This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c:newMETHOP: Remove op_next check
[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 ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin|*msys) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 hostgenerate=''
212 hostosname=''
213 hostperl=''
214 run=''
215 targetarch=''
216 targetdir=''
217 targetenv=''
218 targethost=''
219 targetmkdir=''
220 targetport=''
221 to=''
222 usecrosscompile=''
223 extern_C=''
224 mistrustnm=''
225 usedevel=''
226 perllibs=''
227 dynamic_ext=''
228 extensions=''
229 known_extensions=''
230 nonxs_ext=''
231 static_ext=''
232 useopcode=''
233 useposix=''
234 extras=''
235 d_bsd=''
236 d_eunice=''
237 d_xenix=''
238 eunicefix=''
239 ar=''
240 awk=''
241 bash=''
242 bison=''
243 byacc=''
244 cat=''
245 chgrp=''
246 chmod=''
247 chown=''
248 comm=''
249 compress=''
250 cp=''
251 cpio=''
252 cpp=''
253 csh=''
254 date=''
255 echo=''
256 egrep=''
257 emacs=''
258 expr=''
259 find=''
260 flex=''
261 gmake=''
262 grep=''
263 gzip=''
264 inews=''
265 ksh=''
266 less=''
267 line=''
268 lint=''
269 ln=''
270 lp=''
271 lpr=''
272 ls=''
273 mail=''
274 mailx=''
275 make=''
276 mkdir=''
277 more=''
278 mv=''
279 nm=''
280 nroff=''
281 perl=''
282 pg=''
283 pmake=''
284 pr=''
285 rm=''
286 rmail=''
287 sed=''
288 sendmail=''
289 shar=''
290 sleep=''
291 smail=''
292 sort=''
293 submit=''
294 tail=''
295 tar=''
296 tbl=''
297 tee=''
298 test=''
299 touch=''
300 tr=''
301 troff=''
302 uname=''
303 uniq=''
304 uuname=''
305 vi=''
306 zcat=''
307 zip=''
308 full_ar=''
309 full_sed=''
310 libswanted=''
311 hint=''
312 myuname=''
313 osname=''
314 osvers=''
315 Author=''
316 Date=''
317 Header=''
318 Id=''
319 Locker=''
320 Log=''
321 RCSfile=''
322 Revision=''
323 Source=''
324 State=''
325 sysroot=''
326 _a=''
327 _exe=''
328 _o=''
329 archobjs=''
330 exe_ext=''
331 firstmakefile=''
332 lib_ext=''
333 obj_ext=''
334 path_sep=''
335 rm_try=''
336 afs=''
337 afsroot=''
338 alignbytes=''
339 ansi2knr=''
340 archlib=''
341 archlibexp=''
342 d_archlib=''
343 installarchlib=''
344 archname=''
345 myarchname=''
346 useversionedarchname=''
347 d_atolf=''
348 d_atoll=''
349 baserev=''
350 bin=''
351 binexp=''
352 initialinstalllocation=''
353 installbin=''
354 userelocatableinc=''
355 byteorder=''
356 cc=''
357 ccflags=''
358 cppflags=''
359 ldflags=''
360 lkflags=''
361 locincpth=''
362 optimize=''
363 cf_email=''
364 cf_by=''
365 cf_time=''
366 charbits=''
367 charsize=''
368 contains=''
369 cpp_stuff=''
370 cpplast=''
371 cppminus=''
372 cpprun=''
373 cppstdin=''
374 d__fwalk=''
375 d_access=''
376 d_accessx=''
377 d_acosh=''
378 d_aintl=''
379 d_alarm=''
380 asctime_r_proto=''
381 d_asctime_r=''
382 d_asinh=''
383 d_atanh=''
384 d_attribute_deprecated=''
385 d_attribute_format=''
386 d_attribute_malloc=''
387 d_attribute_nonnull=''
388 d_attribute_noreturn=''
389 d_attribute_pure=''
390 d_attribute_unused=''
391 d_attribute_warn_unused_result=''
392 d_printf_format_null=''
393 d_backtrace=''
394 d_bcmp=''
395 d_bcopy=''
396 d_builtin_choose_expr=''
397 d_builtin_expect=''
398 d_bzero=''
399 d_c99_variadic_macros=''
400 d_casti32=''
401 castflags=''
402 d_castneg=''
403 d_cbrt=''
404 d_chown=''
405 d_chroot=''
406 d_chsize=''
407 d_class=''
408 d_clearenv=''
409 d_closedir=''
410 d_void_closedir=''
411 d_cmsghdr_s=''
412 d_const=''
413 d_copysign=''
414 d_copysignl=''
415 d_cplusplus=''
416 cryptlib=''
417 d_crypt=''
418 crypt_r_proto=''
419 d_crypt_r=''
420 d_csh=''
421 full_csh=''
422 d_ctermid=''
423 ctermid_r_proto=''
424 d_ctermid_r=''
425 ctime_r_proto=''
426 d_ctime_r=''
427 d_cuserid=''
428 d_dbl_dig=''
429 d_dbminitproto=''
430 d_difftime=''
431 d_dir_dd_fd=''
432 d_dirfd=''
433 d_dladdr=''
434 d_dlerror=''
435 d_dlopen=''
436 d_dlsymun=''
437 d_dosuid=''
438 d_suidsafe=''
439 d_drand48_r=''
440 drand48_r_proto=''
441 d_drand48proto=''
442 d_dup2=''
443 d_eaccess=''
444 d_endgrent=''
445 d_endgrent_r=''
446 endgrent_r_proto=''
447 d_endhent=''
448 d_endhostent_r=''
449 endhostent_r_proto=''
450 d_endnent=''
451 d_endnetent_r=''
452 endnetent_r_proto=''
453 d_endpent=''
454 d_endprotoent_r=''
455 endprotoent_r_proto=''
456 d_endpwent=''
457 d_endpwent_r=''
458 endpwent_r_proto=''
459 d_endsent=''
460 d_endservent_r=''
461 endservent_r_proto=''
462 d_erf=''
463 d_erfc=''
464 d_exp2=''
465 d_expm1=''
466 d_faststdio=''
467 d_fchdir=''
468 d_fchmod=''
469 d_fchown=''
470 d_fcntl=''
471 d_fcntl_can_lock=''
472 d_fd_macros=''
473 d_fd_set=''
474 d_fds_bits=''
475 d_fdim=''
476 d_fegetround=''
477 d_fgetpos=''
478 d_finite=''
479 d_finitel=''
480 d_flexfnam=''
481 d_flock=''
482 d_flockproto=''
483 d_fma=''
484 d_fmax=''
485 d_fmin=''
486 d_fork=''
487 d_fp_class=''
488 d_fp_classl=''
489 d_fpclass=''
490 d_fp_classify=''
491 d_fpclassify=''
492 d_fpclassl=''
493 d_fpgetround=''
494 d_fpos64_t=''
495 d_frexpl=''
496 d_fs_data_s=''
497 d_fseeko=''
498 d_fsetpos=''
499 d_fstatfs=''
500 d_fsync=''
501 d_ftello=''
502 d_ftime=''
503 d_gettimeod=''
504 d_futimes=''
505 d_Gconvert=''
506 d_getaddrinfo=''
507 d_getcwd=''
508 d_getespwnam=''
509 d_getfsstat=''
510 d_getgrent=''
511 d_getgrent_r=''
512 getgrent_r_proto=''
513 d_getgrgid_r=''
514 getgrgid_r_proto=''
515 d_getgrnam_r=''
516 getgrnam_r_proto=''
517 d_getgrps=''
518 d_gethbyaddr=''
519 d_gethbyname=''
520 d_gethent=''
521 aphostname=''
522 d_gethname=''
523 d_phostname=''
524 d_uname=''
525 d_gethostbyaddr_r=''
526 gethostbyaddr_r_proto=''
527 d_gethostbyname_r=''
528 gethostbyname_r_proto=''
529 d_gethostent_r=''
530 gethostent_r_proto=''
531 d_gethostprotos=''
532 d_getitimer=''
533 d_getlogin=''
534 d_getlogin_r=''
535 getlogin_r_proto=''
536 d_getmnt=''
537 d_getmntent=''
538 d_getnameinfo=''
539 d_getnbyaddr=''
540 d_getnbyname=''
541 d_getnent=''
542 d_getnetbyaddr_r=''
543 getnetbyaddr_r_proto=''
544 d_getnetbyname_r=''
545 getnetbyname_r_proto=''
546 d_getnetent_r=''
547 getnetent_r_proto=''
548 d_getnetprotos=''
549 d_getpagsz=''
550 d_getpent=''
551 d_getpgid=''
552 d_getpgrp2=''
553 d_bsdgetpgrp=''
554 d_getpgrp=''
555 d_getppid=''
556 d_getprior=''
557 d_getpbyname=''
558 d_getpbynumber=''
559 d_getprotobyname_r=''
560 getprotobyname_r_proto=''
561 d_getprotobynumber_r=''
562 getprotobynumber_r_proto=''
563 d_getprotoent_r=''
564 getprotoent_r_proto=''
565 d_getprotoprotos=''
566 d_getprpwnam=''
567 d_getpwent=''
568 d_getpwent_r=''
569 getpwent_r_proto=''
570 d_getpwnam_r=''
571 getpwnam_r_proto=''
572 d_getpwuid_r=''
573 getpwuid_r_proto=''
574 d_getsent=''
575 d_getservbyname_r=''
576 getservbyname_r_proto=''
577 d_getservbyport_r=''
578 getservbyport_r_proto=''
579 d_getservent_r=''
580 getservent_r_proto=''
581 d_getservprotos=''
582 d_getspnam=''
583 d_getspnam_r=''
584 getspnam_r_proto=''
585 d_getsbyname=''
586 d_getsbyport=''
587 d_gmtime_r=''
588 gmtime_r_proto=''
589 d_gnulibc=''
590 gnulibc_version=''
591 d_hasmntopt=''
592 d_htonl=''
593 d_hypot=''
594 d_ilogb=''
595 d_ilogbl=''
596 d_inetaton=''
597 d_inetntop=''
598 d_inetpton=''
599 d_int64_t=''
600 d_isascii=''
601 d_isblank=''
602 d_isfinite=''
603 d_isfinitel=''
604 d_isinf=''
605 d_isinfl=''
606 d_isless=''
607 d_isnan=''
608 d_isnanl=''
609 d_isnormal=''
610 d_j0=''
611 d_j0l=''
612 d_killpg=''
613 d_lc_monetary_2008=''
614 d_lchown=''
615 d_ldbl_dig=''
616 d_lgamma=''
617 d_lgamma_r=''
618 d_libm_lib_version=''
619 d_link=''
620 d_llrint=''
621 d_llround=''
622 d_localtime_r=''
623 d_localtime_r_needs_tzset=''
624 localtime_r_proto=''
625 d_locconv=''
626 d_lockf=''
627 d_log1p=''
628 d_log2=''
629 d_logb=''
630 d_ldexpl=''
631 d_longdbl=''
632 longdblkind=''
633 longdblsize=''
634 d_longlong=''
635 longlongsize=''
636 d_lrint=''
637 d_lround=''
638 d_lseekproto=''
639 d_lstat=''
640 d_madvise=''
641 d_malloc_good_size=''
642 d_malloc_size=''
643 d_mblen=''
644 d_mbstowcs=''
645 d_mbtowc=''
646 d_memchr=''
647 d_memcmp=''
648 d_memcpy=''
649 d_memmove=''
650 d_memset=''
651 d_mkdir=''
652 d_mkdtemp=''
653 d_mkfifo=''
654 d_mkstemp=''
655 d_mkstemps=''
656 d_mktime=''
657 d_mmap=''
658 mmaptype=''
659 d_modfl=''
660 d_modfl_pow32_bug=''
661 d_modflproto=''
662 d_mprotect=''
663 d_msg=''
664 d_msgctl=''
665 d_msgget=''
666 d_msghdr_s=''
667 d_msgrcv=''
668 d_msgsnd=''
669 d_msync=''
670 d_munmap=''
671 d_nan=''
672 d_nearbyint=''
673 d_nextafter=''
674 d_nexttoward=''
675 d_nice=''
676 d_nl_langinfo=''
677 d_off64_t=''
678 d_open3=''
679 d_fpathconf=''
680 d_pathconf=''
681 d_pause=''
682 d_pipe=''
683 d_poll=''
684 d_portable=''
685 d_prctl=''
686 d_prctl_set_name=''
687 d_procselfexe=''
688 procselfexe=''
689 d_old_pthread_create_joinable=''
690 old_pthread_create_joinable=''
691 d_pthread_atfork=''
692 d_pthread_attr_setscope=''
693 d_pthread_yield=''
694 d_sched_yield=''
695 sched_yield=''
696 d_ptrdiff_t=''
697 d_qgcvt=''
698 d_random_r=''
699 random_r_proto=''
700 d_readdir64_r=''
701 readdir64_r_proto=''
702 d_readdir=''
703 d_rewinddir=''
704 d_seekdir=''
705 d_telldir=''
706 d_readdir_r=''
707 readdir_r_proto=''
708 d_readlink=''
709 d_readv=''
710 d_recvmsg=''
711 d_re_comp=''
712 d_regcmp=''
713 d_regcomp=''
714 d_remainder=''
715 d_remquo=''
716 d_rename=''
717 d_rint=''
718 d_rmdir=''
719 d_round=''
720 d_safebcpy=''
721 d_safemcpy=''
722 d_sanemcmp=''
723 d_sbrkproto=''
724 d_scalbn=''
725 d_scalbnl=''
726 d_select=''
727 d_sem=''
728 d_semctl=''
729 d_semget=''
730 d_semop=''
731 d_sendmsg=''
732 d_setegid=''
733 d_seteuid=''
734 d_setgrent=''
735 d_setgrent_r=''
736 setgrent_r_proto=''
737 d_setgrps=''
738 d_sethent=''
739 d_sethostent_r=''
740 sethostent_r_proto=''
741 d_setitimer=''
742 d_setlinebuf=''
743 d_setlocale=''
744 d_setlocale_r=''
745 setlocale_r_proto=''
746 d_setnent=''
747 d_setnetent_r=''
748 setnetent_r_proto=''
749 d_setpent=''
750 d_setpgid=''
751 d_setpgrp2=''
752 d_bsdsetpgrp=''
753 d_setpgrp=''
754 d_setprior=''
755 d_setproctitle=''
756 d_setprotoent_r=''
757 setprotoent_r_proto=''
758 d_setpwent=''
759 d_setpwent_r=''
760 setpwent_r_proto=''
761 d_setregid=''
762 d_setresgid=''
763 d_setresuid=''
764 d_setreuid=''
765 d_setrgid=''
766 d_setruid=''
767 d_setsent=''
768 d_setservent_r=''
769 setservent_r_proto=''
770 d_setsid=''
771 d_setvbuf=''
772 d_shm=''
773 d_shmat=''
774 d_shmatprototype=''
775 shmattype=''
776 d_shmctl=''
777 d_shmdt=''
778 d_shmget=''
779 d_sigaction=''
780 d_signbit=''
781 d_sigprocmask=''
782 d_sigsetjmp=''
783 usesitecustomize=''
784 d_snprintf=''
785 d_vsnprintf=''
786 d_sockatmark=''
787 d_sockatmarkproto=''
788 d_ip_mreq=''
789 d_ip_mreq_source=''
790 d_ipv6_mreq=''
791 d_ipv6_mreq_source=''
792 d_msg_ctrunc=''
793 d_msg_dontroute=''
794 d_msg_oob=''
795 d_msg_peek=''
796 d_msg_proxy=''
797 d_oldsock=''
798 d_scm_rights=''
799 d_sin6_scope_id=''
800 d_sockaddr_in6=''
801 d_sockaddr_sa_len=''
802 d_socket=''
803 d_sockpair=''
804 sockethdr=''
805 socketlib=''
806 d_socklen_t=''
807 d_socks5_init=''
808 d_sprintf_returns_strlen=''
809 d_sqrtl=''
810 d_srand48_r=''
811 srand48_r_proto=''
812 d_srandom_r=''
813 srandom_r_proto=''
814 d_sresgproto=''
815 d_sresuproto=''
816 d_stat=''
817 d_statblks=''
818 d_statfs_f_flags=''
819 d_statfs_s=''
820 d_static_inline=''
821 perl_static_inline=''
822 d_fstatvfs=''
823 d_statvfs=''
824 d_stdio_cnt_lval=''
825 d_stdio_ptr_lval=''
826 d_stdio_ptr_lval_nochange_cnt=''
827 d_stdio_ptr_lval_sets_cnt=''
828 d_stdiobase=''
829 d_stdstdio=''
830 stdio_base=''
831 stdio_bufsiz=''
832 stdio_cnt=''
833 stdio_filbuf=''
834 stdio_ptr=''
835 d_index=''
836 d_strchr=''
837 d_strcoll=''
838 d_strctcpy=''
839 d_strerrm=''
840 d_strerror=''
841 d_sysernlst=''
842 d_syserrlst=''
843 d_strerror_r=''
844 strerror_r_proto=''
845 d_strftime=''
846 d_strlcat=''
847 d_strlcpy=''
848 d_strtod=''
849 d_strtol=''
850 d_strtold=''
851 d_strtoll=''
852 d_strtoq=''
853 d_strtoul=''
854 d_strtoull=''
855 d_strtouq=''
856 d_strxfrm=''
857 d_symlink=''
858 d_syscall=''
859 d_syscallproto=''
860 d_sysconf=''
861 d_system=''
862 d_tcgetpgrp=''
863 d_tcsetpgrp=''
864 d_telldirproto=''
865 d_tgamma=''
866 d_time=''
867 timetype=''
868 d_asctime64=''
869 d_ctime64=''
870 d_difftime64=''
871 d_gmtime64=''
872 d_localtime64=''
873 d_mktime64=''
874 d_timegm=''
875 clocktype=''
876 d_times=''
877 d_tmpnam_r=''
878 tmpnam_r_proto=''
879 d_trunc=''
880 d_truncate=''
881 d_truncl=''
882 d_ttyname_r=''
883 ttyname_r_proto=''
884 d_tzname=''
885 d_u32align=''
886 d_ualarm=''
887 d_umask=''
888 d_semctl_semid_ds=''
889 d_semctl_semun=''
890 d_union_semun=''
891 d_unordered=''
892 d_unsetenv=''
893 d_usleep=''
894 d_usleepproto=''
895 d_ustat=''
896 d_pseudofork=''
897 d_vfork=''
898 usevfork=''
899 d_voidsig=''
900 signal_t=''
901 d_volatile=''
902 d_charvspr=''
903 d_vprintf=''
904 d_wait4=''
905 d_waitpid=''
906 d_wcscmp=''
907 d_wcstombs=''
908 d_wcsxfrm=''
909 d_wctomb=''
910 d_writev=''
911 dlext=''
912 bin_ELF=''
913 cccdlflags=''
914 ccdlflags=''
915 dlsrc=''
916 ld=''
917 ld_can_script=''
918 lddlflags=''
919 usedl=''
920 doublesize=''
921 ebcdic=''
922 fflushNULL=''
923 fflushall=''
924 fpossize=''
925 fpostype=''
926 gccansipedantic=''
927 gccosandvers=''
928 gccversion=''
929 gidformat=''
930 gidsign=''
931 gidsize=''
932 gidtype=''
933 groupstype=''
934 h_fcntl=''
935 h_sysfile=''
936 html1dir=''
937 html1direxp=''
938 installhtml1dir=''
939 html3dir=''
940 html3direxp=''
941 installhtml3dir=''
942 i_arpainet=''
943 i_assert=''
944 i_bfd=''
945 i_crypt=''
946 db_hashtype=''
947 db_prefixtype=''
948 db_version_major=''
949 db_version_minor=''
950 db_version_patch=''
951 i_db=''
952 i_dbm=''
953 i_rpcsvcdbm=''
954 d_dirnamlen=''
955 direntrytype=''
956 i_dirent=''
957 i_dlfcn=''
958 i_execinfo=''
959 i_fcntl=''
960 i_fenv=''
961 i_float=''
962 i_fp=''
963 i_fp_class=''
964 i_gdbm=''
965 d_grpasswd=''
966 i_grp=''
967 i_ieeefp=''
968 i_inttypes=''
969 i_langinfo=''
970 i_libutil=''
971 i_limits=''
972 i_locale=''
973 i_machcthr=''
974 i_malloc=''
975 i_mallocmalloc=''
976 i_math=''
977 i_memory=''
978 i_mntent=''
979 d_gdbm_ndbm_h_uses_prototypes=''
980 d_gdbmndbm_h_uses_prototypes=''
981 d_ndbm=''
982 d_ndbm_h_uses_prototypes=''
983 i_gdbm_ndbm=''
984 i_gdbmndbm=''
985 i_ndbm=''
986 i_netdb=''
987 i_neterrno=''
988 i_netinettcp=''
989 i_niin=''
990 i_sysin=''
991 i_poll=''
992 i_prot=''
993 i_pthread=''
994 d_pwage=''
995 d_pwchange=''
996 d_pwclass=''
997 d_pwcomment=''
998 d_pwexpire=''
999 d_pwgecos=''
1000 d_pwpasswd=''
1001 d_pwquota=''
1002 i_pwd=''
1003 i_quadmath=''
1004 i_shadow=''
1005 i_socks=''
1006 i_stdbool=''
1007 i_stddef=''
1008 i_stdint=''
1009 i_stdlib=''
1010 i_string=''
1011 strings=''
1012 i_sunmath=''
1013 i_sysaccess=''
1014 i_sysdir=''
1015 i_sysfile=''
1016 d_voidtty=''
1017 i_bsdioctl=''
1018 i_sysfilio=''
1019 i_sysioctl=''
1020 i_syssockio=''
1021 i_syslog=''
1022 i_sysmman=''
1023 i_sysmode=''
1024 i_sysmount=''
1025 i_sysndir=''
1026 i_sysparam=''
1027 i_syspoll=''
1028 i_sysresrc=''
1029 i_syssecrt=''
1030 i_sysselct=''
1031 i_sysstat=''
1032 i_sysstatfs=''
1033 i_sysstatvfs=''
1034 i_systimes=''
1035 i_systypes=''
1036 i_sysuio=''
1037 i_sysun=''
1038 i_sysutsname=''
1039 i_sysvfs=''
1040 i_syswait=''
1041 i_sgtty=''
1042 i_termio=''
1043 i_termios=''
1044 d_tm_tm_gmtoff=''
1045 d_tm_tm_zone=''
1046 i_systime=''
1047 i_systimek=''
1048 i_time=''
1049 timeincl=''
1050 i_unistd=''
1051 i_ustat=''
1052 i_utime=''
1053 i_values=''
1054 i_stdarg=''
1055 i_varargs=''
1056 i_varhdr=''
1057 i_vfork=''
1058 d_inc_version_list=''
1059 inc_version_list=''
1060 inc_version_list_init=''
1061 installprefix=''
1062 installprefixexp=''
1063 installstyle=''
1064 installusrbinperl=''
1065 intsize=''
1066 longsize=''
1067 shortsize=''
1068 issymlink=''
1069 libc=''
1070 ldlibpthname=''
1071 libperl=''
1072 shrpenv=''
1073 useshrplib=''
1074 glibpth=''
1075 incpth=''
1076 libpth=''
1077 loclibpth=''
1078 plibpth=''
1079 xlibpth=''
1080 ignore_versioned_solibs=''
1081 libs=''
1082 libsdirs=''
1083 libsfiles=''
1084 libsfound=''
1085 libspath=''
1086 lns=''
1087 d_PRIEUldbl=''
1088 d_PRIFUldbl=''
1089 d_PRIGUldbl=''
1090 d_PRIeldbl=''
1091 d_PRIfldbl=''
1092 d_PRIgldbl=''
1093 d_SCNfldbl=''
1094 doublekind=''
1095 sPRIEUldbl=''
1096 sPRIFUldbl=''
1097 sPRIGUldbl=''
1098 sPRIeldbl=''
1099 sPRIfldbl=''
1100 sPRIgldbl=''
1101 sSCNfldbl=''
1102 lseeksize=''
1103 lseektype=''
1104 make_set_make=''
1105 d_mymalloc=''
1106 freetype=''
1107 mallocobj=''
1108 mallocsrc=''
1109 malloctype=''
1110 usemallocwrap=''
1111 usemymalloc=''
1112 installman1dir=''
1113 man1dir=''
1114 man1direxp=''
1115 man1ext=''
1116 installman3dir=''
1117 man3dir=''
1118 man3direxp=''
1119 man3ext=''
1120 modetype=''
1121 multiarch=''
1122 mydomain=''
1123 myhostname=''
1124 phostname=''
1125 c=''
1126 n=''
1127 d_eofnblk=''
1128 eagain=''
1129 o_nonblock=''
1130 rd_nodata=''
1131 need_va_copy=''
1132 netdb_hlen_type=''
1133 netdb_host_type=''
1134 netdb_name_type=''
1135 netdb_net_type=''
1136 groupcat=''
1137 hostcat=''
1138 passcat=''
1139 orderlib=''
1140 ranlib=''
1141 d_perl_otherlibdirs=''
1142 otherlibdirs=''
1143 package=''
1144 spackage=''
1145 pager=''
1146 api_revision=''
1147 api_subversion=''
1148 api_version=''
1149 api_versionstring=''
1150 patchlevel=''
1151 perl_patchlevel=''
1152 revision=''
1153 subversion=''
1154 version=''
1155 version_patchlevel_string=''
1156 perl5=''
1157 perladmin=''
1158 perlpath=''
1159 d_nv_preserves_uv=''
1160 d_nv_zero_is_allbits_zero=''
1161 i16size=''
1162 i16type=''
1163 i32size=''
1164 i32type=''
1165 i64size=''
1166 i64type=''
1167 i8size=''
1168 i8type=''
1169 ivsize=''
1170 ivtype=''
1171 nv_overflows_integers_at=''
1172 nv_preserves_uv_bits=''
1173 nvsize=''
1174 nvtype=''
1175 u16size=''
1176 u16type=''
1177 u32size=''
1178 u32type=''
1179 u64size=''
1180 u64type=''
1181 u8size=''
1182 u8type=''
1183 uvsize=''
1184 uvtype=''
1185 ivdformat=''
1186 nvEUformat=''
1187 nvFUformat=''
1188 nvGUformat=''
1189 nveformat=''
1190 nvfformat=''
1191 nvgformat=''
1192 uvXUformat=''
1193 uvoformat=''
1194 uvuformat=''
1195 uvxformat=''
1196 pidtype=''
1197 prefix=''
1198 prefixexp=''
1199 installprivlib=''
1200 privlib=''
1201 privlibexp=''
1202 prototype=''
1203 ptrsize=''
1204 d_PRIXU64=''
1205 d_PRId64=''
1206 d_PRIi64=''
1207 d_PRIo64=''
1208 d_PRIu64=''
1209 d_PRIx64=''
1210 sPRIXU64=''
1211 sPRId64=''
1212 sPRIi64=''
1213 sPRIo64=''
1214 sPRIu64=''
1215 sPRIx64=''
1216 d_quad=''
1217 quadkind=''
1218 quadtype=''
1219 uquadtype=''
1220 drand01=''
1221 randbits=''
1222 randfunc=''
1223 randseedtype=''
1224 seedfunc=''
1225 installscript=''
1226 scriptdir=''
1227 scriptdirexp=''
1228 selectminbits=''
1229 selecttype=''
1230 sh=''
1231 targetsh=''
1232 sig_count=''
1233 sig_name=''
1234 sig_name_init=''
1235 sig_num=''
1236 sig_num_init=''
1237 sig_size=''
1238 d_sitearch=''
1239 installsitearch=''
1240 sitearch=''
1241 sitearchexp=''
1242 installsitebin=''
1243 sitebin=''
1244 sitebinexp=''
1245 installsitehtml1dir=''
1246 sitehtml1dir=''
1247 sitehtml1direxp=''
1248 installsitehtml3dir=''
1249 sitehtml3dir=''
1250 sitehtml3direxp=''
1251 installsitelib=''
1252 sitelib=''
1253 sitelib_stem=''
1254 sitelibexp=''
1255 installsiteman1dir=''
1256 siteman1dir=''
1257 siteman1direxp=''
1258 installsiteman3dir=''
1259 siteman3dir=''
1260 siteman3direxp=''
1261 siteprefix=''
1262 siteprefixexp=''
1263 installsitescript=''
1264 sitescript=''
1265 sitescriptexp=''
1266 sizesize=''
1267 sizetype=''
1268 d_libname_unique=''
1269 so=''
1270 socksizetype=''
1271 sharpbang=''
1272 shsharp=''
1273 spitshell=''
1274 src=''
1275 ssizetype=''
1276 st_ino_sign=''
1277 st_ino_size=''
1278 startperl=''
1279 startsh=''
1280 stdchar=''
1281 d_stdio_stream_array=''
1282 stdio_stream_array=''
1283 sysman=''
1284 sGMTIME_max=''
1285 sGMTIME_min=''
1286 sLOCALTIME_max=''
1287 sLOCALTIME_min=''
1288 trnl=''
1289 uidformat=''
1290 uidsign=''
1291 uidsize=''
1292 uidtype=''
1293 archname64=''
1294 use64bitall=''
1295 use64bitint=''
1296 usecbacktrace=''
1297 dtrace=''
1298 usedtrace=''
1299 usefaststdio=''
1300 usekernprocpathname=''
1301 ccflags_uselargefiles=''
1302 ldflags_uselargefiles=''
1303 libswanted_uselargefiles=''
1304 uselargefiles=''
1305 uselongdouble=''
1306 usemorebits=''
1307 usemultiplicity=''
1308 nm_opt=''
1309 nm_so_opt=''
1310 runnm=''
1311 usenm=''
1312 usensgetexecutablepath=''
1313 useperlio=''
1314 usequadmath=''
1315 usesocks=''
1316 d_oldpthreads=''
1317 use5005threads=''
1318 useithreads=''
1319 usereentrant=''
1320 usethreads=''
1321 incpath=''
1322 mips_type=''
1323 usrinc=''
1324 vaproto=''
1325 d_vendorarch=''
1326 installvendorarch=''
1327 vendorarch=''
1328 vendorarchexp=''
1329 d_vendorbin=''
1330 installvendorbin=''
1331 vendorbin=''
1332 vendorbinexp=''
1333 installvendorhtml1dir=''
1334 vendorhtml1dir=''
1335 vendorhtml1direxp=''
1336 installvendorhtml3dir=''
1337 vendorhtml3dir=''
1338 vendorhtml3direxp=''
1339 d_vendorlib=''
1340 installvendorlib=''
1341 vendorlib=''
1342 vendorlib_stem=''
1343 vendorlibexp=''
1344 installvendorman1dir=''
1345 vendorman1dir=''
1346 vendorman1direxp=''
1347 installvendorman3dir=''
1348 vendorman3dir=''
1349 vendorman3direxp=''
1350 usevendorprefix=''
1351 vendorprefix=''
1352 vendorprefixexp=''
1353 d_vendorscript=''
1354 installvendorscript=''
1355 vendorscript=''
1356 vendorscriptexp=''
1357 versiononly=''
1358 yacc=''
1359 yaccflags=''
1360 CONFIG=''
1361
1362 : Detect odd OSs
1363 define='define'
1364 undef='undef'
1365 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1366 rmlist=''
1367
1368 : We must find out about Eunice early
1369 eunicefix=':'
1370 if test -f /etc/unixtovms; then
1371         eunicefix=/etc/unixtovms
1372 fi
1373 if test -f /etc/unixtovms.exe; then
1374         eunicefix=/etc/unixtovms.exe
1375 fi
1376
1377 : Set executable suffix now -- needed before hints available
1378 if test -f "/libs/version.library"; then
1379 : Amiga OS
1380     _exe=""
1381 elif test -f "/system/gnu_library/bin/ar.pm"; then
1382 : Stratus VOS
1383     _exe=".pm"
1384 elif test -n "$DJGPP"; then
1385 : DOS DJGPP
1386     _exe=".exe"
1387 elif test -f /kern/cookiejar; then
1388 : MiNT
1389     _exe=""
1390 elif test -d c:/. -o -n "$is_os2" ; then
1391 : OS/2 or cygwin
1392     _exe=".exe"
1393 fi
1394
1395 groupstype=''
1396 i_whoami=''
1397 : Trailing extension.  Override this in a hint file, if needed.
1398 : Extra object files, if any, needed on this platform.
1399 archobjs=''
1400 archname=''
1401 : Possible local include directories to search.
1402 : Set locincpth to "" in a hint file to defeat local include searches.
1403 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1404 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1405 :
1406 : no include file wanted by default
1407 inclwanted=''
1408
1409 : Enable -DEBUGGING and -DDEBUGGING from the command line
1410 EBUGGING=''
1411 DEBUGGING=''
1412
1413 libnames=''
1414 : change the next line if compiling for Xenix/286 on Xenix/386
1415 xlibpth='/usr/lib/386 /lib/386'
1416 : Possible local library directories to search.
1417 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1418 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1419
1420 : general looking path for locating libraries
1421 glibpth="/lib /usr/lib $xlibpth"
1422 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1423 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1424 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1425 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1426
1427 : Private path used by Configure to find libraries.  Its value
1428 : is prepended to libpth. This variable takes care of special
1429 : machines, like the mips.  Usually, it should be empty.
1430 plibpth=''
1431
1432 : default library list
1433 libswanted=''
1434 : some systems want to use only the non-versioned libso:s
1435 ignore_versioned_solibs=''
1436 : set usethreads on the Configure command line to enable threads.
1437 usereentrant='undef'
1438 ccname=''
1439 ccversion=''
1440 perllibs=''
1441 : set useposix=false in your hint file to disable the POSIX extension.
1442 useposix=true
1443 : set useopcode=false in your hint file to disable the Opcode extension.
1444 useopcode=true
1445 archname64=''
1446 ccflags_uselargefiles=''
1447 ldflags_uselargefiles=''
1448 libswanted_uselargefiles=''
1449 : set usemultiplicity on the Configure command line to enable multiplicity.
1450 : set usesocks on the Configure command line to enable socks.
1451 : List of libraries we want.
1452 : If anyone needs extra -lxxx, put those in a hint file.
1453 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1454 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1455 : We probably want to search /usr/shlib before most other libraries.
1456 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1457 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1458 glibpth="/usr/shlib $glibpth"
1459 : Do not use vfork unless overridden by a hint file.
1460 usevfork=false
1461
1462 : Find the basic shell for Bourne shell scripts
1463 case "$sh" in
1464 '')
1465         case "$SYSTYPE" in
1466         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1467         *) xxx='/bin/sh';;
1468         esac
1469         if test -f "$xxx"; then
1470                 sh="$xxx"
1471         else
1472                 : Build up a list and do a single loop so we can 'break' out.
1473                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1474                 for xxx in sh bash ksh pdksh ash; do
1475                         for p in $pth; do
1476                                 try="$try ${p}/${xxx}"
1477                         done
1478                 done
1479                 for xxx in $try; do
1480                         if test -f "$xxx"; then
1481                                 sh="$xxx";
1482                                 break
1483                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1484                                 sh="$xxx";
1485                                 break
1486                         elif test -f "$xxx.exe"; then
1487                                 sh="$xxx";
1488                                 break
1489                         fi
1490                 done
1491         fi
1492         ;;
1493 esac
1494
1495 case "$sh" in
1496 '')     cat >&2 <<EOM
1497 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1498
1499 Usually it's in /bin/sh.  How did you even get this far?
1500 Please contact me (Perl Maintainers) at perlbug@perl.org and
1501 we'll try to straighten this all out.
1502 EOM
1503         exit 1
1504         ;;
1505 esac
1506
1507 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1508 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1509 targetsh=$sh
1510
1511 : see if sh knows # comments
1512 if `$sh -c '#' >/dev/null 2>&1`; then
1513         shsharp=true
1514         spitshell=cat
1515         xcat=/bin/cat
1516         test -f $xcat$_exe || xcat=/usr/bin/cat
1517         if test ! -f $xcat$_exe; then
1518                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1519                         if test -f $p/cat$_exe; then
1520                                 xcat=$p/cat
1521                                 break
1522                         fi
1523                 done
1524                 if test ! -f $xcat$_exe; then
1525                         echo "Can't find cat anywhere!"
1526                         exit 1
1527                 fi
1528         fi
1529         echo "#!$xcat" >sharp
1530         $eunicefix sharp
1531         chmod +x sharp
1532         ./sharp > today 2>/dev/null
1533         if test -s today; then
1534                 sharpbang='#!'
1535         else
1536                 echo "#! $xcat" > sharp
1537                 $eunicefix sharp
1538                 chmod +x sharp
1539                 ./sharp > today 2>/dev/null
1540                 if test -s today; then
1541                         sharpbang='#! '
1542                 else
1543                         sharpbang=': use '
1544                 fi
1545         fi
1546 else
1547         echo " "
1548         echo "Your $sh doesn't grok # comments--I will strip them later on."
1549         shsharp=false
1550         cd ..
1551         echo "exec grep -v '^[  ]*#'" >spitshell
1552         chmod +x spitshell
1553         $eunicefix spitshell
1554         spitshell=`pwd`/spitshell
1555         cd UU
1556         echo "I presume that if # doesn't work, #! won't work either!"
1557         sharpbang=': use '
1558 fi
1559 rm -f sharp today
1560
1561 : figure out how to guarantee sh startup
1562 case "$startsh" in
1563 '') startsh=${sharpbang}${sh} ;;
1564 *)
1565 esac
1566 cat >sharp <<EOSS
1567 $startsh
1568 set abc
1569 test "$?abc" != 1
1570 EOSS
1571
1572 chmod +x sharp
1573 $eunicefix sharp
1574 if ./sharp; then
1575         : echo "Yup, it does."
1576 else
1577         echo "Hmm... '$startsh' does not guarantee sh startup..."
1578         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1579 fi
1580 rm -f sharp
1581
1582 : Save command line options in file UU/cmdline.opt for later use in
1583 : generating config.sh.
1584 cat > cmdline.opt <<EOSH
1585 : Configure command line arguments.
1586 config_arg0='$0'
1587 config_args='$*'
1588 config_argc=$#
1589 EOSH
1590 argn=1
1591 args_exp=''
1592 args_sep=''
1593 for arg in "$@"; do
1594         cat >>cmdline.opt <<EOSH
1595 config_arg$argn='$arg'
1596 EOSH
1597         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1598 $arg
1599 EOC
1600         arg_exp=`cat cmdl.opt`
1601         args_exp="$args_exp$args_sep'$arg_exp'"
1602         argn=`expr $argn + 1`
1603         args_sep=' '
1604 done
1605 rm -f cmdl.opt
1606
1607 : produce awk script to parse command line options
1608 cat >options.awk <<'EOF'
1609 BEGIN {
1610         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1611
1612         len = length(optstr);
1613         for (i = 1; i <= len; i++) {
1614                 c = substr(optstr, i, 1);
1615                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1616                 if (a == ":") {
1617                         arg[c] = 1;
1618                         i++;
1619                 }
1620                 opt[c] = 1;
1621         }
1622 }
1623 {
1624         expect = 0;
1625         str = $0;
1626         if (substr(str, 1, 1) != "-") {
1627                 printf("'%s'\n", str);
1628                 next;
1629         }
1630         len = length($0);
1631         for (i = 2; i <= len; i++) {
1632                 c = substr(str, i, 1);
1633                 if (!opt[c]) {
1634                         printf("-%s\n", substr(str, i));
1635                         next;
1636                 }
1637                 printf("-%s\n", c);
1638                 if (arg[c]) {
1639                         if (i < len)
1640                                 printf("'%s'\n", substr(str, i + 1));
1641                         else
1642                                 expect = 1;
1643                         next;
1644                 }
1645         }
1646 }
1647 END {
1648         if (expect)
1649                 print "?";
1650 }
1651 EOF
1652
1653 : process the command line options
1654 set X `for arg in "$@"; do echo "X$arg"; done |
1655         sed -e s/X// | awk -f options.awk`
1656 eval "set $*"
1657 shift
1658 rm -f options.awk
1659
1660 : set up default values
1661 fastread=''
1662 reuseval=false
1663 config_sh=''
1664 alldone=''
1665 error=''
1666 silent=''
1667 extractsh=''
1668 override=''
1669 knowitall=''
1670 rm -f optdef.sh posthint.sh
1671 cat >optdef.sh <<EOS
1672 $startsh
1673 EOS
1674
1675
1676 : option parsing
1677 while test $# -gt 0; do
1678         case "$1" in
1679         -d) shift; fastread=yes;;
1680         -e) shift; alldone=cont;;
1681         -f)
1682                 shift
1683                 cd ..
1684                 if test -r "$1"; then
1685                         config_sh="$1"
1686                 else
1687                         echo "$me: cannot read config file $1." >&2
1688                         error=true
1689                 fi
1690                 cd UU
1691                 shift;;
1692         --help|\
1693         -h) shift; error=true;;
1694         -r) shift; reuseval=true;;
1695         -s) shift; silent=true; realsilent=true;;
1696         -E) shift; alldone=exit;;
1697         -K) shift; knowitall=true;;
1698         -O) shift; override=true;;
1699         -S) shift; silent=true; extractsh=true;;
1700         -D)
1701                 shift
1702                 case "$1" in
1703                 *=)
1704                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1705                         echo "$me: ignoring -D $1" >&2
1706                         ;;
1707                 *=*) echo "$1" | \
1708                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1709                 *) echo "$1='define'" >> optdef.sh;;
1710                 esac
1711                 shift
1712                 ;;
1713         -U)
1714                 shift
1715                 case "$1" in
1716                 *=) echo "$1" >> optdef.sh;;
1717                 *=*)
1718                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1719                         echo "$me: ignoring -U $1" >&2
1720                         ;;
1721                 *) echo "$1='undef'" >> optdef.sh;;
1722                 esac
1723                 shift
1724                 ;;
1725         -A)
1726             shift
1727             xxx=''
1728             yyy="$1"
1729             zzz=''
1730             uuu=undef
1731             case "$yyy" in
1732             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1733                  case "$zzz" in
1734                  *:*) zzz='' ;;
1735                  *)   xxx=append
1736                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1737                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1738                  esac
1739                  ;;
1740             esac
1741             case "$xxx" in
1742             '')  case "$yyy" in
1743                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1744                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1745                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1746                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1747                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1748                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1749                  esac
1750                  ;;
1751             esac
1752             case "$xxx" in
1753             append)
1754                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1755             clear)
1756                 echo "$yyy=''"                  >> posthint.sh ;;
1757             define)
1758                 case "$zzz" in
1759                 '') zzz=define ;;
1760                 esac
1761                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1762             eval)
1763                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1764             prepend)
1765                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1766             undef)
1767                 case "$zzz" in
1768                 '') zzz="$uuu" ;;
1769                 esac
1770                 echo "$yyy=$zzz"                >> posthint.sh ;;
1771             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1772             esac
1773             shift
1774             ;;
1775         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1776             exit 0;;
1777         --) break;;
1778         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1779         *) break;;
1780         esac
1781 done
1782
1783 case "$error" in
1784 true)
1785         cat >&2 <<EOM
1786 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1787                  [-U symbol] [-U symbol=] [-A command:symbol...]
1788   -d : use defaults for all answers.
1789   -e : go on without questioning past the production of config.sh.
1790   -f : specify an alternate default configuration file.
1791   -h : print this help message and exit (with an error status).
1792   -r : reuse C symbols value if possible (skips costly nm extraction).
1793   -s : silent mode, only echoes questions and essential information.
1794   -D : define symbol to have some value:
1795          -D symbol         symbol gets the value 'define'
1796          -D symbol=value   symbol gets the value 'value'
1797        common used examples (see INSTALL for more info):
1798          -Duse64bitint            use 64bit integers
1799          -Duse64bitall            use 64bit integers and pointers
1800          -Dusethreads             use thread support
1801          -Dinc_version_list=none  do not include older perl trees in @INC
1802          -DEBUGGING=none          DEBUGGING options
1803          -Dcc=gcc                 choose your compiler
1804          -Dprefix=/opt/perl5      choose your destination
1805   -E : stop at the end of questions, after having produced config.sh.
1806   -K : do not use unless you know what you are doing.
1807   -O : let -D and -U override definitions from loaded configuration file.
1808   -S : perform variable substitutions on all .SH files (can mix with -f)
1809   -U : undefine symbol:
1810          -U symbol    symbol gets the value 'undef'
1811          -U symbol=   symbol gets completely empty
1812        e.g.:  -Uversiononly
1813   -A : manipulate symbol after the platform specific hints have been applied:
1814          -A append:symbol=value   append value to symbol
1815          -A symbol=value          like append:, but with a separating space
1816          -A define:symbol=value   define symbol to have value
1817          -A clear:symbol          define symbol to be ''
1818          -A define:symbol         define symbol to be 'define'
1819          -A eval:symbol=value     define symbol to be eval of value
1820          -A prepend:symbol=value  prepend value to symbol
1821          -A undef:symbol          define symbol to be 'undef'
1822          -A undef:symbol=         define symbol to be ''
1823        e.g.:  -A prepend:libswanted='cl pthread '
1824               -A ccflags=-DSOME_MACRO
1825   -V : print version number and exit (with a zero status).
1826 EOM
1827         exit 1
1828         ;;
1829 esac
1830
1831 : Sanity checks
1832 case "$fastread$alldone" in
1833 yescont|yesexit) ;;
1834 *)
1835         case "$extractsh" in
1836         true) ;;
1837         *)
1838                 if test ! -t 0; then
1839                         echo "Say 'sh Configure', not 'sh <Configure'"
1840                         exit 1
1841                 fi
1842                 ;;
1843         esac
1844         ;;
1845 esac
1846
1847 exec 4>&1
1848 case "$silent" in
1849 true) exec 1>/dev/null;;
1850 esac
1851
1852 : run the defines and the undefines, if any, but leave the file out there...
1853 touch optdef.sh
1854 . ./optdef.sh
1855 : create the posthint manipulation script and leave the file out there...
1856 touch posthint.sh
1857
1858 : set package name
1859 package='perl5'
1860 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1861 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1862 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1863 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1864 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1865 esac
1866
1867 : Some greps do not return status, grrr.
1868 echo "grimblepritz" >grimble
1869 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1870         contains=contains
1871 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1872         contains=grep
1873 else
1874         contains=contains
1875 fi
1876 rm -f grimble
1877 : the following should work in any shell
1878 case "$contains" in
1879 contains*)
1880         echo " "
1881         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1882         cat >contains <<'EOSS'
1883 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1884 EOSS
1885 chmod +x contains
1886 esac
1887
1888 : Find the path to the source tree
1889 case "$src" in
1890 '') case "$0" in
1891     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1892          case "$src" in
1893          /*)    ;;
1894          .)     ;;
1895          *)     src=`cd ../$src && pwd` ;;
1896          esac
1897          ;;
1898     *)   src='.';;
1899     esac;;
1900 esac
1901 case "$src" in
1902 '')     src=/
1903         rsrc=/
1904         ;;
1905 /*)     rsrc="$src";;
1906 *)      rsrc="../$src";;
1907 esac
1908 if test -f $rsrc/Configure && \
1909         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1910 then
1911    : found it, so we are ok.
1912 else
1913         rsrc=''
1914         for src in . .. ../.. ../../.. ../../../..; do
1915                 if test -f ../$src/Configure && \
1916                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1917                 then
1918                         rsrc=../$src
1919                         break
1920                 fi
1921         done
1922 fi
1923 case "$rsrc" in
1924 '')
1925         cat <<EOM >&4
1926
1927 Sorry, I can't seem to locate the source dir for $package.  Please start
1928 Configure with an explicit path -- i.e. /some/path/Configure.
1929
1930 EOM
1931         exit 1
1932         ;;
1933 ../.)   rsrc='..';;
1934 *)
1935         echo " "
1936         echo "Sources for $package found in \"$src\"." >&4
1937         ;;
1938 esac
1939
1940 : script used to extract .SH files with variable substitutions
1941 cat >extract <<'EOS'
1942 PERL_CONFIG_SH=true
1943 echo "Doing variable substitutions on .SH files..."
1944 if test -f MANIFEST; then
1945         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1946 else
1947         echo "(Looking for .SH files under the source directory.)"
1948         set x `(cd "$src"; find . -name "*.SH" -print)`
1949 fi
1950 shift
1951 case $# in
1952 0) set x `(cd "$src"; echo *.SH)`; shift;;
1953 esac
1954 if test ! -f "$src/$1"; then
1955         shift
1956 fi
1957 mkdir_p='
1958 name=$1;
1959 create="";
1960 while test $name; do
1961         if test ! -d "$name"; then
1962                 create="$name $create";
1963                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1964                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1965         else
1966                 name="";
1967         fi;
1968 done;
1969 for file in $create; do
1970         mkdir $file;
1971 done
1972 '
1973 for file in $*; do
1974         case "$src" in
1975         ".")
1976                 case "$file" in
1977                 */*)
1978                         dir=`expr X$file : 'X\(.*\)/'`
1979                         file=`expr X$file : 'X.*/\(.*\)'`
1980                         (cd "$dir" && . ./$file)
1981                         ;;
1982                 *)
1983                         . ./$file
1984                         ;;
1985                 esac
1986                 ;;
1987         *)
1988                 case "$file" in
1989                 */*)
1990                         dir=`expr X$file : 'X\(.*\)/'`
1991                         file=`expr X$file : 'X.*/\(.*\)'`
1992                         (set x $dir; shift; eval $mkdir_p)
1993                         sh <"$src/$dir/$file"
1994                         ;;
1995                 *)
1996                         sh <"$src/$file"
1997                         ;;
1998                 esac
1999                 ;;
2000         esac
2001 done
2002 if test -f "$src/config_h.SH"; then
2003         if test ! -f config.h; then
2004         : oops, they left it out of MANIFEST, probably, so do it anyway.
2005         . "$src/config_h.SH"
2006         fi
2007 fi
2008 EOS
2009
2010 : extract files and exit if asked to do so
2011 case "$extractsh" in
2012 true)
2013         case "$realsilent" in
2014         true) ;;
2015         *) exec 1>&4;;
2016         esac
2017         case "$config_sh" in
2018         '') config_sh='config.sh';;
2019         esac
2020         echo " "
2021         echo "Fetching answers from $config_sh..."
2022         cd ..
2023         . $config_sh
2024         test "$override" && . ./optdef.sh
2025         echo " "
2026         . UU/extract
2027         rm -rf UU
2028         echo "Extraction done."
2029         exit 0
2030         ;;
2031 esac
2032
2033 : Eunice requires " " instead of "", can you believe it
2034 echo " "
2035 : Here we go...
2036 echo "Beginning of configuration questions for $package."
2037
2038 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2039
2040 : first determine how to suppress newline on echo command
2041 echo " "
2042 echo "Checking echo to see how to suppress newlines..."
2043 (echo "hi there\c" ; echo " ") >.echotmp
2044 if $contains c .echotmp >/dev/null 2>&1 ; then
2045         echo "...using -n."
2046         n='-n'
2047         c=''
2048 else
2049         cat <<'EOM'
2050 ...using \c
2051 EOM
2052         n=''
2053         c='\c'
2054 fi
2055 echo $n "The star should be here-->$c"
2056 echo '*'
2057 rm -f .echotmp
2058
2059 : Now test for existence of everything in MANIFEST
2060 echo " "
2061 if test -f "$rsrc/MANIFEST"; then
2062         echo "First let's make sure your kit is complete.  Checking..." >&4
2063         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2064                 (split -l 50 2>/dev/null || split -50)
2065         rm -f missing
2066         tmppwd=`pwd`
2067         for filelist in x??; do
2068                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2069                         >/dev/null 2>>"$tmppwd/missing")
2070         done
2071         if test -s missing; then
2072                 cat missing >&4
2073                 cat >&4 <<'EOM'
2074
2075 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2076
2077 You have the option of continuing the configuration process, despite the
2078 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2079 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2080 and contact the author (perlbug@perl.org).
2081
2082 EOM
2083                 echo $n "Continue? [n] $c" >&4
2084                 read ans
2085                 case "$ans" in
2086                 y*)
2087                         echo "Continuing..." >&4
2088                         rm -f missing
2089                         ;;
2090                 *)
2091                         echo "ABORTING..." >&4
2092                         kill $$
2093                         ;;
2094                 esac
2095         else
2096                 echo "Looks good..."
2097         fi
2098 else
2099         echo "There is no MANIFEST file.  I hope your kit is complete !"
2100 fi
2101 rm -f missing x??
2102
2103 : Find the appropriate value for a newline for tr
2104 echo " "
2105 if test -n "$DJGPP"; then
2106        trnl='\012'
2107 fi
2108 if test X"$trnl" = X; then
2109         case "`echo foo|tr '\n' x 2>/dev/null`" in
2110         foox) trnl='\n' ;;
2111         esac
2112 fi
2113 if test X"$trnl" = X; then
2114         case "`echo foo|tr '\012' x 2>/dev/null`" in
2115         foox) trnl='\012' ;;
2116         esac
2117 fi
2118 if test X"$trnl" = X; then
2119        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2120        fooxy) trnl='\n\r' ;;
2121        esac
2122 fi
2123 if test X"$trnl" = X; then
2124         cat <<EOM >&2
2125
2126 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2127
2128 EOM
2129         exit 1
2130 fi
2131
2132 : compute the number of columns on the terminal for proper question formatting
2133 case "$COLUMNS" in
2134 '') COLUMNS='80';;
2135 esac
2136
2137 : set up the echo used in my read
2138 myecho="case \"\$xxxm\" in
2139 '') echo $n \"\$rp $c\" >&4;;
2140 *) case \"\$rp\" in
2141         '') echo $n \"[\$xxxm] $c\";;
2142         *)
2143                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2144                         echo \"\$rp\" >&4
2145                         echo $n \"[\$xxxm] $c\" >&4
2146                 else
2147                         echo $n \"\$rp [\$xxxm] $c\" >&4
2148                 fi
2149                 ;;
2150         esac;;
2151 esac"
2152
2153 : now set up to do reads with possible shell escape and default assignment
2154 cat <<EOSC >myread
2155 $startsh
2156 xxxm=\$dflt
2157 $myecho
2158 ans='!'
2159 case "\$fastread" in
2160 yes) case "\$dflt" in
2161         '') ;;
2162         *) ans='';
2163                 case "\$silent-\$rp" in
2164                 true-) ;;
2165                 *) echo " " >&4;;
2166                 esac;;
2167         esac;;
2168 *) case "\$silent" in
2169         true) case "\$rp" in
2170                 '') ans='';;
2171                 esac;;
2172         esac;;
2173 esac
2174 while expr "X\$ans" : "X!" >/dev/null; do
2175         read answ
2176         set x \$xxxm
2177         shift
2178         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2179         case  "\$answ" in
2180         "!")
2181                 sh 1>&4
2182                 echo " "
2183                 $myecho
2184                 ;;
2185         !*)
2186                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2187                 shift
2188                 sh 1>&4 -c "\$*"
2189                 echo " "
2190                 $myecho
2191                 ;;
2192         "\$ans")
2193                 case "\$ans" in
2194                 \\&*)
2195                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2196                         shift
2197                         case "\$1" in
2198                         -d)
2199                                 fastread=yes
2200                                 echo "(OK, I'll run with -d after this question.)" >&4
2201                                 ;;
2202                         -*)
2203                                 echo "*** Sorry, \$1 not supported yet." >&4
2204                                 ;;
2205                         esac
2206                         $myecho
2207                         ans=!
2208                         ;;
2209                 esac;;
2210         *)
2211                 case "\$aok" in
2212                 y)
2213                         echo "*** Substitution done -- please confirm."
2214                         xxxm="\$ans"
2215                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2216                         xxxm="\$ans"
2217                         ans=!
2218                         ;;
2219                 *)
2220                         echo "*** Error -- try again."
2221                         ans=!
2222                         ;;
2223                 esac
2224                 $myecho
2225                 ;;
2226         esac
2227         case "\$ans\$xxxm\$nostick" in
2228         '')
2229                 ans=!
2230                 $myecho
2231                 ;;
2232         esac
2233 done
2234 case "\$ans" in
2235 '') ans="\$xxxm";;
2236 esac
2237 EOSC
2238
2239 : create .config dir to save info across Configure sessions
2240 test -d ../.config || mkdir ../.config
2241 cat >../.config/README <<EOF
2242 This directory created by Configure to save information that should
2243 persist across sessions for $package.
2244
2245 You may safely delete it if you wish.
2246 EOF
2247
2248 : See if we are using a devel version and want that
2249 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2250 case "$usedevel" in
2251 $define|true|[yY]*)
2252     usedevel="$define" ;;
2253 *) case "$xversion" in
2254    *[13579])
2255         cat >&4 <<EOH
2256 *** WHOA THERE!!! ***
2257
2258     This is an UNSTABLE DEVELOPMENT release.
2259     The version of this $package distribution is $xversion, that is, odd,
2260     (as opposed to even) and that signifies a development release.
2261     If you want a maintenance release, you want an even-numbered version.
2262
2263     Do ***NOT*** install this into production use.
2264     Data corruption and crashes are possible.
2265
2266     It is most seriously suggested that you do not continue any further
2267     unless you want to help in developing and debugging Perl.
2268
2269     If you *still* want to build perl, you can answer 'y' now,
2270     or pass -Dusedevel to Configure.
2271
2272 EOH
2273         rp='Do you really want to continue?'
2274         dflt='n'
2275         . ./myread
2276         case "$ans" in
2277         [yY]) echo >&4 "Okay, continuing."
2278               usedevel="$define" ;;
2279         *) echo >&4 "Okay, bye."
2280            exit 1
2281            ;;
2282         esac
2283         ;;
2284     esac
2285     usedevel="$undef"
2286     ;;
2287 esac
2288 case "$usedevel" in
2289 $define|true|[yY]*)
2290         case "$versiononly" in
2291         '') versiononly="$define" ;;
2292         esac
2293         case "$installusrbinperl" in
2294         '') installusrbinperl="$undef" ;;
2295         esac
2296         ;;
2297 esac
2298
2299 : general instructions
2300 needman=true
2301 firsttime=true
2302 user=`(logname) 2>/dev/null`
2303 case "$user" in
2304 '') user=`whoami 2>&1`;;
2305 esac
2306 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2307         firsttime=false
2308         echo " "
2309         rp='Would you like to see the instructions?'
2310         dflt=n
2311         . ./myread
2312         case "$ans" in
2313         [yY]*) ;;
2314         *) needman=false;;
2315         esac
2316 fi
2317 if $needman; then
2318         cat <<EOH
2319
2320 This installation shell script will examine your system and ask you questions
2321 to determine how the perl5 package should be installed. If you get
2322 stuck on a question, you may use a ! shell escape to start a subshell or
2323 execute a command.  Many of the questions will have default answers in square
2324 brackets; typing carriage return will give you the default.
2325
2326 On some of the questions which ask for file or directory names you are allowed
2327 to use the ~name construct to specify the login directory belonging to "name",
2328 even if you don't have a shell which knows about that.  Questions where this is
2329 allowed will be marked "(~name ok)".
2330
2331 EOH
2332         rp=''
2333         dflt='Type carriage return to continue'
2334         . ./myread
2335         cat <<'EOH'
2336
2337 The prompter used in this script allows you to use shell variables and
2338 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2339 in the default answer, as if the default line was a set of arguments given to a
2340 script shell.  This means you may also use $* to repeat the whole default line,
2341 so you do not have to re-type everything to add something to the default.
2342
2343 Every time there is a substitution, you will have to confirm.  If there is an
2344 error (e.g. an unmatched backtick), the default answer will remain unchanged
2345 and you will be prompted again.
2346
2347 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2348 the questions and use the computed defaults (or the previous answers if there
2349 was already a config.sh file). Type 'Configure -h' for a list of options.
2350 You may also start interactively and then answer '& -d' at any prompt to turn
2351 on the non-interactive behaviour for the remainder of the execution.
2352
2353 EOH
2354         . ./myread
2355         cat <<EOH
2356
2357 Much effort has been expended to ensure that this shell script will run on any
2358 Unix system.  If despite that it blows up on yours, your best bet is to edit
2359 Configure and run it again.  If you can't run Configure for some reason,
2360 you'll have to generate a config.sh file by hand.  Whatever problems you
2361 have, let me (perlbug@perl.org) know how I blew it.
2362
2363 This installation script affects things in two ways:
2364
2365 1) it may do direct variable substitutions on some of the files included
2366    in this kit.
2367 2) it builds a config.h file for inclusion in C programs.  You may edit
2368    any of these files as the need arises after running this script.
2369
2370 If you make a mistake on a question, there is no easy way to back up to it
2371 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2372 files.  Configure will offer to let you do this before it runs the SH files.
2373
2374 EOH
2375         dflt='Type carriage return to continue'
2376         . ./myread
2377         case "$firsttime" in
2378         true) echo $user >>../.config/instruct;;
2379         esac
2380 fi
2381
2382 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2383 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2384 if test "X$sysroot" = X; then
2385     sysroot=""
2386 else
2387     case "$cc" in
2388         *gcc*|*g++*)
2389             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2390             # _sysroot is used in places where we need --sysroot=foo
2391             # but using the rest of the flags could cause issues.
2392             _sysroot="--sysroot=$sysroot";
2393             case "$ccflags" in
2394                 *sysroot*) ;;
2395                 'undef'|*)
2396                 ccflags="$ccflags $_sysroot"
2397             esac
2398             case "$ldflags" in
2399                 *sysroot*) ;;
2400                 'undef'|*)
2401                 ldflags="$ldflags $_sysroot"
2402             esac
2403             case "$cppflags" in
2404                 *sysroot*) ;;
2405                 'undef'|*)
2406                 cppflags="$cppflags $_sysroot"
2407             esac
2408             # lddlflags updated below in lddlflags section;
2409             # same with cccdlflags
2410             ;;
2411     esac
2412
2413     # Adjust some defaults to also use $sysroot
2414     for var in xlibpth loclibpth locincpth glibpth; do
2415         eval xxx=\$$var
2416         eval $var=''
2417         for path in $xxx; do
2418             eval $var=\"\$$var $sysroot$path\"
2419         done
2420     done
2421
2422 fi
2423
2424 : find out where common programs are
2425 echo " "
2426 echo "Locating common programs..." >&4
2427 cat <<EOSC >loc
2428 $startsh
2429 case \$# in
2430 0) exit 1;;
2431 esac
2432 thing=\$1
2433 shift
2434 dflt=\$1
2435 shift
2436 for dir in \$*; do
2437         case "\$thing" in
2438         .)
2439         if test -d \$dir/\$thing; then
2440                 echo \$dir
2441                 exit 0
2442         fi
2443         ;;
2444         *)
2445         for thisthing in \$dir/\$thing; do
2446                 : just loop through to pick last item
2447         done
2448         if test -f \$thisthing; then
2449                 echo \$thisthing
2450                 exit 0
2451         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2452                 echo \$thisthing
2453                 exit 0
2454         elif test -f \$dir/\$thing.exe; then
2455                 if test -n "$DJGPP"; then
2456                         echo \$dir/\$thing.exe
2457                 elif test "$eunicefix" != ":"; then
2458                         : on Eunice apparently
2459                         echo \$dir/\$thing
2460                 fi
2461                 exit 0
2462         fi
2463         ;;
2464         esac
2465 done
2466 echo \$dflt
2467 exit 1
2468 EOSC
2469 chmod +x loc
2470 $eunicefix loc
2471 loclist="
2472 awk
2473 cat
2474 chmod
2475 comm
2476 cp
2477 echo
2478 expr
2479 grep
2480 ls
2481 mkdir
2482 rm
2483 sed
2484 sort
2485 touch
2486 tr
2487 uniq
2488 "
2489 trylist="
2490 ar
2491 bison
2492 byacc
2493 cpp
2494 csh
2495 date
2496 egrep
2497 gmake
2498 gzip
2499 less
2500 ln
2501 make
2502 more
2503 nm
2504 nroff
2505 perl
2506 pg
2507 test
2508 uname
2509 zip
2510 "
2511 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2512 pth="$pth $sysroot/lib $sysroot/usr/lib"
2513 for file in $loclist; do
2514         eval xxx=\$$file
2515         case "$xxx" in
2516         /*|?:[\\/]*)
2517                 if test -f "$xxx"; then
2518                         : ok
2519                 else
2520                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2521                         xxx=`./loc $file $file $pth`
2522                 fi
2523                 ;;
2524         '') xxx=`./loc $file $file $pth`;;
2525         *) xxx=`./loc $xxx $xxx $pth`;;
2526         esac
2527         eval $file=$xxx$_exe
2528         eval _$file=$xxx
2529         case "$xxx" in
2530         /*)
2531                 echo $file is in $xxx.
2532                 ;;
2533         ?:[\\/]*)
2534                 echo $file is in $xxx.
2535                 ;;
2536         *)
2537                 echo "I don't know where '$file' is, and my life depends on it." >&4
2538                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2539                 exit 1
2540                 ;;
2541         esac
2542 done
2543 echo " "
2544 echo "Don't worry if any of the following aren't found..."
2545 say=offhand
2546 for file in $trylist; do
2547         eval xxx=\$$file
2548         case "$xxx" in
2549         /*|?:[\\/]*)
2550                 if test -f "$xxx"; then
2551                         : ok
2552                 else
2553                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2554                         xxx=`./loc $file $file $pth`
2555                 fi
2556                 ;;
2557         '') xxx=`./loc $file $file $pth`;;
2558         *) xxx=`./loc $xxx $xxx $pth`;;
2559         esac
2560         eval $file=$xxx$_exe
2561         eval _$file=$xxx
2562         case "$xxx" in
2563         /*)
2564                 echo $file is in $xxx.
2565                 ;;
2566         ?:[\\/]*)
2567                 echo $file is in $xxx.
2568                 ;;
2569         *)
2570                 echo "I don't see $file out there, $say."
2571                 say=either
2572                 ;;
2573         esac
2574 done
2575 case "$egrep" in
2576 egrep)
2577         echo "Substituting grep for egrep."
2578         egrep=$grep
2579         _egrep=$grep
2580         ;;
2581 esac
2582 case "$less" in
2583 '')     ;;
2584 *)      if $less -R </dev/null >/dev/null 2>&1; then
2585                echo "Substituting less -R for less."
2586                less="$less -R"
2587                _less=$less
2588         fi
2589         ;;
2590 esac
2591 case "$ln" in
2592 ln)
2593         echo "Substituting cp for ln."
2594         ln=$cp
2595         _ln=$cp
2596         ;;
2597 esac
2598 case "$make" in
2599 make)
2600         case "$gmake" in
2601         gmake)
2602         echo "I can't find make or gmake, and my life depends on it." >&4
2603         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2604         exit 1
2605         ;;
2606         esac
2607         ;;
2608 esac
2609 case "$gmake" in
2610 gmake)  ;;
2611 *)      # We can't have osname yet.
2612         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2613                 # Assume that gmake, if found, is definitely GNU make
2614                 # and prefer it over the system make.
2615                 echo "Substituting gmake for make."
2616                 make=$gmake
2617                 _make=$gmake
2618         fi
2619         ;;
2620 esac
2621 case "$test" in
2622 test)
2623         echo "Hopefully test is built into your sh."
2624         ;;
2625 *)
2626         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2627                 echo "Using the test built into your sh."
2628                 test=test
2629                 _test=test
2630         fi
2631         ;;
2632 esac
2633 case "$echo" in
2634 echo)
2635         echo "Hopefully echo is built into your sh."
2636         ;;
2637 '') ;;
2638 *)
2639         echo " "
2640 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2641         $echo $n "hi there$c" >foo1
2642         echo $n "hi there$c" >foo2
2643         if cmp foo1 foo2 >/dev/null 2>&1; then
2644                 echo "They are compatible.  In fact, they may be identical."
2645         else
2646                 case "$n" in
2647                 '-n') n='' c='\c';;
2648                 *) n='-n' c='';;
2649                 esac
2650                 cat <<FOO
2651 They are not compatible!  You are probably running ksh on a non-USG system.
2652 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2653 have echo built in and we may have to run some Bourne shell scripts.  That
2654 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2655
2656 FOO
2657                 $echo $n "The star should be here-->$c"
2658                 $echo "*"
2659         fi
2660         $rm -f foo1 foo2
2661         ;;
2662 esac
2663
2664 # This question was auctioned at YAPC::Europe-2007 in Vienna
2665 # I never promised you could answer it. I only auctioned the question.
2666 cat <<FOO
2667 The following message is sponsored by
2668
2669   Dresden.pm<--The stars should be here.
2670
2671 Dear Perl user, system administrator or package
2672 maintainer, the Perl community sends greetings to
2673 you. Do you (emblematical) greet back [Y/n]? n
2674
2675 FOO
2676
2677 : Check what type of C compiler we use
2678 cat <<EOS >trygcc
2679 $startsh
2680 EOS
2681 cat <<'EOSC' >>trygcc
2682 case "$cc" in
2683 '') ;;
2684 *)  $rm -f try try.*
2685     $cat >try.c <<EOM
2686 int main(int argc, char *argv[]) {
2687   return 0;
2688 }
2689 EOM
2690     if $cc -o try $ccflags $ldflags try.c; then
2691        :
2692     else
2693         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2694         despair=yes
2695         trygcc=yes
2696         case "$cc" in
2697         *gcc*) trygcc=no ;;
2698         esac
2699         # Skip this test because it gives a false match on output like:
2700         #    ./trygcc: line 23: cc: command not found
2701         # case "`$cc -v -c try.c 2>&1`" in
2702         # *gcc*) trygcc=no ;;
2703         # esac
2704         if $test X"$trygcc" = Xyes; then
2705             if gcc -o try -c try.c; then
2706                 echo " "
2707                 echo "You seem to have a working gcc, though." >&4
2708                 # Switching compilers may undo the work of hints files.
2709                 # The most common problem is -D_REENTRANT for threads.
2710                 # This heuristic catches that case, but gets false positives
2711                 # if -Dusethreads was not actually specified.  Better to
2712                 # bail out here with a useful message than fail
2713                 # mysteriously later. Should we perhaps just try to
2714                 # re-invoke Configure -Dcc=gcc config_args ?
2715                 if $test -f usethreads.cbu; then
2716                         $cat >&4 <<EOM
2717
2718 *** However, any setting of the C compiler flags (e.g. for thread support)
2719 *** will be lost.  It may be necessary for you to restart Configure and
2720 *** add -Dcc=gcc to your Configure command line.
2721
2722 EOM
2723                         rp="Would you like to go ahead and try gcc anyway?"
2724                         dflt=n
2725                 else
2726                         rp="Would you like to use it?"
2727                         dflt=y
2728                 fi
2729                 if $test -f myread; then
2730                     . ./myread
2731                 else
2732                     if $test -f UU/myread; then
2733                         . ./UU/myread
2734                     else
2735                         echo "Cannot find myread, sorry.  Aborting." >&2
2736                         exit 1
2737                     fi
2738                 fi
2739                 case "$ans" in
2740                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2741                 esac
2742             fi
2743         fi
2744     fi
2745     $rm -f try try.*
2746     ;;
2747 esac
2748 EOSC
2749
2750 cat <<EOS >checkcc
2751 $startsh
2752 EOS
2753 cat <<'EOSC' >>checkcc
2754 case "$cc" in
2755 '') ;;
2756 *)  $rm -f try try.*
2757     $cat >try.c <<EOM
2758 int main(int argc, char *argv[]) {
2759   return 0;
2760 }
2761 EOM
2762     if $cc -o try $ccflags $ldflags try.c; then
2763        :
2764     else
2765         if $test X"$despair" = Xyes; then
2766            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2767         fi
2768         $cat >&4 <<EOM
2769 You need to find a working C compiler.
2770 Either (purchase and) install the C compiler supplied by your OS vendor,
2771 or for a free C compiler try http://gcc.gnu.org/
2772 I cannot continue any further, aborting.
2773 EOM
2774         exit 1
2775     fi
2776     $rm -f try try.*
2777     ;;
2778 esac
2779 EOSC
2780
2781 : determine whether symbolic links are supported
2782 echo " "
2783 $touch blurfl
2784 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2785         echo "Symbolic links are supported." >&4
2786         lns="$ln -s"
2787 else
2788         echo "Symbolic links are NOT supported." >&4
2789         lns="$ln"
2790 fi
2791 $rm -f blurfl sym
2792
2793 : determine whether symbolic links are supported
2794 echo " "
2795 case "$lns" in
2796 *"ln"*" -s")
2797         echo "Checking how to test for symbolic links..." >&4
2798         $lns blurfl sym
2799         if $test "X$issymlink" = X; then
2800                 case "$newsh" in
2801                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2802                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2803                 esac
2804                 if test $? = 0; then
2805                         issymlink="test -h"
2806                 else
2807                         echo "Your builtin 'test -h' may be broken." >&4
2808                         case "$test" in
2809                         /*)     ;;
2810                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2811                                 for p in $pth
2812                                 do
2813                                         if test -f "$p/$test"; then
2814                                                 test="$p/$test"
2815                                                 break
2816                                         fi
2817                                 done
2818                                 ;;
2819                         esac
2820                         case "$test" in
2821                         /*)
2822                                 echo "Trying external '$test -h'." >&4
2823                                 issymlink="$test -h"
2824                                 if $test ! -h sym >/dev/null 2>&1; then
2825                                         echo "External '$test -h' is broken, too." >&4
2826                                         issymlink=''
2827                                 fi
2828                                 ;;
2829                         *)      issymlink='' ;;
2830                         esac
2831                 fi
2832         fi
2833         if $test "X$issymlink" = X; then
2834                 if $test -L sym 2>/dev/null; then
2835                         issymlink="$test -L"
2836                         echo "The builtin '$test -L' worked." >&4
2837                 fi
2838         fi
2839         if $test "X$issymlink" != X; then
2840                 echo "You can test for symbolic links with '$issymlink'." >&4
2841         else
2842                 echo "I do not know how you can test for symbolic links." >&4
2843         fi
2844         $rm -f blurfl sym
2845         ;;
2846 *)      echo "No symbolic links, so not testing for their testing..." >&4
2847         ;;
2848 esac
2849 echo " "
2850
2851 : Make symlinks util
2852 case "$mksymlinks" in
2853 $define|true|[yY]*)
2854         case "$src" in
2855         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2856                 exit 1
2857                 ;;
2858         *)      case "$lns:$issymlink" in
2859                 *"ln"*" -s:"*"test -"?)
2860                         echo "Creating the symbolic links..." >&4
2861                         cd ..
2862                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2863                         awk 'NF == 1 {
2864                                 dir=".";
2865                                 file=$1 "";
2866                              }
2867                              NF == 2 {
2868                                 dir=$1 "";
2869                                 file=$2 "";
2870                              }
2871                              {
2872                                  print "# dir = ", dir, "file = ", file
2873                                  mf[dir] = mf[dir]" "source"/"dir"/"file;
2874                              } END {
2875                                  for (d in mf) {
2876                                      if (d != ".") { print("mkdir -p "d) }
2877                                      print("ln -sf "mf[d]" "d);
2878                                  }
2879                              }' source="$src" > UU/mksymlinks.$$
2880                         sh UU/mksymlinks.$$
2881                         rm UU/mksymlinks.$$
2882                         # Sanity check 1.
2883                         if test ! -d t/base; then
2884                                 echo "Failed to create the subdirectories.  Aborting." >&4
2885                                 exit 1
2886                         fi
2887                         # Sanity check 2.
2888                         if test ! -f t/base/lex.t; then
2889                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2890                                 exit 1
2891                         fi
2892                         if test ! -f win32/win32.c; then
2893                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2894                                 exit 1
2895                         fi
2896                         cd UU
2897                         ;;
2898                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2899                         ;;
2900                 esac
2901                 ;;
2902         esac
2903         ;;
2904 esac
2905
2906 : Check for Cross-Compilation
2907 if $test "X$targethost" = "X"; then
2908     targethost=""
2909 fi
2910 if $test "X$targetenv" = "X"; then
2911     targetenv=""
2912 fi
2913 case "$usecrosscompile" in
2914 $define|true|[yY]*)
2915         $echo "Cross-compiling..."
2916         croak=''
2917         case "$cc" in
2918         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2919             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2920             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2921             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2922             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2923             # leave out ld, choosing it is more complex
2924             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2925             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2926             # We are in a weird spot. Just before us, some values
2927             # were 'saved', to be restored after the hints are
2928             # run.  This means that the changes we made to ar,
2929             # nm and ranlib will get reverted.
2930             # To avoid that, we hijack the saving mechanism and
2931             # have it save our new values.
2932             for file in ar nm ranlib; do
2933                 eval xxx=\$$file
2934                 eval $file=$xxx$_exe
2935                 eval _$file=$xxx
2936             done
2937         ;;
2938         esac
2939         case "$targetarch" in
2940         '') echo "Targetarch not defined." >&4; croak=y ;;
2941         *)  echo "Using targetarch $targetarch." >&4 ;;
2942         esac
2943         case "$targethost" in
2944         '') echo "Targethost not defined." >&4; croak=y ;;
2945         *)  echo "Using targethost $targethost." >&4
2946         esac
2947         locincpth=' '
2948         loclibpth=' '
2949         case "$croak" in
2950         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2951         esac
2952     : compile a host miniperl and generate_uudmap, unless we got passed them
2953     if $test "X$hostperl" = X; then
2954       echo "Building host miniperl and generate_uudmap binaries" >&4
2955       before_host=`pwd`
2956       cd ..
2957       cd $src
2958       src=`pwd`
2959       rm -rf $src/host
2960       mkdir $src/host
2961       cd $src/host
2962       $src/Configure -des -Dusedevel -Dmksymlinks
2963       $make miniperl
2964       case "$hostgenerate" in
2965       '') $make generate_uudmap
2966           hostgenerate=$src/host/generate_uudmap
2967           ;;
2968        "$undef") hostgenerate=''
2969           ;;
2970       esac
2971       hostperl=$src/host/miniperl
2972       cd $before_host
2973     fi
2974     hostosname=`$hostperl -le 'print $^O'`
2975     ;;
2976 *)
2977     usecrosscompile="$undef"
2978     ;;
2979 esac
2980
2981 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2982 case "$targethost" in
2983     '') echo "Checking for cross-compile" >&4
2984     case "$usecrosscompile$multiarch" in
2985        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2986          if [ -f Makefile ]; then
2987            echo " "
2988            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2989          else
2990            echo "Configure done."
2991          fi
2992        exit 0
2993        ;;
2994      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2995         run=''
2996         to=:
2997         from=:
2998         ;;
2999     esac
3000     ;;
3001     *) echo "Using targethost $targethost." >&4
3002         case "$src" in
3003         /*) run=$src/Cross/run
3004             targetmkdir=$src/Cross/mkdir
3005             to=$src/Cross/to
3006             from=$src/Cross/from
3007             ;;
3008         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3009             run=$pwd/Cross/run
3010             targetmkdir=$pwd/Cross/mkdir
3011             to=$pwd/Cross/to
3012             from=$pwd/Cross/from
3013             ;;
3014         esac
3015         case "$targetrun" in
3016         '') targetrun=ssh ;;
3017         esac
3018         case "$targetto" in
3019         '') targetto=scp ;;
3020         esac
3021         case "$targetfrom" in
3022         '') targetfrom=scp ;;
3023         esac
3024         run=$run-$targetrun
3025         to=$to-$targetto
3026         from=$from-$targetfrom
3027         case "$targetdir" in
3028         '')  targetdir=/tmp
3029              echo "Guessing targetdir $targetdir." >&4
3030              ;;
3031         esac
3032         case "$targetuser" in
3033         '')  targetuser=root
3034              echo "Guessing targetuser $targetuser." >&4
3035              ;;
3036         esac
3037         case "$targetport" in
3038         '')  targetport=22
3039              echo "Guessing targetport $targetport." >&4
3040              ;;
3041         esac
3042         case "$targetfrom" in
3043         scp)    q=-q ;;
3044         *)      q='' ;;
3045         esac
3046         case "$targetrun" in
3047         ssh|rsh)
3048             cat >$run <<EOF
3049 #!/bin/sh
3050 env=''
3051 case "\$1" in
3052 -cwd)
3053   shift
3054   cwd=\$1
3055   shift
3056   ;;
3057 esac
3058 case "\$1" in
3059 -env)
3060   shift
3061   env=\$1
3062   shift
3063   ;;
3064 esac
3065 case "\$cwd" in
3066 '') cwd=$targetdir ;;
3067 esac
3068 exe=\$1
3069 shift
3070 $to \$exe
3071 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3072 EOF
3073             ;;
3074         adb)
3075             $touch $run
3076             ;;
3077         *)  echo "Unknown targetrun '$targetrun'" >&4
3078             exit 1
3079             ;;
3080         esac
3081         case "$targetmkdir" in
3082         */Cross/mkdir)
3083             cat >$targetmkdir <<EOF
3084 #!/bin/sh
3085 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3086 EOF
3087             $chmod a+rx $targetmkdir
3088             ;;
3089         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3090             exit 1
3091             ;;
3092         esac
3093         case "$targetto" in
3094         scp|rcp)
3095             cat >$to <<EOF
3096 #!/bin/sh
3097 for f in \$@
3098 do
3099   case "\$f" in
3100   /*)
3101     $targetmkdir \`dirname \$f\`
3102     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3103     ;;
3104   *)
3105     $targetmkdir $targetdir/\`dirname \$f\`
3106     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3107     ;;
3108   esac
3109 done
3110 exit 0
3111 EOF
3112             ;;
3113         cp) cat >$to <<EOF
3114 #!/bin/sh
3115 for f in \$@
3116 do
3117   case "\$f" in
3118   /*)
3119     $mkdir -p $targetdir/\`dirname \$f\`
3120     $cp \$f $targetdir/\$f || exit 1
3121     ;;
3122   *)
3123     $targetmkdir $targetdir/\`dirname \$f\`
3124     $cp \$f $targetdir/\$f || exit 1
3125     ;;
3126   esac
3127 done
3128 exit 0
3129 EOF
3130             ;;
3131         *)  echo "Unknown targetto '$targetto'" >&4
3132             exit 1
3133             ;;
3134         esac
3135         case "$targetfrom" in
3136         scp|rcp)
3137           cat >$from <<EOF
3138 #!/bin/sh
3139 for f in \$@
3140 do
3141   $rm -f \$f
3142   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3143 done
3144 exit 0
3145 EOF
3146             ;;
3147         cp) cat >$from <<EOF
3148 #!/bin/sh
3149 for f in \$@
3150 do
3151   $rm -f \$f
3152   cp $targetdir/\$f . || exit 1
3153 done
3154 exit 0
3155 EOF
3156             ;;
3157         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3158             exit 1
3159             ;;
3160         esac
3161         if $test ! -f $run; then
3162             echo "Target 'run' script '$run' not found." >&4
3163         else
3164             $chmod a+rx $run
3165         fi
3166         if $test ! -f $to; then
3167             echo "Target 'to' script '$to' not found." >&4
3168         else
3169             $chmod a+rx $to
3170         fi
3171         if $test ! -f $from; then
3172             echo "Target 'from' script '$from' not found." >&4
3173         else
3174             $chmod a+rx $from
3175         fi
3176         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3177             exit 1
3178         fi
3179         cat >&4 <<EOF
3180 Using '$run' for remote execution,
3181 and '$from' and '$to'
3182 for remote file transfer.
3183 EOF
3184         ;;
3185 *)      run=''
3186         to=:
3187         from=:
3188         usecrosscompile="$undef"
3189         targetarch=''
3190         ;;
3191 esac
3192
3193 : see whether [:lower:] and [:upper:] are supported character classes
3194 echo " "
3195 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3196 ABYZ)
3197         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3198         up='[:upper:]'
3199         low='[:lower:]'
3200         ;;
3201 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3202         # (0xd9 and 0xe2), therefore that is a nice testing point.
3203         if test "X$up" = X -o "X$low" = X; then
3204             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3205             rs) up='[A-Z]'
3206                 low='[a-z]'
3207                 ;;
3208             esac
3209         fi
3210         if test "X$up" = X -o "X$low" = X; then
3211             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3212             rs) up='A-Z'
3213                 low='a-z'
3214                 ;;
3215             esac
3216         fi
3217         if test "X$up" = X -o "X$low" = X; then
3218             case "`echo RS | od -x 2>/dev/null`" in
3219             *D9E2*|*d9e2*)
3220                 echo "Hey, this might be EBCDIC." >&4
3221                 if test "X$up" = X -o "X$low" = X; then
3222                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3223                     rs) up='[A-IJ-RS-Z]'
3224                         low='[a-ij-rs-z]'
3225                         ;;
3226                     esac
3227                 fi
3228                 if test "X$up" = X -o "X$low" = X; then
3229                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3230                     rs) up='A-IJ-RS-Z'
3231                         low='a-ij-rs-z'
3232                         ;;
3233                     esac
3234                 fi
3235                 ;;
3236             esac
3237         fi
3238 esac
3239 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3240 rs)
3241     echo "Using $up and $low to convert case." >&4
3242     ;;
3243 *)
3244     echo "I don't know how to translate letters from upper to lower case." >&4
3245     echo "Your tr is not acting any way I know of." >&4
3246     exit 1
3247     ;;
3248 esac
3249 : set up the translation script tr, must be called with ./tr of course
3250 cat >tr <<EOSC
3251 $startsh
3252 case "\$1\$2" in
3253 '[A-Z][a-z]') exec $tr '$up' '$low';;
3254 '[a-z][A-Z]') exec $tr '$low' '$up';;
3255 esac
3256 exec $tr "\$@"
3257 EOSC
3258 chmod +x tr
3259 $eunicefix tr
3260
3261 : Try to determine whether config.sh was made on this system
3262 case "$config_sh" in
3263 '')
3264 myuname=`$uname -a 2>/dev/null`
3265 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3266 # Downcase everything to avoid ambiguity.
3267 # Remove slashes and single quotes so we can use parts of this in
3268 # directory and file names.
3269 # Remove newlines so myuname is sane to use elsewhere.
3270 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3271 # because the A-Z/a-z are not consecutive.
3272 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3273         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3274 newmyuname="$myuname"
3275 dflt=n
3276 case "$knowitall" in
3277 '')
3278         if test -f ../config.sh; then
3279                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3280                         eval "`grep myuname= ../config.sh`"
3281                 fi
3282                 if test "X$myuname" = "X$newmyuname"; then
3283                         dflt=y
3284                 fi
3285         fi
3286         ;;
3287 *) dflt=y;;
3288 esac
3289
3290 : Get old answers from old config file if Configure was run on the
3291 : same system, otherwise use the hints.
3292 hint=default
3293 cd ..
3294 if test -f config.sh; then
3295         echo " "
3296         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3297         . UU/myread
3298         case "$ans" in
3299         n*|N*) echo "OK, I'll ignore it."
3300                 mv config.sh config.sh.old
3301                 myuname="$newmyuname"
3302                 ;;
3303         *)  echo "Fetching default answers from your old config.sh file..." >&4
3304                 tmp_n="$n"
3305                 tmp_c="$c"
3306                 tmp_sh="$sh"
3307                 . ./config.sh
3308                 cp config.sh UU
3309                 n="$tmp_n"
3310                 c="$tmp_c"
3311                 : Older versions did not always set $sh.  Catch re-use of such
3312                 : an old config.sh.
3313                 case "$sh" in
3314                 '') sh="$tmp_sh" ;;
3315                 esac
3316                 hint=previous
3317                 ;;
3318         esac
3319 fi
3320 . ./UU/checkcc
3321 if test ! -f config.sh; then
3322         $cat <<EOM
3323
3324 First time through, eh?  I have some defaults handy for some systems
3325 that need some extra help getting the Configure answers right:
3326
3327 EOM
3328         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3329         dflt=''
3330         : Half the following guesses are probably wrong... If you have better
3331         : tests or hints, please send them to perlbug@perl.org
3332         : The metaconfig authors would also appreciate a copy...
3333         $test -f /irix && osname=irix
3334         $test -f /xenix && osname=sco_xenix
3335         $test -f /dynix && osname=dynix
3336         $test -f /dnix && osname=dnix
3337         $test -f /lynx.os && osname=lynxos
3338         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3339         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3340         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3341         $test -f /bin/mips && /bin/mips && osname=mips
3342         $test -d /usr/apollo/bin && osname=apollo
3343         $test -f /etc/saf/_sactab && osname=svr4
3344         $test -d /usr/include/minix && osname=minix
3345         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3346         if $test -d /MachTen -o -d /MachTen_Folder; then
3347                 osname=machten
3348                 if $test -x /sbin/version; then
3349                         osvers=`/sbin/version | $awk '{print $2}' |
3350                         $sed -e 's/[A-Za-z]$//'`
3351                 elif $test -x /usr/etc/version; then
3352                         osvers=`/usr/etc/version | $awk '{print $2}' |
3353                         $sed -e 's/[A-Za-z]$//'`
3354                 else
3355                         osvers="$2.$3"
3356                 fi
3357         fi
3358
3359         $test -f /sys/posix.dll &&
3360                 $test -f /usr/bin/what &&
3361                 set X `/usr/bin/what /sys/posix.dll` &&
3362                 $test "$3" = UWIN &&
3363                 osname=uwin &&
3364                 osvers="$5"
3365
3366         if $test -f $uname; then
3367                 set X $myuname
3368                 shift
3369
3370                 case "$5" in
3371                 fps*) osname=fps ;;
3372                 mips*)
3373                         case "$4" in
3374                         umips) osname=umips ;;
3375                         *) osname=mips ;;
3376                         esac;;
3377                 [23]100) osname=mips ;;
3378                 i386*)
3379                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3380                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3381                                 osname='sco'
3382                                 osvers=$tmp
3383                         elif $test -f /etc/kconfig; then
3384                                 osname=isc
3385                                 if test "$lns" = "$ln -s"; then
3386                                         osvers=4
3387                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3388                                         osvers=3
3389                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3390                                         osvers=2
3391                                 fi
3392                         fi
3393                         tmp=''
3394                         ;;
3395                 pc*)
3396                         if test -n "$DJGPP"; then
3397                                 osname=dos
3398                                 osvers=djgpp
3399                         fi
3400                         ;;
3401                 esac
3402
3403                 case "$1" in
3404                 aix) osname=aix
3405                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3406                         case "$tmp" in
3407                         # oslevel can fail with:
3408                         # oslevel: Unable to acquire lock.
3409                         *not\ found) osvers="$4"."$3" ;;
3410                         '<3240'|'<>3240') osvers=3.2.0 ;;
3411                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3412                         '=3250'|'>3250') osvers=3.2.5 ;;
3413                         *) osvers=$tmp;;
3414                         esac
3415                         ;;
3416                 bitrig) osname=bitrig
3417                         osvers="$3"
3418                         ;;
3419                 bsd386) osname=bsd386
3420                         osvers=`$uname -r`
3421                         ;;
3422                 cygwin*) osname=cygwin
3423                         osvers="$3"
3424                         ;;
3425                 *dc.osx) osname=dcosx
3426                         osvers="$3"
3427                         ;;
3428                 dnix) osname=dnix
3429                         osvers="$3"
3430                         ;;
3431                 domainos) osname=apollo
3432                         osvers="$3"
3433                         ;;
3434                 dgux)   osname=dgux
3435                         osvers="$3"
3436                         ;;
3437                 dragonfly) osname=dragonfly
3438                         osvers="$3"
3439                         ;;
3440                 dynixptx*) osname=dynixptx
3441                         osvers=`echo "$4"|sed 's/^v//'`
3442                         ;;
3443                 freebsd) osname=freebsd
3444                         osvers="$3" ;;
3445                 genix)  osname=genix ;;
3446                 gnu)    osname=gnu
3447                         osvers="$3" ;;
3448                 hp*)    osname=hpux
3449                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3450                         ;;
3451                 irix*)  osname=irix
3452                         case "$3" in
3453                         4*) osvers=4 ;;
3454                         5*) osvers=5 ;;
3455                         *)      osvers="$3" ;;
3456                         esac
3457                         ;;
3458                 linux)  osname=linux
3459                         case "$3" in
3460                         *)      osvers="$3" ;;
3461                         esac
3462                         $test -f /system/lib/libandroid.so && osname=linux-android
3463                         ;;
3464                 MiNT)   osname=mint
3465                         ;;
3466                 netbsd*) osname=netbsd
3467                         osvers="$3"
3468                         ;;
3469                 news-os) osvers="$3"
3470                         case "$3" in
3471                         4*) osname=newsos4 ;;
3472                         *) osname=newsos ;;
3473                         esac
3474                         ;;
3475                 nonstop-ux) osname=nonstopux ;;
3476                 openbsd) osname=openbsd
3477                         osvers="$3"
3478                         ;;
3479                 os2)    osname=os2
3480                         osvers="$4"
3481                         ;;
3482                 POSIX-BC | posix-bc ) osname=posix-bc
3483                         osvers="$3"
3484                         ;;
3485                 powerux | power_ux | powermax_os | powermaxos | \
3486                 powerunix | power_unix) osname=powerux
3487                         osvers="$3"
3488                         ;;
3489                 qnx) osname=qnx
3490                         osvers="$4"
3491                         ;;
3492                 solaris) osname=solaris
3493                         case "$3" in
3494                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3495                         *)      osvers="$3" ;;
3496                         esac
3497                         ;;
3498                 sunos) osname=sunos
3499                         case "$3" in
3500                         5*) osname=solaris
3501                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3502                         *)      osvers="$3" ;;
3503                         esac
3504                         ;;
3505                 titanos) osname=titanos
3506                         case "$3" in
3507                         1*) osvers=1 ;;
3508                         2*) osvers=2 ;;
3509                         3*) osvers=3 ;;
3510                         4*) osvers=4 ;;
3511                         *)      osvers="$3" ;;
3512                         esac
3513                         ;;
3514                 ultrix) osname=ultrix
3515                         osvers="$3"
3516                         ;;
3517                 osf1|mls+)      case "$5" in
3518                                 alpha)
3519                                         osname=dec_osf
3520                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3521                                         case "$osvers" in
3522                                         [1-9].[0-9]*) ;;
3523                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3524                                         esac
3525                                         ;;
3526                         hp*)    osname=hp_osf1  ;;
3527                         mips)   osname=mips_osf1 ;;
3528                         esac
3529                         ;;
3530                 # UnixWare 7.1.2 is known as Open UNIX 8
3531                 openunix|unixware) osname=svr5
3532                         osvers="$4"
3533                         ;;
3534                 uts)    osname=uts
3535                         osvers="$3"
3536                         ;;
3537                 vos) osvers="$3"
3538                         ;;
3539                 $2) case "$osname" in
3540                         *isc*) ;;
3541                         *freebsd*) ;;
3542                         svr*)
3543                                 : svr4.x or possibly later
3544                                 case "svr$3" in
3545                                 ${osname}*)
3546                                         osname=svr$3
3547                                         osvers=$4
3548                                         ;;
3549                                 esac
3550                                 case "$osname" in
3551                                 svr4.0)
3552                                         : Check for ESIX
3553                                         if test -f /stand/boot ; then
3554                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3555                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3556                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3557                                                         if test -n "$isesix"; then
3558                                                                 osname=esix4
3559                                                         fi
3560                                                 fi
3561                                         fi
3562                                         ;;
3563                                 esac
3564                                 ;;
3565                         *)      if test -f /etc/systemid; then
3566                                         osname=sco
3567                                         set `echo $3 | $sed 's/\./ /g'` $4
3568                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3569                                                 osvers=$1.$2.$3
3570                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3571                                                 osvers=$1.$2
3572                                         elif $test -f $src/hints/sco_$1.sh; then
3573                                                 osvers=$1
3574                                         fi
3575                                 else
3576                                         case "$osname" in
3577                                         '') : Still unknown.  Probably a generic Sys V.
3578                                                 osname="sysv"
3579                                                 osvers="$3"
3580                                                 ;;
3581                                         esac
3582                                 fi
3583                                 ;;
3584                         esac
3585                         ;;
3586                 *)      case "$osname" in
3587                         '') : Still unknown.  Probably a generic BSD.
3588                                 osname="$1"
3589                                 osvers="$3"
3590                                 ;;
3591                         esac
3592                         ;;
3593                 esac
3594         else
3595                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3596                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3597                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3598                                 osname=news_os
3599                         fi
3600                         $rm -f UU/kernel.what
3601                 elif test -d c:/. -o -n "$is_os2" ; then
3602                         set X $myuname
3603                         osname=os2
3604                         osvers="$5"
3605                 fi
3606         fi
3607
3608         case "$targetarch" in
3609         '') ;;
3610         *)  hostarch=$osname
3611             case "$targetarch" in
3612                 nto*|*-nto-*)
3613                     # Will load qnx.sh, which should change osname to nto
3614                     osname=qnx
3615                     osvers=''
3616                     ;;
3617                 *linux-android*)
3618                     # Catch arm-linux-androideabi, mipsel-linux-android,
3619                     # and i686-linux-android
3620                     osname=linux-android
3621                     osvers=''
3622                     ;;
3623                 *linux*)
3624                     # Something like arm-linux-gnueabihf is really just
3625                     # plain linux.
3626                     osname=linux
3627                     osvers=''
3628                     ;;
3629                 *solaris*|*sunos*)
3630                     osname=solaris
3631                     # XXX perhaps we should just assume
3632                     # osvers to be 2, or maybe take the value
3633                     # from targetarch. Using $run before the
3634                     # hints are run is somewhat icky.
3635                     set X `$run $uname -a 2>/dev/null`
3636                     shift
3637                     case "$3" in
3638                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3639                         *)  osvers="$3" ;;
3640                     esac
3641                     ;;
3642                 *)
3643                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3644                     osvers=''
3645                 ;;
3646             esac
3647             ;;
3648         esac
3649
3650         : Now look for a hint file osname_osvers, unless one has been
3651         : specified already.
3652         case "$hintfile" in
3653         ''|' ')
3654                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3655                 : Also try without trailing minor version numbers.
3656                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3657                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3658                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3659                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3660                 case "$file" in
3661                 '') dflt=none ;;
3662                 *)  case "$osvers" in
3663                         '') dflt=$file
3664                                 ;;
3665                         *)  if $test -f $src/hints/$file.sh ; then
3666                                         dflt=$file
3667                                 elif $test -f $src/hints/$xfile.sh ; then
3668                                         dflt=$xfile
3669                                 elif $test -f $src/hints/$xxfile.sh ; then
3670                                         dflt=$xxfile
3671                                 elif $test -f $src/hints/$xxxfile.sh ; then
3672                                         dflt=$xxxfile
3673                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3674                                         dflt=$xxxxfile
3675                                 elif $test -f "$src/hints/${osname}.sh" ; then
3676                                         dflt="${osname}"
3677                                 else
3678                                         dflt=none
3679                                 fi
3680                                 ;;
3681                         esac
3682                         ;;
3683                 esac
3684                 if $test -f Policy.sh ; then
3685                         case "$dflt" in
3686                         *Policy*) ;;
3687                         none) dflt="Policy" ;;
3688                         *) dflt="Policy $dflt" ;;
3689                         esac
3690                 fi
3691                 ;;
3692         *)
3693                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3694                 ;;
3695         esac
3696
3697         if $test -f Policy.sh ; then
3698                 $cat <<EOM
3699
3700 There's also a Policy hint file available, which should make the
3701 site-specific (policy) questions easier to answer.
3702 EOM
3703
3704         fi
3705
3706         $cat <<EOM
3707
3708 You may give one or more space-separated answers, or "none" if appropriate.
3709 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3710 previous run of Configure, you may specify it as well as or instead of
3711 OS-specific hints.  If hints are provided for your OS, you should use them:
3712 although Perl can probably be built without hints on many platforms, using
3713 hints often improve performance and may enable features that Configure can't
3714 set up on its own. If there are no hints that match your OS, specify "none";
3715 DO NOT give a wrong version or a wrong OS.
3716
3717 EOM
3718
3719         rp="Which of these apply, if any?"
3720         . UU/myread
3721         tans=$ans
3722         for file in $tans; do
3723                 if $test X$file = XPolicy -a -f Policy.sh; then
3724                         . Policy.sh
3725                         $cat Policy.sh >> UU/config.sh
3726                 elif $test -f $src/hints/$file.sh; then
3727                         . $src/hints/$file.sh
3728                         $cat $src/hints/$file.sh >> UU/config.sh
3729                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3730                         : nothing
3731                 else
3732                         : Give one chance to correct a possible typo.
3733                         echo "$file.sh does not exist"
3734                         dflt=$file
3735                         rp="hint to use instead?"
3736                         . UU/myread
3737                         for file in $ans; do
3738                                 if $test -f "$src/hints/$file.sh"; then
3739                                         . $src/hints/$file.sh
3740                                         $cat $src/hints/$file.sh >> UU/config.sh
3741                                 elif $test X$ans = X -o X$ans = Xnone ; then
3742                                         : nothing
3743                                 else
3744                                         echo "$file.sh does not exist -- ignored."
3745                                 fi
3746                         done
3747                 fi
3748         done
3749
3750         hint=recommended
3751         : Remember our hint file for later.
3752         if $test -f "$src/hints/$file.sh" ; then
3753                 hintfile="$file"
3754         else
3755                 hintfile=''
3756         fi
3757 fi
3758 cd UU
3759 ;;
3760 *)
3761         echo " "
3762         echo "Fetching default answers from $config_sh..." >&4
3763         tmp_n="$n"
3764         tmp_c="$c"
3765         cd ..
3766         cp $config_sh config.sh 2>/dev/null
3767         chmod +w config.sh
3768         . ./config.sh
3769         cd UU
3770         cp ../config.sh .
3771         n="$tmp_n"
3772         c="$tmp_c"
3773         hint=previous
3774         ;;
3775 esac
3776 test "$override" && . ./optdef.sh
3777
3778 : Restore computed paths
3779 for file in $loclist $trylist; do
3780         eval $file="\$_$file"
3781 done
3782
3783 cat << EOM
3784
3785 Configure uses the operating system name and version to set some defaults.
3786 The default value is probably right if the name rings a bell. Otherwise,
3787 since spelling matters for me, either accept the default or answer "none"
3788 to leave it blank.
3789
3790 EOM
3791 case "$osname" in
3792         ''|' ')
3793                 case "$hintfile" in
3794                 ''|' '|none) dflt=none ;;
3795                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3796                 esac
3797                 ;;
3798         *) dflt="$osname" ;;
3799 esac
3800 rp="Operating system name?"
3801 . ./myread
3802 case "$ans" in
3803 none)  osname='' ;;
3804 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3805 esac
3806 echo " "
3807 case "$osvers" in
3808         ''|' ')
3809                 case "$hintfile" in
3810                 ''|' '|none) dflt=none ;;
3811                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3812                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3813                         case "$dflt" in
3814                         ''|' ') dflt=none ;;
3815                         esac
3816                         ;;
3817                 esac
3818                 ;;
3819         *) dflt="$osvers" ;;
3820 esac
3821 rp="Operating system version?"
3822 . ./myread
3823 case "$ans" in
3824 none)  osvers='' ;;
3825 *) osvers="$ans" ;;
3826 esac
3827
3828
3829 . ./posthint.sh
3830
3831 : who configured the system
3832 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3833 case "$cf_by" in
3834 "")
3835         cf_by=`(logname) 2>/dev/null`
3836         case "$cf_by" in
3837         "")
3838                 cf_by=`(whoami) 2>/dev/null`
3839                 case "$cf_by" in
3840                 "") cf_by=unknown ;;
3841                 esac ;;
3842         esac ;;
3843 esac
3844
3845 : decide how portable to be.  Allow command line overrides.
3846 case "$d_portable" in
3847 "$undef") ;;
3848 *)      d_portable="$define" ;;
3849 esac
3850
3851 : set up shell script to do ~ expansion
3852 cat >filexp <<EOSS
3853 $startsh
3854 : expand filename
3855 case "\$1" in
3856  \~/*|\~)
3857         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3858         ;;
3859  \~*)
3860         if $test -f /bin/csh; then
3861                 /bin/csh -f -c "glob \$1"
3862                 failed=\$?
3863                 echo ""
3864                 exit \$failed
3865         else
3866                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3867                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3868                 if $test ! -d "\$dir"; then
3869                         me=\`basename \$0\`
3870                         echo "\$me: can't locate home directory for: \$name" >&2
3871                         exit 1
3872                 fi
3873                 case "\$1" in
3874                 */*)
3875                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3876                         ;;
3877                 *)
3878                         echo \$dir
3879                         ;;
3880                 esac
3881         fi
3882         ;;
3883 *)
3884         echo \$1
3885         ;;
3886 esac
3887 EOSS
3888 chmod +x filexp
3889 $eunicefix filexp
3890
3891 : now set up to get a file name
3892 cat <<EOS >getfile
3893 $startsh
3894 EOS
3895 cat <<'EOSC' >>getfile
3896 tilde=''
3897 fullpath=''
3898 already=''
3899 skip=''
3900 none_ok=''
3901 exp_file=''
3902 nopath_ok=''
3903 orig_rp="$rp"
3904 orig_dflt="$dflt"
3905 case "$gfpth" in
3906 '') gfpth='.' ;;
3907 esac
3908
3909 case "$fn" in
3910 *\(*)
3911         : getfile will accept an answer from the comma-separated list
3912         : enclosed in parentheses even if it does not meet other criteria.
3913         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3914         fn=`echo $fn | sed 's/(.*)//'`
3915         ;;
3916 esac
3917
3918 case "$fn" in
3919 *:*)
3920         loc_file=`expr $fn : '.*:\(.*\)'`
3921         fn=`expr $fn : '\(.*\):.*'`
3922         ;;
3923 esac
3924
3925 case "$fn" in
3926 *~*) tilde=true;;
3927 esac
3928 case "$fn" in
3929 */*) fullpath=true;;
3930 esac
3931 case "$fn" in
3932 *+*) skip=true;;
3933 esac
3934 case "$fn" in
3935 *n*) none_ok=true;;
3936 esac
3937 case "$fn" in
3938 *e*) exp_file=true;;
3939 esac
3940 case "$fn" in
3941 *p*) nopath_ok=true;;
3942 esac
3943
3944 case "$fn" in
3945 *f*) type='File';;
3946 *d*) type='Directory';;
3947 *l*) type='Locate';;
3948 esac
3949
3950 what="$type"
3951 case "$what" in
3952 Locate) what='File';;
3953 esac
3954
3955 case "$exp_file" in
3956 '')
3957         case "$d_portable" in
3958         "$define") ;;
3959         *) exp_file=true;;
3960         esac
3961         ;;
3962 esac
3963
3964 cd ..
3965 while test "$type"; do
3966         redo=''
3967         rp="$orig_rp"
3968         dflt="$orig_dflt"
3969         case "$tilde" in
3970         true) rp="$rp (~name ok)";;
3971         esac
3972         . UU/myread
3973         if test -f UU/getfile.ok && \
3974                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3975         then
3976                 value="$ans"
3977                 ansexp="$ans"
3978                 break
3979         fi
3980         case "$ans" in
3981         none)
3982                 value=''
3983                 ansexp=''
3984                 case "$none_ok" in
3985                 true) type='';;
3986                 esac
3987                 ;;
3988         *)
3989                 case "$tilde" in
3990                 '') value="$ans"
3991                         ansexp="$ans";;
3992                 *)
3993                         value=`UU/filexp $ans`
3994                         case $? in
3995                         0)
3996                                 if test "$ans" != "$value"; then
3997                                         echo "(That expands to $value on this system.)"
3998                                 fi
3999                                 ;;
4000                         *) value="$ans";;
4001                         esac
4002                         ansexp="$value"
4003                         case "$exp_file" in
4004                         '') value="$ans";;
4005                         esac
4006                         ;;
4007                 esac
4008                 case "$fullpath" in
4009                 true)
4010                         case "$ansexp" in
4011                         /*) value="$ansexp" ;;
4012                         [a-zA-Z]:/*) value="$ansexp" ;;
4013                         *)
4014                                 redo=true
4015                                 case "$already" in
4016                                 true)
4017                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4018                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4019                                         ;;
4020                                 *)
4021                                 echo "Please give a full path name, starting with slash." >&4
4022                                         case "$tilde" in
4023                                         true)
4024                                 echo "Note that using ~name is ok provided it expands well." >&4
4025                                                 already=true
4026                                                 ;;
4027                                         esac
4028                                 esac
4029                                 ;;
4030                         esac
4031                         ;;
4032                 esac
4033                 case "$redo" in
4034                 '')
4035                         case "$type" in
4036                         File)
4037                                 for fp in $gfpth; do
4038                                         if test "X$fp" = X.; then
4039                                             pf="$ansexp"
4040                                         else    
4041                                             pf="$fp/$ansexp"
4042                                         fi
4043                                         if test -f "$pf"; then
4044                                                 type=''
4045                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4046                                         then
4047                                                 echo "($value is not a plain file, but that's ok.)"
4048                                                 type=''
4049                                         fi
4050                                         if test X"$type" = X; then
4051                                             value="$pf"
4052                                             break
4053                                         fi
4054                                 done
4055                                 ;;
4056                         Directory)
4057                                 for fp in $gfpth; do
4058                                         if test "X$fp" = X.; then
4059                                             dir="$ans"
4060                                             direxp="$ansexp"
4061                                         else    
4062                                             dir="$fp/$ansexp"
4063                                             direxp="$fp/$ansexp"
4064                                         fi
4065                                         if test -d "$direxp"; then
4066                                                 type=''
4067                                                 value="$dir"
4068                                                 break
4069                                         fi
4070                                 done
4071                                 ;;
4072                         Locate)
4073                                 if test -d "$ansexp"; then
4074                                         echo "(Looking for $loc_file in directory $value.)"
4075                                         value="$value/$loc_file"
4076                                         ansexp="$ansexp/$loc_file"
4077                                 fi
4078                                 if test -f "$ansexp"; then
4079                                         type=''
4080                                 fi
4081                                 case "$nopath_ok" in
4082                                 true)   case "$value" in
4083                                         */*) ;;
4084                                         *)      echo "Assuming $value will be in people's path."
4085                                                 type=''
4086                                                 ;;
4087                                         esac
4088                                         ;;
4089                                 esac
4090                                 ;;
4091                         esac
4092
4093                         case "$skip" in
4094                         true) type='';
4095                         esac
4096
4097                         case "$type" in
4098                         '') ;;
4099                         *)
4100                                 if test "$fastread" = yes; then
4101                                         dflt=y
4102                                 else
4103                                         dflt=n
4104                                 fi
4105                                 rp="$what $value doesn't exist.  Use that name anyway?"
4106                                 . UU/myread
4107                                 dflt=''
4108                                 case "$ans" in
4109                                 y*) type='';;
4110                                 *) echo " ";;
4111                                 esac
4112                                 ;;
4113                         esac
4114                         ;;
4115                 esac
4116                 ;;
4117         esac
4118 done
4119 cd UU
4120 ans="$value"
4121 rp="$orig_rp"
4122 dflt="$orig_dflt"
4123 rm -f getfile.ok
4124 test "X$gfpthkeep" != Xy && gfpth=""
4125 EOSC
4126
4127 : determine root of directory hierarchy where package will be installed.
4128 case "$prefix" in
4129 '')
4130         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4131         ;;
4132 *?/)
4133         dflt=`echo "$prefix" | sed 's/.$//'`
4134         ;;
4135 *)
4136         dflt="$prefix"
4137         ;;
4138 esac
4139 $cat <<EOM
4140
4141 By default, $package will be installed in $dflt/bin, manual pages
4142 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4143 installation directories. Typically this is something like /usr/local.
4144 If you wish to have binaries under /usr/bin but other parts of the
4145 installation under /usr/local, that's ok: you will be prompted
4146 separately for each of the installation directories, the prefix being
4147 only used to set the defaults.
4148
4149 EOM
4150 fn=d~
4151 rp='Installation prefix to use?'
4152 . ./getfile
4153 oldprefix=''
4154 case "$prefix" in
4155 '') ;;
4156 *)
4157         case "$ans" in
4158         "$prefix") ;;
4159         *) oldprefix="$prefix";;
4160         esac
4161         ;;
4162 esac
4163 prefix="$ans"
4164 prefixexp="$ansexp"
4165
4166 : allow them to override the AFS root
4167 case "$afsroot" in
4168 '')     afsroot=/afs ;;
4169 *)      afsroot=$afsroot ;;
4170 esac
4171
4172 : is AFS running?
4173 echo " "
4174 case "$afs" in
4175 $define|true)   afs=true ;;
4176 $undef|false)   afs=false ;;
4177 *)      if $test -d $afsroot; then
4178                 afs=true
4179         else
4180                 afs=false
4181         fi
4182         ;;
4183 esac
4184 if $afs; then
4185         echo "AFS may be running... I'll be extra cautious then..." >&4
4186 else
4187         echo "AFS does not seem to be running..." >&4
4188 fi
4189
4190 : determine installation prefix for where package is to be installed.
4191 if $afs; then
4192 $cat <<EOM
4193
4194 Since you are running AFS, I need to distinguish the directory in which
4195 files will reside from the directory in which they are installed (and from
4196 which they are presumably copied to the former directory by occult means).
4197
4198 EOM
4199         case "$installprefix" in
4200         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4201         *) dflt="$installprefix";;
4202         esac
4203 else
4204 $cat <<EOM
4205
4206 In some special cases, particularly when building $package for distribution,
4207 it is convenient to distinguish the directory in which files should be
4208 installed from the directory ($prefix) in which they will
4209 eventually reside.  For most users, these two directories are the same.
4210
4211 EOM
4212         case "$installprefix" in
4213         '') dflt=$prefix ;;
4214         *) dflt=$installprefix;;
4215         esac
4216 fi
4217 fn=d~
4218 rp='What installation prefix should I use for installing files?'
4219 . ./getfile
4220 installprefix="$ans"
4221 installprefixexp="$ansexp"
4222
4223 : Perform the prefixexp/installprefixexp correction if necessary
4224 cat <<EOS >installprefix
4225 $startsh
4226 EOS
4227 cat <<'EOSC' >>installprefix
4228 : Change installation prefix, if necessary.
4229 if $test X"$prefix" != X"$installprefix"; then
4230     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4231 else
4232     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4233 fi
4234 EOSC
4235 chmod +x installprefix
4236 $eunicefix installprefix
4237
4238 : Set variables such as privlib and privlibexp from the output of ./getfile
4239 : performing the prefixexp/installprefixexp correction if necessary.
4240 cat <<EOS >setprefixvar
4241 $startsh
4242 EOS
4243 cat <<'EOSC' >>setprefixvar
4244 eval "${prefixvar}=\"\$ans\""
4245 eval "${prefixvar}exp=\"\$ansexp\""
4246 . ./installprefix
4247 EOSC
4248 chmod +x setprefixvar
4249 $eunicefix setprefixvar
4250
4251 : set up the script used to warn in case of inconsistency
4252 cat <<EOS >whoa
4253 $startsh
4254 EOS
4255 cat <<'EOSC' >>whoa
4256 dflt=y
4257 case "$hint" in
4258     recommended)
4259         case "$hintfile" in
4260         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4261                 ;;
4262         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4263                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4264                 ;;
4265         esac
4266         ;;
4267     *)  echo " "
4268         echo "*** WHOA THERE!!! ***" >&4
4269         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4270         ;;
4271 esac
4272 rp="    Keep the $hint value?"
4273 . ./myread
4274 case "$ans" in
4275 y) td=$was; tu=$was;;
4276 esac
4277 EOSC
4278
4279 : function used to set '$1' to '$val'
4280 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4281 case "$val$was" in
4282 $define$undef) . ./whoa; eval "$var=\$td";;
4283 $undef$define) . ./whoa; eval "$var=\$tu";;
4284 *) eval "$var=$val";;
4285 esac'
4286
4287 : get the patchlevel
4288 echo " "
4289 echo "Getting the current patchlevel..." >&4
4290 if $test -r $rsrc/patchlevel.h;then
4291         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4292         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4293         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4294         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4295         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4296         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4297         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4298 else
4299         revision=0
4300         patchlevel=0
4301         subversion=0
4302         api_revision=0
4303         api_version=0
4304         api_subversion=0
4305         perl_patchlevel=0
4306         $echo "(You do not have patchlevel.h.  Eek.)"
4307 fi
4308 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4309 version_patchlevel_string="version $patchlevel subversion $subversion"
4310 case "$perl_patchlevel" in
4311 0|'') ;;
4312 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4313     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4314     ;;
4315 esac
4316
4317 $echo "(You have $package $version_patchlevel_string.)"
4318
4319 case "$osname" in
4320 dos|vms)
4321         : XXX Should be a Configure test for double-dots in filenames.
4322         version=`echo $revision $patchlevel $subversion | \
4323                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4324         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4325                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4326         ;;
4327 *)
4328         version=`echo $revision $patchlevel $subversion | \
4329                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4330         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4331                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4332         ;;
4333 esac
4334 : Special case the 5.005_xx maintenance series, which used 5.005
4335 : without any subversion label as a subdirectory in $sitelib
4336 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4337         api_versionstring='5.005'
4338 fi
4339
4340 : Do we want threads support and if so, what type
4341 case "$usethreads" in
4342 $define|true|[yY]*)     dflt='y';;
4343 *)     # Catch case where user specified ithreads or 5005threads but
4344        # forgot -Dusethreads (A.D. 4/2002)
4345        case "$useithreads$use5005threads" in
4346        *$define*)       dflt='y';;
4347        *)               dflt='n';;
4348        esac
4349        ;;
4350 esac
4351 cat <<EOM
4352
4353 Perl can be built to offer a form of threading support on some systems
4354 To do so, Configure can be run with -Dusethreads.
4355
4356 Note that Perl built with threading support runs slightly slower
4357 and uses slightly more memory than plain Perl.
4358
4359 If this doesn't make any sense to you, just accept the default '$dflt'.
4360 EOM
4361 rp='Build a threading Perl?'
4362 . ./myread
4363 case "$ans" in
4364 y|Y)    val="$define" ;;
4365 *)      val="$undef" ;;
4366 esac
4367 set usethreads
4368 eval $setvar
4369
4370 if $test $patchlevel -lt 9; then
4371     case "$usethreads" in
4372     $define)
4373         : Default to ithreads unless overridden on command line or with
4374         : old config.sh
4375         dflt='y'
4376         case "$use5005threads" in
4377                 $define|true|[yY]*)
4378                         echo "5.005 threads are no longer supported"
4379                         exit 1
4380                 ;;
4381         esac
4382         case "$useithreads" in
4383                 $undef|false|[nN]*) dflt='n';;
4384         esac
4385         rp='Use the newer interpreter-based ithreads?'
4386         . ./myread
4387         case "$ans" in
4388         y|Y)    val="$define" ;;
4389         *)      val="$undef" ;;
4390         esac
4391         set useithreads
4392         eval $setvar
4393         : Now set use5005threads to the opposite value.
4394         case "$useithreads" in
4395         $define) val="$undef" ;;
4396         *) val="$define" ;;
4397         esac
4398         set use5005threads
4399         eval $setvar
4400         ;;
4401     *)
4402         useithreads="$undef"
4403         use5005threads="$undef"
4404         ;;
4405     esac
4406
4407     case "$useithreads$use5005threads" in
4408     "$define$define")
4409         $cat >&4 <<EOM
4410
4411 You cannot have both the ithreads and the 5.005 threads enabled
4412 at the same time.  Disabling the 5.005 threads since they are
4413 much less stable than the ithreads.
4414
4415 EOM
4416         use5005threads="$undef"
4417         ;;
4418     esac
4419
4420 else
4421 : perl-5.9.x and later
4422
4423     if test X"$usethreads" = "X$define"; then
4424         case "$use5005threads" in
4425             $define|true|[yY]*)
4426                 $cat >&4 <<EOM
4427
4428 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4429
4430 EOM
4431             ;;
4432         esac
4433     fi
4434
4435     use5005threads="$undef"
4436     useithreads="$usethreads"
4437 fi
4438
4439 case "$d_oldpthreads" in
4440 '')     : Configure tests would be welcome here.  For now, assume undef.
4441         val="$undef" ;;
4442 *)      val="$d_oldpthreads" ;;
4443 esac
4444 set d_oldpthreads
4445 eval $setvar
4446
4447
4448 : Look for a hint-file generated 'call-back-unit'.  If the
4449 : user has specified that a threading perl is to be built,
4450 : we may need to set or change some other defaults.
4451 if $test -f usethreads.cbu; then
4452     echo "Your platform has some specific hints regarding threaded builds, using them..."
4453     . ./usethreads.cbu
4454 else
4455     case "$usethreads" in
4456         "$define"|true|[yY]*)
4457                 $cat <<EOM
4458 (Your platform does not have any specific hints for threaded builds.
4459  Assuming POSIX threads, then.)
4460 EOM
4461         ;;
4462     esac
4463 fi
4464
4465 : Check if multiplicity is required
4466 cat <<EOM
4467
4468 Perl can be built so that multiple Perl interpreters can coexist
4469 within the same Perl executable.
4470 EOM
4471
4472 case "$useithreads" in
4473 $define)
4474         cat <<EOM
4475 This multiple interpreter support is required for interpreter-based threads.
4476 EOM
4477         val="$define"
4478         ;;
4479 *)      case "$usemultiplicity" in
4480         $define|true|[yY]*)     dflt='y';;
4481         *) dflt='n';;
4482         esac
4483         echo " "
4484         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4485         rp='Build Perl for multiplicity?'
4486         . ./myread
4487         case "$ans" in
4488         y|Y)    val="$define" ;;
4489         *)      val="$undef" ;;
4490         esac
4491         ;;
4492 esac
4493 set usemultiplicity
4494 eval $setvar
4495
4496 : Check if morebits is requested
4497 case "$usemorebits" in
4498 "$define"|true|[yY]*)
4499         use64bitint="$define"
4500         uselongdouble="$define"
4501         usemorebits="$define"
4502         ;;
4503 *)      usemorebits="$undef"
4504         ;;
4505 esac
4506
4507 : Determine the C compiler to be used
4508 echo " "
4509 case "$cc" in
4510 '') dflt=cc;;
4511 *) dflt="$cc";;
4512 esac
4513 rp="Use which C compiler?"
4514 . ./myread
4515 cc="$ans"
4516
4517 : See whether they have no cc but they do have gcc
4518 . ./trygcc
4519 if $test -f cc.cbu; then
4520     . ./cc.cbu
4521 fi
4522 . ./checkcc
4523
4524 : make some quick guesses about what we are up against
4525 echo " "
4526 $echo $n "Hmm...  $c"
4527 echo exit 1 >bsd
4528 echo exit 1 >usg
4529 echo exit 1 >v7
4530 echo exit 1 >osf1
4531 echo exit 1 >eunice
4532 echo exit 1 >xenix
4533 echo exit 1 >venix
4534 echo exit 1 >os2
4535 d_bsd="$undef"
4536 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4537 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4538 then
4539         echo "Looks kind of like an OSF/1 system, but we'll see..."
4540         echo exit 0 >osf1
4541 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4542         xxx=`./loc addbib blurfl $pth`
4543         if $test -f $xxx; then
4544         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4545                 echo exit 0 >bsd
4546                 echo exit 0 >usg
4547         else
4548                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4549                         echo "Looks kind of like an extended USG system, but we'll see..."
4550                 else
4551                         echo "Looks kind of like a USG system, but we'll see..."
4552                 fi
4553                 echo exit 0 >usg
4554         fi
4555 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4556         echo "Looks kind of like a BSD system, but we'll see..."
4557         d_bsd="$define"
4558         echo exit 0 >bsd
4559 else
4560         echo "Looks kind of like a Version 7 system, but we'll see..."
4561         echo exit 0 >v7
4562 fi
4563 case "$eunicefix" in
4564 *unixtovms*)
4565         $cat <<'EOI'
4566 There is, however, a strange, musty smell in the air that reminds me of
4567 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4568 EOI
4569         echo exit 0 >eunice
4570         d_eunice="$define"
4571 : it so happens the Eunice I know will not run shell scripts in Unix format
4572         ;;
4573 *)
4574         echo " "
4575         echo "Congratulations.  You aren't running Eunice."
4576         d_eunice="$undef"
4577         ;;
4578 esac
4579 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4580 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4581 : semicolon as a patch separator
4582 case "$p_" in
4583 :) ;;
4584 *)
4585         $cat <<'EOI'
4586 I have the feeling something is not exactly right, however...don't tell me...
4587 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4588 (Or you may be running DOS with DJGPP.)
4589 EOI
4590         echo exit 0 >os2
4591         ;;
4592 esac
4593 if test -f /xenix; then
4594         echo "Actually, this looks more like a XENIX system..."
4595         echo exit 0 >xenix
4596         d_xenix="$define"
4597 else
4598         echo " "
4599         echo "It's not Xenix..."
4600         d_xenix="$undef"
4601 fi
4602 chmod +x xenix
4603 $eunicefix xenix
4604 if test -f /venix; then
4605         echo "Actually, this looks more like a VENIX system..."
4606         echo exit 0 >venix
4607 else
4608         echo " "
4609         if ./xenix; then
4610                 : null
4611         else
4612                 echo "Nor is it Venix..."
4613         fi
4614 fi
4615 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4616 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4617 $rm -f foo
4618
4619 : Check if we are using GNU gcc and what its version is
4620 echo " "
4621 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4622 $cat >try.c <<EOM
4623 #include <stdio.h>
4624 int main() {
4625 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4626 #ifdef __VERSION__
4627         printf("%s\n", __VERSION__);
4628 #else
4629         printf("%s\n", "1");
4630 #endif
4631 #endif
4632         return(0);
4633 }
4634 EOM
4635 if $cc -o try $ccflags $ldflags try.c; then
4636         gccversion=`$run ./try`
4637         case "$gccversion" in
4638         '') echo "You are not using GNU cc." ;;
4639         *)  echo "You are using GNU cc $gccversion."
4640             ccname=gcc
4641             ;;
4642         esac
4643 else
4644         echo " "
4645         echo "*** WHOA THERE!!! ***" >&4
4646         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4647         case "$knowitall" in
4648         '')
4649         echo "    You'd better start hunting for one and let me know about it." >&4
4650                 exit 1
4651                 ;;
4652         esac
4653 fi
4654 $rm -f try try.*
4655 case "$gccversion" in
4656 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4657 esac
4658 case "$gccversion" in
4659 '') gccosandvers='' ;;
4660 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4661    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4662    gccshortvers=''
4663    case "$gccosandvers" in
4664    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4665    $osname$osvers) ;; # looking good
4666    $osname*) cat <<EOM >&4
4667
4668 *** WHOA THERE!!! ***
4669
4670     Your gcc has not been compiled for the exact release of
4671     your operating system ($gccosandvers versus $osname$osvers).
4672
4673     In general it is a good idea to keep gcc synchronized with
4674     the operating system because otherwise serious problems
4675     may ensue when trying to compile software, like Perl.
4676
4677     I'm trying to be optimistic here, though, and will continue.
4678     If later during the configuration and build icky compilation
4679     problems appear (headerfile conflicts being the most common
4680     manifestation), I suggest reinstalling the gcc to match
4681     your operating system release.
4682
4683 EOM
4684       ;;
4685    *) gccosandvers='' ;; # failed to parse, better be silent
4686    esac
4687    ;;
4688 esac
4689 case "$ccname" in
4690 '') ccname="$cc" ;;
4691 esac
4692
4693 # gcc 3.* complain about adding -Idirectories that they already know about,
4694 # so we will take those off from locincpth.
4695 case "$gccversion" in
4696 3*)
4697     echo "main(){}">try.c
4698     for incdir in $locincpth; do
4699        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4700              grep '^c[cp]p*[01]: warning: changing search order '`
4701        if test "X$warn" != X; then
4702            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4703        fi
4704     done
4705     $rm -f try try.*
4706 esac
4707
4708 # gcc 4.9 by default does some optimizations that break perl.
4709 # see ticket 121505.
4710 #
4711 # The -fwrapv disables those optimizations (and probably others,) so
4712 # for gcc 4.9 (and later, since the optimizations probably won't go
4713 # away), add -fwrapv unless the user requests -fno-wrapv, which
4714 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4715 # which turns the overflows -fwrapv ignores into runtime errors.
4716 case "$gccversion" in
4717 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4718     case "$ccflags" in
4719     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4720     *) ccflags="$ccflags -fwrapv" ;;
4721     esac
4722 esac
4723
4724 : What should the include directory be ?
4725 : Use sysroot if set, so findhdr looks in the right place.
4726 echo " "
4727 $echo $n "Hmm...  $c"
4728 dflt="$sysroot/usr/include"
4729 incpath=''
4730 mips_type=''
4731 if $test -f /bin/mips && /bin/mips; then
4732         echo "Looks like a MIPS system..."
4733         $cat >usr.c <<'EOCP'
4734 #ifdef SYSTYPE_BSD43
4735 /bsd43
4736 #endif
4737 EOCP
4738         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4739                 dflt='/bsd43/usr/include'
4740                 incpath='/bsd43'
4741                 mips_type='BSD 4.3'
4742         else
4743                 mips_type='System V'
4744         fi
4745         $rm -f usr.c usr.out
4746         echo "and you're compiling with the $mips_type compiler and libraries."
4747         xxx_prompt=y
4748         echo "exit 0" >mips
4749 else
4750         echo "Doesn't look like a MIPS system."
4751         xxx_prompt=n
4752         echo "exit 1" >mips
4753 fi
4754 chmod +x mips
4755 $eunicefix mips
4756 case "$usrinc" in
4757 '') ;;
4758 *) dflt="$usrinc";;
4759 esac
4760 case "$xxx_prompt" in
4761 y)      fn=d/
4762         echo " "
4763         rp='Where are the include files you want to use?'
4764         . ./getfile
4765         usrinc="$ans"
4766         ;;
4767 *)      usrinc="$dflt"
4768         ;;
4769 esac
4770
4771 : see how we invoke the C preprocessor
4772 echo " "
4773 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4774 cat <<'EOT' >testcpp.c
4775 #define ABC abc
4776 #define XYZ xyz
4777 ABC.XYZ
4778 EOT
4779 cd ..
4780 if test ! -f cppstdin; then
4781         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4782                 # AIX cc -E doesn't show the absolute headerfile
4783                 # locations but we'll cheat by using the -M flag.
4784                 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
4785         else
4786                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4787         fi
4788 else
4789         echo "Keeping your $hint cppstdin wrapper."
4790 fi
4791 chmod 755 cppstdin
4792 wrapper=`pwd`/cppstdin
4793 ok='false'
4794 cd UU
4795
4796 if $test "X$cppstdin" != "X" && \
4797         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4798         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4799 then
4800         echo "You used to use $cppstdin $cppminus so we'll use that again."
4801         case "$cpprun" in
4802         '') echo "But let's see if we can live without a wrapper..." ;;
4803         *)
4804                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4805                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4806                 then
4807                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4808                         ok='true'
4809                 else
4810                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4811                 fi
4812                 ;;
4813         esac
4814 else
4815         case "$cppstdin" in
4816         '') ;;
4817         *)
4818                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4819                 ;;
4820         esac
4821 fi
4822
4823 if $ok; then
4824         : nothing
4825 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4826         $cc -E <testcpp.c >testcpp.out 2>&1; \
4827         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4828         echo "Yup, it does."
4829         x_cpp="$cc $cppflags -E"
4830         x_minus='';
4831 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4832         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4833         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4834         echo "Yup, it does."
4835         x_cpp="$cc $cppflags -E"
4836         x_minus='-';
4837 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4838         $cc -P <testcpp.c >testcpp.out 2>&1; \
4839         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4840         echo "Yipee, that works!"
4841         x_cpp="$cc $cppflags -P"
4842         x_minus='';
4843 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4844         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4845         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4846         echo "At long last!"
4847         x_cpp="$cc $cppflags -P"
4848         x_minus='-';
4849 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4850         $cpp <testcpp.c >testcpp.out 2>&1; \
4851         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4852         echo "It works!"
4853         x_cpp="$cpp $cppflags"
4854         x_minus='';
4855 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4856         $cpp - <testcpp.c >testcpp.out 2>&1; \
4857         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4858         echo "Hooray, it works!  I was beginning to wonder."
4859         x_cpp="$cpp $cppflags"
4860         x_minus='-';
4861 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4862         $wrapper <testcpp.c >testcpp.out 2>&1; \
4863         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4864         x_cpp="$wrapper"
4865         x_minus=''
4866         echo "Eureka!"
4867 else
4868         dflt=''
4869         rp="No dice.  I can't find a C preprocessor.  Name one:"
4870         . ./myread
4871         x_cpp="$ans"
4872         x_minus=''
4873         $x_cpp <testcpp.c >testcpp.out 2>&1
4874         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4875                 echo "OK, that will do." >&4
4876         else
4877 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4878                 exit 1
4879         fi
4880 fi
4881
4882 case "$ok" in
4883 false)
4884         cppstdin="$x_cpp"
4885         cppminus="$x_minus"
4886         cpprun="$x_cpp"
4887         cpplast="$x_minus"
4888         set X $x_cpp
4889         shift
4890         case "$1" in
4891         "$cpp")
4892                 echo "Perhaps can we force $cc -E using a wrapper..."
4893                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4894                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4895                 then
4896                         echo "Yup, we can."
4897                         cppstdin="$wrapper"
4898                         cppminus='';
4899                 else
4900                         echo "Nope, we'll have to live without it..."
4901                 fi
4902                 ;;
4903         esac
4904         case "$cpprun" in
4905         "$wrapper")
4906                 cpprun=''
4907                 cpplast=''
4908                 ;;
4909         esac
4910         ;;
4911 esac
4912
4913 case "$cppstdin" in
4914 "$wrapper"|'cppstdin') ;;
4915 *) $rm -f $wrapper;;
4916 esac
4917 $rm -f testcpp.c testcpp.out
4918
4919 : Adjust cppfilter for path component separator
4920 case "$osname" in
4921 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4922 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4923 *)   cppfilter='' ;;
4924 esac
4925
4926 : Use gcc to determine libpth and incpth
4927 # If using gcc or clang, we can get better values for libpth, incpth
4928 # and usrinc directly from the compiler.
4929 # Note that ccname for clang is also gcc.
4930 case "$ccname" in
4931     gcc)
4932         $echo 'extern int foo;' > try.c
4933         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4934         shift
4935         if $test $# -gt 0; then
4936             incpth="$incpth $*"
4937             incpth="`$echo $incpth|$sed 's/^ //'`"
4938             for i in $*; do
4939                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4940                 if $test -d $j; then
4941                     libpth="$libpth $j"
4942                 fi
4943             done
4944             libpth="`$echo $libpth|$sed 's/^ //'`"
4945             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4946                 if $test -d $xxx; then
4947                     case " $libpth " in
4948                     *" $xxx "*) ;;
4949                     *) libpth="$libpth $xxx";;
4950                     esac
4951                 fi
4952             done
4953         fi
4954         $rm -f try.c
4955         case "$usrinc" in
4956         '') for i in $incpth; do
4957                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4958                     usrinc="$i"
4959                     break
4960                 fi
4961             done
4962             ;;
4963         esac
4964
4965         case "$usecrosscompile" in
4966         $define|true|[yY]*)
4967             case "$incpth" in
4968                 '') echo "Incpth not defined." >&4; croak=y ;;
4969                 *)  echo "Using incpth '$incpth'." >&4 ;;
4970             esac
4971             case "$libpth" in
4972                 '') echo "Libpth not defined." >&4; croak=y ;;
4973                 *)  echo "Using libpth '$libpth'." >&4 ;;
4974             esac
4975             case "$usrinc" in
4976                 '') echo "Usrinc not defined." >&4; croak=y ;;
4977                 *)  echo "Using usrinc $usrinc." >&4 ;;
4978             esac
4979             case "$croak" in
4980                 y)
4981                 if test "X$sysroot" = X; then
4982                     echo "Cannot continue, aborting." >&4; exit 1
4983                 else
4984                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4985                 fi
4986                 ;;
4987             esac
4988             ;;
4989         esac
4990     ;;
4991 esac
4992
4993 : Default value for incpth is just usrinc
4994 case "$incpth" in
4995 '') incpth="$usrinc";;
4996 esac
4997
4998 : Set private lib path
4999 case "$plibpth" in
5000 '') if ./mips; then
5001         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5002     fi;;
5003 esac
5004 case "$libpth" in
5005 ' ') dlist='';;
5006 '') dlist="$loclibpth $plibpth $glibpth";;
5007 *) dlist="$libpth";;
5008 esac
5009
5010 : Now check and see which directories actually exist, avoiding duplicates
5011 for xxx in $dlist
5012 do
5013     if $test -d $xxx; then
5014                 case " $libpth " in
5015                 *" $xxx "*) ;;
5016                 *) libpth="$libpth $xxx";;
5017                 esac
5018     fi
5019 done
5020 $cat <<'EOM'
5021
5022 Some systems have incompatible or broken versions of libraries.  Among
5023 the directories listed in the question below, please remove any you
5024 know not to be holding relevant libraries, and add any that are needed.
5025 Say "none" for none.
5026
5027 EOM
5028
5029 if test "X$sysroot" != X; then
5030     $cat <<EOM
5031 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5032
5033 EOM
5034 fi
5035
5036 case "$libpth" in
5037 '') dflt='none';;
5038 *)
5039         set X $libpth
5040         shift
5041         dflt=${1+"$@"}
5042         ;;
5043 esac
5044 rp="Directories to use for library searches?"
5045 . ./myread
5046 case "$ans" in
5047 none) libpth=' ';;
5048 *) libpth="$ans";;
5049 esac
5050
5051 : compute shared library extension
5052 case "$so" in
5053 '')
5054         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5055                 dflt='sl'
5056         else
5057                 dflt='so'
5058         fi
5059         ;;
5060 *) dflt="$so";;
5061 esac
5062 $cat <<EOM
5063
5064 On some systems, shared libraries may be available.  Answer 'none' if
5065 you want to suppress searching of shared libraries for the remainder
5066 of this configuration.
5067
5068 EOM
5069 rp='What is the file extension used for shared libraries?'
5070 . ./myread
5071 so="$ans"
5072
5073 : Does target system insist that shared library basenames are unique
5074 $cat << EOM
5075
5076 Some dynamic loaders assume that the *basename* of shared library filenames
5077 are globally unique.  We'll default this to undef as we assume your system
5078 is not this weird. Set to defined if you're on one of them.
5079
5080 EOM
5081
5082 dflt='n'
5083 rp='Make shared library basenames unique?'
5084 . ./myread
5085 case "$ans" in
5086 y|Y) val="$define" ;;
5087 *)   val="$undef"  ;;
5088 esac
5089 set d_libname_unique
5090 eval $setvar
5091
5092 : Define several unixisms.
5093 : Hints files or command line option can be used to override them.
5094 : The convoluted testing is in case hints files set either the old
5095 : or the new name.
5096 case "$_exe" in
5097 '')     case "$exe_ext" in
5098         '')     ;;
5099         *)      _exe="$exe_ext" ;;
5100         esac
5101         ;;
5102 esac
5103 case "$_a" in
5104 '')     case "$lib_ext" in
5105     '') _a='.a';;
5106         *)      _a="$lib_ext" ;;
5107         esac
5108         ;;
5109 esac
5110 case "$_o" in
5111 '') case "$obj_ext" in
5112         '')     _o='.o';;
5113         *)      _o="$obj_ext";;
5114         esac
5115         ;;
5116 esac
5117 case "$p_" in
5118 '') case "$path_sep" in
5119         '')     p_=':';;
5120         *)      p_="$path_sep";;
5121         esac
5122         ;;
5123 esac
5124 exe_ext=$_exe
5125 lib_ext=$_a
5126 obj_ext=$_o
5127 path_sep=$p_
5128
5129 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5130
5131 : Which makefile gets called first.  This is used by make depend.
5132 case "$firstmakefile" in
5133 '') firstmakefile='makefile';;
5134 esac
5135
5136 : Check is we will use socks
5137 case "$usesocks" in
5138 $define|true|[yY]*)     dflt='y';;
5139 *) dflt='n';;
5140 esac
5141 cat <<EOM
5142
5143 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5144 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5145 to use the PerlIO abstraction layer, this will be implicitly selected.
5146
5147 If this doesn't make any sense to you, just accept the default '$dflt'.
5148 EOM
5149 rp='Build Perl for SOCKS?'
5150 . ./myread
5151 case "$ans" in
5152 y|Y)    val="$define" ;;
5153 *)      val="$undef" ;;
5154 esac
5155 set usesocks
5156 eval $setvar
5157
5158 : Check for uselongdouble support
5159 case "$ccflags" in
5160 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5161 esac
5162
5163 case "$uselongdouble" in
5164 $define|true|[yY]*)     dflt='y';;
5165 *) dflt='n';;
5166 esac
5167 cat <<EOM
5168
5169 Perl can be built to take advantage of long doubles which
5170 (if available) may give more accuracy and range for floating point numbers.
5171
5172 If this doesn't make any sense to you, just accept the default '$dflt'.
5173 EOM
5174 rp='Try to use long doubles if available?'
5175 . ./myread
5176 case "$ans" in
5177 y|Y)    val="$define"   ;;
5178 *)      val="$undef"    ;;
5179 esac
5180 set uselongdouble
5181 eval $setvar
5182
5183 case "$uselongdouble" in
5184 true|[yY]*) uselongdouble="$define" ;;
5185 esac
5186
5187 : Look for a hint-file generated 'call-back-unit'.  If the
5188 : user has specified that long doubles should be used,
5189 : we may need to set or change some other defaults.
5190 if $test -f uselongdouble.cbu; then
5191     echo "Your platform has some specific hints regarding long doubles, using them..."
5192     . ./uselongdouble.cbu
5193 else
5194     case "$uselongdouble" in
5195         $define)
5196                 $cat <<EOM
5197 (Your platform does not have any specific hints for long doubles.)
5198 EOM
5199         ;;
5200     esac
5201 fi
5202
5203 : Check if quadmath is requested
5204 case "$usequadmath" in
5205 "$define"|true|[yY]*) usequadmath="$define" ;;
5206 *)                    usequadmath="$undef"  ;;
5207 esac
5208
5209 : Looking for optional libraries
5210 echo " "
5211 echo "Checking for optional libraries..." >&4
5212 case "$libs" in
5213 ' '|'') dflt='';;
5214 *) dflt="$libs";;
5215 esac
5216 case "$libswanted" in
5217 '') libswanted='c_s';;
5218 esac
5219 case "$usesocks" in
5220 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5221 esac
5222 case "$usecbacktrace" in
5223 "$define") libswanted="$libswanted bfd" ;;
5224 esac
5225 case "$usequadmath" in
5226 "$define") libswanted="$libswanted quadmath" ;;
5227 esac
5228 libsfound=''
5229 libsfiles=''
5230 libsdirs=''
5231 libspath=''
5232 for thisdir in $libpth $xlibpth; do
5233   test -d $thisdir && libspath="$libspath $thisdir"
5234 done
5235 for thislib in $libswanted; do
5236         for thisdir in $libspath; do
5237             xxx=''
5238             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5239                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5240                 $test -f "$xxx" && eval $libscheck
5241                 $test -f "$xxx" && libstyle=shared
5242                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5243                 $test -f "$xxx" && eval $libscheck
5244                 $test -f "$xxx" && libstyle=shared
5245             fi
5246             if test ! -f "$xxx"; then
5247                 xxx=$thisdir/lib$thislib.$so
5248                 $test -f "$xxx" && eval $libscheck
5249                 $test -f "$xxx" && libstyle=shared
5250             fi
5251             if test ! -f "$xxx"; then
5252                 xxx=$thisdir/lib$thislib$_a
5253                 $test -f "$xxx" && eval $libscheck
5254                 $test -f "$xxx" && libstyle=static
5255             fi
5256             if test ! -f "$xxx"; then
5257                 xxx=$thisdir/$thislib$_a
5258                 $test -f "$xxx" && eval $libscheck
5259                 $test -f "$xxx" && libstyle=static
5260             fi
5261             if test ! -f "$xxx"; then
5262                 xxx=$thisdir/lib${thislib}_s$_a
5263                 $test -f "$xxx" && eval $libscheck
5264                 $test -f "$xxx" && libstyle=static
5265                 $test -f "$xxx" && thislib=${thislib}_s
5266             fi
5267             if test ! -f "$xxx"; then
5268                 xxx=$thisdir/Slib$thislib$_a
5269                 $test -f "$xxx" && eval $libscheck
5270                 $test -f "$xxx" && libstyle=static
5271             fi
5272             if $test -f "$xxx"; then
5273                 case "$libstyle" in
5274                 shared) echo "Found -l$thislib (shared)." ;;
5275                 static) echo "Found -l$thislib." ;;
5276                 *)      echo "Found -l$thislib ($libstyle)." ;;
5277                 esac
5278                 case " $dflt " in
5279                 *"-l$thislib "*);;
5280                 *) dflt="$dflt -l$thislib"
5281                    libsfound="$libsfound $xxx"
5282                    yyy=`basename $xxx`
5283                    libsfiles="$libsfiles $yyy"
5284                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5285                    case " $libsdirs " in
5286                    *" $yyy "*) ;;
5287                    *) libsdirs="$libsdirs $yyy" ;;
5288                    esac
5289                    ;;
5290                 esac
5291                 break
5292             fi
5293         done
5294         if $test ! -f "$xxx"; then
5295             echo "No -l$thislib."
5296         fi
5297 done
5298 set X $dflt
5299 shift
5300 dflt="$*"
5301 case "$libs" in
5302 '') dflt="$dflt";;
5303 *) dflt="$libs";;
5304 esac
5305 case "$dflt" in
5306 ' '|'') dflt='none';;
5307 esac
5308
5309 $cat <<EOM
5310
5311 In order to compile $package on your machine, a number of libraries
5312 are usually needed.  Include any other special libraries here as well.
5313 Say "none" for none.  The default list is almost always right.
5314 EOM
5315
5316 echo " "
5317 rp="What libraries to use?"
5318 . ./myread
5319 case "$ans" in
5320 none) libs=' ';;
5321 *) libs="$ans";;
5322 esac
5323
5324 : determine optimization, if desired, or use for debug flag also
5325 case "$optimize" in
5326 ' '|$undef) dflt='none';;
5327 '') dflt='-O';;
5328 *) dflt="$optimize";;
5329 esac
5330 $cat <<EOH
5331
5332 By default, $package compiles with the -O flag to use the optimizer.
5333 Alternately, you might want to use the symbolic debugger, which uses
5334 the -g flag (on traditional Unix systems).  Either flag can be
5335 specified here.  To use neither flag, specify the word "none".
5336
5337 EOH
5338 rp="What optimizer/debugger flag should be used?"
5339 . ./myread
5340 optimize="$ans"
5341 case "$optimize" in
5342 'none') optimize=" ";;
5343 esac
5344
5345 : Check what DEBUGGING is required from the command line
5346 : -DEBUGGING      or -DDEBUGGING or
5347 : -DEBUGGING=both                       = -g + -DDEBUGGING
5348 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5349 : -DEBUGGING=none or -UDEBUGGING        =
5350 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5351 case "$EBUGGING" in
5352 '')     ;;
5353 *)      DEBUGGING=$EBUGGING ;;
5354 esac
5355
5356 case "$DEBUGGING" in
5357 -g|both|$define)
5358     case "$optimize" in
5359         *-g*) ;;
5360         *)    optimize="$optimize -g" ;;
5361     esac ;;
5362 none|$undef)
5363     case "$optimize" in
5364         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5365                 shift
5366                 optimize="$*"
5367                 ;;
5368     esac ;;
5369 esac
5370
5371 dflt=''
5372 case "$DEBUGGING" in
5373 both|$define) dflt='-DDEBUGGING'
5374 esac
5375
5376 : argument order is deliberate, as the flag will start with - which set could
5377 : think is an option
5378 checkccflag='check=$1; flag=$2; callback=$3;
5379 echo " ";
5380 echo "Checking if your compiler accepts $flag" 2>&1;
5381 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5382 echo "int main(void) { return 0; }" > gcctest.c;
5383 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5384     echo "Yes, it does." 2>&1;
5385     if $test -s gcctest.out ; then
5386         echo "But your platform does not like it:";
5387         cat gcctest.out;
5388     else
5389         case "$ccflags" in
5390         *$check*)
5391             echo "Leaving current flags $ccflags alone." 2>&1
5392             ;;
5393         *) dflt="$dflt $flag";
5394             eval $callback
5395             ;;
5396         esac
5397     fi
5398 else
5399     echo "Nope, it does not, but that is ok." 2>&1;
5400 fi
5401 '
5402
5403 : We will not override a previous value, but we might want to
5404 : augment a hint file
5405 case "$hint" in
5406 default|recommended)
5407         case "$gccversion" in
5408         1*) dflt="$dflt -fpcc-struct-return" ;;
5409         esac
5410         case "$optimize:$DEBUGGING" in
5411         *-g*:old) dflt="$dflt -DDEBUGGING";;
5412         esac
5413         case "$gccversion" in
5414         2*) if $test -d /etc/conf/kconfig.d &&
5415                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5416                 then
5417                         # Interactive Systems (ISC) POSIX mode.
5418                         dflt="$dflt -posix"
5419                 fi
5420                 ;;
5421         esac
5422         case "$gccversion" in
5423         1*) ;;
5424         2.[0-8]*) ;;
5425         ?*)     set strict-aliasing -fno-strict-aliasing
5426                 eval $checkccflag
5427                 ;;
5428         esac
5429         # For gcc, adding -pipe speeds up compilations for some, but apparently
5430         # some assemblers can't read from stdin.  (It also slows down compilations
5431         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5432         case "$gccversion" in
5433         ?*)     set pipe -pipe
5434                 eval $checkccflag
5435                 ;;
5436         esac
5437
5438         # on x86_64 (at least) we require an extra library (libssp) in the
5439         # link command line. This library is not named, so I infer that it is
5440         # an implementation detail that may change. Hence the safest approach
5441         # is to add the flag to the flags passed to the compiler at link time,
5442         # as that way the compiler can do the right implementation dependant
5443         # thing. (NWC)
5444         case "$gccversion" in
5445         ?*)     set stack-protector-strong -fstack-protector-strong
5446                 eval $checkccflag
5447                 case "$dflt" in
5448                 *-fstack-protector-strong*) ;; # It got added.
5449                 *) # Try the plain/older -fstack-protector.
5450                    set stack-protector -fstack-protector
5451                    eval $checkccflag
5452                    ;;
5453                 esac
5454                 ;;
5455         esac
5456         ;;
5457 esac
5458
5459 case "$mips_type" in
5460 *BSD*|'') inclwanted="$locincpth $usrinc";;
5461 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5462 esac
5463 for thisincl in $inclwanted; do
5464         if $test -d $thisincl; then
5465                 if $test x$thisincl != x$usrinc; then
5466                         case "$dflt" in
5467                         *" -I$thisincl "*);;
5468                         *) dflt="$dflt -I$thisincl ";;
5469                         esac
5470                 fi
5471         fi
5472 done
5473
5474 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5475         xxx=true;
5476 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5477         xxx=true;
5478 else
5479         xxx=false;
5480 fi;
5481 if $xxx; then
5482         case "$dflt" in
5483         *$2*);;
5484         *) dflt="$dflt -D$2";;
5485         esac;
5486 fi'
5487
5488 set signal.h LANGUAGE_C; eval $inctest
5489
5490 case "$usesocks" in
5491 $define)
5492         ccflags="$ccflags -DSOCKS"
5493         ;;
5494 esac
5495
5496 case "$hint" in
5497 default|recommended) dflt="$ccflags $dflt" ;;
5498 *) dflt="$ccflags";;
5499 esac
5500
5501 case "$dflt" in
5502 ''|' ') dflt=none;;
5503 esac
5504
5505 $cat <<EOH
5506
5507 Your C compiler may want other flags.  For this question you should include
5508 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5509 but you should NOT include libraries or ld flags like -lwhatever.  If you
5510 want $package to honor its debug switch, you should include -DDEBUGGING here.
5511 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5512
5513 To use no flags, specify the word "none".
5514
5515 EOH
5516 set X $dflt
5517 shift
5518 dflt=${1+"$@"}
5519 rp="Any additional cc flags?"
5520 . ./myread
5521 case "$ans" in
5522 none) ccflags='';;
5523 *) ccflags="$ans";;
5524 esac
5525
5526 : the following weeds options from ccflags that are of no interest to cpp
5527 case "$cppflags" in
5528 '') cppflags="$ccflags" ;;
5529 *)  cppflags="$cppflags $ccflags" ;;
5530 esac
5531 case "$gccversion" in
5532 1*) cppflags="$cppflags -D__GNUC__"
5533 esac
5534 case "$mips_type" in
5535 '');;
5536 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5537 esac
5538 case "$cppflags" in
5539 '');;
5540 *)
5541         echo " "
5542         echo "Let me guess what the preprocessor flags are..." >&4
5543         set X $cppflags
5544         shift
5545         cppflags=''
5546         $cat >cpp.c <<'EOM'
5547 #define BLURFL foo
5548
5549 BLURFL xx LFRULB
5550 EOM
5551         previous=''
5552         for flag in $*
5553         do
5554                 case "$flag" in
5555                 -*) ftry="$flag";;
5556                 *) ftry="$previous $flag";;
5557                 esac
5558                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5559                         >cpp1.out 2>/dev/null && \
5560                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5561                         >cpp2.out 2>/dev/null && \
5562                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5563                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5564                 then
5565                         cppflags="$cppflags $ftry"
5566                         previous=''
5567                 else
5568                         previous="$flag"
5569                 fi
5570         done
5571         set X $cppflags
5572         shift
5573         cppflags=${1+"$@"}
5574         case "$cppflags" in
5575         *-*)  echo "They appear to be: $cppflags";;
5576         esac
5577         $rm -f cpp.c cpp?.out
5578         ;;
5579 esac
5580
5581 : flags used in final linking phase
5582 case "$ldflags" in
5583 '') if ./venix; then
5584                 dflt='-i -z'
5585         else
5586                 dflt=''
5587         fi
5588         case "$ccflags" in
5589         *-posix*) dflt="$dflt -posix" ;;
5590         esac
5591         ;;
5592 *) dflt="$ldflags";;
5593 esac
5594 # See note above about -fstack-protector
5595 case "$ccflags" in
5596 *-fstack-protector-strong*)
5597         case "$dflt" in
5598         *-fstack-protector-strong*) ;; # Don't add it again
5599         *) dflt="$dflt -fstack-protector-strong" ;;
5600         esac
5601         ;;
5602 *-fstack-protector*)
5603         case "$dflt" in
5604         *-fstack-protector*) ;; # Don't add it again
5605         *) dflt="$dflt -fstack-protector" ;;
5606         esac
5607         ;;
5608 esac
5609
5610 : Try to guess additional flags to pick up local libraries.
5611 for thislibdir in $libpth; do
5612         case " $loclibpth " in
5613         *" $thislibdir "*)
5614                 case "$dflt " in
5615                 *"-L$thislibdir "*) ;;
5616                 *)  dflt="$dflt -L$thislibdir" ;;
5617                 esac
5618                 ;;
5619         esac
5620 done
5621
5622 case "$dflt" in
5623 '') dflt='none' ;;
5624 esac
5625
5626 $cat <<EOH
5627
5628 Your C linker may need flags.  For this question you should
5629 include -L/whatever and any other flags used by the C linker, but you
5630 should NOT include libraries like -lwhatever.
5631
5632 Make sure you include the appropriate -L/path flags if your C linker
5633 does not normally search all of the directories you specified above,
5634 namely
5635         $libpth
5636 To use no flags, specify the word "none".
5637
5638 EOH
5639
5640 rp="Any additional ld flags (NOT including libraries)?"
5641 . ./myread
5642 case "$ans" in
5643 none) ldflags='';;
5644 *) ldflags="$ans";;
5645 esac
5646 rmlist="$rmlist pdp11"
5647
5648 : coherency check
5649 echo " "
5650 echo "Checking your choice of C compiler and flags for coherency..." >&4
5651 $cat > try.c <<'EOF'
5652 #include <stdio.h>
5653 int main() { printf("Ok\n"); return(0); }
5654 EOF
5655 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5656 shift
5657 $cat >try.msg <<'EOM'
5658 I've tried to compile and run the following simple program:
5659
5660 EOM
5661 $cat try.c >> try.msg
5662
5663 $cat >> try.msg <<EOM
5664
5665 I used the command:
5666
5667         $*
5668         $run ./try
5669
5670 and I got the following output:
5671
5672 EOM
5673 dflt=y
5674 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5675         if $sh -c "$run ./try " >>try.msg 2>&1; then
5676                 xxx=`$run ./try`
5677                 case "$xxx" in
5678                 "Ok") dflt=n ;;
5679                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5680                 esac
5681         else
5682                 echo "The program compiled OK, but exited with status $?." >>try.msg
5683                 rp="You have a problem.  Shall I abort Configure"
5684                 dflt=y
5685         fi
5686 else
5687         echo "I can't compile the test program." >>try.msg
5688         rp="You have a BIG problem.  Shall I abort Configure"
5689         dflt=y
5690 fi
5691 case "$dflt" in
5692 y)
5693         $cat try.msg >&4
5694         case "$knowitall" in
5695         '')
5696                 echo "(The supplied flags or libraries might be incorrect.)"
5697                 ;;
5698         *) dflt=n;;
5699         esac
5700         echo " "
5701         . ./myread
5702         case "$ans" in
5703         n*|N*) ;;
5704         *)      echo "Ok.  Stopping Configure." >&4
5705                 exit 1
5706                 ;;
5707         esac
5708         ;;
5709 n) echo "OK, that should do.";;
5710 esac
5711 $rm_try gcctest gcctest.out
5712
5713 : define a shorthand compile call
5714 compile='
5715 mc_file=$1;
5716 shift;
5717 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5718 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5719 exit 1;
5720 fi;
5721 esac;
5722 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5723 : define a shorthand compile call for compilations that should be ok.
5724 compile_ok='
5725 mc_file=$1;
5726 shift;
5727 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5728
5729 : determine filename position in cpp output
5730 echo " "
5731 echo "Computing filename position in cpp output for #include directives..." >&4
5732 case "$osname" in
5733 vos) testaccess=-e ;;
5734 *)   testaccess=-r ;;
5735 esac
5736 echo '#include <stdio.h>' > foo.c
5737 $cat >fieldn <<EOF
5738 $startsh
5739 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5740 $grep '^[       ]*#.*stdio\.h' | \
5741 while read cline; do
5742         pos=1
5743         set \$cline
5744         while $test \$# -gt 0; do
5745                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5746                         echo "\$pos"
5747                         exit 0
5748                 fi
5749                 shift
5750                 pos=\`expr \$pos + 1\`
5751         done
5752 done
5753 EOF
5754 chmod +x fieldn
5755 fieldn=`./fieldn`
5756 $rm -f foo.c fieldn
5757 case $fieldn in
5758 '') pos='???';;
5759 1) pos=first;;
5760 2) pos=second;;
5761 3) pos=third;;
5762 *) pos="${fieldn}th";;
5763 esac
5764 echo "Your cpp writes the filename in the $pos field of the line."
5765
5766 : locate header file
5767 $cat >findhdr <<EOF
5768 $startsh
5769 wanted=\$1
5770 name=''
5771 for usrincdir in $incpth
5772 do
5773         if test -f \$usrincdir/\$wanted; then
5774                 echo "\$usrincdir/\$wanted"
5775                 exit 0
5776         fi
5777 done
5778 awkprg='{ print \$$fieldn }'
5779 echo "#include <\$wanted>" > foo\$\$.c
5780 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5781 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5782 while read cline; do
5783         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5784         case "\$name" in
5785         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5786         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5787         *) exit 2;;
5788         esac;
5789 done;
5790 #
5791 # status = 0: grep returned 0 lines, case statement not executed
5792 # status = 1: headerfile found
5793 # status = 2: while loop executed, no headerfile found
5794 #
5795 status=\$?
5796 $rm -f foo\$\$.c;
5797 if test \$status -eq 1; then
5798         exit 0;
5799 fi
5800 exit 1
5801 EOF
5802 chmod +x findhdr
5803
5804 : define an alternate in-header-list? function
5805 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5806 cont=true; xxf="echo \"<\$1> found.\" >&4";
5807 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5808 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5809 esac;
5810 case $# in 4) instead=instead;; *) instead="at last";; esac;
5811 while $test "$cont"; do
5812         xxx=`./findhdr $1`
5813         var=$2; eval "was=\$$2";
5814         if $test "$xxx" && $test -r "$xxx";
5815         then eval $xxf;
5816         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5817                 cont="";
5818         else eval $xxnf;
5819         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5820         set $yyy; shift; shift; yyy=$@;
5821         case $# in 0) cont="";;
5822         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5823                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5824         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5825                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5826         esac;
5827 done;
5828 while $test "$yyy";
5829 do set $yyy; var=$2; eval "was=\$$2";
5830         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5831         set $yyy; shift; shift; yyy=$@;
5832 done'
5833
5834 : see if stdlib is available
5835 set stdlib.h i_stdlib
5836 eval $inhdr
5837
5838 : check for lengths of integral types
5839 echo " "
5840 case "$intsize" in
5841 '')
5842         echo "Checking to see how big your integers are..." >&4
5843         $cat >try.c <<EOCP
5844 #include <stdio.h>
5845 #$i_stdlib I_STDLIB
5846 #ifdef I_STDLIB
5847 #include <stdlib.h>
5848 #endif
5849 int main()
5850 {
5851         printf("intsize=%d;\n", (int)sizeof(int));
5852         printf("longsize=%d;\n", (int)sizeof(long));
5853         printf("shortsize=%d;\n", (int)sizeof(short));
5854         exit(0);
5855 }
5856 EOCP
5857         set try
5858         if eval $compile_ok && $run ./try > /dev/null; then
5859                 eval `$run ./try`
5860                 echo "Your integers are $intsize bytes long."
5861                 echo "Your long integers are $longsize bytes long."
5862                 echo "Your short integers are $shortsize bytes long."
5863         else
5864                 $cat >&4 <<EOM
5865 !
5866 Help! I can't compile and run the intsize test program: please enlighten me!
5867 (This is probably a misconfiguration in your system or libraries, and
5868 you really ought to fix it.  Still, I'll try anyway.)
5869 !
5870 EOM
5871                 dflt=4
5872                 rp="What is the size of an integer (in bytes)?"
5873                 . ./myread
5874                 intsize="$ans"
5875                 dflt=$intsize
5876                 rp="What is the size of a long integer (in bytes)?"
5877                 . ./myread
5878                 longsize="$ans"
5879                 dflt=2
5880                 rp="What is the size of a short integer (in bytes)?"
5881                 . ./myread
5882                 shortsize="$ans"
5883         fi
5884         ;;
5885 esac
5886 $rm_try
5887
5888 : check for long long
5889 echo " "
5890 echo "Checking to see if you have long long..." >&4
5891 echo 'int main() { long long x = 7; return 0; }' > try.c
5892 set try
5893 if eval $compile; then
5894         val="$define"
5895         echo "You have long long."
5896 else
5897         val="$undef"
5898         echo "You do not have long long."
5899 fi
5900 $rm_try
5901 set d_longlong
5902 eval $setvar
5903
5904 : check for length of long long
5905 case "${d_longlong}${longlongsize}" in
5906 $define)
5907         echo " "
5908         echo "Checking to see how big your long longs are..." >&4
5909         $cat >try.c <<'EOCP'
5910 #include <stdio.h>
5911 int main()
5912 {
5913     printf("%d\n", (int)sizeof(long long));
5914     return(0);
5915 }
5916 EOCP
5917         set try
5918         if eval $compile_ok; then
5919                 longlongsize=`$run ./try`
5920                 echo "Your long longs are $longlongsize bytes long."
5921         else
5922                 dflt='8'
5923                 echo " "
5924                 echo "(I can't seem to compile the test program.  Guessing...)"
5925                 rp="What is the size of a long long (in bytes)?"
5926                 . ./myread
5927                 longlongsize="$ans"
5928         fi
5929         if $test "X$longsize" = "X$longlongsize"; then
5930                 echo "(That isn't any different from an ordinary long.)"
5931         fi
5932         ;;
5933 esac
5934 $rm_try
5935
5936 : see if inttypes.h is available
5937 : we want a real compile instead of Inhdr because some systems
5938 : have an inttypes.h which includes non-existent headers
5939 echo " "
5940 $cat >try.c <<EOCP
5941 #include <inttypes.h>
5942 int main() {
5943         static int32_t foo32 = 0x12345678;
5944 }
5945 EOCP
5946 set try
5947 if eval $compile; then
5948         echo "<inttypes.h> found." >&4
5949         val="$define"
5950 else
5951         echo "<inttypes.h> NOT found." >&4
5952         val="$undef"
5953 fi
5954 $rm_try
5955 set i_inttypes
5956 eval $setvar
5957
5958 : check for int64_t
5959 echo " "
5960 echo "Checking to see if you have int64_t..." >&4
5961 $cat >try.c <<EOCP
5962 #include <sys/types.h>
5963 #$i_inttypes I_INTTYPES
5964 #ifdef I_INTTYPES
5965 #include <inttypes.h>
5966 #endif
5967 int main() { int64_t x = 7; }
5968 EOCP
5969 set try
5970 if eval $compile; then
5971         val="$define"
5972         echo "You have int64_t."
5973 else
5974         val="$undef"
5975         echo "You do not have int64_t."
5976 fi
5977 $rm_try
5978 set d_int64_t
5979 eval $setvar
5980
5981 : Check if 64bit ints have a quad type
5982 echo " "
5983 echo "Checking which 64-bit integer type we could use..." >&4
5984
5985 case "$intsize" in
5986 8) val=int
5987    set quadtype
5988    eval $setvar
5989    val='"unsigned int"'
5990    set uquadtype
5991    eval $setvar
5992    quadkind=1
5993    ;;
5994 *) case "$longsize" in
5995    8) val=long
5996       set quadtype
5997       eval $setvar
5998       val='"unsigned long"'
5999       set uquadtype
6000       eval $setvar
6001       quadkind=2
6002       ;;
6003    *) case "$d_longlong:$longlongsize" in
6004       define:8)
6005         val='"long long"'
6006         set quadtype
6007         eval $setvar
6008         val='"unsigned long long"'
6009         set uquadtype
6010         eval $setvar
6011         quadkind=3
6012         ;;
6013       *) case "$d_int64_t" in
6014          define)
6015            val=int64_t
6016            set quadtype
6017            eval $setvar
6018            val=uint64_t
6019            set uquadtype
6020            eval $setvar
6021            quadkind=4
6022            ;;
6023          esac
6024          ;;
6025       esac
6026       ;;
6027    esac
6028    ;;
6029 esac
6030
6031 case "$quadtype" in
6032 '')     echo "Alas, no 64-bit integer types in sight." >&4
6033         d_quad="$undef"
6034         ;;
6035 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6036         d_quad="$define"
6037         ;;
6038 esac
6039
6040 : Do we want 64bit support
6041 case "$uselonglong" in
6042 "$define"|true|[yY]*)
6043         cat <<EOM >&4
6044
6045 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6046 EOM
6047         use64bitint="$define"
6048         ;;
6049 esac
6050 case "$use64bits" in
6051 "$define"|true|[yY]*)
6052         cat <<EOM >&4
6053
6054 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6055 EOM
6056         use64bitint="$define"
6057         ;;
6058 esac
6059 case "$use64bitints" in
6060 "$define"|true|[yY]*)
6061         cat <<EOM >&4
6062
6063 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6064 EOM
6065         use64bitint="$define"
6066         ;;
6067 esac
6068 case "$use64bitsint" in
6069 "$define"|true|[yY]*)
6070         cat <<EOM >&4
6071
6072 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6073 EOM
6074         use64bitint="$define"
6075         ;;
6076 esac
6077 case "$uselonglongs" in
6078 "$define"|true|[yY]*)
6079         cat <<EOM >&4
6080
6081 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6082 EOM
6083         use64bitint="$define"
6084         ;;
6085 esac
6086 case "$use64bitsall" in
6087 "$define"|true|[yY]*)
6088         cat <<EOM >&4
6089
6090 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6091 EOM
6092         use64bitall="$define"
6093         ;;
6094 esac
6095
6096 case "$ccflags" in
6097 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6098 esac
6099 case "$use64bitall" in
6100 "$define"|true|[yY]*) use64bitint="$define" ;;
6101 esac
6102
6103 case "$longsize" in
6104 8) cat <<EOM
6105
6106 You have natively 64-bit long integers.
6107 EOM
6108    val="$define"
6109    ;;
6110 *) case "$use64bitint" in
6111    "$define"|true|[yY]*) dflt='y';;
6112    *) dflt='n';;
6113    esac
6114    case "$d_quad" in
6115    "$define") ;;
6116    *) dflt='n' ;;
6117    esac
6118    cat <<EOM
6119
6120 Perl can be built to take advantage of 64-bit integer types
6121 on some systems.  To do so, Configure can be run with -Duse64bitint.
6122 Choosing this option will most probably introduce binary incompatibilities.
6123
6124 If this doesn't make any sense to you, just accept the default '$dflt'.
6125 (The default has been chosen based on your configuration.)
6126 EOM
6127    rp='Try to use 64-bit integers, if available?'
6128    . ./myread
6129    case "$ans" in
6130    [yY]*) val="$define" ;;
6131    *)     val="$undef"  ;;
6132    esac
6133    ;;
6134 esac
6135 set use64bitint
6136 eval $setvar
6137
6138 case "$use64bitall" in
6139 "$define"|true|[yY]*) dflt='y' ;;
6140 *) case "$longsize" in
6141    8) dflt='y' ;;
6142    *) dflt='n' ;;
6143    esac
6144    ;;
6145 esac
6146 cat <<EOM
6147
6148 You may also choose to try maximal 64-bitness.  It means using as much
6149 64-bitness as possible on the platform.  This in turn means even more
6150 binary incompatibilities.  On the other hand, your platform may not
6151 have any more 64-bitness available than what you already have chosen.
6152
6153 If this doesn't make any sense to you, just accept the default '$dflt'.
6154 (The default has been chosen based on your configuration.)
6155 EOM
6156 rp='Try to use maximal 64-bit support, if available?'
6157 . ./myread
6158 case "$ans" in
6159 [yY]*) val="$define" ;;
6160 *)     val="$undef"  ;;
6161 esac
6162 set use64bitall
6163 eval $setvar
6164 case "$use64bitall" in
6165 "$define")
6166         case "$use64bitint" in
6167         "$undef")
6168                 cat <<EOM
6169
6170 Since you have chosen a maximally 64-bit build, I'm also turning on
6171 the use of 64-bit integers.
6172 EOM
6173                 use64bitint="$define" ;;
6174         esac
6175         ;;
6176 esac
6177
6178 : Look for a hint-file generated 'call-back-unit'.  If the
6179 : user has specified that a 64-bit perl is to be built,
6180 : we may need to set or change some other defaults.
6181 if $test -f use64bitint.cbu; then
6182         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6183         . ./use64bitint.cbu
6184 fi
6185 case "$use64bitint" in
6186 "$define"|true|[yY]*)
6187         : This test was common to all the OpenBSD forks, and seems harmless for
6188         : other platforms:
6189         echo " "
6190         echo "Checking if your C library has broken 64-bit functions..." >&4
6191         cat >try.c <<EOCP
6192 #include <stdio.h>
6193 typedef $uquadtype myULL;
6194 int main (void)
6195 {
6196     struct {
6197         double d;
6198         myULL  u;
6199     } *p, test[] = {
6200         {4294967303.15, 4294967303ULL},
6201         {4294967294.2,  4294967294ULL},
6202         {4294967295.7,  4294967295ULL},
6203         {0.0, 0ULL}
6204     };
6205     for (p = test; p->u; p++) {
6206         myULL x = (myULL)p->d;
6207         if (x != p->u) {
6208             printf("buggy\n");
6209             return 0;
6210         }
6211     }
6212     printf("ok\n");
6213     return 0;
6214 }
6215 EOCP
6216         set try
6217         if eval $compile_ok; then
6218             libcquad=`$run ./try`
6219             echo "Your C library's 64-bit functions are $libcquad."
6220         else
6221             echo "(I can't seem to compile the test program.)"
6222             echo "Assuming that your C library's 64-bit functions are ok."
6223             libcquad="ok"
6224         fi
6225         $rm_try
6226
6227         case "$libcquad" in
6228             buggy*)
6229                 cat >&4 <<EOM
6230
6231 *** You have a C library with broken 64-bit functions.
6232 *** 64-bit support does not work reliably in this configuration.
6233 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6234 *** Cannot continue, aborting.
6235
6236 EOM
6237                 exit 1
6238                 ;;
6239         esac
6240         case "$longsize" in
6241         4) case "$archname64" in
6242            '') archname64=64int ;;
6243            esac
6244            ;;
6245         esac
6246         ;;
6247 esac
6248
6249 : Look for a hint-file generated 'call-back-unit'.  If the
6250 : user has specified that a maximally 64-bit perl is to be built,
6251 : we may need to set or change some other defaults.
6252 if $test -f use64bitall.cbu; then
6253         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6254         . ./use64bitall.cbu
6255 fi
6256 case "$use64bitall" in
6257 "$define"|true|[yY]*)
6258         case "$longsize" in
6259         4) case "$archname64" in
6260            ''|64int) archname64=64all ;;
6261            esac
6262            ;;
6263         esac
6264         ;;
6265 esac
6266
6267 case "$d_quad:$use64bitint" in
6268 $undef:$define)
6269         cat >&4 <<EOF
6270
6271 *** You have chosen to use 64-bit integers,
6272 *** but none can be found.
6273 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6274 *** Cannot continue, aborting.
6275
6276 EOF
6277         exit 1
6278         ;;
6279 esac
6280
6281 : Check if we are using the GNU C library
6282 echo " "
6283 echo "Checking for GNU C Library..." >&4
6284 cat >try.c <<'EOCP'
6285 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6286    alone are insufficient to distinguish different versions, such as
6287    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6288    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6289 */
6290 #include <stdio.h>
6291 int main(void)
6292 {
6293 #ifdef __GLIBC__
6294 #   ifdef __GLIBC_MINOR__
6295 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6296 #           include <gnu/libc-version.h>
6297             printf("%s\n",  gnu_get_libc_version());
6298 #       else
6299             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6300 #       endif
6301 #   else
6302         printf("%d\n",  __GLIBC__);
6303 #   endif
6304     return 0;
6305 #else
6306     return 1;
6307 #endif
6308 }
6309 EOCP
6310 set try
6311 if eval $compile_ok && $run ./try > glibc.ver; then
6312         val="$define"
6313         gnulibc_version=`$cat glibc.ver`
6314         echo "You are using the GNU C Library version $gnulibc_version"
6315 else
6316         val="$undef"
6317         gnulibc_version=''
6318         echo "You are not using the GNU C Library"
6319 fi
6320 $rm_try glibc.ver
6321 set d_gnulibc
6322 eval $setvar
6323
6324 : see if nm is to be used to determine whether a symbol is defined or not
6325 case "$usenm" in
6326 '')
6327         dflt=''
6328         case "$d_gnulibc" in
6329         "$define")
6330                 echo " "
6331                 echo "nm probably won't work on the GNU C Library." >&4
6332                 dflt=n
6333                 ;;
6334         esac
6335         case "$dflt" in
6336         '')
6337                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6338                         echo " "
6339                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6340                         echo "'nm' won't be sufficient on this system." >&4
6341                         dflt=n
6342                 fi
6343                 ;;
6344         esac
6345         case "$dflt" in
6346         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6347                 if $test $dflt -gt 20; then
6348                         dflt=y
6349                 else
6350                         dflt=n
6351                 fi
6352                 ;;
6353         esac
6354         ;;
6355 *)
6356         case "$usenm" in
6357         true|$define) dflt=y;;
6358         *) dflt=n;;
6359         esac
6360         ;;
6361 esac
6362 $cat <<EOM
6363
6364 I can use $nm to extract the symbols from your C libraries. This
6365 is a time consuming task which may generate huge output on the disk (up
6366 to 3 megabytes) but that should make the symbols extraction faster. The
6367 alternative is to skip the 'nm' extraction part and to compile a small
6368 test program instead to determine whether each symbol is present. If
6369 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6370 this may be the best solution.
6371
6372 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6373
6374 EOM
6375 rp="Shall I use $nm to extract C symbols from the libraries?"
6376 . ./myread
6377 case "$ans" in
6378 [Nn]*) usenm=false;;
6379 *) usenm=true;;
6380 esac
6381
6382 runnm=$usenm
6383 case "$reuseval" in
6384 true) runnm=false;;
6385 esac
6386
6387 : nm options which may be necessary
6388 case "$nm_opt" in
6389 '') if $test -f /mach_boot; then
6390                 nm_opt=''       # Mach
6391         elif $test -d /usr/ccs/lib; then
6392                 nm_opt='-p'     # Solaris (and SunOS?)
6393         elif $test -f /dgux; then
6394                 nm_opt='-p'     # DG-UX
6395         elif $test -f /lib64/rld; then
6396                 nm_opt='-p'     # 64-bit Irix
6397         else
6398                 nm_opt=''
6399         fi;;
6400 esac
6401
6402 : nm options which may be necessary for shared libraries but illegal
6403 : for archive libraries.  Thank you, Linux.
6404 case "$nm_so_opt" in
6405 '')     case "$myuname" in
6406         *linux*|gnu*)
6407                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6408                         nm_so_opt='--dynamic'
6409                 fi
6410                 ;;
6411         esac
6412         ;;
6413 esac
6414
6415 : Figure out where the libc is located
6416 case "$runnm" in
6417 true)
6418 : get list of predefined functions in a handy place
6419 echo " "
6420 case "$libc" in
6421 '') libc=unknown
6422         case "$libs" in
6423         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6424         esac
6425         ;;
6426 esac
6427 case "$libs" in
6428 '') ;;
6429 *)  for thislib in $libs; do
6430         case "$thislib" in
6431         -lc|-lc_s)
6432                 : Handle C library specially below.
6433                 ;;
6434         -l*)
6435                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6436                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6437                         :
6438                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6439                         :
6440                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6441                         :
6442                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6443                         :
6444                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6445                         :
6446                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6447                         :
6448                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6449                         :
6450                 else
6451                         try=''
6452                 fi
6453                 libnames="$libnames $try"
6454                 ;;
6455         *) libnames="$libnames $thislib" ;;
6456         esac
6457         done
6458         ;;
6459 esac
6460 xxx=normal
6461 case "$libc" in
6462 unknown)
6463         set /lib/libc.$so
6464         for xxx in $libpth; do
6465                 $test -r $1 || set $xxx/libc.$so
6466                 : The messy sed command sorts on library version numbers.
6467                 $test -r $1 || \
6468                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6469                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6470                                 h
6471                                 s/[0-9][0-9]*/0000&/g
6472                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6473                                 G
6474                                 s/\n/ /' | \
6475                          $sort | $sed -e 's/^.* //'`
6476                 eval set \$$#
6477         done
6478         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6479         $test -r $1 || set $sysroot/lib/libsys_s$_a
6480         ;;
6481 *)
6482         set blurfl
6483         ;;
6484 esac
6485 if $test -r "$1"; then
6486         echo "Your (shared) C library seems to be in $1."
6487         libc="$1"
6488 elif $test -r /lib/libc && $test -r /lib/clib; then
6489         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6490         xxx=apollo
6491         libc='/lib/clib /lib/libc'
6492         if $test -r /lib/syslib; then
6493                 echo "(Your math library is in /lib/syslib.)"
6494                 libc="$libc /lib/syslib"
6495         fi
6496 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6497         echo "Your C library seems to be in $libc, as you said before."
6498 elif $test -r $incpath/usr/lib/libc$_a; then
6499         libc=$incpath/usr/lib/libc$_a;
6500         echo "Your C library seems to be in $libc.  That's fine."
6501 elif $test -r /lib/libc$_a; then
6502         libc=/lib/libc$_a;
6503         echo "Your C library seems to be in $libc.  You're normal."
6504 else
6505         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6506                 :
6507         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6508                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6509         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6510                 :
6511         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6512                 :
6513         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6514                 :
6515         else
6516                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6517         fi
6518         if $test -r "$tans"; then
6519                 echo "Your C library seems to be in $tans, of all places."
6520                 libc=$tans
6521         else
6522                 libc='blurfl'
6523         fi
6524 fi
6525 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6526         dflt="$libc"
6527         cat <<EOM
6528
6529 If the guess above is wrong (which it might be if you're using a strange
6530 compiler, or your machine supports multiple models), you can override it here.
6531
6532 EOM
6533 else
6534         dflt=''
6535         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6536         cat >&4 <<EOM
6537 I can't seem to find your C library.  I've looked in the following places:
6538
6539 EOM
6540         $sed 's/^/      /' libpath
6541         cat <<EOM
6542
6543 None of these seems to contain your C library. I need to get its name...
6544
6545 EOM
6546 fi
6547 fn=f
6548 rp='Where is your C library?'
6549 . ./getfile
6550 libc="$ans"
6551
6552 echo " "
6553 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6554 set X `cat libnames`
6555 shift
6556 xxx=files
6557 case $# in 1) xxx=file; esac
6558 echo "Extracting names from the following $xxx for later perusal:" >&4
6559 echo " "
6560 $sed 's/^/      /' libnames >&4
6561 echo " "
6562 $echo $n "This may take a while...$c" >&4
6563
6564 for file in $*; do
6565         case $file in
6566         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6567         *) $nm $nm_opt $file 2>/dev/null;;
6568         esac
6569 done >libc.tmp
6570
6571 $echo $n ".$c"
6572 $grep fprintf libc.tmp > libc.ptf
6573 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6574 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6575 xxx='[ADTSIWi]'
6576 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6577         eval $xscan;\
6578         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6579                 eval $xrun
6580 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6581         eval $xscan;\
6582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6583                 eval $xrun
6584 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6585         eval $xscan;\
6586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6587                 eval $xrun
6588 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6589         eval $xscan;\
6590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6591                 eval $xrun
6592 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6593         eval $xscan;\
6594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6595                 eval $xrun
6596 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6597         eval $xscan;\
6598         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6599                 eval $xrun
6600 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6601                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6602         eval $xscan;\
6603         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6604                 eval $xrun
6605 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6606         eval $xscan;\
6607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6608                 eval $xrun
6609 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6610         eval $xscan;\
6611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6612                 eval $xrun
6613 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6614         eval $xscan;\
6615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6616                 eval $xrun
6617 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6618         eval $xscan;\
6619         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6620                 eval $xrun
6621 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6622         eval $xscan;\
6623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6624                 eval $xrun
6625 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6626         eval $xscan;\
6627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6628                 eval $xrun
6629 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6630         eval $xscan;\
6631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6632                 eval $xrun
6633 else
6634         $nm -p $* 2>/dev/null >libc.tmp
6635         $grep fprintf libc.tmp > libc.ptf
6636         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6637                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6638         then
6639                 nm_opt='-p'
6640                 eval $xrun
6641         else
6642                 echo " "
6643                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6644                 com=''
6645                 if $ar t $libc > libc.tmp && \
6646                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6647                 then
6648                         for thisname in $libnames $libc; do
6649                                 $ar t $thisname >>libc.tmp
6650                         done
6651                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6652                         echo "Ok." >&4
6653                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6654                         for thisname in $libnames $libc; do
6655                                 $ar tv $thisname >>libc.tmp
6656                                 emximp -o tmp.imp $thisname \
6657                                     2>/dev/null && \
6658                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6659                                     < tmp.imp >>libc.tmp
6660                                 $rm -f tmp.imp
6661                         done
6662                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6663                         echo "Ok." >&4
6664                 else
6665                         echo "$ar didn't seem to work right." >&4
6666                         echo "Maybe this is a Cray...trying bld instead..." >&4
6667                         if  bld t $libc | \
6668                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6669                                 $test -s libc.list
6670                         then
6671                                 for thisname in $libnames; do
6672                                         bld t $libnames | \
6673                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6674                                         $ar t $thisname >>libc.tmp
6675                                 done
6676                                 echo "Ok." >&4
6677                         else
6678                                 echo "That didn't work either.  Giving up." >&4
6679                                 exit 1
6680                         fi
6681                 fi
6682         fi
6683 fi
6684 nm_extract="$com"
6685 case "$PASE" in
6686 define)
6687     echo " "
6688     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6689     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6690     ;;
6691 *)  if $test -f /lib/syscalls.exp; then
6692         echo " "
6693         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6694         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6695                 /lib/syscalls.exp >>libc.list
6696     fi
6697     ;;
6698 esac
6699 ;;
6700 esac
6701 $rm -f libnames libpath
6702
6703 : Check if we are using C++
6704 echo " "
6705 echo "Checking for C++..." >&4
6706 $cat >try.c <<'EOCP'
6707 #include <stdio.h>
6708 int main(void)
6709 {
6710 #ifdef __cplusplus
6711     return 0;
6712 #else
6713     return 1;
6714 #endif
6715 }
6716 EOCP
6717 set try
6718 if eval $compile_ok && $run ./try; then
6719         val="$define"
6720         echo "You are using a C++ compiler."
6721 else
6722         val="$undef"
6723         echo "You are not using a C++ compiler."
6724 fi
6725 $rm_try cplusplus$$
6726 set d_cplusplus
6727 eval $setvar
6728
6729 : is a C symbol defined?
6730 csym='tlook=$1;
6731 case "$3" in
6732 -v) tf=libc.tmp; tdc="";;
6733 -a) tf=libc.tmp; tdc="[]";;
6734 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6735 esac;
6736 case "$d_cplusplus" in
6737     $define)    extern_C="extern \"C\"" ;;
6738     *)          extern_C="extern"       ;;
6739 esac;
6740 tx=yes;
6741 case "$reuseval-$4" in
6742 true-) ;;
6743 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6744 esac;
6745 case "$tx" in
6746 yes)
6747         tval=false;
6748         if $test "$runnm" = true; then
6749                 if $contains $tlook $tf >/dev/null 2>&1; then
6750                         tval=true;
6751                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6752                         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;
6753                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6754                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6755                         $rm_try;
6756                 fi;
6757         else
6758                 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;
6759                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6760                 $rm_try;
6761         fi;
6762         ;;
6763 *)
6764         case "$tval" in
6765         $define) tval=true;;
6766         *) tval=false;;
6767         esac;
6768         ;;
6769 esac;
6770 eval "$2=$tval"'
6771
6772 : define an is-in-libc? function
6773 inlibc='echo " "; td=$define; tu=$undef;
6774 sym=$1; var=$2; eval "was=\$$2";
6775 tx=yes;
6776 case "$reuseval$was" in
6777 true) ;;
6778 true*) tx=no;;
6779 esac;
6780 case "$tx" in
6781 yes)
6782         set $sym tres -f;
6783         eval $csym;
6784         case "$tres" in
6785         true)
6786                 echo "$sym() found." >&4;
6787                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6788         *)
6789                 echo "$sym() NOT found." >&4;
6790                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6791         esac;;
6792 *)
6793         case "$was" in
6794         $define) echo "$sym() found." >&4;;
6795         *) echo "$sym() NOT found." >&4;;
6796         esac;;
6797 esac'
6798
6799 : check for length of double
6800 echo " "
6801 case "$doublesize" in
6802 '')
6803         echo "Checking to see how big your double precision numbers are..." >&4
6804         $cat >try.c <<EOCP
6805 #include <stdio.h>
6806 #$i_stdlib I_STDLIB
6807 #ifdef I_STDLIB
6808 #include <stdlib.h>
6809 #endif
6810 int main()
6811 {
6812     printf("%d\n", (int)sizeof(double));
6813     exit(0);
6814 }
6815 EOCP
6816         set try
6817         if eval $compile_ok; then
6818                 doublesize=`$run ./try`
6819                 echo "Your double is $doublesize bytes long."
6820         else
6821                 dflt='8'
6822                 echo "(I can't seem to compile the test program.  Guessing...)"
6823                 rp="What is the size of a double precision number (in bytes)?"
6824                 . ./myread
6825                 doublesize="$ans"
6826         fi
6827         ;;
6828 esac
6829 $rm_try
6830
6831 : see if this is a float.h system
6832 set float.h i_float
6833 eval $inhdr
6834
6835 : check for long doubles
6836 echo " "
6837 echo "Checking to see if you have long double..." >&4
6838 echo 'int main() { long double x = 7.0; }' > try.c
6839 set try
6840 if eval $compile; then
6841         val="$define"
6842         echo "You have long double."
6843 else
6844         val="$undef"
6845         echo "You do not have long double."
6846 fi
6847 $rm_try
6848 set d_longdbl
6849 eval $setvar
6850
6851 : see if ldexpl exists
6852 set ldexpl d_ldexpl
6853 eval $inlibc
6854
6855 : check for length of long double
6856 case "${d_longdbl}${longdblsize}" in
6857 $define)
6858         echo " "
6859         echo "Checking to see how big your long doubles are..." >&4
6860         $cat >try.c <<'EOCP'
6861 #include <stdio.h>
6862 int main()
6863 {
6864         printf("%d\n", sizeof(long double));
6865 }
6866 EOCP
6867         set try
6868         set try
6869         if eval $compile; then
6870                 longdblsize=`$run ./try`
6871                 echo "Your long doubles are $longdblsize bytes long."
6872         else
6873                 dflt='8'
6874                 echo " "
6875                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6876                 rp="What is the size of a long double (in bytes)?"
6877                 . ./myread
6878                 longdblsize="$ans"
6879         fi
6880         if $test "X$doublesize" = "X$longdblsize"; then
6881                 echo "That isn't any different from an ordinary double."
6882                 echo "I'll keep your setting anyway, but you may see some"
6883                 echo "harmless compilation warnings."
6884         fi
6885         ;;
6886 esac
6887 $rm_try
6888
6889 $echo "Checking the kind of long doubles you have..." >&4
6890 case "$d_longdbl" in
6891 define)
6892 $cat <<EOP >try.c
6893 #$i_float I_FLOAT
6894 #$i_stdlib I_STDLIB
6895 #define LONGDBLSIZE $longdblsize
6896 #define DOUBLESIZE $doublesize
6897 #ifdef I_FLOAT
6898 #include <float.h>
6899 #endif
6900 #ifdef I_STDLIB
6901 #include <stdlib.h>
6902 #endif
6903 #include <stdio.h>
6904 static const long double d = -0.1L;
6905 int main() {
6906   unsigned const char* b = (unsigned const char*)(&d);
6907 #if DOUBLESIZE == LONGDBLSIZE
6908   printf("0\n"); /* if it floats like double */
6909   exit(0);
6910 #endif
6911 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6912   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6913     /* IEEE 754 128-bit little-endian */
6914     printf("1\n");
6915     exit(0);
6916   }
6917   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6918     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6919     printf("2\n");
6920     exit(0);
6921   }
6922 #endif
6923 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6924  * while 64-bits platforms have it in 16 bytes. */
6925 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6926   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6927     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6928      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6929      * Also known as "extended precision". */
6930     printf("3\n");
6931     exit(0);
6932   }
6933   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6934     /* is there ever big-endian 80-bit, really? */
6935     printf("4\n");
6936     exit(0);
6937   }
6938 #endif
6939 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6940   /* software "double double", the 106 is 53+53.
6941    * but irix thinks it is 107. */
6942   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6943     /* double double 128-bit little-endian,
6944      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6945     printf("5\n");
6946     exit(0);
6947   }
6948   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6949     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6950      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6951     printf("6\n");
6952     exit(0);
6953   }
6954 #endif
6955   printf("-1\n"); /* unknown */
6956   exit(0);
6957 }
6958 EOP
6959 set try
6960 if eval $compile; then
6961     longdblkind=`$run ./try`
6962 else
6963     longdblkind=-1
6964 fi
6965 ;;
6966 *) longdblkind=0 ;;
6967 esac
6968 case "$longdblkind" in
6969 0) echo "Your long doubles are doubles." >&4 ;;
6970 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6971 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6972 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6973 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
6974 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
6975 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
6976 *) echo "Cannot figure out your long double." >&4 ;;
6977 esac
6978 $rm_try
6979
6980 : determine the architecture name
6981 echo " "
6982 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6983         tarch=`arch`"-$osname"
6984 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6985         if uname -m > tmparch 2>&1 ; then
6986                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6987                         -e 's/$/'"-$osname/" tmparch`
6988         else
6989                 tarch="$osname"
6990         fi
6991         $rm -f tmparch
6992 else
6993         tarch="$osname"
6994 fi
6995 case "$myarchname" in
6996 ''|"$tarch") ;;
6997 *)
6998         echo "(Your architecture name used to be $myarchname.)"
6999         archname=''
7000         ;;
7001 esac
7002 case "$targetarch" in
7003 '') ;;
7004 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7005 esac
7006 myarchname="$tarch"
7007 case "$archname" in
7008 '') dflt="$tarch";;
7009 *) dflt="$archname";;
7010 esac
7011 rp='What is your architecture name'
7012 . ./myread
7013 archname="$ans"
7014
7015 : optionally add API version to the architecture for versioned archlibs
7016 case "$useversionedarchname" in
7017 $define|true|[yY]*) dflt='y';;
7018 *)                  dflt='n';;
7019 esac
7020 rp='Add the Perl API version to your archname?'
7021 . ./myread
7022 case "$ans" in
7023 y|Y)    useversionedarchname="$define" ;;
7024 *)      useversionedarchname="$undef" ;;
7025 esac
7026 case "$useversionedarchname" in
7027 $define)
7028         case "$archname" in
7029         *-$api_versionstring)
7030                 echo "...and architecture name already has -$api_versionstring" >&4
7031                 ;;
7032         *)
7033                 archname="$archname-$api_versionstring"
7034                 echo "...setting architecture name to $archname." >&4
7035                 ;;
7036         esac
7037         ;;
7038 esac
7039
7040 case "$usethreads" in
7041 $define)
7042         echo "Threads selected." >&4
7043         case "$archname" in
7044         *-thread*) echo "...and architecture name already has -thread." >&4
7045                 ;;
7046         *)      archname="$archname-thread"
7047                 echo "...setting architecture name to $archname." >&4
7048                 ;;
7049         esac
7050         ;;
7051 esac
7052 case "$usemultiplicity" in
7053 $define)
7054         echo "Multiplicity selected." >&4
7055         case "$archname" in
7056         *-multi*) echo "...and architecture name already has -multi." >&4
7057                 ;;
7058         *)      archname="$archname-multi"
7059                 echo "...setting architecture name to $archname." >&4
7060                 ;;
7061         esac
7062         ;;
7063 esac
7064 case "$use64bitint$use64bitall" in
7065 *"$define"*)
7066         case "$archname64" in
7067         '')
7068                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7069                 ;;
7070         *)
7071                 case "$use64bitint" in
7072                 "$define") echo "64 bit integers selected." >&4 ;;
7073                 esac
7074                 case "$use64bitall" in
7075                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7076                 esac
7077                 case "$archname" in
7078                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7079                         ;;
7080                 *)      archname="$archname-$archname64"
7081                         echo "...setting architecture name to $archname." >&4
7082                         ;;
7083                 esac
7084                 ;;
7085         esac
7086 esac
7087 case "$uselongdouble" in
7088 $define)
7089         echo "Long doubles selected." >&4
7090         case "$longdblsize" in
7091         $doublesize)
7092                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7093                 ;;
7094         *)
7095                 case "$archname" in
7096                 *-ld*) echo "...and architecture name already has -ld." >&4
7097                         ;;
7098                 *)      archname="$archname-ld"
7099                         echo "...setting architecture name to $archname." >&4
7100                         ;;
7101                 esac
7102                 ;;
7103         esac
7104         ;;
7105 esac
7106 case "$usequadmath" in
7107 $define)
7108         echo "quadmath selected." >&4
7109         case "$archname" in
7110         *-ld*) echo "...and architecture name already has -quadmath." >&4
7111                 ;;
7112         *)      archname="$archname-quadmath"
7113                 echo "...setting architecture name to $archname." >&4
7114                 ;;
7115         esac
7116         ;;
7117 esac
7118 if $test -f archname.cbu; then
7119         echo "Your platform has some specific hints for architecture name, using them..."
7120         . ./archname.cbu
7121 fi
7122
7123 : set the prefixit variable, to compute a suitable default value
7124 prefixit='case "$3" in
7125 ""|none)
7126         case "$oldprefix" in
7127         "") eval "$1=\"\$$2\"";;
7128         *)
7129                 case "$3" in
7130                 "") eval "$1=";;
7131                 none)
7132                         eval "tp=\"\$$2\"";
7133                         case "$tp" in
7134                         ""|" ") eval "$1=\"\$$2\"";;
7135                         *) eval "$1=";;
7136                         esac;;
7137                 esac;;
7138         esac;;
7139 *)
7140         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7141         case "$tp" in
7142         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7143         /*-$oldprefix/*|\~*-$oldprefix/*)
7144                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7145         *) eval "$1=\"\$$2\"";;
7146         esac;;
7147 esac'
7148
7149 : determine installation style
7150 : For now, try to deduce it from prefix unless it is already set.
7151 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7152 case "$installstyle" in
7153 '')     case "$prefix" in
7154                 *perl*) dflt='lib';;
7155                 *) dflt='lib/perl5' ;;
7156         esac
7157         ;;
7158 *)      dflt="$installstyle" ;;
7159 esac
7160 : Probably not worth prompting for this since we prompt for all
7161 : the directories individually, and the prompt would be too long and
7162 : confusing anyway.
7163 installstyle=$dflt
7164
7165 : determine where public executables go
7166 echo " "
7167 set dflt bin bin
7168 eval $prefixit
7169 fn=d~
7170 rp='Pathname where the public executables will reside?'
7171 . ./getfile
7172 if $test "X$ansexp" != "X$binexp"; then
7173         installbin=''
7174 fi
7175 prefixvar=bin
7176 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7177 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7178 :     this via initialinstalllocation
7179 . ./setprefixvar
7180
7181 case "$userelocatableinc" in
7182 $define|true|[yY]*)     dflt='y' ;;
7183 *)                      dflt='n' ;;
7184 esac
7185 cat <<EOM
7186
7187 Would you like to build Perl so that the installation is relocatable, so that
7188 library paths in @INC are determined relative to the path of the perl binary?
7189 This is not advised for system Perl installs, or if you need to run setid
7190 scripts or scripts under taint mode.
7191
7192 If this doesn't make any sense to you, just accept the default '$dflt'.
7193 EOM
7194 rp='Use relocatable @INC?'
7195 . ./myread
7196 case "$ans" in
7197 y|Y)    val="$define" ;;
7198 *)      val="$undef"  ;;
7199 esac
7200 set userelocatableinc
7201 eval $setvar
7202
7203 initialinstalllocation="$binexp"
7204 : Default prefix is now "up one level from where the binaries are"
7205 case "$userelocatableinc" in
7206 $define|true|[yY]*)
7207     bin=".../"
7208     binexp=".../"
7209     prefix=".../.."
7210     prefixexp=".../.."
7211     installprefixexp=".../.."
7212     ;;
7213 esac
7214
7215 : determine where private library files go
7216 : Usual default is /usr/local/lib/perl5/$version.
7217 : Also allow things like /opt/perl/lib/$version, since
7218 : /opt/perl/lib/perl5... would be redundant.
7219 : The default "style" setting is made in installstyle.U
7220 case "$installstyle" in
7221 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7222 *)       set dflt privlib lib/$version ;;
7223 esac
7224 eval $prefixit
7225 $cat <<EOM
7226
7227 There are some auxiliary files for $package that need to be put into a
7228 private library directory that is accessible by everyone.
7229
7230 EOM
7231 fn=$binexp
7232 fn=d~+
7233 rp='Pathname where the private library files will reside?'
7234 . ./getfile
7235 prefixvar=privlib
7236 . ./setprefixvar
7237
7238 : set the prefixup variable, to restore leading tilda escape
7239 prefixup='case "$prefixexp" in
7240 "$prefix") ;;
7241 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7242 esac'
7243
7244 : determine where public architecture dependent libraries go
7245 set archlib archlib
7246 eval $prefixit
7247 : privlib default is /usr/local/lib/$package/$version
7248 : archlib default is /usr/local/lib/$package/$version/$archname
7249 : privlib may have an optional trailing /share.
7250 tdflt=`echo $privlib | $sed 's,/share$,,'`
7251 tdflt=$tdflt/$archname
7252 case "$archlib" in
7253 '')     dflt=$tdflt
7254         ;;
7255 *)      dflt="$archlib"
7256     ;;
7257 esac
7258 $cat <<EOM
7259
7260 $spackage contains architecture-dependent library files.  If you are
7261 sharing libraries in a heterogeneous environment, you might store
7262 these files in a separate location.  Otherwise, you can just include
7263 them with the rest of the public library files.
7264
7265 EOM
7266 fn=$binexp
7267 fn=d+~
7268 rp='Where do you want to put the public architecture-dependent libraries?'
7269 . ./getfile
7270 prefixvar=archlib
7271 . ./setprefixvar
7272 if $test X"$archlib" = X"$privlib"; then
7273         d_archlib="$undef"
7274 else
7275         d_archlib="$define"
7276 fi
7277
7278 : see if setuid scripts can be secure
7279 $cat <<EOM
7280
7281 Some kernels have a bug that prevents setuid #! scripts from being
7282 secure.  Some sites have disabled setuid #! scripts because of this.
7283
7284 First let's decide if your kernel supports secure setuid #! scripts.
7285 (If setuid #! scripts would be secure but have been disabled anyway,
7286 don't say that they are secure if asked.)
7287
7288 EOM
7289
7290 val="$undef"
7291 if $test -d /dev/fd; then
7292         echo "#!$ls" >reflect
7293         chmod +x,u+s reflect
7294         ./reflect >flect 2>&1
7295         if $contains "/dev/fd" flect >/dev/null; then
7296                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7297                 val="$define"
7298         else
7299                 $cat <<EOM
7300 If you are not sure if they are secure, I can check but I'll need a
7301 username and password different from the one you are using right now.
7302 If you don't have such a username or don't want me to test, simply
7303 enter 'none'.
7304
7305 EOM
7306                 rp='Other username to test security of setuid scripts with?'
7307                 dflt='none'
7308                 . ./myread
7309                 case "$ans" in
7310                 n|none)
7311                         case "$d_suidsafe" in
7312                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7313                                 dflt=n;;
7314                         "$undef")
7315                                 echo "Well, the $hint value is *not* secure." >&4
7316                                 dflt=n;;
7317                         *)      echo "Well, the $hint value *is* secure." >&4
7318                                 dflt=y;;
7319                         esac
7320                         ;;
7321                 *)
7322                         $rm -f reflect flect
7323                         echo "#!$ls" >reflect
7324                         chmod +x,u+s reflect
7325                         echo >flect
7326                         chmod a+w flect
7327                         echo '"su" will (probably) prompt you for '"$ans's password."
7328                         su $ans -c './reflect >flect'
7329                         if $contains "/dev/fd" flect >/dev/null; then
7330                                 echo "Okay, it looks like setuid scripts are secure." >&4
7331                                 dflt=y
7332                         else
7333                                 echo "I don't think setuid scripts are secure." >&4
7334                                 dflt=n
7335                         fi
7336                         ;;
7337                 esac
7338                 rp='Does your kernel have *secure* setuid scripts?'
7339                 . ./myread
7340                 case "$ans" in
7341                 [yY]*)  val="$define";;
7342                 *)      val="$undef";;
7343                 esac
7344         fi
7345 else
7346         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7347         echo "(That's for file descriptors, not floppy disks.)"
7348         val="$undef"
7349 fi
7350 set d_suidsafe
7351 eval $setvar
7352
7353 $rm -f reflect flect
7354
7355 : now see if they want to do setuid emulation
7356 if $test $patchlevel -lt 11; then
7357 echo " "
7358 val="$undef"
7359 case "$d_suidsafe" in
7360 "$define")
7361         val="$undef"
7362         echo "No need to emulate SUID scripts since they are secure here." >&4
7363         ;;
7364 *)
7365         $cat <<EOM
7366 Some systems have disabled setuid scripts, especially systems where
7367 setuid scripts cannot be secure.  On systems where setuid scripts have
7368 been disabled, the setuid/setgid bits on scripts are currently
7369 useless.  It is possible for $package to detect those bits and emulate
7370 setuid/setgid in a secure fashion.  This emulation will only work if
7371 setuid scripts have been disabled in your kernel.
7372
7373 EOM
7374         case "$d_dosuid" in
7375         "$define") dflt=y ;;
7376         *) dflt=n ;;
7377         esac
7378         rp="Do you want to do setuid/setgid emulation?"
7379         . ./myread
7380         case "$ans" in
7381         [yY]*)  val="$define";;
7382         *)      val="$undef";;
7383         esac
7384         ;;
7385 esac
7386 set d_dosuid
7387 eval $setvar
7388 else
7389     case "$d_dosuid" in
7390         "$define")
7391         cat >&4 <<EOH
7392
7393 SUID emulation has been removed for 5.12
7394 Please re-run Configure without -Dd_dosuid
7395
7396 EOH
7397         exit 1;
7398         ;;
7399     esac
7400     d_dosuid=undef
7401 fi
7402
7403 : Find perl5.005 or later.
7404 echo "Looking for a previously installed perl5.005 or later... "
7405 case "$perl5" in
7406 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7407                 : Check if this perl is recent and can load a simple module
7408                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7409                         perl5=$tdir/perl
7410                         break;
7411                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7412                         perl5=$tdir/perl5
7413                         break;
7414                 fi
7415         done
7416         ;;
7417 *)      perl5="$perl5"
7418         ;;
7419 esac
7420 case "$perl5" in
7421 '')     echo "None found.  That's ok.";;
7422 *)      echo "Using $perl5." ;;
7423 esac
7424
7425 : Set the siteprefix variables
7426 $cat <<EOM
7427
7428 After $package is installed, you may wish to install various
7429 add-on modules and utilities.  Typically, these add-ons will
7430 be installed under $prefix with the rest
7431 of this package.  However, you may wish to install such add-ons
7432 elsewhere under a different prefix.
7433
7434 If you do not wish to put everything under a single prefix, that's
7435 ok.  You will be prompted for the individual locations; this siteprefix
7436 is only used to suggest the defaults.
7437
7438 The default should be fine for most people.
7439
7440 EOM
7441 fn=d~+
7442 rp='Installation prefix to use for add-on modules and utilities?'
7443 : XXX Here might be another good place for an installstyle setting.
7444 case "$siteprefix" in
7445 '') dflt=$prefix ;;
7446 *)  dflt=$siteprefix ;;
7447 esac
7448 . ./getfile
7449 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7450 oldsiteprefix=''
7451 case "$siteprefix" in
7452 '') ;;
7453 *)      case "$ans" in
7454         "$prefix") ;;
7455         *) oldsiteprefix="$prefix";;
7456         esac
7457         ;;
7458 esac
7459 siteprefix="$ans"
7460 siteprefixexp="$ansexp"
7461
7462 : determine where site specific libraries go.
7463 : Usual default is /usr/local/lib/perl5/site_perl/$version
7464 : The default "style" setting is made in installstyle.U
7465 : XXX No longer works with Prefixit stuff.
7466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7467 case "$sitelib" in
7468 '') case "$installstyle" in
7469         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7470         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7471         esac
7472         ;;
7473 *)      dflt="$sitelib"
7474         ;;
7475 esac
7476 $cat <<EOM
7477
7478 The installation process will create a directory for
7479 site-specific extensions and modules.  Most users find it convenient
7480 to place all site-specific files in this directory rather than in the
7481 main distribution directory.
7482
7483 EOM
7484 fn=d~+
7485 rp='Pathname for the site-specific library files?'
7486 . ./getfile
7487 prefixvar=sitelib
7488 . ./setprefixvar
7489 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7490
7491 : Determine list of previous versions to include in @INC
7492 $cat > getverlist <<EOPL
7493 #!$perl5 -w
7494 use File::Basename;
7495 \$api_versionstring = "$api_versionstring";
7496 \$version = "$version";
7497 \$stem = "$sitelib_stem";
7498 \$archname = "$archname";
7499 EOPL
7500         $cat >> getverlist <<'EOPL'
7501 # The list found is store twice for each entry: the original name, and
7502 # the binary broken down version as pack "sss", so sorting is easy and
7503 # unambiguous. This will work for all versions that have a maximum of
7504 # three digit groups, separate by '.'s or '_'s. Names are extended with
7505 # ".0.0" to ensure at least three elements for the pack.
7506 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7507
7508 # Can't have leading @ because metaconfig interprets it as a command!
7509 ;@inc_version_list=();
7510 # XXX Redo to do opendir/readdir?
7511 if (-d $stem) {
7512     chdir($stem);
7513     ;@candidates = map {
7514         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7515     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7516 }
7517 else {
7518     ;@candidates = ();
7519 }
7520
7521 ($pversion, $aversion, $vsn5005) = map {
7522     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7523 foreach $d (@candidates) {
7524     if ($d->[1] lt $pversion) {
7525         if ($d->[1] ge $aversion) {
7526             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7527         }
7528         elsif ($d->[1] ge $vsn5005) {
7529             unshift(@inc_version_list, grep { -d } $d->[0]);
7530         }
7531     }
7532     else {
7533         # Skip newer version.  I.e. don't look in
7534         # 5.7.0 if we're installing 5.6.1.
7535     }
7536 }
7537
7538 if (@inc_version_list) {
7539     print join(' ', @inc_version_list);
7540 }
7541 else {
7542     # Blank space to preserve value for next Configure run.
7543     print " ";
7544 }
7545 EOPL
7546 chmod +x getverlist
7547 case "$inc_version_list" in
7548 '')     if test -x "$perl5$exe_ext"; then
7549                 dflt=`$perl5 getverlist`
7550         else
7551                 dflt='none'
7552         fi
7553         ;;
7554 $undef) dflt='none' ;;
7555 *)  eval dflt=\"$inc_version_list\" ;;
7556 esac
7557 case "$dflt" in
7558 ''|' ') dflt=none ;;
7559 esac
7560 case "$dflt" in
7561 5.005) dflt=none ;;
7562 esac
7563 $cat <<EOM
7564
7565 In order to ease the process of upgrading, this version of perl
7566 can be configured to use modules built and installed with earlier
7567 versions of perl that were installed under $prefix.  Specify here
7568 the list of earlier versions that this version of perl should check.
7569 If Configure detected no earlier versions of perl installed under
7570 $prefix, then the list will be empty.  Answer 'none' to tell perl
7571 to not search earlier versions.
7572
7573 The default should almost always be sensible, so if you're not sure,
7574 just accept the default.
7575 EOM
7576
7577 rp='List of earlier versions to include in @INC?'
7578 . ./myread
7579 case "$ans" in
7580 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7581 *) inc_version_list="$ans" ;;
7582 esac
7583 case "$inc_version_list" in
7584 ''|' ')
7585         inc_version_list_init='0'
7586         d_inc_version_list="$undef"
7587         ;;
7588 *)      inc_version_list_init=`echo $inc_version_list |
7589                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7590         d_inc_version_list="$define"
7591         ;;
7592 esac
7593 $rm -f getverlist
7594
7595 : see if malloc/malloc.h has to be included
7596 set malloc/malloc.h i_mallocmalloc
7597 eval $inhdr
7598
7599 : see if this is a malloc.h system
7600 : we want a real compile instead of Inhdr because some systems have a
7601 : malloc.h that just gives a compile error saying to use stdlib.h instead
7602 echo " "
7603 $cat >try.c <<EOCP
7604 #include <stdlib.h>
7605 #include <malloc.h>
7606 #$i_mallocmalloc I_MALLOCMALLOC
7607 #ifdef I_MALLOCMALLOC
7608 # include <malloc/malloc.h>
7609 #endif
7610
7611 int main () { return 0; }
7612 EOCP
7613 set try
7614 if eval $compile; then
7615     echo "<malloc.h> found." >&4
7616     val="$define"
7617 else
7618     echo "<malloc.h> NOT found." >&4
7619     val="$undef"
7620 fi
7621 $rm_try
7622 set i_malloc
7623 eval $setvar
7624
7625 : check for length of pointer
7626 echo " "
7627 case "$ptrsize" in
7628 '')
7629         echo "Checking to see how big your pointers are..." >&4
7630         $cat >>try.c <<EOCP
7631 #include <stdio.h>
7632 #$i_stdlib I_STDLIB
7633 #ifdef I_STDLIB
7634 #include <stdlib.h>
7635 #endif
7636 int main()
7637 {
7638     printf("%d\n", (int)sizeof(void *));
7639     exit(0);
7640 }
7641 EOCP
7642         set try
7643         if eval $compile_ok; then
7644                 ptrsize=`$run ./try`
7645                 echo "Your pointers are $ptrsize bytes long."
7646         else
7647                 dflt='4'
7648                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7649                 rp="What is the size of a pointer (in bytes)?"
7650                 . ./myread
7651                 ptrsize="$ans"
7652         fi
7653         ;;
7654 esac
7655 $rm_try
7656 case "$use64bitall" in
7657 "$define"|true|[yY]*)
7658         case "$ptrsize" in
7659         4)      cat <<EOM >&4
7660
7661 *** You have chosen a maximally 64-bit build,
7662 *** but your pointers are only 4 bytes wide.
7663 *** Please rerun Configure without -Duse64bitall.
7664 EOM
7665                 case "$d_quad" in
7666                 define)
7667                         cat <<EOM >&4
7668 *** Since you have quads, you could possibly try with -Duse64bitint.
7669 EOM
7670                         ;;
7671                 esac
7672                 cat <<EOM >&4
7673 *** Cannot continue, aborting.
7674
7675 EOM
7676
7677                 exit 1
7678                 ;;
7679         esac
7680         ;;
7681 esac
7682
7683
7684 : determine whether to use malloc wrapping
7685 echo " "
7686 case "$usemallocwrap" in
7687 [yY]*|true|$define)     dflt='y' ;;
7688 [nN]*|false|$undef)     dflt='n' ;;
7689 *)      case "$usedevel" in
7690         [yY]*|true|$define)     dflt='y' ;;
7691         *) dflt='n' ;;
7692         esac
7693         ;;
7694 esac
7695 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7696 . ./myread
7697 usemallocwrap="$ans"
7698 case "$ans" in
7699 y*|true)
7700         usemallocwrap="$define" ;;
7701 *)
7702         usemallocwrap="$undef" ;;
7703 esac
7704
7705 : determine which malloc to compile in
7706 echo " "
7707 case "$usemymalloc" in
7708 [yY]*|true|$define)     dflt='y' ;;
7709 [nN]*|false|$undef)     dflt='n' ;;
7710 *)      case "$ptrsize" in
7711         4) dflt='y' ;;
7712         *) dflt='n' ;;
7713         esac
7714         if test "$useithreads" = "$define"; then dflt='n'; fi
7715         ;;
7716 esac
7717 rp="Do you wish to attempt to use the malloc that comes with $package?"
7718 . ./myread
7719 usemymalloc="$ans"
7720 case "$ans" in
7721 y*|true)
7722         usemymalloc='y'
7723         mallocsrc='malloc.c'
7724         mallocobj="malloc$_o"
7725         d_mymalloc="$define"
7726         case "$libs" in
7727         *-lmalloc*)
7728                 : Remove malloc from list of libraries to use
7729                 echo "Removing unneeded -lmalloc from library list" >&4
7730                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7731                 shift
7732                 libs="$*"
7733                 echo "libs = $libs" >&4
7734                 ;;
7735         esac
7736         ;;
7737 *)
7738         usemymalloc='n'
7739         mallocsrc=''
7740         mallocobj=''
7741         d_mymalloc="$undef"
7742         ;;
7743 esac
7744
7745 : compute the return types of malloc and free
7746 echo " "
7747 $cat >malloc.c <<END
7748 #$i_malloc I_MALLOC
7749 #$i_stdlib I_STDLIB
7750 #include <stdio.h>
7751 #include <sys/types.h>
7752 #ifdef I_MALLOC
7753 #include <malloc.h>
7754 #endif
7755 #ifdef I_STDLIB
7756 #include <stdlib.h>
7757 #endif
7758 #ifdef TRY_MALLOC
7759 void *malloc();
7760 #endif
7761 #ifdef TRY_FREE
7762 void free();
7763 #endif
7764 END
7765 case "$malloctype" in
7766 '')
7767         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7768                 malloctype='void *'
7769         else
7770                 malloctype='char *'
7771         fi
7772         ;;
7773 esac
7774 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7775
7776 case "$freetype" in
7777 '')
7778         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7779                 freetype='void'
7780         else
7781                 freetype='int'
7782         fi
7783         ;;
7784 esac
7785 echo "Your system uses $freetype free(), it would seem." >&4
7786 $rm -f malloc.[co]
7787 : determine where site specific architecture-dependent libraries go.
7788 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7789 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7790 : sitelib may have an optional trailing /share.
7791 case "$sitearch" in
7792 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7793         dflt="$dflt/$archname"
7794         ;;
7795 *)      dflt="$sitearch"
7796         ;;
7797 esac
7798 set sitearch sitearch none
7799 eval $prefixit
7800 $cat <<EOM
7801
7802 The installation process will also create a directory for
7803 architecture-dependent site-specific extensions and modules.
7804
7805 EOM
7806 fn=d~+
7807 rp='Pathname for the site-specific architecture-dependent library files?'
7808 . ./getfile
7809 prefixvar=sitearch
7810 . ./setprefixvar
7811 if $test X"$sitearch" = X"$sitelib"; then
7812         d_sitearch="$undef"
7813 else
7814         d_sitearch="$define"
7815 fi
7816
7817 : Set the vendorprefix variables
7818 $cat <<EOM
7819
7820 The installation process will also create a directory for
7821 vendor-supplied add-ons.  Vendors who supply perl with their system
7822 may find it convenient to place all vendor-supplied files in this
7823 directory rather than in the main distribution directory.  This will
7824 ease upgrades between binary-compatible maintenance versions of perl.
7825
7826 Of course you may also use these directories in whatever way you see
7827 fit.  For example, you might use them to access modules shared over a
7828 company-wide network.
7829
7830 The default answer should be fine for most people.
7831 This causes further questions about vendor add-ons to be skipped
7832 and no vendor-specific directories will be configured for perl.
7833
7834 EOM
7835 rp='Do you want to configure vendor-specific add-on directories?'
7836 case "$usevendorprefix" in
7837 define|true|[yY]*) dflt=y ;;
7838 *)      : User may have set vendorprefix directly on Configure command line.
7839         case "$vendorprefix" in
7840         ''|' ') dflt=n ;;
7841         *)      dflt=y ;;
7842         esac
7843         ;;
7844 esac
7845 . ./myread
7846 case "$ans" in
7847 [yY]*)  fn=d~+
7848         rp='Installation prefix to use for vendor-supplied add-ons?'
7849         case "$vendorprefix" in
7850         '') dflt="$prefix" ;;
7851         *)  dflt=$vendorprefix ;;
7852         esac
7853         . ./getfile
7854         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7855         oldvendorprefix=''
7856         case "$vendorprefix" in
7857         '') ;;
7858         *)      case "$ans" in
7859                 "$prefix") ;;
7860                 *) oldvendorprefix="$prefix";;
7861                 esac
7862                 ;;
7863         esac
7864         usevendorprefix="$define"
7865         vendorprefix="$ans"
7866         vendorprefixexp="$ansexp"
7867         ;;
7868 *)      usevendorprefix="$undef"
7869         vendorprefix=''
7870         vendorprefixexp=''
7871         ;;
7872 esac
7873
7874 : Set the vendorlib variables
7875 case "$vendorprefix" in
7876 '')     d_vendorlib="$undef"
7877         vendorlib=''
7878         vendorlibexp=''
7879         ;;
7880 *)      d_vendorlib="$define"
7881         : determine where vendor-supplied modules go.
7882         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7883         case "$vendorlib" in
7884         '')
7885                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7886                 case "$installstyle" in
7887                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7888                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7889                 esac
7890                 ;;
7891         *)      dflt="$vendorlib"
7892                 ;;
7893         esac
7894         fn=d~+
7895         rp='Pathname for the vendor-supplied library files?'
7896         . ./getfile
7897         vendorlib="$ans"
7898         vendorlibexp="$ansexp"
7899         ;;
7900 esac
7901 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7902 prefixvar=vendorlib
7903 . ./installprefix
7904
7905 : Set the vendorarch variables
7906 case "$vendorprefix" in
7907 '')     d_vendorarch="$undef"
7908         vendorarch=''
7909         vendorarchexp=''
7910         ;;
7911 *)      d_vendorarch="$define"
7912         : determine where vendor-supplied architecture-dependent libraries go.
7913         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7914         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7915         : vendorlib may have an optional trailing /share.
7916         case "$vendorarch" in
7917         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7918                 dflt="$dflt/$archname"
7919                 ;;
7920         *)      dflt="$vendorarch" ;;
7921         esac
7922         fn=d~+
7923         rp='Pathname for vendor-supplied architecture-dependent files?'
7924         . ./getfile
7925         vendorarch="$ans"
7926         vendorarchexp="$ansexp"
7927         ;;
7928 esac
7929 prefixvar=vendorarch
7930 . ./installprefix
7931 if $test X"$vendorarch" = X"$vendorlib"; then
7932         d_vendorarch="$undef"
7933 else
7934         d_vendorarch="$define"
7935 fi
7936
7937 : Final catch-all directories to search
7938 $cat <<EOM
7939
7940 Lastly, you can have perl look in other directories for extensions and
7941 modules in addition to those already specified.
7942 These directories will be searched after
7943         $sitearch
7944         $sitelib
7945 EOM
7946 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7947 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7948 echo ' '
7949 case "$otherlibdirs" in
7950 ''|' ') dflt='none' ;;
7951 *)      dflt="$otherlibdirs" ;;
7952 esac
7953 $cat <<EOM
7954 Enter a colon-separated set of extra paths to include in perl's @INC
7955 search path, or enter 'none' for no extra paths.
7956
7957 EOM
7958
7959 rp='Colon-separated list of additional directories for perl to search?'
7960 . ./myread
7961 case "$ans" in
7962 ' '|''|none)    otherlibdirs=' ' ;;
7963 *)      otherlibdirs="$ans" ;;
7964 esac
7965 case "$otherlibdirs" in
7966 ' ') val=$undef ;;
7967 *)      val=$define ;;
7968 esac
7969 set d_perl_otherlibdirs
7970 eval $setvar
7971
7972 : Cruising for prototypes
7973 echo " "
7974 echo "Checking out function prototypes..." >&4
7975 $cat >prototype.c <<EOCP
7976 #$i_stdlib I_STDLIB
7977 #ifdef I_STDLIB
7978 #include <stdlib.h>
7979 #endif
7980 int main(int argc, char *argv[]) {
7981         exit(0);}
7982 EOCP
7983 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7984         echo "Your C compiler appears to support function prototypes."
7985         val="$define"
7986 else
7987         echo "Your C compiler doesn't seem to understand function prototypes."
7988         val="$undef"
7989 fi
7990 set prototype
7991 eval $setvar
7992 $rm -f prototype*
7993
7994 : Check if ansi2knr is required
7995 case "$prototype" in
7996 "$define") ;;
7997 *)      ansi2knr='ansi2knr'
7998         echo " "
7999         cat <<EOM >&4
8000
8001 $me:  FATAL ERROR:
8002 This version of $package can only be compiled by a compiler that
8003 understands function prototypes.  Unfortunately, your C compiler
8004         $cc $ccflags
8005 doesn't seem to understand them.  Sorry about that.
8006
8007 If GNU cc is available for your system, perhaps you could try that instead.
8008
8009 Eventually, we hope to support building Perl with pre-ANSI compilers.
8010 If you would like to help in that effort, please contact <perlbug@perl.org>.
8011
8012 Aborting Configure now.
8013 EOM
8014         exit 2
8015         ;;
8016 esac
8017
8018 : DTrace support
8019 dflt_dtrace='/usr/sbin/dtrace'
8020 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8021
8022 cat <<EOM
8023
8024 Perl can be built to support DTrace on platforms that support it.
8025 DTrace is a diagnosis and performance analysis tool from Sun.
8026
8027 If this doesn't make any sense to you, just accept the default '$dflt'.
8028 EOM
8029
8030 while $test 1 ; do
8031         case "$usedtrace" in
8032         $define|true|[yY]*)
8033                 dflt='y'
8034                 ;;
8035         ?*)
8036                 dflt='y'
8037                 dflt_dtrace=$usedtrace
8038                 ;;
8039         *)
8040                 dflt='n'
8041                 ;;
8042         esac
8043
8044         rp='Support DTrace if available?'
8045         . ./myread
8046         case "$ans" in
8047         y|Y)    val="$define" ;;
8048         *)      val="$undef" ;;
8049         esac
8050         set usedtrace
8051         eval $setvar
8052
8053         test "X$usedtrace" != "X$define" && break
8054
8055         echo " "
8056         rp='Where is the dtrace executable?'
8057         dflt=$dflt_dtrace
8058         . ./getfile
8059         val="$ans"
8060         set dtrace
8061         eval $setvar
8062
8063         if $test -f $dtrace
8064         then
8065                 if $dtrace -h -s ../perldtrace.d \
8066                         -o perldtrace.tmp >/dev/null 2>&1 \
8067                         && rm -f perldtrace.tmp
8068                 then
8069                         echo " "
8070                         echo "Good: your $dtrace knows about the -h flag."
8071                 else
8072                         cat >&2 <<EOM
8073
8074 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8075 ***
8076 *** Your installed dtrace doesn't support the -h switch to compile a D
8077 *** program into a C header. Can't continue.
8078
8079 EOM
8080                         exit 1
8081                 fi
8082                 break;
8083         fi
8084
8085         case "$fastread" in
8086         yes)
8087                 cat >&2 <<EOM
8088
8089 *** $me:  Fatal Error:  $dtrace not found.
8090 *** Can't continue.
8091
8092 EOM
8093                 exit 1
8094                 ;;
8095         *)
8096                 echo "*** $dtrace was not found."
8097                 echo " "
8098                 ;;
8099         esac
8100 done
8101
8102 : See if we want extra modules installed
8103 echo " "
8104 case "$extras" in
8105 '') dflt='n';;
8106 *) dflt='y';;
8107 esac
8108 cat <<EOM
8109 Perl can be built with extra modules or bundles of modules which
8110 will be fetched from the CPAN and installed alongside Perl.
8111
8112 Notice that you will need access to the CPAN; either via the Internet,
8113 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8114 be asked later to configure the CPAN.pm module which will in turn do
8115 the installation of the rest of the extra modules or bundles.)
8116
8117 Notice also that if the modules require any external software such as
8118 libraries and headers (the libz library and the zlib.h header for the
8119 Compress::Zlib module, for example) you MUST have any such software
8120 already installed, this configuration process will NOT install such
8121 things for you.
8122
8123 If this doesn't make any sense to you, just accept the default '$dflt'.
8124 EOM
8125 rp='Install any extra modules (y or n)?'
8126 . ./myread
8127 case "$ans" in
8128 y|Y)
8129         cat <<EOM
8130
8131 Please list any extra modules or bundles to be installed from CPAN,
8132 with spaces between the names.  The names can be in any format the
8133 'install' command of CPAN.pm will understand.  (Answer 'none',
8134 without the quotes, to install no extra modules or bundles.)
8135 EOM
8136         rp='Extras?'
8137         dflt="$extras"
8138         . ./myread
8139         extras="$ans"
8140 esac
8141 case "$extras" in
8142 ''|'none')
8143         val=''
8144         $rm -f ../extras.lst
8145         ;;
8146 *)      echo "(Saving the list of extras for later...)"
8147         echo "$extras" > ../extras.lst
8148         val="'$extras'"
8149         ;;
8150 esac
8151 set extras
8152 eval $setvar
8153 echo " "
8154
8155 : determine where html pages for programs go
8156 set html1dir html1dir none
8157 eval $prefixit
8158 $cat <<EOM
8159
8160 If you wish to install html files for programs in $spackage, indicate
8161 the appropriate directory here.  To skip installing html files,
8162 answer "none".
8163 EOM
8164 case "$html1dir" in
8165 ''|none|$undef|' ') dflt=none ;;
8166 *) dflt=$html1dir ;;
8167 esac
8168 fn=dn+~
8169 rp="Directory for the main $spackage html pages?"
8170 . ./getfile
8171 prefixvar=html1dir
8172 . ./setprefixvar
8173 : Use ' ' for none so value is preserved next time through Configure
8174 $test X"$html1dir" = "X" && html1dir=' '
8175
8176 : determine where html pages for libraries and modules go
8177 set html3dir html3dir none
8178 eval $prefixit
8179 $cat <<EOM
8180
8181 If you wish to install html files for modules associated with $spackage,
8182 indicate the appropriate directory here.  To skip installing html files,
8183 answer "none".
8184 EOM
8185 : There is no obvious default.  If they have specified html1dir, then
8186 : try to key off that, possibly changing .../html1 into .../html3.
8187 case "$html3dir" in
8188 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8189 *) dflt=$html3dir ;;
8190 esac
8191 fn=dn+~
8192 rp="Directory for the $spackage module html pages?"
8193 . ./getfile
8194 prefixvar=html3dir
8195 . ./setprefixvar
8196 : Use ' ' for none so value is preserved next time through Configure
8197 $test X"$html3dir" = "X" && html3dir=' '
8198
8199 : determine whether to install perl also as /usr/bin/perl
8200
8201 echo " "
8202 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8203         $cat <<EOM
8204 Many scripts expect perl to be installed as /usr/bin/perl.
8205
8206 If you want to, I can install the perl you are about to compile
8207 as /usr/bin/perl (in addition to $bin/perl).
8208 EOM
8209         if test -f /usr/bin/perl; then
8210             $cat <<EOM
8211
8212 However, please note that because you already have a /usr/bin/perl,
8213 overwriting that with a new Perl would very probably cause problems.
8214 Therefore I'm assuming you don't want to do that (unless you insist).
8215
8216 EOM
8217             case "$installusrbinperl" in
8218             "$define"|[yY]*)    dflt='y';;
8219             *)                  dflt='n';;
8220             esac
8221         else
8222             $cat <<EOM
8223
8224 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8225
8226 EOM
8227             case "$installusrbinperl" in
8228             "$undef"|[nN]*)     dflt='n';;
8229             *)                  dflt='y';;
8230             esac
8231         fi
8232         rp="Do you want to install perl as /usr/bin/perl?"
8233         . ./myread
8234         case "$ans" in
8235         [yY]*)  val="$define";;
8236         *)      val="$undef" ;;
8237         esac
8238 else
8239         val="$undef"
8240 fi
8241 set installusrbinperl
8242 eval $setvar
8243
8244 : see if dlopen exists
8245 xxx_runnm="$runnm"
8246 xxx_ccflags="$ccflags"
8247 runnm=false
8248 : with g++ one needs -shared to get is-in-libc to work for dlopen
8249 case "$gccversion" in
8250 '')     ;;
8251 *)      case "$d_cplusplus" in
8252         "$define") ccflags="$ccflags -shared" ;;
8253         esac
8254         ;;
8255 esac
8256 set dlopen d_dlopen
8257 eval $inlibc
8258 runnm="$xxx_runnm"
8259 ccflags="$xxx_ccflags"
8260
8261 : see if this is a unistd.h system
8262 set unistd.h i_unistd
8263 eval $inhdr
8264
8265 : determine which dynamic loading, if any, to compile in
8266 echo " "
8267 dldir="ext/DynaLoader"
8268 case "$usedl" in
8269     $define|y|true)
8270         dflt='y'
8271         usedl="$define"
8272         ;;
8273     $undef|n|false)
8274         dflt='n'
8275         usedl="$undef"
8276         ;;
8277     *)
8278         dflt='n'
8279         case "$d_dlopen" in
8280             $define) dflt='y' ;;
8281         esac
8282         : Does a dl_xxx.xs file exist for this operating system
8283         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8284         ;;
8285 esac
8286 rp="Do you wish to use dynamic loading?"
8287 . ./myread
8288 usedl="$ans"
8289 bin_ELF="$undef"
8290 case "$ans" in
8291     y*) usedl="$define"
8292         case "$dlsrc" in
8293             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8294                     dflt="$dldir/dl_${osname}.xs"
8295                 elif $test "$d_dlopen" = "$define" ; then
8296                     dflt="$dldir/dl_dlopen.xs"
8297                 else
8298                     dflt=''
8299                 fi
8300                 ;;
8301             *)  dflt="$dldir/$dlsrc"
8302                 ;;
8303         esac
8304         echo "The following dynamic loading files are available:"
8305         : Can not go over to $dldir because getfile has path hard-coded in.
8306         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8307         rp="Source file to use for dynamic loading"
8308         fn="fne"
8309         gfpth="$src"
8310         . ./getfile
8311         usedl="$define"
8312         : emulate basename
8313         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8314
8315         $cat << EOM
8316
8317 Some systems may require passing special flags to $cc -c to
8318 compile modules that will be used to create a shared library.
8319 To use no flags, say "none".
8320
8321 EOM
8322         case "$cccdlflags" in
8323             '') case "$gccversion" in
8324                 '') case "$osname" in
8325                         hpux)   dflt='+z' ;;
8326                         irix*)  dflt='-KPIC' ;;
8327                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8328                         sunos)  dflt='-pic' ;;
8329                         *)      dflt='none' ;;
8330                     esac
8331                     ;;
8332                 *)  case "$osname" in
8333                         darwin) dflt='none' ;;
8334                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8335                         *)      dflt='-fpic' ;;
8336                     esac ;;
8337                 esac ;;
8338             ' ') dflt='none' ;;
8339             *)   dflt="$cccdlflags" ;;
8340         esac
8341
8342         case "$dflt" in
8343             none) dflt='' ;;
8344         esac
8345
8346         # If -Dsysroot was specified, now's the time to add it
8347         # to cccdlflags
8348         if test "X$sysroot" != X; then
8349             case "$gccversion" in
8350                 '') ;;
8351                 *)  case "$dflt" in
8352                         *sysroot*) ;;
8353                         'undef'|*)
8354                             dflt="$dflt --sysroot=$sysroot" ;;
8355                     esac
8356                     ;;
8357             esac
8358         fi
8359
8360         case "$dflt" in
8361             '') dflt='none';;
8362         esac
8363
8364         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8365         . ./myread
8366         case "$ans" in
8367             none) cccdlflags=' ' ;;
8368             *)    cccdlflags="$ans" ;;
8369         esac
8370
8371         cat << EOM
8372
8373 Some systems use ld to create libraries that can be dynamically loaded,
8374 while other systems (such as those using ELF) use $cc.
8375
8376 EOM
8377
8378 : Determine if this is ELF
8379         $cat >try.c <<EOM
8380 /* Test for whether ELF binaries are produced */
8381 #include <fcntl.h>
8382 #$i_stdlib I_STDLIB
8383 #ifdef I_STDLIB
8384 #include <stdlib.h>
8385 #endif
8386 #$i_unistd I_UNISTD
8387 #ifdef I_UNISTD
8388 #include <unistd.h>
8389 #endif
8390 int main() {
8391     char b[4];
8392     int i = open("a.out",O_RDONLY);
8393     if(i == -1)
8394         exit(1); /* fail */
8395     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8396         exit(0); /* succeed (yes, it is ELF) */
8397     exit(1); /* fail */
8398 }
8399 EOM
8400         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8401             bin_ELF="$define"
8402         fi
8403         $rm_try
8404
8405         case "$ld" in
8406             '') if $test $bin_ELF = "$define"; then
8407                     cat <<EOM
8408 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8409 EOM
8410                     dflt="$cc"
8411                 else
8412                     echo "I'll use ld to build dynamic libraries."
8413                     dflt='ld'
8414                 fi
8415                 ;;
8416             *)  dflt="$ld"
8417                 ;;
8418         esac
8419
8420         rp="What command should be used to create dynamic libraries?"
8421         . ./myread
8422         ld="$ans"
8423
8424         cat << EOM
8425
8426 Some systems may require passing special flags to $ld to create a
8427 library that can be dynamically loaded.  If your ld flags include
8428 -L/other/path options to locate libraries outside your loader's normal
8429 search path, you may need to specify those -L options here as well.  To
8430 use no flags, say "none".
8431
8432 EOM
8433         case "$lddlflags" in
8434             '') case "$osname" in
8435                     haiku) dflt='-shared' ;;
8436                     hpux) dflt='-b';
8437                           case "$gccversion" in
8438                               '') dflt="$dflt +vnocompatwarnings" ;;
8439                           esac
8440                           ;;
8441                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8442                     solaris) # See [perl #66604].
8443                             # On Solaris 11, gcc -m64 on amd64
8444                             # appears not to understand -G.  gcc versions at
8445                             # least as old as 3.4.3 support -shared, so just
8446                             # use that with Solaris 11 and later, but keep
8447                             # the old behavior for older Solaris versions.
8448                             case "$gccversion" in
8449                                 '') dflt='-G' ;;
8450                                 *)  case "$osvers" in
8451                                         2.?|2.10) dflt='-G' ;;
8452                                         *) dflt='-shared' ;;
8453                                     esac
8454                                     ;;
8455                             esac
8456                             ;;
8457                     sunos) dflt='-assert nodefinitions' ;;
8458                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8459                     *)     dflt='none' ;;
8460                 esac
8461                 ;;
8462             *) dflt="$lddlflags" ;;
8463         esac
8464
8465         : Only do this for gcc, since, for example, qcc has no concept
8466         : of --sysroot.
8467         if $test "X$sysroot" != X; then
8468             case "$gccversion" in
8469                 '') ;;
8470                 *)  dflt="$dflt --sysroot $sysroot" ;;
8471             esac
8472         fi
8473
8474         : Try to guess additional flags to pick up local libraries.
8475         : Be careful not to append to a plain 'none'
8476         case "$dflt" in
8477             none) dflt='' ;;
8478         esac
8479         for thisflag in $ldflags; do
8480             case "$thisflag" in
8481                 -L*|-R*|-Wl,-R*)
8482                     case " $dflt " in
8483                         *" $thisflag "*) ;;
8484                         *) dflt="$dflt $thisflag" ;;
8485                     esac
8486                     ;;
8487             esac
8488         done
8489
8490         case "$dflt" in
8491             ''|' ') dflt='none' ;;
8492         esac
8493
8494         case "$ldflags" in
8495             *-fstack-protector-strong*)
8496                 case "$dflt" in
8497                     *-fstack-protector-strong*) ;; # Don't add it again
8498                     *) dflt="$dflt -fstack-protector-strong" ;;
8499                 esac
8500                 ;;
8501             *-fstack-protector*)
8502                 case "$dflt" in
8503                     *-fstack-protector*) ;; # Don't add it again
8504                     *) dflt="$dflt -fstack-protector" ;;
8505                 esac
8506                 ;;
8507         esac
8508
8509         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8510         . ./myread
8511         case "$ans" in
8512             none) lddlflags=' ' ;;
8513             *) lddlflags="$ans" ;;
8514         esac
8515
8516         cat <<EOM
8517
8518 Some systems may require passing special flags to $cc to indicate that
8519 the resulting executable will use dynamic linking.  To use no flags,
8520 say "none".
8521
8522 EOM
8523         case "$ccdlflags" in
8524             '') case "$osname" in
8525                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8526                     sunos)             dflt='none'   ;;
8527                     *)                 dflt='none'   ;;
8528                 esac ;;
8529             ' ') dflt='none' ;;
8530             *)   dflt="$ccdlflags" ;;
8531         esac
8532         rp="Any special flags to pass to $cc to use dynamic linking?"
8533         . ./myread
8534         case "$ans" in
8535             none) ccdlflags=' ' ;;
8536             *)    ccdlflags="$ans" ;;
8537         esac
8538         ;;
8539
8540     *)  usedl="$undef"
8541         ld='ld'
8542         dlsrc='dl_none.xs'
8543         lddlflags=''
8544         ccdlflags=''
8545         ;;
8546 esac
8547
8548 ld_can_script="$undef"
8549 case "$bin_ELF$usedl" in
8550     $define$define)
8551         # Abuse try.h and a.out names for neat cleanup
8552         $cat >try.c <<EOM
8553 void foo() {}
8554 void bar() {}
8555 EOM
8556         $cat >try.h <<EOM
8557 LIBTEST_42 {
8558  global:
8559   foo;
8560  local: *;
8561  };
8562 EOM
8563         if $cc $cccdlflags $ccdlflags $ccflags \
8564                $ldflags $lddlflags -o a.out try.c \
8565                -Wl,--version-script=try.h >/dev/null 2>&1 \
8566            &&  $test -s a.out ; then
8567             echo "ld supports scripting" >&4
8568             ld_can_script="$define"
8569         else
8570             echo "ld does not support scripting" >&4
8571         fi
8572         $rm_try
8573         ;;
8574 esac
8575
8576 : Do we want a shared libperl?
8577 also=''
8578 case "$usedl" in
8579 $undef)
8580         # No dynamic loading being used, so don't bother even to prompt.
8581         useshrplib='false'
8582         ;;
8583 *)      case "$useshrplib" in
8584         '')     case "$osname" in
8585                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8586                         dflt=y
8587                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8588                         ;;
8589                 *)      dflt=n
8590                         ;;
8591                 esac
8592                 ;;
8593         $define|true|[Yy]*)
8594                 dflt=y
8595                 ;;
8596         *)      dflt=n
8597                 ;;
8598         esac
8599         $cat << EOM
8600
8601 The perl executable is normally obtained by linking perlmain.c with
8602 libperl${_a}, any static extensions (usually just DynaLoader), and
8603 any other libraries needed on this system (such as -lm, etc.).  Since
8604 your system supports dynamic loading, it is probably possible to build
8605 a shared libperl.$so.  If you will have more than one executable linked
8606 to libperl.$so, this will significantly reduce the size of each
8607 executable, but it may have a noticeable effect on performance.  The
8608 default is probably sensible for your system.
8609 $also
8610
8611 EOM
8612         rp="Build a shared libperl.$so (y/n)"
8613         . ./myread
8614         case "$ans" in
8615         true|$define|[Yy]*)
8616                 useshrplib='true'  ;;
8617         *)      useshrplib='false' ;;
8618         esac
8619         ;;
8620 esac
8621
8622 case "$useshrplib" in
8623 true)
8624         case "$userelocatableinc" in
8625         true|define)
8626                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8627                 echo "See INSTALL for an explanation why that won't work." >&4
8628                 exit 4
8629                 ;;
8630         esac
8631         case "$libperl" in
8632         '')
8633                 # Figure out a good name for libperl.so.  Since it gets stored in
8634                 # a version-specific architecture-dependent library, the version
8635                 # number isn't really that important, except for making cc/ld happy.
8636                 #
8637                 # A name such as libperl.so.10.1
8638                 majmin="libperl.$so.$patchlevel.$subversion"
8639                 # A name such as libperl.so.100
8640                 majonly=`echo $patchlevel $subversion |
8641                         $awk '{printf "%d%02d", $1, $2}'`
8642                 majonly=libperl.$so.$majonly
8643                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8644                 # rely on figuring it out from the naming of libc.
8645                 case "${osname}${osvers}" in
8646                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8647                         dflt=libperl.$so
8648                         ;;
8649                 cygwin*) # ld links now against the dll directly
8650                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8651                         majonly=`echo $patchlevel $subversion |
8652                                 $awk '{printf "%03d%03d", $1, $2}'`
8653                         majonly=cygperl5.$majonly.$so
8654                         dflt=$majmin
8655                         ;;
8656                 *)      # Try to guess based on whether libc has major.minor.
8657                         case "$libc" in
8658                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8659                         *libc.$so.[0-9]*) dflt=$majonly ;;
8660                         *)      dflt=libperl.$so ;;
8661                         esac
8662                         ;;
8663                 esac
8664                 ;;
8665         *)      dflt=$libperl
8666                 ;;
8667         esac
8668         cat << EOM
8669
8670 I need to select a good name for the shared libperl.  If your system uses
8671 library names with major and minor numbers, then you might want something
8672 like $majmin.  Alternatively, if your system uses a single version
8673 number for shared libraries, then you might want to use $majonly.
8674 Or, your system might be quite happy with a simple libperl.$so.
8675
8676 Since the shared libperl will get installed into a version-specific
8677 architecture-dependent directory, the version number of the shared perl
8678 library probably isn't important, so the default should be o.k.
8679
8680 EOM
8681         rp='What name do you want to give to the shared libperl?'
8682         . ./myread
8683         libperl=$ans
8684         echo "Ok, I'll use $libperl"
8685         ;;
8686 *)
8687         libperl="libperl${_a}"
8688         ;;
8689 esac
8690
8691 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8692 case "$shrpdir" in
8693 '') ;;
8694 *)      $cat >&4 <<EOM
8695 WARNING:  Use of the shrpdir variable for the installation location of
8696 the shared $libperl is not supported.  It was never documented and
8697 will not work in this version.  Let me (perlbug@perl.org)
8698 know of any problems this may cause.
8699
8700 EOM
8701         case "$shrpdir" in
8702         "$archlibexp/CORE")
8703                 $cat >&4 <<EOM
8704 But your current setting of $shrpdir is
8705 the default anyway, so it's harmless.
8706 EOM
8707                 ;;
8708         *)
8709                 $cat >&4 <<EOM
8710 Further, your current attempted setting of $shrpdir
8711 conflicts with the value of $archlibexp/CORE
8712 that installperl will use.
8713 EOM
8714                 ;;
8715         esac
8716         ;;
8717 esac
8718
8719 # How will the perl executable find the installed shared $libperl?
8720 # Add $xxx to ccdlflags.
8721 # If we can't figure out a command-line option, use $shrpenv to
8722 # set env LD_RUN_PATH.  The main perl makefile uses this.
8723 shrpdir=$archlibexp/CORE
8724 xxx=''
8725 tmp_shrpenv=''
8726 if "$useshrplib"; then
8727     case "$osname" in
8728         aix)
8729                 # We'll set it in Makefile.SH...
8730                 ;;
8731         solaris)
8732                 xxx="-R $shrpdir"
8733                 ;;
8734         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8735                 xxx="-Wl,-R$shrpdir"
8736                 ;;
8737         bsdos|linux|irix*|dec_osf|gnu*)
8738                 xxx="-Wl,-rpath,$shrpdir"
8739                 ;;
8740         haiku)
8741                 # Haiku doesn't like the default, either.
8742                 ;;
8743         hpux*)
8744                 # hpux doesn't like the default, either.
8745                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8746                 ;;
8747         cygwin)
8748                 # cygwin needs only ldlibpth
8749                 ;;
8750         *)
8751                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8752                 ;;
8753         esac
8754         case "$xxx" in
8755         '') ;;
8756         *)
8757                 # Only add $xxx if it isn't already in ccdlflags.
8758                 case " $ccdlflags " in
8759                 *" $xxx "*)     ;;
8760                 *)      ccdlflags="$ccdlflags $xxx"
8761                         cat <<EOM >&4
8762
8763 Adding $xxx to the flags
8764 passed to $ld so that the perl executable will find the
8765 installed shared $libperl.
8766
8767 EOM
8768                         ;;
8769                 esac
8770                 ;;
8771         esac
8772 fi
8773 # Fix ccdlflags in AIX for building external extensions.
8774 # (For building Perl itself bare -bE:perl.exp is needed,
8775 #  Makefile.SH takes care of this.)
8776 case "$osname" in
8777 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8778 esac
8779 # Respect a hint or command-line value.
8780 case "$shrpenv" in
8781 '') shrpenv="$tmp_shrpenv" ;;
8782 esac
8783 case "$ldlibpthname" in
8784 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8785 none)   ldlibpthname='' ;;
8786 esac
8787
8788 : determine where manual pages are on this system
8789 echo " "
8790 case "$sysman" in
8791 '')
8792         syspath='/usr/share/man/man1 /usr/man/man1'
8793         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8794         syspath="$syspath /usr/man/u_man/man1"
8795         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8796         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8797         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8798         sysman=`./loc . /usr/man/man1 $syspath`
8799         ;;
8800 esac
8801 if $test -d "$sysman"; then
8802         echo "System manual is in $sysman." >&4
8803 else
8804         echo "Could not find manual pages in source form." >&4
8805 fi
8806
8807 : determine where manual pages go
8808 set man1dir man1dir none
8809 eval $prefixit
8810 $cat <<EOM
8811
8812 $spackage has manual pages available in source form.
8813 EOM
8814 case "$nroff" in
8815 nroff)
8816         echo "However, you don't have nroff, so they're probably useless to you."
8817         case "$man1dir" in
8818         '') man1dir="none";;
8819         esac;;
8820 esac
8821 echo "If you don't want the manual sources installed, answer 'none'."
8822 case "$man1dir" in
8823 ' ') dflt=none
8824         ;;
8825 '')
8826         lookpath="$prefixexp/share/man/man1"
8827         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8828         lookpath="$lookpath $prefixexp/man/p_man/man1"
8829         lookpath="$lookpath $prefixexp/man/u_man/man1"
8830         lookpath="$lookpath $prefixexp/man/man.1"
8831         case "$sysman" in
8832         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8833         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8834         esac
8835         set dflt
8836         eval $prefixup
8837         ;;
8838 *)  dflt="$man1dir"
8839         ;;
8840 esac
8841 echo " "
8842 fn=dn+~
8843 rp="Where do the main $spackage manual pages (source) go?"
8844 . ./getfile
8845 if $test "X$man1direxp" != "X$ansexp"; then
8846         installman1dir=''
8847 fi
8848 prefixvar=man1dir
8849 . ./setprefixvar
8850
8851 case "$man1dir" in
8852 '')     man1dir=' '
8853         installman1dir='';;
8854 esac
8855
8856 : What suffix to use on installed man pages
8857
8858 case "$man1dir" in
8859 ' ')
8860         man1ext='0'
8861         ;;
8862 *)
8863         rp="What suffix should be used for the main $spackage man pages?"
8864         case "$man1ext" in
8865         '')     case "$man1dir" in
8866                 *1)  dflt=1 ;;
8867                 *1p) dflt=1p ;;
8868                 *1pm) dflt=1pm ;;
8869                 *l) dflt=l;;
8870                 *n) dflt=n;;
8871                 *o) dflt=o;;
8872                 *p) dflt=p;;
8873                 *C) dflt=C;;
8874                 *L) dflt=L;;
8875                 *L1) dflt=L1;;
8876                 *) dflt=1;;
8877                 esac
8878                 ;;
8879         *)      dflt="$man1ext";;
8880         esac
8881         . ./myread
8882         man1ext="$ans"
8883         ;;
8884 esac
8885
8886 : see if we can have long filenames
8887 echo " "
8888 first=123456789abcdef
8889 $rm -f $first
8890 if (echo hi >$first) 2>/dev/null; then
8891         if $test -f 123456789abcde; then
8892                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8893                 val="$undef"
8894         else
8895                 echo 'You can have filenames longer than 14 characters.'>&4
8896                 val="$define"
8897         fi
8898 else
8899         $cat <<'EOM'
8900 You can't have filenames longer than 14 chars.
8901 You can't even think about them!
8902 EOM
8903         val="$undef"
8904 fi
8905 set d_flexfnam
8906 eval $setvar
8907 $rm -rf 123456789abcde*
8908
8909 : determine where library module manual pages go
8910 set man3dir man3dir none
8911 eval $prefixit
8912 $cat <<EOM
8913
8914 $spackage has manual pages for many of the library modules.
8915 EOM
8916
8917 case "$nroff" in
8918 nroff)
8919         $cat <<'EOM'
8920 However, you don't have nroff, so they're probably useless to you.
8921 EOM
8922         case "$man3dir" in
8923         '') man3dir="none";;
8924         esac;;
8925 esac
8926
8927 case "$d_flexfnam" in
8928 undef)
8929         $cat <<'EOM'
8930 However, your system can't handle the long file names like File::Basename.3.
8931 EOM
8932         case "$man3dir" in
8933         '') man3dir="none";;
8934         esac;;
8935 esac
8936
8937 echo "If you don't want the manual sources installed, answer 'none'."
8938 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8939 case "$man3dir" in
8940 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8941         if $test -d "$privlib/man/man3"; then
8942                 cat <<EOM >&4
8943
8944 WARNING:  Previous versions of perl installed man3 pages into
8945 $privlib/man/man3.  This version will suggest a
8946 new default of $dflt.
8947 EOM
8948                 tdflt=$dflt
8949                 dflt='n'
8950                 rp='Do you wish to preserve the old behavior?(y/n)'
8951                 . ./myread
8952                 case "$ans" in
8953                 y*) dflt="$privlib/man/man3" ;;
8954                 *)  dflt=$tdflt ;;
8955                 esac
8956     fi
8957         ;;
8958 *)      dflt="$man3dir" ;;
8959 esac
8960 case "$dflt" in
8961 ' ') dflt=none ;;
8962 esac
8963 echo " "
8964 fn=dn+~
8965 rp="Where do the $package library man pages (source) go?"
8966 . ./getfile
8967 prefixvar=man3dir
8968 . ./setprefixvar
8969
8970 case "$man3dir" in
8971 '')     man3dir=' '
8972         installman3dir='';;
8973 esac
8974
8975 : What suffix to use on installed man pages
8976 case "$man3dir" in
8977 ' ')
8978         man3ext='0'
8979         ;;
8980 *)
8981         rp="What suffix should be used for the $package library man pages?"
8982         case "$man3ext" in
8983         '')     case "$man3dir" in
8984                 *3)  dflt=3 ;;
8985                 *3p) dflt=3p ;;
8986                 *3pm) dflt=3pm ;;
8987                 *l) dflt=l;;
8988                 *n) dflt=n;;
8989                 *o) dflt=o;;
8990                 *p) dflt=p;;
8991                 *C) dflt=C;;
8992                 *L) dflt=L;;
8993                 *L3) dflt=L3;;
8994                 *) dflt=3;;
8995                 esac
8996                 ;;
8997         *)      dflt="$man3ext";;
8998         esac
8999         . ./myread
9000         man3ext="$ans"
9001         ;;
9002 esac
9003
9004 : see if we have to deal with yellow pages, now NIS.
9005 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9006         case "$hostcat" in
9007         nidump*) ;;
9008         *)
9009                 case "$hostcat" in
9010                 *ypcat*) dflt=y;;
9011                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9012                                 dflt=y
9013                         else
9014                                 dflt=n
9015                         fi;;
9016                 *) dflt=n;;
9017                 esac
9018                 echo " "
9019                 rp='Are you getting the hosts file via yellow pages?'
9020                 . ./myread
9021                 case "$ans" in
9022                 y*) hostcat='ypcat hosts';;
9023                 *) hostcat='cat /etc/hosts';;
9024                 esac
9025                 ;;
9026         esac
9027 fi
9028 case "$hostcat" in
9029 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9030 esac
9031 case "$groupcat" in
9032 '') test -f /etc/group && groupcat='cat /etc/group';;
9033 esac
9034 case "$passcat" in
9035 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9036 esac
9037
9038 : now get the host name
9039 echo " "
9040 echo "Figuring out host name..." >&4
9041 case "$myhostname" in
9042 '') cont=true
9043         echo 'Maybe "hostname" will work...'
9044         if tans=`sh -c hostname 2>&1` ; then
9045                 myhostname=$tans
9046                 phostname=hostname
9047                 cont=''
9048         fi
9049         ;;
9050 *) cont='';;
9051 esac
9052 if $test "$cont"; then
9053         if ./xenix; then
9054                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9055                 if tans=`cat /etc/systemid 2>&1` ; then
9056                         myhostname=$tans
9057                         phostname='cat /etc/systemid'
9058                         echo "Whadyaknow.  Xenix always was a bit strange..."
9059                         cont=''
9060                 fi
9061         elif $test -r /etc/systemid; then
9062                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9063         fi
9064 fi
9065 if $test "$cont"; then
9066         echo 'No, maybe "uuname -l" will work...'
9067         if tans=`sh -c 'uuname -l' 2>&1` ; then
9068                 myhostname=$tans
9069                 phostname='uuname -l'
9070         else
9071                 echo 'Strange.  Maybe "uname -n" will work...'
9072                 if tans=`sh -c 'uname -n' 2>&1` ; then
9073                         myhostname=$tans
9074                         phostname='uname -n'
9075                 else
9076                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9077                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9078                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9079                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9080                         else
9081                                 case "$myhostname" in
9082                                 '') echo "Does this machine have an identity crisis or something?"
9083                                         phostname='';;
9084                                 *)
9085                                         echo "Well, you said $myhostname before..."
9086                                         phostname='echo $myhostname';;
9087                                 esac
9088                         fi
9089                 fi
9090         fi
9091 fi
9092 case "$myhostname" in
9093 '') myhostname=noname ;;
9094 esac
9095 : you do not want to know about this
9096 set $myhostname
9097 myhostname=$1
9098
9099 : verify guess
9100 if $test "$myhostname" ; then
9101         dflt=y
9102         rp='Your host name appears to be "'$myhostname'".'" Right?"
9103         . ./myread
9104         case "$ans" in
9105         y*) ;;
9106         *) myhostname='';;
9107         esac
9108 fi
9109
9110 : bad guess or no guess
9111 while $test "X$myhostname" = X ; do
9112         dflt=''
9113         rp="Please type the (one word) name of your host:"
9114         . ./myread
9115         myhostname="$ans"
9116 done
9117
9118 : translate upper to lower if necessary
9119 case "$myhostname" in
9120 *[A-Z]*)
9121         echo "(Normalizing case in your host name)"
9122         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9123         ;;
9124 esac
9125
9126 case "$myhostname" in
9127 *.*)
9128         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9129         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9130         echo "(Trimming domain name from host name--host name is now $myhostname)"
9131         ;;
9132 *) case "$mydomain" in
9133         '')
9134                 {
9135                         test "X$hostcat" = "Xypcat hosts" &&
9136                         ypmatch "$myhostname" hosts 2>/dev/null |\
9137                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9138                         $test -s hosts
9139                 } || {
9140                         test "X$hostcat" != "X" &&
9141                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9142                                         /[       ]$myhostname[  . ]/p" > hosts
9143                 }
9144                 tmp_re="[       . ]"
9145                 if $test -f hosts; then
9146                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9147                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9148                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9149                                 hosts | $sort | $uniq | \
9150                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9151                         case `$echo X$dflt` in
9152                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9153                                 dflt=.
9154                                 ;;
9155                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9156                                 ;;
9157                         esac
9158                 else
9159                         echo "(I cannot locate a hosts database anywhere)"
9160                         dflt=.
9161                 fi
9162                 case "$dflt" in
9163                 .)
9164                         tans=`./loc resolv.conf X /etc /usr/etc`
9165                         if $test -f "$tans"; then
9166                                 echo "(Attempting domain name extraction from $tans)"
9167                                 dflt=.`$sed -n -e 's/   / /g' \
9168                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9169                                   -e 1q 2>/dev/null`
9170                                 case "$dflt" in
9171                                 .) dflt=.`$sed -n -e 's/        / /g' \
9172                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9173                                      -e 1q 2>/dev/null`
9174                                         ;;
9175                                 esac
9176                         fi
9177                         ;;
9178                 esac
9179                 case "$dflt" in
9180                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9181                         dflt=.`sh -c domainname 2>/dev/null`
9182                         case "$dflt" in
9183                         '') dflt='.';;
9184                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9185                         esac
9186                         ;;
9187                 esac
9188                 case "$dflt$osname" in
9189                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9190                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9191                         ;;
9192                 esac
9193                 case "$dflt" in
9194                 .) echo "(Lost all hope -- silly guess then)"
9195                         dflt='.nonet'
9196                         ;;
9197                 esac
9198                 $rm -f hosts
9199                 ;;
9200         *) dflt="$mydomain";;
9201         esac;;
9202 esac
9203 echo " "
9204 rp="What is your domain name?"
9205 . ./myread
9206 tans="$ans"
9207 case "$ans" in
9208 '') ;;
9209 .*) ;;
9210 *) tans=".$tans";;
9211 esac
9212 mydomain="$tans"
9213
9214 : translate upper to lower if necessary
9215 case "$mydomain" in
9216 *[A-Z]*)
9217         echo "(Normalizing case in your domain name)"
9218         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9219         ;;
9220 esac
9221
9222 : a little sanity check here
9223 case "$phostname" in
9224 '') ;;
9225 *)
9226         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9227         $myhostname$mydomain|$myhostname) ;;
9228         *)
9229                 case "$phostname" in
9230                 sed*)
9231                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9232                         ;;
9233                 *)
9234                         echo "(That doesn't agree with your $phostname command, by the way.)"
9235                         ;;
9236                 esac
9237         ;;
9238         esac
9239         ;;
9240 esac
9241
9242 : determine the e-mail address of the user who is running us
9243 $cat <<EOM
9244
9245 I need to get your e-mail address in Internet format if possible, i.e.
9246 something like user@host.domain. Please answer accurately since I have
9247 no easy means to double check it. The default value provided below
9248 is most probably close to reality but may not be valid from outside
9249 your organization...
9250
9251 EOM
9252 cont=x
9253 while test "$cont"; do
9254         case "$MAILDOMAIN" in
9255         '')
9256                 if $test -s /etc/mailname; then
9257                         maildomain=`$cat /etc/mailname`
9258                 else
9259                         maildomain="$myhostname$mydomain"
9260                 fi
9261                 ;;
9262         *)  maildomain="$MAILDOMAIN";;
9263         esac
9264         case "$cf_email" in
9265         '') dflt="$cf_by@$maildomain";;
9266         *)  dflt="$cf_email";;
9267         esac
9268         rp='What is your e-mail address?'
9269         . ./myread
9270         cf_email="$ans"
9271         case "$cf_email" in
9272         *@*.*) cont='' ;;
9273         *)
9274                 rp='Address does not look like an Internet one.  Use it anyway?'
9275                 case "$fastread" in
9276                 yes) dflt=y ;;
9277                 *) dflt=n ;;
9278                 esac
9279                 . ./myread
9280                 case "$ans" in
9281                 y*) cont='' ;;
9282                 *) echo " " ;;
9283                 esac
9284                 ;;
9285         esac
9286 done
9287
9288 : Ask e-mail of administrator
9289 $cat <<EOM
9290
9291 If you or somebody else will be maintaining perl at your site, please
9292 fill in the correct e-mail address here so that they may be contacted
9293 if necessary. Currently, the "perlbug" program included with perl
9294 will send mail to this address in addition to perlbug@perl.org. You may
9295 enter "none" for no administrator.
9296
9297 EOM
9298 case "$perladmin" in
9299 '') dflt="$cf_email";;
9300 *) dflt="$perladmin";;
9301 esac
9302 rp='Perl administrator e-mail address'
9303 . ./myread
9304 perladmin="$ans"
9305
9306 : determine whether to only install version-specific parts.
9307 echo " "
9308 $cat <<EOM
9309 Do you want to install only the version-specific parts of the perl
9310 distribution?  Usually you do *not* want to do this.
9311 EOM
9312 case "$versiononly" in
9313 "$define"|[Yy]*|true) dflt='y' ;;
9314 *) dflt='n';
9315 esac
9316 rp="Do you want to install only the version-specific parts of perl?"
9317 . ./myread
9318 case "$ans" in
9319 [yY]*)  val="$define";;
9320 *)      val="$undef" ;;
9321 esac
9322 set versiononly
9323 eval $setvar
9324
9325 case "$versiononly" in
9326 "$define") inc_version_list=''
9327            inc_version_list_init=0
9328            ;;
9329 esac
9330
9331 : figure out how to guarantee perl startup
9332 : XXX Note that this currently takes advantage of the bug that binexp ignores
9333 :     the Configure -Dinstallprefix setting, which in turn means that under
9334 :     relocatable @INC, initialinstalllocation is what binexp started as.
9335 case "$startperl" in
9336 '')
9337         case "$sharpbang" in
9338         *!)
9339                 $cat <<EOH
9340
9341 I can use the #! construct to start perl on your system. This will
9342 make startup of perl scripts faster, but may cause problems if you
9343 want to share those scripts and perl is not in a standard place
9344 ($initialinstalllocation/perl) on all your platforms. The alternative
9345 is to force a shell by starting the script with a single ':' character.
9346
9347 EOH
9348                 case "$versiononly" in
9349                 "$define")      dflt="$initialinstalllocation/perl$version";;
9350                 *)              dflt="$initialinstalllocation/perl";;
9351                 esac
9352                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9353                 . ./myread
9354                 case "$ans" in
9355                 none)   startperl=": # use perl";;
9356                 *)      startperl="#!$ans"
9357                         if $test 30 -lt `echo "$ans" | wc -c`; then
9358                                 $cat >&4 <<EOM
9359
9360 WARNING:  Some systems limit the #! command to 32 characters.
9361 If you experience difficulty running Perl scripts with #!, try
9362 installing Perl in a directory with a shorter pathname.
9363
9364 EOM
9365                         fi ;;
9366                 esac
9367                 ;;
9368         *) startperl=": # use perl"
9369                 ;;
9370         esac
9371         ;;
9372 esac
9373 echo "I'll use $startperl to start perl scripts."
9374
9375 : figure best path for perl in scripts
9376 case "$perlpath" in
9377 '')
9378         case "$versiononly" in
9379         "$define")      perlpath="$initialinstalllocation/perl$version";;
9380         *)              perlpath="$initialinstalllocation/perl";;
9381         esac
9382         case "$startperl" in
9383         *!*) ;;
9384         *)
9385                 $cat <<EOH
9386
9387 I will use the "eval 'exec'" idiom to start Perl on your system.
9388 I can use the full path of your Perl binary for this purpose, but
9389 doing so may cause problems if you want to share those scripts and
9390 Perl is not always in a standard place ($initialinstalllocation/perl).
9391
9392 EOH
9393                 dflt="$initialinstalllocation/perl"
9394                 rp="What path shall I use in \"eval 'exec'\"?"
9395                 . ./myread
9396                 perlpath="$ans"
9397                 ;;
9398         esac
9399         ;;
9400 esac
9401 case "$startperl" in
9402 *!*)    ;;
9403 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9404 esac
9405
9406 : determine where public executable scripts go
9407 set scriptdir scriptdir
9408 eval $prefixit
9409 case "$scriptdir" in
9410 '')
9411         dflt="$bin"
9412         : guess some guesses
9413         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9414         $test -d /usr/share/bin     && dflt=/usr/share/bin
9415         $test -d /usr/local/script  && dflt=/usr/local/script
9416         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9417         $test -d $prefixexp/script  && dflt=$prefixexp/script
9418         set dflt
9419         eval $prefixup
9420         ;;
9421 *)  dflt="$scriptdir"
9422         ;;
9423 esac
9424 $cat <<EOM
9425
9426 Some installations have a separate directory just for executable scripts so
9427 that they can mount it across multiple architectures but keep the scripts in
9428 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9429 Or you might just lump your scripts in with all your other executables.
9430
9431 EOM
9432 fn=d~
9433 rp='Where do you keep publicly executable scripts?'
9434 . ./getfile
9435 if $test "X$ansexp" != "X$scriptdirexp"; then
9436         installscript=''
9437 fi
9438 installscriptdir=''
9439 prefixvar=scriptdir
9440 . ./setprefixvar
9441 : A little fix up for an irregularly named variable.
9442 installscript="$installscriptdir"
9443
9444 : determine where add-on public executables go
9445 case "$sitebin" in
9446 '')     dflt=$siteprefix/bin ;;
9447 *)      dflt=$sitebin ;;
9448 esac
9449 fn=d~
9450 rp='Pathname where the add-on public executables should be installed?'
9451 . ./getfile
9452 prefixvar=sitebin
9453 . ./setprefixvar
9454
9455 : determine where add-on html pages go
9456 : There is no standard location, so try to copy the previously-selected
9457 : directory structure for the core html pages.
9458 case "$sitehtml1dir" in
9459 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9460 *)     dflt=$sitehtml1dir ;;
9461 esac
9462 case "$dflt" in
9463 ''|' ') dflt=none ;;
9464 esac
9465 fn=dn+~
9466 rp='Pathname where the site-specific html pages should be installed?'
9467 . ./getfile
9468 prefixvar=sitehtml1dir
9469 . ./setprefixvar
9470
9471 : determine where add-on library html pages go
9472 : There is no standard location, so try to copy the previously-selected
9473 : directory structure for the core html pages.
9474 case "$sitehtml3dir" in
9475 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9476 *)     dflt=$sitehtml3dir ;;
9477 esac
9478 case "$dflt" in
9479 ''|' ') dflt=none ;;
9480 esac
9481 fn=dn+~
9482 rp='Pathname where the site-specific library html pages should be installed?'
9483 . ./getfile
9484 prefixvar=sitehtml3dir
9485 . ./setprefixvar
9486
9487 : determine where add-on manual pages go
9488 case "$siteman1dir" in
9489 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9490 *)      dflt=$siteman1dir ;;
9491 esac
9492 case "$dflt" in
9493 ''|' ') dflt=none ;;
9494 esac
9495 fn=dn+~
9496 rp='Pathname where the site-specific manual pages should be installed?'
9497 . ./getfile
9498 prefixvar=siteman1dir
9499 . ./setprefixvar
9500
9501 : determine where add-on library man pages go
9502 case "$siteman3dir" in
9503 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9504 *)      dflt=$siteman3dir ;;
9505 esac
9506 case "$dflt" in
9507 ''|' ') dflt=none ;;
9508 esac
9509 fn=dn+~
9510 rp='Pathname where the site-specific library manual pages should be installed?'
9511 . ./getfile
9512 prefixvar=siteman3dir
9513 . ./setprefixvar
9514
9515 : determine where add-on public executable scripts go
9516 case "$sitescript" in
9517 '')     dflt=$siteprefix/script
9518         $test -d $dflt || dflt=$sitebin ;;
9519 *)  dflt="$sitescript" ;;
9520 esac
9521 fn=d~+
9522 rp='Pathname where add-on public executable scripts should be installed?'
9523 . ./getfile
9524 prefixvar=sitescript
9525 . ./setprefixvar
9526
9527 : see if backtrace exists
9528 set backtrace d_backtrace
9529 eval $inlibc
9530
9531 : add flags if using c backtrace
9532 case "$usecbacktrace" in
9533   "") usecbacktrace=$undef ;;
9534   [yY]*|true|$define)
9535     case "$d_backtrace" in
9536       [yY]*|true|$define)
9537         case " $ccflags " in
9538           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9539           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9540           esac
9541         ;;
9542       *)
9543         echo "This system does not support backtrace" >&4
9544         usecbacktrace=$undef
9545         ;;
9546       esac
9547     ;;
9548   esac
9549
9550 : Check if faststdio is requested and available
9551 case "$usefaststdio" in
9552 $define|true|[yY]*|'')
9553         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9554         case "$xversion" in
9555         [68])   dflt='y' ;;
9556         *)      dflt='n' ;;
9557         esac
9558         ;;
9559 *) dflt='n';;
9560 esac
9561 cat <<EOM
9562
9563 Perl can be built to use 'fast stdio', which means using the stdio
9564 library but also directly manipulating the stdio buffers to enable
9565 faster I/O.  Using stdio is better for backward compatibility (especially
9566 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9567 interface has been preferred instead of stdio.
9568
9569 If this doesn't make any sense to you, just accept the default '$dflt'.
9570 EOM
9571 rp='Use the "fast stdio" if available?'
9572 . ./myread
9573 case "$ans" in
9574 y|Y)    val="$define" ;;
9575 *)      val="$undef" ;;
9576 esac
9577 set usefaststdio
9578 eval $setvar
9579
9580
9581 : define an is-a-typedef? function
9582 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9583 case "$inclist" in
9584 "") inclist="sys/types.h";;
9585 esac;
9586 eval "varval=\$$var";
9587 case "$varval" in
9588 "")
9589         $rm -f temp.c;
9590         for inc in $inclist; do
9591                 echo "#include <$inc>" >>temp.c;
9592         done;
9593         echo "#ifdef $type" >> temp.c;
9594         echo "printf(\"We have $type\");" >> temp.c;
9595         echo "#endif" >> temp.c;
9596         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9597         if $contains $type temp.E >/dev/null 2>&1; then
9598                 eval "$var=\$type";
9599         else
9600                 eval "$var=\$def";
9601         fi;
9602         $rm -f temp.?;;
9603 *) eval "$var=\$varval";;
9604 esac'
9605
9606 : define an is-a-typedef? function that prompts if the type is not available.
9607 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9608 case "$inclist" in
9609 "") inclist="sys/types.h";;
9610 esac;
9611 eval "varval=\$$var";
9612 case "$varval" in
9613 "")
9614         $rm -f temp.c;
9615         for inc in $inclist; do
9616                 echo "#include <$inc>" >>temp.c;
9617         done;
9618         echo "#ifdef $type" >> temp.c;
9619         echo "printf(\"We have $type\");" >> temp.c;
9620         echo "#endif" >> temp.c;
9621         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9622         echo " " ;
9623         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9624         if $contains $type temp.E >/dev/null 2>&1; then
9625                 echo "$type found." >&4;
9626                 eval "$var=\$type";
9627         else
9628                 echo "$type NOT found." >&4;
9629                 dflt="$def";
9630                 . ./myread ;
9631                 eval "$var=\$ans";
9632         fi;
9633         $rm -f temp.?;;
9634 *) eval "$var=\$varval";;
9635 esac'
9636
9637 : see what type lseek is declared as in the kernel
9638 rp="What is the type used for lseek's offset on this system?"
9639 set off_t lseektype long stdio.h sys/types.h
9640 eval $typedef_ask
9641
9642 echo " "
9643 echo "Checking to see how big your file offsets are..." >&4
9644 $cat >try.c <<EOCP
9645 #include <sys/types.h>
9646 #include <stdio.h>
9647 int main()
9648 {
9649     printf("%d\n", (int)sizeof($lseektype));
9650     return(0);
9651 }
9652 EOCP
9653 set try
9654 if eval $compile_ok; then
9655         lseeksize=`$run ./try`
9656         echo "Your file offsets are $lseeksize bytes long."
9657 else
9658         dflt=$longsize
9659         echo " "
9660         echo "(I can't seem to compile the test program.  Guessing...)"
9661         rp="What is the size of your file offsets (in bytes)?"
9662         . ./myread
9663         lseeksize="$ans"
9664 fi
9665 $rm_try
9666
9667 : see what type file positions are declared as in the library
9668 rp="What is the type for file position used by fsetpos()?"
9669 set fpos_t fpostype long stdio.h sys/types.h
9670 eval $typedef_ask
9671
9672 : Check size for Fpos_t
9673 echo " "
9674 case "$fpostype" in
9675 *_t) zzz="$fpostype"    ;;
9676 *)   zzz="fpos_t"       ;;
9677 esac
9678 echo "Checking the size of $zzz..." >&4
9679 cat > try.c <<EOCP
9680 #include <sys/types.h>
9681 #include <stdio.h>
9682 #$i_stdlib I_STDLIB
9683 #ifdef I_STDLIB
9684 #include <stdlib.h>
9685 #endif
9686 int main() {
9687     printf("%d\n", (int)sizeof($fpostype));
9688     exit(0);
9689 }
9690 EOCP
9691 set try
9692 if eval $compile_ok; then
9693         yyy=`$run ./try`
9694         case "$yyy" in
9695         '')     fpossize=4
9696                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9697                 ;;
9698         *)      fpossize=$yyy
9699                 echo "Your $zzz is $fpossize bytes long."
9700                 ;;
9701         esac
9702 else
9703         dflt="$longsize"
9704         echo " " >&4
9705         echo "(I can't compile the test program.  Guessing...)" >&4
9706         rp="What is the size of your file positions (in bytes)?"
9707         . ./myread
9708         fpossize="$ans"
9709 fi
9710
9711 : Check for large file support
9712 # Backward compatibility (uselfs is deprecated).
9713 case "$uselfs" in
9714 "$define"|true|[yY]*)
9715         cat <<EOM >&4
9716
9717 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9718 EOM
9719         uselargefiles="$define"
9720         ;;
9721 esac
9722
9723 case "$lseeksize:$fpossize" in
9724 8:8) cat <<EOM
9725
9726 You can have files larger than 2 gigabytes.
9727 EOM
9728    val="$define" ;;
9729 *)    case "$uselargefiles" in
9730    "$undef"|false|[nN]*) dflt='n' ;;
9731    *)   dflt='y' ;;
9732    esac
9733    cat <<EOM
9734
9735 Perl can be built to understand large files (files larger than 2 gigabytes)
9736 on some systems.  To do so, Configure can be run with -Duselargefiles.
9737
9738 If this doesn't make any sense to you, just accept the default '$dflt'.
9739 EOM
9740    rp='Try to understand large files, if available?'
9741    . ./myread
9742    case "$ans" in
9743    y|Y)         val="$define" ;;
9744    *)           val="$undef"  ;;
9745    esac
9746    ;;
9747 esac
9748 set uselargefiles
9749 eval $setvar
9750 : Look for a hint-file generated 'call-back-unit'.  If the
9751 : user has specified that a large files perl is to be built,
9752 : we may need to set or change some other defaults.
9753 if $test -f uselargefiles.cbu; then
9754         echo "Your platform has some specific hints regarding large file builds, using them..."
9755         . ./uselargefiles.cbu
9756 fi
9757 case "$uselargefiles" in
9758 "$define")
9759         if $test -f uselargefiles.cbu; then
9760                 echo " "
9761                 echo "Rechecking to see how big your file offsets are..." >&4
9762                 $cat >try.c <<EOCP
9763 #include <sys/types.h>
9764 #include <stdio.h>
9765 int main()
9766 {
9767     printf("%d\n", (int)sizeof($lseektype));
9768     return(0);
9769 }
9770 EOCP
9771                 set try
9772                 if eval $compile_ok; then
9773                         lseeksize=`$run ./try`
9774                         $echo "Your file offsets are now $lseeksize bytes long."
9775                 else
9776                         dflt="$lseeksize"
9777                         echo " "
9778                         echo "(I can't seem to compile the test program.  Guessing...)"
9779                         rp="What is the size of your file offsets (in bytes)?"
9780                         . ./myread
9781                         lseeksize="$ans"
9782                 fi
9783                 case "$fpostype" in
9784                 *_t) zzz="$fpostype"    ;;
9785                 *)   zzz="fpos_t"       ;;
9786                 esac
9787                 $echo $n "Rechecking the size of $zzz...$c" >&4
9788                 $cat > try.c <<EOCP
9789 #include <sys/types.h>
9790 #include <stdio.h>
9791 #$i_stdlib I_STDLIB
9792 #ifdef I_STDLIB
9793 #include <stdlib.h>
9794 #endif
9795 int main() {
9796     printf("%d\n", (int)sizeof($fpostype));
9797     return(0);
9798 }
9799 EOCP
9800                 set try
9801                 if eval $compile_ok; then
9802                         yyy=`$run ./try`
9803                         dflt="$lseeksize"
9804                         case "$yyy" in
9805                         '')     echo " "
9806                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9807                                 ;;
9808                         *)      fpossize=$yyy
9809                                 echo " $fpossize bytes." >&4
9810                                 ;;
9811                         esac
9812                 else
9813                         dflt="$fpossize"
9814                         echo " "
9815                         echo "(I can't compile the test program.  Guessing...)" >&4
9816                         rp="What is the size of your file positions (in bytes)?"
9817                         . ./myread
9818                         fpossize="$ans"
9819                 fi
9820                 $rm_try
9821         fi
9822         ;;
9823 esac
9824
9825 : Check if we want perlio
9826 useperlio="$define"
9827
9828 : Set the vendorbin variables
9829 case "$vendorprefix" in
9830 '')     d_vendorbin="$undef"
9831         vendorbin=''
9832         vendorbinexp=''
9833         ;;
9834 *)      d_vendorbin="$define"
9835         : determine where vendor-supplied executables go.
9836         case "$vendorbin" in
9837         '') dflt=$vendorprefix/bin ;;
9838         *)      dflt="$vendorbin" ;;
9839         esac
9840         fn=d~+
9841         rp='Pathname for the vendor-supplied executables directory?'
9842         . ./getfile
9843         vendorbin="$ans"
9844         vendorbinexp="$ansexp"
9845         ;;
9846 esac
9847 prefixvar=vendorbin
9848 . ./installprefix
9849
9850 : Set the vendorhtml1dir variables
9851 case "$vendorprefix" in
9852 '')     vendorhtml1dir=''
9853         vendorhtml1direxp=''
9854         ;;
9855 *)      : determine where vendor-supplied html pages go.
9856         : There is no standard location, so try to copy the previously-selected
9857         : directory structure for the core html pages.
9858         : XXX Better default suggestions would be welcome.
9859         case "$vendorhtml1dir" in
9860         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9861         *)      dflt=$vendorhtml1dir ;;
9862         esac
9863         case "$dflt" in
9864         ''|' ') dflt=none ;;
9865         esac
9866         fn=dn+~
9867         rp='Pathname for the vendor-supplied html pages?'
9868         . ./getfile
9869         vendorhtml1dir="$ans"
9870         vendorhtml1direxp="$ansexp"
9871         ;;
9872 esac
9873 : Use ' ' for none so value is preserved next time through Configure
9874 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9875 prefixvar=vendorhtml1dir
9876 . ./installprefix
9877
9878 : Set the vendorhtml3dir variables
9879 case "$vendorprefix" in
9880 '')     vendorhtml3dir=''
9881         vendorhtml3direxp=''
9882         ;;
9883 *)      : determine where vendor-supplied module html pages go.
9884         : There is no standard location, so try to copy the previously-selected
9885         : directory structure for the core html pages.
9886         : XXX Better default suggestions would be welcome.
9887         case "$vendorhtml3dir" in
9888         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9889         *)      dflt=$vendorhtml3dir ;;
9890         esac
9891         case "$dflt" in
9892         ''|' ') dflt=none ;;
9893         esac
9894         fn=dn+~
9895         rp='Pathname for the vendor-supplied html pages?'
9896         . ./getfile
9897         vendorhtml3dir="$ans"
9898         vendorhtml3direxp="$ansexp"
9899         ;;
9900 esac
9901 : Use ' ' for none so value is preserved next time through Configure
9902 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9903 prefixvar=vendorhtml3dir
9904 . ./installprefix
9905
9906 : Set the vendorman1dir variables
9907 case "$vendorprefix" in
9908 '')     vendorman1dir=''
9909         vendorman1direxp=''
9910         ;;
9911 *)      : determine where vendor-supplied manual pages go.
9912         case "$vendorman1dir" in
9913         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9914         *)      dflt=$vendorman1dir ;;
9915         esac
9916         case "$dflt" in
9917         ''|' ') dflt=none ;;
9918         esac
9919         fn=nd~+
9920         rp='Pathname for the vendor-supplied manual section 1 pages?'
9921         . ./getfile
9922         vendorman1dir="$ans"
9923         vendorman1direxp="$ansexp"
9924         ;;
9925 esac
9926 : Use ' ' for none so value is preserved next time through Configure
9927 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9928 prefixvar=vendorman1dir
9929 . ./installprefix
9930
9931 : Set the vendorman3dir variables
9932 case "$vendorprefix" in
9933 '')     vendorman3dir=''
9934         vendorman3direxp=''
9935         ;;
9936 *)      : determine where vendor-supplied module manual pages go.
9937         case "$vendorman3dir" in
9938         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9939         *)      dflt=$vendorman3dir ;;
9940         esac
9941         case "$dflt" in
9942         ''|' ') dflt=none ;;
9943         esac
9944         fn=nd~+
9945         rp='Pathname for the vendor-supplied manual section 3 pages?'
9946         . ./getfile
9947         vendorman3dir="$ans"
9948         vendorman3direxp="$ansexp"
9949         ;;
9950 esac
9951 : Use ' ' for none so value is preserved next time through Configure
9952 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9953 prefixvar=vendorman3dir
9954 . ./installprefix
9955
9956 : Set the vendorscript variables
9957 case "$vendorprefix" in
9958 '')     d_vendorscript="$undef"
9959         vendorscript=''
9960         vendorscriptexp=''
9961         ;;
9962 *)      d_vendorscript="$define"
9963         : determine where vendor-supplied scripts go.
9964         case "$vendorscript" in
9965         '')     dflt=$vendorprefix/script
9966                 $test -d $dflt || dflt=$vendorbin ;;
9967         *)  dflt="$vendorscript" ;;
9968         esac
9969         $cat <<EOM
9970
9971 The installation process will create a directory for
9972 vendor-supplied scripts.
9973
9974 EOM
9975         fn=d~+
9976         rp='Pathname for the vendor-supplied scripts directory?'
9977         . ./getfile
9978         vendorscript="$ans"
9979         vendorscriptexp="$ansexp"
9980         ;;
9981 esac
9982 prefixvar=vendorscript
9983 . ./installprefix
9984
9985 : script used to emit important warnings
9986 cat >warn <<EOS
9987 $startsh
9988 if test \$# -gt 0; then
9989         echo "\$@" >msg
9990 else
9991         cat >msg
9992 fi
9993 echo "*** WARNING:" >&4
9994 sed -e 's/^/*** /' <msg >&4
9995 echo "*** " >&4
9996 cat msg >>config.msg
9997 echo " " >>config.msg
9998 rm -f msg
9999 EOS
10000 chmod +x warn
10001 $eunicefix warn
10002
10003 : see which of string.h or strings.h is needed
10004 echo " "
10005 strings=`./findhdr string.h`
10006 if $test "$strings" && $test -r "$strings"; then
10007         echo "Using <string.h> instead of <strings.h>." >&4
10008         val="$define"
10009 else
10010         val="$undef"
10011         strings=`./findhdr strings.h`
10012         if $test "$strings" && $test -r "$strings"; then
10013                 echo "Using <strings.h> instead of <string.h>." >&4
10014         else
10015                 ./warn "No string header found -- You'll surely have problems."
10016         fi
10017 fi
10018 set i_string
10019 eval $setvar
10020 case "$i_string" in
10021 "$undef") strings=`./findhdr strings.h`;;
10022 *)        strings=`./findhdr string.h`;;
10023 esac
10024
10025 : see if qgcvt exists
10026 set qgcvt d_qgcvt
10027 eval $inlibc
10028
10029 : Check what kind of doubles your system has
10030 $echo "Checking the kind of doubles you have..." >&4
10031 $cat >try.c <<EOP
10032 #$i_stdlib I_STDLIB
10033 #define DOUBLESIZE $doublesize
10034 #ifdef I_STDLIB
10035 #include <stdlib.h>
10036 #endif
10037 #include <stdio.h>
10038 static const double d = -0.1;
10039 int main() {
10040   unsigned const char* b = (unsigned const char*)(&d);
10041 #if DOUBLESIZE == 4
10042   if (b[0] == 0xCD && b[3] == 0xBD) {
10043     /* IEEE 754 32-bit little-endian */
10044     printf("1\n");
10045     exit(0);
10046   }
10047   if (b[0] == 0xBD && b[3] == 0xCD) {
10048     /* IEEE 754 32-bit big-endian */
10049     printf("2\n");
10050     exit(0);
10051   }
10052 #endif
10053 #if DOUBLESIZE == 8
10054   if (b[0] == 0x9A && b[7] == 0xBF) {
10055     /* IEEE 754 64-bit little-endian */
10056     printf("3\n");
10057     exit(0);
10058   }
10059   if (b[0] == 0xBF && b[7] == 0x9A) {
10060     /* IEEE 754 64-bit big-endian */
10061     printf("4\n");
10062     exit(0);
10063   }
10064   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
10065    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
10066     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
10067     * 99 99 b9 bf 9a 99 99 99 */
10068     printf("7\n");
10069     exit(0);
10070   }
10071   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
10072    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
10073     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
10074     * 99 99 99 9a bf b9 99 99 */
10075     printf("8\n");
10076     exit(0);
10077   }
10078 #endif
10079 #if DOUBLESIZE == 16
10080   if (b[0] == 0x9A && b[15] == 0xBF) {
10081     /* IEEE 754 128-bit little-endian */
10082     printf("5\n");
10083     exit(0);
10084   }
10085   if (b[0] == 0xBF && b[15] == 0x9A) {
10086     /* IEEE 754 128-bit big-endian */
10087     printf("6\n");
10088     exit(0);
10089   }
10090 #endif
10091   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
10092    * Whether those environments can still build Perl is debatable. */
10093   printf("-1\n"); /* unknown */
10094   exit(0);
10095 }
10096 EOP
10097 set try
10098 if eval $compile; then
10099     doublekind=`$run ./try`
10100 else
10101     doublekind=-1
10102 fi
10103 case "$doublekind" in
10104 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
10105 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
10106 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
10107 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
10108 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
10109 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
10110 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
10111 esac
10112 $rm_try
10113
10114 : Check print/scan long double stuff
10115 echo " "
10116
10117 if $test X"$d_longdbl" = X"$define"; then
10118
10119 echo "Checking how to print long doubles..." >&4
10120
10121 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10122         $cat >try.c <<'EOCP'
10123 #include <sys/types.h>
10124 #include <stdio.h>
10125 int main() {
10126   double d = 123.456;
10127   printf("%.3f\n", d);
10128 }
10129 EOCP
10130         set try
10131         if eval $compile; then
10132                 yyy=`$run ./try`
10133                 case "$yyy" in
10134                 123.456)
10135                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10136                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10137                         echo "We will use %f."
10138                         ;;
10139                 esac
10140         fi
10141 fi
10142
10143 if $test X"$sPRIfldbl" = X; then
10144         $cat >try.c <<'EOCP'
10145 #include <sys/types.h>
10146 #include <stdio.h>
10147 int main() {
10148   long double d = 123.456;
10149   printf("%.3Lf\n", d);
10150 }
10151 EOCP
10152         set try
10153         if eval $compile; then
10154                 yyy=`$run ./try`
10155                 case "$yyy" in
10156                 123.456)
10157                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10158                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10159                         echo "We will use %Lf."
10160                         ;;
10161                 esac
10162         fi
10163 fi
10164
10165 if $test X"$sPRIfldbl" = X; then
10166         $cat >try.c <<'EOCP'
10167 #include <sys/types.h>
10168 #include <stdio.h>
10169 int main() {
10170   long double d = 123.456;
10171   printf("%.3llf\n", d);
10172 }
10173 EOCP
10174         set try
10175         if eval $compile; then
10176                 yyy=`$run ./try`
10177                 case "$yyy" in
10178                 123.456)
10179                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10180                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10181                         echo "We will use %llf."
10182                         ;;
10183                 esac
10184         fi
10185 fi
10186
10187 if $test X"$sPRIfldbl" = X; then
10188         $cat >try.c <<'EOCP'
10189 #include <sys/types.h>
10190 #include <stdio.h>
10191 int main() {
10192   long double d = 123.456;
10193   printf("%.3lf\n", d);
10194 }
10195 EOCP
10196         set try
10197         if eval $compile; then
10198                 yyy=`$run ./try`
10199                 case "$yyy" in
10200                 123.456)
10201                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10202                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10203                         echo "We will use %lf."
10204                         ;;
10205                 esac
10206         fi
10207 fi
10208
10209 if $test X"$sPRIfldbl" = X; then
10210         echo "Cannot figure out how to print long doubles." >&4
10211 else
10212         sSCNfldbl=$sPRIfldbl    # expect consistency
10213 fi
10214
10215 $rm_try
10216
10217 fi # d_longdbl
10218
10219 case "$sPRIfldbl" in
10220 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10221         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10222         d_SCNfldbl="$undef";
10223         ;;
10224 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10225         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10226         d_SCNfldbl="$define";
10227         ;;
10228 esac
10229
10230 : Before committing on uselongdouble, see whether that looks sane.
10231 if $test "$uselongdouble" = "$define"; then
10232     message=""
10233     echo " "
10234     echo "Checking if your long double math functions work right..." >&4
10235     $cat > try.c <<EOF
10236 #include <math.h>
10237 #include <stdio.h>
10238 int main() {
10239   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
10240 }
10241 EOF
10242     case "$osname:$gccversion" in
10243     aix:)       saveccflags="$ccflags"
10244                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
10245     esac
10246     set try
10247     if eval $compile_ok; then
10248       yyy=`$run ./try`
10249     fi
10250     case "$yyy" in
10251     3) echo "Your long double math functions are working correctly." >&4 ;;
10252     *) echo "Your long double math functions are broken, not using long doubles." >&4
10253        uselongdouble=$undef
10254        ;;
10255     esac
10256     $rm_try
10257     case "$osname:$gccversion" in
10258     aix:)       ccflags="$saveccflags" ;; # restore
10259     esac
10260 fi
10261
10262 : Check how to convert floats to strings.
10263
10264 if test "X$d_Gconvert" = X; then
10265
10266 echo " "
10267 echo "Checking for an efficient way to convert floats to strings."
10268 echo " " > try.c
10269 case "$uselongdouble" in
10270 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10271 esac
10272 case "$d_longdbl" in
10273 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10274 esac
10275 case "$d_PRIgldbl" in
10276 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10277 esac
10278 $cat >>try.c <<EOP
10279 #ifdef TRY_gconvert
10280 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10281 char *myname = "gconvert";
10282 #endif
10283 #ifdef TRY_gcvt
10284 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10285 char *myname = "gcvt";
10286 #endif
10287 #ifdef TRY_qgcvt
10288 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10289 char *myname = "qgcvt";
10290 #define DOUBLETYPE long double
10291 #endif
10292 #ifdef TRY_sprintf
10293 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10294 #ifdef HAS_PRIgldbl
10295 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10296 #else
10297 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10298 #endif
10299 #else
10300 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10301 #endif
10302 char *myname = "sprintf";
10303 #endif
10304
10305 #ifndef DOUBLETYPE
10306 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10307 #define DOUBLETYPE long double
10308 #else
10309 #define DOUBLETYPE double
10310 #endif
10311 #endif
10312
10313 #include <stdio.h>
10314
10315 #$i_stdlib I_STDLIB
10316 #ifdef I_STDLIB
10317 #include <stdlib.h>
10318 #endif
10319 #$i_string I_STRING
10320 #ifdef I_STRING
10321 #  include <string.h>
10322 #else
10323 #  include <strings.h>
10324 #endif
10325
10326 int checkit(char *expect, char *got)
10327 {
10328     if (strcmp(expect, got)) {
10329                 printf("%s oddity:  Expected %s, got %s\n",
10330                         myname, expect, got);
10331                 exit(1);
10332         }
10333 }
10334
10335 int main()
10336 {
10337         char buf[64];
10338         buf[63] = '\0';
10339
10340         /* This must be 1st test on (which?) platform */
10341         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10342         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10343         checkit("0.1", buf);
10344
10345         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10346         checkit("0.01", buf);
10347
10348         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10349         checkit("0.001", buf);
10350
10351         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10352         checkit("0.0001", buf);
10353
10354         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10355         if (strlen(buf) > 5)
10356             checkit("9e-005", buf); /* for Microsoft ?? */
10357         else
10358             checkit("9e-05", buf);
10359
10360         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10361         checkit("1", buf);
10362
10363         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10364         checkit("1.1", buf);
10365
10366         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10367         checkit("1.01", buf);
10368
10369         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10370         checkit("1.001", buf);
10371
10372         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10373         checkit("1.0001", buf);
10374
10375         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10376         checkit("1.00001", buf);
10377
10378         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10379         checkit("1.000001", buf);
10380
10381         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10382         checkit("0", buf);
10383
10384         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10385         checkit("-1", buf);
10386
10387         /* Some Linux gcvt's give 1.e+5 here. */
10388         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10389         checkit("100000", buf);
10390
10391         /* Some Linux gcvt's give -1.e+5 here. */
10392         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10393         checkit("-100000", buf);
10394
10395         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10396         checkit("123.456", buf);
10397
10398         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10399         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10400         /* 34 should be enough to scare even long double
10401          * places into using the e notation. */
10402         if (strlen(buf) > 5)
10403             checkit("1e+034", buf); /* for Microsoft */
10404         else
10405             checkit("1e+34", buf);
10406
10407         /* For Perl, if you add additional tests here, also add them to
10408          * t/base/num.t for benefit of platforms not using Configure or
10409          * overriding d_Gconvert */
10410
10411         exit(0);
10412 }
10413 EOP
10414 : first add preferred functions to our list
10415 xxx_list=""
10416 for xxx_convert in $gconvert_preference; do
10417     case $xxx_convert in
10418     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10419     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10420     esac
10421 done
10422 : then add any others
10423 for xxx_convert in gconvert gcvt sprintf; do
10424     case "$xxx_list" in
10425     *$xxx_convert*) ;;
10426     *) xxx_list="$xxx_list $xxx_convert" ;;
10427     esac
10428 done
10429
10430 case "$d_longdbl$uselongdouble" in
10431 "$define$define")
10432     : again, add preferred functions to our list first
10433     xxx_ld_list=""
10434     for xxx_convert in $gconvert_ld_preference; do
10435         case $xxx_convert in
10436         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10437         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10438         esac
10439     done
10440     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10441     for xxx_convert in qgcvt sprintf $xxx_list; do
10442         case "$xxx_ld_list" in
10443         $xxx_convert*|*" $xxx_convert"*) ;;
10444         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10445         esac
10446     done
10447     : if sprintf cannot do long doubles, move it to the end
10448     if test "$d_PRIgldbl" != "$define"; then
10449         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10450     fi
10451     : if no qgcvt, remove it
10452     if test "$d_qgcvt" != "$define"; then
10453         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10454     fi
10455     : use the ld_list
10456     xxx_list="$xxx_ld_list"
10457     ;;
10458 esac
10459
10460 for xxx_convert in $xxx_list; do
10461         echo "Trying $xxx_convert..."
10462         $rm -f try try$_o core
10463         set try -DTRY_$xxx_convert
10464         if eval $compile; then
10465                 echo "$xxx_convert() found." >&4
10466                 if $run ./try; then
10467                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10468                         break;
10469                 else
10470                         echo "...But $xxx_convert didn't work as I expected."
10471                         xxx_convert=''
10472                 fi
10473         else
10474                 echo "$xxx_convert NOT found." >&4
10475         fi
10476 done
10477
10478 if test X$xxx_convert = X; then
10479     echo "*** WHOA THERE!!! ***" >&4
10480     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10481     xxx_convert=sprintf
10482 fi
10483
10484 case "$xxx_convert" in
10485 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10486 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10487 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10488 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10489    "$define$define$define")
10490       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10491    "$define$define$undef")
10492       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10493    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10494    esac
10495    ;;
10496 esac
10497
10498 fi
10499 $rm_try
10500
10501 : see if _fwalk exists
10502 set fwalk d__fwalk
10503 eval $inlibc
10504
10505 : Initialize h_fcntl
10506 h_fcntl=false
10507
10508 : Initialize h_sysfile
10509 h_sysfile=false
10510
10511 : access call always available on UNIX
10512 set access d_access
10513 eval $inlibc
10514
10515 : locate the flags for 'access()'
10516 case "$d_access" in
10517 "$define")
10518         echo " "
10519         $cat >access.c <<EOCP
10520 #include <sys/types.h>
10521 #ifdef I_FCNTL
10522 #include <fcntl.h>
10523 #endif
10524 #ifdef I_SYS_FILE
10525 #include <sys/file.h>
10526 #endif
10527 #ifdef I_UNISTD
10528 #include <unistd.h>
10529 #endif
10530 #$i_stdlib I_STDLIB
10531 #ifdef I_STDLIB
10532 #include <stdlib.h>
10533 #endif
10534 int main() {
10535         exit(R_OK);
10536 }
10537 EOCP
10538         : check sys/file.h first, no particular reason here
10539         if $test `./findhdr sys/file.h` && \
10540                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10541                 h_sysfile=true;
10542                 echo "<sys/file.h> defines the *_OK access constants." >&4
10543         elif $test `./findhdr fcntl.h` && \
10544                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10545                 h_fcntl=true;
10546                 echo "<fcntl.h> defines the *_OK access constants." >&4
10547         elif $test `./findhdr unistd.h` && \
10548                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10549                 echo "<unistd.h> defines the *_OK access constants." >&4
10550         else
10551                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10552         fi
10553         ;;
10554 esac
10555 $rm -f access*
10556
10557 : see if accessx exists
10558 set accessx d_accessx
10559 eval $inlibc
10560
10561 : see if acosh exists
10562 set acosh d_acosh
10563 eval $inlibc
10564
10565 : see if aintl exists
10566 set aintl d_aintl
10567 eval $inlibc
10568
10569 : see if alarm exists
10570 set alarm d_alarm
10571 eval $inlibc
10572
10573 : see if 64bit time functions exists
10574
10575 set ctime64 d_ctime64
10576 eval $inlibc
10577
10578 set localtime64 d_localtime64
10579 eval $inlibc
10580
10581 set gmtime64 d_gmtime64
10582 eval $inlibc
10583
10584 set mktime64 d_mktime64
10585 eval $inlibc
10586
10587 set difftime64 d_difftime64
10588 eval $inlibc
10589
10590 set asctime64 d_asctime64
10591 eval $inlibc
10592
10593 : see if POSIX threads are available
10594 set pthread.h i_pthread
10595 eval $inhdr
10596
10597 : define a function to check prototypes
10598 $cat > protochk <<EOSH
10599 $startsh
10600 cc="$cc"
10601 optimize="$optimize"
10602 ccflags="$ccflags"
10603 prototype="$prototype"
10604 define="$define"
10605 rm_try="$rm_try"
10606 usethreads=$usethreads
10607 i_pthread=$i_pthread
10608 pthread_h_first=$pthread_h_first
10609 EOSH
10610
10611 $cat >> protochk <<'EOSH'
10612
10613 $rm_try
10614 foo="$1"
10615 shift
10616 while test $# -ge 2; do
10617         case "$1" in
10618                 $define) echo "#include <$2>" >> try.c ;;
10619                 literal) echo "$2" >> try.c ;;
10620         esac
10621     # Extra magic for the benefit of systems that need pthread.h
10622     # to be included early to correctly detect threadsafe functions.
10623     # Such functions must guarantee themselves, though, that the usethreads
10624     # and i_pthread have been defined, before calling protochk.
10625     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10626         echo "#include <pthread.h>" >> try.c
10627         pthread_h_done=yes
10628     fi
10629     shift 2
10630 done
10631 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10632 cat >> try.c <<'EOCP'
10633 #ifdef CAN_PROTOTYPE
10634 #define _(args) args
10635 #else
10636 #define _(args) ()
10637 #endif
10638 EOCP
10639 echo "$foo" >> try.c
10640 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10641 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10642 status=$?
10643 $rm_try
10644 exit $status
10645 EOSH
10646 chmod +x protochk
10647 $eunicefix protochk
10648
10649 : Define hasproto macro for Configure internal use
10650 hasproto='varname=$1; func=$2; shift; shift;
10651 while $test $# -ge 2; do
10652         case "$1" in
10653         $define) echo "#include <$2>";;
10654         esac ;
10655     shift 2;
10656 done > try.c;
10657 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10658 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10659         echo "$func() prototype found.";
10660         val="$define";
10661 else
10662         echo "$func() prototype NOT found.";
10663         val="$undef";
10664 fi;
10665 set $varname;
10666 eval $setvar;
10667 $rm_try tryout.c'
10668
10669 : see if sys/types.h has to be included
10670 set sys/types.h i_systypes
10671 eval $inhdr
10672
10673 : see if sys/select.h has to be included
10674 set sys/select.h i_sysselct
10675 eval $inhdr
10676
10677 : Define hasfield macro for Configure internal use
10678 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10679 while $test $# -ge 2; do
10680         case "$1" in
10681         $define) echo "#include <$2>";;
10682         esac ;
10683     shift 2;
10684 done > try.c;
10685 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10686 set try;
10687 if eval $compile; then
10688         val="$define";
10689 else
10690         val="$undef";
10691 fi;
10692 set $varname;
10693 eval $setvar;
10694 $rm_try'
10695
10696 : see if we should include time.h, sys/time.h, or both
10697 echo " "
10698 if test "X$timeincl" = X; then
10699         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10700         $echo $n "I'm now running the test program...$c"
10701         $cat >try.c <<EOCP
10702 #include <sys/types.h>
10703 #ifdef I_TIME
10704 #include <time.h>
10705 #endif
10706 #ifdef I_SYSTIME
10707 #ifdef SYSTIMEKERNEL
10708 #define KERNEL
10709 #endif
10710 #include <sys/time.h>
10711 #endif
10712 #ifdef I_SYSSELECT
10713 #include <sys/select.h>
10714 #endif
10715 #$i_stdlib I_STDLIB
10716 #ifdef I_STDLIB
10717 #include <stdlib.h>
10718 #endif
10719 int main()
10720 {
10721         struct tm foo;
10722 #ifdef S_TIMEVAL
10723         struct timeval bar;
10724 #endif
10725 #ifdef S_TIMEZONE
10726         struct timezone tzp;
10727 #endif
10728         if (foo.tm_sec == foo.tm_sec)
10729                 exit(0);
10730 #ifdef S_TIMEVAL
10731         if (bar.tv_sec == bar.tv_sec)
10732                 exit(0);
10733 #endif
10734         exit(1);
10735 }
10736 EOCP
10737         flags=''
10738         for s_timezone in '-DS_TIMEZONE' ''; do
10739         sysselect=''
10740         for s_timeval in '-DS_TIMEVAL' ''; do
10741         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10742         for i_time in '' '-DI_TIME'; do
10743         for i_systime in '-DI_SYSTIME' ''; do
10744                 case "$flags" in
10745                 '') $echo $n ".$c"
10746                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10747                         if eval $compile; then
10748                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10749                                 shift
10750                                 flags="$*"
10751                                 echo " "
10752                                 $echo $n "Succeeded with $flags$c"
10753                         fi
10754                         ;;
10755                 esac
10756         done
10757         done
10758         done
10759         done
10760         done
10761         timeincl=''
10762         echo " "
10763         case "$flags" in
10764         *SYSTIMEKERNEL*) i_systimek="$define"
10765                 timeincl=`./findhdr sys/time.h`
10766                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10767         *) i_systimek="$undef";;
10768         esac
10769         case "$flags" in
10770         *I_TIME*) i_time="$define"
10771                 timeincl=`./findhdr time.h`" $timeincl"
10772                 echo "We'll include <time.h>." >&4;;
10773         *) i_time="$undef";;
10774         esac
10775         case "$flags" in
10776         *I_SYSTIME*) i_systime="$define"
10777                 timeincl=`./findhdr sys/time.h`" $timeincl"
10778                 echo "We'll include <sys/time.h>." >&4;;
10779         *) i_systime="$undef";;
10780         esac
10781         $rm_try
10782 fi
10783 : see if struct tm knows about tm_zone
10784 case "$i_systime$i_time" in
10785 *$define*)
10786         echo " "
10787         echo "Checking to see if your struct tm has tm_zone field..." >&4
10788         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10789         eval $hasfield
10790         ;;
10791 *)      val="$undef"
10792         set d_tm_tm_zone
10793         eval $setvar
10794         ;;
10795 esac
10796 case "$d_tm_tm_zone" in
10797 "$define")      echo "Yes, it does."   ;;
10798 *)              echo "No, it doesn't." ;;
10799 esac
10800 : see if struct tm knows about tm_gmtoff
10801 case "$i_systime$i_time" in
10802 *$define*)
10803         echo " "
10804         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10805         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10806         eval $hasfield
10807         ;;
10808 *)      val="$undef"
10809         set d_tm_tm_gmtoff
10810         eval $setvar
10811         ;;
10812 esac
10813 case "$d_tm_tm_gmtoff" in
10814 "$define")      echo "Yes, it does."   ;;
10815 *)              echo "No, it doesn't." ;;
10816 esac
10817
10818 : see if asctime_r exists
10819 set asctime_r d_asctime_r
10820 eval $inlibc
10821 case "$d_asctime_r" in
10822 "$define")
10823         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10824         case "$d_asctime_r_proto:$usethreads" in
10825         ":define")      d_asctime_r_proto=define
10826                 set d_asctime_r_proto asctime_r $hdrs
10827                 eval $hasproto ;;
10828         *)      ;;
10829         esac
10830         case "$d_asctime_r_proto" in
10831         define)
10832         case "$asctime_r_proto" in
10833         ''|0) try='char* asctime_r(const struct tm*, char*);'
10834         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10835         esac
10836         case "$asctime_r_proto" in
10837         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10838         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10839         esac
10840         case "$asctime_r_proto" in
10841         ''|0) try='int asctime_r(const struct tm*, char*);'
10842         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10843         esac
10844         case "$asctime_r_proto" in
10845         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10846         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10847         esac
10848         case "$asctime_r_proto" in
10849         ''|0)   d_asctime_r=undef
10850                 asctime_r_proto=0
10851                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10852         * )     case "$asctime_r_proto" in
10853                 REENTRANT_PROTO*) ;;
10854                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10855                 esac
10856                 echo "Prototype: $try" ;;
10857         esac
10858         ;;
10859         *)      case "$usethreads" in
10860                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10861                 esac
10862                 d_asctime_r=undef
10863                 asctime_r_proto=0
10864                 ;;
10865         esac
10866         ;;
10867 *)      asctime_r_proto=0
10868         ;;
10869 esac
10870
10871 : see if asinh exists
10872 set asinh d_asinh
10873 eval $inlibc
10874
10875 : see if atanh exists
10876 set atanh d_atanh
10877 eval $inlibc
10878
10879 : see if atolf exists
10880 set atolf d_atolf
10881 eval $inlibc
10882
10883 : see if atoll exists
10884 set atoll d_atoll
10885 eval $inlibc
10886
10887 : Look for GCC-style attribute format
10888 case "$d_attribute_format" in
10889 '')
10890 echo " "
10891 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10892 $cat >attrib.c <<'EOCP'
10893 #include <stdio.h>
10894 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10895 EOCP
10896 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10897         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10898                 echo "Your C compiler doesn't support __attribute__((format))."
10899                 val="$undef"
10900         else
10901                 echo "Your C compiler supports __attribute__((format))."
10902                 val="$define"
10903         fi
10904 else
10905         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10906         val="$undef"
10907 fi
10908 ;;
10909 *) val="$d_attribute_format" ;;
10910 esac
10911 set d_attribute_format
10912 eval $setvar
10913 $rm -f attrib*
10914
10915 : Look for GCC-style attribute format with null format allowed
10916 case "$d_printf_format_null" in
10917 '') case "$d_attribute_format" in
10918     $define)
10919         echo " "
10920         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10921 $cat >attrib.c <<EOCP
10922 #include <stdio.h>
10923 #$i_stdlib I_STDLIB
10924 #ifdef I_STDLIB
10925 #include <stdlib.h>
10926 #endif
10927 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10928 int null_printf (char* pat,...) { return (int)pat; }
10929 int main () { exit(null_printf(NULL)); }
10930 EOCP
10931         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10932             : run the executable in case it produces a run-time warning
10933             if $run ./attrib >>attrib.out 2>&1; then
10934                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10935                     echo "Your C compiler doesn't allow __printf__ format to be null."
10936                     val="$undef"
10937                 else
10938                     echo "Your C compiler allows __printf__ format to be null."
10939                     val="$define"
10940                 fi
10941             else
10942             echo "Your C compiler executable failed with __printf__ format null."
10943             val="$undef"
10944         fi
10945     else
10946         echo "Your C compiler fails with __printf__ format null."
10947         val="$undef"
10948     fi
10949     ;;
10950     *)  val="$undef" ;;
10951     esac
10952 ;;
10953 *)  val="$d_printf_format_null" ;;
10954 esac
10955 set d_printf_format_null
10956 eval $setvar
10957 $rm -f attrib*
10958
10959 : Look for GCC-style attribute malloc
10960 case "$d_attribute_malloc" in
10961 '')
10962 echo " "
10963 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10964 $cat >attrib.c <<'EOCP'
10965 #include <stdio.h>
10966 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10967 EOCP
10968 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10969         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10970                 echo "Your C compiler doesn't support __attribute__((malloc))."
10971                 val="$undef"
10972         else
10973                 echo "Your C compiler supports __attribute__((malloc))."
10974                 val="$define"
10975         fi
10976 else
10977         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10978         val="$undef"
10979 fi
10980 ;;
10981 *) val="$d_attribute_malloc" ;;
10982 esac
10983 set d_attribute_malloc
10984 eval $setvar
10985 $rm -f attrib*
10986
10987 : Look for GCC-style attribute nonnull
10988 case "$d_attribute_nonnull" in
10989 '')
10990 echo " "
10991 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10992 $cat >attrib.c <<'EOCP'
10993 #include <stdio.h>
10994 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10995 EOCP
10996 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10997         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10998                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10999                 val="$undef"
11000         else
11001                 echo "Your C compiler supports __attribute__((nonnull))."
11002                 val="$define"
11003         fi
11004 else
11005         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11006         val="$undef"
11007 fi
11008 ;;
11009 *) val="$d_attribute_nonnull" ;;
11010 esac
11011 set d_attribute_nonnull
11012 eval $setvar
11013 $rm -f attrib*
11014
11015 : Look for GCC-style attribute noreturn
11016 case "$d_attribute_noreturn" in
11017 '')
11018 echo " "
11019 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11020 $cat >attrib.c <<'EOCP'
11021 #include <stdio.h>
11022 void fall_over_dead( void ) __attribute__((noreturn));
11023 EOCP
11024 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11025         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11026                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11027                 val="$undef"
11028         else
11029                 echo "Your C compiler supports __attribute__((noreturn))."
11030                 val="$define"
11031         fi
11032 else
11033         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11034         val="$undef"
11035 fi
11036 ;;
11037 *) val="$d_attribute_noreturn" ;;
11038 esac
11039 set d_attribute_noreturn
11040 eval $setvar
11041 $rm -f attrib*
11042
11043 : Look for GCC-style attribute pure
11044 case "$d_attribute_pure" in
11045 '')
11046 echo " "
11047 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11048 $cat >attrib.c <<'EOCP'
11049 #include <stdio.h>
11050 int square( int n ) __attribute__((pure));
11051 EOCP
11052 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11053         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11054                 echo "Your C compiler doesn't support __attribute__((pure))."
11055                 val="$undef"
11056         else
11057                 echo "Your C compiler supports __attribute__((pure))."
11058                 val="$define"
11059         fi
11060 else
11061         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11062         val="$undef"
11063 fi
11064 ;;
11065 *) val="$d_attribute_pure" ;;
11066 esac
11067 set d_attribute_pure
11068 eval $setvar
11069 $rm -f attrib*
11070
11071 : Look for GCC-style attribute unused
11072 case "$d_attribute_unused" in
11073 '')
11074 echo " "
11075 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11076 $cat >attrib.c <<'EOCP'
11077 #include <stdio.h>
11078 int do_something( int dummy __attribute__((unused)), int n );
11079 EOCP
11080 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11081         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11082                 echo "Your C compiler doesn't support __attribute__((unused))."
11083                 val="$undef"
11084         else
11085                 echo "Your C compiler supports __attribute__((unused))."
11086                 val="$define"
11087         fi
11088 else
11089         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11090         val="$undef"
11091 fi
11092 ;;
11093 *) val="$d_attribute_unused" ;;
11094 esac
11095 set d_attribute_unused
11096 eval $setvar
11097 $rm -f attrib*
11098
11099 : Look for GCC-style attribute deprecated
11100 case "$d_attribute_deprecated" in
11101 '')
11102 echo " "
11103 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11104 $cat >attrib.c <<'EOCP'
11105 #include <stdio.h>
11106 int I_am_deprecated(void) __attribute__((deprecated));
11107 EOCP
11108 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11109         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11110                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11111                 val="$undef"
11112         else
11113                 echo "Your C compiler supports __attribute__((deprecated))."
11114                 val="$define"
11115         fi
11116 else
11117         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11118         val="$undef"
11119 fi
11120 ;;
11121 *) val="$d_attribute_deprecated" ;;
11122 esac
11123 set d_attribute_deprecated
11124 eval $setvar
11125 $rm -f attrib*
11126
11127 : Look for GCC-style attribute warn_unused_result
11128 case "$d_attribute_warn_unused_result" in
11129 '')
11130 echo " "
11131 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11132 $cat >attrib.c <<'EOCP'
11133 #include <stdio.h>
11134 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11135 EOCP
11136 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11137         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11138                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11139                 val="$undef"
11140         else
11141                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11142                 val="$define"
11143         fi
11144 else
11145         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11146         val="$undef"
11147 fi
11148 ;;
11149 *) val="$d_attribute_warn_unused_result" ;;
11150 esac
11151 set d_attribute_warn_unused_result
11152 eval $setvar
11153 $rm -f attrib*
11154
11155 : see if bcmp exists
11156 set bcmp d_bcmp
11157 eval $inlibc
11158
11159 : see if bcopy exists
11160 set bcopy d_bcopy
11161 eval $inlibc
11162
11163 : see if getpgrp exists
11164 set getpgrp d_getpgrp
11165 eval $inlibc
11166
11167 case "$d_getpgrp" in
11168 "$define")
11169         echo " "
11170         echo "Checking to see which flavor of getpgrp is in use..."
11171         $cat >try.c <<EOP
11172 #$i_unistd I_UNISTD
11173 #include <sys/types.h>
11174 #ifdef I_UNISTD
11175 #  include <unistd.h>
11176 #endif
11177 #$i_stdlib I_STDLIB
11178 #ifdef I_STDLIB
11179 #include <stdlib.h>
11180 #endif
11181 int main()
11182 {
11183         if (getuid() == 0) {
11184                 printf("(I see you are running Configure as super-user...)\n");
11185                 setuid(1);
11186         }
11187 #ifdef TRY_BSD_PGRP
11188         if (getpgrp(1) == 0)
11189                 exit(0);
11190 #else
11191         if (getpgrp() > 0)
11192                 exit(0);
11193 #endif
11194         exit(1);
11195 }
11196 EOP
11197         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11198                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11199                 val="$define"
11200         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11201                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11202                 val="$undef"
11203         else
11204                 echo "I can't seem to compile and run the test program."
11205                 if ./usg; then
11206                         xxx="a USG one, i.e. you use getpgrp()."
11207                 else
11208                         # SVR4 systems can appear rather BSD-ish.
11209                         case "$i_unistd" in
11210                         $undef)
11211                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11212                                 val="$define"
11213                                 ;;
11214                         $define)
11215                                 xxx="probably a USG one, i.e. you use getpgrp()."
11216                                 val="$undef"
11217                                 ;;
11218                         esac
11219                 fi
11220                 echo "Assuming your getpgrp is $xxx" >&4
11221         fi
11222         ;;
11223 *) val="$undef";;
11224 esac
11225 set d_bsdgetpgrp
11226 eval $setvar
11227 $rm_try
11228
11229 : see if setpgrp exists
11230 set setpgrp d_setpgrp
11231 eval $inlibc
11232
11233 case "$d_setpgrp" in
11234 "$define")
11235         echo " "
11236         echo "Checking to see which flavor of setpgrp is in use..."
11237         $cat >try.c <<EOP
11238 #$i_unistd I_UNISTD
11239 #include <sys/types.h>
11240 #ifdef I_UNISTD
11241 #  include <unistd.h>
11242 #endif
11243 #$i_stdlib I_STDLIB
11244 #ifdef I_STDLIB
11245 #include <stdlib.h>
11246 #endif
11247 int main()
11248 {
11249         if (getuid() == 0) {
11250                 printf("(I see you are running Configure as super-user...)\n");
11251                 setuid(1);
11252         }
11253 #ifdef TRY_BSD_PGRP
11254         if (-1 == setpgrp(1, 1))
11255                 exit(0);
11256 #else
11257         if (setpgrp() != -1)
11258                 exit(0);
11259 #endif
11260         exit(1);
11261 }
11262 EOP
11263         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11264                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11265                 val="$define"
11266         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11267                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11268                 val="$undef"
11269         else
11270                 echo "(I can't seem to compile and run the test program.)"
11271                 if ./usg; then
11272                         xxx="a USG one, i.e. you use setpgrp()."
11273                 else
11274                         # SVR4 systems can appear rather BSD-ish.
11275                         case "$i_unistd" in
11276                         $undef)
11277                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11278                                 val="$define"
11279                                 ;;
11280                         $define)
11281                                 xxx="probably a USG one, i.e. you use setpgrp()."
11282                                 val="$undef"
11283                                 ;;
11284                         esac
11285                 fi
11286                 echo "Assuming your setpgrp is $xxx" >&4
11287         fi
11288         ;;
11289 *) val="$undef";;
11290 esac
11291 set d_bsdsetpgrp
11292 eval $setvar
11293 $rm_try
11294
11295 : Look for GCC-style __builtin_choose_expr
11296 case "$d_builtin_choose_expr" in
11297 '')
11298     echo " "
11299     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11300     $cat >try.c <<'EOCP'
11301 #include <assert.h>
11302 #include <stdlib.h>
11303 #include <stdio.h>
11304
11305 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11306
11307 int main(void) {
11308     assert( SYRINX(1) == 2112 );
11309     assert( SYRINX(1) != 5150 );
11310     assert( SYRINX(0) == 5150 );
11311     assert( SYRINX(0) != 2112 );
11312     puts( "All good!" );
11313     exit(0);
11314 }
11315
11316 EOCP
11317     set try
11318     if eval $compile && $run ./try; then
11319         echo "Your C compiler supports __builtin_choose_expr."
11320         val="$define"
11321     else
11322         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11323         val="$undef"
11324     fi
11325 ;;
11326 *) val="$d_builtin_choose_expr" ;;
11327 esac
11328
11329 set d_builtin_choose_expr
11330 eval $setvar
11331 $rm_try
11332
11333 : Look for GCC-style __builtin_expect
11334 case "$d_builtin_expect" in
11335 '')
11336     echo " "
11337     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11338     $cat >try.c <<'EOCP'
11339 int main(void) {
11340     int n = 50;
11341     if ( __builtin_expect(n, 0) ) n = 1;
11342     /* Remember shell exit code truth is 0, C truth is non-zero */
11343     return !(n == 1);
11344 }
11345 EOCP
11346     set try
11347     if eval $compile && $run ./try; then
11348         echo "Your C compiler supports __builtin_expect."
11349         val="$define"
11350     else
11351         echo "Your C compiler doesn't seem to understand __builtin_expect."
11352         val="$undef"
11353     fi
11354     ;;
11355 *) val="$d_builtin_expect" ;;
11356 esac
11357
11358 set d_builtin_expect
11359 eval $setvar
11360 $rm_try
11361
11362 : see if bzero exists
11363 set bzero d_bzero
11364 eval $inlibc
11365
11366 : see if stdarg is available
11367 echo " "
11368 if $test `./findhdr stdarg.h`; then
11369         echo "<stdarg.h> found." >&4
11370         valstd="$define"
11371 else
11372         echo "<stdarg.h> NOT found." >&4
11373         valstd="$undef"
11374 fi
11375
11376 : see if varargs is available
11377 echo " "
11378 if $test `./findhdr varargs.h`; then
11379         echo "<varargs.h> found." >&4
11380 else
11381         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11382 fi
11383
11384 : set up the varargs testing programs
11385 $cat > varargs.c <<EOP
11386 #ifdef I_STDARG
11387 #include <stdarg.h>
11388 #endif
11389 #ifdef I_VARARGS
11390 #include <varargs.h>
11391 #endif
11392
11393 #ifdef I_STDARG
11394 int f(char *p, ...)
11395 #else
11396 int f(va_alist)
11397 va_dcl
11398 #endif
11399 {
11400         va_list ap;
11401 #ifndef I_STDARG
11402         char *p;
11403 #endif
11404 #ifdef I_STDARG
11405         va_start(ap,p);
11406 #else
11407         va_start(ap);
11408         p = va_arg(ap, char *);
11409 #endif
11410         va_end(ap);
11411         return 0;
11412 }
11413 EOP
11414 $cat > varargs <<EOP
11415 $startsh
11416 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11417         echo "true"
11418 else
11419         echo "false"
11420 fi
11421 $rm -f varargs$_o
11422 EOP
11423 chmod +x varargs
11424
11425 : now check which varargs header should be included
11426 echo " "
11427 i_varhdr=''
11428 val=''
11429 case "$valstd" in
11430 "$define")
11431         if `./varargs I_STDARG`; then
11432                 val='stdarg.h'
11433         elif `./varargs I_VARARGS`; then
11434                 val='varargs.h'
11435         fi
11436         ;;
11437 *)
11438         if `./varargs I_VARARGS`; then
11439                 val='varargs.h'
11440         fi
11441         ;;
11442 esac
11443 case "$val" in
11444 '')
11445         echo " "
11446         echo "*** WHOA THERE!!! ***" >&4
11447         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11448         case "$knowitall" in
11449         '')
11450         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11451                 exit 1
11452                 ;;
11453         esac
11454 echo "I could not find the definition for va_dcl... You have problems..." >&4
11455         val="$undef"; set i_stdarg; eval $setvar
11456         val="$undef"; set i_varargs; eval $setvar
11457         ;;
11458 *)
11459         set i_varhdr
11460         eval $setvar
11461         case "$i_varhdr" in
11462         stdarg.h)
11463                 val="$define"; set i_stdarg; eval $setvar
11464                 val="$undef"; set i_varargs; eval $setvar
11465                 ;;
11466         varargs.h)
11467                 val="$undef"; set i_stdarg; eval $setvar
11468                 val="$define"; set i_varargs; eval $setvar
11469                 ;;
11470         esac
11471         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11472 esac
11473 $rm -f varargs*
11474
11475 : see if the Compiler supports C99 variadic macros
11476 case "$i_stdarg$i_stdlib" in
11477     "$define$define")
11478     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11479     $cat >try.c <<EOCP
11480 #include <stdio.h>
11481 #include <stdarg.h>
11482
11483 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11484
11485 int main() {
11486   char buf[20];
11487   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11488   puts(buf);
11489   return 0;
11490 }
11491 EOCP
11492     set try
11493     if eval $compile && $run ./try 2>&1 >/dev/null; then
11494         case "`$run ./try`" in
11495             "123 456 789")
11496             echo "You have C99 variadic macros." >&4
11497             d_c99_variadic_macros="$define"
11498             ;;
11499             *)
11500             echo "You don't have functional C99 variadic macros." >&4
11501             d_c99_variadic_macros="$undef"
11502             ;;
11503         esac
11504     else
11505         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11506         d_c99_variadic_macros="$undef"
11507     fi
11508     $rm_try
11509     ;;
11510     *)
11511     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11512     d_c99_variadic_macros="$undef"
11513     ;;
11514 esac
11515
11516 : see if signal is declared as pointer to function returning int or void
11517 echo " "
11518 xxx=`./findhdr signal.h`
11519 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11520 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11521         echo "You have int (*signal())() instead of void." >&4
11522         val="$undef"
11523 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11524         echo "You have void (*signal())()." >&4
11525         val="$define"
11526 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11527         echo "You have int (*signal())() instead of void." >&4
11528         val="$undef"
11529 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11530         echo "You have void (*signal())()." >&4
11531         val="$define"
11532 else
11533         case "$d_voidsig" in
11534         '')
11535         echo "I can't determine whether signal handler returns void or int..." >&4
11536                 dflt=void
11537                 rp="What type does your signal handler return?"
11538                 . ./myread
11539                 case "$ans" in
11540                 v*) val="$define";;
11541                 *) val="$undef";;
11542                 esac;;
11543         "$define")
11544                 echo "As you already told me, signal handler returns void." >&4
11545                 val="$define"
11546                 ;;
11547         *)      echo "As you already told me, signal handler returns int." >&4
11548                 val="$undef"
11549                 ;;
11550         esac
11551 fi
11552 set d_voidsig
11553 eval $setvar
11554 case "$d_voidsig" in
11555 "$define") signal_t="void";;
11556 *) signal_t="int";;
11557 esac
11558 $rm -f $$.tmp
11559
11560 : check for ability to cast large floats to 32-bit ints.
11561 echo " "
11562 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11563 if $test "$intsize" -ge 4; then
11564         xxx=int
11565 else
11566         xxx=long
11567 fi
11568 $cat >try.c <<EOCP
11569 #include <stdio.h>
11570 #$i_stdlib I_STDLIB
11571 #ifdef I_STDLIB
11572 #include <stdlib.h>
11573 #endif
11574 #include <sys/types.h>
11575 #include <signal.h>
11576 $signal_t blech(int s) { exit(3); }
11577 int main()
11578 {
11579         $xxx i32;
11580         double f, g;
11581         int result = 0;
11582         char str[16];
11583         signal(SIGFPE, blech);
11584
11585         /* Don't let compiler optimize the test away.  Store the number
11586            in a writable string for gcc to pass to sscanf under HP-UX.
11587         */
11588         sprintf(str, "2147483647");
11589         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11590         g = 10 * f;
11591         i32  = ($xxx) g;
11592
11593         /* x86 processors will probably give 0x8000 0000, which is a
11594            sign change.  We don't want that.  We want to mimic SPARC
11595            behavior here, which is to preserve the sign and give
11596            back 0x7fff ffff.
11597         */
11598         if (i32 != ($xxx) f)
11599                 result |= 1;
11600         exit(result);
11601 }
11602 EOCP
11603 set try
11604 if eval $compile_ok; then
11605         $run ./try
11606         yyy=$?
11607 else
11608         echo "(I can't seem to compile the test program--assuming it can't)"
11609         yyy=1
11610 fi
11611 case "$yyy" in
11612 0)      val="$define"
11613         echo "Yup, it can."
11614         ;;
11615 *)      val="$undef"
11616         echo "Nope, it can't."
11617         ;;
11618 esac
11619 set d_casti32
11620 eval $setvar
11621 $rm_try
11622
11623 : check for ability to cast negative floats to unsigned
11624 echo " "
11625 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11626 $cat >try.c <<EOCP
11627 #include <stdio.h>
11628 #$i_stdlib I_STDLIB
11629 #ifdef I_STDLIB
11630 #include <stdlib.h>
11631 #endif
11632 #include <sys/types.h>
11633 #include <signal.h>
11634 $signal_t blech(int s) { exit(7); }
11635 $signal_t blech_in_list(int s) { exit(4); }
11636 unsigned long dummy_long(unsigned long p) { return p; }
11637 unsigned int dummy_int(unsigned int p) { return p; }
11638 unsigned short dummy_short(unsigned short p) { return p; }
11639 int main()
11640 {
11641         double f;
11642         unsigned long along;
11643         unsigned int aint;
11644         unsigned short ashort;
11645         int result = 0;
11646         char str[16];
11647
11648         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11649            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11650            optimized the whole file away
11651         */
11652         /* Store the number in a writable string for gcc to pass to
11653            sscanf under HP-UX.
11654         */
11655         sprintf(str, "-123");
11656         sscanf(str, "%lf", &f);  /* f = -123.; */
11657
11658         signal(SIGFPE, blech);
11659         along = (unsigned long)f;
11660         aint = (unsigned int)f;
11661         ashort = (unsigned short)f;
11662         if (along != (unsigned long)-123)
11663                 result |= 1;
11664         if (aint != (unsigned int)-123)
11665                 result |= 1;
11666         if (ashort != (unsigned short)-123)
11667                 result |= 1;
11668         sprintf(str, "1073741824.");
11669         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11670         f = f + f;
11671         along = 0;
11672         along = (unsigned long)f;
11673         if (along != 0x80000000)
11674                 result |= 2;
11675         f -= 1.;
11676         along = 0;
11677         along = (unsigned long)f;
11678         if (along != 0x7fffffff)
11679                 result |= 1;
11680         f += 2.;
11681         along = 0;
11682         along = (unsigned long)f;
11683         if (along != 0x80000001)
11684                 result |= 2;
11685         if (result)
11686                 exit(result);
11687         signal(SIGFPE, blech_in_list);
11688         sprintf(str, "123.");
11689         sscanf(str, "%lf", &f);  /* f = 123.; */
11690         along = dummy_long((unsigned long)f);
11691         aint = dummy_int((unsigned int)f);
11692         ashort = dummy_short((unsigned short)f);
11693         if (along != (unsigned long)123)
11694                 result |= 4;
11695         if (aint != (unsigned int)123)
11696                 result |= 4;
11697         if (ashort != (unsigned short)123)
11698                 result |= 4;
11699         exit(result);
11700
11701 }
11702 EOCP
11703 set try
11704 if eval $compile_ok; then
11705         $run ./try
11706         castflags=$?
11707 else
11708         echo "(I can't seem to compile the test program--assuming it can't)"
11709         castflags=7
11710 fi
11711 case "$castflags" in
11712 0)      val="$define"
11713         echo "Yup, it can."
11714         ;;
11715 *)      val="$undef"
11716         echo "Nope, it can't."
11717         ;;
11718 esac
11719 set d_castneg
11720 eval $setvar
11721 $rm_try
11722
11723 : see if cbrt exists
11724 set cbrt d_cbrt
11725 eval $inlibc
11726
11727 : see if vprintf exists
11728 echo " "
11729 if set vprintf val -f d_vprintf; eval $csym; $val; then
11730         echo 'vprintf() found.' >&4
11731         val="$define"
11732         $cat >try.c <<EOF
11733 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11734 #$i_varargs I_VARARGS
11735
11736 #$i_stdlib I_STDLIB
11737 #$i_unistd I_UNISTD
11738
11739 #ifdef I_STDARG
11740 #  include <stdarg.h>
11741 #else /* I_VARARGS */
11742 #  include <varargs.h>
11743 #endif
11744
11745 #ifdef I_UNISTD
11746 #  include <unistd.h>
11747 #endif
11748
11749 #ifdef I_STDLIB
11750 #  include <stdlib.h>
11751 #endif
11752
11753 #include <stdio.h> /* vsprintf prototype */
11754
11755 #ifdef I_STDARG
11756 void xxx(int n, ...)
11757 {
11758     va_list args;
11759     char buf[10];
11760     va_start(args, n);
11761     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11762 }
11763 int main() { xxx(1, "foo"); }
11764
11765 #else /* I_VARARGS */
11766
11767 xxx(va_alist)
11768 va_dcl
11769 {
11770     va_list args;
11771     char buf[10];
11772     va_start(args);
11773     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11774 }
11775 int main() { xxx("foo"); }
11776
11777 #endif
11778
11779 EOF
11780         set try
11781         if eval $compile_ok; then
11782                 if $run ./try; then
11783                         echo "Your vsprintf() returns (int)." >&4
11784                         val2="$undef"
11785                 else
11786                         echo "Your vsprintf() returns (char*)." >&4
11787                         val2="$define"
11788                 fi
11789         else
11790                 echo 'I am unable to compile the vsprintf() test program.' >&4
11791                 # We shouldn't get here.  If we do, assume the standard signature,
11792                 # not the old BSD one.
11793                 echo 'Guessing that vsprintf() returns (int).' >&4
11794                 val2="$undef"
11795         fi
11796 else
11797         echo 'vprintf() NOT found.' >&4
11798         val="$undef"
11799         val2="$undef"
11800 fi
11801 $rm_try
11802 set d_vprintf
11803 eval $setvar
11804 val=$val2
11805 set d_charvspr
11806 eval $setvar
11807
11808 : see if chown exists
11809 set chown d_chown
11810 eval $inlibc
11811
11812 : see if chroot exists
11813 set chroot d_chroot
11814 eval $inlibc
11815
11816 : see if chsize exists
11817 set chsize d_chsize
11818 eval $inlibc
11819
11820 : see if class exists
11821 set class d_class
11822 eval $inlibc
11823
11824 : see if clearenv exists
11825 set clearenv d_clearenv
11826 eval $inlibc
11827
11828 : Define hasstruct macro for Configure internal use
11829 hasstruct='varname=$1; struct=$2; shift; shift;
11830 while $test $# -ge 2; do
11831         case "$1" in
11832         $define) echo "#include <$2>";;
11833         esac ;
11834     shift 2;
11835 done > try.c;
11836 echo "int main () { struct $struct foo; }" >> try.c;
11837 set try;
11838 if eval $compile; then
11839         val="$define";
11840 else
11841         val="$undef";
11842 fi;
11843 set $varname;
11844 eval $setvar;
11845 $rm_try'
11846
11847 : see whether socket exists
11848 socketlib=''
11849 sockethdr=''
11850 echo " "
11851 $echo $n "Hmm... $c" >&4
11852 if set socket val -f d_socket; eval $csym; $val; then
11853     echo "Looks like you have Berkeley networking support." >&4
11854     d_socket="$define"
11855     if set setsockopt val -f; eval $csym; $val; then
11856         d_oldsock="$undef"
11857     else
11858         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11859         d_oldsock="$define"
11860     fi
11861 else
11862     if $contains socklib libc.list >/dev/null 2>&1; then
11863         echo "Looks like you have Berkeley networking support." >&4
11864         d_socket="$define"
11865         : we will have to assume that it supports the 4.2 BSD interface
11866         d_oldsock="$undef"
11867     else
11868         echo "You don't have Berkeley networking in libc$_a..." >&4
11869         if test "X$d_socket" = "X$define"; then
11870             echo "...but you seem to believe that you have sockets." >&4
11871         else
11872             for net in net socket
11873             do
11874                 if test -f $sysroot/usr/lib/lib$net$_a; then
11875                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11876                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11877                     if $contains socket libc.list >/dev/null 2>&1; then
11878                         d_socket="$define"
11879                         socketlib="-l$net"
11880                         case "$net" in
11881                         net)
11882                             echo "...but the Wollongong group seems to have hacked it in." >&4
11883                             sockethdr="-I$sysroot/usr/netinclude"
11884                             ;;
11885                         esac
11886                         echo "Found Berkeley sockets interface in lib$net." >&4
11887                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11888                             d_oldsock="$undef"
11889                         else
11890                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11891                             d_oldsock="$define"
11892                         fi
11893                         break
11894                     fi
11895                 fi
11896             done
11897             if test "X$d_socket" != "X$define"; then
11898                echo "or anywhere else I see." >&4
11899                d_socket="$undef"
11900                d_oldsock="$undef"
11901             fi
11902         fi
11903     fi
11904 fi
11905
11906 : see if socketpair exists
11907 set socketpair d_sockpair
11908 eval $inlibc
11909
11910
11911 echo " "
11912 echo "Checking the availability sa_len in the sock struct ..." >&4
11913 $cat >try.c <<EOF
11914 #include <sys/types.h>
11915 #include <sys/socket.h>
11916 int main() {
11917 struct sockaddr sa;
11918 return (sa.sa_len);
11919 }
11920 EOF
11921 val="$undef"
11922 set try; if eval $compile; then
11923     val="$define"
11924 fi
11925 set d_sockaddr_sa_len; eval $setvar
11926 $rm_try
11927
11928 echo " "
11929 echo "Checking the availability struct sockaddr_in6 ..." >&4
11930 $cat >try.c <<EOF
11931 #include <sys/types.h>
11932 #include <sys/socket.h>
11933 #include <netinet/in.h>
11934 int main() {
11935 struct sockaddr_in6 sin6;
11936 return (sin6.sin6_family);
11937 }
11938 EOF
11939 val="$undef"
11940 set try; if eval $compile; then
11941     val="$define"
11942 fi
11943 set d_sockaddr_in6; eval $setvar
11944 $rm_try
11945
11946 echo " "
11947 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11948 $cat >try.c <<EOF
11949 #include <sys/types.h>
11950 #include <sys/socket.h>
11951 #include <netinet/in.h>
11952 int main() {
11953 struct sockaddr_in6 sin6;
11954 return (sin6.sin6_scope_id);
11955 }
11956 EOF
11957 val="$undef"
11958 set try; if eval $compile; then
11959     val="$define"
11960 fi
11961 set d_sin6_scope_id; eval $setvar
11962 $rm_try
11963
11964 echo " "
11965 echo "Checking the availability struct ip_mreq ..." >&4
11966 $cat >try.c <<EOF
11967 #include <sys/types.h>
11968 #include <sys/socket.h>
11969 #include <netinet/in.h>
11970 int main() {
11971 struct ip_mreq mreq;
11972 return (mreq.imr_multiaddr.s_addr);
11973 }
11974 EOF
11975 val="$undef"
11976 set try; if eval $compile; then
11977        val="$define"
11978 fi
11979 set d_ip_mreq; eval $setvar
11980 $rm_try
11981
11982 echo " "
11983 echo "Checking the availability struct ip_mreq_source ..." >&4
11984 $cat >try.c <<EOF
11985 #include <sys/types.h>
11986 #include <sys/socket.h>
11987 #include <netinet/in.h>
11988 int main() {
11989 struct ip_mreq_source mreq;
11990 return (mreq.imr_multiaddr.s_addr);
11991 }
11992 EOF
11993 val="$undef"
11994 set try; if eval $compile; then
11995        val="$define"
11996 fi
11997 set d_ip_mreq_source; eval $setvar
11998 $rm_try
11999
12000 echo " "
12001 echo "Checking the availability struct ipv6_mreq ..." >&4
12002 $cat >try.c <<EOF
12003 #include <sys/types.h>
12004 #include <sys/socket.h>
12005 #include <netinet/in.h>
12006 int main() {
12007 struct ipv6_mreq mreq;
12008 return (mreq.ipv6mr_interface);
12009 }
12010 EOF
12011 val="$undef"
12012 set try; if eval $compile; then
12013     val="$define"
12014 fi
12015 set d_ipv6_mreq; eval $setvar
12016 $rm_try
12017
12018 echo " "
12019 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12020 $cat >try.c <<EOF
12021 #include <sys/types.h>
12022 #include <sys/socket.h>
12023 #include <netinet/in.h>
12024 int main() {
12025 struct ipv6_mreq_source mreq;
12026 return (mreq.imr_multiaddr.s_addr);
12027 }
12028 EOF
12029 val="$undef"
12030 set try; if eval $compile; then
12031        val="$define"
12032 fi
12033 set d_ipv6_mreq_source; eval $setvar
12034 $rm_try
12035
12036 echo " "
12037 echo "Checking the availability of certain socket constants..." >&4
12038 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12039     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12040     $cat >try.c <<EOF
12041 #include <sys/types.h>
12042 #include <sys/socket.h>
12043 int main() {
12044     int i = $ENUM;
12045 }
12046 EOF
12047     val="$undef"
12048     set try; if eval $compile; then
12049         val="$define"
12050     fi
12051     set d_${enum}; eval $setvar
12052     $rm_try
12053 done
12054
12055 : see if this is a sys/uio.h system
12056 set sys/uio.h i_sysuio
12057 eval $inhdr
12058
12059 : Check for cmsghdr support
12060 echo " "
12061 echo "Checking to see if your system supports struct cmsghdr..." >&4
12062 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12063 eval $hasstruct
12064 case "$d_cmsghdr_s" in
12065 "$define")      echo "Yes, it does."   ;;
12066 *)              echo "No, it doesn't." ;;
12067 esac
12068
12069
12070 : check for const keyword
12071 echo " "
12072 echo 'Checking to see if your C compiler knows about "const"...' >&4
12073 $cat >const.c <<'EOCP'
12074 typedef struct spug { int drokk; } spug;
12075 int main()
12076 {
12077         const char *foo;
12078         const spug y = { 0 };
12079 }
12080 EOCP
12081 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12082         val="$define"
12083         echo "Yup, it does."
12084 else
12085         val="$undef"
12086         echo "Nope, it doesn't."
12087 fi
12088 set d_const
12089 eval $setvar
12090
12091 : see if copysign exists
12092 set copysign d_copysign
12093 eval $inlibc
12094
12095 : see if copysignl exists
12096 set copysignl d_copysignl
12097 eval $inlibc
12098
12099 : see if crypt exists
12100 echo " "
12101 set crypt d_crypt
12102 eval $inlibc
12103 case "$d_crypt" in
12104 $define) cryptlib='' ;;
12105 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12106                 echo 'crypt() found.' >&4
12107                 val="$define"
12108                 cryptlib=''
12109         else
12110                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12111                 if $test -z "$cryptlib"; then
12112                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12113                 else
12114                         cryptlib=-lcrypt
12115                 fi
12116                 if $test -z "$cryptlib"; then
12117                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12118                 else
12119                         cryptlib=-lcrypt
12120                 fi
12121                 if $test -z "$cryptlib"; then
12122                         cryptlib=`./loc libcrypt$_a "" $libpth`
12123                 else
12124                         cryptlib=-lcrypt
12125                 fi
12126                 if $test -z "$cryptlib"; then
12127                         echo 'crypt() NOT found.' >&4
12128                         val="$undef"
12129                 else
12130                         val="$define"
12131                 fi
12132         fi
12133         set d_crypt
12134         eval $setvar
12135         ;;
12136 esac
12137
12138 : see if this is a crypt.h system
12139 set crypt.h i_crypt
12140 eval $inhdr
12141
12142 : see if crypt_r exists
12143 set crypt_r d_crypt_r
12144 eval $inlibc
12145 case "$d_crypt_r" in
12146 "$define")
12147         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12148         case "$d_crypt_r_proto:$usethreads" in
12149         ":define")      d_crypt_r_proto=define
12150                 set d_crypt_r_proto crypt_r $hdrs
12151                 eval $hasproto ;;
12152         *)      ;;
12153         esac
12154         case "$d_crypt_r_proto" in
12155         define)
12156         case "$crypt_r_proto" in
12157         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12158         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12159         esac
12160         case "$crypt_r_proto" in
12161         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12162         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12163         esac
12164         case "$crypt_r_proto" in
12165         ''|0)   d_crypt_r=undef
12166                 crypt_r_proto=0
12167                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12168         * )     case "$crypt_r_proto" in
12169                 REENTRANT_PROTO*) ;;
12170                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12171                 esac
12172                 echo "Prototype: $try" ;;
12173         esac
12174         ;;
12175         *)      case "$usethreads" in
12176                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12177                 esac
12178                 d_crypt_r=undef
12179                 crypt_r_proto=0
12180                 ;;
12181         esac
12182         ;;
12183 *)      crypt_r_proto=0
12184         ;;
12185 esac
12186
12187 : get csh whereabouts
12188 case "$csh" in
12189 'csh') val="$undef" ;;
12190 *) val="$define" ;;
12191 esac
12192 set d_csh
12193 eval $setvar
12194 : Respect a hint or command line value for full_csh.
12195 case "$full_csh" in
12196 '') full_csh=$csh ;;
12197 esac
12198
12199 : see if ctermid exists
12200 set ctermid d_ctermid
12201 eval $inlibc
12202
12203 : see if ctermid_r exists
12204 set ctermid_r d_ctermid_r
12205 eval $inlibc
12206 case "$d_ctermid_r" in
12207 "$define")
12208         hdrs="$i_systypes sys/types.h define stdio.h "
12209         case "$d_ctermid_r_proto:$usethreads" in
12210         ":define")      d_ctermid_r_proto=define
12211                 set d_ctermid_r_proto ctermid_r $hdrs
12212                 eval $hasproto ;;
12213         *)      ;;
12214         esac
12215         case "$d_ctermid_r_proto" in
12216         define)
12217         case "$ctermid_r_proto" in
12218         ''|0) try='char* ctermid_r(char*);'
12219         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12220         esac
12221         case "$ctermid_r_proto" in
12222         ''|0)   d_ctermid_r=undef
12223                 ctermid_r_proto=0
12224                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12225         * )     case "$ctermid_r_proto" in
12226                 REENTRANT_PROTO*) ;;
12227                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12228                 esac
12229                 echo "Prototype: $try" ;;
12230         esac
12231         ;;
12232         *)      case "$usethreads" in
12233                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12234                 esac
12235                 d_ctermid_r=undef
12236                 ctermid_r_proto=0
12237                 ;;
12238         esac
12239         ;;
12240 *)      ctermid_r_proto=0
12241         ;;
12242 esac
12243
12244 : see if ctime_r exists
12245 set ctime_r d_ctime_r
12246 eval $inlibc
12247 case "$d_ctime_r" in
12248 "$define")
12249         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12250         case "$d_ctime_r_proto:$usethreads" in
12251         ":define")      d_ctime_r_proto=define
12252                 set d_ctime_r_proto ctime_r $hdrs
12253                 eval $hasproto ;;
12254         *)      ;;
12255         esac
12256         case "$d_ctime_r_proto" in
12257         define)
12258         case "$ctime_r_proto" in
12259         ''|0) try='char* ctime_r(const time_t*, char*);'
12260         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12261         esac
12262         case "$ctime_r_proto" in
12263         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12264         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12265         esac
12266         case "$ctime_r_proto" in
12267         ''|0) try='int ctime_r(const time_t*, char*);'
12268         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12269         esac
12270         case "$ctime_r_proto" in
12271         ''|0) try='int ctime_r(const time_t*, char*, int);'
12272         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12273         esac
12274         case "$ctime_r_proto" in
12275         ''|0)   d_ctime_r=undef
12276                 ctime_r_proto=0
12277                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12278         * )     case "$ctime_r_proto" in
12279                 REENTRANT_PROTO*) ;;
12280                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12281                 esac
12282                 echo "Prototype: $try" ;;
12283         esac
12284         ;;
12285         *)      case "$usethreads" in
12286                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12287                 esac
12288                 d_ctime_r=undef
12289                 ctime_r_proto=0
12290                 ;;
12291         esac
12292         ;;
12293 *)      ctime_r_proto=0
12294         ;;
12295 esac
12296
12297 : see if cuserid exists
12298 set cuserid d_cuserid
12299 eval $inlibc
12300
12301 : see if this is a limits.h system
12302 set limits.h i_limits
12303 eval $inhdr
12304
12305 : See if number of significant digits in a double precision number is known
12306 echo " "
12307 $cat >dbl_dig.c <<EOM
12308 #$i_limits I_LIMITS
12309 #$i_float I_FLOAT
12310 #ifdef I_LIMITS
12311 #include <limits.h>
12312 #endif
12313 #ifdef I_FLOAT
12314 #include <float.h>
12315 #endif
12316 #ifdef DBL_DIG
12317 printf("Contains DBL_DIG");
12318 #endif
12319 EOM
12320 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12321 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12322         echo "DBL_DIG found." >&4
12323         val="$define"
12324 else
12325         echo "DBL_DIG NOT found." >&4
12326         val="$undef"
12327 fi
12328 $rm -f dbl_dig.?
12329 set d_dbl_dig
12330 eval $setvar
12331
12332 : see if dbm.h is available
12333 : see if dbmclose exists
12334 set dbmclose d_dbmclose
12335 eval $inlibc
12336
12337 case "$d_dbmclose" in
12338 $define)
12339         set dbm.h i_dbm
12340         eval $inhdr
12341         case "$i_dbm" in
12342         $define)
12343                 val="$undef"
12344                 set i_rpcsvcdbm
12345                 eval $setvar
12346                 ;;
12347         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12348                 eval $inhdr
12349                 ;;
12350         esac
12351         ;;
12352 *)      echo "We won't be including <dbm.h>"
12353         val="$undef"
12354         set i_dbm
12355         eval $setvar
12356         val="$undef"
12357         set i_rpcsvcdbm
12358         eval $setvar
12359         ;;
12360 esac
12361
12362 : see if prototype for dbminit is available
12363 echo " "
12364 set d_dbminitproto dbminit $i_dbm dbm.h
12365 eval $hasproto
12366
12367 : see if difftime exists
12368 set difftime d_difftime
12369 eval $inlibc
12370
12371 : see if this is a dirent system
12372 echo " "
12373 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12374         val="$define"
12375         echo "<dirent.h> found." >&4
12376 else
12377         val="$undef"
12378         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12379                 echo "<sys/dir.h> found." >&4
12380                 echo " "
12381         else
12382                 xinc=`./findhdr sys/ndir.h`
12383         fi
12384         echo "<dirent.h> NOT found." >&4
12385 fi
12386 set i_dirent
12387 eval $setvar
12388
12389 : Look for type of directory structure.
12390 echo " "
12391 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12392
12393 case "$direntrytype" in
12394 ''|' ')
12395         case "$i_dirent" in
12396         $define) guess1='struct dirent' ;;
12397         *) guess1='struct direct'  ;;
12398         esac
12399         ;;
12400 *)      guess1="$direntrytype"
12401         ;;
12402 esac
12403
12404 case "$guess1" in
12405 'struct dirent') guess2='struct direct' ;;
12406 *) guess2='struct dirent' ;;
12407 esac
12408
12409 if $contains "$guess1" try.c >/dev/null 2>&1; then
12410         direntrytype="$guess1"
12411         echo "Your directory entries are $direntrytype." >&4
12412 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12413         direntrytype="$guess2"
12414         echo "Your directory entries seem to be $direntrytype." >&4
12415 else
12416         echo "I don't recognize your system's directory entries." >&4
12417         rp="What type is used for directory entries on this system?"
12418         dflt="$guess1"
12419         . ./myread
12420         direntrytype="$ans"
12421 fi
12422 $rm_try
12423
12424 : see if the directory entry stores field length
12425 echo " "
12426 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12427 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12428         echo "Good, your directory entry keeps length information in d_namlen." >&4
12429         val="$define"
12430 else
12431         echo "Your directory entry does not know about the d_namlen field." >&4
12432         val="$undef"
12433 fi
12434 set d_dirnamlen
12435 eval $setvar
12436 $rm_try
12437
12438 : Look for DIR.dd_fd
12439 case "$i_dirent" in
12440 "$define")
12441     echo "Checking to see if DIR has a dd_fd member variable" >&4
12442     $cat >try.c <<EOCP
12443 #$i_stdlib I_STDLIB
12444 #ifdef I_STDLIB
12445 #include <stdlib.h>
12446 #endif
12447 #include <dirent.h>
12448
12449 int main() {
12450     DIR dir;
12451     dir.dd_fd = 1;
12452     return 0;
12453 }
12454 EOCP
12455     val=$undef
12456     set try
12457     if eval $compile; then
12458         echo "Yes, it does."
12459         val="$define"
12460     else
12461         echo "No, it does not."
12462         val="$undef"
12463     fi
12464     ;;
12465 *)
12466     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12467     val="$undef"
12468     ;;
12469 esac
12470 set d_dir_dd_fd
12471 eval $setvar
12472 $rm_try
12473
12474 : see if this is an sysdir system
12475 set sys/dir.h i_sysdir
12476 eval $inhdr
12477
12478 : see if this is an sysndir system
12479 set sys/ndir.h i_sysndir
12480 eval $inhdr
12481
12482 : Look for dirfd
12483 echo " "
12484 $cat >dirfd.c <<EOM
12485 #include <stdio.h>
12486 #$i_stdlib I_STDLIB
12487 #ifdef I_STDLIB
12488 #include <stdlib.h>
12489 #endif
12490 #$i_dirent I_DIRENT             /**/
12491 #$i_sysdir I_SYS_DIR            /**/
12492 #$i_sysndir I_SYS_NDIR          /**/
12493 #$i_systypes I_SYS_TYPES        /**/
12494 #if defined(I_SYS_TYPES)
12495 #include <sys/types.h>
12496 #endif
12497 #if defined(I_DIRENT)
12498 #include <dirent.h>
12499 #else
12500 #ifdef I_SYS_NDIR
12501 #include <sys/ndir.h>
12502 #else
12503 #ifdef I_SYS_DIR
12504 #ifdef hp9000s500
12505 #include <ndir.h>       /* may be wrong in the future */
12506 #else
12507 #include <sys/dir.h>
12508 #endif
12509 #endif
12510 #endif
12511 #endif
12512 int main() {
12513         DIR *dirp = opendir(".");
12514         if (dirfd(dirp) >= 0)
12515                 exit(0);
12516         else
12517                 exit(1);
12518 }
12519 EOM
12520 val=$undef
12521 set dirfd
12522 if eval $compile; then
12523         val="$define"
12524 fi
12525 case "$val" in
12526 $define)        echo "dirfd() found." >&4       ;;
12527 *)              echo "dirfd() NOT found." >&4   ;;
12528 esac
12529 set d_dirfd
12530 eval $setvar
12531 $rm -f dirfd*
12532
12533 : see if dladdr exists
12534 set dladdr d_dladdr
12535 eval $inlibc
12536
12537 : see if dlerror exists
12538 xxx_runnm="$runnm"
12539 runnm=false
12540 set dlerror d_dlerror
12541 eval $inlibc
12542 runnm="$xxx_runnm"
12543
12544 : see if dlfcn is available
12545 set dlfcn.h i_dlfcn
12546 eval $inhdr
12547
12548 : Check what extension to use for shared libs
12549 case "$usedl" in
12550 $define|y|true)
12551         $cat << EOM
12552
12553 On a few systems, the dynamically loaded modules that perl generates and uses
12554 will need a different extension than shared libs. The default will probably
12555 be appropriate.
12556
12557 EOM
12558         case "$dlext" in
12559         '')     dflt="$so" ;;
12560         *)      dflt="$dlext" ;;
12561         esac
12562         rp='What is the extension of dynamically loaded modules'
12563         . ./myread
12564         dlext="$ans"
12565         ;;
12566 *)
12567         dlext="none"
12568         ;;
12569 esac
12570
12571 : Check if dlsym need a leading underscore
12572 echo " "
12573 val="$undef"
12574
12575 case "$dlsrc" in
12576 dl_dlopen.xs)
12577         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12578         $cat >dyna.c <<'EOM'
12579 fred () { }
12580 EOM
12581
12582 $cat >fred.c<<EOM
12583
12584 #include <stdio.h>
12585 #$i_stdlib I_STDLIB
12586 #ifdef I_STDLIB
12587 #include <stdlib.h>
12588 #endif
12589 #$i_dlfcn I_DLFCN
12590 #ifdef I_DLFCN
12591 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12592 #else
12593 #include <sys/types.h>
12594 #include <nlist.h>
12595 #include <link.h>
12596 #endif
12597
12598 extern int fred() ;
12599
12600 int main()
12601 {
12602     void * handle ;
12603     void * symbol ;
12604 #ifndef RTLD_LAZY
12605     int mode = 1 ;
12606 #else
12607     int mode = RTLD_LAZY ;
12608 #endif
12609     handle = dlopen("./dyna.$dlext", mode) ;
12610     if (handle == NULL) {
12611         printf ("1\n") ;
12612         fflush (stdout) ;
12613         exit(0);
12614     }
12615     symbol = dlsym(handle, "fred") ;
12616     if (symbol == NULL) {
12617         /* try putting a leading underscore */
12618         symbol = dlsym(handle, "_fred") ;
12619         if (symbol == NULL) {
12620             printf ("2\n") ;
12621             fflush (stdout) ;
12622             exit(0);
12623         }
12624         printf ("3\n") ;
12625     }
12626     else
12627         printf ("4\n") ;
12628     fflush (stdout) ;
12629     exit(0);
12630 }
12631 EOM
12632         : Call the object file tmp-dyna.o in case dlext=o.
12633         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12634                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12635                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12636                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12637                 xxx=`$run ./fred`
12638                 case $xxx in
12639                 1)      echo "Test program failed using dlopen." >&4
12640                         echo "Perhaps you should not use dynamic loading." >&4;;
12641                 2)      echo "Test program failed using dlsym." >&4
12642                         echo "Perhaps you should not use dynamic loading." >&4;;
12643                 3)      echo "dlsym needs a leading underscore" >&4
12644                         val="$define" ;;
12645                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12646                 esac
12647         else
12648                 echo "I can't compile and run the test program." >&4
12649                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12650         fi
12651         ;;
12652 esac
12653
12654 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12655
12656 set d_dlsymun
12657 eval $setvar
12658
12659 : see if drand48_r exists
12660 set drand48_r d_drand48_r
12661 eval $inlibc
12662 case "$d_drand48_r" in
12663 "$define")
12664         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12665         case "$d_drand48_r_proto:$usethreads" in
12666         ":define")      d_drand48_r_proto=define
12667                 set d_drand48_r_proto drand48_r $hdrs
12668                 eval $hasproto ;;
12669         *)      ;;
12670         esac
12671         case "$d_drand48_r_proto" in
12672         define)
12673         case "$drand48_r_proto" in
12674         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12675         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12676         esac
12677         case "$drand48_r_proto" in
12678         ''|0)   d_drand48_r=undef
12679                 drand48_r_proto=0
12680                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12681         * )     case "$drand48_r_proto" in
12682                 REENTRANT_PROTO*) ;;
12683                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12684                 esac
12685                 echo "Prototype: $try" ;;
12686         esac
12687         ;;
12688         *)      case "$usethreads" in
12689                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12690                 esac
12691                 d_drand48_r=undef
12692                 drand48_r_proto=0
12693                 ;;
12694         esac
12695         ;;
12696 *)      drand48_r_proto=0
12697         ;;
12698 esac
12699
12700 : see if prototype for drand48 is available
12701 echo " "
12702 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12703 eval $hasproto
12704
12705 : see if dup2 exists
12706 set dup2 d_dup2
12707 eval $inlibc
12708
12709 : see if eaccess exists
12710 set eaccess d_eaccess
12711 eval $inlibc
12712
12713 : see if endgrent exists
12714 set endgrent d_endgrent
12715 eval $inlibc
12716
12717 : see if this is an grp system
12718 set grp.h i_grp
12719 eval $inhdr
12720
12721 case "$i_grp" in
12722 $define)
12723         xxx=`./findhdr grp.h`
12724         $cppstdin $cppflags $cppminus < $xxx >$$.h
12725
12726         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12727                 val="$define"
12728         else
12729                 val="$undef"
12730         fi
12731         set d_grpasswd
12732         eval $setvar
12733
12734         $rm -f $$.h
12735         ;;
12736 *)
12737         val="$undef";
12738         set d_grpasswd; eval $setvar
12739         ;;
12740 esac
12741
12742 : see if endgrent_r exists
12743 set endgrent_r d_endgrent_r
12744 eval $inlibc
12745 case "$d_endgrent_r" in
12746 "$define")
12747         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12748         case "$d_endgrent_r_proto:$usethreads" in
12749         ":define")      d_endgrent_r_proto=define
12750                 set d_endgrent_r_proto endgrent_r $hdrs
12751                 eval $hasproto ;;
12752         *)      ;;
12753         esac
12754         case "$d_endgrent_r_proto" in
12755         define)
12756         case "$endgrent_r_proto" in
12757         ''|0) try='int endgrent_r(FILE**);'
12758         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12759         esac
12760         case "$endgrent_r_proto" in
12761         ''|0) try='void endgrent_r(FILE**);'
12762         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12763         esac
12764         case "$endgrent_r_proto" in
12765         ''|0)   d_endgrent_r=undef
12766                 endgrent_r_proto=0
12767                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12768         * )     case "$endgrent_r_proto" in
12769                 REENTRANT_PROTO*) ;;
12770                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12771                 esac
12772                 echo "Prototype: $try" ;;
12773         esac
12774         ;;
12775         *)      case "$usethreads" in
12776                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12777                 esac
12778                 d_endgrent_r=undef
12779                 endgrent_r_proto=0
12780                 ;;
12781         esac
12782         ;;
12783 *)      endgrent_r_proto=0
12784         ;;
12785 esac
12786
12787 : see if endhostent exists
12788 set endhostent d_endhent
12789 eval $inlibc
12790
12791 : see if this is a netdb.h system
12792 set netdb.h i_netdb
12793 eval $inhdr
12794
12795 : see if endhostent_r exists
12796 set endhostent_r d_endhostent_r
12797 eval $inlibc
12798 case "$d_endhostent_r" in
12799 "$define")
12800         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12801         case "$d_endhostent_r_proto:$usethreads" in
12802         ":define")      d_endhostent_r_proto=define
12803                 set d_endhostent_r_proto endhostent_r $hdrs
12804                 eval $hasproto ;;
12805         *)      ;;
12806         esac
12807         case "$d_endhostent_r_proto" in
12808         define)
12809         case "$endhostent_r_proto" in
12810         ''|0) try='int endhostent_r(struct hostent_data*);'
12811         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12812         esac
12813         case "$endhostent_r_proto" in
12814         ''|0) try='void endhostent_r(struct hostent_data*);'
12815         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12816         esac
12817         case "$endhostent_r_proto" in
12818         ''|0)   d_endhostent_r=undef
12819                 endhostent_r_proto=0
12820                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12821         * )     case "$endhostent_r_proto" in
12822                 REENTRANT_PROTO*) ;;
12823                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12824                 esac
12825                 echo "Prototype: $try" ;;
12826         esac
12827         ;;
12828         *)      case "$usethreads" in
12829                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12830                 esac
12831                 d_endhostent_r=undef
12832                 endhostent_r_proto=0
12833                 ;;
12834         esac
12835         ;;
12836 *)      endhostent_r_proto=0
12837         ;;
12838 esac
12839
12840 : see if endnetent exists
12841 set endnetent d_endnent
12842 eval $inlibc
12843
12844 : see if endnetent_r exists
12845 set endnetent_r d_endnetent_r
12846 eval $inlibc
12847 case "$d_endnetent_r" in
12848 "$define")
12849         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12850         case "$d_endnetent_r_proto:$usethreads" in
12851         ":define")      d_endnetent_r_proto=define
12852                 set d_endnetent_r_proto endnetent_r $hdrs
12853                 eval $hasproto ;;
12854         *)      ;;
12855         esac
12856         case "$d_endnetent_r_proto" in
12857         define)
12858         case "$endnetent_r_proto" in
12859         ''|0) try='int endnetent_r(struct netent_data*);'
12860         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12861         esac
12862         case "$endnetent_r_proto" in
12863         ''|0) try='void endnetent_r(struct netent_data*);'
12864         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12865         esac
12866         case "$endnetent_r_proto" in
12867         ''|0)   d_endnetent_r=undef
12868                 endnetent_r_proto=0
12869                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12870         * )     case "$endnetent_r_proto" in
12871                 REENTRANT_PROTO*) ;;
12872                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12873                 esac
12874                 echo "Prototype: $try" ;;
12875         esac
12876         ;;
12877         *)      case "$usethreads" in
12878                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12879                 esac
12880                 d_endnetent_r=undef
12881                 endnetent_r_proto=0
12882                 ;;
12883         esac
12884         ;;
12885 *)      endnetent_r_proto=0
12886         ;;
12887 esac
12888
12889 : see if endprotoent exists
12890 set endprotoent d_endpent
12891 eval $inlibc
12892
12893 : see if endprotoent_r exists
12894 set endprotoent_r d_endprotoent_r
12895 eval $inlibc
12896 case "$d_endprotoent_r" in
12897 "$define")
12898         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12899         case "$d_endprotoent_r_proto:$usethreads" in
12900         ":define")      d_endprotoent_r_proto=define
12901                 set d_endprotoent_r_proto endprotoent_r $hdrs
12902                 eval $hasproto ;;
12903         *)      ;;
12904         esac
12905         case "$d_endprotoent_r_proto" in
12906         define)
12907         case "$endprotoent_r_proto" in
12908         ''|0) try='int endprotoent_r(struct protoent_data*);'
12909         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12910         esac
12911         case "$endprotoent_r_proto" in
12912         ''|0) try='void endprotoent_r(struct protoent_data*);'
12913         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12914         esac
12915         case "$endprotoent_r_proto" in
12916         ''|0)   d_endprotoent_r=undef
12917                 endprotoent_r_proto=0
12918                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12919         * )     case "$endprotoent_r_proto" in
12920                 REENTRANT_PROTO*) ;;
12921                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12922                 esac
12923                 echo "Prototype: $try" ;;
12924         esac
12925         ;;
12926         *)      case "$usethreads" in
12927                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12928                 esac
12929                 d_endprotoent_r=undef
12930                 endprotoent_r_proto=0
12931                 ;;
12932         esac
12933         ;;
12934 *)      endprotoent_r_proto=0
12935         ;;
12936 esac
12937
12938 : see if endpwent exists
12939 set endpwent d_endpwent
12940 eval $inlibc
12941
12942 : see if this is a pwd.h system
12943 set pwd.h i_pwd
12944 eval $inhdr
12945
12946 case "$i_pwd" in
12947 $define)
12948         xxx=`./findhdr pwd.h`
12949         $cppstdin $cppflags $cppminus < $xxx >$$.h
12950
12951         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12952                 val="$define"
12953         else
12954                 val="$undef"
12955         fi
12956         set d_pwquota
12957         eval $setvar
12958
12959         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12960                 val="$define"
12961         else
12962                 val="$undef"
12963         fi
12964         set d_pwage
12965         eval $setvar
12966
12967         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12968                 val="$define"
12969         else
12970                 val="$undef"
12971         fi
12972         set d_pwchange
12973         eval $setvar
12974
12975         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12976                 val="$define"
12977         else
12978                 val="$undef"
12979         fi
12980         set d_pwclass
12981         eval $setvar
12982
12983         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12984                 val="$define"
12985         else
12986                 val="$undef"
12987         fi
12988         set d_pwexpire
12989         eval $setvar
12990
12991         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12992                 val="$define"
12993         else
12994                 val="$undef"
12995         fi
12996         set d_pwcomment
12997         eval $setvar
12998
12999         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
13000                 val="$define"
13001         else
13002                 val="$undef"
13003         fi
13004         set d_pwgecos
13005         eval $setvar
13006
13007         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
13008                 val="$define"
13009         else
13010                 val="$undef"
13011         fi
13012         set d_pwpasswd
13013         eval $setvar
13014
13015         $rm -f $$.h
13016         ;;
13017 *)
13018         val="$undef";
13019         set d_pwquota; eval $setvar
13020         set d_pwage; eval $setvar
13021         set d_pwchange; eval $setvar
13022         set d_pwclass; eval $setvar
13023         set d_pwexpire; eval $setvar
13024         set d_pwcomment; eval $setvar
13025         set d_pwgecos; eval $setvar
13026         set d_pwpasswd; eval $setvar
13027         ;;
13028 esac
13029
13030 : see if endpwent_r exists
13031 set endpwent_r d_endpwent_r
13032 eval $inlibc
13033 case "$d_endpwent_r" in
13034 "$define")
13035         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13036         case "$d_endpwent_r_proto:$usethreads" in
13037         ":define")      d_endpwent_r_proto=define
13038                 set d_endpwent_r_proto endpwent_r $hdrs
13039                 eval $hasproto ;;
13040         *)      ;;
13041         esac
13042         case "$d_endpwent_r_proto" in
13043         define)
13044         case "$endpwent_r_proto" in
13045         ''|0) try='int endpwent_r(FILE**);'
13046         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13047         esac
13048         case "$endpwent_r_proto" in
13049         ''|0) try='void endpwent_r(FILE**);'
13050         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13051         esac
13052         case "$endpwent_r_proto" in
13053         ''|0)   d_endpwent_r=undef
13054                 endpwent_r_proto=0
13055                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13056         * )     case "$endpwent_r_proto" in
13057                 REENTRANT_PROTO*) ;;
13058                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13059                 esac
13060                 echo "Prototype: $try" ;;
13061         esac
13062         ;;
13063         *)      case "$usethreads" in
13064                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13065                 esac
13066                 d_endpwent_r=undef
13067                 endpwent_r_proto=0
13068                 ;;
13069         esac
13070         ;;
13071 *)      endpwent_r_proto=0
13072         ;;
13073 esac
13074
13075 : see if endservent exists
13076 set endservent d_endsent
13077 eval $inlibc
13078
13079 : see if endservent_r exists
13080 set endservent_r d_endservent_r
13081 eval $inlibc
13082 case "$d_endservent_r" in
13083 "$define")
13084         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13085         case "$d_endservent_r_proto:$usethreads" in
13086         ":define")      d_endservent_r_proto=define
13087                 set d_endservent_r_proto endservent_r $hdrs
13088                 eval $hasproto ;;
13089         *)      ;;
13090         esac
13091         case "$d_endservent_r_proto" in
13092         define)
13093         case "$endservent_r_proto" in
13094         ''|0) try='int endservent_r(struct servent_data*);'
13095         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13096         esac
13097         case "$endservent_r_proto" in
13098         ''|0) try='void endservent_r(struct servent_data*);'
13099         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13100         esac
13101         case "$endservent_r_proto" in
13102         ''|0)   d_endservent_r=undef
13103                 endservent_r_proto=0
13104                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13105         * )     case "$endservent_r_proto" in
13106                 REENTRANT_PROTO*) ;;
13107                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13108                 esac
13109                 echo "Prototype: $try" ;;
13110         esac
13111         ;;
13112         *)      case "$usethreads" in
13113                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13114                 esac
13115                 d_endservent_r=undef
13116                 endservent_r_proto=0
13117                 ;;
13118         esac
13119         ;;
13120 *)      endservent_r_proto=0
13121         ;;
13122 esac
13123
13124 : Locate the flags for 'open()'
13125 echo " "
13126 $cat >try.c <<EOCP
13127 #include <sys/types.h>
13128 #ifdef I_FCNTL
13129 #include <fcntl.h>
13130 #endif
13131 #ifdef I_SYS_FILE
13132 #include <sys/file.h>
13133 #endif
13134 #$i_stdlib I_STDLIB
13135 #ifdef I_STDLIB
13136 #include <stdlib.h>
13137 #endif
13138 int main() {
13139         if(O_RDONLY);
13140 #ifdef O_TRUNC
13141         exit(0);
13142 #else
13143         exit(1);
13144 #endif
13145 }
13146 EOCP
13147 : check sys/file.h first to get FREAD on Sun
13148 if $test `./findhdr sys/file.h` && \
13149                 set try -DI_SYS_FILE && eval $compile; then
13150         h_sysfile=true;
13151         echo "<sys/file.h> defines the O_* constants..." >&4
13152         if $run ./try; then
13153                 echo "and you have the 3 argument form of open()." >&4
13154                 val="$define"
13155         else
13156                 echo "but not the 3 argument form of open().  Oh, well." >&4
13157                 val="$undef"
13158         fi
13159 elif $test `./findhdr fcntl.h` && \
13160                 set try -DI_FCNTL && eval $compile; then
13161         h_fcntl=true;
13162         echo "<fcntl.h> defines the O_* constants..." >&4
13163         if $run ./try; then
13164                 echo "and you have the 3 argument form of open()." >&4
13165                 val="$define"
13166         else
13167                 echo "but not the 3 argument form of open().  Oh, well." >&4
13168                 val="$undef"
13169         fi
13170 else
13171         val="$undef"
13172         echo "I can't find the O_* constant definitions!  You got problems." >&4
13173 fi
13174 set d_open3
13175 eval $setvar
13176 $rm_try
13177
13178 : see if this is a sys/file.h system
13179 val=''
13180 set sys/file.h val
13181 eval $inhdr
13182
13183 : do we need to include sys/file.h ?
13184 case "$val" in
13185 "$define")
13186         echo " "
13187         if $h_sysfile; then
13188                 val="$define"
13189                 echo "We'll be including <sys/file.h>." >&4
13190         else
13191                 val="$undef"
13192                 echo "We won't be including <sys/file.h>." >&4
13193         fi
13194         ;;
13195 *)
13196         h_sysfile=false
13197         ;;
13198 esac
13199 set i_sysfile
13200 eval $setvar
13201
13202 : see if fcntl.h is there
13203 val=''
13204 set fcntl.h val
13205 eval $inhdr
13206
13207 : see if we can include fcntl.h
13208 case "$val" in
13209 "$define")
13210         echo " "
13211         if $h_fcntl; then
13212                 val="$define"
13213                 echo "We'll be including <fcntl.h>." >&4
13214         else
13215                 val="$undef"
13216                 if $h_sysfile; then
13217         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13218                 else
13219                         echo "We won't be including <fcntl.h>." >&4
13220                 fi
13221         fi
13222         ;;
13223 *)
13224         h_fcntl=false
13225         val="$undef"
13226         ;;
13227 esac
13228 set i_fcntl
13229 eval $setvar
13230
13231 : see if fork exists
13232 set fork d_fork
13233 eval $inlibc
13234
13235 : see if pipe exists
13236 set pipe d_pipe
13237 eval $inlibc
13238
13239 : check for non-blocking I/O stuff
13240 case "$h_sysfile" in
13241 true) echo "#include <sys/file.h>" > head.c;;
13242 *)
13243        case "$h_fcntl" in
13244        true) echo "#include <fcntl.h>" > head.c;;
13245        *) echo "#include <sys/fcntl.h>" > head.c;;
13246        esac
13247        ;;
13248 esac
13249 echo " "
13250 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13251 case "$o_nonblock" in
13252 '')
13253         $cat head.c > try.c
13254         $cat >>try.c <<EOCP
13255 #include <stdio.h>
13256 #$i_stdlib I_STDLIB
13257 #ifdef I_STDLIB
13258 #include <stdlib.h>
13259 #endif
13260 #$i_fcntl I_FCNTL
13261 #ifdef I_FCNTL
13262 #include <fcntl.h>
13263 #endif
13264 int main() {
13265 #ifdef O_NONBLOCK
13266         printf("O_NONBLOCK\n");
13267         exit(0);
13268 #endif
13269 #ifdef O_NDELAY
13270         printf("O_NDELAY\n");
13271         exit(0);
13272 #endif
13273 #ifdef FNDELAY
13274         printf("FNDELAY\n");
13275         exit(0);
13276 #endif
13277         exit(0);
13278 }
13279 EOCP
13280         set try
13281         if eval $compile_ok; then
13282                 o_nonblock=`$run ./try`
13283                 case "$o_nonblock" in
13284                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13285                 *) echo "Seems like we can use $o_nonblock.";;
13286                 esac
13287         else
13288                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13289         fi
13290         ;;
13291 *) echo "Using $hint value $o_nonblock.";;
13292 esac
13293 $rm_try
13294
13295 echo " "
13296 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13297 case "$eagain" in
13298 '')
13299         case "$d_fork:$d_pipe" in
13300         define:define)
13301         $cat head.c > try.c
13302         $cat >>try.c <<EOCP
13303 #include <errno.h>
13304 #include <sys/types.h>
13305 #include <signal.h>
13306 #include <stdio.h>
13307 #$i_stdlib I_STDLIB
13308 #ifdef I_STDLIB
13309 #include <stdlib.h>
13310 #endif
13311 #$i_fcntl I_FCNTL
13312 #ifdef I_FCNTL
13313 #include <fcntl.h>
13314 #endif
13315 #define MY_O_NONBLOCK $o_nonblock
13316 #ifndef errno  /* XXX need better Configure test */
13317 extern int errno;
13318 #endif
13319 #$i_unistd I_UNISTD
13320 #ifdef I_UNISTD
13321 #include <unistd.h>
13322 #endif
13323 #$i_string I_STRING
13324 #ifdef I_STRING
13325 #include <string.h>
13326 #else
13327 #include <strings.h>
13328 #endif
13329 $signal_t blech(int x) { exit(3); }
13330 EOCP
13331         $cat >> try.c <<'EOCP'
13332 int main()
13333 {
13334         int pd[2];
13335         int pu[2];
13336         char buf[1];
13337         char string[100];
13338         int ret;
13339
13340         ret = pipe(pd); /* Down: child -> parent */
13341         if (ret != 0)
13342                 exit(3);
13343         ret = pipe(pu); /* Up: parent -> child */
13344         if (ret != 0)
13345                 exit(3);
13346         if (0 != fork()) {
13347                 close(pd[1]);   /* Parent reads from pd[0] */
13348                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13349 #ifdef F_SETFL
13350                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13351                         exit(1);
13352 #else
13353                 exit(4);
13354 #endif
13355                 signal(SIGALRM, blech);
13356                 alarm(5);
13357                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13358                         exit(2);
13359                 sprintf(string, "%d\n", ret);
13360                 ret = write(2, string, strlen(string));
13361                 if (ret != strlen(string))
13362                         exit(3);
13363                 alarm(0);
13364 #ifdef EAGAIN
13365                 if (errno == EAGAIN) {
13366                         printf("EAGAIN\n");
13367                         goto ok;
13368                 }
13369 #endif
13370 #ifdef EWOULDBLOCK
13371                 if (errno == EWOULDBLOCK)
13372                         printf("EWOULDBLOCK\n");
13373 #endif
13374         ok:
13375                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13376                 if (ret != 1)
13377                         exit(3);
13378                 sleep(2);                               /* Give it time to close our pipe */
13379                 alarm(5);
13380                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13381                 alarm(0);
13382                 sprintf(string, "%d\n", ret);
13383                 ret = write(4, string, strlen(string));
13384                 if (ret != strlen(string))
13385                         exit(3);
13386                 exit(0);
13387         }
13388
13389         close(pd[0]);                   /* We write to pd[1] */
13390         close(pu[1]);                   /* We read from pu[0] */
13391         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13392         if (ret != 1)
13393                 exit(3);
13394         close(pd[1]);                   /* Pipe pd is now fully closed! */
13395         exit(0);                                /* Bye bye, thank you for playing! */
13396 }
13397 EOCP
13398         set try
13399         if eval $compile_ok; then
13400                 echo "$startsh" >mtry
13401                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13402                 chmod +x mtry
13403                 $run ./mtry >/dev/null 2>&1
13404                 case $? in
13405                 0) eagain=`$cat try.out`;;
13406                 1) echo "Could not perform non-blocking setting!";;
13407                 2) echo "I did a successful read() for something that was not there!";;
13408                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13409                 4) echo "Could not find F_SETFL!";;
13410                 *) echo "Something terribly wrong happened during testing.";;
13411                 esac
13412                 rd_nodata=`$cat try.ret`
13413                 echo "A read() system call with no data present returns $rd_nodata."
13414                 case "$rd_nodata" in
13415                 0|-1) ;;
13416                 *)
13417                         echo "(That's peculiar, fixing that to be -1.)"
13418                         rd_nodata=-1
13419                         ;;
13420                 esac
13421                 case "$eagain" in
13422                 '')
13423                         echo "Forcing errno EAGAIN on read() with no data available."
13424                         eagain=EAGAIN
13425                         ;;
13426                 *)
13427                         echo "Your read() sets errno to $eagain when no data is available."
13428                         ;;
13429                 esac
13430                 status=`$cat try.err`
13431                 case "$status" in
13432                 0) echo "And it correctly returns 0 to signal EOF.";;
13433                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13434                 *) echo "However, your read() returns '$status' on EOF??";;
13435                 esac
13436                 val="$define"
13437                 if test "$status" = "$rd_nodata"; then
13438                         echo "WARNING: you can't distinguish between EOF and no data!"
13439                         val="$undef"
13440                 fi
13441         else
13442                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13443                 eagain=EAGAIN
13444         fi
13445         ;;
13446         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13447                 eagain=EAGAIN
13448                 val="$define"
13449                 ;;
13450         esac
13451         set d_eofnblk
13452         eval $setvar
13453         ;;
13454 *)
13455         echo "Using $hint value $eagain."
13456         echo "Your read() returns $rd_nodata when no data is present."
13457         case "$d_eofnblk" in
13458         "$define") echo "And you can see EOF because read() returns 0.";;
13459         "$undef") echo "But you can't see EOF status from read() returned value.";;
13460         *)
13461                 echo "(Assuming you can't see EOF status from read anyway.)"
13462                 d_eofnblk=$undef
13463                 ;;
13464         esac
13465         ;;
13466 esac
13467 $rm_try head.c mtry
13468
13469 : see if erf exists
13470 set erf d_erf
13471 eval $inlibc
13472
13473 : see if erfc exists
13474 set erfc d_erfc
13475 eval $inlibc
13476
13477 : see if exp2 exists
13478 set exp2 d_exp2
13479 eval $inlibc
13480
13481 : see if expm1 exists
13482 set expm1 d_expm1
13483 eval $inlibc
13484
13485 : see if _ptr and _cnt from stdio act std
13486 echo " "
13487
13488 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13489         echo "(Looks like you have stdio.h from BSD.)"
13490         case "$stdio_ptr" in
13491         '') stdio_ptr='((fp)->_p)'
13492                 ptr_lval=$define
13493                 ;;
13494         *)      ptr_lval=$d_stdio_ptr_lval;;
13495         esac
13496         case "$stdio_cnt" in
13497         '') stdio_cnt='((fp)->_r)'
13498                 cnt_lval=$define
13499                 ;;
13500         *)      cnt_lval=$d_stdio_cnt_lval;;
13501         esac
13502         case "$stdio_base" in
13503         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13504         esac
13505         case "$stdio_bufsiz" in
13506         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13507         esac
13508 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13509         echo "(Looks like you have stdio.h from Linux.)"
13510         case "$stdio_ptr" in
13511         '') stdio_ptr='((fp)->_IO_read_ptr)'
13512                 ptr_lval=$define
13513                 ;;
13514         *)      ptr_lval=$d_stdio_ptr_lval;;
13515         esac
13516         case "$stdio_cnt" in
13517         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13518                 cnt_lval=$undef
13519                 ;;
13520         *)      cnt_lval=$d_stdio_cnt_lval;;
13521         esac
13522         case "$stdio_base" in
13523         '') stdio_base='((fp)->_IO_read_base)';;
13524         esac
13525         case "$stdio_bufsiz" in
13526         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13527         esac
13528 else
13529         case "$stdio_ptr" in
13530         '') stdio_ptr='((fp)->_ptr)'
13531                 ptr_lval=$define
13532                 ;;
13533         *)      ptr_lval=$d_stdio_ptr_lval;;
13534         esac
13535         case "$stdio_cnt" in
13536         '') stdio_cnt='((fp)->_cnt)'
13537                 cnt_lval=$define
13538                 ;;
13539         *)      cnt_lval=$d_stdio_cnt_lval;;
13540         esac
13541         case "$stdio_base" in
13542         '') stdio_base='((fp)->_base)';;
13543         esac
13544         case "$stdio_bufsiz" in
13545         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13546         esac
13547 fi
13548
13549 : test whether _ptr and _cnt really work
13550 echo "Checking how std your stdio is..." >&4
13551 $cat >try.c <<EOP
13552 #include <stdio.h>
13553 #$i_stdlib I_STDLIB
13554 #ifdef I_STDLIB
13555 #include <stdlib.h>
13556 #endif
13557 #define FILE_ptr(fp)    $stdio_ptr
13558 #define FILE_cnt(fp)    $stdio_cnt
13559 int main() {
13560         FILE *fp = fopen("try.c", "r");
13561         char c = getc(fp);
13562         if (
13563                 18 <= FILE_cnt(fp) &&
13564                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13565         )
13566                 exit(0);
13567         exit(1);
13568 }
13569 EOP
13570 val="$undef"
13571 set try
13572 if eval $compile && $to try.c; then
13573         if $run ./try; then
13574                 echo "Your stdio acts pretty std."
13575                 val="$define"
13576         else
13577                 echo "Your stdio isn't very std."
13578         fi
13579 else
13580         echo "Your stdio doesn't appear very std."
13581 fi
13582 $rm_try
13583
13584 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13585 # direct buffer manipulation no longer works.  The Configure tests
13586 # should be changed to correctly detect this, but until then,
13587 # the following check should at least let perl compile and run.
13588 # (This quick fix should be updated before 5.8.1.)
13589 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13590 # A. Dougherty, June 3, 2002.
13591 case "$d_gnulibc" in
13592 $define)
13593         case "$gnulibc_version" in
13594         2.[01]*)  ;;
13595         2.2) ;;
13596         2.2.[0-9]) ;;
13597         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13598                 val="$undef"
13599                 ;;
13600         esac
13601         ;;
13602 esac
13603 set d_stdstdio
13604 eval $setvar
13605
13606 : Can _ptr be used as an lvalue?
13607 case "$d_stdstdio$ptr_lval" in
13608 $define$define) val=$define ;;
13609 *) val=$undef ;;
13610 esac
13611 set d_stdio_ptr_lval
13612 eval $setvar
13613
13614 : Can _cnt be used as an lvalue?
13615 case "$d_stdstdio$cnt_lval" in
13616 $define$define) val=$define ;;
13617 *) val=$undef ;;
13618 esac
13619 set d_stdio_cnt_lval
13620 eval $setvar
13621
13622
13623 : test whether setting _ptr sets _cnt as a side effect
13624 d_stdio_ptr_lval_sets_cnt="$undef"
13625 d_stdio_ptr_lval_nochange_cnt="$undef"
13626 case "$d_stdio_ptr_lval$d_stdstdio" in
13627 $define$define)
13628         echo "Checking to see what happens if we set the stdio ptr..." >&4
13629 $cat >try.c <<EOP
13630 #include <stdio.h>
13631 /* Can we scream? */
13632 /* Eat dust sed :-) */
13633 /* In the buffer space, no one can hear you scream. */
13634 #$i_stdlib I_STDLIB
13635 #ifdef I_STDLIB
13636 #include <stdlib.h>
13637 #endif
13638 #define FILE_ptr(fp)    $stdio_ptr
13639 #define FILE_cnt(fp)    $stdio_cnt
13640 #include <sys/types.h>
13641 int main() {
13642         FILE *fp = fopen("try.c", "r");
13643         int c;
13644         char *ptr;
13645         size_t cnt;
13646         if (!fp) {
13647             puts("Fail even to read");
13648             exit(1);
13649         }
13650         c = getc(fp); /* Read away the first # */
13651         if (c == EOF) {
13652             puts("Fail even to read");
13653             exit(1);
13654         }
13655         if (!(
13656                 18 <= FILE_cnt(fp) &&
13657                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13658         )) {
13659                 puts("Fail even to read");
13660                 exit (1);
13661         }
13662         ptr = (char*) FILE_ptr(fp);
13663         cnt = (size_t)FILE_cnt(fp);
13664
13665         FILE_ptr(fp) += 42;
13666
13667         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13668                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13669                 exit (1);
13670         }
13671         if (FILE_cnt(fp) <= 20) {
13672                 printf ("Fail (<20 chars to test)");
13673                 exit (1);
13674         }
13675         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13676                 puts("Fail compare");
13677                 exit (1);
13678         }
13679         if (cnt == FILE_cnt(fp)) {
13680                 puts("Pass_unchanged");
13681                 exit (0);
13682         }
13683         if (FILE_cnt(fp) == (cnt - 42)) {
13684                 puts("Pass_changed");
13685                 exit (0);
13686         }
13687         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13688         return 1;
13689
13690 }
13691 EOP
13692         set try
13693         if eval $compile && $to try.c; then
13694                 case `$run ./try` in
13695                 Pass_changed)
13696                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13697                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13698                 Pass_unchanged)
13699                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13700                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13701                 Fail*)
13702                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13703                 *)
13704                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13705         esac
13706         else
13707                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13708         fi
13709         $rm_try
13710         ;;
13711 esac
13712
13713 : see if _base is also standard
13714 val="$undef"
13715 case "$d_stdstdio" in
13716 $define)
13717         $cat >try.c <<EOP
13718 #include <stdio.h>
13719 #$i_stdlib I_STDLIB
13720 #ifdef I_STDLIB
13721 #include <stdlib.h>
13722 #endif
13723 #define FILE_base(fp)   $stdio_base
13724 #define FILE_bufsiz(fp) $stdio_bufsiz
13725 int main() {
13726         FILE *fp = fopen("try.c", "r");
13727         char c = getc(fp);
13728         if (
13729                 19 <= FILE_bufsiz(fp) &&
13730                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13731         )
13732                 exit(0);
13733         exit(1);
13734 }
13735 EOP
13736         set try
13737         if eval $compile && $to try.c; then
13738                 if $run ./try; then
13739                         echo "And its _base field acts std."
13740                         val="$define"
13741                 else
13742                         echo "But its _base field isn't std."
13743                 fi
13744         else
13745                 echo "However, it seems to be lacking the _base field."
13746         fi
13747         $rm_try
13748         ;;
13749 esac
13750 set d_stdiobase
13751 eval $setvar
13752
13753 : see if fast_stdio exists
13754 val="$undef"
13755 case "$d_stdstdio:$d_stdio_ptr_lval" in
13756 "$define:$define")
13757         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13758         *$define*)
13759                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13760                 val="$define"
13761                 ;;
13762         esac
13763         ;;
13764 esac
13765 set d_faststdio
13766 eval $setvar
13767
13768
13769
13770 : see if fchdir exists
13771 set fchdir d_fchdir
13772 eval $inlibc
13773
13774 : see if fchmod exists
13775 set fchmod d_fchmod
13776 eval $inlibc
13777
13778 : see if fchown exists
13779 set fchown d_fchown
13780 eval $inlibc
13781
13782 : see if this is an fcntl system
13783 set fcntl d_fcntl
13784 eval $inlibc
13785
13786 : See if fcntl-based locking works.
13787 echo " "
13788 $cat >try.c <<EOCP
13789 #$i_stdlib I_STDLIB
13790 #ifdef I_STDLIB
13791 #include <stdlib.h>
13792 #endif
13793 #include <unistd.h>
13794 #include <fcntl.h>
13795 #include <signal.h>
13796 $signal_t blech(int x) { exit(3); }
13797 int main() {
13798 #if defined(F_SETLK) && defined(F_SETLKW)
13799      struct flock flock;
13800      int retval, fd;
13801      fd = open("try.c", O_RDONLY);
13802      flock.l_type = F_RDLCK;
13803      flock.l_whence = SEEK_SET;
13804      flock.l_start = flock.l_len = 0;
13805      signal(SIGALRM, blech);
13806      alarm(10);
13807      retval = fcntl(fd, F_SETLK, &flock);
13808      close(fd);
13809      (retval < 0 ? exit(2) : exit(0));
13810 #else
13811      exit(2);
13812 #endif
13813 }
13814 EOCP
13815 echo "Checking if fcntl-based file locking works... "
13816 case "$d_fcntl" in
13817 "$define")
13818         set try
13819         if eval $compile_ok; then
13820                 if $run ./try; then
13821                         echo "Yes, it seems to work."
13822                         val="$define"
13823                 else
13824                         echo "Nope, it didn't work."
13825                         val="$undef"
13826                         case "$?" in
13827                         3) $cat >&4 <<EOM
13828 ***
13829 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13830 *** This is (almost) impossible.
13831 *** If your NFS lock daemons are not feeling well, something like
13832 *** this may happen, please investigate.  Cannot continue, aborting.
13833 ***
13834 EOM
13835                                 exit 1
13836                                 ;;
13837                         esac
13838                 fi
13839         else
13840                 echo "I'm unable to compile the test program, so I'll assume not."
13841                 val="$undef"
13842         fi
13843         ;;
13844 *) val="$undef";
13845         echo "Nope, since you don't even have fcntl()."
13846         ;;
13847 esac
13848 set d_fcntl_can_lock
13849 eval $setvar
13850 $rm_try
13851
13852 : check for fd_set items
13853 $cat <<EOM
13854
13855 Checking to see how well your C compiler handles fd_set and friends ...
13856 EOM
13857 $cat >try.c <<EOCP
13858 #$i_stdlib I_STDLIB
13859 #ifdef I_STDLIB
13860 #include <stdlib.h>
13861 #endif
13862 #$i_systime I_SYS_TIME
13863 #$i_sysselct I_SYS_SELECT
13864 #$d_socket HAS_SOCKET
13865 #include <sys/types.h>
13866 #ifdef HAS_SOCKET
13867 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13868 #endif
13869 #ifdef I_SYS_TIME
13870 #include <sys/time.h>
13871 #endif
13872 #ifdef I_SYS_SELECT
13873 #include <sys/select.h>
13874 #endif
13875 int main() {
13876         fd_set fds;
13877
13878 #ifdef TRYBITS
13879         if(fds.fds_bits);
13880 #endif
13881
13882 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13883         exit(0);
13884 #else
13885         exit(1);
13886 #endif
13887 }
13888 EOCP
13889 set try -DTRYBITS
13890 if eval $compile; then
13891         d_fds_bits="$define"
13892         d_fd_set="$define"
13893         echo "Well, your system knows about the normal fd_set typedef..." >&4
13894         if $run ./try; then
13895                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13896                 d_fd_macros="$define"
13897         else
13898                 $cat >&4 <<'EOM'
13899 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13900 EOM
13901                 d_fd_macros="$undef"
13902         fi
13903 else
13904         $cat <<'EOM'
13905 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13906 EOM
13907         set try
13908         if eval $compile; then
13909                 d_fds_bits="$undef"
13910                 d_fd_set="$define"
13911                 echo "Well, your system has some sort of fd_set available..." >&4
13912                 if $run ./try; then
13913                         echo "and you have the normal fd_set macros." >&4
13914                         d_fd_macros="$define"
13915                 else
13916                         $cat <<'EOM'
13917 but not the normal fd_set macros!  Gross!  More work for me...
13918 EOM
13919                         d_fd_macros="$undef"
13920                 fi
13921         else
13922         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13923                 d_fd_set="$undef"
13924                 d_fds_bits="$undef"
13925                 d_fd_macros="$undef"
13926         fi
13927 fi
13928 $rm_try
13929
13930 : see if fdim exists
13931 set fdim d_fdim
13932 eval $inlibc
13933
13934 : see if fegetround exists
13935 set fegetround d_fegetround
13936 eval $inlibc
13937
13938 : see if fgetpos exists
13939 set fgetpos d_fgetpos
13940 eval $inlibc
13941
13942 : see if finite exists
13943 set finite d_finite
13944 eval $inlibc
13945
13946 : see if finitel exists
13947 set finitel d_finitel
13948 eval $inlibc
13949
13950 : see if flock exists
13951 set flock d_flock
13952 eval $inlibc
13953
13954 : see if prototype for flock is available
13955 echo " "
13956 set d_flockproto flock $i_sysfile sys/file.h
13957 eval $hasproto
13958
13959 : see if fma exists
13960 set fma d_fma
13961 eval $inlibc
13962
13963 : see if fmax exists
13964 set fmax d_fmax
13965 eval $inlibc
13966
13967 : see if fmin exists
13968 set fmin d_fmin
13969 eval $inlibc
13970
13971 : see if fp_class exists
13972 set fp_class d_fp_class
13973 eval $inlibc
13974
13975 : see if this is a math.h system
13976 set math.h i_math
13977 eval $inhdr
13978
13979 : check for fpclassify
13980 echo "Checking to see if you have fpclassify..." >&4
13981 $cat >try.c <<EOCP
13982 #$i_math I_MATH
13983 #ifdef I_MATH
13984 #include <math.h>
13985 #endif
13986 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13987 EOCP
13988 set try
13989 if eval $compile; then
13990         val="$define"
13991         echo "You have fpclassify."
13992 else
13993         val="$undef"
13994         echo "You do not have fpclassify."
13995 fi
13996 $rm_try
13997 set d_fpclassify
13998 eval $setvar
13999
14000 : see if fp_classify exists
14001 set fp_classify d_fp_classify
14002 eval $inlibc
14003
14004 : see if fp_classl exists
14005 set fp_classl d_fp_classl
14006 eval $inlibc
14007
14008 : see if pathconf exists
14009 set pathconf d_pathconf
14010 eval $inlibc
14011
14012 : see if fpathconf exists
14013 set fpathconf d_fpathconf
14014 eval $inlibc
14015
14016 : see if fpclass exists
14017 set fpclass d_fpclass
14018 eval $inlibc
14019
14020 : see if fpclassl exists
14021 set fpclassl d_fpclassl
14022 eval $inlibc
14023
14024 : see if fpgetround exists
14025 set fpgetround d_fpgetround
14026 eval $inlibc
14027
14028 : check for fpos64_t
14029 echo " "
14030 echo "Checking to see if you have fpos64_t..." >&4
14031 $cat >try.c <<EOCP
14032 #include <stdio.h>
14033 int main() { fpos64_t x = 7; }
14034 EOCP
14035 set try
14036 if eval $compile; then
14037         val="$define"
14038         echo "You have fpos64_t."
14039 else
14040         val="$undef"
14041         echo "You do not have fpos64_t."
14042         case "$fpossize" in
14043         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14044         esac
14045 fi
14046 $rm_try
14047 set d_fpos64_t
14048 eval $setvar
14049
14050 : see if frexpl exists
14051 set frexpl d_frexpl
14052 eval $inlibc
14053
14054 : see if this is a sys/param system
14055 set sys/param.h i_sysparam
14056 eval $inhdr
14057
14058 : see if this is a sys/mount.h system
14059 set sys/mount.h i_sysmount
14060 eval $inhdr
14061
14062 : Check for fs_data_s
14063 echo " "
14064 echo "Checking to see if your system supports struct fs_data..." >&4
14065 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14066 eval $hasstruct
14067 case "$d_fs_data_s" in
14068 "$define")      echo "Yes, it does."   ;;
14069 *)              echo "No, it doesn't." ;;
14070 esac
14071
14072 : see if fseeko exists
14073 set fseeko d_fseeko
14074 eval $inlibc
14075 case "$longsize" in
14076 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14077 esac
14078
14079 : see if fsetpos exists
14080 set fsetpos d_fsetpos
14081 eval $inlibc
14082
14083 : see if fstatfs exists
14084 set fstatfs d_fstatfs
14085 eval $inlibc
14086
14087 : see if statvfs exists
14088 set statvfs d_statvfs
14089 eval $inlibc
14090
14091 : see if fstatvfs exists
14092 set fstatvfs d_fstatvfs
14093 eval $inlibc
14094
14095
14096 : see if fsync exists
14097 set fsync d_fsync
14098 eval $inlibc
14099
14100 : see if ftello exists
14101 set ftello d_ftello
14102 eval $inlibc
14103 case "$longsize" in
14104 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14105 esac
14106
14107 : check for a working futimes
14108 d_futimes="$undef"
14109 echo " "
14110 echo "Checking if you have a working futimes()" >&4
14111 $cat >try.c <<EOCP
14112 #include <stdio.h>
14113 #include <sys/time.h>
14114 #include <errno.h>
14115 #include <fcntl.h>
14116
14117 int main ()
14118 {
14119     int fd, rv;
14120     fd = open ("try.c", O_RDWR);
14121     if (-1 == fd) exit (1);
14122     rv = futimes (fd, NULL);
14123     exit (rv == -1 ? errno : 0);
14124 }
14125 EOCP
14126 set try
14127 if eval $compile; then
14128     `$run ./try`
14129     rc=$?
14130     case "$rc" in
14131         0)  echo "Yes, you have" >&4
14132             d_futimes="$define"
14133             ;;
14134         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14135             ;;
14136     esac
14137 else
14138     echo "No, it does not (probably harmless)" >&4
14139 fi
14140 $rm_try
14141
14142 : see if ndbm.h is available
14143 set ndbm.h i_ndbm
14144 eval $inhdr
14145 : Compatibility location for RedHat 7.1
14146 set gdbm/ndbm.h i_gdbmndbm
14147 eval $inhdr
14148 : Compatibility location for Debian 4.0
14149 set gdbm-ndbm.h i_gdbm_ndbm
14150 eval $inhdr
14151
14152 val="$undef"
14153 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14154         : see if dbm_open exists
14155         set dbm_open d_dbm_open
14156         eval $inlibc
14157         case "$d_dbm_open" in
14158         $undef)
14159                 i_ndbm="$undef"
14160                 i_gdbmndbm="$undef"
14161                 i_gdbm_ndbm="$undef"
14162                 echo "We won't be including <ndbm.h>"
14163                 val="$undef"
14164                 ;;
14165         *) val="$define"
14166            ;;
14167         esac
14168 fi
14169 set d_ndbm
14170 eval $setvar
14171
14172 ndbm_hdr_protochk='name=$1; hdr=$2;
14173 eval "ihdr=\$""i_$name";
14174 val="$undef";
14175 if $test "$ihdr" = "$define"; then
14176         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14177         case "$d_cplusplus" in
14178         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14179         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14180         esac;
14181         case "$val" in
14182         $define) $echo "Your <$hdr> seems to have prototypes";;
14183         *) $echo "Your <$hdr> does not seem to have prototypes";;
14184         esac;
14185 fi;
14186 set "d_${name}_h_uses_prototypes";
14187 eval $setvar'
14188
14189 set ndbm ndbm.h
14190 eval $ndbm_hdr_protochk
14191 set gdbmndbm gdbm/ndbm.h
14192 eval $ndbm_hdr_protochk
14193 set gdbm_ndbm gdbm-ndbm.h
14194 eval $ndbm_hdr_protochk
14195
14196 : see if getaddrinfo exists
14197 set getaddrinfo d_getaddrinfo
14198 eval $inlibc
14199
14200 : see if getcwd exists
14201 set getcwd d_getcwd
14202 eval $inlibc
14203
14204 : see if getespwnam exists
14205 set getespwnam d_getespwnam
14206 eval $inlibc
14207
14208 : see if getfsstat exists
14209 set getfsstat d_getfsstat
14210 eval $inlibc
14211
14212 : see if getgrent exists
14213 set getgrent d_getgrent
14214 eval $inlibc
14215
14216 : see if getgrent_r exists
14217 set getgrent_r d_getgrent_r
14218 eval $inlibc
14219 case "$d_getgrent_r" in
14220 "$define")
14221         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14222         case "$d_getgrent_r_proto:$usethreads" in
14223         ":define")      d_getgrent_r_proto=define
14224                 set d_getgrent_r_proto getgrent_r $hdrs
14225                 eval $hasproto ;;
14226         *)      ;;
14227         esac
14228         case "$d_getgrent_r_proto" in
14229         define)
14230         case "$getgrent_r_proto" in
14231         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14232         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14233         esac
14234         case "$getgrent_r_proto" in
14235         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14236         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14237         esac
14238         case "$getgrent_r_proto" in
14239         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14240         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14241         esac
14242         case "$getgrent_r_proto" in
14243         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14244         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14245         esac
14246         case "$getgrent_r_proto" in
14247         ''|0) try='int getgrent_r(struct group*, char*, int);'
14248         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14249         esac
14250         case "$getgrent_r_proto" in
14251         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14252         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14253         esac
14254         case "$getgrent_r_proto" in
14255         ''|0)   d_getgrent_r=undef
14256                 getgrent_r_proto=0
14257                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14258         * )     case "$getgrent_r_proto" in
14259                 REENTRANT_PROTO*) ;;
14260                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14261                 esac
14262                 echo "Prototype: $try" ;;
14263         esac
14264         ;;
14265         *)      case "$usethreads" in
14266                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14267                 esac
14268                 d_getgrent_r=undef
14269                 getgrent_r_proto=0
14270                 ;;
14271         esac
14272         ;;
14273 *)      getgrent_r_proto=0
14274         ;;
14275 esac
14276
14277 : see if getgrgid_r exists
14278 set getgrgid_r d_getgrgid_r
14279 eval $inlibc
14280 case "$d_getgrgid_r" in
14281 "$define")
14282         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14283         case "$d_getgrgid_r_proto:$usethreads" in
14284         ":define")      d_getgrgid_r_proto=define
14285                 set d_getgrgid_r_proto getgrgid_r $hdrs
14286                 eval $hasproto ;;
14287         *)      ;;
14288         esac
14289         case "$d_getgrgid_r_proto" in
14290         define)
14291         case "$getgrgid_r_proto" in
14292         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14293         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14294         esac
14295         case "$getgrgid_r_proto" in
14296         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14297         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14298         esac
14299         case "$getgrgid_r_proto" in
14300         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14301         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14302         esac
14303         case "$getgrgid_r_proto" in
14304         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14305         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14306         esac
14307         case "$getgrgid_r_proto" in
14308         ''|0)   d_getgrgid_r=undef
14309                 getgrgid_r_proto=0
14310                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14311         * )     case "$getgrgid_r_proto" in
14312                 REENTRANT_PROTO*) ;;
14313                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14314                 esac
14315                 echo "Prototype: $try" ;;
14316         esac
14317         ;;
14318         *)      case "$usethreads" in
14319                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14320                 esac
14321                 d_getgrgid_r=undef
14322                 getgrgid_r_proto=0
14323                 ;;
14324         esac
14325         ;;
14326 *)      getgrgid_r_proto=0
14327         ;;
14328 esac
14329
14330 : see if getgrnam_r exists
14331 set getgrnam_r d_getgrnam_r
14332 eval $inlibc
14333 case "$d_getgrnam_r" in
14334 "$define")
14335         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14336         case "$d_getgrnam_r_proto:$usethreads" in
14337         ":define")      d_getgrnam_r_proto=define
14338                 set d_getgrnam_r_proto getgrnam_r $hdrs
14339                 eval $hasproto ;;
14340         *)      ;;
14341         esac
14342         case "$d_getgrnam_r_proto" in
14343         define)
14344         case "$getgrnam_r_proto" in
14345         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14346         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14347         esac
14348         case "$getgrnam_r_proto" in
14349         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14350         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14351         esac
14352         case "$getgrnam_r_proto" in
14353         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14354         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14355         esac
14356         case "$getgrnam_r_proto" in
14357         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14358         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14359         esac
14360         case "$getgrnam_r_proto" in
14361         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14362         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14363         esac
14364         case "$getgrnam_r_proto" in
14365         ''|0)   d_getgrnam_r=undef
14366                 getgrnam_r_proto=0
14367                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14368         * )     case "$getgrnam_r_proto" in
14369                 REENTRANT_PROTO*) ;;
14370                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14371                 esac
14372                 echo "Prototype: $try" ;;
14373         esac
14374         ;;
14375         *)      case "$usethreads" in
14376                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14377                 esac
14378                 d_getgrnam_r=undef
14379                 getgrnam_r_proto=0
14380                 ;;
14381         esac
14382         ;;
14383 *)      getgrnam_r_proto=0
14384         ;;
14385 esac
14386
14387 : see if gethostbyaddr exists
14388 set gethostbyaddr d_gethbyaddr
14389 eval $inlibc
14390
14391 : see if gethostbyname exists
14392 set gethostbyname d_gethbyname
14393 eval $inlibc
14394
14395 : see if gethostent exists
14396 set gethostent d_gethent
14397 eval $inlibc
14398
14399 : see how we will look up host name
14400 echo " "
14401 call=''
14402 if set gethostname val -f d_gethname; eval $csym; $val; then
14403         echo 'gethostname() found.' >&4
14404         d_gethname="$define"
14405         call=gethostname
14406 fi
14407 if set uname val -f d_uname; eval $csym; $val; then
14408         if ./xenix; then
14409                 $cat <<'EOM'
14410 uname() was found, but you're running xenix, and older versions of xenix
14411 have a broken uname(). If you don't really know whether your xenix is old
14412 enough to have a broken system call, use the default answer.
14413
14414 EOM
14415                 dflt=y
14416                 case "$d_uname" in
14417                 "$define") dflt=n;;
14418                 esac
14419                 rp='Is your uname() broken?'
14420                 . ./myread
14421                 case "$ans" in
14422                 n*) d_uname="$define"; call=uname;;
14423                 esac
14424         else
14425                 echo 'uname() found.' >&4
14426                 d_uname="$define"
14427                 case "$call" in
14428                 '') call=uname ;;
14429                 esac
14430         fi
14431 fi
14432 case "$d_gethname" in
14433 '') d_gethname="$undef";;
14434 esac
14435 case "$d_uname" in
14436 '') d_uname="$undef";;
14437 esac
14438 case "$d_uname$d_gethname" in
14439 *define*)
14440         dflt=n
14441         cat <<EOM
14442
14443 Every now and then someone has a $call() that lies about the hostname
14444 but can't be fixed for political or economic reasons.  If you wish, I can
14445 pretend $call() isn't there and maybe compute hostname at run-time
14446 thanks to the '$phostname' command.
14447
14448 EOM
14449         rp="Shall I ignore $call() from now on?"
14450         . ./myread
14451         case "$ans" in
14452         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14453         esac;;
14454 esac
14455 case "$phostname" in
14456 '') aphostname='';;
14457 *) case "$aphostname" in
14458         /*) ;;
14459         *) set X $phostname
14460                 shift
14461                 file=$1
14462                 shift
14463                 file=`./loc $file $file $pth`
14464                 aphostname=`echo $file $*`
14465                 ;;
14466         esac
14467         ;;
14468 esac
14469 case "$d_uname$d_gethname" in
14470 *define*) ;;
14471 *)
14472         case "$phostname" in
14473         '')
14474                 echo "There will be no way for $package to get your hostname." >&4;;
14475         *)
14476         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14477                 ;;
14478         esac;;
14479 esac
14480 case "$d_phostname" in
14481 '') d_phostname="$undef";;
14482 esac
14483
14484 : see if gethostbyaddr_r exists
14485 set gethostbyaddr_r d_gethostbyaddr_r
14486 eval $inlibc
14487 case "$d_gethostbyaddr_r" in
14488 "$define")
14489         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14490         case "$d_gethostbyaddr_r_proto:$usethreads" in
14491         ":define")      d_gethostbyaddr_r_proto=define
14492                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14493                 eval $hasproto ;;
14494         *)      ;;
14495         esac
14496         case "$d_gethostbyaddr_r_proto" in
14497         define)
14498         case "$gethostbyaddr_r_proto" in
14499         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14500         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14501         esac
14502         case "$gethostbyaddr_r_proto" in
14503         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14504         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14505         esac
14506         case "$gethostbyaddr_r_proto" in
14507         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14508         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14509         esac
14510         case "$gethostbyaddr_r_proto" in
14511         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14512         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14513         esac
14514         case "$gethostbyaddr_r_proto" in
14515         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14516         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14517         esac
14518         case "$gethostbyaddr_r_proto" in
14519         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14520         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14521         esac
14522         case "$gethostbyaddr_r_proto" in
14523         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14524         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14525         esac
14526         case "$gethostbyaddr_r_proto" in
14527         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14528         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14529         esac
14530         case "$gethostbyaddr_r_proto" in
14531         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14532         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14533         esac
14534         case "$gethostbyaddr_r_proto" in
14535         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14536         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14537         esac
14538         case "$gethostbyaddr_r_proto" in
14539         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14540         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14541         esac
14542         case "$gethostbyaddr_r_proto" in
14543         ''|0)   d_gethostbyaddr_r=undef
14544                 gethostbyaddr_r_proto=0
14545                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14546         * )     case "$gethostbyaddr_r_proto" in
14547                 REENTRANT_PROTO*) ;;
14548                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14549                 esac
14550                 echo "Prototype: $try" ;;
14551         esac
14552         ;;
14553         *)      case "$usethreads" in
14554                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14555                 esac
14556                 d_gethostbyaddr_r=undef
14557                 gethostbyaddr_r_proto=0
14558                 ;;
14559         esac
14560         ;;
14561 *)      gethostbyaddr_r_proto=0
14562         ;;
14563 esac
14564
14565 : see if gethostbyname_r exists
14566 set gethostbyname_r d_gethostbyname_r
14567 eval $inlibc
14568 case "$d_gethostbyname_r" in
14569 "$define")
14570         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14571         case "$d_gethostbyname_r_proto:$usethreads" in
14572         ":define")      d_gethostbyname_r_proto=define
14573                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14574                 eval $hasproto ;;
14575         *)      ;;
14576         esac
14577         case "$d_gethostbyname_r_proto" in
14578         define)
14579         case "$gethostbyname_r_proto" in
14580         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14581         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14582         esac
14583         case "$gethostbyname_r_proto" in
14584         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14585         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14586         esac
14587         case "$gethostbyname_r_proto" in
14588         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14589         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14590         esac
14591         case "$gethostbyname_r_proto" in
14592         ''|0)   d_gethostbyname_r=undef
14593                 gethostbyname_r_proto=0
14594                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14595         * )     case "$gethostbyname_r_proto" in
14596                 REENTRANT_PROTO*) ;;
14597                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14598                 esac
14599                 echo "Prototype: $try" ;;
14600         esac
14601         ;;
14602         *)      case "$usethreads" in
14603                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14604                 esac
14605                 d_gethostbyname_r=undef
14606                 gethostbyname_r_proto=0
14607                 ;;
14608         esac
14609         ;;
14610 *)      gethostbyname_r_proto=0
14611         ;;
14612 esac
14613
14614 : see if gethostent_r exists
14615 set gethostent_r d_gethostent_r
14616 eval $inlibc
14617 case "$d_gethostent_r" in
14618 "$define")
14619         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14620         case "$d_gethostent_r_proto:$usethreads" in
14621         ":define")      d_gethostent_r_proto=define
14622                 set d_gethostent_r_proto gethostent_r $hdrs
14623                 eval $hasproto ;;
14624         *)      ;;
14625         esac
14626         case "$d_gethostent_r_proto" in
14627         define)
14628         case "$gethostent_r_proto" in
14629         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14630         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14631         esac
14632         case "$gethostent_r_proto" in
14633         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14634         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14635         esac
14636         case "$gethostent_r_proto" in
14637         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14638         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14639         esac
14640         case "$gethostent_r_proto" in
14641         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14642         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14643         esac
14644         case "$gethostent_r_proto" in
14645         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14646         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14647         esac
14648         case "$gethostent_r_proto" in
14649         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14650         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14651         esac
14652         case "$gethostent_r_proto" in
14653         ''|0)   d_gethostent_r=undef
14654                 gethostent_r_proto=0
14655                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14656         * )     case "$gethostent_r_proto" in
14657                 REENTRANT_PROTO*) ;;
14658                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14659                 esac
14660                 echo "Prototype: $try" ;;
14661         esac
14662         ;;
14663         *)      case "$usethreads" in
14664                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14665                 esac
14666                 d_gethostent_r=undef
14667                 gethostent_r_proto=0
14668                 ;;
14669         esac
14670         ;;
14671 *)      gethostent_r_proto=0
14672         ;;
14673 esac
14674
14675 : see if prototypes for various gethostxxx netdb.h functions are available
14676 echo " "
14677 set d_gethostprotos gethostent $i_netdb netdb.h
14678 eval $hasproto
14679
14680 : see if getitimer exists
14681 set getitimer d_getitimer
14682 eval $inlibc
14683
14684 : see if getlogin exists
14685 set getlogin d_getlogin
14686 eval $inlibc
14687
14688 : see if getlogin_r exists
14689 set getlogin_r d_getlogin_r
14690 eval $inlibc
14691 case "$d_getlogin_r" in
14692 "$define")
14693         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14694         case "$d_getlogin_r_proto:$usethreads" in
14695         ":define")      d_getlogin_r_proto=define
14696                 set d_getlogin_r_proto getlogin_r $hdrs
14697                 eval $hasproto ;;
14698         *)      ;;
14699         esac
14700         case "$d_getlogin_r_proto" in
14701         define)
14702         case "$getlogin_r_proto" in
14703         ''|0) try='int getlogin_r(char*, size_t);'
14704         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14705         esac
14706         case "$getlogin_r_proto" in
14707         ''|0) try='int getlogin_r(char*, int);'
14708         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14709         esac
14710         case "$getlogin_r_proto" in
14711         ''|0) try='char* getlogin_r(char*, size_t);'
14712         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14713         esac
14714         case "$getlogin_r_proto" in
14715         ''|0) try='char* getlogin_r(char*, int);'
14716         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14717         esac
14718         case "$getlogin_r_proto" in
14719         ''|0)   d_getlogin_r=undef
14720                 getlogin_r_proto=0
14721                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14722         * )     case "$getlogin_r_proto" in
14723                 REENTRANT_PROTO*) ;;
14724                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14725                 esac
14726                 echo "Prototype: $try" ;;
14727         esac
14728         ;;
14729         *)      case "$usethreads" in
14730                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14731                 esac
14732                 d_getlogin_r=undef
14733                 getlogin_r_proto=0
14734                 ;;
14735         esac
14736         ;;
14737 *)      getlogin_r_proto=0
14738         ;;
14739 esac
14740
14741 : see if getmnt exists
14742 set getmnt d_getmnt
14743 eval $inlibc
14744
14745 : see if getmntent exists
14746 set getmntent d_getmntent
14747 eval $inlibc
14748
14749 : see if getnameinfo exists
14750 set getnameinfo d_getnameinfo
14751 eval $inlibc
14752
14753 : see if getnetbyaddr exists
14754 set getnetbyaddr d_getnbyaddr
14755 eval $inlibc
14756
14757 : see if getnetbyname exists
14758 set getnetbyname d_getnbyname
14759 eval $inlibc
14760
14761 : see if getnetent exists
14762 set getnetent d_getnent
14763 eval $inlibc
14764
14765 : see if getnetbyaddr_r exists
14766 set getnetbyaddr_r d_getnetbyaddr_r
14767 eval $inlibc
14768 case "$d_getnetbyaddr_r" in
14769 "$define")
14770         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14771         case "$d_getnetbyaddr_r_proto:$usethreads" in
14772         ":define")      d_getnetbyaddr_r_proto=define
14773                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14774                 eval $hasproto ;;
14775         *)      ;;
14776         esac
14777         case "$d_getnetbyaddr_r_proto" in
14778         define)
14779         case "$getnetbyaddr_r_proto" in
14780         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14781         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14782         esac
14783         case "$getnetbyaddr_r_proto" in
14784         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14785         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14786         esac
14787         case "$getnetbyaddr_r_proto" in
14788         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14789         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14790         esac
14791         case "$getnetbyaddr_r_proto" in
14792         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14793         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14794         esac
14795         case "$getnetbyaddr_r_proto" in
14796         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14797         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14798         esac
14799         case "$getnetbyaddr_r_proto" in
14800         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14801         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14802         esac
14803         case "$getnetbyaddr_r_proto" in
14804         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14805         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14806         esac
14807         case "$getnetbyaddr_r_proto" in
14808         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14809         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14810         esac
14811         case "$getnetbyaddr_r_proto" in
14812         ''|0)   d_getnetbyaddr_r=undef
14813                 getnetbyaddr_r_proto=0
14814                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14815         * )     case "$getnetbyaddr_r_proto" in
14816                 REENTRANT_PROTO*) ;;
14817                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14818                 esac
14819                 echo "Prototype: $try" ;;
14820         esac
14821         ;;
14822         *)      case "$usethreads" in
14823                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14824                 esac
14825                 d_getnetbyaddr_r=undef
14826                 getnetbyaddr_r_proto=0
14827                 ;;
14828         esac
14829         ;;
14830 *)      getnetbyaddr_r_proto=0
14831         ;;
14832 esac
14833
14834 : see if getnetbyname_r exists
14835 set getnetbyname_r d_getnetbyname_r
14836 eval $inlibc
14837 case "$d_getnetbyname_r" in
14838 "$define")
14839         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14840         case "$d_getnetbyname_r_proto:$usethreads" in
14841         ":define")      d_getnetbyname_r_proto=define
14842                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14843                 eval $hasproto ;;
14844         *)      ;;
14845         esac
14846         case "$d_getnetbyname_r_proto" in
14847         define)
14848         case "$getnetbyname_r_proto" in
14849         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14850         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14851         esac
14852         case "$getnetbyname_r_proto" in
14853         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14854         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14855         esac
14856         case "$getnetbyname_r_proto" in
14857         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14858         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14859         esac
14860         case "$getnetbyname_r_proto" in
14861         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14862         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14863         esac
14864         case "$getnetbyname_r_proto" in
14865         ''|0)   d_getnetbyname_r=undef
14866                 getnetbyname_r_proto=0
14867                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14868         * )     case "$getnetbyname_r_proto" in
14869                 REENTRANT_PROTO*) ;;
14870                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14871                 esac
14872                 echo "Prototype: $try" ;;
14873         esac
14874         ;;
14875         *)      case "$usethreads" in
14876                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14877                 esac
14878                 d_getnetbyname_r=undef
14879                 getnetbyname_r_proto=0
14880                 ;;
14881         esac
14882         ;;
14883 *)      getnetbyname_r_proto=0
14884         ;;
14885 esac
14886
14887 : see if getnetent_r exists
14888 set getnetent_r d_getnetent_r
14889 eval $inlibc
14890 case "$d_getnetent_r" in
14891 "$define")
14892         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14893         case "$d_getnetent_r_proto:$usethreads" in
14894         ":define")      d_getnetent_r_proto=define
14895                 set d_getnetent_r_proto getnetent_r $hdrs
14896                 eval $hasproto ;;
14897         *)      ;;
14898         esac
14899         case "$d_getnetent_r_proto" in
14900         define)
14901         case "$getnetent_r_proto" in
14902         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14903         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14904         esac
14905         case "$getnetent_r_proto" in
14906         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14907         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14908         esac
14909         case "$getnetent_r_proto" in
14910         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14911         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14912         esac
14913         case "$getnetent_r_proto" in
14914         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14915         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14916         esac
14917         case "$getnetent_r_proto" in
14918         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14919         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14920         esac
14921         case "$getnetent_r_proto" in
14922         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14923         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14924         esac
14925         case "$getnetent_r_proto" in
14926         ''|0)   d_getnetent_r=undef
14927                 getnetent_r_proto=0
14928                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14929         * )     case "$getnetent_r_proto" in
14930                 REENTRANT_PROTO*) ;;
14931                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14932                 esac
14933                 echo "Prototype: $try" ;;
14934         esac
14935         ;;
14936         *)      case "$usethreads" in
14937                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14938                 esac
14939                 d_getnetent_r=undef
14940                 getnetent_r_proto=0
14941                 ;;
14942         esac
14943         ;;
14944 *)      getnetent_r_proto=0
14945         ;;
14946 esac
14947
14948 : see if prototypes for various getnetxxx netdb.h functions are available
14949 echo " "
14950 set d_getnetprotos getnetent $i_netdb netdb.h
14951 eval $hasproto
14952
14953 : see if getpagesize exists
14954 set getpagesize d_getpagsz
14955 eval $inlibc
14956
14957 : Optional checks for getprotobyname and getprotobynumber
14958
14959 : see if getprotobyname exists
14960 set getprotobyname d_getpbyname
14961 eval $inlibc
14962
14963 : see if getprotobynumber exists
14964 set getprotobynumber d_getpbynumber
14965 eval $inlibc
14966
14967 : see if getprotoent exists
14968 set getprotoent d_getpent
14969 eval $inlibc
14970
14971 : see if getpgid exists
14972 set getpgid d_getpgid
14973 eval $inlibc
14974
14975 : see if getpgrp2 exists
14976 set getpgrp2 d_getpgrp2
14977 eval $inlibc
14978
14979 : see if getppid exists
14980 set getppid d_getppid
14981 eval $inlibc
14982
14983 : see if getpriority exists
14984 set getpriority d_getprior
14985 eval $inlibc
14986
14987 : see if getprotobyname_r exists
14988 set getprotobyname_r d_getprotobyname_r
14989 eval $inlibc
14990 case "$d_getprotobyname_r" in
14991 "$define")
14992         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14993         case "$d_getprotobyname_r_proto:$usethreads" in
14994         ":define")      d_getprotobyname_r_proto=define
14995                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14996                 eval $hasproto ;;
14997         *)      ;;
14998         esac
14999         case "$d_getprotobyname_r_proto" in
15000         define)
15001         case "$getprotobyname_r_proto" in
15002         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15003         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15004         esac
15005         case "$getprotobyname_r_proto" in
15006         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15007         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15008         esac
15009         case "$getprotobyname_r_proto" in
15010         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15011         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15012         esac
15013         case "$getprotobyname_r_proto" in
15014         ''|0)   d_getprotobyname_r=undef
15015                 getprotobyname_r_proto=0
15016                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15017         * )     case "$getprotobyname_r_proto" in
15018                 REENTRANT_PROTO*) ;;
15019                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15020                 esac
15021                 echo "Prototype: $try" ;;
15022         esac
15023         ;;
15024         *)      case "$usethreads" in
15025                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15026                 esac
15027                 d_getprotobyname_r=undef
15028                 getprotobyname_r_proto=0
15029                 ;;
15030         esac
15031         ;;
15032 *)      getprotobyname_r_proto=0
15033         ;;
15034 esac
15035
15036 : see if getprotobynumber_r exists
15037 set getprotobynumber_r d_getprotobynumber_r
15038 eval $inlibc
15039 case "$d_getprotobynumber_r" in
15040 "$define")
15041         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15042         case "$d_getprotobynumber_r_proto:$usethreads" in
15043         ":define")      d_getprotobynumber_r_proto=define
15044                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15045                 eval $hasproto ;;
15046         *)      ;;
15047         esac
15048         case "$d_getprotobynumber_r_proto" in
15049         define)
15050         case "$getprotobynumber_r_proto" in
15051         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15052         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15053         esac
15054         case "$getprotobynumber_r_proto" in
15055         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15056         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15057         esac
15058         case "$getprotobynumber_r_proto" in
15059         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15060         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15061         esac
15062         case "$getprotobynumber_r_proto" in
15063         ''|0)   d_getprotobynumber_r=undef
15064                 getprotobynumber_r_proto=0
15065                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15066         * )     case "$getprotobynumber_r_proto" in
15067                 REENTRANT_PROTO*) ;;
15068                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15069                 esac
15070                 echo "Prototype: $try" ;;
15071         esac
15072         ;;
15073         *)      case "$usethreads" in
15074                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15075                 esac
15076                 d_getprotobynumber_r=undef
15077                 getprotobynumber_r_proto=0
15078                 ;;
15079         esac
15080         ;;
15081 *)      getprotobynumber_r_proto=0
15082         ;;
15083 esac
15084
15085 : see if getprotoent_r exists
15086 set getprotoent_r d_getprotoent_r
15087 eval $inlibc
15088 case "$d_getprotoent_r" in
15089 "$define")
15090         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15091         case "$d_getprotoent_r_proto:$usethreads" in
15092         ":define")      d_getprotoent_r_proto=define
15093                 set d_getprotoent_r_proto getprotoent_r $hdrs
15094                 eval $hasproto ;;
15095         *)      ;;
15096         esac
15097         case "$d_getprotoent_r_proto" in
15098         define)
15099         case "$getprotoent_r_proto" in
15100         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15101         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15102         esac
15103         case "$getprotoent_r_proto" in
15104         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15105         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15106         esac
15107         case "$getprotoent_r_proto" in
15108         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15109         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15110         esac
15111         case "$getprotoent_r_proto" in
15112         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15113         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15114         esac
15115         case "$getprotoent_r_proto" in
15116         ''|0)   d_getprotoent_r=undef
15117                 getprotoent_r_proto=0
15118                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15119         * )     case "$getprotoent_r_proto" in
15120                 REENTRANT_PROTO*) ;;
15121                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15122                 esac
15123                 echo "Prototype: $try" ;;
15124         esac
15125         ;;
15126         *)      case "$usethreads" in
15127                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15128                 esac
15129                 d_getprotoent_r=undef
15130                 getprotoent_r_proto=0
15131                 ;;
15132         esac
15133         ;;
15134 *)      getprotoent_r_proto=0
15135         ;;
15136 esac
15137
15138 : see if prototypes for various getprotoxxx netdb.h functions are available
15139 echo " "
15140 set d_getprotoprotos getprotoent $i_netdb netdb.h
15141 eval $hasproto
15142
15143 : see if getprpwnam exists
15144 set getprpwnam d_getprpwnam
15145 eval $inlibc
15146
15147 : see if getpwent exists
15148 set getpwent d_getpwent
15149 eval $inlibc
15150
15151 : see if getpwent_r exists
15152 set getpwent_r d_getpwent_r
15153 eval $inlibc
15154 case "$d_getpwent_r" in
15155 "$define")
15156         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15157         case "$d_getpwent_r_proto:$usethreads" in
15158         ":define")      d_getpwent_r_proto=define
15159                 set d_getpwent_r_proto getpwent_r $hdrs
15160                 eval $hasproto ;;
15161         *)      ;;
15162         esac
15163         case "$d_getpwent_r_proto" in
15164         define)
15165         case "$getpwent_r_proto" in
15166         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15167         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15168         esac
15169         case "$getpwent_r_proto" in
15170         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15171         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15172         esac
15173         case "$getpwent_r_proto" in
15174         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15175         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15176         esac
15177         case "$getpwent_r_proto" in
15178         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15179         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15180         esac
15181         case "$getpwent_r_proto" in
15182         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15183         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15184         esac
15185         case "$getpwent_r_proto" in
15186         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15187         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15188         esac
15189         case "$getpwent_r_proto" in
15190         ''|0)   d_getpwent_r=undef
15191                 getpwent_r_proto=0
15192                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15193         * )     case "$getpwent_r_proto" in
15194                 REENTRANT_PROTO*) ;;
15195                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15196                 esac
15197                 echo "Prototype: $try" ;;
15198         esac
15199         ;;
15200         *)      case "$usethreads" in
15201                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15202                 esac
15203                 d_getpwent_r=undef
15204                 getpwent_r_proto=0
15205                 ;;
15206         esac
15207         ;;
15208 *)      getpwent_r_proto=0
15209         ;;
15210 esac
15211
15212 : see if getpwnam_r exists
15213 set getpwnam_r d_getpwnam_r
15214 eval $inlibc
15215 case "$d_getpwnam_r" in
15216 "$define")
15217         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15218         case "$d_getpwnam_r_proto:$usethreads" in
15219         ":define")      d_getpwnam_r_proto=define
15220                 set d_getpwnam_r_proto getpwnam_r $hdrs
15221                 eval $hasproto ;;
15222         *)      ;;
15223         esac
15224         case "$d_getpwnam_r_proto" in
15225         define)
15226         case "$getpwnam_r_proto" in
15227         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15228         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15229         esac
15230         case "$getpwnam_r_proto" in
15231         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15232         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15233         esac
15234         case "$getpwnam_r_proto" in
15235         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15236         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15237         esac
15238         case "$getpwnam_r_proto" in
15239         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15240         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15241         esac
15242         case "$getpwnam_r_proto" in
15243         ''|0)   d_getpwnam_r=undef
15244                 getpwnam_r_proto=0
15245                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15246         * )     case "$getpwnam_r_proto" in
15247                 REENTRANT_PROTO*) ;;
15248                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15249                 esac
15250                 echo "Prototype: $try" ;;
15251         esac
15252         ;;
15253         *)      case "$usethreads" in
15254                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15255                 esac
15256                 d_getpwnam_r=undef
15257                 getpwnam_r_proto=0
15258                 ;;
15259         esac
15260         ;;
15261 *)      getpwnam_r_proto=0
15262         ;;
15263 esac
15264
15265 : see if getpwuid_r exists
15266 set getpwuid_r d_getpwuid_r
15267 eval $inlibc
15268 case "$d_getpwuid_r" in
15269 "$define")
15270         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15271         case "$d_getpwuid_r_proto:$usethreads" in
15272         ":define")      d_getpwuid_r_proto=define
15273                 set d_getpwuid_r_proto getpwuid_r $hdrs
15274                 eval $hasproto ;;
15275         *)      ;;
15276         esac
15277         case "$d_getpwuid_r_proto" in
15278         define)
15279         case "$getpwuid_r_proto" in
15280         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15281         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15282         esac
15283         case "$getpwuid_r_proto" in
15284         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15285         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15286         esac
15287         case "$getpwuid_r_proto" in
15288         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15289         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15290         esac
15291         case "$getpwuid_r_proto" in
15292         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15293         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15294         esac
15295         case "$getpwuid_r_proto" in
15296         ''|0)   d_getpwuid_r=undef
15297                 getpwuid_r_proto=0
15298                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15299         * )     case "$getpwuid_r_proto" in
15300                 REENTRANT_PROTO*) ;;
15301                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15302                 esac
15303                 echo "Prototype: $try" ;;
15304         esac
15305         ;;
15306         *)      case "$usethreads" in
15307                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15308                 esac
15309                 d_getpwuid_r=undef
15310                 getpwuid_r_proto=0
15311                 ;;
15312         esac
15313         ;;
15314 *)      getpwuid_r_proto=0
15315         ;;
15316 esac
15317
15318 : Optional checks for getsbyname and getsbyport
15319
15320 : see if getservbyname exists
15321 set getservbyname d_getsbyname
15322 eval $inlibc
15323
15324 : see if getservbyport exists
15325 set getservbyport d_getsbyport
15326 eval $inlibc
15327
15328 : see if getservent exists
15329 set getservent d_getsent
15330 eval $inlibc
15331
15332 : see if getservbyname_r exists
15333 set getservbyname_r d_getservbyname_r
15334 eval $inlibc
15335 case "$d_getservbyname_r" in
15336 "$define")
15337         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15338         case "$d_getservbyname_r_proto:$usethreads" in
15339         ":define")      d_getservbyname_r_proto=define
15340                 set d_getservbyname_r_proto getservbyname_r $hdrs
15341                 eval $hasproto ;;
15342         *)      ;;
15343         esac
15344         case "$d_getservbyname_r_proto" in
15345         define)
15346         case "$getservbyname_r_proto" in
15347         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15348         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15349         esac
15350         case "$getservbyname_r_proto" in
15351         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15352         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15353         esac
15354         case "$getservbyname_r_proto" in
15355         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15356         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15357         esac
15358         case "$getservbyname_r_proto" in
15359         ''|0)   d_getservbyname_r=undef
15360                 getservbyname_r_proto=0
15361                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15362         * )     case "$getservbyname_r_proto" in
15363                 REENTRANT_PROTO*) ;;
15364                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15365                 esac
15366                 echo "Prototype: $try" ;;
15367         esac
15368         ;;
15369         *)      case "$usethreads" in
15370                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15371                 esac
15372                 d_getservbyname_r=undef
15373                 getservbyname_r_proto=0
15374                 ;;
15375         esac
15376         ;;
15377 *)      getservbyname_r_proto=0
15378         ;;
15379 esac
15380
15381 : see if getservbyport_r exists
15382 set getservbyport_r d_getservbyport_r
15383 eval $inlibc
15384 case "$d_getservbyport_r" in
15385 "$define")
15386         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15387         case "$d_getservbyport_r_proto:$usethreads" in
15388         ":define")      d_getservbyport_r_proto=define
15389                 set d_getservbyport_r_proto getservbyport_r $hdrs
15390                 eval $hasproto ;;
15391         *)      ;;
15392         esac
15393         case "$d_getservbyport_r_proto" in
15394         define)
15395         case "$getservbyport_r_proto" in
15396         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15397         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15398         esac
15399         case "$getservbyport_r_proto" in
15400         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15401         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15402         esac
15403         case "$getservbyport_r_proto" in
15404         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15405         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15406         esac
15407         case "$getservbyport_r_proto" in
15408         ''|0)   d_getservbyport_r=undef
15409                 getservbyport_r_proto=0
15410                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15411         * )     case "$getservbyport_r_proto" in
15412                 REENTRANT_PROTO*) ;;
15413                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15414                 esac
15415                 echo "Prototype: $try" ;;
15416         esac
15417         ;;
15418         *)      case "$usethreads" in
15419                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15420                 esac
15421                 d_getservbyport_r=undef
15422                 getservbyport_r_proto=0
15423                 ;;
15424         esac
15425         ;;
15426 *)      getservbyport_r_proto=0
15427         ;;
15428 esac
15429
15430 : see if getservent_r exists
15431 set getservent_r d_getservent_r
15432 eval $inlibc
15433 case "$d_getservent_r" in
15434 "$define")
15435         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15436         case "$d_getservent_r_proto:$usethreads" in
15437         ":define")      d_getservent_r_proto=define
15438                 set d_getservent_r_proto getservent_r $hdrs
15439                 eval $hasproto ;;
15440         *)      ;;
15441         esac
15442         case "$d_getservent_r_proto" in
15443         define)
15444         case "$getservent_r_proto" in
15445         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15446         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15447         esac
15448         case "$getservent_r_proto" in
15449         ''|0) try='int getservent_r(struct servent*, char*, int);'
15450         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15451         esac
15452         case "$getservent_r_proto" in
15453         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15454         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15455         esac
15456         case "$getservent_r_proto" in
15457         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15458         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15459         esac
15460         case "$getservent_r_proto" in
15461         ''|0)   d_getservent_r=undef
15462                 getservent_r_proto=0
15463                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15464         * )     case "$getservent_r_proto" in
15465                 REENTRANT_PROTO*) ;;
15466                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15467                 esac
15468                 echo "Prototype: $try" ;;
15469         esac
15470         ;;
15471         *)      case "$usethreads" in
15472                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15473                 esac
15474                 d_getservent_r=undef
15475                 getservent_r_proto=0
15476                 ;;
15477         esac
15478         ;;
15479 *)      getservent_r_proto=0
15480         ;;
15481 esac
15482
15483 : see if prototypes for various getservxxx netdb.h functions are available
15484 echo " "
15485 set d_getservprotos getservent $i_netdb netdb.h
15486 eval $hasproto
15487
15488 : see if getspnam exists
15489 set getspnam d_getspnam
15490 eval $inlibc
15491
15492 : see if this is a shadow.h system
15493 set shadow.h i_shadow
15494 eval $inhdr
15495
15496 : see if getspnam_r exists
15497 set getspnam_r d_getspnam_r
15498 eval $inlibc
15499 case "$d_getspnam_r" in
15500 "$define")
15501         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15502         case "$d_getspnam_r_proto:$usethreads" in
15503         ":define")      d_getspnam_r_proto=define
15504                 set d_getspnam_r_proto getspnam_r $hdrs
15505                 eval $hasproto ;;
15506         *)      ;;
15507         esac
15508         case "$d_getspnam_r_proto" in
15509         define)
15510         case "$getspnam_r_proto" in
15511         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15512         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15513         esac
15514         case "$getspnam_r_proto" in
15515         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15516         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15517         esac
15518         case "$getspnam_r_proto" in
15519         ''|0)   d_getspnam_r=undef
15520                 getspnam_r_proto=0
15521                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15522         * )     case "$getspnam_r_proto" in
15523                 REENTRANT_PROTO*) ;;
15524                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15525                 esac
15526                 echo "Prototype: $try" ;;
15527         esac
15528         ;;
15529         *)      case "$usethreads" in
15530                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15531                 esac
15532                 d_getspnam_r=undef
15533                 getspnam_r_proto=0
15534                 ;;
15535         esac
15536         ;;
15537 *)      getspnam_r_proto=0
15538         ;;
15539 esac
15540
15541 : see if gettimeofday or ftime exists
15542 set gettimeofday d_gettimeod
15543 eval $inlibc
15544 case "$d_gettimeod" in
15545 "$undef")
15546         set ftime d_ftime 
15547         eval $inlibc
15548         ;;
15549 *)
15550         val="$undef"; set d_ftime; eval $setvar
15551         ;;
15552 esac
15553 case "$d_gettimeod$d_ftime" in
15554 "$undef$undef")
15555         echo " "
15556         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15557         ;;
15558 esac
15559
15560 : see if gmtime_r exists
15561 set gmtime_r d_gmtime_r
15562 eval $inlibc
15563 case "$d_gmtime_r" in
15564 "$define")
15565         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15566         case "$d_gmtime_r_proto:$usethreads" in
15567         ":define")      d_gmtime_r_proto=define
15568                 set d_gmtime_r_proto gmtime_r $hdrs
15569                 eval $hasproto ;;
15570         *)      ;;
15571         esac
15572         case "$d_gmtime_r_proto" in
15573         define)
15574         case "$gmtime_r_proto" in
15575         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15576         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15577         esac
15578         case "$gmtime_r_proto" in
15579         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15580         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15581         esac
15582         case "$gmtime_r_proto" in
15583         ''|0)   d_gmtime_r=undef
15584                 gmtime_r_proto=0
15585                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15586         * )     case "$gmtime_r_proto" in
15587                 REENTRANT_PROTO*) ;;
15588                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15589                 esac
15590                 echo "Prototype: $try" ;;
15591         esac
15592         ;;
15593         *)      case "$usethreads" in
15594                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15595                 esac
15596                 d_gmtime_r=undef
15597                 gmtime_r_proto=0
15598                 ;;
15599         esac
15600         ;;
15601 *)      gmtime_r_proto=0
15602         ;;
15603 esac
15604
15605 : see if hasmntopt exists
15606 set hasmntopt d_hasmntopt
15607 eval $inlibc
15608
15609 : see if this is a netinet/in.h or sys/in.h system
15610 set netinet/in.h i_niin sys/in.h i_sysin
15611 eval $inhdr
15612
15613 : see if arpa/inet.h has to be included
15614 set arpa/inet.h i_arpainet
15615 eval $inhdr
15616
15617 : see if htonl --and friends-- exists
15618 val=''
15619 set htonl val
15620 eval $inlibc
15621
15622 : Maybe they are macros.
15623 case "$val" in
15624 $undef)
15625         $cat >htonl.c <<EOM
15626 #include <stdio.h>
15627 #include <sys/types.h>
15628 #$i_niin I_NETINET_IN
15629 #$i_sysin I_SYS_IN
15630 #$i_arpainet I_ARPA_INET
15631 #ifdef I_NETINET_IN
15632 #include <netinet/in.h>
15633 #endif
15634 #ifdef I_SYS_IN
15635 #include <sys/in.h>
15636 #endif
15637 #ifdef I_ARPA_INET
15638 #include <arpa/inet.h>
15639 #endif
15640 #ifdef htonl
15641 printf("Defined as a macro.");
15642 #endif
15643 EOM
15644         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15645         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15646                 val="$define"
15647                 echo "But it seems to be defined as a macro." >&4
15648         fi
15649         $rm -f htonl.?
15650         ;;
15651 esac
15652 set d_htonl
15653 eval $setvar
15654
15655 : see if hypot exists
15656 set hypot d_hypot
15657 eval $inlibc
15658
15659 : see if ilogb exists
15660 set ilogb d_ilogb
15661 eval $inlibc
15662
15663 : see if ilogbl exists
15664 set ilogbl d_ilogbl
15665 eval $inlibc
15666
15667 : index or strchr
15668 echo " "
15669 if set index val -f; eval $csym; $val; then
15670         if set strchr val -f d_strchr; eval $csym; $val; then
15671                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15672                         val="$define"
15673                         vali="$undef"
15674                         echo "strchr() found." >&4
15675                 else
15676                         val="$undef"
15677                         vali="$define"
15678                         echo "index() found." >&4
15679                 fi
15680         else
15681                 val="$undef"
15682                 vali="$define"
15683                 echo "index() found." >&4
15684         fi
15685 else
15686         if set strchr val -f d_strchr; eval $csym; $val; then
15687                 val="$define"
15688                 vali="$undef"
15689                 echo "strchr() found." >&4
15690         else
15691                 echo "No index() or strchr() found!" >&4
15692                 val="$undef"
15693                 vali="$undef"
15694         fi
15695 fi
15696 set d_strchr; eval $setvar
15697 val="$vali"
15698 set d_index; eval $setvar
15699
15700 : check whether inet_aton exists
15701 set inet_aton d_inetaton
15702 eval $inlibc
15703
15704 : see if inet_ntop exists
15705 set inet_ntop d_inetntop
15706 eval $inlibc
15707
15708 : see if inet_pton exists
15709 set inet_pton d_inetpton
15710 eval $inlibc
15711
15712 : Look for isascii
15713 echo " "
15714 $cat >isascii.c <<EOCP
15715 #include <stdio.h>
15716 #include <ctype.h>
15717 #$i_stdlib I_STDLIB
15718 #ifdef I_STDLIB
15719 #include <stdlib.h>
15720 #endif
15721 int main() {
15722         int c = 'A';
15723         if (isascii(c))
15724                 exit(0);
15725         else
15726                 exit(1);
15727 }
15728 EOCP
15729 set isascii
15730 if eval $compile; then
15731         echo "isascii() found." >&4
15732         val="$define"
15733 else
15734         echo "isascii() NOT found." >&4
15735         val="$undef"
15736 fi
15737 set d_isascii
15738 eval $setvar
15739 $rm -f isascii*
15740
15741 : Look for isblank
15742 echo " "
15743 $cat >isblank.c <<'EOCP'
15744 #include <stdio.h>
15745 #include <ctype.h>
15746 int main() {
15747         int c = ' ';
15748         if (isblank(c))
15749                 return 0 ;
15750         else
15751                 return 1 ;
15752 }
15753 EOCP
15754 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15755         echo "isblank() found." >&4
15756         val="$define"
15757 else
15758         echo "isblank() NOT found." >&4
15759         val="$undef"
15760 fi
15761 set d_isblank
15762 eval $setvar
15763 $rm -f isblank*
15764
15765 : check for isfinite
15766 echo "Checking to see if you have isfinite..." >&4
15767 $cat >try.c <<EOCP
15768 #$i_math I_MATH
15769 #ifdef I_MATH
15770 #include <math.h>
15771 #endif
15772 int main() { return isfinite(0.0); }
15773 EOCP
15774 set try
15775 if eval $compile; then
15776         val="$define"
15777         echo "You have isfinite."
15778 else
15779         val="$undef"
15780         echo "You do not have isfinite."
15781 fi
15782 $rm_try
15783 set d_isfinite
15784 eval $setvar
15785
15786 : see if isfinitel exists
15787 set isfinitel d_isfinitel
15788 eval $inlibc
15789
15790 : check for isinf
15791 echo "Checking to see if you have isinf..." >&4
15792 $cat >try.c <<EOCP
15793 #$i_math I_MATH
15794 #ifdef I_MATH
15795 #include <math.h>
15796 #endif
15797 int main() { return isinf(0.0); }
15798 EOCP
15799 set try
15800 if eval $compile; then
15801         val="$define"
15802         echo "You have isinf."
15803 else
15804         val="$undef"
15805         echo "You do not have isinf."
15806 fi
15807 $rm_try
15808 set d_isinf
15809 eval $setvar
15810
15811 : see if isinfl exists
15812 set isinfl d_isinfl
15813 eval $inlibc
15814
15815 : check for isless
15816 echo "Checking to see if you have isless..." >&4
15817 $cat >try.c <<EOCP
15818 #$i_math I_MATH
15819 #ifdef I_MATH
15820 #include <math.h>
15821 #endif
15822 int main() { return isless(0.0); }
15823 EOCP
15824 set try
15825 if eval $compile; then
15826         val="$define"
15827         echo "You have isless."
15828 else
15829         val="$undef"
15830         echo "You do not have isless."
15831 fi
15832 $rm_try
15833 set d_isless
15834 eval $setvar
15835
15836 : check for isnan
15837 echo "Checking to see if you have isnan..." >&4
15838 $cat >try.c <<EOCP
15839 #$i_math I_MATH
15840 #ifdef I_MATH
15841 #include <math.h>
15842 #endif
15843 int main() { return isnan(0.0); }
15844 EOCP
15845 set try
15846 if eval $compile; then
15847         val="$define"
15848         echo "You have isnan."
15849 else
15850         val="$undef"
15851         echo "You do not have isnan."
15852 fi
15853 $rm_try
15854 set d_isnan
15855 eval $setvar
15856
15857 : see if isnanl exists
15858 set isnanl d_isnanl
15859 eval $inlibc
15860
15861 : check for isnormal
15862 echo "Checking to see if you have isnormal..." >&4
15863 $cat >try.c <<EOCP
15864 #$i_math I_MATH
15865 #ifdef I_MATH
15866 #include <math.h>
15867 #endif
15868 int main() { return isnormal(0.0); }
15869 EOCP
15870 set try
15871 if eval $compile; then
15872         val="$define"
15873         echo "You have isnormal."
15874 else
15875         val="$undef"
15876         echo "You do not have isnormal."
15877 fi
15878 $rm_try
15879 set d_isnormal
15880 eval $setvar
15881
15882 : see if j0 exists
15883 set j0 d_j0
15884 eval $inlibc
15885
15886 : see if j0l exists
15887 set j0l d_j0l
15888 eval $inlibc
15889
15890 : see if killpg exists
15891 set killpg d_killpg
15892 eval $inlibc
15893
15894 : see if localeconv exists
15895 set localeconv d_locconv
15896 eval $inlibc
15897
15898 : see if libc has the POSIX.1-2008 currency locale rules
15899 case "$d_locconv:$d_lc_monetary_2008" in
15900 $define:)
15901         $cat >try.c <<EOCP
15902 #include <locale.h>
15903 int main() {
15904         struct lconv *lc = localeconv();
15905         char int_p_cs_precedes = lc->int_p_cs_precedes;
15906         return 0;
15907 }
15908 EOCP
15909         set try
15910         if eval $compile; then
15911                 d_lc_monetary_2008="$define"
15912         else
15913                 d_lc_monetary_2008="$undef"
15914         fi;
15915         $rm_try
15916         ;;
15917 esac
15918
15919 : see if lchown exists
15920 echo " "
15921 $cat > try.c <<'EOCP'
15922 /* System header to define __stub macros and hopefully few prototypes,
15923     which can conflict with char lchown(); below.  */
15924 #include <assert.h>
15925 /* Override any gcc2 internal prototype to avoid an error.  */
15926 /* We use char because int might match the return type of a gcc2
15927    builtin and then its argument prototype would still apply.  */
15928 char lchown();
15929 int main() {
15930     /*  The GNU C library defines this for functions which it implements
15931         to always fail with ENOSYS.  Some functions are actually named
15932         something starting with __ and the normal name is an alias.  */
15933 #if defined (__stub_lchown) || defined (__stub___lchown)
15934 choke me
15935 #else
15936 lchown();
15937 #endif
15938 ; return 0; }
15939 EOCP
15940 set try
15941 if eval $compile; then
15942     $echo "lchown() found." >&4
15943     val="$define"
15944 else
15945     $echo "lchown() NOT found." >&4
15946     val="$undef"
15947 fi
15948 set d_lchown
15949 eval $setvar
15950
15951 : See if number of significant digits in a double precision number is known
15952 echo " "
15953 $cat >ldbl_dig.c <<EOM
15954 #$i_limits I_LIMITS
15955 #$i_float I_FLOAT
15956 #ifdef I_LIMITS
15957 #include <limits.h>
15958 #endif
15959 #ifdef I_FLOAT
15960 #include <float.h>
15961 #endif
15962 #ifdef LDBL_DIG
15963 printf("Contains LDBL_DIG");
15964 #endif
15965 EOM
15966 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15967 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15968         echo "LDBL_DIG found." >&4
15969         val="$define"
15970 else
15971         echo "LDBL_DIG NOT found." >&4
15972         val="$undef"
15973 fi
15974 $rm -f ldbl_dig.?
15975 set d_ldbl_dig
15976 eval $setvar
15977
15978 : see if lgamma exists
15979 set lgamma d_lgamma
15980 eval $inlibc
15981
15982 : see if lgamma_r exists
15983 set lgamma_r d_lgamma_r
15984 eval $inlibc
15985
15986 : check to see if math.h defines _LIB_VERSION
15987 d_libm_lib_version="$undef"
15988 case $i_math in
15989     $define)
15990         echo " "
15991         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15992         $cat >try.c <<EOCP
15993 #include <unistd.h>
15994 #include <math.h>
15995 int main (int argc, char *argv[])
15996 {
15997     printf ("%d\n", _LIB_VERSION);
15998     return (0);
15999     } /* main */
16000 EOCP
16001         set try
16002         if eval $compile; then
16003             foo=`$run ./try`
16004             echo "Yes, it does ($foo)" >&4
16005             d_libm_lib_version="$define"
16006         else
16007             echo "No, it does not (probably harmless)" >&4
16008             fi
16009         $rm_try
16010         ;;
16011
16012     esac
16013
16014 : see if link exists
16015 set link d_link
16016 eval $inlibc
16017
16018 : see if llrint exists
16019 set llrint d_llrint
16020 eval $inlibc
16021
16022 : see if llround exists
16023 set llround d_llround
16024 eval $inlibc
16025
16026 : see if localtime_r exists
16027 set localtime_r d_localtime_r
16028 eval $inlibc
16029 case "$d_localtime_r" in
16030 "$define")
16031         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16032         case "$d_localtime_r_proto:$usethreads" in
16033         ":define")      d_localtime_r_proto=define
16034                 set d_localtime_r_proto localtime_r $hdrs
16035                 eval $hasproto ;;
16036         *)      ;;
16037         esac
16038         case "$d_localtime_r_proto" in
16039         define)
16040         case "$localtime_r_proto" in
16041         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16042         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16043         esac
16044         case "$localtime_r_proto" in
16045         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16046         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16047         esac
16048         case "$localtime_r_proto" in
16049         ''|0)   d_localtime_r=undef
16050                 localtime_r_proto=0
16051                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16052         * )     case "$localtime_r_proto" in
16053                 REENTRANT_PROTO*) ;;
16054                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16055                 esac
16056                 echo "Prototype: $try" ;;
16057         esac
16058         ;;
16059         *)      case "$usethreads" in
16060                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16061                 esac
16062                 d_localtime_r=undef
16063                 localtime_r_proto=0
16064                 ;;
16065         esac
16066         ;;
16067 *)      localtime_r_proto=0
16068         ;;
16069 esac
16070
16071 : see if localtime_r calls tzset
16072 case "$localtime_r_proto" in
16073 REENTRANT_PROTO*)
16074         $cat >try.c <<EOCP
16075 /*  Does our libc's localtime_r call tzset ?
16076  *  return 0 if so, 1 otherwise.
16077  */
16078 #$i_systypes    I_SYS_TYPES
16079 #$i_unistd      I_UNISTD
16080 #$i_time        I_TIME
16081 #$i_stdlib      I_STDLIB
16082 #$i_string      I_STRING
16083 #$i_malloc      I_MALLOC
16084 #ifdef I_SYS_TYPES
16085 #  include <sys/types.h>
16086 #endif
16087 #ifdef I_UNISTD
16088 #  include <unistd.h>
16089 #endif
16090 #ifdef I_TIME
16091 #  include <time.h>
16092 #endif
16093 #ifdef I_STDLIB
16094 #include <stdlib.h>
16095 #endif
16096 #ifdef I_STRING
16097 #  include <string.h>
16098 #else
16099 #  include <strings.h>
16100 #endif
16101 #ifdef I_MALLOC
16102 #  include <malloc.h>
16103 #endif
16104 int main()
16105 {
16106     time_t t = time(0L);
16107     char w_tz[]="TZ" "=GMT+5",
16108          e_tz[]="TZ" "=GMT-5",
16109         *tz_e = (char*)malloc(16),
16110         *tz_w = (char*)malloc(16);
16111     struct tm tm_e, tm_w;
16112     memset(&tm_e,'\0',sizeof(struct tm));
16113     memset(&tm_w,'\0',sizeof(struct tm));
16114     strcpy(tz_e,e_tz);
16115     strcpy(tz_w,w_tz);
16116
16117     putenv(tz_e);
16118     localtime_r(&t, &tm_e);
16119
16120     putenv(tz_w);
16121     localtime_r(&t, &tm_w);
16122
16123     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16124         return 1;
16125     return 0;
16126 }
16127 EOCP
16128         set try
16129         if eval $compile; then
16130             if $run ./try; then
16131                 d_localtime_r_needs_tzset=undef;
16132             else
16133                 d_localtime_r_needs_tzset=define;
16134             fi;
16135         else
16136             d_localtime_r_needs_tzset=undef;
16137         fi;
16138      ;;
16139   *)
16140      d_localtime_r_needs_tzset=undef;
16141      ;;
16142 esac
16143 $rm_try
16144
16145 : see if lockf exists
16146 set lockf d_lockf
16147 eval $inlibc
16148
16149 : see if log1p exists
16150 set log1p d_log1p
16151 eval $inlibc
16152
16153 : see if log2 exists
16154 set log2 d_log2
16155 eval $inlibc
16156
16157 : see if logb exists
16158 set logb d_logb
16159 eval $inlibc
16160
16161 : see if lrint exists
16162 set lrint d_lrint
16163 eval $inlibc
16164
16165 : see if lround exists
16166 set lround d_lround
16167 eval $inlibc
16168
16169 : see if prototype for lseek is available
16170 echo " "
16171 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16172 eval $hasproto
16173
16174 : see if lstat exists
16175 set lstat d_lstat
16176 eval $inlibc
16177
16178 : see if madvise exists
16179 set madvise d_madvise
16180 eval $inlibc
16181
16182 : see if malloc_size exists
16183 set malloc_size d_malloc_size
16184 eval $inlibc
16185
16186 : see if malloc_size_good exists
16187 set malloc_good_size d_malloc_good_size
16188 eval $inlibc
16189
16190 : see if mblen exists
16191 set mblen d_mblen
16192 eval $inlibc
16193
16194 : see if mbstowcs exists
16195 set mbstowcs d_mbstowcs
16196 eval $inlibc
16197
16198 : see if mbtowc exists
16199 set mbtowc d_mbtowc
16200 eval $inlibc
16201
16202 : see if memchr exists
16203 set memchr d_memchr
16204 eval $inlibc
16205
16206 : see if memcmp exists
16207 set memcmp d_memcmp
16208 eval $inlibc
16209
16210 : see if memcpy exists
16211 set memcpy d_memcpy
16212 eval $inlibc
16213
16214 : see if memmove exists
16215 set memmove d_memmove
16216 eval $inlibc
16217
16218 : see if memset exists
16219 set memset d_memset
16220 eval $inlibc
16221
16222 : see if mkdir exists
16223 set mkdir d_mkdir
16224 eval $inlibc
16225
16226 : see if mkdtemp exists
16227 set mkdtemp d_mkdtemp
16228 eval $inlibc
16229
16230 : see if mkfifo exists
16231 set mkfifo d_mkfifo
16232 eval $inlibc
16233
16234 : see if mkstemp exists
16235 set mkstemp d_mkstemp
16236 eval $inlibc
16237
16238 : see if mkstemps exists
16239 set mkstemps d_mkstemps
16240 eval $inlibc
16241
16242 : see if mktime exists
16243 set mktime d_mktime
16244 eval $inlibc
16245
16246 : see if this is a sys/mman.h system
16247 set sys/mman.h i_sysmman
16248 eval $inhdr
16249
16250 : see if mmap exists
16251 set mmap d_mmap
16252 eval $inlibc
16253 : see what shmat returns
16254 : default to something harmless
16255 mmaptype='void *'
16256 case "$i_sysmman$d_mmap" in
16257 "$define$define")
16258         $cat >mmap.c <<'END'
16259 #include <sys/mman.h>
16260 void *mmap();
16261 END
16262         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16263                 mmaptype='void *'
16264         else
16265                 mmaptype='caddr_t'
16266         fi
16267         echo "and it returns ($mmaptype)." >&4
16268         ;;
16269 esac
16270
16271
16272
16273 : see if sqrtl exists
16274 set sqrtl d_sqrtl
16275 eval $inlibc
16276
16277 : see if scalbnl exists
16278 set scalbnl d_scalbnl
16279 eval $inlibc
16280
16281 : see if truncl exists
16282 set truncl d_truncl
16283 eval $inlibc
16284
16285 : see if modfl exists
16286 set modfl d_modfl
16287 eval $inlibc
16288
16289 : see if prototype for modfl is available
16290 echo " "
16291 set d_modflproto modfl $i_math math.h
16292 eval $hasproto
16293
16294 d_modfl_pow32_bug="$undef"
16295
16296 case "$d_longdbl$d_modfl" in
16297 $define$define)
16298         $cat <<EOM
16299 Checking to see whether your modfl() is okay for large values...
16300 EOM
16301 $cat >try.c <<EOCP
16302 #include <math.h>
16303 #include <stdio.h>
16304 EOCP
16305 if $test "X$d_modflproto" != "X$define"; then
16306         $cat >>try.c <<EOCP
16307 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16308 long double modfl (long double, long double *);
16309 EOCP
16310 fi
16311 $cat >>try.c <<EOCP
16312 int main() {
16313     long double nv = 4294967303.15;
16314     long double v, w;
16315     v = modfl(nv, &w);
16316 #ifdef __GLIBC__
16317     printf("glibc");
16318 #endif
16319     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16320     return 0;
16321 }
16322 EOCP
16323         case "$osname:$gccversion" in
16324         aix:)   saveccflags="$ccflags"
16325                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16326         esac
16327         set try
16328         if eval $compile; then
16329                 foo=`$run ./try`
16330                 case "$foo" in
16331                 *" 4294967303.150000 1.150000 4294967302.000000")
16332                         echo >&4 "Your modfl() is broken for large values."
16333                         d_modfl_pow32_bug="$define"
16334                         case "$foo" in
16335                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16336                         ;;
16337                         esac
16338                         ;;
16339                 *" 4294967303.150000 0.150000 4294967303.000000")
16340                         echo >&4 "Your modfl() seems okay for large values."
16341                         ;;
16342                 *)      echo >&4 "I don't understand your modfl() at all."
16343                         d_modfl="$undef"
16344                         ;;
16345                 esac
16346                 $rm_try
16347         else
16348                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16349                 d_modfl="$undef"
16350         fi
16351         case "$osname:$gccversion" in
16352         aix:)   ccflags="$saveccflags" ;; # restore
16353         esac
16354         ;;
16355 esac
16356
16357 if $test "$uselongdouble" = "$define"; then
16358     message=""
16359     if $test "$d_sqrtl" != "$define"; then
16360         message="$message sqrtl"
16361     fi
16362     if $test "$d_modfl" != "$define"; then
16363         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16364             echo "You have both truncl and copysignl, so I can emulate modfl."
16365         else
16366             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16367                 echo "You have both aintl and copysignl, so I can emulate modfl."
16368             else
16369                 message="$message modfl"
16370             fi
16371         fi
16372     fi
16373     if $test "$d_frexpl" != "$define"; then
16374         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16375             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16376         else
16377             message="$message frexpl"
16378         fi
16379     fi
16380     if $test "$d_ldexpl" != "$define"; then
16381         message="$message ldexpl"
16382     fi
16383
16384     if $test "$message" != ""; then
16385         $cat <<EOM >&4
16386
16387 *** You requested the use of long doubles but you do not seem to have
16388 *** the following mathematical functions needed for long double support:
16389 ***    $message
16390 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16391 *** Cannot continue, aborting.
16392
16393 EOM
16394
16395         exit 1
16396     fi
16397 fi
16398
16399 : see if mprotect exists
16400 set mprotect d_mprotect
16401 eval $inlibc
16402
16403 : see if msgctl exists
16404 set msgctl d_msgctl
16405 eval $inlibc
16406
16407 : see if msgget exists
16408 set msgget d_msgget
16409 eval $inlibc
16410
16411 : see if msgsnd exists
16412 set msgsnd d_msgsnd
16413 eval $inlibc
16414
16415 : see if msgrcv exists
16416 set msgrcv d_msgrcv
16417 eval $inlibc
16418
16419 : see how much of the 'msg*(2)' library is present.
16420 h_msg=true
16421 echo " "
16422 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16423 *"$undef"*) h_msg=false;;
16424 esac
16425 case "$osname" in
16426 freebsd)
16427     case "`ipcs 2>&1`" in
16428     "SVID messages"*"not configured"*)
16429         echo "Your $osname does not have the msg*(2) configured." >&4
16430         h_msg=false
16431         val="$undef"
16432         set msgctl d_msgctl
16433         eval $setvar
16434         set msgget d_msgget
16435         eval $setvar
16436         set msgsnd d_msgsnd
16437         eval $setvar
16438         set msgrcv d_msgrcv
16439         eval $setvar
16440         ;;
16441     esac
16442     ;;
16443 esac
16444 : we could also check for sys/ipc.h ...
16445 if $h_msg && $test `./findhdr sys/msg.h`; then
16446         echo "You have the full msg*(2) library." >&4
16447         val="$define"
16448 else
16449         echo "You don't have the full msg*(2) library." >&4
16450         val="$undef"
16451 fi
16452 set d_msg
16453 eval $setvar
16454
16455 : Check for msghdr_s
16456 echo " "
16457 echo "Checking to see if your system supports struct msghdr..." >&4
16458 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16459 eval $hasstruct
16460 case "$d_msghdr_s" in
16461 "$define")      echo "Yes, it does."   ;;
16462 *)              echo "No, it doesn't." ;;
16463 esac
16464
16465
16466 : see if msync exists
16467 set msync d_msync
16468 eval $inlibc
16469
16470 : see if munmap exists
16471 set munmap d_munmap
16472 eval $inlibc
16473
16474 : see if nan exists
16475 set nan d_nan
16476 eval $inlibc
16477
16478 : see if nearbyint exists
16479 set nearbyint d_nearbyint
16480 eval $inlibc
16481
16482 : see if nextafter exists
16483 set nextafter d_nextafter
16484 eval $inlibc
16485
16486 : see if nexttoward exists
16487 set nexttoward d_nexttoward
16488 eval $inlibc
16489
16490 : see if nice exists
16491 set nice d_nice
16492 eval $inlibc
16493
16494 : see if this is a langinfo.h system
16495 set langinfo.h i_langinfo
16496 eval $inhdr
16497
16498 : see if nl_langinfo exists
16499 set nl_langinfo d_nl_langinfo
16500 eval $inlibc
16501
16502 : see if this is a quadmath.h system
16503 set quadmath.h i_quadmath
16504 eval $inhdr
16505
16506 : check for volatile keyword
16507 echo " "
16508 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16509 $cat >try.c <<'EOCP'
16510 int main()
16511 {
16512         typedef struct _goo_struct goo_struct;
16513         goo_struct * volatile goo = ((goo_struct *)0);
16514         struct _goo_struct {
16515                 long long_int;
16516                 int reg_int;
16517                 char char_var;
16518         };
16519         typedef unsigned short foo_t;
16520         char *volatile foo;
16521         volatile int bar;
16522         volatile foo_t blech;
16523         foo = foo;
16524 }
16525 EOCP
16526 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16527         val="$define"
16528         echo "Yup, it does."
16529 else
16530         val="$undef"
16531         echo "Nope, it doesn't."
16532 fi
16533 set d_volatile
16534 eval $setvar
16535 $rm_try
16536
16537 : Check basic sizes
16538 echo " "
16539 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16540
16541 case "$use64bitint:$d_quad:$quadtype" in
16542 define:define:?*)
16543         ivtype="$quadtype"
16544         uvtype="$uquadtype"
16545         ivsize=8
16546         uvsize=8
16547         ;;
16548 *)      ivtype="long"
16549         uvtype="unsigned long"
16550         ivsize=$longsize
16551         uvsize=$longsize
16552         ;;
16553 esac
16554
16555 case "$uselongdouble:$d_longdbl" in
16556 define:define)
16557         nvtype="long double"
16558         nvsize=$longdblsize
16559         ;;
16560 *)      nvtype=double
16561         nvsize=$doublesize
16562         ;;
16563 esac
16564
16565 case "$usequadmath:$i_quadmath" in
16566 define:define)
16567   nvtype="__float128"
16568   nvsize=16
16569   case "$libs" in
16570   *quadmath*) ;;
16571   *) $cat <<EOM >&4
16572
16573 *** You requested the use of the quadmath library, but you
16574 *** do not seem to have the quadmath library installed.
16575 *** Cannot continue, aborting.
16576 EOM
16577     exit 1
16578     ;;
16579   esac
16580   ;;
16581 define:*) $cat <<EOM >&4
16582
16583 *** You requested the use of the quadmath library, but you
16584 *** do not seem to have the required header, <quadmath.h>.
16585 EOM
16586   case "$gccversion" in
16587   [23].*|4.[0-5]*)
16588    $cat <<EOM >&4
16589 *** Your gcc looks a bit old:
16590 *** $gccversion
16591 EOM
16592     ;;
16593   '')
16594    $cat <<EOM >&4
16595 *** You are not running a gcc.
16596 EOM
16597     ;;
16598   esac
16599   $cat <<EOM >&4
16600 *** For the quadmath library you need at least gcc 4.6.
16601 *** Cannot continue, aborting.
16602 EOM
16603   exit 1
16604   ;;
16605 esac
16606
16607 $echo "(IV will be "$ivtype", $ivsize bytes)"
16608 $echo "(UV will be "$uvtype", $uvsize bytes)"
16609 $echo "(NV will be "$nvtype", $nvsize bytes)"
16610
16611 $cat >try.c <<EOCP
16612 #$i_inttypes I_INTTYPES
16613 #ifdef I_INTTYPES
16614 #include <inttypes.h>
16615 #endif
16616 #include <stdio.h>
16617 int main() {
16618 #ifdef INT8
16619    int8_t i =  INT8_MAX;
16620   uint8_t u = UINT8_MAX;
16621   printf("int8_t\n");
16622 #endif
16623 #ifdef INT16
16624    int16_t i =  INT16_MAX;
16625   uint16_t u = UINT16_MAX;
16626   printf("int16_t\n");
16627 #endif
16628 #ifdef INT32
16629    int32_t i =  INT32_MAX;
16630   uint32_t u = UINT32_MAX;
16631   printf("int32_t\n");
16632 #endif
16633 }
16634 EOCP
16635
16636 i8type="signed char"
16637 u8type="unsigned char"
16638 i8size=1
16639 u8size=1
16640
16641 case "$i16type" in
16642 '')     case "$shortsize" in
16643         2)      i16type=short
16644                 u16type="unsigned short"
16645                 i16size=$shortsize
16646                 u16size=$shortsize
16647                 ;;
16648         esac
16649         ;;
16650 esac
16651 case "$i16type" in
16652 '')     set try -DINT16
16653         if eval $compile; then
16654                 case "`$run ./try`" in
16655                 int16_t)
16656                         i16type=int16_t
16657                         u16type=uint16_t
16658                         i16size=2
16659                         u16size=2
16660                         ;;
16661                 esac
16662         fi
16663         ;;
16664 esac
16665 case "$i16type" in
16666 '')     if $test $shortsize -ge 2; then
16667                 i16type=short
16668                 u16type="unsigned short"
16669                 i16size=$shortsize
16670                 u16size=$shortsize
16671         fi
16672         ;;
16673 esac
16674
16675 case "$i32type" in
16676 '')     case "$longsize" in
16677         4)      i32type=long
16678                 u32type="unsigned long"
16679                 i32size=$longsize
16680                 u32size=$longsize
16681                 ;;
16682         *)      case "$intsize" in
16683                 4)      i32type=int
16684                         u32type="unsigned int"
16685                         i32size=$intsize
16686                         u32size=$intsize
16687                         ;;
16688                 esac
16689                 ;;
16690         esac
16691         ;;
16692 esac
16693 case "$i32type" in
16694 '')     set try -DINT32
16695         if eval $compile; then
16696                 case "`$run ./try`" in
16697                 int32_t)
16698                         i32type=int32_t
16699                         u32type=uint32_t
16700                         i32size=4
16701                         u32size=4
16702                         ;;
16703                 esac
16704         fi
16705         ;;
16706 esac
16707 case "$i32type" in
16708 '')     if $test $intsize -ge 4; then
16709                 i32type=int
16710                 u32type="unsigned int"
16711                 i32size=$intsize
16712                 u32size=$intsize
16713         fi
16714         ;;
16715 esac
16716
16717 case "$i64type" in
16718 '')     case "$d_quad:$quadtype" in
16719         define:?*)
16720                 i64type="$quadtype"
16721                 u64type="$uquadtype"
16722                 i64size=8
16723                 u64size=8
16724                 ;;
16725         esac
16726         ;;
16727 esac
16728
16729 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16730 : volatile so that the compiler has to store it out to memory.
16731 if test X"$d_volatile" = X"$define"; then
16732         volatile=volatile
16733 fi
16734 $cat <<EOP >try.c
16735 #include <stdio.h>
16736 #$i_stdlib I_STDLIB
16737 #ifdef I_STDLIB
16738 #include <stdlib.h>
16739 #endif
16740 #include <sys/types.h>
16741 #include <signal.h>
16742 #ifdef SIGFPE
16743 $volatile int bletched = 0;
16744 $signal_t blech(int s) { bletched = 1; }
16745 #endif
16746 int main() {
16747     $uvtype u = 0;
16748     $nvtype d;
16749     int     n = 8 * $uvsize;
16750     int     i;
16751 #ifdef SIGFPE
16752     signal(SIGFPE, blech);
16753 #endif
16754
16755     for (i = 0; i < n; i++) {
16756       u = u << 1 | ($uvtype)1;
16757       d = ($nvtype)u;
16758       if (($uvtype)d != u)
16759         break;
16760       if (d <= 0)
16761         break;
16762       d = ($nvtype)(u - 1);
16763       if (($uvtype)d != (u - 1))
16764         break;
16765 #ifdef SIGFPE
16766       if (bletched)
16767         break;
16768 #endif
16769     }
16770     printf("%d\n", ((i == n) ? -n : i));
16771     exit(0);
16772 }
16773 EOP
16774 set try
16775
16776 d_nv_preserves_uv="$undef"
16777 if eval $compile; then
16778         nv_preserves_uv_bits="`$run ./try`"
16779 fi
16780 case "$nv_preserves_uv_bits" in
16781 \-[1-9]*)
16782         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16783         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16784         d_nv_preserves_uv="$define"
16785         ;;
16786 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16787         d_nv_preserves_uv="$undef" ;;
16788 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16789         nv_preserves_uv_bits="0" ;;
16790 esac
16791 $rm_try
16792
16793 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16794 : volatile so that the compiler has to store it out to memory.
16795 if test X"$d_volatile" = X"$define"; then
16796         volatile=volatile
16797 fi
16798 $cat <<EOP >try.c
16799 #include <stdio.h>
16800
16801 typedef $nvtype NV;
16802
16803 int
16804 main() {
16805   NV value = 2;
16806   int count = 1;
16807
16808   while(count < 256) {
16809     $volatile NV up = value + 1.0;
16810     $volatile NV negated = -value;
16811     $volatile NV down = negated - 1.0;
16812     $volatile NV got_up = up - value;
16813     int up_good = got_up == 1.0;
16814     int got_down = down - negated;
16815     int down_good = got_down == -1.0;
16816
16817     if (down_good != up_good) {
16818       fprintf(stderr,
16819               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16820               up_good, (double) got_up, down_good, (double) got_down,
16821               count, (double) value);
16822       return 1;
16823     }
16824     if (!up_good) {
16825       while (1) {
16826         if (count > 8) {
16827           count -= 8;
16828           fputs("256.0", stdout);
16829         } else {
16830           count--;
16831           fputs("2.0", stdout);
16832         }
16833         if (!count) {
16834           puts("");
16835           return 0;
16836         }
16837         fputs("*", stdout);
16838       }
16839     }
16840     value *= 2;
16841     ++count;
16842   }
16843   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16844           count, (double) value);
16845   return 1;
16846 }
16847 EOP
16848 set try
16849
16850 nv_overflows_integers_at='0'
16851 if eval $compile; then
16852     xxx="`$run ./try`"
16853     case "$?" in
16854         0)
16855             case "$xxx" in
16856                 2*)  cat >&4 <<EOM
16857 The largest integer your NVs can preserve is equal to $xxx
16858 EOM
16859                     nv_overflows_integers_at="$xxx"
16860                     ;;
16861                 *)  cat >&4 <<EOM
16862 Cannot determine the largest integer value your NVs can hold, unexpected output
16863 '$xxx'
16864 EOM
16865                     ;;
16866             esac
16867             ;;
16868         *)  cat >&4 <<EOM
16869 Cannot determine the largest integer value your NVs can hold
16870 EOM
16871             ;;
16872     esac
16873 fi
16874 $rm_try
16875
16876 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16877 : volatile so that the compiler has to store it out to memory.
16878 if test X"$d_volatile" = X"$define"; then
16879         volatile=volatile
16880 fi
16881 $cat <<EOP >try.c
16882 #include <stdio.h>
16883 #$i_stdlib I_STDLIB
16884 #ifdef I_STDLIB
16885 #include <stdlib.h>
16886 #endif
16887 #$i_string I_STRING
16888 #ifdef I_STRING
16889 #  include <string.h>
16890 #else
16891 #  include <strings.h>
16892 #endif
16893 #include <sys/types.h>
16894 #include <signal.h>
16895 #ifdef SIGFPE
16896 $volatile int bletched = 0;
16897 $signal_t blech(int s) { bletched = 1; }
16898 #endif
16899
16900 int checkit($nvtype d, char *where) {
16901     unsigned char *p = (char *)&d;
16902     unsigned char *end = p + sizeof(d);
16903     int fail = 0;
16904
16905     while (p < end)
16906         fail += *p++;
16907
16908     if (!fail)
16909         return 0;
16910
16911     p = (char *)&d;
16912     printf("No - %s: 0x", where);
16913     while (p < end)
16914         printf ("%02X", *p++);
16915     printf("\n");
16916     return 1;
16917 }
16918
16919 int main(int argc, char **argv) {
16920     $nvtype d = 0.0;
16921     int fail = 0;
16922     fail += checkit(d, "0.0");
16923
16924     /* The compiler shouldn't be assuming that bletched is 0  */
16925     d = bletched;
16926
16927     fail += checkit(d, "bleched");
16928
16929 #ifdef SIGFPE
16930     signal(SIGFPE, blech);
16931 #endif
16932
16933     /* Paranoia - the compiler should have no way of knowing that ANSI says
16934        that argv[argc] will always be NULL.  Actually, if it did assume this it
16935        would be buggy, as this is C and main() can be called from elsewhere in
16936        the program.  */
16937     d = argv[argc] ? 1 : 0;
16938
16939     if (d) {
16940         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16941     }
16942
16943     fail += checkit(d, "ternary");
16944
16945     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16946
16947     if (d != 0.0) {
16948         printf("No - memset doesn't give 0.0\n");
16949         /* This might just blow up:  */
16950         printf("(gives %g)\n", d);
16951         return 1;
16952     }
16953
16954 #ifdef SIGFPE
16955     if (bletched) {
16956         printf("No - something bleched\n");
16957         return 1;
16958     }
16959 #endif
16960     if (fail) {
16961       printf("No - %d fail(s)\n", fail);
16962       return 1;
16963     }
16964     printf("Yes\n");
16965     return 0;
16966 }
16967 EOP
16968 set try
16969
16970 d_nv_zero_is_allbits_zero="$undef"
16971 if eval $compile; then
16972     xxx="`$run ./try`"
16973     case "$?" in
16974         0)
16975             case "$xxx" in
16976                 Yes)  cat >&4 <<EOM
16977 0.0 is represented as all bits zero in memory
16978 EOM
16979                     d_nv_zero_is_allbits_zero="$define"
16980                     ;;
16981                 *)  cat >&4 <<EOM
16982 0.0 is not represented as all bits zero in memory
16983 EOM
16984                     d_nv_zero_is_allbits_zero="$undef"
16985                     ;;
16986             esac
16987             ;;
16988         *)  cat >&4 <<EOM
16989 0.0 is not represented as all bits zero in memory
16990 EOM
16991             d_nv_zero_is_allbits_zero="$undef"
16992             ;;
16993     esac
16994 fi
16995 $rm_try
16996
16997 : check for off64_t
16998 echo " "
16999 echo "Checking to see if you have off64_t..." >&4
17000 $cat >try.c <<EOCP
17001 #include <sys/types.h>
17002 #include <unistd.h>
17003 int main() { off64_t x = 7; }
17004 EOCP
17005 set try
17006 if eval $compile; then
17007         val="$define"
17008         echo "You have off64_t."
17009 else
17010         val="$undef"
17011         echo "You do not have off64_t."
17012         case "$lseeksize" in
17013         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17014         esac
17015 fi
17016 $rm_try
17017 set d_off64_t
17018 eval $setvar
17019
17020 : how to create joinable pthreads
17021 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17022         echo " "
17023         echo "Checking what constant to use for creating joinable pthreads..." >&4
17024         $cat >try.c <<'EOCP'
17025 #include <pthread.h>
17026 int main() {
17027     int detachstate = JOINABLE;
17028 }
17029 EOCP
17030         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17031         if eval $compile; then
17032                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17033                 val="$undef" # Yes, undef.
17034                 set d_old_pthread_create_joinable
17035                 eval $setvar
17036                 val=""
17037                 set old_pthread_create_joinable
17038                 eval $setvar
17039         else
17040                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17041                 if eval $compile; then
17042                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17043                         val="$define"
17044                         set d_old_pthread_create_joinable
17045                         eval $setvar
17046                         val=PTHREAD_CREATE_UNDETACHED
17047                         set old_pthread_create_joinable
17048                         eval $setvar
17049                 else
17050                         set try -DJOINABLE=__UNDETACHED
17051                         if eval $compile; then
17052                                 echo "You seem to use __UNDETACHED." >&4
17053                                 val="$define"
17054                                 set d_old_pthread_create_joinable
17055                                 eval $setvar
17056                                 val=__UNDETACHED
17057                                 set old_pthread_create_joinable
17058                                 eval $setvar
17059                         else
17060                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17061                                 val="$define"
17062                                 set d_old_pthread_create_joinable
17063                                 eval $setvar
17064                                 val=0
17065                                 set old_pthread_create_joinable
17066                                 eval $setvar
17067                         fi
17068                 fi
17069         fi
17070         $rm_try
17071 else
17072     d_old_pthread_create_joinable="$undef"
17073     old_pthread_create_joinable=""
17074 fi
17075
17076 : see if pause exists
17077 set pause d_pause
17078 eval $inlibc
17079
17080 : see if poll exists
17081 set poll d_poll
17082 eval $inlibc
17083
17084 : see if prctl exists
17085 set prctl d_prctl
17086 eval $inlibc
17087
17088 : see if prctl supports PR_SET_NAME
17089 d_prctl_set_name=$undef
17090 case $d_prctl in
17091     $define)
17092         $cat >try.c <<EOM
17093 #ifdef __ANDROID__
17094 #include <unistd.h>
17095 #endif
17096 #include <sys/prctl.h>
17097
17098 int main (int argc, char *argv[])
17099 {
17100     return (prctl (PR_SET_NAME, "Test"));
17101     } /* main */
17102 EOM
17103         set try
17104         if eval $compile_ok && $run ./try; then
17105             echo "Your prctl (PR_SET_NAME, ...) works"
17106             d_prctl_set_name=$define
17107             fi
17108         $rm_try
17109         ;;
17110     esac
17111
17112 : see if readlink exists
17113 set readlink d_readlink
17114 eval $inlibc
17115
17116 : Check if exe is symlink to abs path of executing program
17117 echo " "
17118 procselfexe=''
17119 val="$undef"
17120 case "$d_readlink" in
17121     "$define")
17122         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17123         : more tidy to avoid an extra level of symlink
17124         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17125         while test $# -gt 0; do
17126             type=$1; try=$2
17127             shift; shift
17128             if $issymlink $try; then
17129                 $ls -l $try > reflect
17130                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17131                     echo "You have $type-like $try."
17132                     procselfexe='"'$try'"'
17133                     val="$define"
17134                     : This will break out of the loop
17135                     set X; shift
17136                 fi
17137             fi
17138         done
17139         ;;
17140 esac
17141 $rm -f reflect
17142 set d_procselfexe
17143 eval $setvar
17144
17145 : backward compatibility for d_hvfork
17146 if test X$d_hvfork != X; then
17147         d_vfork="$d_hvfork"
17148         d_hvfork=''
17149 fi
17150 : see if there is a vfork
17151 val=''
17152 set vfork val
17153 eval $inlibc
17154
17155 d_pseudofork=$undef
17156
17157 : Ok, but do we want to use it. vfork is reportedly unreliable in
17158 : perl on Solaris 2.x, and probably elsewhere.
17159 case "$val" in
17160 $define)
17161         echo " "
17162         case "$usevfork" in
17163         false) dflt='n';;
17164         *) dflt='y';;
17165         esac
17166         cat <<'EOM'
17167
17168 Perl can only use a vfork() that doesn't suffer from strict
17169 restrictions on calling functions or modifying global data in
17170 the child.  For example, glibc-2.1 contains such a vfork()
17171 that is unsuitable.  If your system provides a proper fork()
17172 call, chances are that you do NOT want perl to use vfork().
17173
17174 EOM
17175         rp="Do you still want to use vfork()?"
17176         . ./myread
17177         case "$ans" in
17178         y|Y) ;;
17179         *)
17180                 echo "Ok, we won't use vfork()."
17181                 val="$undef"
17182                 ;;
17183         esac
17184         ;;
17185 esac
17186 set d_vfork
17187 eval $setvar
17188 case "$d_vfork" in
17189 $define) usevfork='true';;
17190 *) usevfork='false';;
17191 esac
17192
17193 : see whether the pthread_atfork exists
17194 $cat >try.c <<EOP
17195 #include <pthread.h>
17196 #include <stdio.h>
17197 int main() {
17198 #ifdef  PTHREAD_ATFORK
17199         pthread_atfork(NULL,NULL,NULL);
17200 #endif
17201 }
17202 EOP
17203
17204 : see if pthread_atfork exists
17205 set try -DPTHREAD_ATFORK
17206 if eval $compile; then
17207     val="$define"
17208 else
17209     val="$undef"
17210 fi
17211 case "$usethreads" in
17212 $define)
17213         case "$val" in
17214         $define) echo 'pthread_atfork found.' >&4        ;;
17215         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17216         esac
17217 esac
17218 set d_pthread_atfork
17219 eval $setvar
17220
17221 : see if pthread_attr_setscope exists
17222 set pthread_attr_setscope d_pthread_attr_setscope
17223 eval $inlibc
17224
17225 : see whether the various POSIXish _yields exist
17226 $cat >try.c <<EOP
17227 #include <pthread.h>
17228 #include <stdio.h>
17229 int main() {
17230 #ifdef SCHED_YIELD
17231         sched_yield();
17232 #else
17233 #ifdef PTHREAD_YIELD
17234         pthread_yield();
17235 #else
17236 #ifdef PTHREAD_YIELD_NULL
17237         pthread_yield(NULL);
17238 #endif
17239 #endif
17240 #endif
17241 }
17242 EOP
17243 : see if sched_yield exists
17244 set try -DSCHED_YIELD
17245 if eval $compile; then
17246     val="$define"
17247     sched_yield='sched_yield()'
17248 else
17249     val="$undef"
17250 fi
17251 case "$usethreads" in
17252 $define)
17253         case "$val" in
17254         $define) echo 'sched_yield() found.' >&4        ;;
17255         *)       echo 'sched_yield() NOT found.' >&4    ;;
17256         esac
17257 esac
17258 set d_sched_yield
17259 eval $setvar
17260
17261 : see if pthread_yield exists
17262 set try -DPTHREAD_YIELD
17263 if eval $compile; then
17264     val="$define"
17265     case "$sched_yield" in
17266     '') sched_yield='pthread_yield()' ;;
17267     esac
17268 else
17269     set try -DPTHREAD_YIELD_NULL
17270     if eval $compile; then
17271         val="$define"
17272         case "$sched_yield" in
17273         '') sched_yield='pthread_yield(NULL)' ;;
17274         esac
17275     else
17276         val="$undef"
17277     fi
17278 fi
17279 case "$usethreads" in
17280 $define)
17281         case "$val" in
17282         $define) echo 'pthread_yield() found.' >&4      ;;
17283         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17284         esac
17285         ;;
17286 esac
17287 set d_pthread_yield
17288 eval $setvar
17289 case "$sched_yield" in
17290 '') sched_yield=undef ;;
17291 esac
17292 $rm_try
17293
17294 : check for ptrdiff_t
17295 echo " "
17296 echo "Checking to see if you have ptrdiff_t..." >&4
17297 $cat >try.c <<EOCP
17298 #include <stddef.h>
17299 int main() { ptrdiff_t x = 7; }
17300 EOCP
17301 set try
17302 if eval $compile; then
17303         val="$define"
17304         echo "You have ptrdiff_t."
17305 else
17306         val="$undef"
17307         echo "You do not have ptrdiff_t."
17308 fi
17309 $rm_try
17310 set d_ptrdiff_t
17311 eval $setvar
17312
17313 : see if random_r exists
17314 set random_r d_random_r
17315 eval $inlibc
17316 case "$d_random_r" in
17317 "$define")
17318         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17319         case "$d_random_r_proto:$usethreads" in
17320         ":define")      d_random_r_proto=define
17321                 set d_random_r_proto random_r $hdrs
17322                 eval $hasproto ;;
17323         *)      ;;
17324         esac
17325         case "$d_random_r_proto" in
17326         define)
17327         case "$random_r_proto" in
17328         ''|0) try='int random_r(int*, struct random_data*);'
17329         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17330         esac
17331         case "$random_r_proto" in
17332         ''|0) try='int random_r(long*, struct random_data*);'
17333         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17334         esac
17335         case "$random_r_proto" in
17336         ''|0) try='int random_r(struct random_data*, int32_t*);'
17337         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17338         esac
17339         case "$random_r_proto" in
17340         ''|0)   d_random_r=undef
17341                 random_r_proto=0
17342                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17343         * )     case "$random_r_proto" in
17344                 REENTRANT_PROTO*) ;;
17345                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17346                 esac
17347                 echo "Prototype: $try" ;;
17348         esac
17349         ;;
17350         *)      case "$usethreads" in
17351                 define) echo "random_r has no prototype, not using it." >&4 ;;
17352                 esac
17353                 d_random_r=undef
17354                 random_r_proto=0
17355                 ;;
17356         esac
17357         ;;
17358 *)      random_r_proto=0
17359         ;;
17360 esac
17361
17362 : see if readdir and friends exist
17363 set readdir d_readdir
17364 eval $inlibc
17365 set seekdir d_seekdir
17366 eval $inlibc
17367 set telldir d_telldir
17368 eval $inlibc
17369 set rewinddir d_rewinddir
17370 eval $inlibc
17371
17372 : see if readdir64_r exists
17373 set readdir64_r d_readdir64_r
17374 eval $inlibc
17375 case "$d_readdir64_r" in
17376 "$define")
17377         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17378         case "$d_readdir64_r_proto:$usethreads" in
17379         ":define")      d_readdir64_r_proto=define
17380                 set d_readdir64_r_proto readdir64_r $hdrs
17381                 eval $hasproto ;;
17382         *)      ;;
17383         esac
17384         case "$d_readdir64_r_proto" in
17385         define)
17386         case "$readdir64_r_proto" in
17387         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17388         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17389         esac
17390         case "$readdir64_r_proto" in
17391         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17392         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17393         esac
17394         case "$readdir64_r_proto" in
17395         ''|0)   d_readdir64_r=undef
17396                 readdir64_r_proto=0
17397                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17398         * )     case "$readdir64_r_proto" in
17399                 REENTRANT_PROTO*) ;;
17400                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17401                 esac
17402                 echo "Prototype: $try" ;;
17403         esac
17404         ;;
17405         *)      case "$usethreads" in
17406                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17407                 esac
17408                 d_readdir64_r=undef
17409                 readdir64_r_proto=0
17410                 ;;
17411         esac
17412         ;;
17413 *)      readdir64_r_proto=0
17414         ;;
17415 esac
17416
17417 : see if readdir_r exists
17418 set readdir_r d_readdir_r
17419 eval $inlibc
17420 case "$d_readdir_r" in
17421 "$define")
17422         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17423         case "$d_readdir_r_proto:$usethreads" in
17424         ":define")      d_readdir_r_proto=define
17425                 set d_readdir_r_proto readdir_r $hdrs
17426                 eval $hasproto ;;
17427         *)      ;;
17428         esac
17429         case "$d_readdir_r_proto" in
17430         define)
17431         case "$readdir_r_proto" in
17432         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17433         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17434         esac
17435         case "$readdir_r_proto" in
17436         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17437         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17438         esac
17439         case "$readdir_r_proto" in
17440         ''|0)   d_readdir_r=undef
17441                 readdir_r_proto=0
17442                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17443         * )     case "$readdir_r_proto" in
17444                 REENTRANT_PROTO*) ;;
17445                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17446                 esac
17447                 echo "Prototype: $try" ;;
17448         esac
17449         ;;
17450         *)      case "$usethreads" in
17451                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17452                 esac
17453                 d_readdir_r=undef
17454                 readdir_r_proto=0
17455                 ;;
17456         esac
17457         ;;
17458 *)      readdir_r_proto=0
17459         ;;
17460 esac
17461
17462 : see if readv exists
17463 set readv d_readv
17464 eval $inlibc
17465
17466 : see if recvmsg exists
17467 set recvmsg d_recvmsg
17468 eval $inlibc
17469
17470 : see if regcomp, regcmp, or re_comp exist, for regular pattern matching
17471 echo " "
17472 if set regcomp val -f d_regcomp; eval $csym; $val; then
17473         echo 'regcomp() found.' >&4
17474         d_regcomp="$define"
17475         d_regcmp="$undef"
17476         d_re_comp="$undef"
17477 elif set regcmp val -f d_regcmp; eval $csym; $val; then
17478         echo 'regcmp() found.' >&4
17479         d_regcmp="$define"
17480         d_regcomp="$undef"
17481         d_re_comp="$undef"
17482 elif set re_comp val -f d_re_comp; eval $csym; $val; then
17483         echo 're_comp() found, assuming re_exec() also exists.' >&4
17484         d_re_comp="$define"
17485         d_regcomp="$undef"
17486         d_regcmp="$undef"
17487 else
17488         $cat >&4 <<EOM
17489 No regcomp(), regcmp() nor re_comp() found !! No regular pattern matching.
17490 EOM
17491         d_regcmp="$undef"
17492         d_re_comp="$undef"
17493         d_regcomp="$undef"
17494 fi
17495
17496 : see if remainder exists
17497 set remainder d_remainder
17498 eval $inlibc
17499
17500 : see if remquo exists
17501 set remquo d_remquo
17502 eval $inlibc
17503
17504 : see if rename exists
17505 set rename d_rename
17506 eval $inlibc
17507
17508 : see if rint exists
17509 set rint d_rint
17510 eval $inlibc
17511
17512 : see if rmdir exists
17513 set rmdir d_rmdir
17514 eval $inlibc
17515
17516 : see if round exists
17517 set round d_round
17518 eval $inlibc
17519
17520 : see if memory.h is available.
17521 val=''
17522 set memory.h val
17523 eval $inhdr
17524
17525 : See if it conflicts with string.h
17526 case "$val" in
17527 $define)
17528         case "$strings" in
17529         '') ;;
17530         *)
17531                 $cppstdin $cppflags $cppminus < $strings > mem.h
17532                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17533                         echo " "
17534                         echo "We won't be including <memory.h>."
17535                         val="$undef"
17536                 fi
17537                 $rm -f mem.h
17538                 ;;
17539         esac
17540 esac
17541 set i_memory
17542 eval $setvar
17543
17544 : can bcopy handle overlapping blocks?
17545 echo " "
17546 val="$undef"
17547 case "$d_memmove" in
17548 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17549 *)      case "$d_bcopy" in
17550         "$define")
17551                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17552                 $cat >try.c <<EOCP
17553 #$i_memory I_MEMORY
17554 #$i_stdlib I_STDLIB
17555 #$i_string I_STRING
17556 #$i_unistd I_UNISTD
17557 EOCP
17558         $cat >>try.c <<'EOCP'
17559 #include <stdio.h>
17560 #ifdef I_MEMORY
17561 #  include <memory.h>
17562 #endif
17563 #ifdef I_STDLIB
17564 #  include <stdlib.h>
17565 #endif
17566 #ifdef I_STRING
17567 #  include <string.h>
17568 #else
17569 #  include <strings.h>
17570 #endif
17571 #ifdef I_UNISTD
17572 #  include <unistd.h>  /* Needed for NetBSD */
17573 #endif
17574 int main()
17575 {
17576 char buf[128], abc[128];
17577 char *b;
17578 int len;
17579 int off;
17580 int align;
17581
17582 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17583    try to store the string in read-only memory. */
17584 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17585
17586 for (align = 7; align >= 0; align--) {
17587         for (len = 36; len; len--) {
17588                 b = buf+align;
17589                 bcopy(abc, b, len);
17590                 for (off = 1; off <= len; off++) {
17591                         bcopy(b, b+off, len);
17592                         bcopy(b+off, b, len);
17593                         if (bcmp(b, abc, len))
17594                                 exit(1);
17595                 }
17596         }
17597 }
17598 exit(0);
17599 }
17600 EOCP
17601                 set try
17602                 if eval $compile_ok; then
17603                         if $run ./try 2>/dev/null; then
17604                                 echo "Yes, it can."
17605                                 val="$define"
17606                         else
17607                                 echo "It can't, sorry."
17608                         fi
17609                 else
17610                         echo "(I can't compile the test program, so we'll assume not...)"
17611                 fi
17612                 ;;
17613         esac
17614         $rm_try
17615         ;;
17616 esac
17617 set d_safebcpy
17618 eval $setvar
17619
17620 : can memcpy handle overlapping blocks?
17621 echo " "
17622 val="$undef"
17623 case "$d_memmove" in
17624 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17625 *)      case "$d_memcpy" in
17626         "$define")
17627                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17628                 $cat >try.c <<EOCP
17629 #$i_memory I_MEMORY
17630 #$i_stdlib I_STDLIB
17631 #$i_string I_STRING
17632 #$i_unistd I_UNISTD
17633 EOCP
17634         $cat >>try.c <<'EOCP'
17635 #include <stdio.h>
17636 #ifdef I_MEMORY
17637 #  include <memory.h>
17638 #endif
17639 #ifdef I_STDLIB
17640 #  include <stdlib.h>
17641 #endif
17642 #ifdef I_STRING
17643 #  include <string.h>
17644 #else
17645 #  include <strings.h>
17646 #endif
17647 #ifdef I_UNISTD
17648 #  include <unistd.h>  /* Needed for NetBSD */
17649 #endif
17650 int main()
17651 {
17652 char buf[128], abc[128];
17653 char *b;
17654 int len;
17655 int off;
17656 int align;
17657
17658 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17659    try to store the string in read-only memory. */
17660 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17661
17662 for (align = 7; align >= 0; align--) {
17663         for (len = 36; len; len--) {
17664                 b = buf+align;
17665                 memcpy(b, abc, len);
17666                 for (off = 1; off <= len; off++) {
17667                         memcpy(b+off, b, len);
17668                         memcpy(b, b+off, len);
17669                         if (memcmp(b, abc, len))
17670                                 exit(1);
17671                 }
17672         }
17673 }
17674 exit(0);
17675 }
17676 EOCP
17677                 set try
17678                 if eval $compile_ok; then
17679                         if $run ./try 2>/dev/null; then
17680                                 echo "Yes, it can."
17681                                 val="$define"
17682                         else
17683                                 echo "It can't, sorry."
17684                         fi
17685                 else
17686                         echo "(I can't compile the test program, so we'll assume not...)"
17687                 fi
17688                 ;;
17689         esac
17690         $rm_try
17691         ;;
17692 esac
17693 set d_safemcpy
17694 eval $setvar
17695
17696 : can memcmp be trusted to compare relative magnitude?
17697 val="$undef"
17698 case "$d_memcmp" in
17699 "$define")
17700         echo " "
17701         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17702         $cat >try.c <<EOCP
17703 #$i_memory I_MEMORY
17704 #$i_stdlib I_STDLIB
17705 #$i_string I_STRING
17706 #$i_unistd I_UNISTD
17707 EOCP
17708         $cat >>try.c <<'EOCP'
17709 #include <stdio.h>
17710 #ifdef I_MEMORY
17711 #  include <memory.h>
17712 #endif
17713 #ifdef I_STDLIB
17714 #  include <stdlib.h>
17715 #endif
17716 #ifdef I_STRING
17717 #  include <string.h>
17718 #else
17719 #  include <strings.h>
17720 #endif
17721 #ifdef I_UNISTD
17722 #  include <unistd.h>  /* Needed for NetBSD */
17723 #endif
17724 int main()
17725 {
17726 char a = -1;
17727 char b = 0;
17728 if ((a < b) && memcmp(&a, &b, 1) < 0)
17729         exit(1);
17730 exit(0);
17731 }
17732 EOCP
17733         set try
17734         if eval $compile_ok; then
17735                 if $run ./try 2>/dev/null; then
17736                         echo "Yes, it can."
17737                         val="$define"
17738                 else
17739                         echo "No, it can't (it uses signed chars)."
17740                 fi
17741         else
17742                 echo "(I can't compile the test program, so we'll assume not...)"
17743         fi
17744         ;;
17745 esac
17746 $rm_try
17747 set d_sanemcmp
17748 eval $setvar
17749
17750 : see if prototype for sbrk is available
17751 echo " "
17752 set d_sbrkproto sbrk $i_unistd unistd.h
17753 eval $hasproto
17754
17755 : see if scalbn exists
17756 set scalbn d_scalbn
17757 eval $inlibc
17758
17759 : see if select exists
17760 set select d_select
17761 eval $inlibc
17762
17763 : see if semctl exists
17764 set semctl d_semctl
17765 eval $inlibc
17766
17767 : see if semget exists
17768 set semget d_semget
17769 eval $inlibc
17770
17771 : see if semop exists
17772 set semop d_semop
17773 eval $inlibc
17774
17775 : see how much of the 'sem*(2)' library is present.
17776 h_sem=true
17777 echo " "
17778 case "$d_semctl$d_semget$d_semop" in
17779 *"$undef"*) h_sem=false;;
17780 esac
17781 case "$osname" in
17782 freebsd)
17783     case "`ipcs 2>&1`" in
17784     "SVID messages"*"not configured"*)
17785         echo "Your $osname does not have the sem*(2) configured." >&4
17786         h_sem=false
17787         val="$undef"
17788         set semctl d_semctl
17789         eval $setvar
17790         set semget d_semget
17791         eval $setvar
17792         set semop d_semop
17793         eval $setvar
17794         ;;
17795     esac
17796     ;;
17797 esac
17798 : we could also check for sys/ipc.h ...
17799 if $h_sem && $test `./findhdr sys/sem.h`; then
17800         echo "You have the full sem*(2) library." >&4
17801         val="$define"
17802 else
17803         echo "You don't have the full sem*(2) library." >&4
17804         val="$undef"
17805 fi
17806 set d_sem
17807 eval $setvar
17808
17809 : see whether sys/sem.h defines union semun
17810 echo " "
17811 $cat > try.c <<'END'
17812 #include <sys/types.h>
17813 #include <sys/ipc.h>
17814 #include <sys/sem.h>
17815 int main () { union semun semun; semun.buf = 0; }
17816 END
17817 set try
17818 if eval $compile; then
17819     echo "You have union semun in <sys/sem.h>." >&4
17820     val="$define"
17821 else
17822     echo "You do not have union semun in <sys/sem.h>." >&4
17823     val="$undef"
17824 fi
17825 $rm_try
17826 set d_union_semun
17827 eval $setvar
17828
17829 : see how to do semctl IPC_STAT
17830 case "$d_sem" in
17831 $define)
17832     echo " "
17833     $cat > tryh.h <<END
17834 #ifndef S_IRUSR
17835 #   ifdef S_IREAD
17836 #       define S_IRUSR S_IREAD
17837 #       define S_IWUSR S_IWRITE
17838 #       define S_IXUSR S_IEXEC
17839 #   else
17840 #       define S_IRUSR 0400
17841 #       define S_IWUSR 0200
17842 #       define S_IXUSR 0100
17843 #   endif
17844 #   define S_IRGRP (S_IRUSR>>3)
17845 #   define S_IWGRP (S_IWUSR>>3)
17846 #   define S_IXGRP (S_IXUSR>>3)
17847 #   define S_IROTH (S_IRUSR>>6)
17848 #   define S_IWOTH (S_IWUSR>>6)
17849 #   define S_IXOTH (S_IXUSR>>6)
17850 #endif
17851 #ifndef S_IRWXU
17852 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17853 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17854 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17855 #endif
17856 END
17857     : see whether semctl IPC_STAT can use union semun
17858     case "$d_semctl_semun" in
17859     '')
17860       val="$undef"
17861       $cat > try.c <<END
17862 #include <sys/types.h>
17863 #include <sys/ipc.h>
17864 #include <sys/sem.h>
17865 #include <sys/stat.h>
17866 #include <stdio.h>
17867 #include <errno.h>
17868 #include "tryh.h"
17869 #ifndef errno
17870 extern int errno;
17871 #endif
17872 #$d_union_semun HAS_UNION_SEMUN
17873 int main() {
17874     union semun
17875 #ifndef HAS_UNION_SEMUN
17876     {
17877         int val;
17878         struct semid_ds *buf;
17879         unsigned short *array;
17880     }
17881 #endif
17882     arg;
17883     int sem, st;
17884
17885 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17886     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17887     if (sem > -1) {
17888         struct semid_ds argbuf;
17889         arg.buf = &argbuf;
17890 #       ifdef IPC_STAT
17891         st = semctl(sem, 0, IPC_STAT, arg);
17892         if (st == 0)
17893             printf("semun\n");
17894         else
17895 #       endif /* IPC_STAT */
17896             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17897 #       ifdef IPC_RMID
17898         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17899 #       endif /* IPC_RMID */
17900             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17901     } else
17902 #endif /* IPC_PRIVATE && ... */
17903         printf("semget failed: errno = %d\n", errno);
17904   return 0;
17905 }
17906 END
17907       set try
17908       if eval $compile; then
17909           xxx=`$run ./try`
17910           case "$xxx" in
17911           semun) val="$define" ;;
17912           esac
17913       fi
17914       $rm_try
17915       set d_semctl_semun
17916       eval $setvar
17917       ;;
17918     esac
17919     case "$d_semctl_semun" in
17920     $define)
17921         echo "You can use union semun for semctl IPC_STAT." >&4
17922         also='also'
17923         ;;
17924     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17925         also=''
17926         ;;
17927     esac
17928
17929     : see whether semctl IPC_STAT can use struct semid_ds pointer
17930     case "$d_semctl_semid_ds" in
17931     '')
17932       val="$undef"
17933       $cat > try.c <<'END'
17934 #include <sys/types.h>
17935 #include <sys/ipc.h>
17936 #include <sys/sem.h>
17937 #include <sys/stat.h>
17938 #include "tryh.h"
17939 #include <stdio.h>
17940 #include <errno.h>
17941 #ifndef errno
17942 extern int errno;
17943 #endif
17944 int main() {
17945     struct semid_ds arg;
17946     int sem, st;
17947
17948 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17949     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17950     if (sem > -1) {
17951 #       ifdef IPC_STAT
17952         st = semctl(sem, 0, IPC_STAT, &arg);
17953         if (st == 0)
17954             printf("semid_ds\n");
17955         else
17956 #       endif /* IPC_STAT */
17957             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17958 #       ifdef IPC_RMID
17959         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17960 #       endif /* IPC_RMID */
17961             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17962     } else
17963 #endif /* IPC_PRIVATE && ... */
17964         printf("semget failed: errno = %d\n", errno);
17965
17966     return 0;
17967 }
17968 END
17969       set try
17970       if eval $compile; then
17971           xxx=`$run ./try`
17972           case "$xxx" in
17973           semid_ds) val="$define" ;;
17974           esac
17975       fi
17976       $rm_try
17977       set d_semctl_semid_ds
17978       eval $setvar
17979       ;;
17980     esac
17981     case "$d_semctl_semid_ds" in
17982     $define)
17983         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17984         ;;
17985     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17986         ;;
17987     esac
17988     ;;
17989 *)  val="$undef"
17990
17991     # We do not have the full sem*(2) library, so assume we can not
17992     # use either.
17993
17994     set d_semctl_semun
17995     eval $setvar
17996
17997     set d_semctl_semid_ds
17998     eval $setvar
17999     ;;
18000 esac
18001 $rm_try tryh.h
18002
18003 : see if sendmsg exists
18004 set sendmsg d_sendmsg
18005 eval $inlibc
18006
18007 : see if setegid exists
18008 set setegid d_setegid
18009 eval $inlibc
18010
18011 : see if seteuid exists
18012 set seteuid d_seteuid
18013 eval $inlibc
18014
18015 : see if setgrent exists
18016 set setgrent d_setgrent
18017 eval $inlibc
18018
18019 : see if setgrent_r exists
18020 set setgrent_r d_setgrent_r
18021 eval $inlibc
18022 case "$d_setgrent_r" in
18023 "$define")
18024         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18025         case "$d_setgrent_r_proto:$usethreads" in
18026         ":define")      d_setgrent_r_proto=define
18027                 set d_setgrent_r_proto setgrent_r $hdrs
18028                 eval $hasproto ;;
18029         *)      ;;
18030         esac
18031         case "$d_setgrent_r_proto" in
18032         define)
18033         case "$setgrent_r_proto" in
18034         ''|0) try='int setgrent_r(FILE**);'
18035         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18036         esac
18037         case "$setgrent_r_proto" in
18038         ''|0) try='void setgrent_r(FILE**);'
18039         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18040         esac
18041         case "$setgrent_r_proto" in
18042         ''|0)   d_setgrent_r=undef
18043                 setgrent_r_proto=0
18044                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18045         * )     case "$setgrent_r_proto" in
18046                 REENTRANT_PROTO*) ;;
18047                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18048                 esac
18049                 echo "Prototype: $try" ;;
18050         esac
18051         ;;
18052         *)      case "$usethreads" in
18053                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18054                 esac
18055                 d_setgrent_r=undef
18056                 setgrent_r_proto=0
18057                 ;;
18058         esac
18059         ;;
18060 *)      setgrent_r_proto=0
18061         ;;
18062 esac
18063
18064 : see if sethostent exists
18065 set sethostent d_sethent
18066 eval $inlibc
18067
18068 : see if sethostent_r exists
18069 set sethostent_r d_sethostent_r
18070 eval $inlibc
18071 case "$d_sethostent_r" in
18072 "$define")
18073         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18074         case "$d_sethostent_r_proto:$usethreads" in
18075         ":define")      d_sethostent_r_proto=define
18076                 set d_sethostent_r_proto sethostent_r $hdrs
18077                 eval $hasproto ;;
18078         *)      ;;
18079         esac
18080         case "$d_sethostent_r_proto" in
18081         define)
18082         case "$sethostent_r_proto" in
18083         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18084         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18085         esac
18086         case "$sethostent_r_proto" in
18087         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18088         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18089         esac
18090         case "$sethostent_r_proto" in
18091         ''|0)   d_sethostent_r=undef
18092                 sethostent_r_proto=0
18093                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18094         * )     case "$sethostent_r_proto" in
18095                 REENTRANT_PROTO*) ;;
18096                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18097                 esac
18098                 echo "Prototype: $try" ;;
18099         esac
18100         ;;
18101         *)      case "$usethreads" in
18102                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18103                 esac
18104                 d_sethostent_r=undef
18105                 sethostent_r_proto=0
18106                 ;;
18107         esac
18108         ;;
18109 *)      sethostent_r_proto=0
18110         ;;
18111 esac
18112
18113 : see if setitimer exists
18114 set setitimer d_setitimer
18115 eval $inlibc
18116
18117 : see if setlinebuf exists
18118 set setlinebuf d_setlinebuf
18119 eval $inlibc
18120
18121 : see if setlocale exists
18122 set setlocale d_setlocale
18123 eval $inlibc
18124
18125 : see if locale.h is available
18126 set locale.h i_locale
18127 eval $inhdr
18128
18129 : see if setlocale_r exists
18130 set setlocale_r d_setlocale_r
18131 eval $inlibc
18132 case "$d_setlocale_r" in
18133 "$define")
18134         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18135         case "$d_setlocale_r_proto:$usethreads" in
18136         ":define")      d_setlocale_r_proto=define
18137                 set d_setlocale_r_proto setlocale_r $hdrs
18138                 eval $hasproto ;;
18139         *)      ;;
18140         esac
18141         case "$d_setlocale_r_proto" in
18142         define)
18143         case "$setlocale_r_proto" in
18144         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18145         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18146         esac
18147         case "$setlocale_r_proto" in
18148         ''|0)   d_setlocale_r=undef
18149                 setlocale_r_proto=0
18150                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18151         * )     case "$setlocale_r_proto" in
18152                 REENTRANT_PROTO*) ;;
18153                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18154                 esac
18155                 echo "Prototype: $try" ;;
18156         esac
18157         ;;
18158         *)      case "$usethreads" in
18159                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18160                 esac
18161                 d_setlocale_r=undef
18162                 setlocale_r_proto=0
18163                 ;;
18164         esac
18165         ;;
18166 *)      setlocale_r_proto=0
18167         ;;
18168 esac
18169
18170 : see if setnetent exists
18171 set setnetent d_setnent
18172 eval $inlibc
18173
18174 : see if setnetent_r exists
18175 set setnetent_r d_setnetent_r
18176 eval $inlibc
18177 case "$d_setnetent_r" in
18178 "$define")
18179         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18180         case "$d_setnetent_r_proto:$usethreads" in
18181         ":define")      d_setnetent_r_proto=define
18182                 set d_setnetent_r_proto setnetent_r $hdrs
18183                 eval $hasproto ;;
18184         *)      ;;
18185         esac
18186         case "$d_setnetent_r_proto" in
18187         define)
18188         case "$setnetent_r_proto" in
18189         ''|0) try='int setnetent_r(int, struct netent_data*);'
18190         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18191         esac
18192         case "$setnetent_r_proto" in
18193         ''|0) try='void setnetent_r(int, struct netent_data*);'
18194         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18195         esac
18196         case "$setnetent_r_proto" in
18197         ''|0)   d_setnetent_r=undef
18198                 setnetent_r_proto=0
18199                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18200         * )     case "$setnetent_r_proto" in
18201                 REENTRANT_PROTO*) ;;
18202                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18203                 esac
18204                 echo "Prototype: $try" ;;
18205         esac
18206         ;;
18207         *)      case "$usethreads" in
18208                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18209                 esac
18210                 d_setnetent_r=undef
18211                 setnetent_r_proto=0
18212                 ;;
18213         esac
18214         ;;
18215 *)      setnetent_r_proto=0
18216         ;;
18217 esac
18218
18219 : see if setprotoent exists
18220 set setprotoent d_setpent
18221 eval $inlibc
18222
18223 : see if setpgid exists
18224 set setpgid d_setpgid
18225 eval $inlibc
18226
18227 : see if setpgrp2 exists
18228 set setpgrp2 d_setpgrp2
18229 eval $inlibc
18230
18231 : see if setpriority exists
18232 set setpriority d_setprior
18233 eval $inlibc
18234
18235 : see if setproctitle exists
18236 set setproctitle d_setproctitle
18237 eval $inlibc
18238
18239 : see if setprotoent_r exists
18240 set setprotoent_r d_setprotoent_r
18241 eval $inlibc
18242 case "$d_setprotoent_r" in
18243 "$define")
18244         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18245         case "$d_setprotoent_r_proto:$usethreads" in
18246         ":define")      d_setprotoent_r_proto=define
18247                 set d_setprotoent_r_proto setprotoent_r $hdrs
18248                 eval $hasproto ;;
18249         *)      ;;
18250         esac
18251         case "$d_setprotoent_r_proto" in
18252         define)
18253         case "$setprotoent_r_proto" in
18254         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18255         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18256         esac
18257         case "$setprotoent_r_proto" in
18258         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18259         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18260         esac
18261         case "$setprotoent_r_proto" in
18262         ''|0)   d_setprotoent_r=undef
18263                 setprotoent_r_proto=0
18264                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18265         * )     case "$setprotoent_r_proto" in
18266                 REENTRANT_PROTO*) ;;
18267                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18268                 esac
18269                 echo "Prototype: $try" ;;
18270         esac
18271         ;;
18272         *)      case "$usethreads" in
18273                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18274                 esac
18275                 d_setprotoent_r=undef
18276                 setprotoent_r_proto=0
18277                 ;;
18278         esac
18279         ;;
18280 *)      setprotoent_r_proto=0
18281         ;;
18282 esac
18283
18284 : see if setpwent exists
18285 set setpwent d_setpwent
18286 eval $inlibc
18287
18288 : see if setpwent_r exists
18289 set setpwent_r d_setpwent_r
18290 eval $inlibc
18291 case "$d_setpwent_r" in
18292 "$define")
18293         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18294         case "$d_setpwent_r_proto:$usethreads" in
18295         ":define")      d_setpwent_r_proto=define
18296                 set d_setpwent_r_proto setpwent_r $hdrs
18297                 eval $hasproto ;;
18298         *)      ;;
18299         esac
18300         case "$d_setpwent_r_proto" in
18301         define)
18302         case "$setpwent_r_proto" in
18303         ''|0) try='int setpwent_r(FILE**);'
18304         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18305         esac
18306         case "$setpwent_r_proto" in
18307         ''|0) try='void setpwent_r(FILE**);'
18308         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18309         esac
18310         case "$setpwent_r_proto" in
18311         ''|0)   d_setpwent_r=undef
18312                 setpwent_r_proto=0
18313                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18314         * )     case "$setpwent_r_proto" in
18315                 REENTRANT_PROTO*) ;;
18316                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18317                 esac
18318                 echo "Prototype: $try" ;;
18319         esac
18320         ;;
18321         *)      case "$usethreads" in
18322                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18323                 esac
18324                 d_setpwent_r=undef
18325                 setpwent_r_proto=0
18326                 ;;
18327         esac
18328         ;;
18329 *)      setpwent_r_proto=0
18330         ;;
18331 esac
18332
18333 : see if setregid exists
18334 set setregid d_setregid
18335 eval $inlibc
18336 set setresgid d_setresgid
18337 eval $inlibc
18338
18339 : see if setreuid exists
18340 set setreuid d_setreuid
18341 eval $inlibc
18342 set setresuid d_setresuid
18343 eval $inlibc
18344
18345 : see if setrgid exists
18346 set setrgid d_setrgid
18347 eval $inlibc
18348
18349 : see if setruid exists
18350 set setruid d_setruid
18351 eval $inlibc
18352
18353 : see if setservent exists
18354 set setservent d_setsent
18355 eval $inlibc
18356
18357 : see if setservent_r exists
18358 set setservent_r d_setservent_r
18359 eval $inlibc
18360 case "$d_setservent_r" in
18361 "$define")
18362         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18363         case "$d_setservent_r_proto:$usethreads" in
18364         ":define")      d_setservent_r_proto=define
18365                 set d_setservent_r_proto setservent_r $hdrs
18366                 eval $hasproto ;;
18367         *)      ;;
18368         esac
18369         case "$d_setservent_r_proto" in
18370         define)
18371         case "$setservent_r_proto" in
18372         ''|0) try='int setservent_r(int, struct servent_data*);'
18373         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18374         esac
18375         case "$setservent_r_proto" in
18376         ''|0) try='void setservent_r(int, struct servent_data*);'
18377         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18378         esac
18379         case "$setservent_r_proto" in
18380         ''|0)   d_setservent_r=undef
18381                 setservent_r_proto=0
18382                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18383         * )     case "$setservent_r_proto" in
18384                 REENTRANT_PROTO*) ;;
18385                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18386                 esac
18387                 echo "Prototype: $try" ;;
18388         esac
18389         ;;
18390         *)      case "$usethreads" in
18391                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18392                 esac
18393                 d_setservent_r=undef
18394                 setservent_r_proto=0
18395                 ;;
18396         esac
18397         ;;
18398 *)      setservent_r_proto=0
18399         ;;
18400 esac
18401
18402 : see if setsid exists
18403 set setsid d_setsid
18404 eval $inlibc
18405
18406 : see if setvbuf exists
18407 set setvbuf d_setvbuf
18408 eval $inlibc
18409
18410 : see if shmctl exists
18411 set shmctl d_shmctl
18412 eval $inlibc
18413
18414 : see if shmget exists
18415 set shmget d_shmget
18416 eval $inlibc
18417
18418 : see if shmat exists
18419 set shmat d_shmat
18420 eval $inlibc
18421 : see what shmat returns
18422 case "$d_shmat" in
18423 "$define")
18424         $cat >shmat.c <<'END'
18425 #include <sys/shm.h>
18426 void *shmat();
18427 END
18428         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18429                 shmattype='void *'
18430         else
18431                 shmattype='char *'
18432         fi
18433         echo "and it returns ($shmattype)." >&4
18434         : see if a prototype for shmat is available
18435         xxx=`./findhdr sys/shm.h`
18436         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18437         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18438                 val="$define"
18439         else
18440                 val="$undef"
18441         fi
18442         $rm -f shmat.[co]
18443         ;;
18444 *)
18445         val="$undef"
18446         ;;
18447 esac
18448 set d_shmatprototype
18449 eval $setvar
18450
18451 : see if shmdt exists
18452 set shmdt d_shmdt
18453 eval $inlibc
18454
18455 : see how much of the 'shm*(2)' library is present.
18456 h_shm=true
18457 echo " "
18458 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18459 *"$undef"*) h_shm=false;;
18460 esac
18461 case "$osname" in
18462 freebsd)
18463     case "`ipcs 2>&1`" in
18464     "SVID shared memory"*"not configured"*)
18465         echo "Your $osname does not have the shm*(2) configured." >&4
18466         h_shm=false
18467         val="$undef"
18468         set shmctl d_shmctl
18469         eval $setvar
18470         set shmget d_shmget
18471         eval $setvar
18472         set shmat d_shmat
18473         eval $setvar
18474         set shmdt d_shmdt
18475         eval $setvar
18476         ;;
18477     esac
18478     ;;
18479 esac
18480 : we could also check for sys/ipc.h ...
18481 if $h_shm && $test `./findhdr sys/shm.h`; then
18482         echo "You have the full shm*(2) library." >&4
18483         val="$define"
18484 else
18485         echo "You don't have the full shm*(2) library." >&4
18486         val="$undef"
18487 fi
18488 set d_shm
18489 eval $setvar
18490
18491 : see if we have sigaction
18492 echo " "
18493 if set sigaction val -f d_sigaction; eval $csym; $val; then
18494         echo 'sigaction() found.' >&4
18495         $cat > try.c <<EOP
18496 #include <stdio.h>
18497 #include <sys/types.h>
18498 #include <signal.h>
18499 #$i_stdlib I_STDLIB
18500 #ifdef I_STDLIB
18501 #include <stdlib.h>
18502 #endif
18503 int main()
18504 {
18505     struct sigaction act, oact;
18506     act.sa_flags = 0;
18507     oact.sa_handler = 0;
18508     /* so that act and oact are used */
18509     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18510 }
18511 EOP
18512         set try
18513         if eval $compile_ok; then
18514                 val="$define"
18515         else
18516                 echo "But you don't seem to have a usable struct sigaction." >&4
18517                 val="$undef"
18518         fi
18519 else
18520         echo 'sigaction NOT found.' >&4
18521         val="$undef"
18522 fi
18523 set d_sigaction; eval $setvar
18524 $rm_try
18525
18526 : see if this is a sunmath.h system
18527 set sunmath.h i_sunmath
18528 eval $inhdr
18529
18530 : see if signbit exists
18531 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18532 $cat >try.c <<EOCP
18533 #$i_math I_MATH
18534 #$i_sunmath I_SUNMATH
18535 #ifdef I_MATH
18536 #  include <math.h>
18537 #endif
18538 #ifdef I_SUNMATH  /* Solaris special math library */
18539 #  include <sunmath.h>
18540 #endif
18541 #define NV $nvtype
18542 int main(int argc, char **argv)
18543 {
18544     NV x = 0.0;
18545     NV y = -0.0;
18546     if ((signbit(x) == 0) && (signbit(y) != 0))
18547         return 0;
18548     else
18549         return 1;
18550 }
18551 EOCP
18552 val="$undef"
18553 set try
18554 if eval $compile; then
18555     if $run ./try; then
18556         $echo "Yes." >&4
18557         val="$define"
18558     else
18559         $echo "Signbit seems to be available, but doesn't work as I expected."
18560         $echo "I won't use it." >&4
18561         val="$undef"
18562     fi
18563 else
18564     $echo "Nope." >&4
18565     dflt="$undef"
18566 fi
18567 set d_signbit
18568 eval $setvar
18569 $rm_try
18570
18571 : see if sigprocmask exists
18572 set sigprocmask d_sigprocmask
18573 eval $inlibc
18574
18575 : see if sigsetjmp exists
18576 echo " "
18577 case "$d_sigsetjmp" in
18578 '')
18579         $cat >try.c <<EOP
18580 #include <setjmp.h>
18581 #$i_stdlib I_STDLIB
18582 #ifdef I_STDLIB
18583 #include <stdlib.h>
18584 #endif
18585 sigjmp_buf env;
18586 int set = 1;
18587 int main()
18588 {
18589         if (sigsetjmp(env,1))
18590                 exit(set);
18591         set = 0;
18592         siglongjmp(env, 1);
18593         exit(1);
18594 }
18595 EOP
18596         set try
18597         if eval $compile; then
18598                 if $run ./try >/dev/null 2>&1; then
18599                         echo "POSIX sigsetjmp found." >&4
18600                         val="$define"
18601                 else
18602                         $cat >&4 <<EOM
18603 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18604 I'll ignore them.
18605 EOM
18606                         val="$undef"
18607                 fi
18608         else
18609                 echo "sigsetjmp not found." >&4
18610                 val="$undef"
18611         fi
18612         ;;
18613 *) val="$d_sigsetjmp"
18614         case "$d_sigsetjmp" in
18615         $define) echo "POSIX sigsetjmp found." >&4;;
18616         $undef) echo "sigsetjmp not found." >&4;;
18617         esac
18618         ;;
18619 esac
18620 set d_sigsetjmp
18621 eval $setvar
18622 $rm_try
18623
18624 : see if snprintf exists
18625 set snprintf d_snprintf
18626 eval $inlibc
18627
18628 : see if vsnprintf exists
18629 set vsnprintf d_vsnprintf
18630 eval $inlibc
18631
18632 case "$d_snprintf-$d_vsnprintf" in
18633 "$define-$define")
18634     $cat <<EOM
18635 Checking whether your snprintf() and vsnprintf() work okay...
18636 EOM
18637     $cat >try.c <<'EOCP'
18638 /* v?snprintf testing logic courtesy of Russ Allbery.
18639  * According to C99:
18640  * - if the buffer is too short it still must be \0-terminated
18641  * - if the buffer is too short the potentially required length
18642  *   must be returned and not -1
18643  * - if the buffer is NULL the potentially required length
18644  *   must be returned and not -1 or core dump
18645  */
18646 #include <stdio.h>
18647 #include <stdarg.h>
18648
18649 char buf[2];
18650
18651 int test (char *format, ...)
18652 {
18653     va_list args;
18654     int count;
18655
18656     va_start (args, format);
18657     count = vsnprintf (buf, sizeof buf, format, args);
18658     va_end (args);
18659     return count;
18660 }
18661
18662 int main ()
18663 {
18664     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18665              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18666 }
18667 EOCP
18668     set try
18669     if eval $compile; then
18670         `$run ./try`
18671         case "$?" in
18672         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18673         *) cat <<EOM >&4
18674 Your snprintf() and snprintf() don't seem to be working okay.
18675 EOM
18676            d_snprintf="$undef"
18677            d_vsnprintf="$undef"
18678            ;;
18679         esac
18680     else
18681         echo "(I can't seem to compile the test program--assuming they don't)"
18682         d_snprintf="$undef"
18683         d_vsnprintf="$undef"
18684     fi
18685     $rm_try
18686     ;;
18687 esac
18688
18689 : see if sockatmark exists
18690 set sockatmark d_sockatmark
18691 eval $inlibc
18692
18693 : see if prototype for sockatmark is available
18694 echo " "
18695 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18696 eval $hasproto
18697
18698 : see if socks5_init exists
18699 set socks5_init d_socks5_init
18700 eval $inlibc
18701
18702 : see if sprintf returns the length of the string in the buffer as per ANSI
18703 $echo "Checking whether sprintf returns the length of the string..." >&4
18704 $cat <<EOP >try.c
18705 #include <stdio.h>
18706 #$i_stdlib I_STDLIB
18707 #ifdef I_STDLIB
18708 #include <stdlib.h>
18709 #endif
18710 #$i_string I_STRING
18711 #ifdef I_STRING
18712 #  include <string.h>
18713 #else
18714 #  include <strings.h>
18715 #endif
18716 #$i_math I_MATH
18717 #ifdef I_MATH
18718 #include <math.h>
18719 #endif
18720
18721 char buffer[256];
18722
18723 int check (size_t expect, int test) {
18724   size_t got = strlen(buffer);
18725   if (expect == got)
18726     return 0;
18727
18728   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18729        test, buffer);
18730   exit (test);
18731 }
18732
18733 int main(int argc, char **argv) {
18734   int test = 0;
18735
18736   check(sprintf(buffer, ""), ++test);
18737   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18738   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18739
18740   return 0;
18741 }
18742 EOP
18743 set try
18744
18745 if eval $compile; then
18746     xxx="`$run ./try`"
18747     case "$?" in
18748         0) cat >&4 <<EOM
18749 sprintf returns the length of the string (as ANSI says it should)
18750 EOM
18751         d_sprintf_returns_strlen="$define"
18752         ;;
18753         *) cat >&4 <<EOM
18754 sprintf does not return the length of the string (how old is this system?)
18755 EOM
18756         d_sprintf_returns_strlen="$undef"
18757         ;;
18758     esac
18759 else
18760     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18761     d_sprintf_returns_strlen="$undef"
18762 fi
18763 $rm_try
18764
18765 : see if srand48_r exists
18766 set srand48_r d_srand48_r
18767 eval $inlibc
18768 case "$d_srand48_r" in
18769 "$define")
18770         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18771         case "$d_srand48_r_proto:$usethreads" in
18772         ":define")      d_srand48_r_proto=define
18773                 set d_srand48_r_proto srand48_r $hdrs
18774                 eval $hasproto ;;
18775         *)      ;;
18776         esac
18777         case "$d_srand48_r_proto" in
18778         define)
18779         case "$srand48_r_proto" in
18780         ''|0) try='int srand48_r(long, struct drand48_data*);'
18781         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18782         esac
18783         case "$srand48_r_proto" in
18784         ''|0)   d_srand48_r=undef
18785                 srand48_r_proto=0
18786                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18787         * )     case "$srand48_r_proto" in
18788                 REENTRANT_PROTO*) ;;
18789                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18790                 esac
18791                 echo "Prototype: $try" ;;
18792         esac
18793         ;;
18794         *)      case "$usethreads" in
18795                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18796                 esac
18797                 d_srand48_r=undef
18798                 srand48_r_proto=0
18799                 ;;
18800         esac
18801         ;;
18802 *)      srand48_r_proto=0
18803         ;;
18804 esac
18805
18806 : see if srandom_r exists
18807 set srandom_r d_srandom_r
18808 eval $inlibc
18809 case "$d_srandom_r" in
18810 "$define")
18811         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18812         case "$d_srandom_r_proto:$usethreads" in
18813         ":define")      d_srandom_r_proto=define
18814                 set d_srandom_r_proto srandom_r $hdrs
18815                 eval $hasproto ;;
18816         *)      ;;
18817         esac
18818         case "$d_srandom_r_proto" in
18819         define)
18820         case "$srandom_r_proto" in
18821         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18822         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18823         esac
18824         case "$srandom_r_proto" in
18825         ''|0)   d_srandom_r=undef
18826                 srandom_r_proto=0
18827                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18828         * )     case "$srandom_r_proto" in
18829                 REENTRANT_PROTO*) ;;
18830                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18831                 esac
18832                 echo "Prototype: $try" ;;
18833         esac
18834         ;;
18835         *)      case "$usethreads" in
18836                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18837                 esac
18838                 d_srandom_r=undef
18839                 srandom_r_proto=0
18840                 ;;
18841         esac
18842         ;;
18843 *)      srandom_r_proto=0
18844         ;;
18845 esac
18846
18847 : see if prototype for setresgid is available
18848 echo " "
18849 set d_sresgproto setresgid $i_unistd unistd.h
18850 eval $hasproto
18851
18852 : see if prototype for setresuid is available
18853 echo " "
18854 set d_sresuproto setresuid $i_unistd unistd.h
18855 eval $hasproto
18856
18857 : see if stat exists
18858 set stat d_stat
18859 eval $inlibc
18860
18861 : see if sys/stat.h is available
18862 set sys/stat.h i_sysstat
18863 eval $inhdr
18864
18865 : see if stat knows about block sizes
18866 echo " "
18867 echo "Checking to see if your struct stat has st_blocks field..." >&4
18868 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18869 eval $hasfield
18870
18871 : see if this is a sys/vfs.h system
18872 set sys/vfs.h i_sysvfs
18873 eval $inhdr
18874
18875 : see if this is a sys/statfs.h system
18876 set sys/statfs.h i_sysstatfs
18877 eval $inhdr
18878
18879 : Check for statfs_s
18880 echo " "
18881 echo "Checking to see if your system supports struct statfs..." >&4
18882 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
18883 eval $hasstruct
18884 case "$d_statfs_s" in
18885 "$define")      echo "Yes, it does."   ;;
18886 *)              echo "No, it doesn't." ;;
18887 esac
18888
18889
18890 : see if struct statfs knows about f_flags
18891 case "$d_statfs_s" in
18892 define)
18893         echo " "
18894         echo "Checking to see if your struct statfs has f_flags field..." >&4
18895         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
18896         eval $hasfield
18897         ;;
18898 *)      val="$undef"
18899         set d_statfs_f_flags
18900         eval $setvar
18901         ;;
18902 esac
18903 case "$d_statfs_f_flags" in
18904 "$define")      echo "Yes, it does."   ;;
18905 *)              echo "No, it doesn't." ;;
18906 esac
18907
18908 : see what flavor, if any, of static inline is supported
18909 echo " "
18910 echo "Checking to see if your system supports static inline..."
18911 $cat > try.c <<'EOCP'
18912 #include <stdlib.h>
18913 extern int f_via_a(int x);
18914 extern int f_via_b(int x);
18915 int main(int argc, char **argv)
18916 {
18917     int y;
18918
18919     y = f_via_a(0);
18920 #ifdef USE_B
18921     y = f_via_b(0);
18922 #endif
18923     if (y == 42) {
18924         return EXIT_SUCCESS;
18925     }
18926     else {
18927         return EXIT_FAILURE;
18928     }
18929 }
18930 EOCP
18931 $cat > a.c <<'EOCP'
18932 static INLINE int f(int x) {
18933     int y;
18934     y = x + 42;
18935     return y;
18936 }
18937
18938 int f_via_a(int x)
18939 {
18940     return f(x);
18941 }
18942 EOCP
18943 $cat > b.c <<'EOCP'
18944 extern int f(int x);
18945
18946 int f_via_b(int x)
18947 {
18948     return f(x);
18949 }
18950 EOCP
18951
18952 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18953 case "$perl_static_inline" in
18954 '')     # Check the various possibilities, and break out on success.
18955         # For gcc, prefer __inline__, which will still permit
18956         # cflags.SH to add in -ansi.
18957         case "$gccversion" in
18958                 '') xxx="inline __inline__ __inline _inline";;
18959                 *)  xxx="__inline__ inline __inline _inline";;
18960         esac
18961         for inline in $xxx; do
18962                 set try -DINLINE=$inline a.c
18963                 if eval $compile && $run ./try; then
18964                         # Now make sure there is no external linkage of static
18965                         # functions
18966                         set try -DINLINE=$inline -DUSE_B a.c b.c
18967                         if eval $compile && $run ./try; then
18968                                 $echo "Your compiler supports static $inline, " >&4
18969                                 $echo "but it also creates an external definition," >&4
18970                                 $echo "so I won't use it." >&4
18971                                 val=$undef
18972                         else
18973                                 $echo "Your compiler supports static $inline." >&4
18974                                 val=$define
18975                                 perl_static_inline="static $inline";
18976                                 break;
18977                         fi
18978                 else
18979                         $echo "Your compiler does NOT support static $inline." >&4
18980                         val="$undef"
18981                 fi
18982         done
18983         ;;
18984 *inline*) # Some variant of inline exists.
18985         echo "Keeping your $hint value of $perl_static_inline."
18986         val=$define
18987         ;;
18988 static)  # No inline capabilities
18989         echo "Keeping your $hint value of $perl_static_inline."
18990         val=$undef
18991         ;;
18992 *)  # Unrecognized previous value -- blindly trust the supplied
18993         # value and hope it makes sense.  Use old value for
18994         # d_static_inline, if there is one.
18995         echo "Keeping your $hint value of $perl_static_inline."
18996         case "$d_static_inline" in
18997                 '') val=$define ;;
18998                 *)  val=$d_static_inline ;;
18999         esac
19000         ;;
19001 esac
19002 # Fallback to plain 'static' if nothing worked.
19003 case "$perl_static_inline" in
19004 '')
19005         perl_static_inline="static"
19006         val=$undef
19007         ;;
19008 esac
19009 set d_static_inline
19010 eval $setvar
19011 $rm -f a.[co] b.[co]
19012 $rm_try
19013
19014 : Check stream access
19015 $cat >&4 <<EOM
19016 Checking how to access stdio streams by file descriptor number...
19017 EOM
19018 case "$stdio_stream_array" in
19019 '')     $cat >try.c <<EOCP
19020 #include <stdio.h>
19021 int main() {
19022   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19023     printf("yes\n");
19024 }
19025 EOCP
19026         for s in _iob __iob __sF
19027         do
19028                 set try -DSTDIO_STREAM_ARRAY=$s
19029                 if eval $compile; then
19030                         case "`$run ./try`" in
19031                         yes)    stdio_stream_array=$s; break ;;
19032                         esac
19033                 fi
19034         done
19035         $rm_try
19036 esac
19037 case "$stdio_stream_array" in
19038 '')     $cat >&4 <<EOM
19039 I can't figure out how to access stdio streams by file descriptor number.
19040 EOM
19041         d_stdio_stream_array="$undef"
19042         ;;
19043 *)      $cat >&4 <<EOM
19044 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19045 EOM
19046         d_stdio_stream_array="$define"
19047         ;;
19048 esac
19049
19050 : see if strcoll exists
19051 set strcoll d_strcoll
19052 eval $inlibc
19053
19054 : check for structure copying
19055 echo " "
19056 echo "Checking to see if your C compiler can copy structs..." >&4
19057 $cat >try.c <<'EOCP'
19058 int main()
19059 {
19060         struct blurfl {
19061                 int dyick;
19062         } foo, bar;
19063
19064         foo = bar;
19065 }
19066 EOCP
19067 if $cc -c try.c >/dev/null 2>&1 ; then
19068         val="$define"
19069         echo "Yup, it can."
19070 else
19071         val="$undef"
19072         echo "Nope, it can't."
19073 fi
19074 set d_strctcpy
19075 eval $setvar
19076 $rm_try
19077
19078 : see if strerror and/or sys_errlist[] exist
19079 echo " "
19080 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19081     if set strerror val -f d_strerror; eval $csym; $val; then
19082                 echo 'strerror() found.' >&4
19083                 d_strerror="$define"
19084                 d_strerrm='strerror(e)'
19085                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19086                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19087                         d_syserrlst="$define"
19088                 else
19089                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19090                         d_syserrlst="$undef"
19091                 fi
19092     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19093                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19094                 echo 'strerror() found in string header.' >&4
19095                 d_strerror="$define"
19096                 d_strerrm='strerror(e)'
19097                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19098                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19099                                 d_syserrlst="$define"
19100                 else
19101                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19102                         d_syserrlst="$undef"
19103                 fi
19104     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19105                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19106                 d_strerror="$undef"
19107                 d_syserrlst="$define"
19108                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19109     else
19110                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19111                 d_strerror="$undef"
19112                 d_syserrlst="$undef"
19113                 d_strerrm='"unknown"'
19114     fi
19115 fi
19116
19117 : see if strerror_r exists
19118 set strerror_r d_strerror_r
19119 eval $inlibc
19120 case "$d_strerror_r" in
19121 "$define")
19122         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19123         case "$d_strerror_r_proto:$usethreads" in
19124         ":define")      d_strerror_r_proto=define
19125                 set d_strerror_r_proto strerror_r $hdrs
19126                 eval $hasproto ;;
19127         *)      ;;
19128         esac
19129         case "$d_strerror_r_proto" in
19130         define)
19131         case "$strerror_r_proto" in
19132         ''|0) try='int strerror_r(int, char*, size_t);'
19133         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19134         esac
19135         case "$strerror_r_proto" in
19136         ''|0) try='int strerror_r(int, char*, int);'
19137         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19138         esac
19139         case "$strerror_r_proto" in
19140         ''|0) try='char* strerror_r(int, char*, size_t);'
19141         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19142         esac
19143         case "$strerror_r_proto" in
19144         ''|0)   d_strerror_r=undef
19145                 strerror_r_proto=0
19146                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19147         * )     case "$strerror_r_proto" in
19148                 REENTRANT_PROTO*) ;;
19149                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19150                 esac
19151                 echo "Prototype: $try" ;;
19152         esac
19153         ;;
19154         *)      case "$usethreads" in
19155                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19156                 esac
19157                 d_strerror_r=undef
19158                 strerror_r_proto=0
19159                 ;;
19160         esac
19161         ;;
19162 *)      strerror_r_proto=0
19163         ;;
19164 esac
19165
19166 : see if strftime exists
19167 set strftime d_strftime
19168 eval $inlibc
19169
19170 : see if strlcat exists
19171 set strlcat d_strlcat
19172 eval $inlibc
19173
19174 : see if strlcpy exists
19175 set strlcpy d_strlcpy
19176 eval $inlibc
19177
19178 : see if strtod exists
19179 set strtod d_strtod
19180 eval $inlibc
19181
19182 : see if strtol exists
19183 set strtol d_strtol
19184 eval $inlibc
19185
19186 : see if strtold exists
19187 set strtold d_strtold
19188 eval $inlibc
19189
19190 : see if strtoll exists
19191 set strtoll d_strtoll
19192 eval $inlibc
19193
19194 case "$d_longlong-$d_strtoll" in
19195 "$define-$define")
19196         $cat <<EOM
19197 Checking whether your strtoll() works okay...
19198 EOM
19199         $cat >try.c <<'EOCP'
19200 #include <errno.h>
19201 #ifdef __hpux
19202 #define strtoll __strtoll
19203 #endif
19204 #ifdef __EMX__
19205 #define strtoll _strtoll
19206 #endif
19207 #include <stdio.h>
19208 extern long long int strtoll(char *s, char **, int);
19209 static int bad = 0;
19210 int check(char *s, long long ell, int een) {
19211         long long gll;
19212         errno = 0;
19213         gll = strtoll(s, 0, 10);
19214         if (!((gll == ell) && (errno == een)))
19215                 bad++;
19216 }
19217 int main() {
19218         check(" 1",                                      1LL, 0);
19219         check(" 0",                                      0LL, 0);
19220         check("-1",                                     -1LL, 0);
19221         check("-9223372036854775808", -9223372036854775808LL, 0);
19222         check("-9223372036854775808", -9223372036854775808LL, 0);
19223         check(" 9223372036854775807",  9223372036854775807LL, 0);
19224         check("-9223372036854775808", -9223372036854775808LL, 0);
19225         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19226         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19227         if (!bad)
19228                 printf("ok\n");
19229 }
19230 EOCP
19231         set try
19232         if eval $compile; then
19233                 yyy=`$run ./try`
19234                 case "$yyy" in
19235                 ok) echo "Your strtoll() seems to be working okay." ;;
19236                 *) cat <<EOM >&4
19237 Your strtoll() doesn't seem to be working okay.
19238 EOM
19239                    d_strtoll="$undef"
19240                    ;;
19241                 esac
19242         else
19243                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19244                 d_strtoll="$undef"
19245         fi
19246         ;;
19247 esac
19248
19249 : see if strtoq exists
19250 set strtoq d_strtoq
19251 eval $inlibc
19252
19253 : see if strtoul exists
19254 set strtoul d_strtoul
19255 eval $inlibc
19256
19257 case "$d_strtoul" in
19258 "$define")
19259         $cat <<EOM
19260 Checking whether your strtoul() works okay...
19261 EOM
19262         $cat >try.c <<'EOCP'
19263 #include <errno.h>
19264 #include <stdio.h>
19265 extern unsigned long int strtoul(char *s, char **, int);
19266 static int bad = 0;
19267 void check(char *s, unsigned long eul, int een) {
19268         unsigned long gul;
19269         errno = 0;
19270         gul = strtoul(s, 0, 10);
19271         if (!((gul == eul) && (errno == een)))
19272                 bad++;
19273 }
19274 int main() {
19275         check(" 1", 1L, 0);
19276         check(" 0", 0L, 0);
19277 EOCP
19278         case "$longsize" in
19279         8)
19280             $cat >>try.c <<'EOCP'
19281         check("18446744073709551615", 18446744073709551615UL, 0);
19282         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19283 #if 0 /* strtoul() for /^-/ strings is undefined. */
19284         check("-1", 18446744073709551615UL, 0);
19285         check("-18446744073709551614", 2, 0);
19286         check("-18446744073709551615", 1, 0);
19287         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19288         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19289 #endif
19290 EOCP
19291                 ;;
19292         4)
19293                     $cat >>try.c <<'EOCP'
19294         check("4294967295", 4294967295UL, 0);
19295         check("4294967296", 4294967295UL, ERANGE);
19296 #if 0 /* strtoul() for /^-/ strings is undefined. */
19297         check("-1", 4294967295UL, 0);
19298         check("-4294967294", 2, 0);
19299         check("-4294967295", 1, 0);
19300         check("-4294967296", 4294967295UL, ERANGE);
19301         check("-4294967297", 4294967295UL, ERANGE);
19302 #endif
19303 EOCP
19304                 ;;
19305         *)
19306 : Should we write these tests to be more portable by sprintf-ing
19307 : ~0 and then manipulating that char string as input for strtol?
19308                 ;;
19309         esac
19310         $cat >>try.c <<'EOCP'
19311         if (!bad)
19312                 printf("ok\n");
19313         return 0;
19314 }
19315 EOCP
19316         set try
19317         if eval $compile; then
19318                 case "`$run ./try`" in
19319                 ok) echo "Your strtoul() seems to be working okay." ;;
19320                 *) cat <<EOM >&4
19321 Your strtoul() doesn't seem to be working okay.
19322 EOM
19323                    d_strtoul="$undef"
19324                    ;;
19325                 esac
19326         else
19327                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19328                 d_strtoul="$undef"
19329         fi
19330         ;;
19331 esac
19332
19333 : see if strtoull exists
19334 set strtoull d_strtoull
19335 eval $inlibc
19336
19337 case "$d_longlong-$d_strtoull" in
19338 "$define-$define")
19339         $cat <<EOM
19340 Checking whether your strtoull() works okay...
19341 EOM
19342         $cat >try.c <<'EOCP'
19343 #include <errno.h>
19344 #ifdef __hpux
19345 #define strtoull __strtoull
19346 #endif
19347 #include <stdio.h>
19348 extern unsigned long long int strtoull(char *s, char **, int);
19349 static int bad = 0;
19350 int check(char *s, long long eull, int een) {
19351         long long gull;
19352         errno = 0;
19353         gull = strtoull(s, 0, 10);
19354         if (!((gull == eull) && (errno == een)))
19355                 bad++;
19356 }
19357 int main() {
19358         check(" 1",                                        1LL, 0);
19359         check(" 0",                                        0LL, 0);
19360         check("18446744073709551615",  18446744073709551615ULL, 0);
19361         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19362 #if 0 /* strtoull() for /^-/ strings is undefined. */
19363         check("-1",                    18446744073709551615ULL, 0);
19364         check("-18446744073709551614",                     2LL, 0);
19365         check("-18446744073709551615",                     1LL, 0);
19366         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19367         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19368 #endif
19369         if (!bad)
19370                 printf("ok\n");
19371 }
19372 EOCP
19373         set try
19374         if eval $compile; then
19375                 case "`$run ./try`" in
19376                 ok) echo "Your strtoull() seems to be working okay." ;;
19377                 *) cat <<EOM >&4
19378 Your strtoull() doesn't seem to be working okay.
19379 EOM
19380                    d_strtoull="$undef"
19381                    ;;
19382                 esac
19383         else
19384                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19385                 d_strtoull="$undef"
19386         fi
19387         ;;
19388 esac
19389
19390 : see if strtouq exists
19391 set strtouq d_strtouq
19392 eval $inlibc
19393
19394 case "$d_strtouq" in
19395 "$define")
19396         $cat <<EOM
19397 Checking whether your strtouq() works okay...
19398 EOM
19399         $cat >try.c <<'EOCP'
19400 #include <errno.h>
19401 #include <stdio.h>
19402 extern unsigned long long int strtouq(char *s, char **, int);
19403 static int bad = 0;
19404 void check(char *s, unsigned long long eull, int een) {
19405         unsigned long long gull;
19406         errno = 0;
19407         gull = strtouq(s, 0, 10);
19408         if (!((gull == eull) && (errno == een)))
19409                 bad++;
19410 }
19411 int main() {
19412         check(" 1",                                        1LL, 0);
19413         check(" 0",                                        0LL, 0);
19414         check("18446744073709551615",  18446744073709551615ULL, 0);
19415         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19416 #if 0 /* strtouq() for /^-/ strings is undefined. */
19417         check("-1",                    18446744073709551615ULL, 0);
19418         check("-18446744073709551614",                     2LL, 0);
19419         check("-18446744073709551615",                     1LL, 0);
19420         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19421         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19422 #endif
19423         if (!bad)
19424                 printf("ok\n");
19425         return 0;
19426 }
19427 EOCP
19428         set try
19429         if eval $compile; then
19430                 case "`$run ./try`" in
19431                 ok) echo "Your strtouq() seems to be working okay." ;;
19432                 *) cat <<EOM >&4
19433 Your strtouq() doesn't seem to be working okay.
19434 EOM
19435                    d_strtouq="$undef"
19436                    ;;
19437                 esac
19438         else
19439                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19440                 d_strtouq="$undef"
19441         fi
19442         ;;
19443 esac
19444
19445 : see if strxfrm exists
19446 set strxfrm d_strxfrm
19447 eval $inlibc
19448
19449 : see if symlink exists
19450 set symlink d_symlink
19451 eval $inlibc
19452
19453 : see if syscall exists
19454 set syscall d_syscall
19455 eval $inlibc
19456
19457 : see if prototype for syscall is available
19458 echo " "
19459 set d_syscallproto syscall $i_unistd unistd.h
19460 eval $hasproto
19461
19462 : see if sysconf exists
19463 set sysconf d_sysconf
19464 eval $inlibc
19465
19466 : see if system exists
19467 set system d_system
19468 eval $inlibc
19469
19470 : see if tcgetpgrp exists
19471 set tcgetpgrp d_tcgetpgrp
19472 eval $inlibc
19473
19474 : see if tcsetpgrp exists
19475 set tcsetpgrp d_tcsetpgrp
19476 eval $inlibc
19477
19478 : see if prototype for telldir is available
19479 echo " "
19480 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19481 eval $hasproto
19482
19483 : see if tgamma exists
19484 set tgamma d_tgamma
19485 eval $inlibc
19486
19487 : see if time exists
19488 echo " "
19489 if test "X$d_time" = X -o X"$timetype" = X; then
19490     if set time val -f d_time; eval $csym; $val; then
19491                 echo 'time() found.' >&4
19492                 val="$define"
19493                 rp="What is the type returned by time() on this system?"
19494                 set time_t timetype long stdio.h sys/types.h
19495                 eval $typedef_ask
19496     else
19497                 echo 'time() not found, hope that will do.' >&4
19498                 val="$undef"
19499                 timetype='int';
19500     fi
19501     set d_time
19502     eval $setvar
19503 fi
19504
19505 : see if timegm exists
19506 set timegm d_timegm
19507 eval $inlibc
19508
19509 : see if this is a sys/times.h system
19510 set sys/times.h i_systimes
19511 eval $inhdr
19512
19513 : see if times exists
19514 echo " "
19515 if set times val -f d_times; eval $csym; $val; then
19516         echo 'times() found.' >&4
19517         d_times="$define"
19518         inc=''
19519         case "$i_systimes" in
19520         "$define") inc='sys/times.h';;
19521         esac
19522         rp="What is the type returned by times() on this system?"
19523         set clock_t clocktype long stdio.h sys/types.h $inc
19524         eval $typedef_ask
19525 else
19526         echo 'times() NOT found, hope that will do.' >&4
19527         d_times="$undef"
19528         clocktype='int'
19529 fi
19530
19531 : see if tmpnam_r exists
19532 set tmpnam_r d_tmpnam_r
19533 eval $inlibc
19534 case "$d_tmpnam_r" in
19535 "$define")
19536         hdrs="$i_systypes sys/types.h define stdio.h "
19537         case "$d_tmpnam_r_proto:$usethreads" in
19538         ":define")      d_tmpnam_r_proto=define
19539                 set d_tmpnam_r_proto tmpnam_r $hdrs
19540                 eval $hasproto ;;
19541         *)      ;;
19542         esac
19543         case "$d_tmpnam_r_proto" in
19544         define)
19545         case "$tmpnam_r_proto" in
19546         ''|0) try='char* tmpnam_r(char*);'
19547         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19548         esac
19549         case "$tmpnam_r_proto" in
19550         ''|0)   d_tmpnam_r=undef
19551                 tmpnam_r_proto=0
19552                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19553         * )     case "$tmpnam_r_proto" in
19554                 REENTRANT_PROTO*) ;;
19555                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19556                 esac
19557                 echo "Prototype: $try" ;;
19558         esac
19559         ;;
19560         *)      case "$usethreads" in
19561                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19562                 esac
19563                 d_tmpnam_r=undef
19564                 tmpnam_r_proto=0
19565                 ;;
19566         esac
19567         ;;
19568 *)      tmpnam_r_proto=0
19569         ;;
19570 esac
19571
19572 : see if trunc exists
19573 set trunc d_trunc
19574 eval $inlibc
19575
19576 : see if truncate exists
19577 set truncate d_truncate
19578 eval $inlibc
19579
19580 : see if ttyname_r exists
19581 set ttyname_r d_ttyname_r
19582 eval $inlibc
19583 case "$d_ttyname_r" in
19584 "$define")
19585         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19586         case "$d_ttyname_r_proto:$usethreads" in
19587         ":define")      d_ttyname_r_proto=define
19588                 set d_ttyname_r_proto ttyname_r $hdrs
19589                 eval $hasproto ;;
19590         *)      ;;
19591         esac
19592         case "$d_ttyname_r_proto" in
19593         define)
19594         case "$ttyname_r_proto" in
19595         ''|0) try='int ttyname_r(int, char*, size_t);'
19596         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19597         esac
19598         case "$ttyname_r_proto" in
19599         ''|0) try='int ttyname_r(int, char*, int);'
19600         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19601         esac
19602         case "$ttyname_r_proto" in
19603         ''|0) try='char* ttyname_r(int, char*, int);'
19604         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19605         esac
19606         case "$ttyname_r_proto" in
19607         ''|0)   d_ttyname_r=undef
19608                 ttyname_r_proto=0
19609                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19610         * )     case "$ttyname_r_proto" in
19611                 REENTRANT_PROTO*) ;;
19612                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19613                 esac
19614                 echo "Prototype: $try" ;;
19615         esac
19616         ;;
19617         *)      case "$usethreads" in
19618                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19619                 esac
19620                 d_ttyname_r=undef
19621                 ttyname_r_proto=0
19622                 ;;
19623         esac
19624         ;;
19625 *)      ttyname_r_proto=0
19626         ;;
19627 esac
19628
19629 : see if tzname[] exists
19630 echo " "
19631 if set tzname val -a d_tzname; eval $csym; $val; then
19632         val="$define"
19633         echo 'tzname[] found.' >&4
19634 else
19635         val="$undef"
19636         echo 'tzname[] NOT found.' >&4
19637 fi
19638 set d_tzname
19639 eval $setvar
19640
19641 : Check if is a multiplatform env
19642 case "$osname" in
19643 darwin) multiarch="$define" ;;
19644 esac
19645 case "$multiarch" in
19646 ''|[nN]*) multiarch="$undef" ;;
19647 esac
19648
19649 : check for ordering of bytes in a UV
19650 echo " "
19651 case "$multiarch" in
19652 *$define*)
19653         $cat <<EOM
19654 You seem to be doing a multiarchitecture build,
19655 skipping the byteorder check.
19656
19657 EOM
19658         byteorder='ffff'
19659         ;;
19660 *)
19661         case "$byteorder" in
19662         '')
19663                 $cat <<'EOM'
19664 In the following, larger digits indicate more significance.  A big-endian
19665 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19666 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19667 machines may have weird orders like 3412.  A Cray will report 87654321,
19668 an Alpha will report 12345678. If the test program works the default is
19669 probably right.
19670 I'm now running the test program...
19671 EOM
19672                 $cat >try.c <<EOCP
19673 #include <stdio.h>
19674 #$i_stdlib I_STDLIB
19675 #ifdef I_STDLIB
19676 #include <stdlib.h>
19677 #endif
19678 #include <sys/types.h>
19679 typedef $uvtype UV;
19680 int main()
19681 {
19682         int i;
19683         union {
19684                 UV l;
19685                 char c[$uvsize];
19686         } u;
19687
19688         if ($uvsize > 4)
19689                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19690         else
19691                 u.l = (UV)0x04030201;
19692         for (i = 0; i < $uvsize; i++)
19693                 printf("%c", u.c[i]+'0');
19694         printf("\n");
19695         exit(0);
19696 }
19697 EOCP
19698                 xxx_prompt=y
19699                 set try
19700                 if eval $compile && $run ./try > /dev/null; then
19701                         dflt=`$run ./try`
19702                         case "$dflt" in
19703                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19704                                 echo "(The test program ran ok.)"
19705                                 echo "byteorder=$dflt"
19706                                 xxx_prompt=n
19707                         ;;
19708                         ????|????????) echo "(The test program ran ok.)" ;;
19709                         *) echo "(The test program didn't run right for some reason.)" ;;
19710                         esac
19711                 else
19712                         dflt='4321'
19713                         cat <<'EOM'
19714 (I can't seem to compile the test program.  Guessing big-endian...)
19715 EOM
19716                 fi
19717                 case "$xxx_prompt" in
19718                 y)
19719                         rp="What is the order of bytes in $uvtype?"
19720                         . ./myread
19721                         byteorder="$ans"
19722                         ;;
19723                 *)      byteorder=$dflt
19724                         ;;
19725                 esac
19726                 ;;
19727         esac
19728         $rm_try
19729         ;;
19730 esac
19731
19732 : Checking 32bit alignedness
19733 $cat <<EOM
19734
19735 Checking to see whether you can access character data unalignedly...
19736 EOM
19737 case "$d_u32align" in
19738 '')   $cat >try.c <<EOCP
19739 #include <stdio.h>
19740 #$i_stdlib I_STDLIB
19741 #ifdef I_STDLIB
19742 #include <stdlib.h>
19743 #endif
19744 #define U32 $u32type
19745 #define BYTEORDER 0x$byteorder
19746 #define U8 $u8type
19747 #include <signal.h>
19748 #ifdef SIGBUS
19749 $signal_t bletch(int s) { exit(4); }
19750 #endif
19751 int main() {
19752 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19753     volatile U8 buf[8];
19754     volatile U32 *up;
19755     int i;
19756
19757     if (sizeof(U32) != 4) {
19758         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19759         exit(1);
19760     }
19761
19762     fflush(stdout);
19763
19764 #ifdef SIGBUS
19765     signal(SIGBUS, bletch);
19766 #endif
19767
19768     buf[0] = 0;
19769     buf[1] = 0;
19770     buf[2] = 0;
19771     buf[3] = 1;
19772     buf[4] = 0;
19773     buf[5] = 0;
19774     buf[6] = 0;
19775     buf[7] = 1;
19776
19777     for (i = 0; i < 4; i++) {
19778         up = (U32*)(buf + i);
19779         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19780                (*up == 1 << (8*(3-i)))  /* little-endian */
19781               )
19782            )
19783         {
19784             printf("read failed (%x)\n", *up);
19785             exit(2);
19786         }
19787     }
19788
19789     /* write test */
19790     for (i = 0; i < 4; i++) {
19791         up = (U32*)(buf + i);
19792         *up = 0xBeef;
19793         if (*up != 0xBeef) {
19794             printf("write failed (%x)\n", *up);
19795             exit(3);
19796         }
19797     }
19798
19799     exit(0);
19800 #else
19801     printf("1\n");
19802     exit(1);
19803 #endif
19804     return 0;
19805 }
19806 EOCP
19807 set try
19808 if eval $compile_ok; then
19809         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19810         $run ./try 2>&1 >/dev/null
19811         case "$?" in
19812         0)      cat >&4 <<EOM
19813 You can access character data pretty unalignedly.
19814 EOM
19815                 d_u32align="$undef"
19816                 ;;
19817         *)      cat >&4 <<EOM
19818 It seems that you must access character data in an aligned manner.
19819 EOM
19820                 d_u32align="$define"
19821                 ;;
19822         esac
19823 else
19824         rp='Can you access character data at unaligned addresses?'
19825         dflt='n'
19826         . ./myread
19827         case "$ans" in
19828         [yY]*)  d_u32align="$undef"  ;;
19829         *)      d_u32align="$define" ;;
19830         esac
19831 fi
19832 $rm_try
19833 ;;
19834 esac
19835
19836 : see if ualarm exists
19837 set ualarm d_ualarm
19838 eval $inlibc
19839
19840 : see if umask exists
19841 set umask d_umask
19842 eval $inlibc
19843
19844 : see if unordered exists
19845 set unordered d_unordered
19846 eval $inlibc
19847
19848 : see if unsetenv exists
19849 set unsetenv d_unsetenv
19850 eval $inlibc
19851
19852 : see if usleep exists
19853 set usleep d_usleep
19854 eval $inlibc
19855
19856 : see if prototype for usleep is available
19857 echo " "
19858 set d_usleepproto usleep $i_unistd unistd.h
19859 eval $hasproto
19860
19861 : see if ustat exists
19862 set ustat d_ustat
19863 eval $inlibc
19864
19865 : see if closedir exists
19866 set closedir d_closedir
19867 eval $inlibc
19868
19869 case "$d_closedir" in
19870 "$define")
19871         echo " "
19872         echo "Checking whether closedir() returns a status..." >&4
19873         cat > try.c <<EOM
19874 #$i_dirent I_DIRENT             /**/
19875 #$i_sysdir I_SYS_DIR            /**/
19876 #$i_sysndir I_SYS_NDIR          /**/
19877 #$i_systypes I_SYS_TYPES        /**/
19878
19879 #if defined(I_SYS_TYPES)
19880 #include <sys/types.h>
19881 #endif
19882 #if defined(I_DIRENT)
19883 #include <dirent.h>
19884 #else
19885 #ifdef I_SYS_NDIR
19886 #include <sys/ndir.h>
19887 #else
19888 #ifdef I_SYS_DIR
19889 #ifdef hp9000s500
19890 #include <ndir.h>       /* may be wrong in the future */
19891 #else
19892 #include <sys/dir.h>
19893 #endif
19894 #endif
19895 #endif
19896 #endif
19897 int main() { return closedir(opendir(".")); }
19898 EOM
19899         set try
19900         if eval $compile_ok; then
19901                 if $run ./try > /dev/null 2>&1 ; then
19902                         echo "Yes, it does."
19903                         val="$undef"
19904                 else
19905                         echo "No, it doesn't."
19906                         val="$define"
19907                 fi
19908         else
19909                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19910                 val="$define"
19911         fi
19912         ;;
19913 *)
19914         val="$undef";
19915         ;;
19916 esac
19917 set d_void_closedir
19918 eval $setvar
19919 $rm_try
19920
19921 : see if there is a wait4
19922 set wait4 d_wait4
19923 eval $inlibc
19924
19925 : see if waitpid exists
19926 set waitpid d_waitpid
19927 eval $inlibc
19928
19929 : look for wcscmp
19930 echo " "
19931 $cat >try.c <<'EOCP'
19932 #include <stdio.h>
19933 #include <wchar.h>
19934 int main ()
19935 {
19936     wchar_t *s = L" ";
19937     return (wcscmp (s, s) ? 1 : 0);
19938     }
19939 EOCP
19940 set try
19941 val="$undef"
19942 if eval $compile; then
19943     `$run ./try`
19944     case "$?" in
19945         0)  echo "A working wcscmp() found." >&4
19946             val="$define" ;;
19947         *)  echo "wcscmp() found, but it doesn't work" >&4
19948             ;;
19949         esac
19950 else
19951     echo "wcscmp() NOT found." >&4
19952     fi
19953 set d_wcscmp
19954 eval $setvar
19955 $rm_try
19956
19957 : see if wcstombs exists
19958 set wcstombs d_wcstombs
19959 eval $inlibc
19960
19961 : look for wcsxfrm
19962 echo " "
19963 $cat >try.c <<'EOCP'
19964 #include <errno.h>
19965 #include <wchar.h>
19966 int main ()
19967 {
19968     wchar_t dst[4], *src = L" ";
19969     errno = 0;
19970     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19971     }
19972 EOCP
19973 set try
19974 val="$undef"
19975 if eval $compile; then
19976     `$run ./try`
19977     case "$?" in
19978         0)  echo "A working wcsxfrm() found." >&4
19979             val="$define" ;;
19980         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19981             ;;
19982         esac
19983 else
19984     echo "wcsxfrm() NOT found." >&4
19985     fi
19986 set d_wcsxfrm
19987 eval $setvar
19988 $rm_try
19989
19990 : see if wctomb exists
19991 set wctomb d_wctomb
19992 eval $inlibc
19993
19994 : see if writev exists
19995 set writev d_writev
19996 eval $inlibc
19997
19998 : check for alignment requirements
19999 echo " "
20000 case "$alignbytes" in
20001     '') echo "Checking alignment constraints..." >&4
20002         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20003             $cat >try.c <<'EOCP'
20004 typedef long double NV;
20005 EOCP
20006         else
20007             $cat >try.c <<'EOCP'
20008 typedef double NV;
20009 EOCP
20010         fi
20011         $cat >>try.c <<'EOCP'
20012 #include <stdio.h>
20013 struct foobar {
20014     char foo;
20015     NV bar;
20016 } try_algn;
20017 int main()
20018 {
20019     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20020     return(0);
20021 }
20022 EOCP
20023         set try
20024         if eval $compile_ok; then
20025             dflt=`$run ./try`
20026         else
20027             dflt='8'
20028             echo "(I can't seem to compile the test program...)"
20029         fi
20030         case "$multiarch" in
20031             *$define*)
20032                 : The usual safe value is 8, but Darwin with -Duselongdouble
20033                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20034                 : Configure to pick a larger value if needed.
20035                 if $test "$dflt" -lt 8; then
20036                     dflt='8'
20037                     echo "Setting alignment to 8 for multiarch support.">&4
20038                 fi
20039                 ;;
20040         esac
20041         ;;
20042     *) dflt="$alignbytes"
20043         ;;
20044 esac
20045 rp="Doubles must be aligned on a how-many-byte boundary?"
20046 . ./myread
20047 alignbytes="$ans"
20048 $rm_try
20049
20050 : set the base revision
20051 baserev=5.0
20052
20053 : length of character in bytes. Is always 1, otherwise it is not C
20054 : This used to be a test using sizeof
20055 charsize=1
20056
20057 : Check for the number of bits in a character
20058 case "$charbits" in
20059 '')     echo "Checking how long a character is (in bits)..." >&4
20060         $cat >try.c <<EOCP
20061 #include <stdio.h>
20062 int main ()
20063 {
20064     int n;
20065     unsigned char c;
20066     for (c = 1, n = 0; c; c <<= 1, n++) ;
20067     printf ("%d\n", n);
20068     return (0);
20069     }
20070 EOCP
20071         set try
20072         if eval $compile_ok; then
20073                 dflt=`$run ./try`
20074         else
20075                 dflt='8'
20076                 echo "(I can't seem to compile the test program.  Guessing...)"
20077         fi
20078         ;;
20079 *)
20080         dflt="$charbits"
20081         ;;
20082 esac
20083 rp="What is the length of a character (in bits)?"
20084 . ./myread
20085 charbits="$ans"
20086 $rm_try
20087 case "$charbits" in
20088 8)      ;;
20089 *)      cat >&4 << EOM
20090 Your system has an unsigned character size of $charbits bits, which
20091 is rather unusual (normally it is 8 bits).  Perl likely will not work
20092 correctly on your system, with subtle bugs in various places.
20093 EOM
20094         rp='Do you really want to continue?'
20095         dflt='n'
20096         . ./myread
20097         case "$ans" in
20098                 [yY])   echo >&4 "Okay, continuing."    ;;
20099                 *)      exit 1                          ;;
20100         esac
20101 esac
20102
20103 : how do we concatenate cpp tokens here?
20104 echo " "
20105 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20106 $cat >cpp_stuff.c <<'EOCP'
20107 #define RCAT(a,b)a/**/b
20108 #define ACAT(a,b)a ## b
20109 RCAT(Rei,ser)
20110 ACAT(Cir,cus)
20111 EOCP
20112 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20113 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20114         echo "Oh!  Smells like ANSI's been here." >&4
20115         echo "We can catify or stringify, separately or together!"
20116         cpp_stuff=42
20117 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20118         echo "Ah, yes!  The good old days!" >&4
20119         echo "However, in the good old days we don't know how to stringify and"
20120         echo "catify at the same time."
20121         cpp_stuff=1
20122 else
20123         $cat >&4 <<EOM
20124 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20125 You're going to have to edit the values of CAT[2-5] in config.h...
20126 EOM
20127         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20128 fi
20129 $rm -f cpp_stuff.*
20130
20131 : see if this is a db.h system
20132 set db.h i_db
20133 eval $inhdr
20134
20135 case "$i_db" in
20136 $define)
20137         : Check db version.
20138         echo " "
20139         echo "Checking Berkeley DB version ..." >&4
20140         $cat >try.c <<EOCP
20141 #$d_const HASCONST
20142 #ifndef HASCONST
20143 #define const
20144 #endif
20145 #include <sys/types.h>
20146 #include <stdio.h>
20147 #$i_stdlib I_STDLIB
20148 #ifdef I_STDLIB
20149 #include <stdlib.h>
20150 #endif
20151 #include <db.h>
20152 int main(int argc, char *argv[])
20153 {
20154 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20155     int Major, Minor, Patch ;
20156     unsigned long Version ;
20157     (void)db_version(&Major, &Minor, &Patch) ;
20158     if (argc == 2) {
20159         printf("%d %d %d %d %d %d\n",
20160                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20161                Major, Minor, Patch);
20162         exit(0);
20163     }
20164     printf("You have Berkeley DB Version 2 or greater.\n");
20165
20166     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20167                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20168     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20169                 Major, Minor, Patch) ;
20170
20171     /* check that db.h & libdb are compatible */
20172     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20173         printf("db.h and libdb are incompatible.\n") ;
20174         exit(3);
20175     }
20176
20177     printf("db.h and libdb are compatible.\n") ;
20178
20179     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20180                 + DB_VERSION_PATCH ;
20181
20182     /* needs to be >= 2.3.4 */
20183     if (Version < 2003004) {
20184     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20185         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20186         exit(2);
20187     }
20188
20189     exit(0);
20190 #else
20191 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20192     if (argc == 2) {
20193         printf("1 0 0\n");
20194         exit(0);
20195     }
20196     printf("You have Berkeley DB Version 1.\n");
20197     exit(0);    /* DB version < 2: the coast is clear. */
20198 #else
20199     exit(1);    /* <db.h> not Berkeley DB? */
20200 #endif
20201 #endif
20202 }
20203 EOCP
20204         set try
20205         if eval $compile_ok && $run ./try; then
20206                 echo 'Looks OK.' >&4
20207                 set `$run ./try 1`
20208                 db_version_major=$1
20209                 db_version_minor=$2
20210                 db_version_patch=$3
20211         else
20212                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20213                 i_db=$undef
20214                 case " $libs " in
20215                 *"-ldb "*)
20216                         : Remove db from list of libraries to use
20217                         echo "Removing unusable -ldb from library list" >&4
20218                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20219                         shift
20220                         libs="$*"
20221                         echo "libs = $libs" >&4
20222                         ;;
20223                 esac
20224         fi
20225         $rm_try
20226         ;;
20227 esac
20228
20229 case "$i_db" in
20230 define)
20231         : Check the return type needed for hash
20232         echo " "
20233         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20234         $cat >try.c <<EOCP
20235 #$d_const HASCONST
20236 #ifndef HASCONST
20237 #define const
20238 #endif
20239 #include <sys/types.h>
20240 #include <db.h>
20241
20242 #ifndef DB_VERSION_MAJOR
20243 u_int32_t hash_cb (const void* ptr, size_t size)
20244 {
20245 }
20246 HASHINFO info;
20247 int main()
20248 {
20249         info.hash = hash_cb;
20250 }
20251 #endif
20252 EOCP
20253         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20254                 if $contains warning try.out >>/dev/null 2>&1 ; then
20255                         db_hashtype='int'
20256                 else
20257                         db_hashtype='u_int32_t'
20258                 fi
20259         else
20260                 : XXX Maybe we should just give up here.
20261                 db_hashtype=u_int32_t
20262                 $cat try.out >&4
20263                 echo "Help:  I can't seem to compile the db test program." >&4
20264                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20265         fi
20266         $rm_try
20267         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20268         ;;
20269 *)      db_hashtype=u_int32_t
20270         ;;
20271 esac
20272 case "$i_db" in
20273 define)
20274         : Check the return type needed for prefix
20275         echo " "
20276         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20277         cat >try.c <<EOCP
20278 #$d_const HASCONST
20279 #ifndef HASCONST
20280 #define const
20281 #endif
20282 #include <sys/types.h>
20283 #include <db.h>
20284
20285 #ifndef DB_VERSION_MAJOR
20286 size_t prefix_cb (const DBT *key1, const DBT *key2)
20287 {
20288 }
20289 BTREEINFO info;
20290 int main()
20291 {
20292         info.prefix = prefix_cb;
20293 }
20294 #endif
20295 EOCP
20296         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20297                 if $contains warning try.out >>/dev/null 2>&1 ; then
20298                         db_prefixtype='int'
20299                 else
20300                         db_prefixtype='size_t'
20301                 fi
20302         else
20303                 db_prefixtype='size_t'
20304                 : XXX Maybe we should just give up here.
20305                 $cat try.out >&4
20306                 echo "Help:  I can't seem to compile the db test program." >&4
20307                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20308         fi
20309         $rm_try
20310         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20311         ;;
20312 *)      db_prefixtype='size_t'
20313         ;;
20314 esac
20315
20316 : How can we generate normalized random numbers ?
20317 echo " "
20318 echo "Using our internal random number implementation..." >&4
20319
20320 case "$ccflags" in
20321 *-Dmy_rand=*|*-Dmy_srand=*)
20322         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20323         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20324         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20325         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20326         ;;
20327 esac
20328
20329 randfunc=Perl_drand48
20330 drand01="Perl_drand48()"
20331 seedfunc="Perl_drand48_init"
20332 randbits=48
20333 randseedtype=U32
20334
20335 : Determine if this is an EBCDIC system
20336 echo " "
20337 echo "Determining whether or not we are on an EBCDIC system..." >&4
20338 $cat >try.c <<'EOM'
20339 int main()
20340 {
20341   if ('M'==0xd4) return 0;
20342   return 1;
20343 }
20344 EOM
20345
20346 val=$undef
20347 set try
20348 if eval $compile_ok; then
20349         if $run ./try; then
20350                 echo "You seem to speak EBCDIC." >&4
20351                 val="$define"
20352         else
20353                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20354         fi
20355 else
20356         echo "I'm unable to compile the test program." >&4
20357         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20358 fi
20359 $rm_try
20360 set ebcdic
20361 eval $setvar
20362
20363 : Check how to flush
20364 echo " "
20365 $cat >&4 <<EOM
20366 Checking how to flush all pending stdio output...
20367 EOM
20368 # I only know how to find the first 32 possibly open files on SunOS.
20369 # See also hints/sunos_4_1.sh and util.c  --AD
20370 case "$osname" in
20371 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20372 esac
20373 $cat >>try.c <<EOCP
20374 #include <stdio.h>
20375 #$i_stdlib I_STDLIB
20376 #ifdef I_STDLIB
20377 #include <stdlib.h>
20378 #endif
20379 #$i_unistd I_UNISTD
20380 #ifdef I_UNISTD
20381 # include <unistd.h>
20382 #endif
20383 #$d_sysconf HAS_SYSCONF
20384 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20385 #ifdef HAS_STDIO_STREAM_ARRAY
20386 # define STDIO_STREAM_ARRAY $stdio_stream_array
20387 #endif
20388 int main() {
20389   FILE* p;
20390   unlink("try.out");
20391   p = fopen("try.out", "w");
20392 #ifdef TRY_FPUTC
20393   fputc('x', p);
20394 #else
20395 # ifdef TRY_FPRINTF
20396   fprintf(p, "x");
20397 # endif
20398 #endif
20399 #ifdef TRY_FFLUSH_NULL
20400   fflush(NULL);
20401 #endif
20402 #ifdef TRY_FFLUSH_ALL
20403   {
20404     long open_max = -1;
20405 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20406     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20407 # else
20408 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20409     open_max = sysconf(_SC_OPEN_MAX);
20410 #  else
20411 #   ifdef FOPEN_MAX
20412     open_max = FOPEN_MAX;
20413 #   else
20414 #    ifdef OPEN_MAX
20415     open_max = OPEN_MAX;
20416 #    else
20417 #     ifdef _NFILE
20418     open_max = _NFILE;
20419 #     endif
20420 #    endif
20421 #   endif
20422 #  endif
20423 # endif
20424 # ifdef HAS_STDIO_STREAM_ARRAY
20425     if (open_max > 0) {
20426       long i;
20427       for (i = 0; i < open_max; i++)
20428             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20429                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20430                 STDIO_STREAM_ARRAY[i]._flag)
20431                 fflush(&STDIO_STREAM_ARRAY[i]);
20432     }
20433   }
20434 # endif
20435 #endif
20436   _exit(42);
20437 }
20438 EOCP
20439 : first we have to find out how _not_ to flush
20440 $to try.c
20441 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20442     output=''
20443     set try -DTRY_FPUTC
20444     if eval $compile; then
20445             $run ./try 2>/dev/null
20446             code="$?"
20447             $from try.out
20448             if $test ! -s try.out -a "X$code" = X42; then
20449                 output=-DTRY_FPUTC
20450             fi
20451     fi
20452     case "$output" in
20453     '')
20454             set try -DTRY_FPRINTF
20455             if eval $compile; then
20456                     $run ./try 2>/dev/null
20457                     code="$?"
20458                     $from try.out
20459                     if $test ! -s try.out -a "X$code" = X42; then
20460                         output=-DTRY_FPRINTF
20461                     fi
20462             fi
20463         ;;
20464     esac
20465 fi
20466 : check for fflush NULL behavior
20467 case "$fflushNULL" in
20468 '')     set try -DTRY_FFLUSH_NULL $output
20469         if eval $compile; then
20470                 $run ./try 2>/dev/null
20471                 code="$?"
20472                 $from try.out
20473                 if $test -s try.out -a "X$code" = X42; then
20474                         fflushNULL="`$cat try.out`"
20475                 else
20476                         if $test "X$code" != X42; then
20477                                 $cat >&4 <<EOM
20478 (If this test failed, don't worry, we'll try another method shortly.)
20479 EOM
20480                         fi
20481                 fi
20482         fi
20483         $rm -f core try.core core.try.*
20484         case "$fflushNULL" in
20485         x)      $cat >&4 <<EOM
20486 Your fflush(NULL) works okay for output streams.
20487 Let's see if it clobbers input pipes...
20488 EOM
20489 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20490 # bug that improperly flushes the input end of pipes.  So we avoid the
20491 # autoflush on fork/system/exec support for now. :-(
20492 $cat >tryp.c <<EOCP
20493 #include <stdio.h>
20494 int
20495 main(int argc, char **argv)
20496 {
20497     char buf[1024];
20498     int i;
20499     char *bp = buf;
20500     while (1) {
20501         while ((i = getc(stdin)) != -1
20502                && (*bp++ = i) != '\n'
20503                && bp < &buf[1024])
20504         /* DO NOTHING */ ;
20505         *bp = '\0';
20506         fprintf(stdout, "%s", buf);
20507         fflush(NULL);
20508         if (i == -1)
20509             return 0;
20510         bp = buf;
20511     }
20512 }
20513 EOCP
20514                 fflushNULL="$define"
20515                 set tryp
20516                 if eval $compile; then
20517                     $rm -f tryp.out
20518                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20519                     if $test "X$targethost" != X; then
20520                         $to tryp.c
20521                         $to tryp
20522                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20523                     else
20524                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20525                     fi
20526                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20527                        $cat >&4 <<EOM
20528 fflush(NULL) seems to behave okay with input streams.
20529 EOM
20530                         fflushNULL="$define"
20531                     else
20532                         $cat >&4 <<EOM
20533 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20534 EOM
20535                         fflushNULL="$undef"
20536                     fi
20537                 fi
20538                 $rm -f core tryp.c tryp.core core.tryp.*
20539                 ;;
20540         '')     $cat >&4 <<EOM
20541 Your fflush(NULL) isn't working (contrary to ANSI C).
20542 EOM
20543                 fflushNULL="$undef"
20544                 ;;
20545         *)      $cat >&4 <<EOM
20546 Cannot figure out whether your fflush(NULL) works or not.
20547 I'm assuming it doesn't (contrary to ANSI C).
20548 EOM
20549                 fflushNULL="$undef"
20550                 ;;
20551         esac
20552         ;;
20553 $define|true|[yY]*)
20554         fflushNULL="$define"
20555         ;;
20556 *)
20557         fflushNULL="$undef"
20558         ;;
20559 esac
20560 : check explicit looping only if NULL did not work, and if the pipe
20561 : bug does not show up on an explicit flush too
20562 case "$fflushNULL" in
20563 "$undef")
20564         $cat >tryp.c <<EOCP
20565 #include <stdio.h>
20566 int
20567 main(int argc, char **argv)
20568 {
20569     char buf[1024];
20570     int i;
20571     char *bp = buf;
20572     while (1) {
20573         while ((i = getc(stdin)) != -1
20574                && (*bp++ = i) != '\n'
20575                && bp < &buf[1024])
20576         /* DO NOTHING */ ;
20577         *bp = '\0';
20578         fprintf(stdout, "%s", buf);
20579         fflush(stdin);
20580         if (i == -1)
20581             return 0;
20582         bp = buf;
20583     }
20584 }
20585 EOCP
20586         set tryp
20587         if eval $compile; then
20588             $rm -f tryp.out
20589             if $test "X$targethost" != X; then
20590                 $to tryp.c
20591                 $to tryp
20592                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20593             else
20594                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20595             fi
20596             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20597                $cat >&4 <<EOM
20598 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20599 EOM
20600                 : now check for fflushall behaviour
20601                 case "$fflushall" in
20602                 '')     set try -DTRY_FFLUSH_ALL $output
20603                         if eval $compile; then
20604                                 $cat >&4 <<EOM
20605 (Now testing the other method--but note that this also may fail.)
20606 EOM
20607                                 $run ./try 2>/dev/null
20608                                 code=$?
20609                                 $from try.out
20610                                 if $test -s try.out -a "X$code" = X42; then
20611                                         fflushall="`$cat try.out`"
20612                                 fi
20613                         fi
20614                         $rm_try
20615                         case "$fflushall" in
20616                         x)      $cat >&4 <<EOM
20617 Whew. Flushing explicitly all the stdio streams works.
20618 EOM
20619                                 fflushall="$define"
20620                                 ;;
20621                         '')     $cat >&4 <<EOM
20622 Sigh. Flushing explicitly all the stdio streams doesn't work.
20623 EOM
20624                                 fflushall="$undef"
20625                                 ;;
20626                         *)      $cat >&4 <<EOM
20627 Cannot figure out whether flushing stdio streams explicitly works or not.
20628 I'm assuming it doesn't.
20629 EOM
20630                                 fflushall="$undef"
20631                                 ;;
20632                         esac
20633                         ;;
20634                 "$define"|true|[yY]*)
20635                         fflushall="$define"
20636                         ;;
20637                 *)
20638                         fflushall="$undef"
20639                         ;;
20640                 esac
20641             else
20642                 $cat >&4 <<EOM
20643 All is futile.  Even fflush(stdin) clobbers input pipes!
20644 EOM
20645                 fflushall="$undef"
20646             fi
20647         else
20648             fflushall="$undef"
20649         fi
20650         $rm -f core tryp.c tryp.core core.tryp.*
20651         ;;
20652 *)      fflushall="$undef"
20653         ;;
20654 esac
20655
20656 case "$fflushNULL$fflushall" in
20657 undefundef)
20658         $cat <<EOM
20659 OK, I give up.  I cannot figure out how to flush pending stdio output.
20660 We won't be flushing handles at all before fork/exec/popen.
20661 EOM
20662         ;;
20663 esac
20664 $rm_try tryp
20665
20666 : Store the full pathname to the ar program for use in the C program
20667 : Respect a hint or command line value for full_ar.
20668 case "$full_ar" in
20669 '') full_ar=$ar ;;
20670 esac
20671
20672 : Store the full pathname to the sed program for use in the C program
20673 full_sed=$sed
20674
20675 : see what type gids are declared as in the kernel
20676 echo " "
20677 echo "Looking for the type for group ids returned by getgid()."
20678 set gid_t gidtype xxx stdio.h sys/types.h
20679 eval $typedef
20680 case "$gidtype" in
20681 xxx)
20682         xxx=`./findhdr sys/user.h`
20683         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20684         case $1 in
20685         unsigned) dflt="$1 $2" ;;
20686         *) dflt="$1" ;;
20687         esac
20688         ;;
20689 *) dflt="$gidtype";;
20690 esac
20691 case "$gidtype" in
20692 gid_t) echo "gid_t found." ;;
20693 *)      rp="What is the type for group ids returned by getgid()?"
20694         . ./myread
20695         gidtype="$ans"
20696         ;;
20697 esac
20698
20699 : Check the size of GID
20700 echo " "
20701 case "$gidtype" in
20702 *_t) zzz="$gidtype"     ;;
20703 *)   zzz="gid"          ;;
20704 esac
20705 echo "Checking the size of $zzz..." >&4
20706 cat > try.c <<EOCP
20707 #include <sys/types.h>
20708 #include <stdio.h>
20709 #$i_stdlib I_STDLIB
20710 #ifdef I_STDLIB
20711 #include <stdlib.h>
20712 #endif
20713 int main() {
20714     printf("%d\n", (int)sizeof($gidtype));
20715     exit(0);
20716 }
20717 EOCP
20718 set try
20719 if eval $compile_ok; then
20720         yyy=`$run ./try`
20721         case "$yyy" in
20722         '')     gidsize=4
20723                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20724                 ;;
20725         *)      gidsize=$yyy
20726                 echo "Your $zzz is $gidsize bytes long."
20727                 ;;
20728         esac
20729 else
20730         gidsize=4
20731         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20732 fi
20733
20734
20735 : Check if GID is signed
20736 echo " "
20737 case "$gidtype" in
20738 *_t) zzz="$gidtype"     ;;
20739 *)   zzz="gid"          ;;
20740 esac
20741 echo "Checking the sign of $zzz..." >&4
20742 cat > try.c <<EOCP
20743 #include <sys/types.h>
20744 #include <stdio.h>
20745 int main() {
20746         $gidtype foo = -1;
20747         if (foo < 0)
20748                 printf("-1\n");
20749         else
20750                 printf("1\n");
20751 }
20752 EOCP
20753 set try
20754 if eval $compile; then
20755         yyy=`$run ./try`
20756         case "$yyy" in
20757         '')     gidsign=1
20758                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20759                 ;;
20760         *)      gidsign=$yyy
20761                 case "$gidsign" in
20762                  1) echo "Your $zzz is unsigned." ;;
20763                 -1) echo "Your $zzz is signed."   ;;
20764                 esac
20765                 ;;
20766         esac
20767 else
20768         gidsign=1
20769         echo "(I can't compile the test program--guessing unsigned.)" >&4
20770 fi
20771
20772
20773 : Check 64bit sizes
20774 echo " "
20775
20776 if $test X"$quadtype" != X; then
20777
20778 echo "Checking how to print 64-bit integers..." >&4
20779
20780 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20781         $cat >try.c <<'EOCP'
20782 #include <sys/types.h>
20783 #include <stdio.h>
20784 int main() {
20785   int q = 12345678901;
20786   printf("%ld\n", q);
20787 }
20788 EOCP
20789         set try
20790         if eval $compile; then
20791                 yyy=`$run ./try`
20792                 case "$yyy" in
20793                 12345678901)
20794                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20795                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20796                         echo "We will use %d."
20797                         ;;
20798                 esac
20799         fi
20800 fi
20801
20802 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20803         $cat >try.c <<'EOCP'
20804 #include <sys/types.h>
20805 #include <stdio.h>
20806 int main() {
20807   long q = 12345678901;
20808   printf("%ld\n", q);
20809 }
20810 EOCP
20811         set try
20812         if eval $compile; then
20813                 yyy=`$run ./try`
20814                 case "$yyy" in
20815                 12345678901)
20816                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20817                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20818                         echo "We will use %ld."
20819                         ;;
20820                 esac
20821         fi
20822 fi
20823
20824 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20825         $cat >try.c <<'EOCP'
20826 #include <sys/types.h>
20827 #include <inttypes.h>
20828 #include <stdio.h>
20829 int main() {
20830   int64_t q = 12345678901;
20831   printf("%" PRId64 "\n", q);
20832 }
20833 EOCP
20834         set try
20835         if eval $compile; then
20836                 yyy=`$run ./try`
20837                 case "$yyy" in
20838                 12345678901)
20839                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20840                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20841                         echo "We will use the C9X style."
20842                         ;;
20843                 esac
20844         fi
20845 fi
20846
20847 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20848         $cat >try.c <<EOCP
20849 #include <sys/types.h>
20850 #include <stdio.h>
20851 int main() {
20852   $quadtype q = 12345678901;
20853   printf("%Ld\n", q);
20854 }
20855 EOCP
20856         set try
20857         if eval $compile; then
20858                 yyy=`$run ./try`
20859                 case "$yyy" in
20860                 12345678901)
20861                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20862                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20863                         echo "We will use %Ld."
20864                         ;;
20865                 esac
20866         fi
20867 fi
20868
20869 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20870         $cat >try.c <<'EOCP'
20871 #include <sys/types.h>
20872 #include <stdio.h>
20873 int main() {
20874   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20875   printf("%lld\n", q);
20876 }
20877 EOCP
20878         set try
20879         if eval $compile; then
20880                 yyy=`$run ./try`
20881                 case "$yyy" in
20882                 12345678901)
20883                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20884                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20885                         echo "We will use the %lld style."
20886                         ;;
20887                 esac
20888         fi
20889 fi
20890
20891 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20892         $cat >try.c <<EOCP
20893 #include <sys/types.h>
20894 #include <stdio.h>
20895 int main() {
20896   $quadtype q = 12345678901;
20897   printf("%qd\n", q);
20898 }
20899 EOCP
20900         set try
20901         if eval $compile; then
20902                 yyy=`$run ./try`
20903                 case "$yyy" in
20904                 12345678901)
20905                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20906                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20907                         echo "We will use %qd."
20908                         ;;
20909                 esac
20910         fi
20911 fi
20912
20913 if $test X"$sPRId64" = X; then
20914         echo "Cannot figure out how to print 64-bit integers." >&4
20915 fi
20916 $rm_try
20917
20918 fi
20919
20920 case "$sPRId64" in
20921 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20922         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20923         ;;
20924 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20925         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20926         ;;
20927 esac
20928
20929 : Check format strings for internal types
20930 echo " "
20931 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20932
20933 if $test X"$ivsize" = X8; then
20934         ivdformat="$sPRId64"
20935         uvuformat="$sPRIu64"
20936         uvoformat="$sPRIo64"
20937         uvxformat="$sPRIx64"
20938         uvXUformat="$sPRIXU64"
20939 else
20940         if $test X"$ivsize" = X"$longsize"; then
20941                 ivdformat='"ld"'
20942                 uvuformat='"lu"'
20943                 uvoformat='"lo"'
20944                 uvxformat='"lx"'
20945                 uvXUformat='"lX"'
20946         else
20947                 if $test X"$ivsize" = X"$intsize"; then
20948                         ivdformat='"d"'
20949                         uvuformat='"u"'
20950                         uvoformat='"o"'
20951                         uvxformat='"x"'
20952                         uvXUformat='"X"'
20953                 else
20954                         : far out
20955                         if $test X"$ivsize" = X"$shortsize"; then
20956                                 ivdformat='"hd"'
20957                                 uvuformat='"hu"'
20958                                 uvoformat='"ho"'
20959                                 uvxformat='"hx"'
20960                                 uvXUformat='"hX"'
20961                         fi
20962                 fi
20963         fi
20964 fi
20965
20966 if $test X"$usequadmath" = X"$define"; then
20967     nveformat='"Qe"'
20968     nvfformat='"Qf"'
20969     nvgformat='"Qg"'
20970     nvEUformat='"QE"'
20971     nvFUformat='"QF"'
20972     nvGUformat='"QG"'
20973 else
20974     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20975         nveformat="$sPRIeldbl"
20976         nvfformat="$sPRIfldbl"
20977         nvgformat="$sPRIgldbl"
20978         nvEUformat="$sPRIEUldbl"
20979         nvFUformat="$sPRIFUldbl"
20980         nvGUformat="$sPRIGUldbl"
20981     else
20982         nveformat='"e"'
20983         nvfformat='"f"'
20984         nvgformat='"g"'
20985         nvEUformat='"E"'
20986         nvFUformat='"F"'
20987         nvGUformat='"G"'
20988     fi
20989 fi
20990
20991 case "$ivdformat" in
20992 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20993     exit 1
20994     ;;
20995 esac
20996
20997 : Check format string for GID
20998
20999 echo " "
21000 $echo "Checking the format string to be used for gids..." >&4
21001
21002 case "$gidsign" in
21003 -1)     if $test X"$gidsize" = X"$ivsize"; then
21004                 gidformat="$ivdformat"
21005         else
21006                 if $test X"$gidsize" = X"$longsize"; then
21007                         gidformat='"ld"'
21008                 else
21009                         if $test X"$gidsize" = X"$intsize"; then
21010                                 gidformat='"d"'
21011                         else
21012                                 if $test X"$gidsize" = X"$shortsize"; then
21013                                         gidformat='"hd"'
21014                                 fi
21015                         fi
21016                 fi
21017         fi
21018         ;;
21019 *)      if $test X"$gidsize" = X"$uvsize"; then
21020                 gidformat="$uvuformat"
21021         else
21022                 if $test X"$gidsize" = X"$longsize"; then
21023                         gidformat='"lu"'
21024                 else
21025                         if $test X"$gidsize" = X"$intsize"; then
21026                                 gidformat='"u"'
21027                         else
21028                                 if $test X"$gidsize" = X"$shortsize"; then
21029                                         gidformat='"hu"'
21030                                 fi
21031                         fi
21032                 fi
21033         fi
21034         ;;
21035 esac
21036
21037 : see if getgroups exists
21038 set getgroups d_getgrps
21039 eval $inlibc
21040
21041 : see if setgroups exists
21042 set setgroups d_setgrps
21043 eval $inlibc
21044
21045 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21046 echo " "
21047 case "$d_getgrps$d_setgrps" in
21048 *define*)
21049         case "$groupstype" in
21050         '') dflt="$gidtype" ;;
21051         *)  dflt="$groupstype" ;;
21052         esac
21053         $cat <<EOM
21054 What type of pointer is the second argument to getgroups() and setgroups()?
21055 Usually this is the same as group ids, $gidtype, but not always.
21056
21057 EOM
21058         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21059         . ./myread
21060         groupstype="$ans"
21061         ;;
21062 *)  groupstype="$gidtype";;
21063 esac
21064
21065 : check whether make sets MAKE
21066 echo " "
21067 echo "Checking if your $make program sets \$(MAKE)..." >&4
21068 case "$make_set_make" in
21069 '')
21070         $sed 's/^X //' > testmake.mak << 'EOF'
21071 Xall:
21072 X       @echo 'maketemp="$(MAKE)"'
21073 EOF
21074         case "`$make -f testmake.mak 2>/dev/null`" in
21075         *maketemp=*) make_set_make='#' ;;
21076         *)      make_set_make="MAKE=$make" ;;
21077         esac
21078         $rm -f testmake.mak
21079         ;;
21080 esac
21081 case "$make_set_make" in
21082 '#') echo "Yup, it does.";;
21083 *) echo "Nope, it doesn't.";;
21084 esac
21085
21086 : see what type is used for mode_t
21087 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21088 set mode_t modetype int stdio.h sys/types.h
21089 eval $typedef_ask
21090
21091 : see if we need va_copy
21092 echo " "
21093 case "$i_stdarg" in
21094 "$define")
21095         $cat >try.c <<EOCP
21096 #include <stdarg.h>
21097 #include <stdio.h>
21098 #$i_stdlib I_STDLIB
21099 #ifdef I_STDLIB
21100 #include <stdlib.h>
21101 #endif
21102 #include <signal.h>
21103
21104 int
21105 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21106 {
21107   return vfprintf(f, fmt, *valp);
21108 }
21109
21110 int
21111 myvfprintf(FILE *f, const  char *fmt, va_list val)
21112 {
21113   return ivfprintf(f, fmt, &val);
21114 }
21115
21116 int
21117 myprintf(char *fmt, ...)
21118 {
21119   va_list val;
21120   va_start(val, fmt);
21121   return myvfprintf(stdout, fmt, val);
21122 }
21123
21124 int
21125 main(int ac, char **av)
21126 {
21127   signal(SIGSEGV, exit);
21128
21129   myprintf("%s%cs all right, then\n", "that", '\'');
21130   exit(0);
21131 }
21132 EOCP
21133         set try
21134         if eval $compile && $run ./try 2>&1 >/dev/null; then
21135                 case "`$run ./try`" in
21136                 "that's all right, then")
21137                         okay=yes
21138                         ;;
21139                 esac
21140         fi
21141         case "$okay" in
21142         yes)    echo "It seems that you don't need va_copy()." >&4
21143                 need_va_copy="$undef"
21144                 ;;
21145         *)      echo "It seems that va_copy() or similar will be needed." >&4
21146                 need_va_copy="$define"
21147                 ;;
21148         esac
21149         $rm_try
21150         ;;
21151 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21152         need_va_copy="$undef"
21153         ;;
21154 esac
21155
21156 : see what type is used for size_t
21157 rp="What is the type used for the length parameter for string functions?"
21158 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21159 eval $typedef_ask
21160
21161 : check for type of arguments to gethostbyaddr.
21162 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21163         case "$d_gethbyaddr" in
21164         $define)
21165                 $cat <<EOM
21166
21167 Checking to see what type of arguments are accepted by gethostbyaddr().
21168 EOM
21169                 hdrs="$define sys/types.h
21170                         $d_socket sys/socket.h
21171                         $i_niin netinet/in.h
21172                         $i_netdb netdb.h
21173                         $i_unistd unistd.h"
21174                 : The first arg can 'char *' or 'void *'
21175                 : The second arg is some of integral type
21176                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21177                         for yyy in size_t long int; do
21178                                 case "$netdb_host_type" in
21179                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21180                                         if ./protochk "$try" $hdrs; then
21181                                                 echo "Your system accepts $xxx for the first arg."
21182                                                 echo "...and $yyy for the second arg."
21183                                                 netdb_host_type="$xxx"
21184                                                 netdb_hlen_type="$yyy"
21185                                         fi
21186                                         ;;
21187                                 esac
21188                         done
21189                 done
21190                 : In case none of those worked, prompt the user.
21191                 case "$netdb_host_type" in
21192                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21193                         dflt='char *'
21194                         . ./myread
21195                         netdb_host_type=$ans
21196                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21197                         dflt="$sizetype"
21198                         . ./myread
21199                         netdb_hlen_type=$ans
21200                         ;;
21201                 esac
21202                 ;;
21203         *)      : no gethostbyaddr, so pick harmless defaults
21204                 netdb_host_type='char *'
21205                 netdb_hlen_type="$sizetype"
21206                 ;;
21207         esac
21208         # Remove the "const" if needed. -- but then we'll have a
21209         # prototype clash!
21210         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21211 fi
21212
21213 : check for type of argument to gethostbyname.
21214 if test "X$netdb_name_type" = X ; then
21215         case "$d_gethbyname" in
21216         $define)
21217                 $cat <<EOM
21218
21219 Checking to see what type of argument is accepted by gethostbyname().
21220 EOM
21221                 hdrs="$define sys/types.h
21222                         $d_socket sys/socket.h
21223                         $i_niin netinet/in.h
21224                         $i_netdb netdb.h
21225                         $i_unistd unistd.h"
21226                 for xxx in "const char *" "char *"; do
21227                         case "$netdb_name_type" in
21228                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21229                                 if ./protochk "$try" $hdrs; then
21230                                         echo "Your system accepts $xxx."
21231                                         netdb_name_type="$xxx"
21232                                 fi
21233                                 ;;
21234                         esac
21235                 done
21236                 : In case none of those worked, prompt the user.
21237                 case "$netdb_name_type" in
21238                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21239                         dflt='char *'
21240                         . ./myread
21241                         netdb_name_type=$ans
21242                         ;;
21243                 esac
21244                 ;;
21245         *)      : no gethostbyname, so pick harmless default
21246                 netdb_name_type='char *'
21247                 ;;
21248         esac
21249 fi
21250
21251 : check for type of 1st argument to getnetbyaddr.
21252 if test "X$netdb_net_type" = X ; then
21253         case "$d_getnbyaddr" in
21254         $define)
21255                 $cat <<EOM
21256
21257 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21258 EOM
21259                 hdrs="$define sys/types.h
21260                         $d_socket sys/socket.h
21261                         $i_niin netinet/in.h
21262                         $i_netdb netdb.h
21263                         $i_unistd unistd.h"
21264                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21265                         case "$netdb_net_type" in
21266                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21267                                 if ./protochk "$try" $hdrs; then
21268                                         echo "Your system accepts $xxx."
21269                                         netdb_net_type="$xxx"
21270                                 fi
21271                                 ;;
21272                         esac
21273                 done
21274                 : In case none of those worked, prompt the user.
21275                 case "$netdb_net_type" in
21276                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21277                         dflt='long'
21278                         . ./myread
21279                         netdb_net_type=$ans
21280                         ;;
21281                 esac
21282                 ;;
21283         *)      : no getnetbyaddr, so pick harmless default
21284                 netdb_net_type='long'
21285                 ;;
21286         esac
21287 fi
21288 : locate the preferred pager for this system
21289 fn=f/
21290 case "$pager" in
21291 '')
21292         dflt=''
21293         case "$pg" in
21294         /*) dflt=$pg;;
21295         [a-zA-Z]:/*) dflt=$pg;;
21296         esac
21297         case "$more" in
21298         /*) dflt=$more;;
21299         [a-zA-Z]:/*) dflt=$more;;
21300         esac
21301         case "$less" in
21302         /*) dflt=$less;;
21303         [a-zA-Z]:/*) dflt=$less;;
21304         esac
21305         case "$dflt" in
21306         '') dflt=/usr/ucb/more;;
21307         esac
21308         ;;
21309 *)      dflt="$pager"
21310         ;;
21311 esac
21312 fn="f/($dflt)"
21313 echo " "
21314 rp='What pager is used on your system?'
21315 . ./getfile
21316 pager="$ans"
21317
21318 : see what type pids are declared as in the kernel
21319 rp="What is the type of process ids on this system?"
21320 set pid_t pidtype int stdio.h sys/types.h
21321 eval $typedef_ask
21322
21323 : see if ar generates random libraries by itself
21324 echo " "
21325 echo "Checking how to generate random libraries on your machine..." >&4
21326 echo 'int bar1() { return bar2(); }' > bar1.c
21327 echo 'int bar2() { return 2; }' > bar2.c
21328 $cat > foo.c <<EOP
21329 #$i_stdlib I_STDLIB
21330 #ifdef I_STDLIB
21331 #include <stdlib.h>
21332 #endif
21333 int main() { printf("%d\n", bar1()); exit(0); }
21334 EOP
21335 $cc $ccflags -c bar1.c >/dev/null 2>&1
21336 $cc $ccflags -c bar2.c >/dev/null 2>&1
21337 $cc $ccflags -c foo.c >/dev/null 2>&1
21338 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21339 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21340         $run ./foobar >/dev/null 2>&1; then
21341         echo "$ar appears to generate random libraries itself."
21342         orderlib=false
21343         if [ "X$ranlib" = "X" ]; then
21344             ranlib=":"
21345         fi
21346 elif $ar s bar$_a >/dev/null 2>&1 &&
21347         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21348         $run ./foobar >/dev/null 2>&1; then
21349                 echo "a table of contents needs to be added with '$ar s'."
21350                 orderlib=false
21351                 ranlib="$ar s"
21352 elif $ar ts bar$_a >/dev/null 2>&1 &&
21353         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21354         $run ./foobar >/dev/null 2>&1; then
21355                 echo "a table of contents needs to be added with '$ar ts'."
21356                 orderlib=false
21357                 ranlib="$ar ts"
21358 else
21359         case "$ranlib" in
21360         :) ranlib='';;
21361         '')
21362                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21363                 $test -f $ranlib || ranlib=''
21364                 ;;
21365         esac
21366         if $test -n "$ranlib"; then
21367                 echo "your system has '$ranlib'; we'll use that."
21368                 orderlib=false
21369         else
21370                 echo "your system doesn't seem to support random libraries"
21371                 echo "so we'll use lorder and tsort to order the libraries."
21372                 orderlib=true
21373                 ranlib=":"
21374         fi
21375 fi
21376 $rm -f foo* bar*
21377
21378 : see if this is a values.h system
21379 set values.h i_values
21380 eval $inhdr
21381
21382 : Check the max offset that gmtime and localtime accept
21383 echo "Checking max offsets that gmtime () accepts"
21384
21385 case $i_values in
21386     define) yyy="#include <values.h>" ;;
21387     *)      yyy="" ;;
21388     esac
21389
21390 case "$sGMTIME_min/$sGMTIME_max" in
21391     0/0|/)
21392         $cat >try.c <<EOCP
21393 #include <sys/types.h>
21394 #include <stdio.h>
21395 #include <time.h>
21396 $yyy
21397
21398 int i;
21399 struct tm *tmp;
21400 time_t pt;
21401
21402 void gm_check (time_t t, int min_year, int max_year)
21403 {
21404     tmp = gmtime (&t);
21405     if ( tmp == NULL ||
21406         /* Check tm_year overflow */
21407          tmp->tm_year < min_year || tmp->tm_year > max_year)
21408         tmp = NULL;
21409     else
21410         pt = t;
21411     } /* gm_check */
21412
21413 int check_max ()
21414 {
21415     tmp = NULL;
21416     pt  = 0;
21417 #ifdef MAXLONG
21418     gm_check (MAXLONG, 69, 0x7fffffff);
21419 #endif
21420     if (tmp == NULL || tmp->tm_year < 0) {
21421         for (i = 63; i >= 0; i--) {
21422             time_t x = pt | ((time_t)1 << i);
21423             if (x < 0 || x < pt) continue;
21424             gm_check (x, 69, 0x7fffffff);
21425             }
21426         }
21427     printf ("sGMTIME_max=%ld\n", pt);
21428     return (0);
21429     } /* check_max */
21430
21431 int check_min ()
21432 {
21433     tmp = NULL;
21434     pt  = 0;
21435 #ifdef MINLONG
21436     gm_check (MINLONG, -1900, 70);
21437 #endif
21438     if (tmp == NULL) {
21439         for (i = 36; i >= 0; i--) {
21440             time_t x = pt - ((time_t)1 << i);
21441             if (x > 0) continue;
21442             gm_check (x, -1900, 70);
21443             }
21444         }
21445     printf ("sGMTIME_min=%ld\n", pt);
21446     return (0);
21447     } /* check_min */
21448
21449 int main (int argc, char *argv[])
21450 {
21451     check_max ();
21452     check_min ();
21453     return (0);
21454     } /* main */
21455 EOCP
21456         set try
21457         if eval $compile; then
21458             eval `$run ./try`
21459         else
21460             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21461             fi
21462         $rm_try
21463         ;;
21464     esac
21465
21466 echo "Checking max offsets that localtime () accepts"
21467
21468 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21469     0/0|/)
21470         $cat >try.c <<EOCP
21471 #include <sys/types.h>
21472 #include <stdio.h>
21473 #include <time.h>
21474 $yyy
21475
21476 int i;
21477 struct tm *tmp;
21478 time_t pt;
21479
21480 void local_check (time_t t, int min_year, int max_year)
21481 {
21482     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21483         tmp = NULL;
21484     else
21485         tmp = localtime (&t);
21486     if ( tmp == NULL ||
21487         /* Check tm_year overflow */
21488          tmp->tm_year < min_year || tmp->tm_year > max_year)
21489         tmp = NULL;
21490     else
21491         pt = t;
21492     } /* local_check */
21493
21494 int check_max ()
21495 {
21496     tmp = NULL;
21497     pt  = 0;
21498 #ifdef MAXLONG
21499     local_check (MAXLONG, 69, 0x7fffffff);
21500 #endif
21501     if (tmp == NULL || tmp->tm_year < 0) {
21502         for (i = 63; i >= 0; i--) {
21503             time_t x = pt | ((time_t)1 << i);
21504             if (x < 0 || x < pt) continue;
21505             local_check (x, 69, 0x7fffffff);
21506             }
21507         }
21508     printf ("sLOCALTIME_max=%ld\n", pt);
21509     return (0);
21510    } /* check_max */
21511
21512 int check_min ()
21513 {
21514     tmp = NULL;
21515     pt  = 0;
21516 #ifdef MINLONG
21517     local_check (MINLONG, -1900, 70);
21518 #endif
21519     if (tmp == NULL) {
21520         for (i = 36; i >= 0; i--) {
21521             time_t x = pt - ((time_t)1 << i);
21522             if (x > 0) continue;
21523             local_check (x, -1900, 70);
21524             }
21525         }
21526     printf ("sLOCALTIME_min=%ld\n", pt);
21527     return (0);
21528     } /* check_min */
21529
21530 int main (int argc, char *argv[])
21531 {
21532     check_max ();
21533     check_min ();
21534     return (0);
21535     } /* main */
21536 EOCP
21537         set try
21538         if eval $compile; then
21539             eval `$run ./try`
21540         else
21541             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21542             fi
21543         $rm_try
21544         ;;
21545     esac
21546
21547 : check for type of arguments to select.
21548 case "$selecttype" in
21549 '') case "$d_select" in
21550         $define)
21551                 echo " "
21552                 $cat <<EOM
21553 Checking to see what type of arguments are accepted by select().
21554 EOM
21555                 hdrs="$define sys/types.h
21556                         $i_systime sys/time.h
21557                         $i_sysselct sys/select.h
21558                         $d_socket sys/socket.h"
21559                 : The first arg can be int, unsigned, or size_t
21560                 : The last arg may or may not be 'const'
21561                 val=''
21562                 : void pointer has been seen but using that
21563                 : breaks the selectminbits test
21564                 for xxx in 'fd_set *' 'int *'; do
21565                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21566                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21567                                         case "$val" in
21568                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21569                                                 if ./protochk "$try" $hdrs; then
21570                                                         echo "Your system accepts $xxx."
21571                                                         val="$xxx"
21572                                                 fi
21573                                                 ;;
21574                                         esac
21575                                 done
21576                         done
21577                 done
21578                 case "$val" in
21579                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21580                         case "$d_fd_set" in
21581                                 $define) dflt="fd_set *" ;;
21582                                 *)              dflt="int *" ;;
21583                         esac
21584                         . ./myread
21585                         val=$ans
21586                         ;;
21587                 esac
21588                 selecttype="$val"
21589                 ;;
21590         *)      : no select, so pick a harmless default
21591                 selecttype='int *'
21592                 ;;
21593         esac
21594         ;;
21595 esac
21596
21597 : check for the select 'width'
21598 case "$selectminbits" in
21599 '') safebits=`expr $ptrsize \* 8`
21600     case "$d_select" in
21601         $define)
21602                 $cat <<EOM
21603
21604 Checking to see on how many bits at a time your select() operates...
21605 EOM
21606                 $cat >try.c <<EOCP
21607 #include <sys/types.h>
21608 #$i_time I_TIME
21609 #$i_systime I_SYS_TIME
21610 #$i_systimek I_SYS_TIME_KERNEL
21611 #ifdef I_TIME
21612 #   include <time.h>
21613 #endif
21614 #ifdef I_SYS_TIME
21615 #   ifdef I_SYS_TIME_KERNEL
21616 #       define KERNEL
21617 #   endif
21618 #   include <sys/time.h>
21619 #   ifdef I_SYS_TIME_KERNEL
21620 #       undef KERNEL
21621 #   endif
21622 #endif
21623 #$i_sysselct I_SYS_SELECT
21624 #ifdef I_SYS_SELECT
21625 #include <sys/select.h>
21626 #endif
21627 #$d_socket HAS_SOCKET
21628 #ifdef HAS_SOCKET
21629 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21630 #endif
21631 #include <stdio.h>
21632 #$i_stdlib I_STDLIB
21633 #ifdef I_STDLIB
21634 #include <stdlib.h>
21635 #endif
21636 $selecttype b;
21637 #define S sizeof(*(b))
21638 #define MINBITS 64
21639 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21640 #define NBITS  (NBYTES * 8)
21641 int main() {
21642     char *s = (char *)malloc(NBYTES);
21643     struct timeval t;
21644     int i;
21645     FILE* fp;
21646     int fd;
21647
21648     if (!s)
21649         exit(1);
21650     fclose(stdin);
21651     fp = fopen("try.c", "r");
21652     if (fp == 0)
21653       exit(2);
21654     fd = fileno(fp);
21655     if (fd < 0)
21656       exit(3);
21657     b = ($selecttype)s;
21658     for (i = 0; i < NBITS; i++)
21659         FD_SET(i, b);
21660     t.tv_sec  = 0;
21661     t.tv_usec = 0;
21662     select(fd + 1, b, 0, 0, &t);
21663     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21664     free(s);
21665     printf("%d\n", i + 1);
21666     return 0;
21667 }
21668 EOCP
21669                 set try
21670                 if eval $compile_ok; then
21671                         selectminbits=`$run ./try`
21672                         case "$selectminbits" in
21673                         '')     cat >&4 <<EOM
21674 Cannot figure out on how many bits at a time your select() operates.
21675 I'll play safe and guess it is $safebits bits.
21676 EOM
21677                                 selectminbits=$safebits
21678                                 bits="$safebits bits"
21679                                 ;;
21680                         1)      bits="1 bit" ;;
21681                         *)      bits="$selectminbits bits" ;;
21682                         esac
21683                         echo "Your select() operates on $bits at a time." >&4
21684                 else
21685                         rp='What is the minimum number of bits your select() operates on?'
21686                         case "$byteorder" in
21687                         12345678)       dflt=64 ;;
21688                         1234)           dflt=32 ;;
21689                         *)              dflt=1  ;;
21690                         esac
21691                         . ./myread
21692                         val=$ans
21693                         selectminbits="$val"
21694                 fi
21695                 $rm_try
21696                 ;;
21697         *)      : no select, so pick a harmless default
21698                 selectminbits=$safebits
21699                 ;;
21700         esac
21701         ;;
21702 esac
21703
21704 : Trace out the files included by signal.h, then look for SIGxxx names.
21705 if [ "X$fieldn" = X ]; then
21706         : Just make some guesses.  We check them later.
21707         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21708 else
21709         xxx=`echo '#include <signal.h>' |
21710         $cppstdin $cppminus $cppflags 2>/dev/null |
21711         $grep '^[       ]*#.*include' |
21712         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21713                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21714 fi
21715 xxxfiles=''
21716 for xx in $xxx /dev/null ; do
21717         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21718 done
21719 case "$xxxfiles" in
21720 '')     xxxfiles=`./findhdr signal.h` ;;
21721 esac
21722 xxx=`awk '
21723 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21724         print substr($2, 4, 20)
21725 }
21726 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21727         print substr($3, 4, 20)
21728 }' $xxxfiles`
21729 : Append some common names just in case the awk scan failed.
21730 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21731 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21732 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21733 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21734 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21735
21736 : generate a few handy files for later
21737 $cat > signal.c <<EOCP
21738 #include <sys/types.h>
21739 #include <signal.h>
21740 #$i_stdlib I_STDLIB
21741 #ifdef I_STDLIB
21742 #include <stdlib.h>
21743 #endif
21744 #include <stdio.h>
21745 int main() {
21746
21747 /* Strange style to avoid deeply-nested #if/#else/#endif */
21748 #ifndef NSIG
21749 #  ifdef _NSIG
21750 #    define NSIG (_NSIG)
21751 #  endif
21752 #endif
21753
21754 #ifndef NSIG
21755 #  ifdef SIGMAX
21756 #    define NSIG (SIGMAX+1)
21757 #  endif
21758 #endif
21759
21760 #ifndef NSIG
21761 #  ifdef SIG_MAX
21762 #    define NSIG (SIG_MAX+1)
21763 #  endif
21764 #endif
21765
21766 #ifndef NSIG
21767 #  ifdef _SIG_MAX
21768 #    define NSIG (_SIG_MAX+1)
21769 #  endif
21770 #endif
21771
21772 #ifndef NSIG
21773 #  ifdef MAXSIG
21774 #    define NSIG (MAXSIG+1)
21775 #  endif
21776 #endif
21777
21778 #ifndef NSIG
21779 #  ifdef MAX_SIG
21780 #    define NSIG (MAX_SIG+1)
21781 #  endif
21782 #endif
21783
21784 #ifndef NSIG
21785 #  ifdef SIGARRAYSIZE
21786 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21787 #  endif
21788 #endif
21789
21790 #ifndef NSIG
21791 #  ifdef _sys_nsig
21792 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21793 #  endif
21794 #endif
21795
21796 /* Default to some arbitrary number that's big enough to get most
21797    of the common signals.
21798 */
21799 #ifndef NSIG
21800 #    define NSIG 50
21801 #endif
21802
21803 printf("NSIG %d\n", NSIG);
21804
21805 #ifndef JUST_NSIG
21806
21807 EOCP
21808
21809 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21810 {
21811         printf "#ifdef SIG"; printf $1; printf "\n"
21812         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21813         printf $1; printf ");\n"
21814         printf "#endif\n"
21815 }
21816 END {
21817         printf "#endif /* JUST_NSIG */\n";
21818         printf "exit(0);\n}\n";
21819 }
21820 ' >>signal.c
21821 $cat >signal.awk <<'EOP'
21822 BEGIN { ndups = 0 }
21823 $1 ~ /^NSIG$/ { nsig = $2 }
21824 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21825     if ($2 > maxsig) { maxsig = $2 }
21826     if (sig_name[$2]) {
21827         dup_name[ndups] = $1
21828         dup_num[ndups] = $2
21829         ndups++
21830     }
21831     else {
21832         sig_name[$2] = $1
21833         sig_num[$2] = $2
21834     }
21835 }
21836 END {
21837     if (nsig == 0) {
21838         nsig = maxsig + 1
21839     }
21840     printf("NSIG %d\n", nsig);
21841     for (n = 1; n < nsig; n++) {
21842         if (sig_name[n]) {
21843             printf("%s %d\n", sig_name[n], sig_num[n])
21844         }
21845         else {
21846             printf("NUM%d %d\n", n, n)
21847         }
21848     }
21849     for (n = 0; n < ndups; n++) {
21850         printf("%s %d\n", dup_name[n], dup_num[n])
21851     }
21852 }
21853 EOP
21854 $cat >signal_cmd <<EOS
21855 $startsh
21856 if $test -s signal.lst; then
21857     echo "Using your existing signal.lst file"
21858         exit 0
21859 fi
21860 xxx="$xxx"
21861 EOS
21862 $cat >>signal_cmd <<'EOS'
21863
21864 set signal
21865 if eval $compile_ok; then
21866         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21867                 $uniq | $awk -f signal.awk >signal.lst
21868 else
21869         echo "(I can't seem be able to compile the whole test program)" >&4
21870         echo "(I'll try it in little pieces.)" >&4
21871         set signal -DJUST_NSIG
21872         if eval $compile_ok; then
21873                 $run ./signal$_exe > signal.nsg
21874                 $cat signal.nsg
21875         else
21876                 echo "I can't seem to figure out how many signals you have." >&4
21877                 echo "Guessing 50." >&4
21878                 echo 'NSIG 50' > signal.nsg
21879         fi
21880         : Now look at all the signal names, one at a time.
21881         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21882                 $cat > signal.c <<EOCP
21883 #include <sys/types.h>
21884 #include <signal.h>
21885 #include <stdio.h>
21886 int main() {
21887 printf("$xx %d\n", SIG${xx});
21888 return 0;
21889 }
21890 EOCP
21891                 set signal
21892                 if eval $compile; then
21893                         echo "SIG${xx} found."
21894                         $run ./signal$_exe  >> signal.ls1
21895                 else
21896                         echo "SIG${xx} NOT found."
21897                 fi
21898         done
21899         if $test -s signal.ls1; then
21900                 $cat signal.nsg signal.ls1 |
21901                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21902         fi
21903
21904 fi
21905 if $test -s signal.lst; then
21906         :
21907 else
21908         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21909         echo 'kill -l' >signal
21910         set X `csh -f <signal`
21911         $rm -f signal
21912         shift
21913         case $# in
21914         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21915         esac
21916         echo $@ | $tr ' ' $trnl | \
21917             $awk '{ printf "%s %d\n", $1, ++s; }
21918                   END { printf "NSIG %d\n", ++s }' >signal.lst
21919 fi
21920 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21921 EOS
21922 chmod a+x signal_cmd
21923 $eunicefix signal_cmd
21924
21925 : generate list of signal names
21926 echo " "
21927 case "$sig_name_init" in
21928 '') doinit=yes ;;
21929 *)  case "$sig_num_init" in
21930     ''|*,*) doinit=yes ;;
21931     esac ;;
21932 esac
21933 case "$doinit" in
21934 yes)
21935         echo "Generating a list of signal names and numbers..." >&4
21936         . ./signal_cmd
21937         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21938         sig_name=`$awk 'BEGIN { printf "ZERO " }
21939                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21940         sig_num=`$awk  'BEGIN { printf "0 " }
21941                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21942         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21943                              !/^NSIG/   { printf "\"%s\", ", $1 }
21944                              END        { printf "0\n" }' signal.lst`
21945         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21946                              !/^NSIG/   { printf "%d, ", $2}
21947                              END        { printf "0\n"}' signal.lst`
21948         ;;
21949 esac
21950 echo "The following $sig_count signals are available:"
21951 echo " "
21952 echo $sig_name | $awk \
21953 'BEGIN { linelen = 0 }
21954 {
21955         for (i = 1; i <= NF; i++) {
21956                 name = "SIG" $i " "
21957                 linelen = linelen + length(name)
21958                 if (linelen > 70) {
21959                         printf "\n"
21960                         linelen = length(name)
21961                 }
21962                 printf "%s", name
21963         }
21964         printf "\n"
21965 }'
21966 sig_size=`echo $sig_name | awk '{print NF}'`
21967 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21968
21969 : Check size of size
21970 echo " "
21971 case "$sizetype" in
21972 *_t) zzz="$sizetype"    ;;
21973 *)   zzz="filesize"     ;;
21974 esac
21975 echo "Checking the size of $zzz..." >&4
21976 cat > try.c <<EOCP
21977 #include <sys/types.h>
21978 #include <stdio.h>
21979 #$i_stdlib I_STDLIB
21980 #ifdef I_STDLIB
21981 #include <stdlib.h>
21982 #endif
21983 int main() {
21984     printf("%d\n", (int)sizeof($sizetype));
21985     exit(0);
21986 }
21987 EOCP
21988 set try
21989 if eval $compile_ok; then
21990         yyy=`$run ./try`
21991         case "$yyy" in
21992         '')     sizesize=4
21993                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21994                 ;;
21995         *)      sizesize=$yyy
21996                 echo "Your $zzz size is $sizesize bytes."
21997                 ;;
21998         esac
21999 else
22000         sizesize=4
22001         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22002 fi
22003
22004
22005 : check for socklen_t
22006 echo " "
22007 echo "Checking to see if you have socklen_t..." >&4
22008 $cat >try.c <<EOCP
22009 #include <sys/types.h>
22010 #$d_socket HAS_SOCKET
22011 #ifdef HAS_SOCKET
22012 #include <sys/socket.h>
22013 #endif
22014 int main() { socklen_t x = 16; }
22015 EOCP
22016 set try
22017 if eval $compile; then
22018         val="$define"
22019         echo "You have socklen_t."
22020 else
22021         val="$undef"
22022         echo "You do not have socklen_t."
22023         case "$sizetype" in
22024         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22025         esac
22026 fi
22027 $rm_try
22028 set d_socklen_t
22029 eval $setvar
22030
22031 : see if this is a socks.h system
22032 set socks.h i_socks
22033 eval $inhdr
22034
22035 : check for type of the size argument to socket calls
22036 case "$d_socket" in
22037 "$define")
22038         $cat <<EOM
22039
22040 Checking to see what type is the last argument of accept().
22041 EOM
22042         yyy=''
22043         case "$d_socklen_t" in
22044         "$define") yyy="$yyy socklen_t"
22045         esac
22046         yyy="$yyy $sizetype int long unsigned"
22047         for xxx in $yyy; do
22048                 case "$socksizetype" in
22049                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22050                         case "$usesocks" in
22051                         "$define")
22052                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22053                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22054                                         socksizetype="$xxx"
22055                                 fi
22056                                 ;;
22057                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22058                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22059                                         socksizetype="$xxx"
22060                                 fi
22061                                 ;;
22062                         esac
22063                         ;;
22064                 esac
22065         done
22066 : In case none of those worked, prompt the user.
22067         case "$socksizetype" in
22068         '')     rp='What is the type for socket address structure sizes?'
22069                 dflt='int'
22070                 . ./myread
22071                 socksizetype=$ans
22072                 ;;
22073         esac
22074         ;;
22075 *)      : no sockets, so pick relatively harmless default
22076         socksizetype='int'
22077         ;;
22078 esac
22079
22080 : see what type is used for signed size_t
22081 set ssize_t ssizetype int stdio.h sys/types.h
22082 eval $typedef
22083 dflt="$ssizetype"
22084 $cat > try.c <<EOM
22085 #include <stdio.h>
22086 #$i_stdlib I_STDLIB
22087 #ifdef I_STDLIB
22088 #include <stdlib.h>
22089 #endif
22090 #include <sys/types.h>
22091 #define Size_t $sizetype
22092 #define SSize_t $dflt
22093 int main()
22094 {
22095         if (sizeof(Size_t) == sizeof(SSize_t))
22096                 printf("$dflt\n");
22097         else if (sizeof(Size_t) == sizeof(int))
22098                 printf("int\n");
22099         else
22100                 printf("long\n");
22101         exit(0);
22102 }
22103 EOM
22104 echo " "
22105 set try
22106 if eval $compile_ok && $run ./try > /dev/null; then
22107         ssizetype=`$run ./try`
22108         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22109 else
22110         $cat >&4 <<EOM
22111 Help! I can't compile and run the ssize_t test program: please enlighten me!
22112 (This is probably a misconfiguration in your system or libraries, and
22113 you really ought to fix it.  Still, I'll try anyway.)
22114
22115 I need a type that is the same size as $sizetype, but is guaranteed to
22116 be signed.  Common values are ssize_t, int and long.
22117
22118 EOM
22119         rp="What signed type is the same size as $sizetype?"
22120         . ./myread
22121         ssizetype="$ans"
22122 fi
22123 $rm_try
22124
22125 : Check the size of st_ino
22126 $echo " "
22127 $echo "Checking the size of st_ino..." >&4
22128 $cat > try.c <<EOCP
22129 #include <sys/stat.h>
22130 #include <stdio.h>
22131 #$i_stdlib I_STDLIB
22132 #ifdef I_STDLIB
22133 #include <stdlib.h>
22134 #endif
22135 int main() {
22136     struct stat st;
22137     printf("%d\n", (int)sizeof(st.st_ino));
22138     exit(0);
22139 }
22140 EOCP
22141 set try
22142 if eval $compile_ok; then
22143         val=`$run ./try`
22144         case "$val" in
22145         '')     st_ino_size=4
22146                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22147                 ;;
22148         *)      st_ino_size=$val
22149                 $echo "Your st_ino is $st_ino_size bytes long."
22150                 ;;
22151         esac
22152 else
22153         st_ino_size=4
22154         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22155 fi
22156 $rm_try
22157
22158 : Check if st_ino is signed
22159 $echo " "
22160 $echo "Checking the sign of st_ino..." >&4
22161 $cat > try.c <<EOCP
22162 #include <sys/stat.h>
22163 #include <stdio.h>
22164 int main() {
22165         struct stat foo;
22166         foo.st_ino = -1;
22167         if (foo.st_ino < 0)
22168                 printf("-1\n");
22169         else
22170                 printf("1\n");
22171 }
22172 EOCP
22173 set try
22174 if eval $compile; then
22175         val=`$run ./try`
22176         case "$val" in
22177         '')     st_ino_sign=1
22178                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22179                 ;;
22180         *)      st_ino_sign=$val
22181                 case "$st_ino_sign" in
22182                  1) $echo "Your st_ino is unsigned." ;;
22183                 -1) $echo "Your st_ino is signed."   ;;
22184                 esac
22185                 ;;
22186         esac
22187 else
22188         st_ino_sign=1
22189         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22190 fi
22191 $rm_try
22192
22193 : see what type of char stdio uses.
22194 echo " "
22195 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22196 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22197         echo "Your stdio uses unsigned chars." >&4
22198         stdchar="unsigned char"
22199 else
22200         echo "Your stdio uses signed chars." >&4
22201         stdchar="char"
22202 fi
22203 $rm -f stdioh
22204
22205 : see what type uids are declared as in the kernel
22206 echo " "
22207 echo "Looking for the type for user ids returned by getuid()."
22208 set uid_t uidtype xxx stdio.h sys/types.h
22209 eval $typedef
22210 case "$uidtype" in
22211 xxx)
22212         xxx=`./findhdr sys/user.h`
22213         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22214         case $1 in
22215         unsigned) dflt="$1 $2" ;;
22216         *) dflt="$1" ;;
22217         esac
22218         ;;
22219 *) dflt="$uidtype";;
22220 esac
22221 case "$uidtype" in
22222 uid_t)  echo "uid_t found." ;;
22223 *)      rp="What is the type for user ids returned by getuid()?"
22224         . ./myread
22225         uidtype="$ans"
22226         ;;
22227 esac
22228
22229 : Check size of UID
22230 echo " "
22231 case "$uidtype" in
22232 *_t) zzz="$uidtype"     ;;
22233 *)   zzz="uid"          ;;
22234 esac
22235 echo "Checking the size of $zzz..." >&4
22236 cat > try.c <<EOCP
22237 #include <sys/types.h>
22238 #include <stdio.h>
22239 #$i_stdlib I_STDLIB
22240 #ifdef I_STDLIB
22241 #include <stdlib.h>
22242 #endif
22243 int main() {
22244     printf("%d\n", (int)sizeof($uidtype));
22245     exit(0);
22246 }
22247 EOCP
22248 set try
22249 if eval $compile_ok; then
22250         yyy=`$run ./try`
22251         case "$yyy" in
22252         '')     uidsize=4
22253                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22254                 ;;
22255         *)      uidsize=$yyy
22256                 echo "Your $zzz is $uidsize bytes long."
22257                 ;;
22258         esac
22259 else
22260         uidsize=4
22261         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22262 fi
22263
22264 : Check if UID is signed
22265 echo " "
22266 case "$uidtype" in
22267 *_t) zzz="$uidtype"     ;;
22268 *)   zzz="uid"          ;;
22269 esac
22270 echo "Checking the sign of $zzz..." >&4
22271 cat > try.c <<EOCP
22272 #include <sys/types.h>
22273 #include <stdio.h>
22274 int main() {
22275         $uidtype foo = -1;
22276         if (foo < 0)
22277                 printf("-1\n");
22278         else
22279                 printf("1\n");
22280 }
22281 EOCP
22282 set try
22283 if eval $compile; then
22284         yyy=`$run ./try`
22285         case "$yyy" in
22286         '')     uidsign=1
22287                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22288                 ;;
22289         *)      uidsign=$yyy
22290                 case "$uidsign" in
22291                  1) echo "Your $zzz is unsigned." ;;
22292                 -1) echo "Your $zzz is signed."   ;;
22293                 esac
22294                 ;;
22295         esac
22296 else
22297         uidsign=1
22298         echo "(I can't compile the test program--guessing unsigned.)" >&4
22299 fi
22300
22301
22302 : Check format string for UID
22303 echo " "
22304 $echo "Checking the format string to be used for uids..." >&4
22305
22306 case "$uidsign" in
22307 -1)     if $test X"$uidsize" = X"$ivsize"; then
22308                 uidformat="$ivdformat"
22309         else
22310                 if $test X"$uidsize" = X"$longsize"; then
22311                         uidformat='"ld"'
22312                 else
22313                         if $test X"$uidsize" = X"$intsize"; then
22314                                 uidformat='"d"'
22315                         else
22316                                 if $test X"$uidsize" = X"$shortsize"; then
22317                                         uidformat='"hd"'
22318                                 fi
22319                         fi
22320                 fi
22321         fi
22322         ;;
22323 *)      if $test X"$uidsize" = X"$uvsize"; then
22324                 uidformat="$uvuformat"
22325         else
22326                 if $test X"$uidsize" = X"$longsize"; then
22327                         uidformat='"lu"'
22328                 else
22329                         if $test X"$uidsize" = X"$intsize"; then
22330                                 uidformat='"u"'
22331                         else
22332                                 if $test X"$uidsize" = X"$shortsize"; then
22333                                         uidformat='"hu"'
22334                                 fi
22335                         fi
22336                 fi
22337         fi
22338         ;;
22339 esac
22340
22341 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22342 echo " "
22343 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22344 $cat >try.c <<'EOM'
22345 /* Intentionally a long probe as I'd like to sanity check that the exact
22346    approach is going to work, as thinking it will work, but only having it
22347    part working at runtime is worse than not having it.  */
22348
22349 #include <sys/types.h>
22350 #include <sys/sysctl.h>
22351 #include <sys/param.h>
22352 #include <stdio.h>
22353 #include <string.h>
22354 #include <stdlib.h>
22355 #include <unistd.h>
22356
22357 int
22358 main(int argc, char **argv) {
22359     char *buffer;
22360     char *argv_leaf = strrchr(argv[0], '/');
22361     char *buffer_leaf;
22362     size_t size = 0;
22363     int mib[4];
22364
22365     mib[0] = CTL_KERN;
22366     mib[1] = KERN_PROC;
22367     mib[2] = KERN_PROC_PATHNAME;
22368     mib[3] = -1;
22369
22370     if (!argv_leaf) {
22371         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22372         return 1;
22373     }
22374
22375     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22376         perror("sysctl");
22377         return 2;
22378     }
22379
22380     if (size < strlen(argv_leaf) + 1) {
22381         fprintf(stderr, "size %lu is too short for a path\n",
22382                 (unsigned long) size);
22383         return 3;
22384     }
22385
22386     if (size > MAXPATHLEN * MAXPATHLEN) {
22387         fprintf(stderr, "size %lu is too long for a path\n",
22388                 (unsigned long) size);
22389         return 4;
22390     }
22391
22392     buffer = malloc(size);
22393     if (!buffer) {
22394         perror("malloc");
22395         return 5;
22396     }
22397
22398     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22399         perror("sysctl");
22400         return 6;
22401     }
22402
22403     if (strlen(buffer) + 1 != size) {
22404         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22405                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22406         return 7;
22407     }
22408
22409
22410     if (*buffer != '/') {
22411         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22412         return 8;
22413     }
22414
22415     if (strstr(buffer, "/./")) {
22416         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22417         return 9;
22418     }
22419
22420     if (strstr(buffer, "/../")) {
22421         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22422         return 10;
22423     }
22424
22425     buffer_leaf = strrchr(buffer, '/');
22426     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22427         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22428         return 11;
22429     }
22430
22431     free(buffer);
22432
22433     return 0;
22434 }
22435 EOM
22436
22437 val=$undef
22438 set try
22439 if eval $compile; then
22440         if $run ./try; then
22441                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22442                 val="$define"
22443         else
22444                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22445                 val="$undef"
22446         fi
22447 else
22448         echo "I'm unable to compile the test program." >&4
22449         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22450         val="$undef"
22451 fi
22452 $rm_try
22453 set usekernprocpathname
22454 eval $setvar
22455
22456 : Determine if we can use _NSGetExecutablePath to find executing program
22457 echo " "
22458 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22459 $cat >try.c <<'EOM'
22460 /* Intentionally a long probe as I'd like to sanity check that the exact
22461    approach is going to work, as thinking it will work, but only having it
22462    part working at runtime is worse than not having it.  */
22463 #include <mach-o/dyld.h>
22464 #include <stdio.h>
22465 #include <stdlib.h>
22466 #include <sys/param.h>
22467 #include <string.h>
22468
22469 int
22470 main(int argc, char **argv) {
22471     char buf[1];
22472     uint32_t size = sizeof(buf);
22473     int result;
22474     char *buffer;
22475     char *tidied;
22476     char *argv_leaf = strrchr(argv[0], '/');
22477     char *tidied_leaf;
22478
22479     if (!argv_leaf) {
22480         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22481         return 1;
22482     }
22483
22484     _NSGetExecutablePath(buf, &size);
22485     if (size > MAXPATHLEN * MAXPATHLEN) {
22486         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22487                 (unsigned int) size);
22488         return 2;
22489     }
22490
22491     buffer = malloc(size);
22492     if (!buffer) {
22493         perror("malloc");
22494         return 3;
22495     }
22496
22497     result = _NSGetExecutablePath(buffer, &size);
22498     if (result != 0) {
22499         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22500                 result, (unsigned int) size);
22501         return 4;
22502     }
22503
22504     tidied = realpath(buffer, NULL);
22505     if (!tidied) {
22506         perror("realpath");
22507         return 5;
22508     }
22509
22510     free(buffer);
22511
22512     if (*tidied != '/') {
22513         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22514         return 6;
22515     }
22516
22517     if (strstr(tidied, "/./")) {
22518         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22519         return 7;
22520     }
22521
22522     if (strstr(tidied, "/../")) {
22523         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22524         return 8;
22525     }
22526
22527     tidied_leaf = strrchr(tidied, '/');
22528     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22529         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22530         return 9;
22531     }
22532
22533     free(tidied);
22534
22535     return 0;
22536 }
22537 EOM
22538
22539 val=$undef
22540 set try
22541 if eval $compile; then
22542         if $run ./try; then
22543                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22544                 val="$define"
22545         else
22546                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22547         fi
22548 else
22549         echo "I'm unable to compile the test program." >&4
22550         echo "I'll assume no _NSGetExecutablePath here." >&4
22551 fi
22552 $rm_try
22553 set usensgetexecutablepath
22554 eval $setvar
22555
22556 : Check if site customization support was requested
22557 case "$usesitecustomize" in
22558     $define|true|[Yy]*)
22559         usesitecustomize="$define"
22560         ;;
22561     *)
22562         usesitecustomize="$undef"
22563         ;;
22564     esac
22565
22566 : see if prototypes support variable argument declarations
22567 echo " "
22568 case "$prototype$i_stdarg" in
22569 $define$define)
22570         echo "It appears we'll be able to prototype varargs functions." >&4
22571         val="$define"
22572         ;;
22573 *)
22574         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22575         val="$undef"
22576         ;;
22577 esac
22578 set vaproto
22579 eval $setvar
22580
22581 : determine compiler compiler
22582 case "$yacc" in
22583 '')
22584         dflt=yacc;;
22585 *)
22586         dflt="$yacc";;
22587 esac
22588 echo " "
22589 comp='yacc'
22590 if $test -f "$byacc$_exe"; then
22591         dflt="$byacc"
22592         comp="byacc or $comp"
22593 fi
22594 if $test -f "$bison$_exe"; then
22595         comp="$comp or bison -y"
22596 fi
22597 rp="Which compiler compiler ($comp) shall I use?"
22598 . ./myread
22599 yacc="$ans"
22600 case "$yacc" in
22601 *bis*)
22602         case "$yacc" in
22603         *-y*) ;;
22604         *)
22605                 yacc="$yacc -y"
22606                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22607                 ;;
22608         esac
22609         ;;
22610 esac
22611
22612 : see if this is a assert.h system
22613 set assert.h i_assert
22614 eval $inhdr
22615
22616 : see if this is a bfd.h system
22617 set bfd.h i_bfd
22618 eval $inhdr
22619
22620 : see if this is an execinfo.h system
22621 set execinfo.h i_execinfo
22622 eval $inhdr
22623
22624 : see if this is a fenv.h system
22625 set fenv.h i_fenv
22626 eval $inhdr
22627
22628 : see if this is a fp.h system
22629 set fp.h i_fp
22630 eval $inhdr
22631
22632 : see if this is a fp_class.h system
22633 set fp_class.h i_fp_class
22634 eval $inhdr
22635
22636 : see if gdbm.h is available
22637 set gdbm.h t_gdbm
22638 eval $inhdr
22639 case "$t_gdbm" in
22640 $define)
22641         : see if gdbm_open exists
22642         set gdbm_open d_gdbm_open
22643         eval $inlibc
22644         case "$d_gdbm_open" in
22645         $undef)
22646                 t_gdbm="$undef"
22647                 echo "We won't be including <gdbm.h>"
22648                 ;;
22649         esac
22650         ;;
22651 esac
22652 val="$t_gdbm"
22653 set i_gdbm
22654 eval $setvar
22655
22656 : see if this is a ieeefp.h system
22657 case "$i_ieeefp" in
22658 '' ) set ieeefp.h i_ieeefp
22659      eval $inhdr
22660      ;;
22661 esac
22662
22663 : see if this is a libutil.h system
22664 set libutil.h i_libutil
22665 eval $inhdr
22666
22667 : see if mach cthreads are available
22668 if test "X$usethreads" = "X$define"; then
22669         set mach/cthreads.h i_machcthr
22670         eval $inhdr
22671 else
22672         i_machcthr="$undef"
22673 fi
22674
22675 : see if this is a mntent.h system
22676 set mntent.h i_mntent
22677 eval $inhdr
22678
22679 : see if net/errno.h is available
22680 val=''
22681 set net/errno.h val
22682 eval $inhdr
22683
22684 : Unfortunately, it causes problems on some systems.  Arrgh.
22685 case "$val" in
22686 $define)
22687         cat > try.c <<'EOM'
22688 #include <stdio.h>
22689 #include <errno.h>
22690 #include <net/errno.h>
22691 int func()
22692 {
22693         return ENOTSOCK;
22694 }
22695 EOM
22696         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22697                 echo "We'll be including <net/errno.h>." >&4
22698         else
22699                 echo "We won't be including <net/errno.h>." >&4
22700                 val="$undef"
22701         fi
22702         $rm_try
22703         ;;
22704 esac
22705 set i_neterrno
22706 eval $setvar
22707
22708 : see if netinet/tcp.h is available
22709 set netinet/tcp.h i_netinettcp
22710 eval $inhdr
22711
22712 : see if this is a poll.h system
22713 set poll.h i_poll
22714 eval $inhdr
22715
22716 : see if this is a prot.h system
22717 set prot.h i_prot
22718 eval $inhdr
22719
22720 : Preprocessor symbols
22721 echo " "
22722 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22723 $cat <<'EOSH' > Cppsym.know
22724 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22725 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22726 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22727 arch_pwr ardent ARM ARM32 atarist att386 att3b
22728 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22729 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22730 byteorder byte_order
22731 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22732 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22733 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22734 ELF encore EPI EXTENSIONS
22735 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22736 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22737 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22738 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22739 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22740 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22741 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22742 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22743 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22744 ksr1
22745 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22746 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22747 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22748 luna88k Lynx
22749 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22750 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22751 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22752 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22753 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22754 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22755 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22756 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22757 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22758 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22759 ns32000 ns32016 ns32332 ns32k nsc32000
22760 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22761 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22762 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22763 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22764 QK_USER QNX
22765 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22766 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22767 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22768 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22769 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22770 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22771 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22772 SYSV4 SYSV5 sysV68 sysV88
22773 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22774 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22775 tower32_800 tower32_850 tss
22776 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22777 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22778 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22779 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22780 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22781 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22782 uxpm uxps
22783 vax venix VMESA vms
22784 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22785 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22786 z8000 zarch
22787 EOSH
22788 # Maybe put other stuff here too.
22789 ./tr '-' '_' <<EOSH >>Cppsym.know
22790 $osname
22791 EOSH
22792 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22793 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22794 $cat Cppsym.know > Cppsym.c
22795 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22796 $rm -f Cppsym.a Cppsym.b Cppsym.c
22797 cat <<EOSH > Cppsym
22798 $startsh
22799 if $test \$# -gt 0; then
22800     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22801     if $test -s Cppsym.got; then
22802         $rm -f Cppsym.got
22803         exit 0
22804     fi
22805     $rm -f Cppsym.got
22806     exit 1
22807 else
22808     $tr " " "$trnl" | ./Cppsym.try
22809     exit 0
22810 fi
22811 EOSH
22812 chmod +x Cppsym
22813 $eunicefix Cppsym
22814 cat <<EOSH > Cppsym.try
22815 $startsh
22816 cat <<'EOCP' > try.c
22817 #include <stdio.h>
22818 #if cpp_stuff == 1
22819 #define STRINGIFY(a)    "a"
22820 #endif
22821 #if cpp_stuff == 42
22822 #define StGiFy(a)  #a
22823 #define STRINGIFY(a)    StGiFy(a)
22824 #endif
22825 #if $cpp_stuff != 1 && $cpp_stuff != 42
22826 #   include "Bletch: How does this C preprocessor stringify macros?"
22827 #endif
22828 int main() {
22829 EOCP
22830 $awk \\
22831 EOSH
22832 cat <<'EOSH' >> Cppsym.try
22833 'length($1) > 0 {
22834     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22835     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22836     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22837     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22838 }'       >> try.c
22839 echo 'return 0;}' >> try.c
22840 EOSH
22841 cat <<EOSH >> Cppsym.try
22842 ccflags="$ccflags"
22843 case "$osname-$gccversion" in
22844 irix-) ccflags="\$ccflags -woff 1178" ;;
22845 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22846 esac
22847 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22848 EOSH
22849 chmod +x Cppsym.try
22850 $eunicefix Cppsym.try
22851 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22852 : Add in any Linux cpp "predefined macros":
22853 case "$osname::$gccversion" in
22854   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22855     tHdrH=_tmpHdr
22856     rm -f $tHdrH'.h' $tHdrH
22857     touch $tHdrH'.h'
22858     # Filter out macro arguments, such as Linux's __INT8_C(c)
22859     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22860        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22861        if [ -s $tHdrH'_cppsym.real' ]; then
22862           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22863        fi
22864     fi
22865     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22866   ;;
22867 esac
22868 : now check the C compiler for additional symbols
22869 postprocess_cc_v=''
22870 case "$osname" in
22871 aix) postprocess_cc_v="|$tr , ' '" ;;
22872 esac
22873 $cat >ccsym <<EOS
22874 $startsh
22875 $cat >tmp.c <<EOF
22876 extern int foo;
22877 EOF
22878 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22879 do
22880         case "\$i" in
22881         -D*) echo "\$i" | $sed 's/^-D//';;
22882         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22883         esac
22884 done
22885 $rm_try
22886 EOS
22887 postprocess_cc_v=''
22888 chmod +x ccsym
22889 $eunicefix ccsym
22890 ./ccsym > ccsym1.raw
22891 if $test -s ccsym1.raw; then
22892     $sort ccsym1.raw | $uniq >ccsym.raw
22893 else
22894     mv ccsym1.raw ccsym.raw
22895 fi
22896
22897 $awk '/\=/ { print $0; next }
22898         { print $0"=1" }' ccsym.raw >ccsym.list
22899 $comm -13 Cppsym.true ccsym.list >ccsym.own
22900 $comm -12 Cppsym.true ccsym.list >ccsym.com
22901 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22902 also=''
22903 if $test -z ccsym.raw; then
22904         echo "Your C compiler doesn't seem to define any symbols!" >&4
22905         echo " "
22906         echo "However, your C preprocessor defines the following symbols:"
22907         $cat Cppsym.true
22908         ccsymbols=''
22909         cppsymbols=`$cat Cppsym.true`
22910         cppsymbols=`echo $cppsymbols`
22911         cppccsymbols="$cppsymbols"
22912 else
22913         if $test -s ccsym.com; then
22914                 echo "Your C compiler and pre-processor define these symbols:"
22915                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22916                 also='also '
22917                 symbols='ones'
22918                 cppccsymbols=`$cat ccsym.com`
22919                 cppccsymbols=`echo $cppccsymbols`
22920                 $test "$silent" || sleep 1
22921         fi
22922         if $test -s ccsym.cpp; then
22923                 $test "$also" && echo " "
22924                 echo "Your C pre-processor ${also}defines the following symbols:"
22925                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22926                 also='further '
22927                 cppsymbols=`$cat ccsym.cpp`
22928                 cppsymbols=`echo $cppsymbols`
22929                 $test "$silent" || sleep 1
22930         fi
22931         if $test -s ccsym.own; then
22932                 $test "$also" && echo " "
22933                 echo "Your C compiler ${also}defines the following cpp symbols:"
22934                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22935                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22936                 ccsymbols=`$cat ccsym.own`
22937                 ccsymbols=`echo $ccsymbols`
22938                 $test "$silent" || sleep 1
22939         fi
22940 fi
22941
22942 : add -D_FORTIFY_SOURCE if feasible and not already there
22943 case "$gccversion" in
22944 4.*)    case "$optimize$ccflags" in
22945         *-O*)   case "$ccflags$cppsymbols" in
22946                 *_FORTIFY_SOURCE=*) # Don't add it again.
22947                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22948                         ;;
22949                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22950                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22951                         ;;
22952                 esac
22953                 ;;
22954         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22955                 ;;
22956         esac
22957         ;;
22958 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22959         ;;
22960 esac
22961
22962 : see if this is a termio system
22963 val="$undef"
22964 val2="$undef"
22965 val3="$undef"
22966 if $test `./findhdr termios.h`; then
22967     set tcsetattr i_termios
22968     eval $inlibc
22969     val3="$i_termios"
22970 fi
22971 echo " "
22972 case "$val3" in
22973     "$define") echo "You have POSIX termios.h... good!" >&4;;
22974     *)  if ./Cppsym pyr; then
22975             case "`$run /bin/universe`" in
22976                 ucb) if $test `./findhdr sgtty.h`; then
22977                         val2="$define"
22978                         echo "<sgtty.h> found." >&4
22979                     else
22980                         echo "System is pyramid with BSD universe."
22981                         ./warn "<sgtty.h> not found--you could have problems."
22982                     fi;;
22983                 *)  if $test `./findhdr termio.h`; then
22984                         val="$define"
22985                         echo "<termio.h> found." >&4
22986                     else
22987                         echo "System is pyramid with USG universe."
22988                         ./warn "<termio.h> not found--you could have problems."
22989                     fi;;
22990             esac
22991         elif ./usg; then
22992             if $test `./findhdr termio.h`; then
22993                 echo "<termio.h> found." >&4
22994                 val="$define"
22995             elif $test `./findhdr sgtty.h`; then
22996                 echo "<sgtty.h> found." >&4
22997                 val2="$define"
22998             else
22999                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23000             fi
23001         else
23002             if $test `./findhdr sgtty.h`; then
23003                 echo "<sgtty.h> found." >&4
23004                 val2="$define"
23005             elif $test `./findhdr termio.h`; then
23006                 echo "<termio.h> found." >&4
23007                 val="$define"
23008             else
23009                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23010             fi
23011         fi;;
23012 esac
23013 set i_termio; eval $setvar
23014 val=$val2; set i_sgtty; eval $setvar
23015 val=$val3; set i_termios; eval $setvar
23016
23017 : see if stdbool is available
23018 : we want a real compile instead of Inhdr because some Solaris systems
23019 : have stdbool.h, but it can only be used if the compiler indicates it
23020 : is sufficiently c99-compliant.
23021 echo " "
23022 $cat >try.c <<EOCP
23023 #include <stdio.h>
23024 #include <stdbool.h>
23025 int func(bool x)
23026 {
23027     return x ? 1 : 0;
23028 }
23029 int main(int argc, char **argv)
23030 {
23031     return func(0);
23032 }
23033 EOCP
23034 set try
23035 if eval $compile; then
23036         echo "<stdbool.h> found." >&4
23037         val="$define"
23038 else
23039         echo "<stdbool.h> NOT found." >&4
23040         val="$undef"
23041 fi
23042 $rm_try
23043 set i_stdbool
23044 eval $setvar
23045
23046 : see if stddef is available
23047 set stddef.h i_stddef
23048 eval $inhdr
23049
23050 : see if stdint is available
23051 set stdint.h i_stdint
23052 eval $inhdr
23053
23054 : see if sys/access.h is available
23055 set sys/access.h i_sysaccess
23056 eval $inhdr
23057
23058 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23059 set sys/filio.h i_sysfilio
23060 eval $inhdr
23061 echo " "
23062 if $test `./findhdr sys/ioctl.h`; then
23063         val="$define"
23064         echo '<sys/ioctl.h> found.' >&4
23065 else
23066         val="$undef"
23067         if $test $i_sysfilio = "$define"; then
23068             echo '<sys/ioctl.h> NOT found.' >&4
23069         else
23070                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23071                 $test $i_termio = "$define" && xxx="termio.h"
23072                 $test $i_termios = "$define" && xxx="termios.h"
23073 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23074         fi
23075 fi
23076 set i_sysioctl
23077 eval $setvar
23078
23079 : see if socket ioctl defs are in sys/sockio.h
23080 echo " "
23081 xxx=`./findhdr sys/sockio.h`
23082 if $test "$xxx"; then
23083         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23084                 val="$define"
23085                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23086         else
23087                 val="$undef"
23088                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23089         fi
23090 else
23091         val="$undef"
23092         $cat <<EOM
23093 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23094 EOM
23095 fi
23096 set i_syssockio
23097 eval $setvar
23098
23099 : see if this is a syslog.h system
23100 set syslog.h i_syslog
23101 eval $inhdr
23102
23103 : see if this is a sys/mode.h system
23104 set sys/mode.h i_sysmode
23105 eval $inhdr
23106
23107 : see if there is a sys/poll.h file
23108 set sys/poll.h i_syspoll
23109 eval $inhdr
23110
23111 : see if sys/resource.h has to be included
23112 set sys/resource.h i_sysresrc
23113 eval $inhdr
23114
23115 : see if sys/security.h is available
23116 set sys/security.h i_syssecrt
23117 eval $inhdr
23118
23119 : see if this is a sys/statvfs.h system
23120 set sys/statvfs.h i_sysstatvfs
23121 eval $inhdr
23122
23123 : see if this is a sys/un.h system
23124 set sys/un.h i_sysun
23125 eval $inhdr
23126
23127 : see if this is a sys/utsname.h system
23128 set sys/utsname.h i_sysutsname
23129 eval $inhdr
23130
23131 : see if this is a syswait system
23132 set sys/wait.h i_syswait
23133 eval $inhdr
23134
23135 : see if this is a ustat.h system
23136 set ustat.h i_ustat
23137 eval $inhdr
23138
23139 : see if this is an utime system
23140 set utime.h i_utime
23141 eval $inhdr
23142
23143 : see if this is a vfork system
23144 case "$d_vfork" in
23145 "$define")
23146         set vfork.h i_vfork
23147         eval $inhdr
23148         ;;
23149 *)
23150         i_vfork="$undef"
23151         ;;
23152 esac
23153
23154 : Check extensions
23155 echo " "
23156 echo "Looking for extensions..." >&4
23157 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23158 : contain old or inaccurate or duplicate values.
23159 nonxs_extensions=''
23160 xs_extensions=''
23161 : We do not use find because it might not be available.
23162 : We do not just use MANIFEST because the user may have dropped
23163 : some additional extensions into the source tree and expect them
23164 : to be built.
23165
23166 : Function to recursively find available extensions, ignoring DynaLoader
23167 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23168 : In 5.10.1 and later, extensions are stored in directories
23169 : like File-Glob instead of the older File/Glob/.
23170 find_extensions='
23171     for xxx in *; do
23172         case "$xxx" in
23173             DynaLoader|dynaload) ;;
23174             *)
23175             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
23176             case "$this_ext" in
23177                 Scalar/List/Utils) this_ext="List/Util" ;;
23178                 PathTools)         this_ext="Cwd"       ;;
23179             esac;
23180             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
23181             if $contains " $this_ext " $tdir/$$.tmp; then
23182                 echo >&4;
23183                 echo "Duplicate directories detected for extension $xxx" >&4;
23184                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23185                 case "$knowitall" in
23186                 "") dflt=y;;
23187                 *) dflt=n;;
23188                 esac;
23189                 . ../UU/myread;
23190                 case "$ans" in
23191                 n*|N*) ;;
23192                 *) echo >&4;
23193                     echo "Ok.  Stopping Configure." >&4;
23194                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23195                     exit 1;;
23196                 esac;
23197                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23198             fi;
23199             $ls -1 $xxx > $tdir/$$.tmp;
23200             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
23201                 xs_extensions="$xs_extensions $this_ext";
23202             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
23203                 xs_extensions="$xs_extensions $this_ext";
23204             elif $test -d $xxx; then
23205                 nonxs_extensions="$nonxs_extensions $this_ext";
23206             fi;
23207             $rm -f $tdir/$$.tmp;
23208             ;;
23209         esac;
23210     done'
23211 tdir=`pwd`
23212 cd "$rsrc/cpan"
23213 set X
23214 shift
23215 eval $find_extensions
23216 cd "$rsrc/dist"
23217 set X
23218 shift
23219 eval $find_extensions
23220 cd "$rsrc/ext"
23221 set X
23222 shift
23223 eval $find_extensions
23224 set X $xs_extensions
23225 shift
23226 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23227 set X $nonxs_extensions
23228 shift
23229 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23230 cd "$tdir"
23231 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23232
23233 : Now see which are supported on this system.
23234 avail_ext=''
23235 for xxx in $xs_extensions ; do
23236         case "$xxx" in
23237         DB_File|db_file)
23238                 case "$i_db" in
23239                 $define) avail_ext="$avail_ext $xxx" ;;
23240                 esac
23241                 ;;
23242         GDBM_File|gdbm_fil)
23243                 case "$i_gdbm" in
23244                 $define) avail_ext="$avail_ext $xxx" ;;
23245                 esac
23246                 ;;
23247         I18N/Langinfo|i18n_lan)
23248                 case "$i_langinfo$d_nl_langinfo" in
23249                 $define$define) avail_ext="$avail_ext $xxx" ;;
23250                 esac
23251                 ;;
23252         IPC/SysV|ipc/sysv)
23253                 : XXX Do we need a useipcsysv variable here
23254                 case "${d_msg}${d_sem}${d_shm}" in
23255                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23256                 esac
23257                 ;;
23258         NDBM_File|ndbm_fil)
23259                 case "$d_ndbm" in
23260                 $define)
23261                     case "$osname-$use64bitint" in
23262                     hpux-define)
23263                         case "$libs" in
23264                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23265                         esac
23266                         ;;
23267                     *) avail_ext="$avail_ext $xxx" ;;
23268                     esac
23269                     ;;
23270                 esac
23271                 ;;
23272         ODBM_File|odbm_fil)
23273                 case "${i_dbm}${i_rpcsvcdbm}" in
23274                 *"${define}"*)
23275                     case "$d_cplusplus" in
23276                     define) ;; # delete as a function name will not work
23277                     *)  case "$osname-$use64bitint" in
23278                         hpux-define)
23279                             case "$libs" in
23280                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23281                             esac
23282                             ;;
23283                         *) avail_ext="$avail_ext $xxx" ;;
23284                         esac
23285                         ;;
23286                     esac
23287                     ;;
23288                 esac
23289                 ;;
23290         Opcode|opcode)
23291                 case "$useopcode" in
23292                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23293                 esac
23294                 ;;
23295         POSIX|posix)
23296                 case "$useposix" in
23297                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23298                 esac
23299                 ;;
23300         Socket|socket)
23301                 case "$d_socket" in
23302                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23303                 esac
23304                 ;;
23305         Sys/Syslog|sys/syslog)
23306                 : XXX syslog requires socket
23307                 case "$d_socket" in
23308                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23309                 esac
23310                 ;;
23311         Thread|thread)
23312                 case "$usethreads" in
23313                 true|$define|y)
23314                         case "$use5005threads" in
23315                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23316                         esac
23317                 esac
23318                 ;;
23319         threads|threads/shared)
23320                 # threads and threads::shared are special cases.
23321                 # To stop people from asking "Perl 5.8.0 was supposed
23322                 # to have this new fancy threads implementation but my
23323                 # perl doesn't have it" and from people trying to
23324                 # (re)install the threads module using CPAN.pm and
23325                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23326                 # the threads.pm and threads/shared.pm will always be
23327                 # there, croaking informatively ("you need to rebuild
23328                 # all of Perl with threads, sorry") when threads haven't
23329                 # been compiled in.
23330                 # --jhi
23331                 avail_ext="$avail_ext $xxx"
23332                 ;;
23333         VMS*)
23334                 ;;
23335         Win32*)
23336                 case "$osname" in
23337                 cygwin) avail_ext="$avail_ext $xxx" ;;
23338                 esac
23339                 ;;
23340         XS/APItest|xs/apitest)
23341                 # This is just for testing.  Skip it unless we have dynamic loading.
23342
23343                 case "$usedl" in
23344                 $define) avail_ext="$avail_ext $xxx" ;;
23345                 esac
23346                 ;;
23347         XS/Typemap|xs/typemap)
23348                 # This is just for testing.  Skip it unless we have dynamic loading.
23349                 case "$usedl" in
23350                 $define) avail_ext="$avail_ext $xxx" ;;
23351                 esac
23352                 ;;
23353         *)      avail_ext="$avail_ext $xxx"
23354                 ;;
23355         esac
23356 done
23357
23358 set X $avail_ext
23359 shift
23360 avail_ext="$*"
23361
23362 case "$onlyextensions" in
23363 '') ;;
23364 *)  keepextensions=''
23365     echo "You have requested that only certain extensions be included..." >&4
23366     for i in $onlyextensions; do
23367         case " $avail_ext " in
23368         *" $i "*)
23369             echo "Keeping extension $i."
23370             keepextensions="$keepextensions $i"
23371             ;;
23372         *) echo "Ignoring extension $i." ;;
23373         esac
23374     done
23375     avail_ext="$keepextensions"
23376     ;;
23377 esac
23378
23379 case "$noextensions" in
23380 '') ;;
23381 *)  keepextensions=''
23382     echo "You have requested that certain extensions be ignored..." >&4
23383     for i in $avail_ext; do
23384         case " $noextensions " in
23385         *" $i "*) echo "Ignoring extension $i." ;;
23386         *) echo "Keeping extension $i.";
23387            keepextensions="$keepextensions $i"
23388            ;;
23389         esac
23390     done
23391     avail_ext="$keepextensions"
23392     ;;
23393 esac
23394
23395 : Now see which nonxs extensions are supported on this system.
23396 : For now assume all are.
23397 nonxs_ext=''
23398 for xxx in $nonxs_extensions ; do
23399         case "$xxx" in
23400         VMS*)
23401                 ;;
23402         *)      nonxs_ext="$nonxs_ext $xxx"
23403                 ;;
23404         esac
23405 done
23406
23407 set X $nonxs_ext
23408 shift
23409 nonxs_ext="$*"
23410
23411 case $usedl in
23412 $define)
23413         $cat <<EOM
23414 A number of extensions are supplied with $package.  You may choose to
23415 compile these extensions for dynamic loading (the default), compile
23416 them into the $package executable (static loading), or not include
23417 them at all.  Answer "none" to include no extensions.
23418 Note that DynaLoader is always built and need not be mentioned here.
23419
23420 EOM
23421         case "$dynamic_ext" in
23422         '')
23423                 : Exclude those listed in static_ext
23424                 dflt=''
23425                 for xxx in $avail_ext; do
23426                         case " $static_ext " in
23427                         *" $xxx "*) ;;
23428                         *) dflt="$dflt $xxx" ;;
23429                         esac
23430                 done
23431                 set X $dflt
23432                 shift
23433                 dflt="$*"
23434                 ;;
23435         *)      dflt="$dynamic_ext"
23436                 # Perhaps we are reusing an old out-of-date config.sh.
23437                 case "$hint" in
23438                 previous)
23439                         if test X"$dynamic_ext" != X"$avail_ext"; then
23440                                 $cat <<EOM
23441 NOTICE:  Your previous config.sh list may be incorrect.
23442 The extensions now available to you are
23443         ${avail_ext}
23444 but the default list from your previous config.sh is
23445         ${dynamic_ext}
23446
23447 EOM
23448                         fi
23449                         ;;
23450                 esac
23451                 ;;
23452         esac
23453         case "$dflt" in
23454         '')     dflt=none;;
23455         esac
23456         rp="What extensions do you wish to load dynamically?"
23457         . ./myread
23458         case "$ans" in
23459         none) dynamic_ext=' ' ;;
23460         *) dynamic_ext="$ans" ;;
23461         esac
23462
23463         case "$static_ext" in
23464         '')
23465                 : Exclude those already listed in dynamic linking
23466                 dflt=''
23467                 for xxx in $avail_ext; do
23468                         case " $dynamic_ext " in
23469                         *" $xxx "*) ;;
23470                         *) dflt="$dflt $xxx" ;;
23471                         esac
23472                 done
23473                 set X $dflt
23474                 shift
23475                 dflt="$*"
23476                 ;;
23477         *)  dflt="$static_ext"
23478                 ;;
23479         esac
23480
23481         case "$dflt" in
23482         '')     dflt=none;;
23483         esac
23484         rp="What extensions do you wish to load statically?"
23485         . ./myread
23486         case "$ans" in
23487         none) static_ext=' ' ;;
23488         *) static_ext="$ans" ;;
23489         esac
23490         ;;
23491 *)
23492         $cat <<EOM
23493 A number of extensions are supplied with $package.  Answer "none"
23494 to include no extensions.
23495 Note that DynaLoader is always built and need not be mentioned here.
23496
23497 EOM
23498         case "$static_ext" in
23499         '') dflt="$avail_ext" ;;
23500         *)      dflt="$static_ext"
23501                 # Perhaps we are reusing an old out-of-date config.sh.
23502                 case "$hint" in
23503                 previous)
23504                         if test X"$static_ext" != X"$avail_ext"; then
23505                                 $cat <<EOM
23506 NOTICE:  Your previous config.sh list may be incorrect.
23507 The extensions now available to you are
23508         ${avail_ext}
23509 but the default list from your previous config.sh is
23510         ${static_ext}
23511
23512 EOM
23513                         fi
23514                         ;;
23515                 esac
23516                 ;;
23517         esac
23518         : Exclude those that are not xs extensions
23519         case "$dflt" in
23520         '')     dflt=none;;
23521         esac
23522         rp="What extensions do you wish to include?"
23523         . ./myread
23524         case "$ans" in
23525         none) static_ext=' ' ;;
23526         *) static_ext="$ans" ;;
23527         esac
23528         ;;
23529 esac
23530 #
23531 # Encode is a special case.  If we are building Encode as a static
23532 # extension, we need to explicitly list its subextensions as well.
23533 # For other nested extensions, this is handled automatically by
23534 # the appropriate Makefile.PL.
23535 case " $static_ext " in
23536         *" Encode "*) # Add the subextensions of Encode
23537         cd "$rsrc/cpan"
23538         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23539                 static_ext="$static_ext Encode/$xxx"
23540                 known_extensions="$known_extensions Encode/$xxx"
23541         done
23542         cd "$tdir"
23543         ;;
23544 esac
23545
23546 set X $dynamic_ext $static_ext $nonxs_ext
23547 shift
23548 extensions="$*"
23549
23550 # Sanity check:  We require an extension suitable for use with
23551 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23552 # should show up as failures in the test suite, but it's helpful to
23553 # catch them now.) The 'extensions' list is normally sorted
23554 # alphabetically, so we need to accept either
23555 #    DB_File ... Fcntl ... IO  ....
23556 # or something like
23557 #    Fcntl ... NDBM_File ... IO  ....
23558 case " $extensions"  in
23559 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23560 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23561 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23562 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23563    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23564    ;;
23565 esac
23566
23567 : Remove libraries needed only for extensions
23568 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23569 : The exception is SunOS 4.x, which needs them.
23570 case "${osname}X${osvers}" in
23571 sunos*X4*)
23572     perllibs="$libs"
23573     ;;
23574 *) case "$usedl" in
23575     $define|true|[yY]*)
23576             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23577             shift
23578             perllibs="$*"
23579             ;;
23580     *)  perllibs="$libs"
23581             ;;
23582     esac
23583     ;;
23584 esac
23585
23586 : Remove build directory name from cppstdin so it can be used from
23587 : either the present location or the final installed location.
23588 echo " "
23589 : Get out of the UU directory to get correct path name.
23590 cd ..
23591 case "$cppstdin" in
23592 `pwd`/cppstdin)
23593         echo "Stripping down cppstdin path name"
23594         cppstdin=cppstdin
23595         ;;
23596 esac
23597 cd UU
23598
23599 : end of configuration questions
23600 echo " "
23601 echo "End of configuration questions."
23602 echo " "
23603
23604 : back to where it started
23605 if test -d ../UU; then
23606         cd ..
23607 fi
23608
23609 : configuration may be unconditionally patched via a 'config.arch' file
23610 if $test -f config.arch; then
23611         echo "I see a config.arch file, loading it." >&4
23612         . ./config.arch
23613 fi
23614
23615 : configuration may be patched via a 'config.over' file
23616 if $test -f config.over; then
23617         echo " "
23618         dflt=y
23619         rp='I see a config.over file.  Do you wish to load it?'
23620         . UU/myread
23621         case "$ans" in
23622         n*) echo "OK, I'll ignore it.";;
23623         *)      . ./config.over
23624                 echo "Configuration override changes have been loaded."
23625                 ;;
23626         esac
23627 fi
23628
23629 : in case they want portability, strip down executable paths
23630 case "$d_portable" in
23631 "$define")
23632         echo " "
23633         echo "Stripping down executable paths..." >&4
23634         for file in $loclist $trylist; do
23635                 eval temp=\$$file
23636                 eval $file=`basename $temp`
23637         done
23638         ;;
23639 esac
23640
23641 : create config.sh file
23642 echo " "
23643 echo "Creating config.sh..." >&4
23644 $spitshell <<EOT >config.sh
23645 $startsh
23646 #
23647 # This file was produced by running the Configure script. It holds all the
23648 # definitions figured out by Configure. Should you modify one of these values,
23649 # do not forget to propagate your changes by running "Configure -der". You may
23650 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23651 #
23652
23653 # Package name      : $package
23654 # Source directory  : $src
23655 # Configuration time: $cf_time
23656 # Configured by     : $cf_by
23657 # Target system     : $myuname
23658
23659 EOT
23660 : Add in command line options if available
23661 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23662
23663 $spitshell <<EOT >>config.sh
23664
23665 Author='$Author'
23666 Date='$Date'
23667 Header='$Header'
23668 Id='$Id'
23669 Locker='$Locker'
23670 Log='$Log'
23671 RCSfile='$RCSfile'
23672 Revision='$Revision'
23673 Source='$Source'
23674 State='$State'
23675 _a='$_a'
23676 _exe='$_exe'
23677 _o='$_o'
23678 afs='$afs'
23679 afsroot='$afsroot'
23680 alignbytes='$alignbytes'
23681 ansi2knr='$ansi2knr'
23682 aphostname='$aphostname'
23683 api_revision='$api_revision'
23684 api_subversion='$api_subversion'
23685 api_version='$api_version'
23686 api_versionstring='$api_versionstring'
23687 ar='$ar'
23688 archlib='$archlib'
23689 archlibexp='$archlibexp'
23690 archname64='$archname64'
23691 archname='$archname'
23692 archobjs='$archobjs'
23693 asctime_r_proto='$asctime_r_proto'
23694 awk='$awk'
23695 baserev='$baserev'
23696 bash='$bash'
23697 bin='$bin'
23698 bin_ELF='$bin_ELF'
23699 binexp='$binexp'
23700 bison='$bison'
23701 byacc='$byacc'
23702 byteorder='$byteorder'
23703 c='$c'
23704 castflags='$castflags'
23705 cat='$cat'
23706 cc='$cc'
23707 cccdlflags='$cccdlflags'
23708 ccdlflags='$ccdlflags'
23709 ccflags='$ccflags'
23710 ccflags_uselargefiles='$ccflags_uselargefiles'
23711 ccname='$ccname'
23712 ccsymbols='$ccsymbols'
23713 ccversion='$ccversion'
23714 cf_by='$cf_by'
23715 cf_email='$cf_email'
23716 cf_time='$cf_time'
23717 charbits='$charbits'
23718 charsize='$charsize'
23719 chgrp='$chgrp'
23720 chmod='$chmod'
23721 chown='$chown'
23722 clocktype='$clocktype'
23723 comm='$comm'
23724 compress='$compress'
23725 contains='$contains'
23726 cp='$cp'
23727 cpio='$cpio'
23728 cpp='$cpp'
23729 cpp_stuff='$cpp_stuff'
23730 cppccsymbols='$cppccsymbols'
23731 cppflags='$cppflags'
23732 cpplast='$cpplast'
23733 cppminus='$cppminus'
23734 cpprun='$cpprun'
23735 cppstdin='$cppstdin'
23736 cppsymbols='$cppsymbols'
23737 crypt_r_proto='$crypt_r_proto'
23738 cryptlib='$cryptlib'
23739 csh='$csh'
23740 ctermid_r_proto='$ctermid_r_proto'
23741 ctime_r_proto='$ctime_r_proto'
23742 d_Gconvert='$d_Gconvert'
23743 d_PRIEUldbl='$d_PRIEUldbl'
23744 d_PRIFUldbl='$d_PRIFUldbl'
23745 d_PRIGUldbl='$d_PRIGUldbl'
23746 d_PRIXU64='$d_PRIXU64'
23747 d_PRId64='$d_PRId64'
23748 d_PRIeldbl='$d_PRIeldbl'
23749 d_PRIfldbl='$d_PRIfldbl'
23750 d_PRIgldbl='$d_PRIgldbl'
23751 d_PRIi64='$d_PRIi64'
23752 d_PRIo64='$d_PRIo64'
23753 d_PRIu64='$d_PRIu64'
23754 d_PRIx64='$d_PRIx64'
23755 d_SCNfldbl='$d_SCNfldbl'
23756 d__fwalk='$d__fwalk'
23757 d_access='$d_access'
23758 d_accessx='$d_accessx'
23759 d_acosh='$d_acosh'
23760 d_aintl='$d_aintl'
23761 d_alarm='$d_alarm'
23762 d_archlib='$d_archlib'
23763 d_asctime64='$d_asctime64'
23764 d_asctime_r='$d_asctime_r'
23765 d_asinh='$d_asinh'
23766 d_atanh='$d_atanh'
23767 d_atolf='$d_atolf'
23768 d_atoll='$d_atoll'
23769 d_attribute_deprecated='$d_attribute_deprecated'
23770 d_attribute_format='$d_attribute_format'
23771 d_attribute_malloc='$d_attribute_malloc'
23772 d_attribute_nonnull='$d_attribute_nonnull'
23773 d_attribute_noreturn='$d_attribute_noreturn'
23774 d_attribute_pure='$d_attribute_pure'
23775 d_attribute_unused='$d_attribute_unused'
23776 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23777 d_backtrace='$d_backtrace'
23778 d_bcmp='$d_bcmp'
23779 d_bcopy='$d_bcopy'
23780 d_bsd='$d_bsd'
23781 d_bsdgetpgrp='$d_bsdgetpgrp'
23782 d_bsdsetpgrp='$d_bsdsetpgrp'
23783 d_builtin_choose_expr='$d_builtin_choose_expr'
23784 d_builtin_expect='$d_builtin_expect'
23785 d_bzero='$d_bzero'
23786 d_c99_variadic_macros='$d_c99_variadic_macros'
23787 d_casti32='$d_casti32'
23788 d_castneg='$d_castneg'
23789 d_cbrt='$d_cbrt'
23790 d_charvspr='$d_charvspr'
23791 d_chown='$d_chown'
23792 d_chroot='$d_chroot'
23793 d_chsize='$d_chsize'
23794 d_class='$d_class'
23795 d_clearenv='$d_clearenv'
23796 d_closedir='$d_closedir'
23797 d_cmsghdr_s='$d_cmsghdr_s'
23798 d_const='$d_const'
23799 d_copysign='$d_copysign'
23800 d_copysignl='$d_copysignl'
23801 d_cplusplus='$d_cplusplus'
23802 d_crypt='$d_crypt'
23803 d_crypt_r='$d_crypt_r'
23804 d_csh='$d_csh'
23805 d_ctermid='$d_ctermid'
23806 d_ctermid_r='$d_ctermid_r'
23807 d_ctime64='$d_ctime64'
23808 d_ctime_r='$d_ctime_r'
23809 d_cuserid='$d_cuserid'
23810 d_dbl_dig='$d_dbl_dig'
23811 d_dbminitproto='$d_dbminitproto'
23812 d_difftime64='$d_difftime64'
23813 d_difftime='$d_difftime'
23814 d_dir_dd_fd='$d_dir_dd_fd'
23815 d_dirfd='$d_dirfd'
23816 d_dirnamlen='$d_dirnamlen'
23817 d_dladdr='$d_dladdr'
23818 d_dlerror='$d_dlerror'
23819 d_dlopen='$d_dlopen'
23820 d_dlsymun='$d_dlsymun'
23821 d_dosuid='$d_dosuid'
23822 d_drand48_r='$d_drand48_r'
23823 d_drand48proto='$d_drand48proto'
23824 d_dup2='$d_dup2'
23825 d_eaccess='$d_eaccess'
23826 d_endgrent='$d_endgrent'
23827 d_endgrent_r='$d_endgrent_r'
23828 d_endhent='$d_endhent'
23829 d_endhostent_r='$d_endhostent_r'
23830 d_endnent='$d_endnent'
23831 d_endnetent_r='$d_endnetent_r'
23832 d_endpent='$d_endpent'
23833 d_endprotoent_r='$d_endprotoent_r'
23834 d_endpwent='$d_endpwent'
23835 d_endpwent_r='$d_endpwent_r'
23836 d_endsent='$d_endsent'
23837 d_endservent_r='$d_endservent_r'
23838 d_eofnblk='$d_eofnblk'
23839 d_erf='$d_erf'
23840 d_erfc='$d_erfc'
23841 d_eunice='$d_eunice'
23842 d_exp2='$d_exp2'
23843 d_expm1='$d_expm1'
23844 d_faststdio='$d_faststdio'
23845 d_fchdir='$d_fchdir'
23846 d_fchmod='$d_fchmod'
23847 d_fchown='$d_fchown'
23848 d_fcntl='$d_fcntl'
23849 d_fcntl_can_lock='$d_fcntl_can_lock'
23850 d_fd_macros='$d_fd_macros'
23851 d_fd_set='$d_fd_set'
23852 d_fdim='$d_fdim'
23853 d_fds_bits='$d_fds_bits'
23854 d_fegetround='$d_fegetround'
23855 d_fgetpos='$d_fgetpos'
23856 d_finite='$d_finite'
23857 d_finitel='$d_finitel'
23858 d_flexfnam='$d_flexfnam'
23859 d_flock='$d_flock'
23860 d_flockproto='$d_flockproto'
23861 d_fma='$d_fma'
23862 d_fmax='$d_fmax'
23863 d_fmin='$d_fmin'
23864 d_fork='$d_fork'
23865 d_fp_class='$d_fp_class'
23866 d_fp_classify='$d_fp_classify'
23867 d_fp_classl='$d_fp_classl'
23868 d_fpathconf='$d_fpathconf'
23869 d_fpclass='$d_fpclass'
23870 d_fpclassify='$d_fpclassify'
23871 d_fpclassl='$d_fpclassl'
23872 d_fpgetround='$d_fpgetround'
23873 d_fpos64_t='$d_fpos64_t'
23874 d_frexpl='$d_frexpl'
23875 d_fs_data_s='$d_fs_data_s'
23876 d_fseeko='$d_fseeko'
23877 d_fsetpos='$d_fsetpos'
23878 d_fstatfs='$d_fstatfs'
23879 d_fstatvfs='$d_fstatvfs'
23880 d_fsync='$d_fsync'
23881 d_ftello='$d_ftello'
23882 d_ftime='$d_ftime'
23883 d_futimes='$d_futimes'
23884 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23885 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23886 d_getaddrinfo='$d_getaddrinfo'
23887 d_getcwd='$d_getcwd'
23888 d_getespwnam='$d_getespwnam'
23889 d_getfsstat='$d_getfsstat'
23890 d_getgrent='$d_getgrent'
23891 d_getgrent_r='$d_getgrent_r'
23892 d_getgrgid_r='$d_getgrgid_r'
23893 d_getgrnam_r='$d_getgrnam_r'
23894 d_getgrps='$d_getgrps'
23895 d_gethbyaddr='$d_gethbyaddr'
23896 d_gethbyname='$d_gethbyname'
23897 d_gethent='$d_gethent'
23898 d_gethname='$d_gethname'
23899 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23900 d_gethostbyname_r='$d_gethostbyname_r'
23901 d_gethostent_r='$d_gethostent_r'
23902 d_gethostprotos='$d_gethostprotos'
23903 d_getitimer='$d_getitimer'
23904 d_getlogin='$d_getlogin'
23905 d_getlogin_r='$d_getlogin_r'
23906 d_getmnt='$d_getmnt'
23907 d_getmntent='$d_getmntent'
23908 d_getnameinfo='$d_getnameinfo'
23909 d_getnbyaddr='$d_getnbyaddr'
23910 d_getnbyname='$d_getnbyname'
23911 d_getnent='$d_getnent'
23912 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23913 d_getnetbyname_r='$d_getnetbyname_r'
23914 d_getnetent_r='$d_getnetent_r'
23915 d_getnetprotos='$d_getnetprotos'
23916 d_getpagsz='$d_getpagsz'
23917 d_getpbyname='$d_getpbyname'
23918 d_getpbynumber='$d_getpbynumber'
23919 d_getpent='$d_getpent'
23920 d_getpgid='$d_getpgid'
23921 d_getpgrp2='$d_getpgrp2'
23922 d_getpgrp='$d_getpgrp'
23923 d_getppid='$d_getppid'
23924 d_getprior='$d_getprior'
23925 d_getprotobyname_r='$d_getprotobyname_r'
23926 d_getprotobynumber_r='$d_getprotobynumber_r'
23927 d_getprotoent_r='$d_getprotoent_r'
23928 d_getprotoprotos='$d_getprotoprotos'
23929 d_getprpwnam='$d_getprpwnam'
23930 d_getpwent='$d_getpwent'
23931 d_getpwent_r='$d_getpwent_r'
23932 d_getpwnam_r='$d_getpwnam_r'
23933 d_getpwuid_r='$d_getpwuid_r'
23934 d_getsbyname='$d_getsbyname'
23935 d_getsbyport='$d_getsbyport'
23936 d_getsent='$d_getsent'
23937 d_getservbyname_r='$d_getservbyname_r'
23938 d_getservbyport_r='$d_getservbyport_r'
23939 d_getservent_r='$d_getservent_r'
23940 d_getservprotos='$d_getservprotos'
23941 d_getspnam='$d_getspnam'
23942 d_getspnam_r='$d_getspnam_r'
23943 d_gettimeod='$d_gettimeod'
23944 d_gmtime64='$d_gmtime64'
23945 d_gmtime_r='$d_gmtime_r'
23946 d_gnulibc='$d_gnulibc'
23947 d_grpasswd='$d_grpasswd'
23948 d_hasmntopt='$d_hasmntopt'
23949 d_htonl='$d_htonl'
23950 d_hypot='$d_hypot'
23951 d_ilogb='$d_ilogb'
23952 d_ilogbl='$d_ilogbl'
23953 d_inc_version_list='$d_inc_version_list'
23954 d_index='$d_index'
23955 d_inetaton='$d_inetaton'
23956 d_inetntop='$d_inetntop'
23957 d_inetpton='$d_inetpton'
23958 d_int64_t='$d_int64_t'
23959 d_ip_mreq='$d_ip_mreq'
23960 d_ip_mreq_source='$d_ip_mreq_source'
23961 d_ipv6_mreq='$d_ipv6_mreq'
23962 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23963 d_isascii='$d_isascii'
23964 d_isblank='$d_isblank'
23965 d_isfinite='$d_isfinite'
23966 d_isfinitel='$d_isfinitel'
23967 d_isinf='$d_isinf'
23968 d_isinfl='$d_isinfl'
23969 d_isless='$d_isless'
23970 d_isnan='$d_isnan'
23971 d_isnanl='$d_isnanl'
23972 d_isnormal='$d_isnormal'
23973 d_j0='$d_j0'
23974 d_j0l='$d_j0l'
23975 d_killpg='$d_killpg'
23976 d_lc_monetary_2008='$d_lc_monetary_2008'
23977 d_lchown='$d_lchown'
23978 d_ldbl_dig='$d_ldbl_dig'
23979 d_ldexpl='$d_ldexpl'
23980 d_lgamma='$d_lgamma'
23981 d_lgamma_r='$d_lgamma_r'
23982 d_libm_lib_version='$d_libm_lib_version'
23983 d_libname_unique='$d_libname_unique'
23984 d_link='$d_link'
23985 d_llrint='$d_llrint'
23986 d_llround='$d_llround'
23987 d_localtime64='$d_localtime64'
23988 d_localtime_r='$d_localtime_r'
23989 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23990 d_locconv='$d_locconv'
23991 d_lockf='$d_lockf'
23992 d_log1p='$d_log1p'
23993 d_log2='$d_log2'
23994 d_logb='$d_logb'
23995 d_longdbl='$d_longdbl'
23996 d_longlong='$d_longlong'
23997 d_lrint='$d_lrint'
23998 d_lround='$d_lround'
23999 d_lseekproto='$d_lseekproto'
24000 d_lstat='$d_lstat'
24001 d_madvise='$d_madvise'
24002 d_malloc_good_size='$d_malloc_good_size'
24003 d_malloc_size='$d_malloc_size'
24004 d_mblen='$d_mblen'
24005 d_mbstowcs='$d_mbstowcs'
24006 d_mbtowc='$d_mbtowc'
24007 d_memchr='$d_memchr'
24008 d_memcmp='$d_memcmp'
24009 d_memcpy='$d_memcpy'
24010 d_memmove='$d_memmove'
24011 d_memset='$d_memset'
24012 d_mkdir='$d_mkdir'
24013 d_mkdtemp='$d_mkdtemp'
24014 d_mkfifo='$d_mkfifo'
24015 d_mkstemp='$d_mkstemp'
24016 d_mkstemps='$d_mkstemps'
24017 d_mktime64='$d_mktime64'
24018 d_mktime='$d_mktime'
24019 d_mmap='$d_mmap'
24020 d_modfl='$d_modfl'
24021 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24022 d_modflproto='$d_modflproto'
24023 d_mprotect='$d_mprotect'
24024 d_msg='$d_msg'
24025 d_msg_ctrunc='$d_msg_ctrunc'
24026 d_msg_dontroute='$d_msg_dontroute'
24027 d_msg_oob='$d_msg_oob'
24028 d_msg_peek='$d_msg_peek'
24029 d_msg_proxy='$d_msg_proxy'
24030 d_msgctl='$d_msgctl'
24031 d_msgget='$d_msgget'
24032 d_msghdr_s='$d_msghdr_s'
24033 d_msgrcv='$d_msgrcv'
24034 d_msgsnd='$d_msgsnd'
24035 d_msync='$d_msync'
24036 d_munmap='$d_munmap'
24037 d_mymalloc='$d_mymalloc'
24038 d_nan='$d_nan'
24039 d_ndbm='$d_ndbm'
24040 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24041 d_nearbyint='$d_nearbyint'
24042 d_nextafter='$d_nextafter'
24043 d_nexttoward='$d_nexttoward'
24044 d_nice='$d_nice'
24045 d_nl_langinfo='$d_nl_langinfo'
24046 d_nv_preserves_uv='$d_nv_preserves_uv'
24047 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24048 d_off64_t='$d_off64_t'
24049 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24050 d_oldpthreads='$d_oldpthreads'
24051 d_oldsock='$d_oldsock'
24052 d_open3='$d_open3'
24053 d_pathconf='$d_pathconf'
24054 d_pause='$d_pause'
24055 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24056 d_phostname='$d_phostname'
24057 d_pipe='$d_pipe'
24058 d_poll='$d_poll'
24059 d_portable='$d_portable'
24060 d_prctl='$d_prctl'
24061 d_prctl_set_name='$d_prctl_set_name'
24062 d_printf_format_null='$d_printf_format_null'
24063 d_procselfexe='$d_procselfexe'
24064 d_pseudofork='$d_pseudofork'
24065 d_pthread_atfork='$d_pthread_atfork'
24066 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24067 d_pthread_yield='$d_pthread_yield'
24068 d_ptrdiff_t='$d_ptrdiff_t'
24069 d_pwage='$d_pwage'
24070 d_pwchange='$d_pwchange'
24071 d_pwclass='$d_pwclass'
24072 d_pwcomment='$d_pwcomment'
24073 d_pwexpire='$d_pwexpire'
24074 d_pwgecos='$d_pwgecos'
24075 d_pwpasswd='$d_pwpasswd'
24076 d_pwquota='$d_pwquota'
24077 d_qgcvt='$d_qgcvt'
24078 d_quad='$d_quad'
24079 d_random_r='$d_random_r'
24080 d_re_comp='$d_re_comp'
24081 d_readdir64_r='$d_readdir64_r'
24082 d_readdir='$d_readdir'
24083 d_readdir_r='$d_readdir_r'
24084 d_readlink='$d_readlink'
24085 d_readv='$d_readv'
24086 d_recvmsg='$d_recvmsg'
24087 d_regcmp='$d_regcmp'
24088 d_regcomp='$d_regcomp'
24089 d_remainder='$d_remainder'
24090 d_remquo='$d_remquo'
24091 d_rename='$d_rename'
24092 d_rewinddir='$d_rewinddir'
24093 d_rint='$d_rint'
24094 d_rmdir='$d_rmdir'
24095 d_round='$d_round'
24096 d_safebcpy='$d_safebcpy'
24097 d_safemcpy='$d_safemcpy'
24098 d_sanemcmp='$d_sanemcmp'
24099 d_sbrkproto='$d_sbrkproto'
24100 d_scalbn='$d_scalbn'
24101 d_scalbnl='$d_scalbnl'
24102 d_sched_yield='$d_sched_yield'
24103 d_scm_rights='$d_scm_rights'
24104 d_seekdir='$d_seekdir'
24105 d_select='$d_select'
24106 d_sem='$d_sem'
24107 d_semctl='$d_semctl'
24108 d_semctl_semid_ds='$d_semctl_semid_ds'
24109 d_semctl_semun='$d_semctl_semun'
24110 d_semget='$d_semget'
24111 d_semop='$d_semop'
24112 d_sendmsg='$d_sendmsg'
24113 d_setegid='$d_setegid'
24114 d_seteuid='$d_seteuid'
24115 d_setgrent='$d_setgrent'
24116 d_setgrent_r='$d_setgrent_r'
24117 d_setgrps='$d_setgrps'
24118 d_sethent='$d_sethent'
24119 d_sethostent_r='$d_sethostent_r'
24120 d_setitimer='$d_setitimer'
24121 d_setlinebuf='$d_setlinebuf'
24122 d_setlocale='$d_setlocale'
24123 d_setlocale_r='$d_setlocale_r'
24124 d_setnent='$d_setnent'
24125 d_setnetent_r='$d_setnetent_r'
24126 d_setpent='$d_setpent'
24127 d_setpgid='$d_setpgid'
24128 d_setpgrp2='$d_setpgrp2'
24129 d_setpgrp='$d_setpgrp'
24130 d_setprior='$d_setprior'
24131 d_setproctitle='$d_setproctitle'
24132 d_setprotoent_r='$d_setprotoent_r'
24133 d_setpwent='$d_setpwent'
24134 d_setpwent_r='$d_setpwent_r'
24135 d_setregid='$d_setregid'
24136 d_setresgid='$d_setresgid'
24137 d_setresuid='$d_setresuid'
24138 d_setreuid='$d_setreuid'
24139 d_setrgid='$d_setrgid'
24140 d_setruid='$d_setruid'
24141 d_setsent='$d_setsent'
24142 d_setservent_r='$d_setservent_r'
24143 d_setsid='$d_setsid'
24144 d_setvbuf='$d_setvbuf'
24145 d_shm='$d_shm'
24146 d_shmat='$d_shmat'
24147 d_shmatprototype='$d_shmatprototype'
24148 d_shmctl='$d_shmctl'
24149 d_shmdt='$d_shmdt'
24150 d_shmget='$d_shmget'
24151 d_sigaction='$d_sigaction'
24152 d_signbit='$d_signbit'
24153 d_sigprocmask='$d_sigprocmask'
24154 d_sigsetjmp='$d_sigsetjmp'
24155 d_sin6_scope_id='$d_sin6_scope_id'
24156 d_sitearch='$d_sitearch'
24157 d_snprintf='$d_snprintf'
24158 d_sockaddr_in6='$d_sockaddr_in6'
24159 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24160 d_sockatmark='$d_sockatmark'
24161 d_sockatmarkproto='$d_sockatmarkproto'
24162 d_socket='$d_socket'
24163 d_socklen_t='$d_socklen_t'
24164 d_sockpair='$d_sockpair'
24165 d_socks5_init='$d_socks5_init'
24166 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24167 d_sqrtl='$d_sqrtl'
24168 d_srand48_r='$d_srand48_r'
24169 d_srandom_r='$d_srandom_r'
24170 d_sresgproto='$d_sresgproto'
24171 d_sresuproto='$d_sresuproto'
24172 d_stat='$d_stat'
24173 d_statblks='$d_statblks'
24174 d_statfs_f_flags='$d_statfs_f_flags'
24175 d_statfs_s='$d_statfs_s'
24176 d_static_inline='$d_static_inline'
24177 d_statvfs='$d_statvfs'
24178 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24179 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24180 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24181 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24182 d_stdio_stream_array='$d_stdio_stream_array'
24183 d_stdiobase='$d_stdiobase'
24184 d_stdstdio='$d_stdstdio'
24185 d_strchr='$d_strchr'
24186 d_strcoll='$d_strcoll'
24187 d_strctcpy='$d_strctcpy'
24188 d_strerrm='$d_strerrm'
24189 d_strerror='$d_strerror'
24190 d_strerror_r='$d_strerror_r'
24191 d_strftime='$d_strftime'
24192 d_strlcat='$d_strlcat'
24193 d_strlcpy='$d_strlcpy'
24194 d_strtod='$d_strtod'
24195 d_strtol='$d_strtol'
24196 d_strtold='$d_strtold'
24197 d_strtoll='$d_strtoll'
24198 d_strtoq='$d_strtoq'
24199 d_strtoul='$d_strtoul'
24200 d_strtoull='$d_strtoull'
24201 d_strtouq='$d_strtouq'
24202 d_strxfrm='$d_strxfrm'
24203 d_suidsafe='$d_suidsafe'
24204 d_symlink='$d_symlink'
24205 d_syscall='$d_syscall'
24206 d_syscallproto='$d_syscallproto'
24207 d_sysconf='$d_sysconf'
24208 d_sysernlst='$d_sysernlst'
24209 d_syserrlst='$d_syserrlst'
24210 d_system='$d_system'
24211 d_tcgetpgrp='$d_tcgetpgrp'
24212 d_tcsetpgrp='$d_tcsetpgrp'
24213 d_telldir='$d_telldir'
24214 d_telldirproto='$d_telldirproto'
24215 d_tgamma='$d_tgamma'
24216 d_time='$d_time'
24217 d_timegm='$d_timegm'
24218 d_times='$d_times'
24219 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24220 d_tm_tm_zone='$d_tm_tm_zone'
24221 d_tmpnam_r='$d_tmpnam_r'
24222 d_trunc='$d_trunc'
24223 d_truncate='$d_truncate'
24224 d_truncl='$d_truncl'
24225 d_ttyname_r='$d_ttyname_r'
24226 d_tzname='$d_tzname'
24227 d_u32align='$d_u32align'
24228 d_ualarm='$d_ualarm'
24229 d_umask='$d_umask'
24230 d_uname='$d_uname'
24231 d_union_semun='$d_union_semun'
24232 d_unordered='$d_unordered'
24233 d_unsetenv='$d_unsetenv'
24234 d_usleep='$d_usleep'
24235 d_usleepproto='$d_usleepproto'
24236 d_ustat='$d_ustat'
24237 d_vendorarch='$d_vendorarch'
24238 d_vendorbin='$d_vendorbin'
24239 d_vendorlib='$d_vendorlib'
24240 d_vendorscript='$d_vendorscript'
24241 d_vfork='$d_vfork'
24242 d_void_closedir='$d_void_closedir'
24243 d_voidsig='$d_voidsig'
24244 d_voidtty='$d_voidtty'
24245 d_volatile='$d_volatile'
24246 d_vprintf='$d_vprintf'
24247 d_vsnprintf='$d_vsnprintf'
24248 d_wait4='$d_wait4'
24249 d_waitpid='$d_waitpid'
24250 d_wcscmp='$d_wcscmp'
24251 d_wcstombs='$d_wcstombs'
24252 d_wcsxfrm='$d_wcsxfrm'
24253 d_wctomb='$d_wctomb'
24254 d_writev='$d_writev'
24255 d_xenix='$d_xenix'
24256 date='$date'
24257 db_hashtype='$db_hashtype'
24258 db_prefixtype='$db_prefixtype'
24259 db_version_major='$db_version_major'
24260 db_version_minor='$db_version_minor'
24261 db_version_patch='$db_version_patch'
24262 direntrytype='$direntrytype'
24263 dlext='$dlext'
24264 dlsrc='$dlsrc'
24265 doublekind='$doublekind'
24266 doublesize='$doublesize'
24267 drand01='$drand01'
24268 drand48_r_proto='$drand48_r_proto'
24269 dtrace='$dtrace'
24270 dynamic_ext='$dynamic_ext'
24271 eagain='$eagain'
24272 ebcdic='$ebcdic'
24273 echo='$echo'
24274 egrep='$egrep'
24275 emacs='$emacs'
24276 endgrent_r_proto='$endgrent_r_proto'
24277 endhostent_r_proto='$endhostent_r_proto'
24278 endnetent_r_proto='$endnetent_r_proto'
24279 endprotoent_r_proto='$endprotoent_r_proto'
24280 endpwent_r_proto='$endpwent_r_proto'
24281 endservent_r_proto='$endservent_r_proto'
24282 eunicefix='$eunicefix'
24283 exe_ext='$exe_ext'
24284 expr='$expr'
24285 extensions='$extensions'
24286 extern_C='$extern_C'
24287 extras='$extras'
24288 fflushNULL='$fflushNULL'
24289 fflushall='$fflushall'
24290 find='$find'
24291 firstmakefile='$firstmakefile'
24292 flex='$flex'
24293 fpossize='$fpossize'
24294 fpostype='$fpostype'
24295 freetype='$freetype'
24296 from='$from'
24297 full_ar='$full_ar'
24298 full_csh='$full_csh'
24299 full_sed='$full_sed'
24300 gccansipedantic='$gccansipedantic'
24301 gccosandvers='$gccosandvers'
24302 gccversion='$gccversion'
24303 getgrent_r_proto='$getgrent_r_proto'
24304 getgrgid_r_proto='$getgrgid_r_proto'
24305 getgrnam_r_proto='$getgrnam_r_proto'
24306 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24307 gethostbyname_r_proto='$gethostbyname_r_proto'
24308 gethostent_r_proto='$gethostent_r_proto'
24309 getlogin_r_proto='$getlogin_r_proto'
24310 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24311 getnetbyname_r_proto='$getnetbyname_r_proto'
24312 getnetent_r_proto='$getnetent_r_proto'
24313 getprotobyname_r_proto='$getprotobyname_r_proto'
24314 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24315 getprotoent_r_proto='$getprotoent_r_proto'
24316 getpwent_r_proto='$getpwent_r_proto'
24317 getpwnam_r_proto='$getpwnam_r_proto'
24318 getpwuid_r_proto='$getpwuid_r_proto'
24319 getservbyname_r_proto='$getservbyname_r_proto'
24320 getservbyport_r_proto='$getservbyport_r_proto'
24321 getservent_r_proto='$getservent_r_proto'
24322 getspnam_r_proto='$getspnam_r_proto'
24323 gidformat='$gidformat'
24324 gidsign='$gidsign'
24325 gidsize='$gidsize'
24326 gidtype='$gidtype'
24327 glibpth='$glibpth'
24328 gmake='$gmake'
24329 gmtime_r_proto='$gmtime_r_proto'
24330 gnulibc_version='$gnulibc_version'
24331 grep='$grep'
24332 groupcat='$groupcat'
24333 groupstype='$groupstype'
24334 gzip='$gzip'
24335 h_fcntl='$h_fcntl'
24336 h_sysfile='$h_sysfile'
24337 hint='$hint'
24338 hostcat='$hostcat'
24339 hostgenerate='$hostgenerate'
24340 hostosname='$hostosname'
24341 hostperl='$hostperl'
24342 html1dir='$html1dir'
24343 html1direxp='$html1direxp'
24344 html3dir='$html3dir'
24345 html3direxp='$html3direxp'
24346 i16size='$i16size'
24347 i16type='$i16type'
24348 i32size='$i32size'
24349 i32type='$i32type'
24350 i64size='$i64size'
24351 i64type='$i64type'
24352 i8size='$i8size'
24353 i8type='$i8type'
24354 i_arpainet='$i_arpainet'
24355 i_assert='$i_assert'
24356 i_bfd='$i_bfd'
24357 i_bsdioctl='$i_bsdioctl'
24358 i_crypt='$i_crypt'
24359 i_db='$i_db'
24360 i_dbm='$i_dbm'
24361 i_dirent='$i_dirent'
24362 i_dlfcn='$i_dlfcn'
24363 i_execinfo='$i_execinfo'
24364 i_fcntl='$i_fcntl'
24365 i_fenv='$i_fenv'
24366 i_float='$i_float'
24367 i_fp='$i_fp'
24368 i_fp_class='$i_fp_class'
24369 i_gdbm='$i_gdbm'
24370 i_gdbm_ndbm='$i_gdbm_ndbm'
24371 i_gdbmndbm='$i_gdbmndbm'
24372 i_grp='$i_grp'
24373 i_ieeefp='$i_ieeefp'
24374 i_inttypes='$i_inttypes'
24375 i_langinfo='$i_langinfo'
24376 i_libutil='$i_libutil'
24377 i_limits='$i_limits'
24378 i_locale='$i_locale'
24379 i_machcthr='$i_machcthr'
24380 i_malloc='$i_malloc'
24381 i_mallocmalloc='$i_mallocmalloc'
24382 i_math='$i_math'
24383 i_memory='$i_memory'
24384 i_mntent='$i_mntent'
24385 i_ndbm='$i_ndbm'
24386 i_netdb='$i_netdb'
24387 i_neterrno='$i_neterrno'
24388 i_netinettcp='$i_netinettcp'
24389 i_niin='$i_niin'
24390 i_poll='$i_poll'
24391 i_prot='$i_prot'
24392 i_pthread='$i_pthread'
24393 i_pwd='$i_pwd'
24394 i_quadmath='$i_quadmath'
24395 i_rpcsvcdbm='$i_rpcsvcdbm'
24396 i_sgtty='$i_sgtty'
24397 i_shadow='$i_shadow'
24398 i_socks='$i_socks'
24399 i_stdarg='$i_stdarg'
24400 i_stdbool='$i_stdbool'
24401 i_stddef='$i_stddef'
24402 i_stdint='$i_stdint'
24403 i_stdlib='$i_stdlib'
24404 i_string='$i_string'
24405 i_sunmath='$i_sunmath'
24406 i_sysaccess='$i_sysaccess'
24407 i_sysdir='$i_sysdir'
24408 i_sysfile='$i_sysfile'
24409 i_sysfilio='$i_sysfilio'
24410 i_sysin='$i_sysin'
24411 i_sysioctl='$i_sysioctl'
24412 i_syslog='$i_syslog'
24413 i_sysmman='$i_sysmman'
24414 i_sysmode='$i_sysmode'
24415 i_sysmount='$i_sysmount'
24416 i_sysndir='$i_sysndir'
24417 i_sysparam='$i_sysparam'
24418 i_syspoll='$i_syspoll'
24419 i_sysresrc='$i_sysresrc'
24420 i_syssecrt='$i_syssecrt'
24421 i_sysselct='$i_sysselct'
24422 i_syssockio='$i_syssockio'
24423 i_sysstat='$i_sysstat'
24424 i_sysstatfs='$i_sysstatfs'
24425 i_sysstatvfs='$i_sysstatvfs'
24426 i_systime='$i_systime'
24427 i_systimek='$i_systimek'
24428 i_systimes='$i_systimes'
24429 i_systypes='$i_systypes'
24430 i_sysuio='$i_sysuio'
24431 i_sysun='$i_sysun'
24432 i_sysutsname='$i_sysutsname'
24433 i_sysvfs='$i_sysvfs'
24434 i_syswait='$i_syswait'
24435 i_termio='$i_termio'
24436 i_termios='$i_termios'
24437 i_time='$i_time'
24438 i_unistd='$i_unistd'
24439 i_ustat='$i_ustat'
24440 i_utime='$i_utime'
24441 i_values='$i_values'
24442 i_varargs='$i_varargs'
24443 i_varhdr='$i_varhdr'
24444 i_vfork='$i_vfork'
24445 ignore_versioned_solibs='$ignore_versioned_solibs'
24446 inc_version_list='$inc_version_list'
24447 inc_version_list_init='$inc_version_list_init'
24448 incpath='$incpath'
24449 incpth='$incpth'
24450 inews='$inews'
24451 initialinstalllocation='$initialinstalllocation'
24452 installarchlib='$installarchlib'
24453 installbin='$installbin'
24454 installhtml1dir='$installhtml1dir'
24455 installhtml3dir='$installhtml3dir'
24456 installman1dir='$installman1dir'
24457 installman3dir='$installman3dir'
24458 installprefix='$installprefix'
24459 installprefixexp='$installprefixexp'
24460 installprivlib='$installprivlib'
24461 installscript='$installscript'
24462 installsitearch='$installsitearch'
24463 installsitebin='$installsitebin'
24464 installsitehtml1dir='$installsitehtml1dir'
24465 installsitehtml3dir='$installsitehtml3dir'
24466 installsitelib='$installsitelib'
24467 installsiteman1dir='$installsiteman1dir'
24468 installsiteman3dir='$installsiteman3dir'
24469 installsitescript='$installsitescript'
24470 installstyle='$installstyle'
24471 installusrbinperl='$installusrbinperl'
24472 installvendorarch='$installvendorarch'
24473 installvendorbin='$installvendorbin'
24474 installvendorhtml1dir='$installvendorhtml1dir'
24475 installvendorhtml3dir='$installvendorhtml3dir'
24476 installvendorlib='$installvendorlib'
24477 installvendorman1dir='$installvendorman1dir'
24478 installvendorman3dir='$installvendorman3dir'
24479 installvendorscript='$installvendorscript'
24480 intsize='$intsize'
24481 issymlink='$issymlink'
24482 ivdformat='$ivdformat'
24483 ivsize='$ivsize'
24484 ivtype='$ivtype'
24485 known_extensions='$known_extensions'
24486 ksh='$ksh'
24487 ld='$ld'
24488 ld_can_script='$ld_can_script'
24489 lddlflags='$lddlflags'
24490 ldflags='$ldflags'
24491 ldflags_uselargefiles='$ldflags_uselargefiles'
24492 ldlibpthname='$ldlibpthname'
24493 less='$less'
24494 lib_ext='$lib_ext'
24495 libc='$libc'
24496 libperl='$libperl'
24497 libpth='$libpth'
24498 libs='$libs'
24499 libsdirs='$libsdirs'
24500 libsfiles='$libsfiles'
24501 libsfound='$libsfound'
24502 libspath='$libspath'
24503 libswanted='$libswanted'
24504 libswanted_uselargefiles='$libswanted_uselargefiles'
24505 line='$line'
24506 lint='$lint'
24507 lkflags='$lkflags'
24508 ln='$ln'
24509 lns='$lns'
24510 localtime_r_proto='$localtime_r_proto'
24511 locincpth='$locincpth'
24512 loclibpth='$loclibpth'
24513 longdblkind='$longdblkind'
24514 longdblsize='$longdblsize'
24515 longlongsize='$longlongsize'
24516 longsize='$longsize'
24517 lp='$lp'
24518 lpr='$lpr'
24519 ls='$ls'
24520 lseeksize='$lseeksize'
24521 lseektype='$lseektype'
24522 mail='$mail'
24523 mailx='$mailx'
24524 make='$make'
24525 make_set_make='$make_set_make'
24526 mallocobj='$mallocobj'
24527 mallocsrc='$mallocsrc'
24528 malloctype='$malloctype'
24529 man1dir='$man1dir'
24530 man1direxp='$man1direxp'
24531 man1ext='$man1ext'
24532 man3dir='$man3dir'
24533 man3direxp='$man3direxp'
24534 man3ext='$man3ext'
24535 mips_type='$mips_type'
24536 mistrustnm='$mistrustnm'
24537 mkdir='$mkdir'
24538 mmaptype='$mmaptype'
24539 modetype='$modetype'
24540 more='$more'
24541 multiarch='$multiarch'
24542 mv='$mv'
24543 myarchname='$myarchname'
24544 mydomain='$mydomain'
24545 myhostname='$myhostname'
24546 myuname='$myuname'
24547 n='$n'
24548 need_va_copy='$need_va_copy'
24549 netdb_hlen_type='$netdb_hlen_type'
24550 netdb_host_type='$netdb_host_type'
24551 netdb_name_type='$netdb_name_type'
24552 netdb_net_type='$netdb_net_type'
24553 nm='$nm'
24554 nm_opt='$nm_opt'
24555 nm_so_opt='$nm_so_opt'
24556 nonxs_ext='$nonxs_ext'
24557 nroff='$nroff'
24558 nvEUformat='$nvEUformat'
24559 nvFUformat='$nvFUformat'
24560 nvGUformat='$nvGUformat'
24561 nv_overflows_integers_at='$nv_overflows_integers_at'
24562 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24563 nveformat='$nveformat'
24564 nvfformat='$nvfformat'
24565 nvgformat='$nvgformat'
24566 nvsize='$nvsize'
24567 nvtype='$nvtype'
24568 o_nonblock='$o_nonblock'
24569 obj_ext='$obj_ext'
24570 old_pthread_create_joinable='$old_pthread_create_joinable'
24571 optimize='$optimize'
24572 orderlib='$orderlib'
24573 osname='$osname'
24574 osvers='$osvers'
24575 otherlibdirs='$otherlibdirs'
24576 package='$package'
24577 pager='$pager'
24578 passcat='$passcat'
24579 patchlevel='$patchlevel'
24580 path_sep='$path_sep'
24581 perl5='$perl5'
24582 perl='$perl'
24583 perl_patchlevel='$perl_patchlevel'
24584 perl_static_inline='$perl_static_inline'
24585 perladmin='$perladmin'
24586 perllibs='$perllibs'
24587 perlpath='$perlpath'
24588 pg='$pg'
24589 phostname='$phostname'
24590 pidtype='$pidtype'
24591 plibpth='$plibpth'
24592 pmake='$pmake'
24593 pr='$pr'
24594 prefix='$prefix'
24595 prefixexp='$prefixexp'
24596 privlib='$privlib'
24597 privlibexp='$privlibexp'
24598 procselfexe='$procselfexe'
24599 prototype='$prototype'
24600 ptrsize='$ptrsize'
24601 quadkind='$quadkind'
24602 quadtype='$quadtype'
24603 randbits='$randbits'
24604 randfunc='$randfunc'
24605 random_r_proto='$random_r_proto'
24606 randseedtype='$randseedtype'
24607 ranlib='$ranlib'
24608 rd_nodata='$rd_nodata'
24609 readdir64_r_proto='$readdir64_r_proto'
24610 readdir_r_proto='$readdir_r_proto'
24611 revision='$revision'
24612 rm='$rm'
24613 rm_try='$rm_try'
24614 rmail='$rmail'
24615 run='$run'
24616 runnm='$runnm'
24617 sGMTIME_max='$sGMTIME_max'
24618 sGMTIME_min='$sGMTIME_min'
24619 sLOCALTIME_max='$sLOCALTIME_max'
24620 sLOCALTIME_min='$sLOCALTIME_min'
24621 sPRIEUldbl='$sPRIEUldbl'
24622 sPRIFUldbl='$sPRIFUldbl'
24623 sPRIGUldbl='$sPRIGUldbl'
24624 sPRIXU64='$sPRIXU64'
24625 sPRId64='$sPRId64'
24626 sPRIeldbl='$sPRIeldbl'
24627 sPRIfldbl='$sPRIfldbl'
24628 sPRIgldbl='$sPRIgldbl'
24629 sPRIi64='$sPRIi64'
24630 sPRIo64='$sPRIo64'
24631 sPRIu64='$sPRIu64'
24632 sPRIx64='$sPRIx64'
24633 sSCNfldbl='$sSCNfldbl'
24634 sched_yield='$sched_yield'
24635 scriptdir='$scriptdir'
24636 scriptdirexp='$scriptdirexp'
24637 sed='$sed'
24638 seedfunc='$seedfunc'
24639 selectminbits='$selectminbits'
24640 selecttype='$selecttype'
24641 sendmail='$sendmail'
24642 setgrent_r_proto='$setgrent_r_proto'
24643 sethostent_r_proto='$sethostent_r_proto'
24644 setlocale_r_proto='$setlocale_r_proto'
24645 setnetent_r_proto='$setnetent_r_proto'
24646 setprotoent_r_proto='$setprotoent_r_proto'
24647 setpwent_r_proto='$setpwent_r_proto'
24648 setservent_r_proto='$setservent_r_proto'
24649 sh='$sh'
24650 shar='$shar'
24651 sharpbang='$sharpbang'
24652 shmattype='$shmattype'
24653 shortsize='$shortsize'
24654 shrpenv='$shrpenv'
24655 shsharp='$shsharp'
24656 sig_count='$sig_count'
24657 sig_name='$sig_name'
24658 sig_name_init='$sig_name_init'
24659 sig_num='$sig_num'
24660 sig_num_init='$sig_num_init'
24661 sig_size='$sig_size'
24662 signal_t='$signal_t'
24663 sitearch='$sitearch'
24664 sitearchexp='$sitearchexp'
24665 sitebin='$sitebin'
24666 sitebinexp='$sitebinexp'
24667 sitehtml1dir='$sitehtml1dir'
24668 sitehtml1direxp='$sitehtml1direxp'
24669 sitehtml3dir='$sitehtml3dir'
24670 sitehtml3direxp='$sitehtml3direxp'
24671 sitelib='$sitelib'
24672 sitelib_stem='$sitelib_stem'
24673 sitelibexp='$sitelibexp'
24674 siteman1dir='$siteman1dir'
24675 siteman1direxp='$siteman1direxp'
24676 siteman3dir='$siteman3dir'
24677 siteman3direxp='$siteman3direxp'
24678 siteprefix='$siteprefix'
24679 siteprefixexp='$siteprefixexp'
24680 sitescript='$sitescript'
24681 sitescriptexp='$sitescriptexp'
24682 sizesize='$sizesize'
24683 sizetype='$sizetype'
24684 sleep='$sleep'
24685 smail='$smail'
24686 so='$so'
24687 sockethdr='$sockethdr'
24688 socketlib='$socketlib'
24689 socksizetype='$socksizetype'
24690 sort='$sort'
24691 spackage='$spackage'
24692 spitshell='$spitshell'
24693 srand48_r_proto='$srand48_r_proto'
24694 srandom_r_proto='$srandom_r_proto'
24695 src='$src'
24696 ssizetype='$ssizetype'
24697 st_ino_sign='$st_ino_sign'
24698 st_ino_size='$st_ino_size'
24699 startperl='$startperl'
24700 startsh='$startsh'
24701 static_ext='$static_ext'
24702 stdchar='$stdchar'
24703 stdio_base='$stdio_base'
24704 stdio_bufsiz='$stdio_bufsiz'
24705 stdio_cnt='$stdio_cnt'
24706 stdio_filbuf='$stdio_filbuf'
24707 stdio_ptr='$stdio_ptr'
24708 stdio_stream_array='$stdio_stream_array'
24709 strerror_r_proto='$strerror_r_proto'
24710 strings='$strings'
24711 submit='$submit'
24712 subversion='$subversion'
24713 sysman='$sysman'
24714 sysroot='$sysroot'
24715 tail='$tail'
24716 tar='$tar'
24717 targetarch='$targetarch'
24718 targetdir='$targetdir'
24719 targetenv='$targetenv'
24720 targethost='$targethost'
24721 targetmkdir='$targetmkdir'
24722 targetport='$targetport'
24723 targetsh='$targetsh'
24724 tbl='$tbl'
24725 tee='$tee'
24726 test='$test'
24727 timeincl='$timeincl'
24728 timetype='$timetype'
24729 tmpnam_r_proto='$tmpnam_r_proto'
24730 to='$to'
24731 touch='$touch'
24732 tr='$tr'
24733 trnl='$trnl'
24734 troff='$troff'
24735 ttyname_r_proto='$ttyname_r_proto'
24736 u16size='$u16size'
24737 u16type='$u16type'
24738 u32size='$u32size'
24739 u32type='$u32type'
24740 u64size='$u64size'
24741 u64type='$u64type'
24742 u8size='$u8size'
24743 u8type='$u8type'
24744 uidformat='$uidformat'
24745 uidsign='$uidsign'
24746 uidsize='$uidsize'
24747 uidtype='$uidtype'
24748 uname='$uname'
24749 uniq='$uniq'
24750 uquadtype='$uquadtype'
24751 use5005threads='$use5005threads'
24752 use64bitall='$use64bitall'
24753 use64bitint='$use64bitint'
24754 usecbacktrace='$usecbacktrace'
24755 usecrosscompile='$usecrosscompile'
24756 usedevel='$usedevel'
24757 usedl='$usedl'
24758 usedtrace='$usedtrace'
24759 usefaststdio='$usefaststdio'
24760 useithreads='$useithreads'
24761 usekernprocpathname='$usekernprocpathname'
24762 uselargefiles='$uselargefiles'
24763 uselongdouble='$uselongdouble'
24764 usemallocwrap='$usemallocwrap'
24765 usemorebits='$usemorebits'
24766 usemultiplicity='$usemultiplicity'
24767 usemymalloc='$usemymalloc'
24768 usenm='$usenm'
24769 usensgetexecutablepath='$usensgetexecutablepath'
24770 useopcode='$useopcode'
24771 useperlio='$useperlio'
24772 useposix='$useposix'
24773 usequadmath='$usequadmath'
24774 usereentrant='$usereentrant'
24775 userelocatableinc='$userelocatableinc'
24776 useshrplib='$useshrplib'
24777 usesitecustomize='$usesitecustomize'
24778 usesocks='$usesocks'
24779 usethreads='$usethreads'
24780 usevendorprefix='$usevendorprefix'
24781 useversionedarchname='$useversionedarchname'
24782 usevfork='$usevfork'
24783 usrinc='$usrinc'
24784 uuname='$uuname'
24785 uvXUformat='$uvXUformat'
24786 uvoformat='$uvoformat'
24787 uvsize='$uvsize'
24788 uvtype='$uvtype'
24789 uvuformat='$uvuformat'
24790 uvxformat='$uvxformat'
24791 vaproto='$vaproto'
24792 vendorarch='$vendorarch'
24793 vendorarchexp='$vendorarchexp'
24794 vendorbin='$vendorbin'
24795 vendorbinexp='$vendorbinexp'
24796 vendorhtml1dir='$vendorhtml1dir'
24797 vendorhtml1direxp='$vendorhtml1direxp'
24798 vendorhtml3dir='$vendorhtml3dir'
24799 vendorhtml3direxp='$vendorhtml3direxp'
24800 vendorlib='$vendorlib'
24801 vendorlib_stem='$vendorlib_stem'
24802 vendorlibexp='$vendorlibexp'
24803 vendorman1dir='$vendorman1dir'
24804 vendorman1direxp='$vendorman1direxp'
24805 vendorman3dir='$vendorman3dir'
24806 vendorman3direxp='$vendorman3direxp'
24807 vendorprefix='$vendorprefix'
24808 vendorprefixexp='$vendorprefixexp'
24809 vendorscript='$vendorscript'
24810 vendorscriptexp='$vendorscriptexp'
24811 version='$version'
24812 version_patchlevel_string='$version_patchlevel_string'
24813 versiononly='$versiononly'
24814 vi='$vi'
24815 xlibpth='$xlibpth'
24816 yacc='$yacc'
24817 yaccflags='$yaccflags'
24818 zcat='$zcat'
24819 zip='$zip'
24820 EOT
24821
24822 : add special variables
24823 $test -f $src/patchlevel.h && \
24824 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24825 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24826 echo "PERL_CONFIG_SH=true" >>config.sh
24827
24828 : propagate old symbols
24829 if $test -f UU/config.sh; then
24830         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24831         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24832                 config.sh config.sh UU/oldconfig.sh |\
24833                 $sort | $uniq -u >UU/oldsyms
24834         set X `$cat UU/oldsyms`
24835         shift
24836         case $# in
24837         0) ;;
24838         *)
24839                 $cat <<EOM
24840 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24841 EOM
24842                 echo ": Variables propagated from previous config.sh file." >>config.sh
24843                 for sym in `$cat UU/oldsyms`; do
24844                         echo "    Propagating $hint variable "'$'"$sym..."
24845                         eval 'tmp="$'"${sym}"'"'
24846                         echo "$tmp" | \
24847                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24848                 done
24849                 ;;
24850         esac
24851 fi
24852
24853 : preserve RCS keywords in files with variable substitution, grrr
24854 Id='$Id'
24855
24856 : Finish up by extracting the .SH files
24857 case "$alldone" in
24858 exit)
24859         $rm -rf UU
24860         echo "Extraction done."
24861         exit 0
24862         ;;
24863 cont)
24864         ;;
24865 '')
24866         dflt=''
24867         nostick=true
24868         $cat <<EOM
24869
24870 If you'd like to make any changes to the config.sh file before I begin
24871 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24872
24873 EOM
24874         rp="Press return or use a shell escape to edit config.sh:"
24875         . UU/myread
24876         nostick=''
24877         case "$ans" in
24878         '') ;;
24879         *) : in case they cannot read
24880                 sh 1>&4 -c "$ans";;
24881         esac
24882         ;;
24883 esac
24884
24885 : if this fails, just run all the .SH files by hand
24886 . ./config.sh
24887
24888 echo " "
24889 exec 1>&4
24890 pwd=`pwd`
24891 . ./UU/extract
24892 cd "$pwd"
24893
24894 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24895         dflt=y
24896         case "$silent" in
24897         true) ;;
24898         *)
24899                 $cat <<EOM
24900
24901 Now you need to generate make dependencies by running "$make depend".
24902 You might prefer to run it in background: "$make depend > makedepend.out &"
24903 It can take a while, so you might not want to run it right now.
24904
24905 EOM
24906                 ;;
24907         esac
24908         rp="Run $make depend now?"
24909         . UU/myread
24910         case "$ans" in
24911         y*)
24912                 $make depend && echo "Now you must run '$make'."
24913                 ;;
24914         *)
24915                 echo "You must run '$make depend' then '$make'."
24916                 ;;
24917         esac
24918 elif test -f [Mm]akefile; then
24919         echo " "
24920         echo "Now you must run a $make."
24921 else
24922         echo "Configure done."
24923 fi
24924
24925 if $test -f Policy.sh; then
24926     $cat <<EOM
24927
24928 If you compile $package on a different machine or from a different object
24929 directory, copy the Policy.sh file from this object directory to the
24930 new one before you run Configure -- this will help you with most of
24931 the policy defaults.
24932
24933 EOM
24934 fi
24935 if $test -f config.msg; then
24936     echo "Hmm.  I also noted the following information while running:"
24937     echo " "
24938     $cat config.msg >&4
24939     $rm -f config.msg
24940 fi
24941 $rm -f kit*isdone ark*isdone
24942 $rm -rf UU
24943
24944 : End of Configure
24945