This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
svleak.t: Add test for #123198
[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. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated using [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin|*msys) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 hostgenerate=''
210 hostosname=''
211 hostperl=''
212 run=''
213 targetarch=''
214 targetdir=''
215 targetenv=''
216 targethost=''
217 targetmkdir=''
218 targetport=''
219 to=''
220 usecrosscompile=''
221 extern_C=''
222 mistrustnm=''
223 usedevel=''
224 perllibs=''
225 dynamic_ext=''
226 extensions=''
227 known_extensions=''
228 nonxs_ext=''
229 static_ext=''
230 useopcode=''
231 useposix=''
232 extras=''
233 d_bsd=''
234 d_eunice=''
235 d_xenix=''
236 eunicefix=''
237 ar=''
238 awk=''
239 bash=''
240 bison=''
241 byacc=''
242 cat=''
243 chgrp=''
244 chmod=''
245 chown=''
246 comm=''
247 compress=''
248 cp=''
249 cpio=''
250 cpp=''
251 csh=''
252 date=''
253 echo=''
254 egrep=''
255 emacs=''
256 expr=''
257 find=''
258 flex=''
259 gmake=''
260 grep=''
261 gzip=''
262 inews=''
263 ksh=''
264 less=''
265 line=''
266 lint=''
267 ln=''
268 lp=''
269 lpr=''
270 ls=''
271 mail=''
272 mailx=''
273 make=''
274 mkdir=''
275 more=''
276 mv=''
277 nm=''
278 nroff=''
279 perl=''
280 pg=''
281 pmake=''
282 pr=''
283 rm=''
284 rmail=''
285 sed=''
286 sendmail=''
287 shar=''
288 sleep=''
289 smail=''
290 sort=''
291 submit=''
292 tail=''
293 tar=''
294 tbl=''
295 tee=''
296 test=''
297 touch=''
298 tr=''
299 troff=''
300 uname=''
301 uniq=''
302 uuname=''
303 vi=''
304 zcat=''
305 zip=''
306 full_ar=''
307 full_sed=''
308 libswanted=''
309 hint=''
310 myuname=''
311 osname=''
312 osvers=''
313 Author=''
314 Date=''
315 Header=''
316 Id=''
317 Locker=''
318 Log=''
319 RCSfile=''
320 Revision=''
321 Source=''
322 State=''
323 sysroot=''
324 _a=''
325 _exe=''
326 _o=''
327 archobjs=''
328 exe_ext=''
329 firstmakefile=''
330 lib_ext=''
331 obj_ext=''
332 path_sep=''
333 rm_try=''
334 afs=''
335 afsroot=''
336 alignbytes=''
337 ansi2knr=''
338 archlib=''
339 archlibexp=''
340 d_archlib=''
341 installarchlib=''
342 archname=''
343 myarchname=''
344 useversionedarchname=''
345 d_atolf=''
346 d_atoll=''
347 baserev=''
348 bin=''
349 binexp=''
350 initialinstalllocation=''
351 installbin=''
352 userelocatableinc=''
353 byteorder=''
354 cc=''
355 ccflags=''
356 cppflags=''
357 ldflags=''
358 lkflags=''
359 locincpth=''
360 optimize=''
361 cf_email=''
362 cf_by=''
363 cf_time=''
364 charbits=''
365 charsize=''
366 contains=''
367 cpp_stuff=''
368 cpplast=''
369 cppminus=''
370 cpprun=''
371 cppstdin=''
372 d__fwalk=''
373 d_access=''
374 d_accessx=''
375 d_acosh=''
376 d_asinh=''
377 d_atanh=''
378 d_aintl=''
379 d_alarm=''
380 asctime_r_proto=''
381 d_asctime_r=''
382 d_attribute_deprecated=''
383 d_attribute_format=''
384 d_attribute_malloc=''
385 d_attribute_nonnull=''
386 d_attribute_noreturn=''
387 d_attribute_pure=''
388 d_attribute_unused=''
389 d_attribute_warn_unused_result=''
390 d_printf_format_null=''
391 d_backtrace=''
392 d_bcmp=''
393 d_bcopy=''
394 d_builtin_choose_expr=''
395 d_builtin_expect=''
396 d_bzero=''
397 d_c99_variadic_macros=''
398 d_casti32=''
399 castflags=''
400 d_castneg=''
401 d_cbrt=''
402 d_chown=''
403 d_chroot=''
404 d_chsize=''
405 d_class=''
406 d_clearenv=''
407 d_closedir=''
408 d_void_closedir=''
409 d_cmsghdr_s=''
410 d_const=''
411 d_copysign=''
412 d_copysignl=''
413 d_cplusplus=''
414 cryptlib=''
415 d_crypt=''
416 crypt_r_proto=''
417 d_crypt_r=''
418 d_csh=''
419 full_csh=''
420 d_ctermid=''
421 ctermid_r_proto=''
422 d_ctermid_r=''
423 ctime_r_proto=''
424 d_ctime_r=''
425 d_cuserid=''
426 d_dbl_dig=''
427 d_dbminitproto=''
428 d_difftime=''
429 d_dir_dd_fd=''
430 d_dirfd=''
431 d_dladdr=''
432 d_dlerror=''
433 d_dlopen=''
434 d_dlsymun=''
435 d_dosuid=''
436 d_suidsafe=''
437 d_drand48_r=''
438 drand48_r_proto=''
439 d_drand48proto=''
440 d_dup2=''
441 d_eaccess=''
442 d_endgrent=''
443 d_endgrent_r=''
444 endgrent_r_proto=''
445 d_endhent=''
446 d_endhostent_r=''
447 endhostent_r_proto=''
448 d_endnent=''
449 d_endnetent_r=''
450 endnetent_r_proto=''
451 d_endpent=''
452 d_endprotoent_r=''
453 endprotoent_r_proto=''
454 d_endpwent=''
455 d_endpwent_r=''
456 endpwent_r_proto=''
457 d_endsent=''
458 d_endservent_r=''
459 endservent_r_proto=''
460 d_erf=''
461 d_erfc=''
462 d_exp2=''
463 d_expm1=''
464 d_faststdio=''
465 d_fchdir=''
466 d_fchmod=''
467 d_fchown=''
468 d_fcntl=''
469 d_fcntl_can_lock=''
470 d_fdim=''
471 d_fd_macros=''
472 d_fd_set=''
473 d_fds_bits=''
474 d_fegetround=''
475 d_fgetpos=''
476 d_finite=''
477 d_finitel=''
478 d_flexfnam=''
479 d_flock=''
480 d_flockproto=''
481 d_fdim=''
482 d_fma=''
483 d_fmax=''
484 d_fmin=''
485 d_fork=''
486 d_fp_class=''
487 d_fp_classl=''
488 d_fpclass=''
489 d_fp_classify=''
490 d_fpclassify=''
491 d_fpclassl=''
492 d_fpgetround=''
493 d_fpos64_t=''
494 d_frexpl=''
495 d_fs_data_s=''
496 d_fseeko=''
497 d_fsetpos=''
498 d_fstatfs=''
499 d_fsync=''
500 d_ftello=''
501 d_ftime=''
502 d_gettimeod=''
503 d_futimes=''
504 d_Gconvert=''
505 d_getaddrinfo=''
506 d_getcwd=''
507 d_getespwnam=''
508 d_getfsstat=''
509 d_getgrent=''
510 d_getgrent_r=''
511 getgrent_r_proto=''
512 d_getgrgid_r=''
513 getgrgid_r_proto=''
514 d_getgrnam_r=''
515 getgrnam_r_proto=''
516 d_getgrps=''
517 d_gethbyaddr=''
518 d_gethbyname=''
519 d_gethent=''
520 aphostname=''
521 d_gethname=''
522 d_phostname=''
523 d_uname=''
524 d_gethostbyaddr_r=''
525 gethostbyaddr_r_proto=''
526 d_gethostbyname_r=''
527 gethostbyname_r_proto=''
528 d_gethostent_r=''
529 gethostent_r_proto=''
530 d_gethostprotos=''
531 d_getitimer=''
532 d_getlogin=''
533 d_getlogin_r=''
534 getlogin_r_proto=''
535 d_getmnt=''
536 d_getmntent=''
537 d_getnameinfo=''
538 d_getnbyaddr=''
539 d_getnbyname=''
540 d_getnent=''
541 d_getnetbyaddr_r=''
542 getnetbyaddr_r_proto=''
543 d_getnetbyname_r=''
544 getnetbyname_r_proto=''
545 d_getnetent_r=''
546 getnetent_r_proto=''
547 d_getnetprotos=''
548 d_getpagsz=''
549 d_getpent=''
550 d_getpgid=''
551 d_getpgrp2=''
552 d_bsdgetpgrp=''
553 d_getpgrp=''
554 d_getppid=''
555 d_getprior=''
556 d_getpbyname=''
557 d_getpbynumber=''
558 d_getprotobyname_r=''
559 getprotobyname_r_proto=''
560 d_getprotobynumber_r=''
561 getprotobynumber_r_proto=''
562 d_getprotoent_r=''
563 getprotoent_r_proto=''
564 d_getprotoprotos=''
565 d_getprpwnam=''
566 d_getpwent=''
567 d_getpwent_r=''
568 getpwent_r_proto=''
569 d_getpwnam_r=''
570 getpwnam_r_proto=''
571 d_getpwuid_r=''
572 getpwuid_r_proto=''
573 d_getsent=''
574 d_getservbyname_r=''
575 getservbyname_r_proto=''
576 d_getservbyport_r=''
577 getservbyport_r_proto=''
578 d_getservent_r=''
579 getservent_r_proto=''
580 d_getservprotos=''
581 d_getspnam=''
582 d_getspnam_r=''
583 getspnam_r_proto=''
584 d_getsbyname=''
585 d_getsbyport=''
586 d_gmtime_r=''
587 gmtime_r_proto=''
588 d_gnulibc=''
589 gnulibc_version=''
590 d_hasmntopt=''
591 d_htonl=''
592 d_hypot=''
593 d_ilogb=''
594 d_ilogbl=''
595 d_inetaton=''
596 d_inetntop=''
597 d_inetpton=''
598 d_int64_t=''
599 d_isascii=''
600 d_isblank=''
601 d_isfinite=''
602 d_isfinitel=''
603 d_isinf=''
604 d_isinfl=''
605 d_isnan=''
606 d_isnanl=''
607 d_isnormal=''
608 d_j0=''
609 d_j0l=''
610 d_killpg=''
611 d_lchown=''
612 d_ldbl_dig=''
613 d_lgamma=''
614 d_lgamma_r=''
615 d_libm_lib_version=''
616 d_link=''
617 d_llrint=''
618 d_llround=''
619 d_localtime_r=''
620 d_localtime_r_needs_tzset=''
621 localtime_r_proto=''
622 d_locconv=''
623 d_lc_monetary_2008=''
624 d_lockf=''
625 d_ldexpl=''
626 d_log1p=''
627 d_log2=''
628 d_logb=''
629 d_longdbl=''
630 longdblkind=''
631 longdblsize=''
632 d_longlong=''
633 longlongsize=''
634 d_lrint=''
635 d_lround=''
636 d_lseekproto=''
637 d_lstat=''
638 d_madvise=''
639 d_malloc_good_size=''
640 d_malloc_size=''
641 d_mblen=''
642 d_mbstowcs=''
643 d_mbtowc=''
644 d_memchr=''
645 d_memcmp=''
646 d_memcpy=''
647 d_memmove=''
648 d_memset=''
649 d_mkdir=''
650 d_mkdtemp=''
651 d_mkfifo=''
652 d_mkstemp=''
653 d_mkstemps=''
654 d_mktime=''
655 d_mmap=''
656 mmaptype=''
657 d_modfl=''
658 d_modfl_pow32_bug=''
659 d_modflproto=''
660 d_mprotect=''
661 d_msg=''
662 d_msgctl=''
663 d_msgget=''
664 d_msghdr_s=''
665 d_msgrcv=''
666 d_msgsnd=''
667 d_msync=''
668 d_munmap=''
669 d_nan=''
670 d_nearbyint=''
671 d_nextafter=''
672 d_nexttoward=''
673 d_nice=''
674 d_nl_langinfo=''
675 d_off64_t=''
676 d_open3=''
677 d_fpathconf=''
678 d_pathconf=''
679 d_pause=''
680 d_pipe=''
681 d_poll=''
682 d_portable=''
683 d_prctl=''
684 d_prctl_set_name=''
685 d_procselfexe=''
686 procselfexe=''
687 d_old_pthread_create_joinable=''
688 old_pthread_create_joinable=''
689 d_pthread_atfork=''
690 d_pthread_attr_setscope=''
691 d_pthread_yield=''
692 d_sched_yield=''
693 sched_yield=''
694 d_ptrdiff_t=''
695 d_qgcvt=''
696 d_random_r=''
697 random_r_proto=''
698 d_readdir64_r=''
699 readdir64_r_proto=''
700 d_readdir=''
701 d_rewinddir=''
702 d_seekdir=''
703 d_telldir=''
704 d_readdir_r=''
705 readdir_r_proto=''
706 d_readlink=''
707 d_readv=''
708 d_recvmsg=''
709 d_remainder=''
710 d_remquo=''
711 d_rename=''
712 d_rint=''
713 d_rmdir=''
714 d_round=''
715 d_safebcpy=''
716 d_safemcpy=''
717 d_sanemcmp=''
718 d_sbrkproto=''
719 d_scalbn=''
720 d_scalbnl=''
721 d_select=''
722 d_sem=''
723 d_semctl=''
724 d_semget=''
725 d_semop=''
726 d_sendmsg=''
727 d_setegid=''
728 d_seteuid=''
729 d_setgrent=''
730 d_setgrent_r=''
731 setgrent_r_proto=''
732 d_setgrps=''
733 d_sethent=''
734 d_sethostent_r=''
735 sethostent_r_proto=''
736 d_setitimer=''
737 d_setlinebuf=''
738 d_setlocale=''
739 d_setlocale_r=''
740 setlocale_r_proto=''
741 d_setnent=''
742 d_setnetent_r=''
743 setnetent_r_proto=''
744 d_setpent=''
745 d_setpgid=''
746 d_setpgrp2=''
747 d_bsdsetpgrp=''
748 d_setpgrp=''
749 d_setprior=''
750 d_setproctitle=''
751 d_setprotoent_r=''
752 setprotoent_r_proto=''
753 d_setpwent=''
754 d_setpwent_r=''
755 setpwent_r_proto=''
756 d_setregid=''
757 d_setresgid=''
758 d_setresuid=''
759 d_setreuid=''
760 d_setrgid=''
761 d_setruid=''
762 d_setsent=''
763 d_setservent_r=''
764 setservent_r_proto=''
765 d_setsid=''
766 d_setvbuf=''
767 d_shm=''
768 d_shmat=''
769 d_shmatprototype=''
770 shmattype=''
771 d_shmctl=''
772 d_shmdt=''
773 d_shmget=''
774 d_sigaction=''
775 d_signbit=''
776 d_sigprocmask=''
777 d_sigsetjmp=''
778 usesitecustomize=''
779 d_snprintf=''
780 d_vsnprintf=''
781 d_sockatmark=''
782 d_sockatmarkproto=''
783 d_ip_mreq=''
784 d_ip_mreq_source=''
785 d_ipv6_mreq=''
786 d_ipv6_mreq_source=''
787 d_msg_ctrunc=''
788 d_msg_dontroute=''
789 d_msg_oob=''
790 d_msg_peek=''
791 d_msg_proxy=''
792 d_oldsock=''
793 d_scm_rights=''
794 d_sin6_scope_id=''
795 d_sockaddr_in6=''
796 d_sockaddr_sa_len=''
797 d_socket=''
798 d_sockpair=''
799 sockethdr=''
800 socketlib=''
801 d_socklen_t=''
802 d_socks5_init=''
803 d_sprintf_returns_strlen=''
804 d_sqrtl=''
805 d_srand48_r=''
806 srand48_r_proto=''
807 d_srandom_r=''
808 srandom_r_proto=''
809 d_sresgproto=''
810 d_sresuproto=''
811 d_statblks=''
812 d_statfs_f_flags=''
813 d_statfs_s=''
814 d_static_inline=''
815 perl_static_inline=''
816 d_fstatvfs=''
817 d_statvfs=''
818 d_stdio_cnt_lval=''
819 d_stdio_ptr_lval=''
820 d_stdio_ptr_lval_nochange_cnt=''
821 d_stdio_ptr_lval_sets_cnt=''
822 d_stdiobase=''
823 d_stdstdio=''
824 stdio_base=''
825 stdio_bufsiz=''
826 stdio_cnt=''
827 stdio_filbuf=''
828 stdio_ptr=''
829 d_index=''
830 d_strchr=''
831 d_strcoll=''
832 d_strctcpy=''
833 d_strerrm=''
834 d_strerror=''
835 d_sysernlst=''
836 d_syserrlst=''
837 d_strerror_r=''
838 strerror_r_proto=''
839 d_strftime=''
840 d_strlcat=''
841 d_strlcpy=''
842 d_strtod=''
843 d_strtol=''
844 d_strtold=''
845 d_strtoll=''
846 d_strtoq=''
847 d_strtoul=''
848 d_strtoull=''
849 d_strtouq=''
850 d_strxfrm=''
851 d_symlink=''
852 d_syscall=''
853 d_syscallproto=''
854 d_sysconf=''
855 d_system=''
856 d_tcgetpgrp=''
857 d_tcsetpgrp=''
858 d_telldirproto=''
859 d_time=''
860 timetype=''
861 d_asctime64=''
862 d_ctime64=''
863 d_difftime64=''
864 d_gmtime64=''
865 d_localtime64=''
866 d_mktime64=''
867 d_timegm=''
868 clocktype=''
869 d_times=''
870 d_tmpnam_r=''
871 tmpnam_r_proto=''
872 d_tgamma=''
873 d_trunc=''
874 d_truncate=''
875 d_truncl=''
876 d_ttyname_r=''
877 ttyname_r_proto=''
878 d_tzname=''
879 d_u32align=''
880 d_ualarm=''
881 d_umask=''
882 d_semctl_semid_ds=''
883 d_semctl_semun=''
884 d_union_semun=''
885 d_unordered=''
886 d_unsetenv=''
887 d_usleep=''
888 d_usleepproto=''
889 d_ustat=''
890 d_pseudofork=''
891 d_vfork=''
892 usevfork=''
893 d_voidsig=''
894 signal_t=''
895 d_volatile=''
896 d_charvspr=''
897 d_vprintf=''
898 d_wait4=''
899 d_waitpid=''
900 d_wcscmp=''
901 d_wcstombs=''
902 d_wcsxfrm=''
903 d_wctomb=''
904 d_writev=''
905 dlext=''
906 bin_ELF=''
907 cccdlflags=''
908 ccdlflags=''
909 dlsrc=''
910 ld=''
911 ld_can_script=''
912 lddlflags=''
913 usedl=''
914 doublekind=''
915 doublesize=''
916 ebcdic=''
917 fflushNULL=''
918 fflushall=''
919 fpossize=''
920 fpostype=''
921 gccansipedantic=''
922 gccosandvers=''
923 gccversion=''
924 gidformat=''
925 gidsign=''
926 gidsize=''
927 gidtype=''
928 groupstype=''
929 h_fcntl=''
930 h_sysfile=''
931 html1dir=''
932 html1direxp=''
933 installhtml1dir=''
934 html3dir=''
935 html3direxp=''
936 installhtml3dir=''
937 i_arpainet=''
938 i_assert=''
939 i_bfd=''
940 i_crypt=''
941 db_hashtype=''
942 db_prefixtype=''
943 db_version_major=''
944 db_version_minor=''
945 db_version_patch=''
946 i_db=''
947 i_dbm=''
948 i_rpcsvcdbm=''
949 d_dirnamlen=''
950 direntrytype=''
951 i_dirent=''
952 i_dlfcn=''
953 i_execinfo=''
954 i_fcntl=''
955 i_fenv=''
956 i_float=''
957 i_fp=''
958 i_fp_class=''
959 i_gdbm=''
960 d_grpasswd=''
961 i_grp=''
962 i_ieeefp=''
963 i_inttypes=''
964 i_langinfo=''
965 i_libutil=''
966 i_limits=''
967 i_locale=''
968 i_machcthr=''
969 i_malloc=''
970 i_mallocmalloc=''
971 i_math=''
972 i_memory=''
973 i_mntent=''
974 d_gdbm_ndbm_h_uses_prototypes=''
975 d_gdbmndbm_h_uses_prototypes=''
976 d_ndbm=''
977 d_ndbm_h_uses_prototypes=''
978 i_gdbm_ndbm=''
979 i_gdbmndbm=''
980 i_ndbm=''
981 i_netdb=''
982 i_neterrno=''
983 i_netinettcp=''
984 i_niin=''
985 i_sysin=''
986 i_poll=''
987 i_prot=''
988 i_pthread=''
989 d_pwage=''
990 d_pwchange=''
991 d_pwclass=''
992 d_pwcomment=''
993 d_pwexpire=''
994 d_pwgecos=''
995 d_pwpasswd=''
996 d_pwquota=''
997 i_pwd=''
998 i_quadmath=''
999 i_shadow=''
1000 i_socks=''
1001 i_stdbool=''
1002 i_stddef=''
1003 i_stdint=''
1004 i_stdlib=''
1005 i_string=''
1006 strings=''
1007 i_sunmath=''
1008 i_sysaccess=''
1009 i_sysdir=''
1010 i_sysfile=''
1011 d_voidtty=''
1012 i_bsdioctl=''
1013 i_sysfilio=''
1014 i_sysioctl=''
1015 i_syssockio=''
1016 i_syslog=''
1017 i_sysmman=''
1018 i_sysmode=''
1019 i_sysmount=''
1020 i_sysndir=''
1021 i_sysparam=''
1022 i_syspoll=''
1023 i_sysresrc=''
1024 i_syssecrt=''
1025 i_sysselct=''
1026 i_sysstat=''
1027 i_sysstatfs=''
1028 i_sysstatvfs=''
1029 i_systimes=''
1030 i_systypes=''
1031 i_sysuio=''
1032 i_sysun=''
1033 i_sysutsname=''
1034 i_sysvfs=''
1035 i_syswait=''
1036 i_sgtty=''
1037 i_termio=''
1038 i_termios=''
1039 d_tm_tm_gmtoff=''
1040 d_tm_tm_zone=''
1041 i_systime=''
1042 i_systimek=''
1043 i_time=''
1044 timeincl=''
1045 i_unistd=''
1046 i_ustat=''
1047 i_utime=''
1048 i_values=''
1049 i_stdarg=''
1050 i_varargs=''
1051 i_varhdr=''
1052 i_vfork=''
1053 d_inc_version_list=''
1054 inc_version_list=''
1055 inc_version_list_init=''
1056 installprefix=''
1057 installprefixexp=''
1058 installstyle=''
1059 installusrbinperl=''
1060 intsize=''
1061 longsize=''
1062 shortsize=''
1063 issymlink=''
1064 libc=''
1065 ldlibpthname=''
1066 libperl=''
1067 shrpenv=''
1068 useshrplib=''
1069 glibpth=''
1070 incpth=''
1071 libpth=''
1072 loclibpth=''
1073 plibpth=''
1074 xlibpth=''
1075 ignore_versioned_solibs=''
1076 libs=''
1077 libsdirs=''
1078 libsfiles=''
1079 libsfound=''
1080 libspath=''
1081 lns=''
1082 d_PRIEUldbl=''
1083 d_PRIFUldbl=''
1084 d_PRIGUldbl=''
1085 d_PRIeldbl=''
1086 d_PRIfldbl=''
1087 d_PRIgldbl=''
1088 d_SCNfldbl=''
1089 sPRIEUldbl=''
1090 sPRIFUldbl=''
1091 sPRIGUldbl=''
1092 sPRIeldbl=''
1093 sPRIfldbl=''
1094 sPRIgldbl=''
1095 sSCNfldbl=''
1096 lseeksize=''
1097 lseektype=''
1098 make_set_make=''
1099 d_mymalloc=''
1100 freetype=''
1101 mallocobj=''
1102 mallocsrc=''
1103 malloctype=''
1104 usemallocwrap=''
1105 usemymalloc=''
1106 installman1dir=''
1107 man1dir=''
1108 man1direxp=''
1109 man1ext=''
1110 installman3dir=''
1111 man3dir=''
1112 man3direxp=''
1113 man3ext=''
1114 modetype=''
1115 multiarch=''
1116 mydomain=''
1117 myhostname=''
1118 phostname=''
1119 c=''
1120 n=''
1121 d_eofnblk=''
1122 eagain=''
1123 o_nonblock=''
1124 rd_nodata=''
1125 need_va_copy=''
1126 netdb_hlen_type=''
1127 netdb_host_type=''
1128 netdb_name_type=''
1129 netdb_net_type=''
1130 groupcat=''
1131 hostcat=''
1132 passcat=''
1133 orderlib=''
1134 ranlib=''
1135 d_perl_otherlibdirs=''
1136 otherlibdirs=''
1137 package=''
1138 spackage=''
1139 pager=''
1140 api_revision=''
1141 api_subversion=''
1142 api_version=''
1143 api_versionstring=''
1144 patchlevel=''
1145 perl_patchlevel=''
1146 revision=''
1147 subversion=''
1148 version=''
1149 version_patchlevel_string=''
1150 perl5=''
1151 perladmin=''
1152 perlpath=''
1153 d_nv_preserves_uv=''
1154 d_nv_zero_is_allbits_zero=''
1155 i16size=''
1156 i16type=''
1157 i32size=''
1158 i32type=''
1159 i64size=''
1160 i64type=''
1161 i8size=''
1162 i8type=''
1163 ivsize=''
1164 ivtype=''
1165 nv_overflows_integers_at=''
1166 nv_preserves_uv_bits=''
1167 nvsize=''
1168 nvtype=''
1169 u16size=''
1170 u16type=''
1171 u32size=''
1172 u32type=''
1173 u64size=''
1174 u64type=''
1175 u8size=''
1176 u8type=''
1177 uvsize=''
1178 uvtype=''
1179 ivdformat=''
1180 nvEUformat=''
1181 nvFUformat=''
1182 nvGUformat=''
1183 nveformat=''
1184 nvfformat=''
1185 nvgformat=''
1186 uvXUformat=''
1187 uvoformat=''
1188 uvuformat=''
1189 uvxformat=''
1190 pidtype=''
1191 prefix=''
1192 prefixexp=''
1193 installprivlib=''
1194 privlib=''
1195 privlibexp=''
1196 prototype=''
1197 ptrsize=''
1198 d_PRIXU64=''
1199 d_PRId64=''
1200 d_PRIi64=''
1201 d_PRIo64=''
1202 d_PRIu64=''
1203 d_PRIx64=''
1204 sPRIXU64=''
1205 sPRId64=''
1206 sPRIi64=''
1207 sPRIo64=''
1208 sPRIu64=''
1209 sPRIx64=''
1210 d_quad=''
1211 quadkind=''
1212 quadtype=''
1213 uquadtype=''
1214 drand01=''
1215 randbits=''
1216 randfunc=''
1217 randseedtype=''
1218 seedfunc=''
1219 installscript=''
1220 scriptdir=''
1221 scriptdirexp=''
1222 selectminbits=''
1223 selecttype=''
1224 sh=''
1225 targetsh=''
1226 sig_count=''
1227 sig_name=''
1228 sig_name_init=''
1229 sig_num=''
1230 sig_num_init=''
1231 sig_size=''
1232 d_sitearch=''
1233 installsitearch=''
1234 sitearch=''
1235 sitearchexp=''
1236 installsitebin=''
1237 sitebin=''
1238 sitebinexp=''
1239 installsitehtml1dir=''
1240 sitehtml1dir=''
1241 sitehtml1direxp=''
1242 installsitehtml3dir=''
1243 sitehtml3dir=''
1244 sitehtml3direxp=''
1245 installsitelib=''
1246 sitelib=''
1247 sitelib_stem=''
1248 sitelibexp=''
1249 installsiteman1dir=''
1250 siteman1dir=''
1251 siteman1direxp=''
1252 installsiteman3dir=''
1253 siteman3dir=''
1254 siteman3direxp=''
1255 siteprefix=''
1256 siteprefixexp=''
1257 installsitescript=''
1258 sitescript=''
1259 sitescriptexp=''
1260 sizesize=''
1261 sizetype=''
1262 d_libname_unique=''
1263 so=''
1264 socksizetype=''
1265 sharpbang=''
1266 shsharp=''
1267 spitshell=''
1268 src=''
1269 ssizetype=''
1270 st_ino_sign=''
1271 st_ino_size=''
1272 startperl=''
1273 startsh=''
1274 stdchar=''
1275 d_stdio_stream_array=''
1276 stdio_stream_array=''
1277 sysman=''
1278 sGMTIME_max=''
1279 sGMTIME_min=''
1280 sLOCALTIME_max=''
1281 sLOCALTIME_min=''
1282 trnl=''
1283 uidformat=''
1284 uidsign=''
1285 uidsize=''
1286 uidtype=''
1287 archname64=''
1288 use64bitall=''
1289 use64bitint=''
1290 usecbacktrace=''
1291 dtrace=''
1292 usedtrace=''
1293 usefaststdio=''
1294 usekernprocpathname=''
1295 ccflags_uselargefiles=''
1296 ldflags_uselargefiles=''
1297 libswanted_uselargefiles=''
1298 uselargefiles=''
1299 uselongdouble=''
1300 usemorebits=''
1301 usequadmath=''
1302 usemultiplicity=''
1303 nm_opt=''
1304 nm_so_opt=''
1305 runnm=''
1306 usenm=''
1307 usensgetexecutablepath=''
1308 useperlio=''
1309 usesocks=''
1310 d_oldpthreads=''
1311 use5005threads=''
1312 useithreads=''
1313 usereentrant=''
1314 usethreads=''
1315 incpath=''
1316 mips_type=''
1317 usrinc=''
1318 vaproto=''
1319 d_vendorarch=''
1320 installvendorarch=''
1321 vendorarch=''
1322 vendorarchexp=''
1323 d_vendorbin=''
1324 installvendorbin=''
1325 vendorbin=''
1326 vendorbinexp=''
1327 installvendorhtml1dir=''
1328 vendorhtml1dir=''
1329 vendorhtml1direxp=''
1330 installvendorhtml3dir=''
1331 vendorhtml3dir=''
1332 vendorhtml3direxp=''
1333 d_vendorlib=''
1334 installvendorlib=''
1335 vendorlib=''
1336 vendorlib_stem=''
1337 vendorlibexp=''
1338 installvendorman1dir=''
1339 vendorman1dir=''
1340 vendorman1direxp=''
1341 installvendorman3dir=''
1342 vendorman3dir=''
1343 vendorman3direxp=''
1344 usevendorprefix=''
1345 vendorprefix=''
1346 vendorprefixexp=''
1347 d_vendorscript=''
1348 installvendorscript=''
1349 vendorscript=''
1350 vendorscriptexp=''
1351 versiononly=''
1352 yacc=''
1353 yaccflags=''
1354 CONFIG=''
1355
1356 : Detect odd OSs
1357 define='define'
1358 undef='undef'
1359 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1360 rmlist=''
1361
1362 : We must find out about Eunice early
1363 eunicefix=':'
1364 if test -f /etc/unixtovms; then
1365         eunicefix=/etc/unixtovms
1366 fi
1367 if test -f /etc/unixtovms.exe; then
1368         eunicefix=/etc/unixtovms.exe
1369 fi
1370
1371 : Set executable suffix now -- needed before hints available
1372 if test -f "/libs/version.library"; then
1373 : Amiga OS
1374     _exe=""
1375 elif test -f "/system/gnu_library/bin/ar.pm"; then
1376 : Stratus VOS
1377     _exe=".pm"
1378 elif test -n "$DJGPP"; then
1379 : DOS DJGPP
1380     _exe=".exe"
1381 elif test -f /kern/cookiejar; then
1382 : MiNT
1383     _exe=""
1384 elif test -d c:/. -o -n "$is_os2" ; then
1385 : OS/2 or cygwin
1386     _exe=".exe"
1387 fi
1388
1389 groupstype=''
1390 i_whoami=''
1391 : Trailing extension.  Override this in a hint file, if needed.
1392 : Extra object files, if any, needed on this platform.
1393 archobjs=''
1394 archname=''
1395 : Possible local include directories to search.
1396 : Set locincpth to "" in a hint file to defeat local include searches.
1397 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1398 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1399 :
1400 : no include file wanted by default
1401 inclwanted=''
1402
1403 : Enable -DEBUGGING and -DDEBUGGING from the command line
1404 EBUGGING=''
1405 DEBUGGING=''
1406
1407 libnames=''
1408 : change the next line if compiling for Xenix/286 on Xenix/386
1409 xlibpth='/usr/lib/386 /lib/386'
1410 : Possible local library directories to search.
1411 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1412 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1413
1414 : general looking path for locating libraries
1415 glibpth="/lib /usr/lib $xlibpth"
1416 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1417 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1418 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1419 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1420
1421 : Private path used by Configure to find libraries.  Its value
1422 : is prepended to libpth. This variable takes care of special
1423 : machines, like the mips.  Usually, it should be empty.
1424 plibpth=''
1425
1426 : default library list
1427 libswanted=''
1428 : some systems want to use only the non-versioned libso:s
1429 ignore_versioned_solibs=''
1430 : set usethreads on the Configure command line to enable threads.
1431 usereentrant='undef'
1432 ccname=''
1433 ccversion=''
1434 perllibs=''
1435 : set useposix=false in your hint file to disable the POSIX extension.
1436 useposix=true
1437 : set useopcode=false in your hint file to disable the Opcode extension.
1438 useopcode=true
1439 archname64=''
1440 ccflags_uselargefiles=''
1441 ldflags_uselargefiles=''
1442 libswanted_uselargefiles=''
1443 : set usemultiplicity on the Configure command line to enable multiplicity.
1444 : set usesocks on the Configure command line to enable socks.
1445 : List of libraries we want.
1446 : If anyone needs extra -lxxx, put those in a hint file.
1447 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1448 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1449 : We probably want to search /usr/shlib before most other libraries.
1450 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1451 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1452 glibpth="/usr/shlib $glibpth"
1453 : Do not use vfork unless overridden by a hint file.
1454 usevfork=false
1455
1456 : Find the basic shell for Bourne shell scripts
1457 case "$sh" in
1458 '')
1459         case "$SYSTYPE" in
1460         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1461         *) xxx='/bin/sh';;
1462         esac
1463         if test -f "$xxx"; then
1464                 sh="$xxx"
1465         else
1466                 : Build up a list and do a single loop so we can 'break' out.
1467                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1468                 for xxx in sh bash ksh pdksh ash; do
1469                         for p in $pth; do
1470                                 try="$try ${p}/${xxx}"
1471                         done
1472                 done
1473                 for xxx in $try; do
1474                         if test -f "$xxx"; then
1475                                 sh="$xxx";
1476                                 break
1477                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1478                                 sh="$xxx";
1479                                 break
1480                         elif test -f "$xxx.exe"; then
1481                                 sh="$xxx";
1482                                 break
1483                         fi
1484                 done
1485         fi
1486         ;;
1487 esac
1488
1489 case "$sh" in
1490 '')     cat >&2 <<EOM
1491 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1492
1493 Usually it's in /bin/sh.  How did you even get this far?
1494 Please contact me (Perl Maintainers) at perlbug@perl.org and
1495 we'll try to straighten this all out.
1496 EOM
1497         exit 1
1498         ;;
1499 esac
1500
1501 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1502 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1503 targetsh=$sh
1504
1505 : see if sh knows # comments
1506 if `$sh -c '#' >/dev/null 2>&1`; then
1507         shsharp=true
1508         spitshell=cat
1509         xcat=/bin/cat
1510         test -f $xcat$_exe || xcat=/usr/bin/cat
1511         if test ! -f $xcat$_exe; then
1512                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1513                         if test -f $p/cat$_exe; then
1514                                 xcat=$p/cat
1515                                 break
1516                         fi
1517                 done
1518                 if test ! -f $xcat$_exe; then
1519                         echo "Can't find cat anywhere!"
1520                         exit 1
1521                 fi
1522         fi
1523         echo "#!$xcat" >sharp
1524         $eunicefix sharp
1525         chmod +x sharp
1526         ./sharp > today 2>/dev/null
1527         if test -s today; then
1528                 sharpbang='#!'
1529         else
1530                 echo "#! $xcat" > sharp
1531                 $eunicefix sharp
1532                 chmod +x sharp
1533                 ./sharp > today 2>/dev/null
1534                 if test -s today; then
1535                         sharpbang='#! '
1536                 else
1537                         sharpbang=': use '
1538                 fi
1539         fi
1540 else
1541         echo " "
1542         echo "Your $sh doesn't grok # comments--I will strip them later on."
1543         shsharp=false
1544         cd ..
1545         echo "exec grep -v '^[  ]*#'" >spitshell
1546         chmod +x spitshell
1547         $eunicefix spitshell
1548         spitshell=`pwd`/spitshell
1549         cd UU
1550         echo "I presume that if # doesn't work, #! won't work either!"
1551         sharpbang=': use '
1552 fi
1553 rm -f sharp today
1554
1555 : figure out how to guarantee sh startup
1556 case "$startsh" in
1557 '') startsh=${sharpbang}${sh} ;;
1558 *)
1559 esac
1560 cat >sharp <<EOSS
1561 $startsh
1562 set abc
1563 test "$?abc" != 1
1564 EOSS
1565
1566 chmod +x sharp
1567 $eunicefix sharp
1568 if ./sharp; then
1569         : echo "Yup, it does."
1570 else
1571         echo "Hmm... '$startsh' does not guarantee sh startup..."
1572         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1573 fi
1574 rm -f sharp
1575
1576 : Save command line options in file UU/cmdline.opt for later use in
1577 : generating config.sh.
1578 cat > cmdline.opt <<EOSH
1579 : Configure command line arguments.
1580 config_arg0='$0'
1581 config_args='$*'
1582 config_argc=$#
1583 EOSH
1584 argn=1
1585 args_exp=''
1586 args_sep=''
1587 for arg in "$@"; do
1588         cat >>cmdline.opt <<EOSH
1589 config_arg$argn='$arg'
1590 EOSH
1591         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1592 $arg
1593 EOC
1594         arg_exp=`cat cmdl.opt`
1595         args_exp="$args_exp$args_sep'$arg_exp'"
1596         argn=`expr $argn + 1`
1597         args_sep=' '
1598 done
1599 rm -f cmdl.opt
1600
1601 : produce awk script to parse command line options
1602 cat >options.awk <<'EOF'
1603 BEGIN {
1604         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1605
1606         len = length(optstr);
1607         for (i = 1; i <= len; i++) {
1608                 c = substr(optstr, i, 1);
1609                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1610                 if (a == ":") {
1611                         arg[c] = 1;
1612                         i++;
1613                 }
1614                 opt[c] = 1;
1615         }
1616 }
1617 {
1618         expect = 0;
1619         str = $0;
1620         if (substr(str, 1, 1) != "-") {
1621                 printf("'%s'\n", str);
1622                 next;
1623         }
1624         len = length($0);
1625         for (i = 2; i <= len; i++) {
1626                 c = substr(str, i, 1);
1627                 if (!opt[c]) {
1628                         printf("-%s\n", substr(str, i));
1629                         next;
1630                 }
1631                 printf("-%s\n", c);
1632                 if (arg[c]) {
1633                         if (i < len)
1634                                 printf("'%s'\n", substr(str, i + 1));
1635                         else
1636                                 expect = 1;
1637                         next;
1638                 }
1639         }
1640 }
1641 END {
1642         if (expect)
1643                 print "?";
1644 }
1645 EOF
1646
1647 : process the command line options
1648 set X `for arg in "$@"; do echo "X$arg"; done |
1649         sed -e s/X// | awk -f options.awk`
1650 eval "set $*"
1651 shift
1652 rm -f options.awk
1653
1654 : set up default values
1655 fastread=''
1656 reuseval=false
1657 config_sh=''
1658 alldone=''
1659 error=''
1660 silent=''
1661 extractsh=''
1662 override=''
1663 knowitall=''
1664 rm -f optdef.sh posthint.sh
1665 cat >optdef.sh <<EOS
1666 $startsh
1667 EOS
1668
1669
1670 : option parsing
1671 while test $# -gt 0; do
1672         case "$1" in
1673         -d) shift; fastread=yes;;
1674         -e) shift; alldone=cont;;
1675         -f)
1676                 shift
1677                 cd ..
1678                 if test -r "$1"; then
1679                         config_sh="$1"
1680                 else
1681                         echo "$me: cannot read config file $1." >&2
1682                         error=true
1683                 fi
1684                 cd UU
1685                 shift;;
1686         --help|\
1687         -h) shift; error=true;;
1688         -r) shift; reuseval=true;;
1689         -s) shift; silent=true; realsilent=true;;
1690         -E) shift; alldone=exit;;
1691         -K) shift; knowitall=true;;
1692         -O) shift; override=true;;
1693         -S) shift; silent=true; extractsh=true;;
1694         -D)
1695                 shift
1696                 case "$1" in
1697                 *=)
1698                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1699                         echo "$me: ignoring -D $1" >&2
1700                         ;;
1701                 *=*) echo "$1" | \
1702                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1703                 *) echo "$1='define'" >> optdef.sh;;
1704                 esac
1705                 shift
1706                 ;;
1707         -U)
1708                 shift
1709                 case "$1" in
1710                 *=) echo "$1" >> optdef.sh;;
1711                 *=*)
1712                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1713                         echo "$me: ignoring -U $1" >&2
1714                         ;;
1715                 *) echo "$1='undef'" >> optdef.sh;;
1716                 esac
1717                 shift
1718                 ;;
1719         -A)
1720             shift
1721             xxx=''
1722             yyy="$1"
1723             zzz=''
1724             uuu=undef
1725             case "$yyy" in
1726             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1727                  case "$zzz" in
1728                  *:*) zzz='' ;;
1729                  *)   xxx=append
1730                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1731                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1732                  esac
1733                  ;;
1734             esac
1735             case "$xxx" in
1736             '')  case "$yyy" in
1737                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1738                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1739                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1740                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1741                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1742                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1743                  esac
1744                  ;;
1745             esac
1746             case "$xxx" in
1747             append)
1748                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1749             clear)
1750                 echo "$yyy=''"                  >> posthint.sh ;;
1751             define)
1752                 case "$zzz" in
1753                 '') zzz=define ;;
1754                 esac
1755                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1756             eval)
1757                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1758             prepend)
1759                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1760             undef)
1761                 case "$zzz" in
1762                 '') zzz="$uuu" ;;
1763                 esac
1764                 echo "$yyy=$zzz"                >> posthint.sh ;;
1765             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1766             esac
1767             shift
1768             ;;
1769         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1770             exit 0;;
1771         --) break;;
1772         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1773         *) break;;
1774         esac
1775 done
1776
1777 case "$error" in
1778 true)
1779         cat >&2 <<EOM
1780 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1781                  [-U symbol] [-U symbol=] [-A command:symbol...]
1782   -d : use defaults for all answers.
1783   -e : go on without questioning past the production of config.sh.
1784   -f : specify an alternate default configuration file.
1785   -h : print this help message and exit (with an error status).
1786   -r : reuse C symbols value if possible (skips costly nm extraction).
1787   -s : silent mode, only echoes questions and essential information.
1788   -D : define symbol to have some value:
1789          -D symbol         symbol gets the value 'define'
1790          -D symbol=value   symbol gets the value 'value'
1791        common used examples (see INSTALL for more info):
1792          -Duse64bitint            use 64bit integers
1793          -Duse64bitall            use 64bit integers and pointers
1794          -Dusethreads             use thread support
1795          -Dinc_version_list=none  do not include older perl trees in @INC
1796          -DEBUGGING=none          DEBUGGING options
1797          -Dcc=gcc                 choose your compiler
1798          -Dprefix=/opt/perl5      choose your destination
1799   -E : stop at the end of questions, after having produced config.sh.
1800   -K : do not use unless you know what you are doing.
1801   -O : let -D and -U override definitions from loaded configuration file.
1802   -S : perform variable substitutions on all .SH files (can mix with -f)
1803   -U : undefine symbol:
1804          -U symbol    symbol gets the value 'undef'
1805          -U symbol=   symbol gets completely empty
1806        e.g.:  -Uversiononly
1807   -A : manipulate symbol after the platform specific hints have been applied:
1808          -A append:symbol=value   append value to symbol
1809          -A symbol=value          like append:, but with a separating space
1810          -A define:symbol=value   define symbol to have value
1811          -A clear:symbol          define symbol to be ''
1812          -A define:symbol         define symbol to be 'define'
1813          -A eval:symbol=value     define symbol to be eval of value
1814          -A prepend:symbol=value  prepend value to symbol
1815          -A undef:symbol          define symbol to be 'undef'
1816          -A undef:symbol=         define symbol to be ''
1817        e.g.:  -A prepend:libswanted='cl pthread '
1818               -A ccflags=-DSOME_MACRO
1819   -V : print version number and exit (with a zero status).
1820 EOM
1821         exit 1
1822         ;;
1823 esac
1824
1825 : Sanity checks
1826 case "$fastread$alldone" in
1827 yescont|yesexit) ;;
1828 *)
1829         case "$extractsh" in
1830         true) ;;
1831         *)
1832                 if test ! -t 0; then
1833                         echo "Say 'sh Configure', not 'sh <Configure'"
1834                         exit 1
1835                 fi
1836                 ;;
1837         esac
1838         ;;
1839 esac
1840
1841 exec 4>&1
1842 case "$silent" in
1843 true) exec 1>/dev/null;;
1844 esac
1845
1846 : run the defines and the undefines, if any, but leave the file out there...
1847 touch optdef.sh
1848 . ./optdef.sh
1849 : create the posthint manipulation script and leave the file out there...
1850 touch posthint.sh
1851
1852 : set package name
1853 package='perl5'
1854 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1855 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1856 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1857 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1858 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1859 esac
1860
1861 : Some greps do not return status, grrr.
1862 echo "grimblepritz" >grimble
1863 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1864         contains=contains
1865 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1866         contains=grep
1867 else
1868         contains=contains
1869 fi
1870 rm -f grimble
1871 : the following should work in any shell
1872 case "$contains" in
1873 contains*)
1874         echo " "
1875         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1876         cat >contains <<'EOSS'
1877 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1878 EOSS
1879 chmod +x contains
1880 esac
1881
1882 : Find the path to the source tree
1883 case "$src" in
1884 '') case "$0" in
1885     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1886          case "$src" in
1887          /*)    ;;
1888          .)     ;;
1889          *)     src=`cd ../$src && pwd` ;;
1890          esac
1891          ;;
1892     *)   src='.';;
1893     esac;;
1894 esac
1895 case "$src" in
1896 '')     src=/
1897         rsrc=/
1898         ;;
1899 /*)     rsrc="$src";;
1900 *)      rsrc="../$src";;
1901 esac
1902 if test -f $rsrc/Configure && \
1903         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1904 then
1905    : found it, so we are ok.
1906 else
1907         rsrc=''
1908         for src in . .. ../.. ../../.. ../../../..; do
1909                 if test -f ../$src/Configure && \
1910                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1911                 then
1912                         rsrc=../$src
1913                         break
1914                 fi
1915         done
1916 fi
1917 case "$rsrc" in
1918 '')
1919         cat <<EOM >&4
1920
1921 Sorry, I can't seem to locate the source dir for $package.  Please start
1922 Configure with an explicit path -- i.e. /some/path/Configure.
1923
1924 EOM
1925         exit 1
1926         ;;
1927 ../.)   rsrc='..';;
1928 *)
1929         echo " "
1930         echo "Sources for $package found in \"$src\"." >&4
1931         ;;
1932 esac
1933
1934 : script used to extract .SH files with variable substitutions
1935 cat >extract <<'EOS'
1936 PERL_CONFIG_SH=true
1937 echo "Doing variable substitutions on .SH files..."
1938 if test -f MANIFEST; then
1939         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1940 else
1941         echo "(Looking for .SH files under the source directory.)"
1942         set x `(cd "$src"; find . -name "*.SH" -print)`
1943 fi
1944 shift
1945 case $# in
1946 0) set x `(cd "$src"; echo *.SH)`; shift;;
1947 esac
1948 if test ! -f "$src/$1"; then
1949         shift
1950 fi
1951 mkdir_p='
1952 name=$1;
1953 create="";
1954 while test $name; do
1955         if test ! -d "$name"; then
1956                 create="$name $create";
1957                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1958                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1959         else
1960                 name="";
1961         fi;
1962 done;
1963 for file in $create; do
1964         mkdir $file;
1965 done
1966 '
1967 for file in $*; do
1968         case "$src" in
1969         ".")
1970                 case "$file" in
1971                 */*)
1972                         dir=`expr X$file : 'X\(.*\)/'`
1973                         file=`expr X$file : 'X.*/\(.*\)'`
1974                         (cd "$dir" && . ./$file)
1975                         ;;
1976                 *)
1977                         . ./$file
1978                         ;;
1979                 esac
1980                 ;;
1981         *)
1982                 case "$file" in
1983                 */*)
1984                         dir=`expr X$file : 'X\(.*\)/'`
1985                         file=`expr X$file : 'X.*/\(.*\)'`
1986                         (set x $dir; shift; eval $mkdir_p)
1987                         sh <"$src/$dir/$file"
1988                         ;;
1989                 *)
1990                         sh <"$src/$file"
1991                         ;;
1992                 esac
1993                 ;;
1994         esac
1995 done
1996 if test -f "$src/config_h.SH"; then
1997         if test ! -f config.h; then
1998         : oops, they left it out of MANIFEST, probably, so do it anyway.
1999         . "$src/config_h.SH"
2000         fi
2001 fi
2002 EOS
2003
2004 : extract files and exit if asked to do so
2005 case "$extractsh" in
2006 true)
2007         case "$realsilent" in
2008         true) ;;
2009         *) exec 1>&4;;
2010         esac
2011         case "$config_sh" in
2012         '') config_sh='config.sh';;
2013         esac
2014         echo " "
2015         echo "Fetching answers from $config_sh..."
2016         cd ..
2017         . $config_sh
2018         test "$override" && . ./optdef.sh
2019         echo " "
2020         . UU/extract
2021         rm -rf UU
2022         echo "Extraction done."
2023         exit 0
2024         ;;
2025 esac
2026
2027 : Eunice requires " " instead of "", can you believe it
2028 echo " "
2029 : Here we go...
2030 echo "Beginning of configuration questions for $package."
2031
2032 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
2033
2034 : first determine how to suppress newline on echo command
2035 echo " "
2036 echo "Checking echo to see how to suppress newlines..."
2037 (echo "hi there\c" ; echo " ") >.echotmp
2038 if $contains c .echotmp >/dev/null 2>&1 ; then
2039         echo "...using -n."
2040         n='-n'
2041         c=''
2042 else
2043         cat <<'EOM'
2044 ...using \c
2045 EOM
2046         n=''
2047         c='\c'
2048 fi
2049 echo $n "The star should be here-->$c"
2050 echo '*'
2051 rm -f .echotmp
2052
2053 : Now test for existence of everything in MANIFEST
2054 echo " "
2055 if test -f "$rsrc/MANIFEST"; then
2056         echo "First let's make sure your kit is complete.  Checking..." >&4
2057         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2058                 (split -l 50 2>/dev/null || split -50)
2059         rm -f missing
2060         tmppwd=`pwd`
2061         for filelist in x??; do
2062                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2063                         >/dev/null 2>>"$tmppwd/missing")
2064         done
2065         if test -s missing; then
2066                 cat missing >&4
2067                 cat >&4 <<'EOM'
2068
2069 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2070
2071 You have the option of continuing the configuration process, despite the
2072 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2073 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2074 and contact the author (perlbug@perl.org).
2075
2076 EOM
2077                 echo $n "Continue? [n] $c" >&4
2078                 read ans
2079                 case "$ans" in
2080                 y*)
2081                         echo "Continuing..." >&4
2082                         rm -f missing
2083                         ;;
2084                 *)
2085                         echo "ABORTING..." >&4
2086                         kill $$
2087                         ;;
2088                 esac
2089         else
2090                 echo "Looks good..."
2091         fi
2092 else
2093         echo "There is no MANIFEST file.  I hope your kit is complete !"
2094 fi
2095 rm -f missing x??
2096
2097 : Find the appropriate value for a newline for tr
2098 echo " "
2099 if test -n "$DJGPP"; then
2100        trnl='\012'
2101 fi
2102 if test X"$trnl" = X; then
2103         case "`echo foo|tr '\n' x 2>/dev/null`" in
2104         foox) trnl='\n' ;;
2105         esac
2106 fi
2107 if test X"$trnl" = X; then
2108         case "`echo foo|tr '\012' x 2>/dev/null`" in
2109         foox) trnl='\012' ;;
2110         esac
2111 fi
2112 if test X"$trnl" = X; then
2113        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2114        fooxy) trnl='\n\r' ;;
2115        esac
2116 fi
2117 if test X"$trnl" = X; then
2118         cat <<EOM >&2
2119
2120 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2121
2122 EOM
2123         exit 1
2124 fi
2125
2126 : compute the number of columns on the terminal for proper question formatting
2127 case "$COLUMNS" in
2128 '') COLUMNS='80';;
2129 esac
2130
2131 : set up the echo used in my read
2132 myecho="case \"\$xxxm\" in
2133 '') echo $n \"\$rp $c\" >&4;;
2134 *) case \"\$rp\" in
2135         '') echo $n \"[\$xxxm] $c\";;
2136         *)
2137                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2138                         echo \"\$rp\" >&4
2139                         echo $n \"[\$xxxm] $c\" >&4
2140                 else
2141                         echo $n \"\$rp [\$xxxm] $c\" >&4
2142                 fi
2143                 ;;
2144         esac;;
2145 esac"
2146
2147 : now set up to do reads with possible shell escape and default assignment
2148 cat <<EOSC >myread
2149 $startsh
2150 xxxm=\$dflt
2151 $myecho
2152 ans='!'
2153 case "\$fastread" in
2154 yes) case "\$dflt" in
2155         '') ;;
2156         *) ans='';
2157                 case "\$silent-\$rp" in
2158                 true-) ;;
2159                 *) echo " " >&4;;
2160                 esac;;
2161         esac;;
2162 *) case "\$silent" in
2163         true) case "\$rp" in
2164                 '') ans='';;
2165                 esac;;
2166         esac;;
2167 esac
2168 while expr "X\$ans" : "X!" >/dev/null; do
2169         read answ
2170         set x \$xxxm
2171         shift
2172         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2173         case  "\$answ" in
2174         "!")
2175                 sh 1>&4
2176                 echo " "
2177                 $myecho
2178                 ;;
2179         !*)
2180                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2181                 shift
2182                 sh 1>&4 -c "\$*"
2183                 echo " "
2184                 $myecho
2185                 ;;
2186         "\$ans")
2187                 case "\$ans" in
2188                 \\&*)
2189                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2190                         shift
2191                         case "\$1" in
2192                         -d)
2193                                 fastread=yes
2194                                 echo "(OK, I'll run with -d after this question.)" >&4
2195                                 ;;
2196                         -*)
2197                                 echo "*** Sorry, \$1 not supported yet." >&4
2198                                 ;;
2199                         esac
2200                         $myecho
2201                         ans=!
2202                         ;;
2203                 esac;;
2204         *)
2205                 case "\$aok" in
2206                 y)
2207                         echo "*** Substitution done -- please confirm."
2208                         xxxm="\$ans"
2209                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2210                         xxxm="\$ans"
2211                         ans=!
2212                         ;;
2213                 *)
2214                         echo "*** Error -- try again."
2215                         ans=!
2216                         ;;
2217                 esac
2218                 $myecho
2219                 ;;
2220         esac
2221         case "\$ans\$xxxm\$nostick" in
2222         '')
2223                 ans=!
2224                 $myecho
2225                 ;;
2226         esac
2227 done
2228 case "\$ans" in
2229 '') ans="\$xxxm";;
2230 esac
2231 EOSC
2232
2233 : create .config dir to save info across Configure sessions
2234 test -d ../.config || mkdir ../.config
2235 cat >../.config/README <<EOF
2236 This directory created by Configure to save information that should
2237 persist across sessions for $package.
2238
2239 You may safely delete it if you wish.
2240 EOF
2241
2242 : See if we are using a devel version and want that
2243 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2244 case "$usedevel" in
2245 $define|true|[yY]*)
2246     usedevel="$define" ;;
2247 *) case "$xversion" in
2248    *[13579])
2249         cat >&4 <<EOH
2250 *** WHOA THERE!!! ***
2251
2252     This is an UNSTABLE DEVELOPMENT release.
2253     The version of this $package distribution is $xversion, that is, odd,
2254     (as opposed to even) and that signifies a development release.
2255     If you want a maintenance release, you want an even-numbered version.
2256
2257     Do ***NOT*** install this into production use.
2258     Data corruption and crashes are possible.
2259
2260     It is most seriously suggested that you do not continue any further
2261     unless you want to help in developing and debugging Perl.
2262
2263     If you *still* want to build perl, you can answer 'y' now,
2264     or pass -Dusedevel to Configure.
2265
2266 EOH
2267         rp='Do you really want to continue?'
2268         dflt='n'
2269         . ./myread
2270         case "$ans" in
2271         [yY]) echo >&4 "Okay, continuing."
2272               usedevel="$define" ;;
2273         *) echo >&4 "Okay, bye."
2274            exit 1
2275            ;;
2276         esac
2277         ;;
2278     esac
2279     usedevel="$undef"
2280     ;;
2281 esac
2282 case "$usedevel" in
2283 $define|true|[yY]*)
2284         case "$versiononly" in
2285         '') versiononly="$define" ;;
2286         esac
2287         case "$installusrbinperl" in
2288         '') installusrbinperl="$undef" ;;
2289         esac
2290         ;;
2291 esac
2292
2293 : general instructions
2294 needman=true
2295 firsttime=true
2296 user=`(logname) 2>/dev/null`
2297 case "$user" in
2298 '') user=`whoami 2>&1`;;
2299 esac
2300 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2301         firsttime=false
2302         echo " "
2303         rp='Would you like to see the instructions?'
2304         dflt=n
2305         . ./myread
2306         case "$ans" in
2307         [yY]*) ;;
2308         *) needman=false;;
2309         esac
2310 fi
2311 if $needman; then
2312         cat <<EOH
2313
2314 This installation shell script will examine your system and ask you questions
2315 to determine how the perl5 package should be installed. If you get
2316 stuck on a question, you may use a ! shell escape to start a subshell or
2317 execute a command.  Many of the questions will have default answers in square
2318 brackets; typing carriage return will give you the default.
2319
2320 On some of the questions which ask for file or directory names you are allowed
2321 to use the ~name construct to specify the login directory belonging to "name",
2322 even if you don't have a shell which knows about that.  Questions where this is
2323 allowed will be marked "(~name ok)".
2324
2325 EOH
2326         rp=''
2327         dflt='Type carriage return to continue'
2328         . ./myread
2329         cat <<'EOH'
2330
2331 The prompter used in this script allows you to use shell variables and
2332 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2333 in the default answer, as if the default line was a set of arguments given to a
2334 script shell.  This means you may also use $* to repeat the whole default line,
2335 so you do not have to re-type everything to add something to the default.
2336
2337 Every time there is a substitution, you will have to confirm.  If there is an
2338 error (e.g. an unmatched backtick), the default answer will remain unchanged
2339 and you will be prompted again.
2340
2341 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2342 the questions and use the computed defaults (or the previous answers if there
2343 was already a config.sh file). Type 'Configure -h' for a list of options.
2344 You may also start interactively and then answer '& -d' at any prompt to turn
2345 on the non-interactive behaviour for the remainder of the execution.
2346
2347 EOH
2348         . ./myread
2349         cat <<EOH
2350
2351 Much effort has been expended to ensure that this shell script will run on any
2352 Unix system.  If despite that it blows up on yours, your best bet is to edit
2353 Configure and run it again.  If you can't run Configure for some reason,
2354 you'll have to generate a config.sh file by hand.  Whatever problems you
2355 have, let me (perlbug@perl.org) know how I blew it.
2356
2357 This installation script affects things in two ways:
2358
2359 1) it may do direct variable substitutions on some of the files included
2360    in this kit.
2361 2) it builds a config.h file for inclusion in C programs.  You may edit
2362    any of these files as the need arises after running this script.
2363
2364 If you make a mistake on a question, there is no easy way to back up to it
2365 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2366 files.  Configure will offer to let you do this before it runs the SH files.
2367
2368 EOH
2369         dflt='Type carriage return to continue'
2370         . ./myread
2371         case "$firsttime" in
2372         true) echo $user >>../.config/instruct;;
2373         esac
2374 fi
2375
2376 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2377 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2378 if test "X$sysroot" = X; then
2379     sysroot=""
2380 else
2381     case "$cc" in
2382         *gcc*|*g++*)
2383             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2384             # _sysroot is used in places where we need --sysroot=foo
2385             # but using the rest of the flags could cause issues.
2386             _sysroot="--sysroot=$sysroot";
2387             case "$ccflags" in
2388                 *sysroot*) ;;
2389                 'undef'|*)
2390                 ccflags="$ccflags $_sysroot"
2391             esac
2392             case "$ldflags" in
2393                 *sysroot*) ;;
2394                 'undef'|*)
2395                 ldflags="$ldflags $_sysroot"
2396             esac
2397             case "$cppflags" in
2398                 *sysroot*) ;;
2399                 'undef'|*)
2400                 cppflags="$cppflags $_sysroot"
2401             esac
2402             # lddlflags updated below in lddlflags section;
2403             # same with cccdlflags
2404             ;;
2405     esac
2406
2407     # Adjust some defaults to also use $sysroot
2408     for var in xlibpth loclibpth locincpth glibpth; do
2409         eval xxx=\$$var
2410         eval $var=''
2411         for path in $xxx; do
2412             eval $var=\"\$$var $sysroot$path\"
2413         done
2414     done
2415
2416 fi
2417
2418 : find out where common programs are
2419 echo " "
2420 echo "Locating common programs..." >&4
2421 cat <<EOSC >loc
2422 $startsh
2423 case \$# in
2424 0) exit 1;;
2425 esac
2426 thing=\$1
2427 shift
2428 dflt=\$1
2429 shift
2430 for dir in \$*; do
2431         case "\$thing" in
2432         .)
2433         if test -d \$dir/\$thing; then
2434                 echo \$dir
2435                 exit 0
2436         fi
2437         ;;
2438         *)
2439         for thisthing in \$dir/\$thing; do
2440                 : just loop through to pick last item
2441         done
2442         if test -f \$thisthing; then
2443                 echo \$thisthing
2444                 exit 0
2445         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2446                 echo \$thisthing
2447                 exit 0
2448         elif test -f \$dir/\$thing.exe; then
2449                 if test -n "$DJGPP"; then
2450                         echo \$dir/\$thing.exe
2451                 elif test "$eunicefix" != ":"; then
2452                         : on Eunice apparently
2453                         echo \$dir/\$thing
2454                 fi
2455                 exit 0
2456         fi
2457         ;;
2458         esac
2459 done
2460 echo \$dflt
2461 exit 1
2462 EOSC
2463 chmod +x loc
2464 $eunicefix loc
2465 loclist="
2466 awk
2467 cat
2468 chmod
2469 comm
2470 cp
2471 echo
2472 expr
2473 grep
2474 ls
2475 mkdir
2476 rm
2477 sed
2478 sort
2479 touch
2480 tr
2481 uniq
2482 "
2483 trylist="
2484 ar
2485 bison
2486 byacc
2487 cpp
2488 csh
2489 date
2490 egrep
2491 gmake
2492 gzip
2493 less
2494 ln
2495 make
2496 more
2497 nm
2498 nroff
2499 perl
2500 pg
2501 test
2502 uname
2503 zip
2504 "
2505 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2506 pth="$pth $sysroot/lib $sysroot/usr/lib"
2507 for file in $loclist; do
2508         eval xxx=\$$file
2509         case "$xxx" in
2510         /*|?:[\\/]*)
2511                 if test -f "$xxx"; then
2512                         : ok
2513                 else
2514                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2515                         xxx=`./loc $file $file $pth`
2516                 fi
2517                 ;;
2518         '') xxx=`./loc $file $file $pth`;;
2519         *) xxx=`./loc $xxx $xxx $pth`;;
2520         esac
2521         eval $file=$xxx$_exe
2522         eval _$file=$xxx
2523         case "$xxx" in
2524         /*)
2525                 echo $file is in $xxx.
2526                 ;;
2527         ?:[\\/]*)
2528                 echo $file is in $xxx.
2529                 ;;
2530         *)
2531                 echo "I don't know where '$file' is, and my life depends on it." >&4
2532                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2533                 exit 1
2534                 ;;
2535         esac
2536 done
2537 echo " "
2538 echo "Don't worry if any of the following aren't found..."
2539 say=offhand
2540 for file in $trylist; do
2541         eval xxx=\$$file
2542         case "$xxx" in
2543         /*|?:[\\/]*)
2544                 if test -f "$xxx"; then
2545                         : ok
2546                 else
2547                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2548                         xxx=`./loc $file $file $pth`
2549                 fi
2550                 ;;
2551         '') xxx=`./loc $file $file $pth`;;
2552         *) xxx=`./loc $xxx $xxx $pth`;;
2553         esac
2554         eval $file=$xxx$_exe
2555         eval _$file=$xxx
2556         case "$xxx" in
2557         /*)
2558                 echo $file is in $xxx.
2559                 ;;
2560         ?:[\\/]*)
2561                 echo $file is in $xxx.
2562                 ;;
2563         *)
2564                 echo "I don't see $file out there, $say."
2565                 say=either
2566                 ;;
2567         esac
2568 done
2569 case "$egrep" in
2570 egrep)
2571         echo "Substituting grep for egrep."
2572         egrep=$grep
2573         _egrep=$grep
2574         ;;
2575 esac
2576 case "$less" in
2577 '')     ;;
2578 *)      if $less -R </dev/null >/dev/null 2>&1; then
2579                echo "Substituting less -R for less."
2580                less="$less -R"
2581                _less=$less
2582         fi
2583         ;;
2584 esac
2585 case "$ln" in
2586 ln)
2587         echo "Substituting cp for ln."
2588         ln=$cp
2589         _ln=$cp
2590         ;;
2591 esac
2592 case "$make" in
2593 make)
2594         case "$gmake" in
2595         gmake)
2596         echo "I can't find make or gmake, and my life depends on it." >&4
2597         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2598         exit 1
2599         ;;
2600         esac
2601         ;;
2602 esac
2603 case "$gmake" in
2604 gmake)  ;;
2605 *)      # We can't have osname yet.
2606         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2607                 # Assume that gmake, if found, is definitely GNU make
2608                 # and prefer it over the system make.
2609                 echo "Substituting gmake for make."
2610                 make=$gmake
2611                 _make=$gmake
2612         fi
2613         ;;
2614 esac
2615 case "$test" in
2616 test)
2617         echo "Hopefully test is built into your sh."
2618         ;;
2619 *)
2620         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2621                 echo "Using the test built into your sh."
2622                 test=test
2623                 _test=test
2624         fi
2625         ;;
2626 esac
2627 case "$echo" in
2628 echo)
2629         echo "Hopefully echo is built into your sh."
2630         ;;
2631 '') ;;
2632 *)
2633         echo " "
2634 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2635         $echo $n "hi there$c" >foo1
2636         echo $n "hi there$c" >foo2
2637         if cmp foo1 foo2 >/dev/null 2>&1; then
2638                 echo "They are compatible.  In fact, they may be identical."
2639         else
2640                 case "$n" in
2641                 '-n') n='' c='\c';;
2642                 *) n='-n' c='';;
2643                 esac
2644                 cat <<FOO
2645 They are not compatible!  You are probably running ksh on a non-USG system.
2646 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2647 have echo built in and we may have to run some Bourne shell scripts.  That
2648 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2649
2650 FOO
2651                 $echo $n "The star should be here-->$c"
2652                 $echo "*"
2653         fi
2654         $rm -f foo1 foo2
2655         ;;
2656 esac
2657
2658 # This question was auctioned at YAPC::Europe-2007 in Vienna
2659 # I never promised you could answer it. I only auctioned the question.
2660 cat <<FOO
2661 The following message is sponsored by
2662
2663   Dresden.pm<--The stars should be here.
2664
2665 Dear Perl user, system administrator or package
2666 maintainer, the Perl community sends greetings to
2667 you. Do you (emblematical) greet back [Y/n]? n
2668
2669 FOO
2670
2671 : Check what type of C compiler we use
2672 cat <<EOS >trygcc
2673 $startsh
2674 EOS
2675 cat <<'EOSC' >>trygcc
2676 case "$cc" in
2677 '') ;;
2678 *)  $rm -f try try.*
2679     $cat >try.c <<EOM
2680 int main(int argc, char *argv[]) {
2681   return 0;
2682 }
2683 EOM
2684     if $cc -o try $ccflags $ldflags try.c; then
2685        :
2686     else
2687         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2688         despair=yes
2689         trygcc=yes
2690         case "$cc" in
2691         *gcc*) trygcc=no ;;
2692         esac
2693         # Skip this test because it gives a false match on output like:
2694         #    ./trygcc: line 23: cc: command not found
2695         # case "`$cc -v -c try.c 2>&1`" in
2696         # *gcc*) trygcc=no ;;
2697         # esac
2698         if $test X"$trygcc" = Xyes; then
2699             if gcc -o try -c try.c; then
2700                 echo " "
2701                 echo "You seem to have a working gcc, though." >&4
2702                 # Switching compilers may undo the work of hints files.
2703                 # The most common problem is -D_REENTRANT for threads.
2704                 # This heuristic catches that case, but gets false positives
2705                 # if -Dusethreads was not actually specified.  Better to
2706                 # bail out here with a useful message than fail
2707                 # mysteriously later. Should we perhaps just try to
2708                 # re-invoke Configure -Dcc=gcc config_args ?
2709                 if $test -f usethreads.cbu; then
2710                         $cat >&4 <<EOM
2711
2712 *** However, any setting of the C compiler flags (e.g. for thread support)
2713 *** will be lost.  It may be necessary for you to restart Configure and
2714 *** add -Dcc=gcc to your Configure command line.
2715
2716 EOM
2717                         rp="Would you like to go ahead and try gcc anyway?"
2718                         dflt=n
2719                 else
2720                         rp="Would you like to use it?"
2721                         dflt=y
2722                 fi
2723                 if $test -f myread; then
2724                     . ./myread
2725                 else
2726                     if $test -f UU/myread; then
2727                         . ./UU/myread
2728                     else
2729                         echo "Cannot find myread, sorry.  Aborting." >&2
2730                         exit 1
2731                     fi
2732                 fi
2733                 case "$ans" in
2734                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2735                 esac
2736             fi
2737         fi
2738     fi
2739     $rm -f try try.*
2740     ;;
2741 esac
2742 EOSC
2743
2744 cat <<EOS >checkcc
2745 $startsh
2746 EOS
2747 cat <<'EOSC' >>checkcc
2748 case "$cc" in
2749 '') ;;
2750 *)  $rm -f try try.*
2751     $cat >try.c <<EOM
2752 int main(int argc, char *argv[]) {
2753   return 0;
2754 }
2755 EOM
2756     if $cc -o try $ccflags $ldflags try.c; then
2757        :
2758     else
2759         if $test X"$despair" = Xyes; then
2760            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2761         fi
2762         $cat >&4 <<EOM
2763 You need to find a working C compiler.
2764 Either (purchase and) install the C compiler supplied by your OS vendor,
2765 or for a free C compiler try http://gcc.gnu.org/
2766 I cannot continue any further, aborting.
2767 EOM
2768         exit 1
2769     fi
2770     $rm -f try try.*
2771     ;;
2772 esac
2773 EOSC
2774
2775 : determine whether symbolic links are supported
2776 echo " "
2777 $touch blurfl
2778 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2779         echo "Symbolic links are supported." >&4
2780         lns="$ln -s"
2781 else
2782         echo "Symbolic links are NOT supported." >&4
2783         lns="$ln"
2784 fi
2785 $rm -f blurfl sym
2786
2787 : determine whether symbolic links are supported
2788 echo " "
2789 case "$lns" in
2790 *"ln"*" -s")
2791         echo "Checking how to test for symbolic links..." >&4
2792         $lns blurfl sym
2793         if $test "X$issymlink" = X; then
2794                 case "$newsh" in
2795                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2796                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2797                 esac
2798                 if test $? = 0; then
2799                         issymlink="test -h"
2800                 else
2801                         echo "Your builtin 'test -h' may be broken." >&4
2802                         case "$test" in
2803                         /*)     ;;
2804                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2805                                 for p in $pth
2806                                 do
2807                                         if test -f "$p/$test"; then
2808                                                 test="$p/$test"
2809                                                 break
2810                                         fi
2811                                 done
2812                                 ;;
2813                         esac
2814                         case "$test" in
2815                         /*)
2816                                 echo "Trying external '$test -h'." >&4
2817                                 issymlink="$test -h"
2818                                 if $test ! -h sym >/dev/null 2>&1; then
2819                                         echo "External '$test -h' is broken, too." >&4
2820                                         issymlink=''
2821                                 fi
2822                                 ;;
2823                         *)      issymlink='' ;;
2824                         esac
2825                 fi
2826         fi
2827         if $test "X$issymlink" = X; then
2828                 if $test -L sym 2>/dev/null; then
2829                         issymlink="$test -L"
2830                         echo "The builtin '$test -L' worked." >&4
2831                 fi
2832         fi
2833         if $test "X$issymlink" != X; then
2834                 echo "You can test for symbolic links with '$issymlink'." >&4
2835         else
2836                 echo "I do not know how you can test for symbolic links." >&4
2837         fi
2838         $rm -f blurfl sym
2839         ;;
2840 *)      echo "No symbolic links, so not testing for their testing..." >&4
2841         ;;
2842 esac
2843 echo " "
2844
2845 : Make symlinks util
2846 case "$mksymlinks" in
2847 $define|true|[yY]*)
2848         case "$src" in
2849         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2850                 exit 1
2851                 ;;
2852         *)      case "$lns:$issymlink" in
2853                 *"ln"*" -s:"*"test -"?)
2854                         echo "Creating the symbolic links..." >&4
2855                         cd ..
2856                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2857                         awk 'NF == 1 {
2858                                 dir=".";
2859                                 file=$1 "";
2860                              }
2861                              NF == 2 {
2862                                 dir=$1 "";
2863                                 file=$2 "";
2864                              }
2865                              {
2866                                  print "# dir = ", dir, "file = ", file
2867                                  mf[dir] = mf[dir]" "src"/"dir"/"file;
2868                              } END {
2869                                  for (d in mf) {
2870                                      if (d != ".") { print("mkdir -p "d) }
2871                                      print("ln -sf "mf[d]" "d);
2872                                  }
2873                              }' src="$src" > UU/mksymlinks.$$
2874                         sh UU/mksymlinks.$$
2875                         rm UU/mksymlinks.$$
2876                         # Sanity check 1.
2877                         if test ! -d t/base; then
2878                                 echo "Failed to create the subdirectories.  Aborting." >&4
2879                                 exit 1
2880                         fi
2881                         # Sanity check 2.
2882                         if test ! -f t/base/lex.t; then
2883                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2884                                 exit 1
2885                         fi
2886                         if test ! -f win32/win32.c; then
2887                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2888                                 exit 1
2889                         fi
2890                         cd UU
2891                         ;;
2892                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2893                         ;;
2894                 esac
2895                 ;;
2896         esac
2897         ;;
2898 esac
2899
2900 : Check for Cross-Compilation
2901 if $test "X$targethost" = "X"; then
2902     targethost=""
2903 fi
2904 if $test "X$targetenv" = "X"; then
2905     targetenv=""
2906 fi
2907 case "$usecrosscompile" in
2908 $define|true|[yY]*)
2909         $echo "Cross-compiling..."
2910         croak=''
2911         case "$cc" in
2912         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2913             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2914             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2915             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2916             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2917             # leave out ld, choosing it is more complex
2918             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2919             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2920             # We are in a weird spot. Just before us, some values
2921             # were 'saved', to be restored after the hints are
2922             # run.  This means that the changes we made to ar,
2923             # nm and ranlib will get reverted.
2924             # To avoid that, we hijack the saving mechanism and
2925             # have it save our new values.
2926             for file in ar nm ranlib; do
2927                 eval xxx=\$$file
2928                 eval $file=$xxx$_exe
2929                 eval _$file=$xxx
2930             done
2931         ;;
2932         esac
2933         case "$targetarch" in
2934         '') echo "Targetarch not defined." >&4; croak=y ;;
2935         *)  echo "Using targetarch $targetarch." >&4 ;;
2936         esac
2937         case "$targethost" in
2938         '') echo "Targethost not defined." >&4; croak=y ;;
2939         *)  echo "Using targethost $targethost." >&4
2940         esac
2941         locincpth=' '
2942         loclibpth=' '
2943         case "$croak" in
2944         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2945         esac
2946     : compile a host miniperl and generate_uudmap, unless we got passed them
2947     if $test "X$hostperl" = X; then
2948       echo "Building host miniperl and generate_uudmap binaries" >&4
2949       before_host=`pwd`
2950       cd ..
2951       cd $src
2952       src=`pwd`
2953       rm -rf $src/host
2954       mkdir $src/host
2955       cd $src/host
2956       $src/Configure -des -Dusedevel -Dmksymlinks
2957       $make miniperl
2958       case "$hostgenerate" in
2959       '') $make generate_uudmap
2960           hostgenerate=$src/host/generate_uudmap
2961           ;;
2962        "$undef") hostgenerate=''
2963           ;;
2964       esac
2965       hostperl=$src/host/miniperl
2966       cd $before_host
2967     fi
2968     hostosname=`$hostperl -le 'print $^O'`
2969     ;;
2970 *)
2971     usecrosscompile="$undef"
2972     ;;
2973 esac
2974
2975 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2976 case "$targethost" in
2977     '') echo "Checking for cross-compile" >&4
2978     case "$usecrosscompile$multiarch" in
2979        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2980          if [ -f Makefile ]; then
2981            echo " "
2982            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2983          else
2984            echo "Configure done."
2985          fi
2986        exit 0
2987        ;;
2988      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2989         run=''
2990         to=:
2991         from=:
2992         ;;
2993     esac
2994     ;;
2995     *) echo "Using targethost $targethost." >&4
2996         case "$src" in
2997         /*) run=$src/Cross/run
2998             targetmkdir=$src/Cross/mkdir
2999             to=$src/Cross/to
3000             from=$src/Cross/from
3001             ;;
3002         *)  pwd=`$test -f ../Configure & cd ..; pwd`
3003             run=$pwd/Cross/run
3004             targetmkdir=$pwd/Cross/mkdir
3005             to=$pwd/Cross/to
3006             from=$pwd/Cross/from
3007             ;;
3008         esac
3009         case "$targetrun" in
3010         '') targetrun=ssh ;;
3011         esac
3012         case "$targetto" in
3013         '') targetto=scp ;;
3014         esac
3015         case "$targetfrom" in
3016         '') targetfrom=scp ;;
3017         esac
3018         run=$run-$targetrun
3019         to=$to-$targetto
3020         from=$from-$targetfrom
3021         case "$targetdir" in
3022         '')  targetdir=/tmp
3023              echo "Guessing targetdir $targetdir." >&4
3024              ;;
3025         esac
3026         case "$targetuser" in
3027         '')  targetuser=root
3028              echo "Guessing targetuser $targetuser." >&4
3029              ;;
3030         esac
3031         case "$targetport" in
3032         '')  targetport=22
3033              echo "Guessing targetport $targetport." >&4
3034              ;;
3035         esac
3036         case "$targetfrom" in
3037         scp)    q=-q ;;
3038         *)      q='' ;;
3039         esac
3040         case "$targetrun" in
3041         ssh|rsh)
3042             cat >$run <<EOF
3043 #!/bin/sh
3044 env=''
3045 case "\$1" in
3046 -cwd)
3047   shift
3048   cwd=\$1
3049   shift
3050   ;;
3051 esac
3052 case "\$1" in
3053 -env)
3054   shift
3055   env=\$1
3056   shift
3057   ;;
3058 esac
3059 case "\$cwd" in
3060 '') cwd=$targetdir ;;
3061 esac
3062 exe=\$1
3063 shift
3064 $to \$exe
3065 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3066 EOF
3067             ;;
3068         adb)
3069             $touch $run
3070             ;;
3071         *)  echo "Unknown targetrun '$targetrun'" >&4
3072             exit 1
3073             ;;
3074         esac
3075         case "$targetmkdir" in
3076         */Cross/mkdir)
3077             cat >$targetmkdir <<EOF
3078 #!/bin/sh
3079 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3080 EOF
3081             $chmod a+rx $targetmkdir
3082             ;;
3083         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3084             exit 1
3085             ;;
3086         esac
3087         case "$targetto" in
3088         scp|rcp)
3089             cat >$to <<EOF
3090 #!/bin/sh
3091 for f in \$@
3092 do
3093   case "\$f" in
3094   /*)
3095     $targetmkdir \`dirname \$f\`
3096     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3097     ;;
3098   *)
3099     $targetmkdir $targetdir/\`dirname \$f\`
3100     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3101     ;;
3102   esac
3103 done
3104 exit 0
3105 EOF
3106             ;;
3107         cp) cat >$to <<EOF
3108 #!/bin/sh
3109 for f in \$@
3110 do
3111   case "\$f" in
3112   /*)
3113     $mkdir -p $targetdir/\`dirname \$f\`
3114     $cp \$f $targetdir/\$f || exit 1
3115     ;;
3116   *)
3117     $targetmkdir $targetdir/\`dirname \$f\`
3118     $cp \$f $targetdir/\$f || exit 1
3119     ;;
3120   esac
3121 done
3122 exit 0
3123 EOF
3124             ;;
3125         *)  echo "Unknown targetto '$targetto'" >&4
3126             exit 1
3127             ;;
3128         esac
3129         case "$targetfrom" in
3130         scp|rcp)
3131           cat >$from <<EOF
3132 #!/bin/sh
3133 for f in \$@
3134 do
3135   $rm -f \$f
3136   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3137 done
3138 exit 0
3139 EOF
3140             ;;
3141         cp) cat >$from <<EOF
3142 #!/bin/sh
3143 for f in \$@
3144 do
3145   $rm -f \$f
3146   cp $targetdir/\$f . || exit 1
3147 done
3148 exit 0
3149 EOF
3150             ;;
3151         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3152             exit 1
3153             ;;
3154         esac
3155         if $test ! -f $run; then
3156             echo "Target 'run' script '$run' not found." >&4
3157         else
3158             $chmod a+rx $run
3159         fi
3160         if $test ! -f $to; then
3161             echo "Target 'to' script '$to' not found." >&4
3162         else
3163             $chmod a+rx $to
3164         fi
3165         if $test ! -f $from; then
3166             echo "Target 'from' script '$from' not found." >&4
3167         else
3168             $chmod a+rx $from
3169         fi
3170         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3171             exit 1
3172         fi
3173         cat >&4 <<EOF
3174 Using '$run' for remote execution,
3175 and '$from' and '$to'
3176 for remote file transfer.
3177 EOF
3178         ;;
3179 *)      run=''
3180         to=:
3181         from=:
3182         usecrosscompile="$undef"
3183         targetarch=''
3184         ;;
3185 esac
3186
3187 : see whether [:lower:] and [:upper:] are supported character classes
3188 echo " "
3189 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3190 ABYZ)
3191         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3192         up='[:upper:]'
3193         low='[:lower:]'
3194         ;;
3195 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3196         # (0xd9 and 0xe2), therefore that is a nice testing point.
3197         if test "X$up" = X -o "X$low" = X; then
3198             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3199             rs) up='[A-Z]'
3200                 low='[a-z]'
3201                 ;;
3202             esac
3203         fi
3204         if test "X$up" = X -o "X$low" = X; then
3205             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3206             rs) up='A-Z'
3207                 low='a-z'
3208                 ;;
3209             esac
3210         fi
3211         if test "X$up" = X -o "X$low" = X; then
3212             case "`echo RS | od -x 2>/dev/null`" in
3213             *D9E2*|*d9e2*)
3214                 echo "Hey, this might be EBCDIC." >&4
3215                 if test "X$up" = X -o "X$low" = X; then
3216                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3217                     rs) up='[A-IJ-RS-Z]'
3218                         low='[a-ij-rs-z]'
3219                         ;;
3220                     esac
3221                 fi
3222                 if test "X$up" = X -o "X$low" = X; then
3223                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3224                     rs) up='A-IJ-RS-Z'
3225                         low='a-ij-rs-z'
3226                         ;;
3227                     esac
3228                 fi
3229                 ;;
3230             esac
3231         fi
3232 esac
3233 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3234 rs)
3235     echo "Using $up and $low to convert case." >&4
3236     ;;
3237 *)
3238     echo "I don't know how to translate letters from upper to lower case." >&4
3239     echo "Your tr is not acting any way I know of." >&4
3240     exit 1
3241     ;;
3242 esac
3243 : set up the translation script tr, must be called with ./tr of course
3244 cat >tr <<EOSC
3245 $startsh
3246 case "\$1\$2" in
3247 '[A-Z][a-z]') exec $tr '$up' '$low';;
3248 '[a-z][A-Z]') exec $tr '$low' '$up';;
3249 esac
3250 exec $tr "\$@"
3251 EOSC
3252 chmod +x tr
3253 $eunicefix tr
3254
3255 : Try to determine whether config.sh was made on this system
3256 case "$config_sh" in
3257 '')
3258 myuname=`$uname -a 2>/dev/null`
3259 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3260 # Downcase everything to avoid ambiguity.
3261 # Remove slashes and single quotes so we can use parts of this in
3262 # directory and file names.
3263 # Remove newlines so myuname is sane to use elsewhere.
3264 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3265 # because the A-Z/a-z are not consecutive.
3266 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3267         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3268 newmyuname="$myuname"
3269 dflt=n
3270 case "$knowitall" in
3271 '')
3272         if test -f ../config.sh; then
3273                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3274                         eval "`grep myuname= ../config.sh`"
3275                 fi
3276                 if test "X$myuname" = "X$newmyuname"; then
3277                         dflt=y
3278                 fi
3279         fi
3280         ;;
3281 *) dflt=y;;
3282 esac
3283
3284 : Get old answers from old config file if Configure was run on the
3285 : same system, otherwise use the hints.
3286 hint=default
3287 cd ..
3288 if test -f config.sh; then
3289         echo " "
3290         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3291         . UU/myread
3292         case "$ans" in
3293         n*|N*) echo "OK, I'll ignore it."
3294                 mv config.sh config.sh.old
3295                 myuname="$newmyuname"
3296                 ;;
3297         *)  echo "Fetching default answers from your old config.sh file..." >&4
3298                 tmp_n="$n"
3299                 tmp_c="$c"
3300                 tmp_sh="$sh"
3301                 . ./config.sh
3302                 cp config.sh UU
3303                 n="$tmp_n"
3304                 c="$tmp_c"
3305                 : Older versions did not always set $sh.  Catch re-use of such
3306                 : an old config.sh.
3307                 case "$sh" in
3308                 '') sh="$tmp_sh" ;;
3309                 esac
3310                 hint=previous
3311                 ;;
3312         esac
3313 fi
3314 . ./UU/checkcc
3315 if test ! -f config.sh; then
3316         $cat <<EOM
3317
3318 First time through, eh?  I have some defaults handy for some systems
3319 that need some extra help getting the Configure answers right:
3320
3321 EOM
3322         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3323         dflt=''
3324         : Half the following guesses are probably wrong... If you have better
3325         : tests or hints, please send them to perlbug@perl.org
3326         : The metaconfig authors would also appreciate a copy...
3327         $test -f /irix && osname=irix
3328         $test -f /xenix && osname=sco_xenix
3329         $test -f /dynix && osname=dynix
3330         $test -f /dnix && osname=dnix
3331         $test -f /lynx.os && osname=lynxos
3332         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3333         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3334         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3335         $test -f /bin/mips && /bin/mips && osname=mips
3336         $test -d /usr/apollo/bin && osname=apollo
3337         $test -f /etc/saf/_sactab && osname=svr4
3338         $test -d /usr/include/minix && osname=minix
3339         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3340         if $test -d /MachTen -o -d /MachTen_Folder; then
3341                 osname=machten
3342                 if $test -x /sbin/version; then
3343                         osvers=`/sbin/version | $awk '{print $2}' |
3344                         $sed -e 's/[A-Za-z]$//'`
3345                 elif $test -x /usr/etc/version; then
3346                         osvers=`/usr/etc/version | $awk '{print $2}' |
3347                         $sed -e 's/[A-Za-z]$//'`
3348                 else
3349                         osvers="$2.$3"
3350                 fi
3351         fi
3352
3353         $test -f /sys/posix.dll &&
3354                 $test -f /usr/bin/what &&
3355                 set X `/usr/bin/what /sys/posix.dll` &&
3356                 $test "$3" = UWIN &&
3357                 osname=uwin &&
3358                 osvers="$5"
3359
3360         if $test -f $uname; then
3361                 set X $myuname
3362                 shift
3363
3364                 case "$5" in
3365                 fps*) osname=fps ;;
3366                 mips*)
3367                         case "$4" in
3368                         umips) osname=umips ;;
3369                         *) osname=mips ;;
3370                         esac;;
3371                 [23]100) osname=mips ;;
3372                 i386*)
3373                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3374                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3375                                 osname='sco'
3376                                 osvers=$tmp
3377                         elif $test -f /etc/kconfig; then
3378                                 osname=isc
3379                                 if test "$lns" = "$ln -s"; then
3380                                         osvers=4
3381                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3382                                         osvers=3
3383                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3384                                         osvers=2
3385                                 fi
3386                         fi
3387                         tmp=''
3388                         ;;
3389                 pc*)
3390                         if test -n "$DJGPP"; then
3391                                 osname=dos
3392                                 osvers=djgpp
3393                         fi
3394                         ;;
3395                 esac
3396
3397                 case "$1" in
3398                 aix) osname=aix
3399                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3400                         case "$tmp" in
3401                         # oslevel can fail with:
3402                         # oslevel: Unable to acquire lock.
3403                         *not\ found) osvers="$4"."$3" ;;
3404                         '<3240'|'<>3240') osvers=3.2.0 ;;
3405                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3406                         '=3250'|'>3250') osvers=3.2.5 ;;
3407                         *) osvers=$tmp;;
3408                         esac
3409                         ;;
3410                 bitrig) osname=bitrig
3411                         osvers="$3"
3412                         ;;
3413                 bsd386) osname=bsd386
3414                         osvers=`$uname -r`
3415                         ;;
3416                 cygwin*) osname=cygwin
3417                         osvers="$3"
3418                         ;;
3419                 *dc.osx) osname=dcosx
3420                         osvers="$3"
3421                         ;;
3422                 dnix) osname=dnix
3423                         osvers="$3"
3424                         ;;
3425                 domainos) osname=apollo
3426                         osvers="$3"
3427                         ;;
3428                 dgux)   osname=dgux
3429                         osvers="$3"
3430                         ;;
3431                 dragonfly) osname=dragonfly
3432                         osvers="$3"
3433                         ;;
3434                 dynixptx*) osname=dynixptx
3435                         osvers=`echo "$4"|sed 's/^v//'`
3436                         ;;
3437                 freebsd) osname=freebsd
3438                         osvers="$3" ;;
3439                 genix)  osname=genix ;;
3440                 gnu)    osname=gnu
3441                         osvers="$3" ;;
3442                 hp*)    osname=hpux
3443                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3444                         ;;
3445                 irix*)  osname=irix
3446                         case "$3" in
3447                         4*) osvers=4 ;;
3448                         5*) osvers=5 ;;
3449                         *)      osvers="$3" ;;
3450                         esac
3451                         ;;
3452                 linux)  osname=linux
3453                         case "$3" in
3454                         *)      osvers="$3" ;;
3455                         esac
3456                         $test -f /system/lib/libandroid.so && osname=linux-android
3457                         ;;
3458                 MiNT)   osname=mint
3459                         ;;
3460                 netbsd*) osname=netbsd
3461                         osvers="$3"
3462                         ;;
3463                 news-os) osvers="$3"
3464                         case "$3" in
3465                         4*) osname=newsos4 ;;
3466                         *) osname=newsos ;;
3467                         esac
3468                         ;;
3469                 nonstop-ux) osname=nonstopux ;;
3470                 openbsd) osname=openbsd
3471                         osvers="$3"
3472                         ;;
3473                 os2)    osname=os2
3474                         osvers="$4"
3475                         ;;
3476                 POSIX-BC | posix-bc ) osname=posix-bc
3477                         osvers="$3"
3478                         ;;
3479                 powerux | power_ux | powermax_os | powermaxos | \
3480                 powerunix | power_unix) osname=powerux
3481                         osvers="$3"
3482                         ;;
3483                 qnx) osname=qnx
3484                         osvers="$4"
3485                         ;;
3486                 solaris) osname=solaris
3487                         case "$3" in
3488                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3489                         *)      osvers="$3" ;;
3490                         esac
3491                         ;;
3492                 sunos) osname=sunos
3493                         case "$3" in
3494                         5*) osname=solaris
3495                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3496                         *)      osvers="$3" ;;
3497                         esac
3498                         ;;
3499                 titanos) osname=titanos
3500                         case "$3" in
3501                         1*) osvers=1 ;;
3502                         2*) osvers=2 ;;
3503                         3*) osvers=3 ;;
3504                         4*) osvers=4 ;;
3505                         *)      osvers="$3" ;;
3506                         esac
3507                         ;;
3508                 ultrix) osname=ultrix
3509                         osvers="$3"
3510                         ;;
3511                 osf1|mls+)      case "$5" in
3512                                 alpha)
3513                                         osname=dec_osf
3514                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3515                                         case "$osvers" in
3516                                         [1-9].[0-9]*) ;;
3517                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3518                                         esac
3519                                         ;;
3520                         hp*)    osname=hp_osf1  ;;
3521                         mips)   osname=mips_osf1 ;;
3522                         esac
3523                         ;;
3524                 # UnixWare 7.1.2 is known as Open UNIX 8
3525                 openunix|unixware) osname=svr5
3526                         osvers="$4"
3527                         ;;
3528                 uts)    osname=uts
3529                         osvers="$3"
3530                         ;;
3531                 vos) osvers="$3"
3532                         ;;
3533                 $2) case "$osname" in
3534                         *isc*) ;;
3535                         *freebsd*) ;;
3536                         svr*)
3537                                 : svr4.x or possibly later
3538                                 case "svr$3" in
3539                                 ${osname}*)
3540                                         osname=svr$3
3541                                         osvers=$4
3542                                         ;;
3543                                 esac
3544                                 case "$osname" in
3545                                 svr4.0)
3546                                         : Check for ESIX
3547                                         if test -f /stand/boot ; then
3548                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3549                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3550                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3551                                                         if test -n "$isesix"; then
3552                                                                 osname=esix4
3553                                                         fi
3554                                                 fi
3555                                         fi
3556                                         ;;
3557                                 esac
3558                                 ;;
3559                         *)      if test -f /etc/systemid; then
3560                                         osname=sco
3561                                         set `echo $3 | $sed 's/\./ /g'` $4
3562                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3563                                                 osvers=$1.$2.$3
3564                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3565                                                 osvers=$1.$2
3566                                         elif $test -f $src/hints/sco_$1.sh; then
3567                                                 osvers=$1
3568                                         fi
3569                                 else
3570                                         case "$osname" in
3571                                         '') : Still unknown.  Probably a generic Sys V.
3572                                                 osname="sysv"
3573                                                 osvers="$3"
3574                                                 ;;
3575                                         esac
3576                                 fi
3577                                 ;;
3578                         esac
3579                         ;;
3580                 *)      case "$osname" in
3581                         '') : Still unknown.  Probably a generic BSD.
3582                                 osname="$1"
3583                                 osvers="$3"
3584                                 ;;
3585                         esac
3586                         ;;
3587                 esac
3588         else
3589                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3590                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3591                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3592                                 osname=news_os
3593                         fi
3594                         $rm -f UU/kernel.what
3595                 elif test -d c:/. -o -n "$is_os2" ; then
3596                         set X $myuname
3597                         osname=os2
3598                         osvers="$5"
3599                 fi
3600         fi
3601
3602         case "$targetarch" in
3603         '') ;;
3604         *)  hostarch=$osname
3605             case "$targetarch" in
3606                 nto*|*-nto-*)
3607                     # Will load qnx.sh, which should change osname to nto
3608                     osname=qnx
3609                     osvers=''
3610                     ;;
3611                 *linux-android*)
3612                     # Catch arm-linux-androideabi, mipsel-linux-android,
3613                     # and i686-linux-android
3614                     osname=linux-android
3615                     osvers=''
3616                     ;;
3617                 *linux*)
3618                     # Something like arm-linux-gnueabihf is really just
3619                     # plain linux.
3620                     osname=linux
3621                     osvers=''
3622                     ;;
3623                 *solaris*|*sunos*)
3624                     osname=solaris
3625                     # XXX perhaps we should just assume
3626                     # osvers to be 2, or maybe take the value
3627                     # from targetarch. Using $run before the
3628                     # hints are run is somewhat icky.
3629                     set X `$run $uname -a 2>/dev/null`
3630                     shift
3631                     case "$3" in
3632                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3633                         *)  osvers="$3" ;;
3634                     esac
3635                     ;;
3636                 *)
3637                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3638                     osvers=''
3639                 ;;
3640             esac
3641             ;;
3642         esac
3643
3644         : Now look for a hint file osname_osvers, unless one has been
3645         : specified already.
3646         case "$hintfile" in
3647         ''|' ')
3648                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3649                 : Also try without trailing minor version numbers.
3650                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3651                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3652                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3653                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3654                 case "$file" in
3655                 '') dflt=none ;;
3656                 *)  case "$osvers" in
3657                         '') dflt=$file
3658                                 ;;
3659                         *)  if $test -f $src/hints/$file.sh ; then
3660                                         dflt=$file
3661                                 elif $test -f $src/hints/$xfile.sh ; then
3662                                         dflt=$xfile
3663                                 elif $test -f $src/hints/$xxfile.sh ; then
3664                                         dflt=$xxfile
3665                                 elif $test -f $src/hints/$xxxfile.sh ; then
3666                                         dflt=$xxxfile
3667                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3668                                         dflt=$xxxxfile
3669                                 elif $test -f "$src/hints/${osname}.sh" ; then
3670                                         dflt="${osname}"
3671                                 else
3672                                         dflt=none
3673                                 fi
3674                                 ;;
3675                         esac
3676                         ;;
3677                 esac
3678                 if $test -f Policy.sh ; then
3679                         case "$dflt" in
3680                         *Policy*) ;;
3681                         none) dflt="Policy" ;;
3682                         *) dflt="Policy $dflt" ;;
3683                         esac
3684                 fi
3685                 ;;
3686         *)
3687                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3688                 ;;
3689         esac
3690
3691         if $test -f Policy.sh ; then
3692                 $cat <<EOM
3693
3694 There's also a Policy hint file available, which should make the
3695 site-specific (policy) questions easier to answer.
3696 EOM
3697
3698         fi
3699
3700         $cat <<EOM
3701
3702 You may give one or more space-separated answers, or "none" if appropriate.
3703 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3704 previous run of Configure, you may specify it as well as or instead of
3705 OS-specific hints.  If hints are provided for your OS, you should use them:
3706 although Perl can probably be built without hints on many platforms, using
3707 hints often improve performance and may enable features that Configure can't
3708 set up on its own. If there are no hints that match your OS, specify "none";
3709 DO NOT give a wrong version or a wrong OS.
3710
3711 EOM
3712
3713         rp="Which of these apply, if any?"
3714         . UU/myread
3715         tans=$ans
3716         for file in $tans; do
3717                 if $test X$file = XPolicy -a -f Policy.sh; then
3718                         . Policy.sh
3719                         $cat Policy.sh >> UU/config.sh
3720                 elif $test -f $src/hints/$file.sh; then
3721                         . $src/hints/$file.sh
3722                         $cat $src/hints/$file.sh >> UU/config.sh
3723                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3724                         : nothing
3725                 else
3726                         : Give one chance to correct a possible typo.
3727                         echo "$file.sh does not exist"
3728                         dflt=$file
3729                         rp="hint to use instead?"
3730                         . UU/myread
3731                         for file in $ans; do
3732                                 if $test -f "$src/hints/$file.sh"; then
3733                                         . $src/hints/$file.sh
3734                                         $cat $src/hints/$file.sh >> UU/config.sh
3735                                 elif $test X$ans = X -o X$ans = Xnone ; then
3736                                         : nothing
3737                                 else
3738                                         echo "$file.sh does not exist -- ignored."
3739                                 fi
3740                         done
3741                 fi
3742         done
3743
3744         hint=recommended
3745         : Remember our hint file for later.
3746         if $test -f "$src/hints/$file.sh" ; then
3747                 hintfile="$file"
3748         else
3749                 hintfile=''
3750         fi
3751 fi
3752 cd UU
3753 ;;
3754 *)
3755         echo " "
3756         echo "Fetching default answers from $config_sh..." >&4
3757         tmp_n="$n"
3758         tmp_c="$c"
3759         cd ..
3760         cp $config_sh config.sh 2>/dev/null
3761         chmod +w config.sh
3762         . ./config.sh
3763         cd UU
3764         cp ../config.sh .
3765         n="$tmp_n"
3766         c="$tmp_c"
3767         hint=previous
3768         ;;
3769 esac
3770 test "$override" && . ./optdef.sh
3771
3772 : Restore computed paths
3773 for file in $loclist $trylist; do
3774         eval $file="\$_$file"
3775 done
3776
3777 cat << EOM
3778
3779 Configure uses the operating system name and version to set some defaults.
3780 The default value is probably right if the name rings a bell. Otherwise,
3781 since spelling matters for me, either accept the default or answer "none"
3782 to leave it blank.
3783
3784 EOM
3785 case "$osname" in
3786         ''|' ')
3787                 case "$hintfile" in
3788                 ''|' '|none) dflt=none ;;
3789                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3790                 esac
3791                 ;;
3792         *) dflt="$osname" ;;
3793 esac
3794 rp="Operating system name?"
3795 . ./myread
3796 case "$ans" in
3797 none)  osname='' ;;
3798 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3799 esac
3800 echo " "
3801 case "$osvers" in
3802         ''|' ')
3803                 case "$hintfile" in
3804                 ''|' '|none) dflt=none ;;
3805                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3806                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3807                         case "$dflt" in
3808                         ''|' ') dflt=none ;;
3809                         esac
3810                         ;;
3811                 esac
3812                 ;;
3813         *) dflt="$osvers" ;;
3814 esac
3815 rp="Operating system version?"
3816 . ./myread
3817 case "$ans" in
3818 none)  osvers='' ;;
3819 *) osvers="$ans" ;;
3820 esac
3821
3822
3823 . ./posthint.sh
3824
3825 : who configured the system
3826 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3827 case "$cf_by" in
3828 "")
3829         cf_by=`(logname) 2>/dev/null`
3830         case "$cf_by" in
3831         "")
3832                 cf_by=`(whoami) 2>/dev/null`
3833                 case "$cf_by" in
3834                 "") cf_by=unknown ;;
3835                 esac ;;
3836         esac ;;
3837 esac
3838
3839 : decide how portable to be.  Allow command line overrides.
3840 case "$d_portable" in
3841 "$undef") ;;
3842 *)      d_portable="$define" ;;
3843 esac
3844
3845 : set up shell script to do ~ expansion
3846 cat >filexp <<EOSS
3847 $startsh
3848 : expand filename
3849 case "\$1" in
3850  \~/*|\~)
3851         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3852         ;;
3853  \~*)
3854         if $test -f /bin/csh; then
3855                 /bin/csh -f -c "glob \$1"
3856                 failed=\$?
3857                 echo ""
3858                 exit \$failed
3859         else
3860                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3861                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3862                 if $test ! -d "\$dir"; then
3863                         me=\`basename \$0\`
3864                         echo "\$me: can't locate home directory for: \$name" >&2
3865                         exit 1
3866                 fi
3867                 case "\$1" in
3868                 */*)
3869                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3870                         ;;
3871                 *)
3872                         echo \$dir
3873                         ;;
3874                 esac
3875         fi
3876         ;;
3877 *)
3878         echo \$1
3879         ;;
3880 esac
3881 EOSS
3882 chmod +x filexp
3883 $eunicefix filexp
3884
3885 : now set up to get a file name
3886 cat <<EOS >getfile
3887 $startsh
3888 EOS
3889 cat <<'EOSC' >>getfile
3890 tilde=''
3891 fullpath=''
3892 already=''
3893 skip=''
3894 none_ok=''
3895 exp_file=''
3896 nopath_ok=''
3897 orig_rp="$rp"
3898 orig_dflt="$dflt"
3899 case "$gfpth" in
3900 '') gfpth='.' ;;
3901 esac
3902
3903 case "$fn" in
3904 *\(*)
3905         : getfile will accept an answer from the comma-separated list
3906         : enclosed in parentheses even if it does not meet other criteria.
3907         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3908         fn=`echo $fn | sed 's/(.*)//'`
3909         ;;
3910 esac
3911
3912 case "$fn" in
3913 *:*)
3914         loc_file=`expr $fn : '.*:\(.*\)'`
3915         fn=`expr $fn : '\(.*\):.*'`
3916         ;;
3917 esac
3918
3919 case "$fn" in
3920 *~*) tilde=true;;
3921 esac
3922 case "$fn" in
3923 */*) fullpath=true;;
3924 esac
3925 case "$fn" in
3926 *+*) skip=true;;
3927 esac
3928 case "$fn" in
3929 *n*) none_ok=true;;
3930 esac
3931 case "$fn" in
3932 *e*) exp_file=true;;
3933 esac
3934 case "$fn" in
3935 *p*) nopath_ok=true;;
3936 esac
3937
3938 case "$fn" in
3939 *f*) type='File';;
3940 *d*) type='Directory';;
3941 *l*) type='Locate';;
3942 esac
3943
3944 what="$type"
3945 case "$what" in
3946 Locate) what='File';;
3947 esac
3948
3949 case "$exp_file" in
3950 '')
3951         case "$d_portable" in
3952         "$define") ;;
3953         *) exp_file=true;;
3954         esac
3955         ;;
3956 esac
3957
3958 cd ..
3959 while test "$type"; do
3960         redo=''
3961         rp="$orig_rp"
3962         dflt="$orig_dflt"
3963         case "$tilde" in
3964         true) rp="$rp (~name ok)";;
3965         esac
3966         . UU/myread
3967         if test -f UU/getfile.ok && \
3968                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3969         then
3970                 value="$ans"
3971                 ansexp="$ans"
3972                 break
3973         fi
3974         case "$ans" in
3975         none)
3976                 value=''
3977                 ansexp=''
3978                 case "$none_ok" in
3979                 true) type='';;
3980                 esac
3981                 ;;
3982         *)
3983                 case "$tilde" in
3984                 '') value="$ans"
3985                         ansexp="$ans";;
3986                 *)
3987                         value=`UU/filexp $ans`
3988                         case $? in
3989                         0)
3990                                 if test "$ans" != "$value"; then
3991                                         echo "(That expands to $value on this system.)"
3992                                 fi
3993                                 ;;
3994                         *) value="$ans";;
3995                         esac
3996                         ansexp="$value"
3997                         case "$exp_file" in
3998                         '') value="$ans";;
3999                         esac
4000                         ;;
4001                 esac
4002                 case "$fullpath" in
4003                 true)
4004                         case "$ansexp" in
4005                         /*) value="$ansexp" ;;
4006                         [a-zA-Z]:/*) value="$ansexp" ;;
4007                         *)
4008                                 redo=true
4009                                 case "$already" in
4010                                 true)
4011                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4012                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4013                                         ;;
4014                                 *)
4015                                 echo "Please give a full path name, starting with slash." >&4
4016                                         case "$tilde" in
4017                                         true)
4018                                 echo "Note that using ~name is ok provided it expands well." >&4
4019                                                 already=true
4020                                                 ;;
4021                                         esac
4022                                 esac
4023                                 ;;
4024                         esac
4025                         ;;
4026                 esac
4027                 case "$redo" in
4028                 '')
4029                         case "$type" in
4030                         File)
4031                                 for fp in $gfpth; do
4032                                         if test "X$fp" = X.; then
4033                                             pf="$ansexp"
4034                                         else    
4035                                             pf="$fp/$ansexp"
4036                                         fi
4037                                         if test -f "$pf"; then
4038                                                 type=''
4039                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4040                                         then
4041                                                 echo "($value is not a plain file, but that's ok.)"
4042                                                 type=''
4043                                         fi
4044                                         if test X"$type" = X; then
4045                                             value="$pf"
4046                                             break
4047                                         fi
4048                                 done
4049                                 ;;
4050                         Directory)
4051                                 for fp in $gfpth; do
4052                                         if test "X$fp" = X.; then
4053                                             dir="$ans"
4054                                             direxp="$ansexp"
4055                                         else    
4056                                             dir="$fp/$ansexp"
4057                                             direxp="$fp/$ansexp"
4058                                         fi
4059                                         if test -d "$direxp"; then
4060                                                 type=''
4061                                                 value="$dir"
4062                                                 break
4063                                         fi
4064                                 done
4065                                 ;;
4066                         Locate)
4067                                 if test -d "$ansexp"; then
4068                                         echo "(Looking for $loc_file in directory $value.)"
4069                                         value="$value/$loc_file"
4070                                         ansexp="$ansexp/$loc_file"
4071                                 fi
4072                                 if test -f "$ansexp"; then
4073                                         type=''
4074                                 fi
4075                                 case "$nopath_ok" in
4076                                 true)   case "$value" in
4077                                         */*) ;;
4078                                         *)      echo "Assuming $value will be in people's path."
4079                                                 type=''
4080                                                 ;;
4081                                         esac
4082                                         ;;
4083                                 esac
4084                                 ;;
4085                         esac
4086
4087                         case "$skip" in
4088                         true) type='';
4089                         esac
4090
4091                         case "$type" in
4092                         '') ;;
4093                         *)
4094                                 if test "$fastread" = yes; then
4095                                         dflt=y
4096                                 else
4097                                         dflt=n
4098                                 fi
4099                                 rp="$what $value doesn't exist.  Use that name anyway?"
4100                                 . UU/myread
4101                                 dflt=''
4102                                 case "$ans" in
4103                                 y*) type='';;
4104                                 *) echo " ";;
4105                                 esac
4106                                 ;;
4107                         esac
4108                         ;;
4109                 esac
4110                 ;;
4111         esac
4112 done
4113 cd UU
4114 ans="$value"
4115 rp="$orig_rp"
4116 dflt="$orig_dflt"
4117 rm -f getfile.ok
4118 test "X$gfpthkeep" != Xy && gfpth=""
4119 EOSC
4120
4121 : determine root of directory hierarchy where package will be installed.
4122 case "$prefix" in
4123 '')
4124         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4125         ;;
4126 *?/)
4127         dflt=`echo "$prefix" | sed 's/.$//'`
4128         ;;
4129 *)
4130         dflt="$prefix"
4131         ;;
4132 esac
4133 $cat <<EOM
4134
4135 By default, $package will be installed in $dflt/bin, manual pages
4136 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4137 installation directories. Typically this is something like /usr/local.
4138 If you wish to have binaries under /usr/bin but other parts of the
4139 installation under /usr/local, that's ok: you will be prompted
4140 separately for each of the installation directories, the prefix being
4141 only used to set the defaults.
4142
4143 EOM
4144 fn=d~
4145 rp='Installation prefix to use?'
4146 . ./getfile
4147 oldprefix=''
4148 case "$prefix" in
4149 '') ;;
4150 *)
4151         case "$ans" in
4152         "$prefix") ;;
4153         *) oldprefix="$prefix";;
4154         esac
4155         ;;
4156 esac
4157 prefix="$ans"
4158 prefixexp="$ansexp"
4159
4160 : allow them to override the AFS root
4161 case "$afsroot" in
4162 '')     afsroot=/afs ;;
4163 *)      afsroot=$afsroot ;;
4164 esac
4165
4166 : is AFS running?
4167 echo " "
4168 case "$afs" in
4169 $define|true)   afs=true ;;
4170 $undef|false)   afs=false ;;
4171 *)      if $test -d $afsroot; then
4172                 afs=true
4173         else
4174                 afs=false
4175         fi
4176         ;;
4177 esac
4178 if $afs; then
4179         echo "AFS may be running... I'll be extra cautious then..." >&4
4180 else
4181         echo "AFS does not seem to be running..." >&4
4182 fi
4183
4184 : determine installation prefix for where package is to be installed.
4185 if $afs; then
4186 $cat <<EOM
4187
4188 Since you are running AFS, I need to distinguish the directory in which
4189 files will reside from the directory in which they are installed (and from
4190 which they are presumably copied to the former directory by occult means).
4191
4192 EOM
4193         case "$installprefix" in
4194         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4195         *) dflt="$installprefix";;
4196         esac
4197 else
4198 $cat <<EOM
4199
4200 In some special cases, particularly when building $package for distribution,
4201 it is convenient to distinguish the directory in which files should be
4202 installed from the directory ($prefix) in which they will
4203 eventually reside.  For most users, these two directories are the same.
4204
4205 EOM
4206         case "$installprefix" in
4207         '') dflt=$prefix ;;
4208         *) dflt=$installprefix;;
4209         esac
4210 fi
4211 fn=d~
4212 rp='What installation prefix should I use for installing files?'
4213 . ./getfile
4214 installprefix="$ans"
4215 installprefixexp="$ansexp"
4216
4217 : Perform the prefixexp/installprefixexp correction if necessary
4218 cat <<EOS >installprefix
4219 $startsh
4220 EOS
4221 cat <<'EOSC' >>installprefix
4222 : Change installation prefix, if necessary.
4223 if $test X"$prefix" != X"$installprefix"; then
4224     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4225 else
4226     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4227 fi
4228 EOSC
4229 chmod +x installprefix
4230 $eunicefix installprefix
4231
4232 : Set variables such as privlib and privlibexp from the output of ./getfile
4233 : performing the prefixexp/installprefixexp correction if necessary.
4234 cat <<EOS >setprefixvar
4235 $startsh
4236 EOS
4237 cat <<'EOSC' >>setprefixvar
4238 eval "${prefixvar}=\"\$ans\""
4239 eval "${prefixvar}exp=\"\$ansexp\""
4240 . ./installprefix
4241 EOSC
4242 chmod +x setprefixvar
4243 $eunicefix setprefixvar
4244
4245 : set up the script used to warn in case of inconsistency
4246 cat <<EOS >whoa
4247 $startsh
4248 EOS
4249 cat <<'EOSC' >>whoa
4250 dflt=y
4251 case "$hint" in
4252     recommended)
4253         case "$hintfile" in
4254         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4255                 ;;
4256         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4257                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4258                 ;;
4259         esac
4260         ;;
4261     *)  echo " "
4262         echo "*** WHOA THERE!!! ***" >&4
4263         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4264         ;;
4265 esac
4266 rp="    Keep the $hint value?"
4267 . ./myread
4268 case "$ans" in
4269 y) td=$was; tu=$was;;
4270 esac
4271 EOSC
4272
4273 : function used to set '$1' to '$val'
4274 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4275 case "$val$was" in
4276 $define$undef) . ./whoa; eval "$var=\$td";;
4277 $undef$define) . ./whoa; eval "$var=\$tu";;
4278 *) eval "$var=$val";;
4279 esac'
4280
4281 : get the patchlevel
4282 echo " "
4283 echo "Getting the current patchlevel..." >&4
4284 if $test -r $rsrc/patchlevel.h;then
4285         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4286         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4287         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4288         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4289         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4290         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4291         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4292 else
4293         revision=0
4294         patchlevel=0
4295         subversion=0
4296         api_revision=0
4297         api_version=0
4298         api_subversion=0
4299         perl_patchlevel=0
4300         $echo "(You do not have patchlevel.h.  Eek.)"
4301 fi
4302 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4303 version_patchlevel_string="version $patchlevel subversion $subversion"
4304 case "$perl_patchlevel" in
4305 0|'') ;;
4306 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4307     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4308     ;;
4309 esac
4310
4311 $echo "(You have $package $version_patchlevel_string.)"
4312
4313 case "$osname" in
4314 dos|vms)
4315         : XXX Should be a Configure test for double-dots in filenames.
4316         version=`echo $revision $patchlevel $subversion | \
4317                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4318         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4319                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4320         ;;
4321 *)
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 esac
4328 : Special case the 5.005_xx maintenance series, which used 5.005
4329 : without any subversion label as a subdirectory in $sitelib
4330 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4331         api_versionstring='5.005'
4332 fi
4333
4334 : Do we want threads support and if so, what type
4335 case "$usethreads" in
4336 $define|true|[yY]*)     dflt='y';;
4337 *)     # Catch case where user specified ithreads or 5005threads but
4338        # forgot -Dusethreads (A.D. 4/2002)
4339        case "$useithreads$use5005threads" in
4340        *$define*)       dflt='y';;
4341        *)               dflt='n';;
4342        esac
4343        ;;
4344 esac
4345 cat <<EOM
4346
4347 Perl can be built to offer a form of threading support on some systems
4348 To do so, Configure can be run with -Dusethreads.
4349
4350 Note that Perl built with threading support runs slightly slower
4351 and uses slightly more memory than plain Perl.
4352
4353 If this doesn't make any sense to you, just accept the default '$dflt'.
4354 EOM
4355 rp='Build a threading Perl?'
4356 . ./myread
4357 case "$ans" in
4358 y|Y)    val="$define" ;;
4359 *)      val="$undef" ;;
4360 esac
4361 set usethreads
4362 eval $setvar
4363
4364 if $test $patchlevel -lt 9; then
4365     case "$usethreads" in
4366     $define)
4367         : Default to ithreads unless overridden on command line or with
4368         : old config.sh
4369         dflt='y'
4370         case "$use5005threads" in
4371                 $define|true|[yY]*)
4372                         echo "5.005 threads are no longer supported"
4373                         exit 1
4374                 ;;
4375         esac
4376         case "$useithreads" in
4377                 $undef|false|[nN]*) dflt='n';;
4378         esac
4379         rp='Use the newer interpreter-based ithreads?'
4380         . ./myread
4381         case "$ans" in
4382         y|Y)    val="$define" ;;
4383         *)      val="$undef" ;;
4384         esac
4385         set useithreads
4386         eval $setvar
4387         : Now set use5005threads to the opposite value.
4388         case "$useithreads" in
4389         $define) val="$undef" ;;
4390         *) val="$define" ;;
4391         esac
4392         set use5005threads
4393         eval $setvar
4394         ;;
4395     *)
4396         useithreads="$undef"
4397         use5005threads="$undef"
4398         ;;
4399     esac
4400
4401     case "$useithreads$use5005threads" in
4402     "$define$define")
4403         $cat >&4 <<EOM
4404
4405 You cannot have both the ithreads and the 5.005 threads enabled
4406 at the same time.  Disabling the 5.005 threads since they are
4407 much less stable than the ithreads.
4408
4409 EOM
4410         use5005threads="$undef"
4411         ;;
4412     esac
4413
4414 else
4415 : perl-5.9.x and later
4416
4417     if test X"$usethreads" = "X$define"; then
4418         case "$use5005threads" in
4419             $define|true|[yY]*)
4420                 $cat >&4 <<EOM
4421
4422 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4423
4424 EOM
4425             ;;
4426         esac
4427     fi
4428
4429     use5005threads="$undef"
4430     useithreads="$usethreads"
4431 fi
4432
4433 case "$d_oldpthreads" in
4434 '')     : Configure tests would be welcome here.  For now, assume undef.
4435         val="$undef" ;;
4436 *)      val="$d_oldpthreads" ;;
4437 esac
4438 set d_oldpthreads
4439 eval $setvar
4440
4441
4442 : Look for a hint-file generated 'call-back-unit'.  If the
4443 : user has specified that a threading perl is to be built,
4444 : we may need to set or change some other defaults.
4445 if $test -f usethreads.cbu; then
4446     echo "Your platform has some specific hints regarding threaded builds, using them..."
4447     . ./usethreads.cbu
4448 else
4449     case "$usethreads" in
4450         "$define"|true|[yY]*)
4451                 $cat <<EOM
4452 (Your platform does not have any specific hints for threaded builds.
4453  Assuming POSIX threads, then.)
4454 EOM
4455         ;;
4456     esac
4457 fi
4458
4459 : Check if multiplicity is required
4460 cat <<EOM
4461
4462 Perl can be built so that multiple Perl interpreters can coexist
4463 within the same Perl executable.
4464 EOM
4465
4466 case "$useithreads" in
4467 $define)
4468         cat <<EOM
4469 This multiple interpreter support is required for interpreter-based threads.
4470 EOM
4471         val="$define"
4472         ;;
4473 *)      case "$usemultiplicity" in
4474         $define|true|[yY]*)     dflt='y';;
4475         *) dflt='n';;
4476         esac
4477         echo " "
4478         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4479         rp='Build Perl for multiplicity?'
4480         . ./myread
4481         case "$ans" in
4482         y|Y)    val="$define" ;;
4483         *)      val="$undef" ;;
4484         esac
4485         ;;
4486 esac
4487 set usemultiplicity
4488 eval $setvar
4489
4490 : Check if usequadmath is requested
4491 case "$usequadmath" in
4492 "$define"|true|[yY]*)
4493         usequadmath="$define"
4494         ;;
4495 *)      usequadmath="$undef" ;;
4496 esac
4497
4498 : Check if morebits is requested
4499 case "$usemorebits" in
4500 "$define"|true|[yY]*)
4501         use64bitint="$define"
4502         uselongdouble="$define"
4503         usemorebits="$define"
4504         ;;
4505 *)      usemorebits="$undef"
4506         ;;
4507 esac
4508
4509 : Determine the C compiler to be used
4510 echo " "
4511 case "$cc" in
4512 '') dflt=cc;;
4513 *) dflt="$cc";;
4514 esac
4515 rp="Use which C compiler?"
4516 . ./myread
4517 cc="$ans"
4518
4519 : See whether they have no cc but they do have gcc
4520 . ./trygcc
4521 if $test -f cc.cbu; then
4522     . ./cc.cbu
4523 fi
4524 . ./checkcc
4525
4526 : make some quick guesses about what we are up against
4527 echo " "
4528 $echo $n "Hmm...  $c"
4529 echo exit 1 >bsd
4530 echo exit 1 >usg
4531 echo exit 1 >v7
4532 echo exit 1 >osf1
4533 echo exit 1 >eunice
4534 echo exit 1 >xenix
4535 echo exit 1 >venix
4536 echo exit 1 >os2
4537 d_bsd="$undef"
4538 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4539 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4540 then
4541         echo "Looks kind of like an OSF/1 system, but we'll see..."
4542         echo exit 0 >osf1
4543 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4544         xxx=`./loc addbib blurfl $pth`
4545         if $test -f $xxx; then
4546         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4547                 echo exit 0 >bsd
4548                 echo exit 0 >usg
4549         else
4550                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4551                         echo "Looks kind of like an extended USG system, but we'll see..."
4552                 else
4553                         echo "Looks kind of like a USG system, but we'll see..."
4554                 fi
4555                 echo exit 0 >usg
4556         fi
4557 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4558         echo "Looks kind of like a BSD system, but we'll see..."
4559         d_bsd="$define"
4560         echo exit 0 >bsd
4561 else
4562         echo "Looks kind of like a Version 7 system, but we'll see..."
4563         echo exit 0 >v7
4564 fi
4565 case "$eunicefix" in
4566 *unixtovms*)
4567         $cat <<'EOI'
4568 There is, however, a strange, musty smell in the air that reminds me of
4569 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4570 EOI
4571         echo exit 0 >eunice
4572         d_eunice="$define"
4573 : it so happens the Eunice I know will not run shell scripts in Unix format
4574         ;;
4575 *)
4576         echo " "
4577         echo "Congratulations.  You aren't running Eunice."
4578         d_eunice="$undef"
4579         ;;
4580 esac
4581 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4582 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4583 : semicolon as a patch separator
4584 case "$p_" in
4585 :) ;;
4586 *)
4587         $cat <<'EOI'
4588 I have the feeling something is not exactly right, however...don't tell me...
4589 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4590 (Or you may be running DOS with DJGPP.)
4591 EOI
4592         echo exit 0 >os2
4593         ;;
4594 esac
4595 if test -f /xenix; then
4596         echo "Actually, this looks more like a XENIX system..."
4597         echo exit 0 >xenix
4598         d_xenix="$define"
4599 else
4600         echo " "
4601         echo "It's not Xenix..."
4602         d_xenix="$undef"
4603 fi
4604 chmod +x xenix
4605 $eunicefix xenix
4606 if test -f /venix; then
4607         echo "Actually, this looks more like a VENIX system..."
4608         echo exit 0 >venix
4609 else
4610         echo " "
4611         if ./xenix; then
4612                 : null
4613         else
4614                 echo "Nor is it Venix..."
4615         fi
4616 fi
4617 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4618 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4619 $rm -f foo
4620
4621 : Check if we are using GNU gcc and what its version is
4622 echo " "
4623 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4624 $cat >try.c <<EOM
4625 #include <stdio.h>
4626 int main() {
4627 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4628 #ifdef __VERSION__
4629         printf("%s\n", __VERSION__);
4630 #else
4631         printf("%s\n", "1");
4632 #endif
4633 #endif
4634         return(0);
4635 }
4636 EOM
4637 if $cc -o try $ccflags $ldflags try.c; then
4638         gccversion=`$run ./try`
4639         case "$gccversion" in
4640         '') echo "You are not using GNU cc." ;;
4641         *)  echo "You are using GNU cc $gccversion."
4642             ccname=gcc
4643             ;;
4644         esac
4645 else
4646         echo " "
4647         echo "*** WHOA THERE!!! ***" >&4
4648         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4649         case "$knowitall" in
4650         '')
4651         echo "    You'd better start hunting for one and let me know about it." >&4
4652                 exit 1
4653                 ;;
4654         esac
4655 fi
4656 $rm -f try try.*
4657 case "$gccversion" in
4658 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4659 esac
4660 case "$gccversion" in
4661 '') gccosandvers='' ;;
4662 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4663    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4664    gccshortvers=''
4665    case "$gccosandvers" in
4666    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4667    $osname$osvers) ;; # looking good
4668    $osname*) cat <<EOM >&4
4669
4670 *** WHOA THERE!!! ***
4671
4672     Your gcc has not been compiled for the exact release of
4673     your operating system ($gccosandvers versus $osname$osvers).
4674
4675     In general it is a good idea to keep gcc synchronized with
4676     the operating system because otherwise serious problems
4677     may ensue when trying to compile software, like Perl.
4678
4679     I'm trying to be optimistic here, though, and will continue.
4680     If later during the configuration and build icky compilation
4681     problems appear (headerfile conflicts being the most common
4682     manifestation), I suggest reinstalling the gcc to match
4683     your operating system release.
4684
4685 EOM
4686       ;;
4687    *) gccosandvers='' ;; # failed to parse, better be silent
4688    esac
4689    ;;
4690 esac
4691 case "$ccname" in
4692 '') ccname="$cc" ;;
4693 esac
4694
4695 # gcc 3.* complain about adding -Idirectories that they already know about,
4696 # so we will take those off from locincpth.
4697 case "$gccversion" in
4698 3*)
4699     echo "main(){}">try.c
4700     for incdir in $locincpth; do
4701        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4702              grep '^c[cp]p*[01]: warning: changing search order '`
4703        if test "X$warn" != X; then
4704            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4705        fi
4706     done
4707     $rm -f try try.*
4708 esac
4709
4710 # gcc 4.9 by default does some optimizations that break perl.
4711 # see ticket 121505.
4712 #
4713 # The -fwrapv disables those optimizations (and probably others,) so
4714 # for gcc 4.9 (and later, since the optimizations probably won't go
4715 # away), add -fwrapv unless the user requests -fno-wrapv, which
4716 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4717 # which turns the overflows -fwrapv ignores into runtime errors.
4718 case "$gccversion" in
4719 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4720     case "$ccflags" in
4721     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4722     *) ccflags="$ccflags -fwrapv" ;;
4723     esac
4724 esac
4725
4726 : What should the include directory be ?
4727 : Use sysroot if set, so findhdr looks in the right place.
4728 echo " "
4729 $echo $n "Hmm...  $c"
4730 dflt="$sysroot/usr/include"
4731 incpath=''
4732 mips_type=''
4733 if $test -f /bin/mips && /bin/mips; then
4734         echo "Looks like a MIPS system..."
4735         $cat >usr.c <<'EOCP'
4736 #ifdef SYSTYPE_BSD43
4737 /bsd43
4738 #endif
4739 EOCP
4740         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4741                 dflt='/bsd43/usr/include'
4742                 incpath='/bsd43'
4743                 mips_type='BSD 4.3'
4744         else
4745                 mips_type='System V'
4746         fi
4747         $rm -f usr.c usr.out
4748         echo "and you're compiling with the $mips_type compiler and libraries."
4749         xxx_prompt=y
4750         echo "exit 0" >mips
4751 else
4752         echo "Doesn't look like a MIPS system."
4753         xxx_prompt=n
4754         echo "exit 1" >mips
4755 fi
4756 chmod +x mips
4757 $eunicefix mips
4758 case "$usrinc" in
4759 '') ;;
4760 *) dflt="$usrinc";;
4761 esac
4762 case "$xxx_prompt" in
4763 y)      fn=d/
4764         echo " "
4765         rp='Where are the include files you want to use?'
4766         . ./getfile
4767         usrinc="$ans"
4768         ;;
4769 *)      usrinc="$dflt"
4770         ;;
4771 esac
4772
4773 : see how we invoke the C preprocessor
4774 echo " "
4775 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4776 cat <<'EOT' >testcpp.c
4777 #define ABC abc
4778 #define XYZ xyz
4779 ABC.XYZ
4780 EOT
4781 cd ..
4782 if test ! -f cppstdin; then
4783         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4784                 # AIX cc -E doesn't show the absolute headerfile
4785                 # locations but we'll cheat by using the -M flag.
4786                 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
4787         else
4788                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4789         fi
4790 else
4791         echo "Keeping your $hint cppstdin wrapper."
4792 fi
4793 chmod 755 cppstdin
4794 wrapper=`pwd`/cppstdin
4795 ok='false'
4796 cd UU
4797
4798 if $test "X$cppstdin" != "X" && \
4799         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4800         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4801 then
4802         echo "You used to use $cppstdin $cppminus so we'll use that again."
4803         case "$cpprun" in
4804         '') echo "But let's see if we can live without a wrapper..." ;;
4805         *)
4806                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4807                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4808                 then
4809                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4810                         ok='true'
4811                 else
4812                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4813                 fi
4814                 ;;
4815         esac
4816 else
4817         case "$cppstdin" in
4818         '') ;;
4819         *)
4820                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4821                 ;;
4822         esac
4823 fi
4824
4825 if $ok; then
4826         : nothing
4827 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4828         $cc -E <testcpp.c >testcpp.out 2>&1; \
4829         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4830         echo "Yup, it does."
4831         x_cpp="$cc $cppflags -E"
4832         x_minus='';
4833 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4834         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4835         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4836         echo "Yup, it does."
4837         x_cpp="$cc $cppflags -E"
4838         x_minus='-';
4839 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4840         $cc -P <testcpp.c >testcpp.out 2>&1; \
4841         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4842         echo "Yipee, that works!"
4843         x_cpp="$cc $cppflags -P"
4844         x_minus='';
4845 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4846         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4847         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4848         echo "At long last!"
4849         x_cpp="$cc $cppflags -P"
4850         x_minus='-';
4851 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4852         $cpp <testcpp.c >testcpp.out 2>&1; \
4853         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4854         echo "It works!"
4855         x_cpp="$cpp $cppflags"
4856         x_minus='';
4857 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4858         $cpp - <testcpp.c >testcpp.out 2>&1; \
4859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4860         echo "Hooray, it works!  I was beginning to wonder."
4861         x_cpp="$cpp $cppflags"
4862         x_minus='-';
4863 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4864         $wrapper <testcpp.c >testcpp.out 2>&1; \
4865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4866         x_cpp="$wrapper"
4867         x_minus=''
4868         echo "Eureka!"
4869 else
4870         dflt=''
4871         rp="No dice.  I can't find a C preprocessor.  Name one:"
4872         . ./myread
4873         x_cpp="$ans"
4874         x_minus=''
4875         $x_cpp <testcpp.c >testcpp.out 2>&1
4876         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4877                 echo "OK, that will do." >&4
4878         else
4879 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4880                 exit 1
4881         fi
4882 fi
4883
4884 case "$ok" in
4885 false)
4886         cppstdin="$x_cpp"
4887         cppminus="$x_minus"
4888         cpprun="$x_cpp"
4889         cpplast="$x_minus"
4890         set X $x_cpp
4891         shift
4892         case "$1" in
4893         "$cpp")
4894                 echo "Perhaps can we force $cc -E using a wrapper..."
4895                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4896                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4897                 then
4898                         echo "Yup, we can."
4899                         cppstdin="$wrapper"
4900                         cppminus='';
4901                 else
4902                         echo "Nope, we'll have to live without it..."
4903                 fi
4904                 ;;
4905         esac
4906         case "$cpprun" in
4907         "$wrapper")
4908                 cpprun=''
4909                 cpplast=''
4910                 ;;
4911         esac
4912         ;;
4913 esac
4914
4915 case "$cppstdin" in
4916 "$wrapper"|'cppstdin') ;;
4917 *) $rm -f $wrapper;;
4918 esac
4919 $rm -f testcpp.c testcpp.out
4920
4921 : Adjust cppfilter for path component separator
4922 case "$osname" in
4923 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4924 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4925 *)   cppfilter='' ;;
4926 esac
4927
4928 : Use gcc to determine libpth and incpth
4929 # If using gcc or clang, we can get better values for libpth, incpth
4930 # and usrinc directly from the compiler.
4931 # Note that ccname for clang is also gcc.
4932 case "$ccname" in
4933     gcc)
4934         $echo 'extern int foo;' > try.c
4935         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4936         shift
4937         if $test $# -gt 0; then
4938             incpth="$incpth $*"
4939             incpth="`$echo $incpth|$sed 's/^ //'`"
4940             for i in $*; do
4941                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4942                 if $test -d $j; then
4943                     libpth="$libpth $j"
4944                 fi
4945             done
4946             libpth="`$echo $libpth|$sed 's/^ //'`"
4947             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4948                 if $test -d $xxx; then
4949                     case " $libpth " in
4950                     *" $xxx "*) ;;
4951                     *) libpth="$libpth $xxx";;
4952                     esac
4953                 fi
4954             done
4955         fi
4956         $rm -f try.c
4957         case "$usrinc" in
4958         '') for i in $incpth; do
4959                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4960                     usrinc="$i"
4961                     break
4962                 fi
4963             done
4964             ;;
4965         esac
4966
4967         case "$usecrosscompile" in
4968         $define|true|[yY]*)
4969             case "$incpth" in
4970                 '') echo "Incpth not defined." >&4; croak=y ;;
4971                 *)  echo "Using incpth '$incpth'." >&4 ;;
4972             esac
4973             case "$libpth" in
4974                 '') echo "Libpth not defined." >&4; croak=y ;;
4975                 *)  echo "Using libpth '$libpth'." >&4 ;;
4976             esac
4977             case "$usrinc" in
4978                 '') echo "Usrinc not defined." >&4; croak=y ;;
4979                 *)  echo "Using usrinc $usrinc." >&4 ;;
4980             esac
4981             case "$croak" in
4982                 y)
4983                 if test "X$sysroot" = X; then
4984                     echo "Cannot continue, aborting." >&4; exit 1
4985                 else
4986                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4987                 fi
4988                 ;;
4989             esac
4990             ;;
4991         esac
4992     ;;
4993 esac
4994
4995 : Default value for incpth is just usrinc
4996 case "$incpth" in
4997 '') incpth="$usrinc";;
4998 esac
4999
5000 : Set private lib path
5001 case "$plibpth" in
5002 '') if ./mips; then
5003         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
5004     fi;;
5005 esac
5006 case "$libpth" in
5007 ' ') dlist='';;
5008 '') dlist="$loclibpth $plibpth $glibpth";;
5009 *) dlist="$libpth";;
5010 esac
5011
5012 : Now check and see which directories actually exist, avoiding duplicates
5013 for xxx in $dlist
5014 do
5015     if $test -d $xxx; then
5016                 case " $libpth " in
5017                 *" $xxx "*) ;;
5018                 *) libpth="$libpth $xxx";;
5019                 esac
5020     fi
5021 done
5022 $cat <<'EOM'
5023
5024 Some systems have incompatible or broken versions of libraries.  Among
5025 the directories listed in the question below, please remove any you
5026 know not to be holding relevant libraries, and add any that are needed.
5027 Say "none" for none.
5028
5029 EOM
5030
5031 if test "X$sysroot" != X; then
5032     $cat <<EOM
5033 You have set sysroot to $sysroot, please supply the directories excluding sysroot
5034
5035 EOM
5036 fi
5037
5038 case "$libpth" in
5039 '') dflt='none';;
5040 *)
5041         set X $libpth
5042         shift
5043         dflt=${1+"$@"}
5044         ;;
5045 esac
5046 rp="Directories to use for library searches?"
5047 . ./myread
5048 case "$ans" in
5049 none) libpth=' ';;
5050 *) libpth="$ans";;
5051 esac
5052
5053 : compute shared library extension
5054 case "$so" in
5055 '')
5056         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5057                 dflt='sl'
5058         else
5059                 dflt='so'
5060         fi
5061         ;;
5062 *) dflt="$so";;
5063 esac
5064 $cat <<EOM
5065
5066 On some systems, shared libraries may be available.  Answer 'none' if
5067 you want to suppress searching of shared libraries for the remainder
5068 of this configuration.
5069
5070 EOM
5071 rp='What is the file extension used for shared libraries?'
5072 . ./myread
5073 so="$ans"
5074
5075 : Does target system insist that shared library basenames are unique
5076 $cat << EOM
5077
5078 Some dynamic loaders assume that the *basename* of shared library filenames
5079 are globally unique.  We'll default this to undef as we assume your system
5080 is not this weird. Set to defined if you're on one of them.
5081
5082 EOM
5083
5084 dflt='n'
5085 rp='Make shared library basenames unique?'
5086 . ./myread
5087 case "$ans" in
5088 y|Y) val="$define" ;;
5089 *)   val="$undef"  ;;
5090 esac
5091 set d_libname_unique
5092 eval $setvar
5093
5094 : Define several unixisms.
5095 : Hints files or command line option can be used to override them.
5096 : The convoluted testing is in case hints files set either the old
5097 : or the new name.
5098 case "$_exe" in
5099 '')     case "$exe_ext" in
5100         '')     ;;
5101         *)      _exe="$exe_ext" ;;
5102         esac
5103         ;;
5104 esac
5105 case "$_a" in
5106 '')     case "$lib_ext" in
5107     '') _a='.a';;
5108         *)      _a="$lib_ext" ;;
5109         esac
5110         ;;
5111 esac
5112 case "$_o" in
5113 '') case "$obj_ext" in
5114         '')     _o='.o';;
5115         *)      _o="$obj_ext";;
5116         esac
5117         ;;
5118 esac
5119 case "$p_" in
5120 '') case "$path_sep" in
5121         '')     p_=':';;
5122         *)      p_="$path_sep";;
5123         esac
5124         ;;
5125 esac
5126 exe_ext=$_exe
5127 lib_ext=$_a
5128 obj_ext=$_o
5129 path_sep=$p_
5130
5131 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5132
5133 : Which makefile gets called first.  This is used by make depend.
5134 case "$firstmakefile" in
5135 '') firstmakefile='makefile';;
5136 esac
5137
5138 : Check is we will use socks
5139 case "$usesocks" in
5140 $define|true|[yY]*)     dflt='y';;
5141 *) dflt='n';;
5142 esac
5143 cat <<EOM
5144
5145 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5146 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5147 to use the PerlIO abstraction layer, this will be implicitly selected.
5148
5149 If this doesn't make any sense to you, just accept the default '$dflt'.
5150 EOM
5151 rp='Build Perl for SOCKS?'
5152 . ./myread
5153 case "$ans" in
5154 y|Y)    val="$define" ;;
5155 *)      val="$undef" ;;
5156 esac
5157 set usesocks
5158 eval $setvar
5159
5160 : Check for uselongdouble support
5161 case "$ccflags" in
5162 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5163 esac
5164
5165 case "$uselongdouble" in
5166 $define|true|[yY]*)     dflt='y';;
5167 *) dflt='n';;
5168 esac
5169 cat <<EOM
5170
5171 Perl can be built to take advantage of long doubles which
5172 (if available) may give more accuracy and range for floating point numbers.
5173
5174 If this doesn't make any sense to you, just accept the default '$dflt'.
5175 EOM
5176 rp='Try to use long doubles if available?'
5177 . ./myread
5178 case "$ans" in
5179 y|Y)    val="$define"   ;;
5180 *)      val="$undef"    ;;
5181 esac
5182 set uselongdouble
5183 eval $setvar
5184
5185 case "$uselongdouble" in
5186 true|[yY]*) uselongdouble="$define" ;;
5187 esac
5188
5189 : Look for a hint-file generated 'call-back-unit'.  If the
5190 : user has specified that long doubles should be used,
5191 : we may need to set or change some other defaults.
5192 if $test -f uselongdouble.cbu; then
5193     echo "Your platform has some specific hints regarding long doubles, using them..."
5194     . ./uselongdouble.cbu
5195 else
5196     case "$uselongdouble" in
5197         $define)
5198                 $cat <<EOM
5199 (Your platform does not have any specific hints for long doubles.)
5200 EOM
5201         ;;
5202     esac
5203 fi
5204
5205 : Looking for optional libraries
5206 echo " "
5207 echo "Checking for optional libraries..." >&4
5208 case "$libs" in
5209 ' '|'') dflt='';;
5210 *) dflt="$libs";;
5211 esac
5212 case "$libswanted" in
5213 '') libswanted='c_s';;
5214 esac
5215 case "$usesocks" in
5216 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5217 esac
5218 case "$usecbacktrace" in
5219 "$define") libswanted="$libswanted bfd" ;;
5220 esac
5221 case "$usequadmath" in
5222 "$define") libswanted="$libswanted quadmath" ;;
5223 esac
5224 libsfound=''
5225 libsfiles=''
5226 libsdirs=''
5227 libspath=''
5228 for thisdir in $libpth $xlibpth; do
5229   test -d $thisdir && libspath="$libspath $thisdir"
5230 done
5231 for thislib in $libswanted; do
5232         for thisdir in $libspath; do
5233             xxx=''
5234             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5235                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5236                 $test -f "$xxx" && eval $libscheck
5237                 $test -f "$xxx" && libstyle=shared
5238                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5239                 $test -f "$xxx" && eval $libscheck
5240                 $test -f "$xxx" && libstyle=shared
5241             fi
5242             if test ! -f "$xxx"; then
5243                 xxx=$thisdir/lib$thislib.$so
5244                 $test -f "$xxx" && eval $libscheck
5245                 $test -f "$xxx" && libstyle=shared
5246             fi
5247             if test ! -f "$xxx"; then
5248                 xxx=$thisdir/lib$thislib$_a
5249                 $test -f "$xxx" && eval $libscheck
5250                 $test -f "$xxx" && libstyle=static
5251             fi
5252             if test ! -f "$xxx"; then
5253                 xxx=$thisdir/$thislib$_a
5254                 $test -f "$xxx" && eval $libscheck
5255                 $test -f "$xxx" && libstyle=static
5256             fi
5257             if test ! -f "$xxx"; then
5258                 xxx=$thisdir/lib${thislib}_s$_a
5259                 $test -f "$xxx" && eval $libscheck
5260                 $test -f "$xxx" && libstyle=static
5261                 $test -f "$xxx" && thislib=${thislib}_s
5262             fi
5263             if test ! -f "$xxx"; then
5264                 xxx=$thisdir/Slib$thislib$_a
5265                 $test -f "$xxx" && eval $libscheck
5266                 $test -f "$xxx" && libstyle=static
5267             fi
5268             if $test -f "$xxx"; then
5269                 case "$libstyle" in
5270                 shared) echo "Found -l$thislib (shared)." ;;
5271                 static) echo "Found -l$thislib." ;;
5272                 *)      echo "Found -l$thislib ($libstyle)." ;;
5273                 esac
5274                 case " $dflt " in
5275                 *"-l$thislib "*);;
5276                 *) dflt="$dflt -l$thislib"
5277                    libsfound="$libsfound $xxx"
5278                    yyy=`basename $xxx`
5279                    libsfiles="$libsfiles $yyy"
5280                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5281                    case " $libsdirs " in
5282                    *" $yyy "*) ;;
5283                    *) libsdirs="$libsdirs $yyy" ;;
5284                    esac
5285                    ;;
5286                 esac
5287                 break
5288             fi
5289         done
5290         if $test ! -f "$xxx"; then
5291             echo "No -l$thislib."
5292         fi
5293 done
5294 set X $dflt
5295 shift
5296 dflt="$*"
5297 case "$libs" in
5298 '') dflt="$dflt";;
5299 *) dflt="$libs";;
5300 esac
5301 case "$dflt" in
5302 ' '|'') dflt='none';;
5303 esac
5304
5305 $cat <<EOM
5306
5307 In order to compile $package on your machine, a number of libraries
5308 are usually needed.  Include any other special libraries here as well.
5309 Say "none" for none.  The default list is almost always right.
5310 EOM
5311
5312 echo " "
5313 rp="What libraries to use?"
5314 . ./myread
5315 case "$ans" in
5316 none) libs=' ';;
5317 *) libs="$ans";;
5318 esac
5319
5320 : determine optimization, if desired, or use for debug flag also
5321 case "$optimize" in
5322 ' '|$undef) dflt='none';;
5323 '') dflt='-O';;
5324 *) dflt="$optimize";;
5325 esac
5326 $cat <<EOH
5327
5328 By default, $package compiles with the -O flag to use the optimizer.
5329 Alternately, you might want to use the symbolic debugger, which uses
5330 the -g flag (on traditional Unix systems).  Either flag can be
5331 specified here.  To use neither flag, specify the word "none".
5332
5333 EOH
5334 rp="What optimizer/debugger flag should be used?"
5335 . ./myread
5336 optimize="$ans"
5337 case "$optimize" in
5338 'none') optimize=" ";;
5339 esac
5340
5341 : Check what DEBUGGING is required from the command line
5342 : -DEBUGGING      or -DDEBUGGING or
5343 : -DEBUGGING=both                       = -g + -DDEBUGGING
5344 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5345 : -DEBUGGING=none or -UDEBUGGING        =
5346 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5347 case "$EBUGGING" in
5348 '')     ;;
5349 *)      DEBUGGING=$EBUGGING ;;
5350 esac
5351
5352 case "$DEBUGGING" in
5353 -g|both|$define)
5354     case "$optimize" in
5355         *-g*) ;;
5356         *)    optimize="$optimize -g" ;;
5357     esac ;;
5358 none|$undef)
5359     case "$optimize" in
5360         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5361                 shift
5362                 optimize="$*"
5363                 ;;
5364     esac ;;
5365 esac
5366
5367 dflt=''
5368 case "$DEBUGGING" in
5369 both|$define) dflt='-DDEBUGGING'
5370 esac
5371
5372 : argument order is deliberate, as the flag will start with - which set could
5373 : think is an option
5374 checkccflag='check=$1; flag=$2; callback=$3;
5375 echo " ";
5376 echo "Checking if your compiler accepts $flag" 2>&1;
5377 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5378 echo "int main(void) { return 0; }" > gcctest.c;
5379 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5380     echo "Yes, it does." 2>&1;
5381     if $test -s gcctest.out ; then
5382         echo "But your platform does not like it:";
5383         cat gcctest.out;
5384     else
5385         case "$ccflags" in
5386         *$check*)
5387             echo "Leaving current flags $ccflags alone." 2>&1
5388             ;;
5389         *) dflt="$dflt $flag";
5390             eval $callback
5391             ;;
5392         esac
5393     fi
5394 else
5395     echo "Nope, it does not, but that is ok." 2>&1;
5396 fi
5397 '
5398
5399 : We will not override a previous value, but we might want to
5400 : augment a hint file
5401 case "$hint" in
5402 default|recommended)
5403         case "$gccversion" in
5404         1*) dflt="$dflt -fpcc-struct-return" ;;
5405         esac
5406         case "$optimize:$DEBUGGING" in
5407         *-g*:old) dflt="$dflt -DDEBUGGING";;
5408         esac
5409         case "$gccversion" in
5410         2*) if $test -d /etc/conf/kconfig.d &&
5411                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5412                 then
5413                         # Interactive Systems (ISC) POSIX mode.
5414                         dflt="$dflt -posix"
5415                 fi
5416                 ;;
5417         esac
5418         case "$gccversion" in
5419         1*) ;;
5420         2.[0-8]*) ;;
5421         ?*)     set strict-aliasing -fno-strict-aliasing
5422                 eval $checkccflag
5423                 ;;
5424         esac
5425         # For gcc, adding -pipe speeds up compilations for some, but apparently
5426         # some assemblers can't read from stdin.  (It also slows down compilations
5427         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5428         case "$gccversion" in
5429         ?*)     set pipe -pipe
5430                 eval $checkccflag
5431                 ;;
5432         esac
5433
5434         # on x86_64 (at least) we require an extra library (libssp) in the
5435         # link command line. This library is not named, so I infer that it is
5436         # an implementation detail that may change. Hence the safest approach
5437         # is to add the flag to the flags passed to the compiler at link time,
5438         # as that way the compiler can do the right implementation dependant
5439         # thing. (NWC)
5440         case "$gccversion" in
5441         ?*)     set stack-protector-strong -fstack-protector-strong
5442                 eval $checkccflag
5443                 case "$dflt" in
5444                 *-fstack-protector-strong*) ;; # It got added.
5445                 *) # Try the plain/older -fstack-protector.
5446                    set stack-protector -fstack-protector
5447                    eval $checkccflag
5448                    ;;
5449                 esac
5450                 ;;
5451         esac
5452         ;;
5453 esac
5454
5455 case "$mips_type" in
5456 *BSD*|'') inclwanted="$locincpth $usrinc";;
5457 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5458 esac
5459 for thisincl in $inclwanted; do
5460         if $test -d $thisincl; then
5461                 if $test x$thisincl != x$usrinc; then
5462                         case "$dflt" in
5463                         *" -I$thisincl "*);;
5464                         *) dflt="$dflt -I$thisincl ";;
5465                         esac
5466                 fi
5467         fi
5468 done
5469
5470 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5471         xxx=true;
5472 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5473         xxx=true;
5474 else
5475         xxx=false;
5476 fi;
5477 if $xxx; then
5478         case "$dflt" in
5479         *$2*);;
5480         *) dflt="$dflt -D$2";;
5481         esac;
5482 fi'
5483
5484 set signal.h LANGUAGE_C; eval $inctest
5485
5486 case "$usesocks" in
5487 $define)
5488         ccflags="$ccflags -DSOCKS"
5489         ;;
5490 esac
5491
5492 case "$hint" in
5493 default|recommended) dflt="$ccflags $dflt" ;;
5494 *) dflt="$ccflags";;
5495 esac
5496
5497 case "$dflt" in
5498 ''|' ') dflt=none;;
5499 esac
5500
5501 $cat <<EOH
5502
5503 Your C compiler may want other flags.  For this question you should include
5504 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5505 but you should NOT include libraries or ld flags like -lwhatever.  If you
5506 want $package to honor its debug switch, you should include -DDEBUGGING here.
5507 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5508
5509 To use no flags, specify the word "none".
5510
5511 EOH
5512 set X $dflt
5513 shift
5514 dflt=${1+"$@"}
5515 rp="Any additional cc flags?"
5516 . ./myread
5517 case "$ans" in
5518 none) ccflags='';;
5519 *) ccflags="$ans";;
5520 esac
5521
5522 : the following weeds options from ccflags that are of no interest to cpp
5523 case "$cppflags" in
5524 '') cppflags="$ccflags" ;;
5525 *)  cppflags="$cppflags $ccflags" ;;
5526 esac
5527 case "$gccversion" in
5528 1*) cppflags="$cppflags -D__GNUC__"
5529 esac
5530 case "$mips_type" in
5531 '');;
5532 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5533 esac
5534 case "$cppflags" in
5535 '');;
5536 *)
5537         echo " "
5538         echo "Let me guess what the preprocessor flags are..." >&4
5539         set X $cppflags
5540         shift
5541         cppflags=''
5542         $cat >cpp.c <<'EOM'
5543 #define BLURFL foo
5544
5545 BLURFL xx LFRULB
5546 EOM
5547         previous=''
5548         for flag in $*
5549         do
5550                 case "$flag" in
5551                 -*) ftry="$flag";;
5552                 *) ftry="$previous $flag";;
5553                 esac
5554                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5555                         >cpp1.out 2>/dev/null && \
5556                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5557                         >cpp2.out 2>/dev/null && \
5558                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5559                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5560                 then
5561                         cppflags="$cppflags $ftry"
5562                         previous=''
5563                 else
5564                         previous="$flag"
5565                 fi
5566         done
5567         set X $cppflags
5568         shift
5569         cppflags=${1+"$@"}
5570         case "$cppflags" in
5571         *-*)  echo "They appear to be: $cppflags";;
5572         esac
5573         $rm -f cpp.c cpp?.out
5574         ;;
5575 esac
5576
5577 : flags used in final linking phase
5578 case "$ldflags" in
5579 '') if ./venix; then
5580                 dflt='-i -z'
5581         else
5582                 dflt=''
5583         fi
5584         case "$ccflags" in
5585         *-posix*) dflt="$dflt -posix" ;;
5586         esac
5587         ;;
5588 *) dflt="$ldflags";;
5589 esac
5590 # See note above about -fstack-protector
5591 case "$ccflags" in
5592 *-fstack-protector-strong*)
5593         case "$dflt" in
5594         *-fstack-protector-strong*) ;; # Don't add it again
5595         *) dflt="$dflt -fstack-protector-strong" ;;
5596         esac
5597         ;;
5598 *-fstack-protector*)
5599         case "$dflt" in
5600         *-fstack-protector*) ;; # Don't add it again
5601         *) dflt="$dflt -fstack-protector" ;;
5602         esac
5603         ;;
5604 esac
5605
5606 : Try to guess additional flags to pick up local libraries.
5607 for thislibdir in $libpth; do
5608         case " $loclibpth " in
5609         *" $thislibdir "*)
5610                 case "$dflt " in
5611                 *"-L$thislibdir "*) ;;
5612                 *)  dflt="$dflt -L$thislibdir" ;;
5613                 esac
5614                 ;;
5615         esac
5616 done
5617
5618 case "$dflt" in
5619 '') dflt='none' ;;
5620 esac
5621
5622 $cat <<EOH
5623
5624 Your C linker may need flags.  For this question you should
5625 include -L/whatever and any other flags used by the C linker, but you
5626 should NOT include libraries like -lwhatever.
5627
5628 Make sure you include the appropriate -L/path flags if your C linker
5629 does not normally search all of the directories you specified above,
5630 namely
5631         $libpth
5632 To use no flags, specify the word "none".
5633
5634 EOH
5635
5636 rp="Any additional ld flags (NOT including libraries)?"
5637 . ./myread
5638 case "$ans" in
5639 none) ldflags='';;
5640 *) ldflags="$ans";;
5641 esac
5642 rmlist="$rmlist pdp11"
5643
5644 : coherency check
5645 echo " "
5646 echo "Checking your choice of C compiler and flags for coherency..." >&4
5647 $cat > try.c <<'EOF'
5648 #include <stdio.h>
5649 int main() { printf("Ok\n"); return(0); }
5650 EOF
5651 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5652 shift
5653 $cat >try.msg <<'EOM'
5654 I've tried to compile and run the following simple program:
5655
5656 EOM
5657 $cat try.c >> try.msg
5658
5659 $cat >> try.msg <<EOM
5660
5661 I used the command:
5662
5663         $*
5664         $run ./try
5665
5666 and I got the following output:
5667
5668 EOM
5669 dflt=y
5670 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5671         if $sh -c "$run ./try " >>try.msg 2>&1; then
5672                 xxx=`$run ./try`
5673                 case "$xxx" in
5674                 "Ok") dflt=n ;;
5675                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5676                 esac
5677         else
5678                 echo "The program compiled OK, but exited with status $?." >>try.msg
5679                 rp="You have a problem.  Shall I abort Configure"
5680                 dflt=y
5681         fi
5682 else
5683         echo "I can't compile the test program." >>try.msg
5684         rp="You have a BIG problem.  Shall I abort Configure"
5685         dflt=y
5686 fi
5687 case "$dflt" in
5688 y)
5689         $cat try.msg >&4
5690         case "$knowitall" in
5691         '')
5692                 echo "(The supplied flags or libraries might be incorrect.)"
5693                 ;;
5694         *) dflt=n;;
5695         esac
5696         echo " "
5697         . ./myread
5698         case "$ans" in
5699         n*|N*) ;;
5700         *)      echo "Ok.  Stopping Configure." >&4
5701                 exit 1
5702                 ;;
5703         esac
5704         ;;
5705 n) echo "OK, that should do.";;
5706 esac
5707 $rm_try gcctest gcctest.out
5708
5709 : define a shorthand compile call
5710 compile='
5711 mc_file=$1;
5712 shift;
5713 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5714 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5715 exit 1;
5716 fi;
5717 esac;
5718 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5719 : define a shorthand compile call for compilations that should be ok.
5720 compile_ok='
5721 mc_file=$1;
5722 shift;
5723 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5724
5725 : determine filename position in cpp output
5726 echo " "
5727 echo "Computing filename position in cpp output for #include directives..." >&4
5728 case "$osname" in
5729 vos) testaccess=-e ;;
5730 *)   testaccess=-r ;;
5731 esac
5732 echo '#include <stdio.h>' > foo.c
5733 $cat >fieldn <<EOF
5734 $startsh
5735 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5736 $grep '^[       ]*#.*stdio\.h' | \
5737 while read cline; do
5738         pos=1
5739         set \$cline
5740         while $test \$# -gt 0; do
5741                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5742                         echo "\$pos"
5743                         exit 0
5744                 fi
5745                 shift
5746                 pos=\`expr \$pos + 1\`
5747         done
5748 done
5749 EOF
5750 chmod +x fieldn
5751 fieldn=`./fieldn`
5752 $rm -f foo.c fieldn
5753 case $fieldn in
5754 '') pos='???';;
5755 1) pos=first;;
5756 2) pos=second;;
5757 3) pos=third;;
5758 *) pos="${fieldn}th";;
5759 esac
5760 echo "Your cpp writes the filename in the $pos field of the line."
5761
5762 : locate header file
5763 $cat >findhdr <<EOF
5764 $startsh
5765 wanted=\$1
5766 name=''
5767 for usrincdir in $incpth
5768 do
5769         if test -f \$usrincdir/\$wanted; then
5770                 echo "\$usrincdir/\$wanted"
5771                 exit 0
5772         fi
5773 done
5774 awkprg='{ print \$$fieldn }'
5775 echo "#include <\$wanted>" > foo\$\$.c
5776 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5777 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5778 while read cline; do
5779         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5780         case "\$name" in
5781         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5782         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5783         *) exit 2;;
5784         esac;
5785 done;
5786 #
5787 # status = 0: grep returned 0 lines, case statement not executed
5788 # status = 1: headerfile found
5789 # status = 2: while loop executed, no headerfile found
5790 #
5791 status=\$?
5792 $rm -f foo\$\$.c;
5793 if test \$status -eq 1; then
5794         exit 0;
5795 fi
5796 exit 1
5797 EOF
5798 chmod +x findhdr
5799
5800 : define an alternate in-header-list? function
5801 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5802 cont=true; xxf="echo \"<\$1> found.\" >&4";
5803 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5804 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5805 esac;
5806 case $# in 4) instead=instead;; *) instead="at last";; esac;
5807 while $test "$cont"; do
5808         xxx=`./findhdr $1`
5809         var=$2; eval "was=\$$2";
5810         if $test "$xxx" && $test -r "$xxx";
5811         then eval $xxf;
5812         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5813                 cont="";
5814         else eval $xxnf;
5815         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5816         set $yyy; shift; shift; yyy=$@;
5817         case $# in 0) cont="";;
5818         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5819                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5820         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5821                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5822         esac;
5823 done;
5824 while $test "$yyy";
5825 do set $yyy; var=$2; eval "was=\$$2";
5826         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5827         set $yyy; shift; shift; yyy=$@;
5828 done'
5829
5830 : see if stdlib is available
5831 set stdlib.h i_stdlib
5832 eval $inhdr
5833
5834 : check for lengths of integral types
5835 echo " "
5836 case "$intsize" in
5837 '')
5838         echo "Checking to see how big your integers are..." >&4
5839         $cat >try.c <<EOCP
5840 #include <stdio.h>
5841 #$i_stdlib I_STDLIB
5842 #ifdef I_STDLIB
5843 #include <stdlib.h>
5844 #endif
5845 int main()
5846 {
5847         printf("intsize=%d;\n", (int)sizeof(int));
5848         printf("longsize=%d;\n", (int)sizeof(long));
5849         printf("shortsize=%d;\n", (int)sizeof(short));
5850         exit(0);
5851 }
5852 EOCP
5853         set try
5854         if eval $compile_ok && $run ./try > /dev/null; then
5855                 eval `$run ./try`
5856                 echo "Your integers are $intsize bytes long."
5857                 echo "Your long integers are $longsize bytes long."
5858                 echo "Your short integers are $shortsize bytes long."
5859         else
5860                 $cat >&4 <<EOM
5861 !
5862 Help! I can't compile and run the intsize test program: please enlighten me!
5863 (This is probably a misconfiguration in your system or libraries, and
5864 you really ought to fix it.  Still, I'll try anyway.)
5865 !
5866 EOM
5867                 dflt=4
5868                 rp="What is the size of an integer (in bytes)?"
5869                 . ./myread
5870                 intsize="$ans"
5871                 dflt=$intsize
5872                 rp="What is the size of a long integer (in bytes)?"
5873                 . ./myread
5874                 longsize="$ans"
5875                 dflt=2
5876                 rp="What is the size of a short integer (in bytes)?"
5877                 . ./myread
5878                 shortsize="$ans"
5879         fi
5880         ;;
5881 esac
5882 $rm_try
5883
5884 : check for long long
5885 echo " "
5886 echo "Checking to see if you have long long..." >&4
5887 echo 'int main() { long long x = 7; return 0; }' > try.c
5888 set try
5889 if eval $compile; then
5890         val="$define"
5891         echo "You have long long."
5892 else
5893         val="$undef"
5894         echo "You do not have long long."
5895 fi
5896 $rm_try
5897 set d_longlong
5898 eval $setvar
5899
5900 : check for length of long long
5901 case "${d_longlong}${longlongsize}" in
5902 $define)
5903         echo " "
5904         echo "Checking to see how big your long longs are..." >&4
5905         $cat >try.c <<'EOCP'
5906 #include <stdio.h>
5907 int main()
5908 {
5909     printf("%d\n", (int)sizeof(long long));
5910     return(0);
5911 }
5912 EOCP
5913         set try
5914         if eval $compile_ok; then
5915                 longlongsize=`$run ./try`
5916                 echo "Your long longs are $longlongsize bytes long."
5917         else
5918                 dflt='8'
5919                 echo " "
5920                 echo "(I can't seem to compile the test program.  Guessing...)"
5921                 rp="What is the size of a long long (in bytes)?"
5922                 . ./myread
5923                 longlongsize="$ans"
5924         fi
5925         if $test "X$longsize" = "X$longlongsize"; then
5926                 echo "(That isn't any different from an ordinary long.)"
5927         fi
5928         ;;
5929 esac
5930 $rm_try
5931
5932 : see if inttypes.h is available
5933 : we want a real compile instead of Inhdr because some systems
5934 : have an inttypes.h which includes non-existent headers
5935 echo " "
5936 $cat >try.c <<EOCP
5937 #include <inttypes.h>
5938 int main() {
5939         static int32_t foo32 = 0x12345678;
5940 }
5941 EOCP
5942 set try
5943 if eval $compile; then
5944         echo "<inttypes.h> found." >&4
5945         val="$define"
5946 else
5947         echo "<inttypes.h> NOT found." >&4
5948         val="$undef"
5949 fi
5950 $rm_try
5951 set i_inttypes
5952 eval $setvar
5953
5954 : check for int64_t
5955 echo " "
5956 echo "Checking to see if you have int64_t..." >&4
5957 $cat >try.c <<EOCP
5958 #include <sys/types.h>
5959 #$i_inttypes I_INTTYPES
5960 #ifdef I_INTTYPES
5961 #include <inttypes.h>
5962 #endif
5963 int main() { int64_t x = 7; }
5964 EOCP
5965 set try
5966 if eval $compile; then
5967         val="$define"
5968         echo "You have int64_t."
5969 else
5970         val="$undef"
5971         echo "You do not have int64_t."
5972 fi
5973 $rm_try
5974 set d_int64_t
5975 eval $setvar
5976
5977 : Check if 64bit ints have a quad type
5978 echo " "
5979 echo "Checking which 64-bit integer type we could use..." >&4
5980
5981 case "$intsize" in
5982 8) val=int
5983    set quadtype
5984    eval $setvar
5985    val='"unsigned int"'
5986    set uquadtype
5987    eval $setvar
5988    quadkind=1
5989    ;;
5990 *) case "$longsize" in
5991    8) val=long
5992       set quadtype
5993       eval $setvar
5994       val='"unsigned long"'
5995       set uquadtype
5996       eval $setvar
5997       quadkind=2
5998       ;;
5999    *) case "$d_longlong:$longlongsize" in
6000       define:8)
6001         val='"long long"'
6002         set quadtype
6003         eval $setvar
6004         val='"unsigned long long"'
6005         set uquadtype
6006         eval $setvar
6007         quadkind=3
6008         ;;
6009       *) case "$d_int64_t" in
6010          define)
6011            val=int64_t
6012            set quadtype
6013            eval $setvar
6014            val=uint64_t
6015            set uquadtype
6016            eval $setvar
6017            quadkind=4
6018            ;;
6019          esac
6020          ;;
6021       esac
6022       ;;
6023    esac
6024    ;;
6025 esac
6026
6027 case "$quadtype" in
6028 '')     echo "Alas, no 64-bit integer types in sight." >&4
6029         d_quad="$undef"
6030         ;;
6031 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
6032         d_quad="$define"
6033         ;;
6034 esac
6035
6036 : Do we want 64bit support
6037 case "$uselonglong" in
6038 "$define"|true|[yY]*)
6039         cat <<EOM >&4
6040
6041 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6042 EOM
6043         use64bitint="$define"
6044         ;;
6045 esac
6046 case "$use64bits" in
6047 "$define"|true|[yY]*)
6048         cat <<EOM >&4
6049
6050 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6051 EOM
6052         use64bitint="$define"
6053         ;;
6054 esac
6055 case "$use64bitints" in
6056 "$define"|true|[yY]*)
6057         cat <<EOM >&4
6058
6059 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6060 EOM
6061         use64bitint="$define"
6062         ;;
6063 esac
6064 case "$use64bitsint" in
6065 "$define"|true|[yY]*)
6066         cat <<EOM >&4
6067
6068 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6069 EOM
6070         use64bitint="$define"
6071         ;;
6072 esac
6073 case "$uselonglongs" in
6074 "$define"|true|[yY]*)
6075         cat <<EOM >&4
6076
6077 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6078 EOM
6079         use64bitint="$define"
6080         ;;
6081 esac
6082 case "$use64bitsall" in
6083 "$define"|true|[yY]*)
6084         cat <<EOM >&4
6085
6086 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6087 EOM
6088         use64bitall="$define"
6089         ;;
6090 esac
6091
6092 case "$ccflags" in
6093 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6094 esac
6095 case "$use64bitall" in
6096 "$define"|true|[yY]*) use64bitint="$define" ;;
6097 esac
6098
6099 case "$longsize" in
6100 8) cat <<EOM
6101
6102 You have natively 64-bit long integers.
6103 EOM
6104    val="$define"
6105    ;;
6106 *) case "$use64bitint" in
6107    "$define"|true|[yY]*) dflt='y';;
6108    *) dflt='n';;
6109    esac
6110    case "$d_quad" in
6111    "$define") ;;
6112    *) dflt='n' ;;
6113    esac
6114    cat <<EOM
6115
6116 Perl can be built to take advantage of 64-bit integer types
6117 on some systems.  To do so, Configure can be run with -Duse64bitint.
6118 Choosing this option will most probably introduce binary incompatibilities.
6119
6120 If this doesn't make any sense to you, just accept the default '$dflt'.
6121 (The default has been chosen based on your configuration.)
6122 EOM
6123    rp='Try to use 64-bit integers, if available?'
6124    . ./myread
6125    case "$ans" in
6126    [yY]*) val="$define" ;;
6127    *)     val="$undef"  ;;
6128    esac
6129    ;;
6130 esac
6131 set use64bitint
6132 eval $setvar
6133
6134 case "$use64bitall" in
6135 "$define"|true|[yY]*) dflt='y' ;;
6136 *) case "$longsize" in
6137    8) dflt='y' ;;
6138    *) dflt='n' ;;
6139    esac
6140    ;;
6141 esac
6142 cat <<EOM
6143
6144 You may also choose to try maximal 64-bitness.  It means using as much
6145 64-bitness as possible on the platform.  This in turn means even more
6146 binary incompatibilities.  On the other hand, your platform may not
6147 have any more 64-bitness available than what you already have chosen.
6148
6149 If this doesn't make any sense to you, just accept the default '$dflt'.
6150 (The default has been chosen based on your configuration.)
6151 EOM
6152 rp='Try to use maximal 64-bit support, if available?'
6153 . ./myread
6154 case "$ans" in
6155 [yY]*) val="$define" ;;
6156 *)     val="$undef"  ;;
6157 esac
6158 set use64bitall
6159 eval $setvar
6160 case "$use64bitall" in
6161 "$define")
6162         case "$use64bitint" in
6163         "$undef")
6164                 cat <<EOM
6165
6166 Since you have chosen a maximally 64-bit build, I'm also turning on
6167 the use of 64-bit integers.
6168 EOM
6169                 use64bitint="$define" ;;
6170         esac
6171         ;;
6172 esac
6173
6174 : Look for a hint-file generated 'call-back-unit'.  If the
6175 : user has specified that a 64-bit perl is to be built,
6176 : we may need to set or change some other defaults.
6177 if $test -f use64bitint.cbu; then
6178         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6179         . ./use64bitint.cbu
6180 fi
6181 case "$use64bitint" in
6182 "$define"|true|[yY]*)
6183         : This test was common to all the OpenBSD forks, and seems harmless for
6184         : other platforms:
6185         echo " "
6186         echo "Checking if your C library has broken 64-bit functions..." >&4
6187         cat >try.c <<EOCP
6188 #include <stdio.h>
6189 typedef $uquadtype myULL;
6190 int main (void)
6191 {
6192     struct {
6193         double d;
6194         myULL  u;
6195     } *p, test[] = {
6196         {4294967303.15, 4294967303ULL},
6197         {4294967294.2,  4294967294ULL},
6198         {4294967295.7,  4294967295ULL},
6199         {0.0, 0ULL}
6200     };
6201     for (p = test; p->u; p++) {
6202         myULL x = (myULL)p->d;
6203         if (x != p->u) {
6204             printf("buggy\n");
6205             return 0;
6206         }
6207     }
6208     printf("ok\n");
6209     return 0;
6210 }
6211 EOCP
6212         set try
6213         if eval $compile_ok; then
6214             libcquad=`$run ./try`
6215             echo "Your C library's 64-bit functions are $libcquad."
6216         else
6217             echo "(I can't seem to compile the test program.)"
6218             echo "Assuming that your C library's 64-bit functions are ok."
6219             libcquad="ok"
6220         fi
6221         $rm_try
6222
6223         case "$libcquad" in
6224             buggy*)
6225                 cat >&4 <<EOM
6226
6227 *** You have a C library with broken 64-bit functions.
6228 *** 64-bit support does not work reliably in this configuration.
6229 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6230 *** Cannot continue, aborting.
6231
6232 EOM
6233                 exit 1
6234                 ;;
6235         esac
6236         case "$longsize" in
6237         4) case "$archname64" in
6238            '') archname64=64int ;;
6239            esac
6240            ;;
6241         esac
6242         ;;
6243 esac
6244
6245 : Look for a hint-file generated 'call-back-unit'.  If the
6246 : user has specified that a maximally 64-bit perl is to be built,
6247 : we may need to set or change some other defaults.
6248 if $test -f use64bitall.cbu; then
6249         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6250         . ./use64bitall.cbu
6251 fi
6252 case "$use64bitall" in
6253 "$define"|true|[yY]*)
6254         case "$longsize" in
6255         4) case "$archname64" in
6256            ''|64int) archname64=64all ;;
6257            esac
6258            ;;
6259         esac
6260         ;;
6261 esac
6262
6263 case "$d_quad:$use64bitint" in
6264 $undef:$define)
6265         cat >&4 <<EOF
6266
6267 *** You have chosen to use 64-bit integers,
6268 *** but none can be found.
6269 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6270 *** Cannot continue, aborting.
6271
6272 EOF
6273         exit 1
6274         ;;
6275 esac
6276
6277 : Check if we are using the GNU C library
6278 echo " "
6279 echo "Checking for GNU C Library..." >&4
6280 cat >try.c <<'EOCP'
6281 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6282    alone are insufficient to distinguish different versions, such as
6283    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6284    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6285 */
6286 #include <stdio.h>
6287 int main(void)
6288 {
6289 #ifdef __GLIBC__
6290 #   ifdef __GLIBC_MINOR__
6291 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6292 #           include <gnu/libc-version.h>
6293             printf("%s\n",  gnu_get_libc_version());
6294 #       else
6295             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6296 #       endif
6297 #   else
6298         printf("%d\n",  __GLIBC__);
6299 #   endif
6300     return 0;
6301 #else
6302     return 1;
6303 #endif
6304 }
6305 EOCP
6306 set try
6307 if eval $compile_ok && $run ./try > glibc.ver; then
6308         val="$define"
6309         gnulibc_version=`$cat glibc.ver`
6310         echo "You are using the GNU C Library version $gnulibc_version"
6311 else
6312         val="$undef"
6313         gnulibc_version=''
6314         echo "You are not using the GNU C Library"
6315 fi
6316 $rm_try glibc.ver
6317 set d_gnulibc
6318 eval $setvar
6319
6320 : see if nm is to be used to determine whether a symbol is defined or not
6321 case "$usenm" in
6322 '')
6323         dflt=''
6324         case "$d_gnulibc" in
6325         "$define")
6326                 echo " "
6327                 echo "nm probably won't work on the GNU C Library." >&4
6328                 dflt=n
6329                 ;;
6330         esac
6331         case "$dflt" in
6332         '')
6333                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6334                         echo " "
6335                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6336                         echo "'nm' won't be sufficient on this system." >&4
6337                         dflt=n
6338                 fi
6339                 ;;
6340         esac
6341         case "$dflt" in
6342         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6343                 if $test $dflt -gt 20; then
6344                         dflt=y
6345                 else
6346                         dflt=n
6347                 fi
6348                 ;;
6349         esac
6350         ;;
6351 *)
6352         case "$usenm" in
6353         true|$define) dflt=y;;
6354         *) dflt=n;;
6355         esac
6356         ;;
6357 esac
6358 $cat <<EOM
6359
6360 I can use $nm to extract the symbols from your C libraries. This
6361 is a time consuming task which may generate huge output on the disk (up
6362 to 3 megabytes) but that should make the symbols extraction faster. The
6363 alternative is to skip the 'nm' extraction part and to compile a small
6364 test program instead to determine whether each symbol is present. If
6365 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6366 this may be the best solution.
6367
6368 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6369
6370 EOM
6371 rp="Shall I use $nm to extract C symbols from the libraries?"
6372 . ./myread
6373 case "$ans" in
6374 [Nn]*) usenm=false;;
6375 *) usenm=true;;
6376 esac
6377
6378 runnm=$usenm
6379 case "$reuseval" in
6380 true) runnm=false;;
6381 esac
6382
6383 : nm options which may be necessary
6384 case "$nm_opt" in
6385 '') if $test -f /mach_boot; then
6386                 nm_opt=''       # Mach
6387         elif $test -d /usr/ccs/lib; then
6388                 nm_opt='-p'     # Solaris (and SunOS?)
6389         elif $test -f /dgux; then
6390                 nm_opt='-p'     # DG-UX
6391         elif $test -f /lib64/rld; then
6392                 nm_opt='-p'     # 64-bit Irix
6393         else
6394                 nm_opt=''
6395         fi;;
6396 esac
6397
6398 : nm options which may be necessary for shared libraries but illegal
6399 : for archive libraries.  Thank you, Linux.
6400 case "$nm_so_opt" in
6401 '')     case "$myuname" in
6402         *linux*|gnu*)
6403                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6404                         nm_so_opt='--dynamic'
6405                 fi
6406                 ;;
6407         esac
6408         ;;
6409 esac
6410
6411 : Figure out where the libc is located
6412 case "$runnm" in
6413 true)
6414 : get list of predefined functions in a handy place
6415 echo " "
6416 case "$libc" in
6417 '') libc=unknown
6418         case "$libs" in
6419         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6420         esac
6421         ;;
6422 esac
6423 case "$libs" in
6424 '') ;;
6425 *)  for thislib in $libs; do
6426         case "$thislib" in
6427         -lc|-lc_s)
6428                 : Handle C library specially below.
6429                 ;;
6430         -l*)
6431                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6432                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6433                         :
6434                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6435                         :
6436                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6437                         :
6438                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6439                         :
6440                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6441                         :
6442                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6443                         :
6444                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6445                         :
6446                 else
6447                         try=''
6448                 fi
6449                 libnames="$libnames $try"
6450                 ;;
6451         *) libnames="$libnames $thislib" ;;
6452         esac
6453         done
6454         ;;
6455 esac
6456 xxx=normal
6457 case "$libc" in
6458 unknown)
6459         set /lib/libc.$so
6460         for xxx in $libpth; do
6461                 $test -r $1 || set $xxx/libc.$so
6462                 : The messy sed command sorts on library version numbers.
6463                 $test -r $1 || \
6464                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6465                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6466                                 h
6467                                 s/[0-9][0-9]*/0000&/g
6468                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6469                                 G
6470                                 s/\n/ /' | \
6471                          $sort | $sed -e 's/^.* //'`
6472                 eval set \$$#
6473         done
6474         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6475         $test -r $1 || set $sysroot/lib/libsys_s$_a
6476         ;;
6477 *)
6478         set blurfl
6479         ;;
6480 esac
6481 if $test -r "$1"; then
6482         echo "Your (shared) C library seems to be in $1."
6483         libc="$1"
6484 elif $test -r /lib/libc && $test -r /lib/clib; then
6485         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6486         xxx=apollo
6487         libc='/lib/clib /lib/libc'
6488         if $test -r /lib/syslib; then
6489                 echo "(Your math library is in /lib/syslib.)"
6490                 libc="$libc /lib/syslib"
6491         fi
6492 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6493         echo "Your C library seems to be in $libc, as you said before."
6494 elif $test -r $incpath/usr/lib/libc$_a; then
6495         libc=$incpath/usr/lib/libc$_a;
6496         echo "Your C library seems to be in $libc.  That's fine."
6497 elif $test -r /lib/libc$_a; then
6498         libc=/lib/libc$_a;
6499         echo "Your C library seems to be in $libc.  You're normal."
6500 else
6501         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6502                 :
6503         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6504                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6505         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6506                 :
6507         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6508                 :
6509         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6510                 :
6511         else
6512                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6513         fi
6514         if $test -r "$tans"; then
6515                 echo "Your C library seems to be in $tans, of all places."
6516                 libc=$tans
6517         else
6518                 libc='blurfl'
6519         fi
6520 fi
6521 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6522         dflt="$libc"
6523         cat <<EOM
6524
6525 If the guess above is wrong (which it might be if you're using a strange
6526 compiler, or your machine supports multiple models), you can override it here.
6527
6528 EOM
6529 else
6530         dflt=''
6531         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6532         cat >&4 <<EOM
6533 I can't seem to find your C library.  I've looked in the following places:
6534
6535 EOM
6536         $sed 's/^/      /' libpath
6537         cat <<EOM
6538
6539 None of these seems to contain your C library. I need to get its name...
6540
6541 EOM
6542 fi
6543 fn=f
6544 rp='Where is your C library?'
6545 . ./getfile
6546 libc="$ans"
6547
6548 echo " "
6549 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6550 set X `cat libnames`
6551 shift
6552 xxx=files
6553 case $# in 1) xxx=file; esac
6554 echo "Extracting names from the following $xxx for later perusal:" >&4
6555 echo " "
6556 $sed 's/^/      /' libnames >&4
6557 echo " "
6558 $echo $n "This may take a while...$c" >&4
6559
6560 for file in $*; do
6561         case $file in
6562         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6563         *) $nm $nm_opt $file 2>/dev/null;;
6564         esac
6565 done >libc.tmp
6566
6567 $echo $n ".$c"
6568 $grep fprintf libc.tmp > libc.ptf
6569 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6570 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6571 xxx='[ADTSIWi]'
6572 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6573         eval $xscan;\
6574         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6575                 eval $xrun
6576 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6577         eval $xscan;\
6578         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6579                 eval $xrun
6580 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6581         eval $xscan;\
6582         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6583                 eval $xrun
6584 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6585         eval $xscan;\
6586         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6587                 eval $xrun
6588 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6589         eval $xscan;\
6590         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6591                 eval $xrun
6592 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6593         eval $xscan;\
6594         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6595                 eval $xrun
6596 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6597                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6598         eval $xscan;\
6599         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6600                 eval $xrun
6601 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6602         eval $xscan;\
6603         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6604                 eval $xrun
6605 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6606         eval $xscan;\
6607         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6608                 eval $xrun
6609 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6610         eval $xscan;\
6611         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6612                 eval $xrun
6613 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6614         eval $xscan;\
6615         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6616                 eval $xrun
6617 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\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/.*\.text n\ \ \ \.//p'";\
6622         eval $xscan;\
6623         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6624                 eval $xrun
6625 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6626         eval $xscan;\
6627         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6628                 eval $xrun
6629 else
6630         $nm -p $* 2>/dev/null >libc.tmp
6631         $grep fprintf libc.tmp > libc.ptf
6632         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6633                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6634         then
6635                 nm_opt='-p'
6636                 eval $xrun
6637         else
6638                 echo " "
6639                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6640                 com=''
6641                 if $ar t $libc > libc.tmp && \
6642                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6643                 then
6644                         for thisname in $libnames $libc; do
6645                                 $ar t $thisname >>libc.tmp
6646                         done
6647                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6648                         echo "Ok." >&4
6649                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6650                         for thisname in $libnames $libc; do
6651                                 $ar tv $thisname >>libc.tmp
6652                                 emximp -o tmp.imp $thisname \
6653                                     2>/dev/null && \
6654                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6655                                     < tmp.imp >>libc.tmp
6656                                 $rm -f tmp.imp
6657                         done
6658                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6659                         echo "Ok." >&4
6660                 else
6661                         echo "$ar didn't seem to work right." >&4
6662                         echo "Maybe this is a Cray...trying bld instead..." >&4
6663                         if  bld t $libc | \
6664                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6665                                 $test -s libc.list
6666                         then
6667                                 for thisname in $libnames; do
6668                                         bld t $libnames | \
6669                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6670                                         $ar t $thisname >>libc.tmp
6671                                 done
6672                                 echo "Ok." >&4
6673                         else
6674                                 echo "That didn't work either.  Giving up." >&4
6675                                 exit 1
6676                         fi
6677                 fi
6678         fi
6679 fi
6680 nm_extract="$com"
6681 case "$PASE" in
6682 define)
6683     echo " "
6684     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6685     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6686     ;;
6687 *)  if $test -f /lib/syscalls.exp; then
6688         echo " "
6689         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6690         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6691                 /lib/syscalls.exp >>libc.list
6692     fi
6693     ;;
6694 esac
6695 ;;
6696 esac
6697 $rm -f libnames libpath
6698
6699 : Check if we are using C++
6700 echo " "
6701 echo "Checking for C++..." >&4
6702 $cat >try.c <<'EOCP'
6703 #include <stdio.h>
6704 int main(void)
6705 {
6706 #ifdef __cplusplus
6707     return 0;
6708 #else
6709     return 1;
6710 #endif
6711 }
6712 EOCP
6713 set try
6714 if eval $compile_ok && $run ./try; then
6715         val="$define"
6716         echo "You are using a C++ compiler."
6717 else
6718         val="$undef"
6719         echo "You are not using a C++ compiler."
6720 fi
6721 $rm_try cplusplus$$
6722 set d_cplusplus
6723 eval $setvar
6724
6725 : is a C symbol defined?
6726 csym='tlook=$1;
6727 case "$3" in
6728 -v) tf=libc.tmp; tdc="";;
6729 -a) tf=libc.tmp; tdc="[]";;
6730 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6731 esac;
6732 case "$d_cplusplus" in
6733     $define)    extern_C="extern \"C\"" ;;
6734     *)          extern_C="extern"       ;;
6735 esac;
6736 tx=yes;
6737 case "$reuseval-$4" in
6738 true-) ;;
6739 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6740 esac;
6741 case "$tx" in
6742 yes)
6743         tval=false;
6744         if $test "$runnm" = true; then
6745                 if $contains $tlook $tf >/dev/null 2>&1; then
6746                         tval=true;
6747                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6748                         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;
6749                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6750                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6751                         $rm_try;
6752                 fi;
6753         else
6754                 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;
6755                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6756                 $rm_try;
6757         fi;
6758         ;;
6759 *)
6760         case "$tval" in
6761         $define) tval=true;;
6762         *) tval=false;;
6763         esac;
6764         ;;
6765 esac;
6766 eval "$2=$tval"'
6767
6768 : define an is-in-libc? function
6769 inlibc='echo " "; td=$define; tu=$undef;
6770 sym=$1; var=$2; eval "was=\$$2";
6771 tx=yes;
6772 case "$reuseval$was" in
6773 true) ;;
6774 true*) tx=no;;
6775 esac;
6776 case "$tx" in
6777 yes)
6778         set $sym tres -f;
6779         eval $csym;
6780         case "$tres" in
6781         true)
6782                 echo "$sym() found." >&4;
6783                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6784         *)
6785                 echo "$sym() NOT found." >&4;
6786                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6787         esac;;
6788 *)
6789         case "$was" in
6790         $define) echo "$sym() found." >&4;;
6791         *) echo "$sym() NOT found." >&4;;
6792         esac;;
6793 esac'
6794
6795 : check for length of double
6796 echo " "
6797 case "$doublesize" in
6798 '')
6799         echo "Checking to see how big your double precision numbers are..." >&4
6800         $cat >try.c <<EOCP
6801 #include <stdio.h>
6802 #$i_stdlib I_STDLIB
6803 #ifdef I_STDLIB
6804 #include <stdlib.h>
6805 #endif
6806 int main()
6807 {
6808     printf("%d\n", (int)sizeof(double));
6809     exit(0);
6810 }
6811 EOCP
6812         set try
6813         if eval $compile_ok; then
6814                 doublesize=`$run ./try`
6815                 echo "Your double is $doublesize bytes long."
6816         else
6817                 dflt='8'
6818                 echo "(I can't seem to compile the test program.  Guessing...)"
6819                 rp="What is the size of a double precision number (in bytes)?"
6820                 . ./myread
6821                 doublesize="$ans"
6822         fi
6823         ;;
6824 esac
6825 $rm_try
6826
6827 : see if this is a float.h system
6828 set float.h i_float
6829 eval $inhdr
6830
6831 echo " "
6832 $echo "Checking the kind of doubles you have..." >&4
6833 $cat <<EOP >try.c
6834 #$i_stdlib I_STDLIB
6835 #define DOUBLESIZE $doublesize
6836 #ifdef I_STDLIB
6837 #include <stdlib.h>
6838 #endif
6839 #include <stdio.h>
6840 static const double d = -0.1;
6841 int main() {
6842   unsigned const char* b = (unsigned const char*)(&d);
6843 #if DOUBLESIZE == 4
6844   if (b[0] == 0xCD && b[3] == 0xBD) {
6845     /* IEEE 754 32-bit little-endian */
6846     printf("1\n");
6847     exit(0);
6848   }
6849   if (b[0] == 0xBD && b[3] == 0xCD) {
6850     /* IEEE 754 32-bit big-endian */
6851     printf("2\n");
6852     exit(0);
6853   }
6854 #endif
6855 #if DOUBLESIZE == 8
6856   if (b[0] == 0x9A && b[7] == 0xBF) {
6857     /* IEEE 754 64-bit little-endian */
6858     printf("3\n");
6859     exit(0);
6860   }
6861   if (b[0] == 0xBF && b[7] == 0x9A) {
6862     /* IEEE 754 64-bit big-endian */
6863     printf("4\n");
6864     exit(0);
6865   }
6866   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
6867    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
6868     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
6869     * 99 99 b9 bf 9a 99 99 99 */
6870     printf("7\n");
6871     exit(0);
6872   }
6873   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
6874    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
6875     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
6876     * 99 99 99 9a bf b9 99 99 */
6877     printf("8\n");
6878     exit(0);
6879   }
6880 #endif
6881 #if DOUBLESIZE == 16
6882   if (b[0] == 0x9A && b[15] == 0xBF) {
6883     /* IEEE 754 128-bit little-endian */
6884     printf("5\n");
6885     exit(0);
6886   }
6887   if (b[0] == 0xBF && b[15] == 0x9A) {
6888     /* IEEE 754 128-bit big-endian */
6889     printf("6\n");
6890     exit(0);
6891   }
6892 #endif
6893   /* Rumoredly some old ARM processors have 'mixed endian' doubles,
6894    * two 32-bit little endians stored in big-endian order. */
6895   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
6896    * Whether those environments can still build Perl is debatable. */
6897   printf("-1\n"); /* unknown */
6898   exit(0);
6899 }
6900 EOP
6901 set try
6902 if eval $compile; then
6903     doublekind=`$run ./try`
6904 else
6905     doublekind=-1
6906 fi
6907 case "$doublekind" in
6908 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
6909 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
6910 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
6911 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
6912 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
6913 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
6914 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
6915 esac
6916 $rm_try
6917
6918 : check for long doubles
6919 echo " "
6920 echo "Checking to see if you have long double..." >&4
6921 echo 'int main() { long double x = 7.0; }' > try.c
6922 set try
6923 if eval $compile; then
6924         val="$define"
6925         echo "You have long double."
6926 else
6927         val="$undef"
6928         echo "You do not have long double."
6929 fi
6930 $rm_try
6931 set d_longdbl
6932 eval $setvar
6933
6934 : see if ldexpl exists
6935 set ldexpl d_ldexpl
6936 eval $inlibc
6937
6938 : see if this is a quadmath.h system
6939 set quadmath.h i_quadmath
6940 eval $inhdr
6941
6942 : check for length of long double
6943 case "${d_longdbl}${longdblsize}" in
6944 $define)
6945         echo " "
6946         echo "Checking to see how big your long doubles are..." >&4
6947         $cat >try.c <<'EOCP'
6948 #include <stdio.h>
6949 int main()
6950 {
6951         printf("%d\n", sizeof(long double));
6952 }
6953 EOCP
6954         set try
6955         set try
6956         if eval $compile; then
6957                 longdblsize=`$run ./try`
6958                 echo "Your long doubles are $longdblsize bytes long."
6959         else
6960                 dflt='8'
6961                 echo " "
6962                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6963                 rp="What is the size of a long double (in bytes)?"
6964                 . ./myread
6965                 longdblsize="$ans"
6966         fi
6967         if $test "X$doublesize" = "X$longdblsize"; then
6968                 echo "That isn't any different from an ordinary double."
6969                 echo "I'll keep your setting anyway, but you may see some"
6970                 echo "harmless compilation warnings."
6971         fi
6972         ;;
6973 esac
6974 $rm_try
6975
6976 echo " "
6977 $echo "Checking the kind of long doubles you have..." >&4
6978 case "$d_longdbl" in
6979 define)
6980 $cat <<EOP >try.c
6981 #$i_float I_FLOAT
6982 #$i_stdlib I_STDLIB
6983 #define LONGDBLSIZE $longdblsize
6984 #define DOUBLESIZE $doublesize
6985 #ifdef I_FLOAT
6986 #include <float.h>
6987 #endif
6988 #ifdef I_STDLIB
6989 #include <stdlib.h>
6990 #endif
6991 static const long double d = -0.1L;
6992 #include <stdio.h>
6993 int main() {
6994   unsigned const char* b = (unsigned const char*)(&d);
6995 #if DOUBLESIZE == LONGDBLSIZE
6996   printf("0\n"); /* if it floats like double */
6997   exit(0);
6998 #endif
6999 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
7000   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
7001     /* IEEE 754 128-bit little-endian */
7002     printf("1\n");
7003     exit(0);
7004   }
7005   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
7006     /* IEEE 128-bit big-endian, e.g. solaris sparc */
7007     printf("2\n");
7008     exit(0);
7009   }
7010 #endif
7011 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
7012  * while 64-bits platforms have it in 16 bytes. */
7013 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
7014   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
7015     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
7016      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
7017      * Also known as "extended precision". */
7018     printf("3\n");
7019     exit(0);
7020   }
7021   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
7022     /* is there ever big-endian 80-bit, really? */
7023     printf("4\n");
7024     exit(0);
7025   }
7026 #endif
7027 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
7028   /* software "double double", the 106 is 53+53.
7029    * but irix thinks it is 107. */
7030   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
7031     /* double double 128-bit little-endian,
7032      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
7033     printf("5\n");
7034     exit(0);
7035   }
7036   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7037     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
7038      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7039     printf("6\n");
7040     exit(0);
7041   }
7042 #endif
7043   printf("-1\n"); /* unknown */
7044   exit(0);
7045 }
7046 EOP
7047 set try
7048 if eval $compile; then
7049     longdblkind=`$run ./try`
7050 else
7051     longdblkind=-1
7052 fi
7053 ;;
7054 *) longdblkind=0 ;;
7055 esac
7056 case "$longdblkind" in
7057 0) echo "Your long doubles are doubles." >&4 ;;
7058 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7059 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7060 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7061 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7062 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
7063 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
7064 *) echo "Cannot figure out your long double." >&4 ;;
7065 esac
7066 $rm_try
7067
7068 : Check print/scan long double stuff
7069 echo " "
7070
7071 if $test X"$d_longdbl" = X"$define"; then
7072
7073 echo "Checking how to print long doubles..." >&4
7074
7075 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7076         $cat >try.c <<'EOCP'
7077 #include <sys/types.h>
7078 #include <stdio.h>
7079 int main() {
7080   double d = 123.456;
7081   printf("%.3f\n", d);
7082 }
7083 EOCP
7084         set try
7085         if eval $compile; then
7086                 yyy=`$run ./try`
7087                 case "$yyy" in
7088                 123.456)
7089                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7090                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
7091                         echo "We will use %f."
7092                         ;;
7093                 esac
7094         fi
7095 fi
7096
7097 if $test X"$sPRIfldbl" = X; then
7098         $cat >try.c <<'EOCP'
7099 #include <sys/types.h>
7100 #include <stdio.h>
7101 int main() {
7102   long double d = 123.456;
7103   printf("%.3Lf\n", d);
7104 }
7105 EOCP
7106         set try
7107         if eval $compile; then
7108                 yyy=`$run ./try`
7109                 case "$yyy" in
7110                 123.456)
7111                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7112                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
7113                         echo "We will use %Lf."
7114                         ;;
7115                 esac
7116         fi
7117 fi
7118
7119 if $test X"$sPRIfldbl" = X; then
7120         $cat >try.c <<'EOCP'
7121 #include <sys/types.h>
7122 #include <stdio.h>
7123 int main() {
7124   long double d = 123.456;
7125   printf("%.3llf\n", d);
7126 }
7127 EOCP
7128         set try
7129         if eval $compile; then
7130                 yyy=`$run ./try`
7131                 case "$yyy" in
7132                 123.456)
7133                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7134                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
7135                         echo "We will use %llf."
7136                         ;;
7137                 esac
7138         fi
7139 fi
7140
7141 if $test X"$sPRIfldbl" = X; then
7142         $cat >try.c <<'EOCP'
7143 #include <sys/types.h>
7144 #include <stdio.h>
7145 int main() {
7146   long double d = 123.456;
7147   printf("%.3lf\n", d);
7148 }
7149 EOCP
7150         set try
7151         if eval $compile; then
7152                 yyy=`$run ./try`
7153                 case "$yyy" in
7154                 123.456)
7155                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7156                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
7157                         echo "We will use %lf."
7158                         ;;
7159                 esac
7160         fi
7161 fi
7162
7163 if $test X"$sPRIfldbl" = X; then
7164         echo "Cannot figure out how to print long doubles." >&4
7165 else
7166         sSCNfldbl=$sPRIfldbl    # expect consistency
7167 fi
7168
7169 $rm_try
7170
7171 fi # d_longdbl
7172
7173 case "$sPRIfldbl" in
7174 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
7175         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
7176         d_SCNfldbl="$undef";
7177         ;;
7178 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
7179         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
7180         d_SCNfldbl="$define";
7181         ;;
7182 esac
7183
7184 : Before committing on uselongdouble, see whether that looks sane.
7185 if $test "$uselongdouble" = "$define"; then
7186     message=""
7187     echo " "
7188     echo "Checking if your long double math functions work right..." >&4
7189     $cat > try.c <<EOF
7190 #include <math.h>
7191 #include <stdio.h>
7192 int main() {
7193   printf("%"$sPRIgldbl"\n", sqrtl(logl(expl(cosl(sinl(0.0L))))+powl(2.0L, 3.0L)));
7194 }
7195 EOF
7196     case "$osname:$gccversion" in
7197     aix:)       saveccflags="$ccflags"
7198                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
7199     esac
7200     set try
7201     if eval $compile_ok; then
7202       yyy=`$run ./try`
7203     fi
7204     case "$yyy" in
7205     3) echo "Your long double math functions are working correctly." >&4 ;;
7206     *) echo "Your long double math functions are broken, not using long doubles." >&4
7207        uselongdouble=$undef
7208        ;;
7209     esac
7210     $rm_try
7211     case "$osname:$gccversion" in
7212     aix:)       ccflags="$saveccflags" ;; # restore
7213     esac
7214 fi
7215
7216 : determine the architecture name
7217 echo " "
7218 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7219         tarch=`arch`"-$osname"
7220 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7221         if uname -m > tmparch 2>&1 ; then
7222                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7223                         -e 's/$/'"-$osname/" tmparch`
7224         else
7225                 tarch="$osname"
7226         fi
7227         $rm -f tmparch
7228 else
7229         tarch="$osname"
7230 fi
7231 case "$myarchname" in
7232 ''|"$tarch") ;;
7233 *)
7234         echo "(Your architecture name used to be $myarchname.)"
7235         archname=''
7236         ;;
7237 esac
7238 case "$targetarch" in
7239 '') ;;
7240 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7241 esac
7242 myarchname="$tarch"
7243 case "$archname" in
7244 '') dflt="$tarch";;
7245 *) dflt="$archname";;
7246 esac
7247 rp='What is your architecture name'
7248 . ./myread
7249 archname="$ans"
7250
7251 : optionally add API version to the architecture for versioned archlibs
7252 case "$useversionedarchname" in
7253 $define|true|[yY]*) dflt='y';;
7254 *)                  dflt='n';;
7255 esac
7256 rp='Add the Perl API version to your archname?'
7257 . ./myread
7258 case "$ans" in
7259 y|Y)    useversionedarchname="$define" ;;
7260 *)      useversionedarchname="$undef" ;;
7261 esac
7262 case "$useversionedarchname" in
7263 $define)
7264         case "$archname" in
7265         *-$api_versionstring)
7266                 echo "...and architecture name already has -$api_versionstring" >&4
7267                 ;;
7268         *)
7269                 archname="$archname-$api_versionstring"
7270                 echo "...setting architecture name to $archname." >&4
7271                 ;;
7272         esac
7273         ;;
7274 esac
7275
7276 case "$usethreads" in
7277 $define)
7278         echo "Threads selected." >&4
7279         case "$archname" in
7280         *-thread*) echo "...and architecture name already has -thread." >&4
7281                 ;;
7282         *)      archname="$archname-thread"
7283                 echo "...setting architecture name to $archname." >&4
7284                 ;;
7285         esac
7286         ;;
7287 esac
7288 case "$usemultiplicity" in
7289 $define)
7290         echo "Multiplicity selected." >&4
7291         case "$archname" in
7292         *-multi*) echo "...and architecture name already has -multi." >&4
7293                 ;;
7294         *)      archname="$archname-multi"
7295                 echo "...setting architecture name to $archname." >&4
7296                 ;;
7297         esac
7298         ;;
7299 esac
7300 case "$use64bitint$use64bitall" in
7301 *"$define"*)
7302         case "$archname64" in
7303         '')
7304                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7305                 ;;
7306         *)
7307                 case "$use64bitint" in
7308                 "$define") echo "64 bit integers selected." >&4 ;;
7309                 esac
7310                 case "$use64bitall" in
7311                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7312                 esac
7313                 case "$archname" in
7314                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7315                         ;;
7316                 *)      archname="$archname-$archname64"
7317                         echo "...setting architecture name to $archname." >&4
7318                         ;;
7319                 esac
7320                 ;;
7321         esac
7322 esac
7323 case "$uselongdouble" in
7324 $define)
7325         echo "Long doubles selected." >&4
7326         case "$longdblsize" in
7327         $doublesize)
7328                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7329                 ;;
7330         *)
7331                 case "$archname" in
7332                 *-ld*) echo "...and architecture name already has -ld." >&4
7333                         ;;
7334                 *)      archname="$archname-ld"
7335                         echo "...setting architecture name to $archname." >&4
7336                         ;;
7337                 esac
7338                 ;;
7339         esac
7340         ;;
7341 esac
7342 case "$usequadmath" in
7343 $define)
7344         echo "quadmath selected." >&4
7345         case "$archname" in
7346         *-ld*) echo "...and architecture name already has -quadmath." >&4
7347                 ;;
7348         *)      archname="$archname-quadmath"
7349                 echo "...setting architecture name to $archname." >&4
7350                 ;;
7351         esac
7352         ;;
7353 esac
7354 if $test -f archname.cbu; then
7355         echo "Your platform has some specific hints for architecture name, using them..."
7356         . ./archname.cbu
7357 fi
7358
7359 : set the prefixit variable, to compute a suitable default value
7360 prefixit='case "$3" in
7361 ""|none)
7362         case "$oldprefix" in
7363         "") eval "$1=\"\$$2\"";;
7364         *)
7365                 case "$3" in
7366                 "") eval "$1=";;
7367                 none)
7368                         eval "tp=\"\$$2\"";
7369                         case "$tp" in
7370                         ""|" ") eval "$1=\"\$$2\"";;
7371                         *) eval "$1=";;
7372                         esac;;
7373                 esac;;
7374         esac;;
7375 *)
7376         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7377         case "$tp" in
7378         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7379         /*-$oldprefix/*|\~*-$oldprefix/*)
7380                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7381         *) eval "$1=\"\$$2\"";;
7382         esac;;
7383 esac'
7384
7385 : determine installation style
7386 : For now, try to deduce it from prefix unless it is already set.
7387 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7388 case "$installstyle" in
7389 '')     case "$prefix" in
7390                 *perl*) dflt='lib';;
7391                 *) dflt='lib/perl5' ;;
7392         esac
7393         ;;
7394 *)      dflt="$installstyle" ;;
7395 esac
7396 : Probably not worth prompting for this since we prompt for all
7397 : the directories individually, and the prompt would be too long and
7398 : confusing anyway.
7399 installstyle=$dflt
7400
7401 : determine where public executables go
7402 echo " "
7403 set dflt bin bin
7404 eval $prefixit
7405 fn=d~
7406 rp='Pathname where the public executables will reside?'
7407 . ./getfile
7408 if $test "X$ansexp" != "X$binexp"; then
7409         installbin=''
7410 fi
7411 prefixvar=bin
7412 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7413 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7414 :     this via initialinstalllocation
7415 . ./setprefixvar
7416
7417 case "$userelocatableinc" in
7418 $define|true|[yY]*)     dflt='y' ;;
7419 *)                      dflt='n' ;;
7420 esac
7421 cat <<EOM
7422
7423 Would you like to build Perl so that the installation is relocatable, so that
7424 library paths in @INC are determined relative to the path of the perl binary?
7425 This is not advised for system Perl installs, or if you need to run setid
7426 scripts or scripts under taint mode.
7427
7428 If this doesn't make any sense to you, just accept the default '$dflt'.
7429 EOM
7430 rp='Use relocatable @INC?'
7431 . ./myread
7432 case "$ans" in
7433 y|Y)    val="$define" ;;
7434 *)      val="$undef"  ;;
7435 esac
7436 set userelocatableinc
7437 eval $setvar
7438
7439 initialinstalllocation="$binexp"
7440 : Default prefix is now "up one level from where the binaries are"
7441 case "$userelocatableinc" in
7442 $define|true|[yY]*)
7443     bin=".../"
7444     binexp=".../"
7445     prefix=".../.."
7446     prefixexp=".../.."
7447     installprefixexp=".../.."
7448     ;;
7449 esac
7450
7451 : determine where private library files go
7452 : Usual default is /usr/local/lib/perl5/$version.
7453 : Also allow things like /opt/perl/lib/$version, since
7454 : /opt/perl/lib/perl5... would be redundant.
7455 : The default "style" setting is made in installstyle.U
7456 case "$installstyle" in
7457 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7458 *)       set dflt privlib lib/$version ;;
7459 esac
7460 eval $prefixit
7461 $cat <<EOM
7462
7463 There are some auxiliary files for $package that need to be put into a
7464 private library directory that is accessible by everyone.
7465
7466 EOM
7467 fn=$binexp
7468 fn=d~+
7469 rp='Pathname where the private library files will reside?'
7470 . ./getfile
7471 prefixvar=privlib
7472 . ./setprefixvar
7473
7474 : set the prefixup variable, to restore leading tilda escape
7475 prefixup='case "$prefixexp" in
7476 "$prefix") ;;
7477 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7478 esac'
7479
7480 : determine where public architecture dependent libraries go
7481 set archlib archlib
7482 eval $prefixit
7483 : privlib default is /usr/local/lib/$package/$version
7484 : archlib default is /usr/local/lib/$package/$version/$archname
7485 : privlib may have an optional trailing /share.
7486 tdflt=`echo $privlib | $sed 's,/share$,,'`
7487 tdflt=$tdflt/$archname
7488 case "$archlib" in
7489 '')     dflt=$tdflt
7490         ;;
7491 *)      dflt="$archlib"
7492     ;;
7493 esac
7494 $cat <<EOM
7495
7496 $spackage contains architecture-dependent library files.  If you are
7497 sharing libraries in a heterogeneous environment, you might store
7498 these files in a separate location.  Otherwise, you can just include
7499 them with the rest of the public library files.
7500
7501 EOM
7502 fn=$binexp
7503 fn=d+~
7504 rp='Where do you want to put the public architecture-dependent libraries?'
7505 . ./getfile
7506 prefixvar=archlib
7507 . ./setprefixvar
7508 if $test X"$archlib" = X"$privlib"; then
7509         d_archlib="$undef"
7510 else
7511         d_archlib="$define"
7512 fi
7513
7514 : see if setuid scripts can be secure
7515 $cat <<EOM
7516
7517 Some kernels have a bug that prevents setuid #! scripts from being
7518 secure.  Some sites have disabled setuid #! scripts because of this.
7519
7520 First let's decide if your kernel supports secure setuid #! scripts.
7521 (If setuid #! scripts would be secure but have been disabled anyway,
7522 don't say that they are secure if asked.)
7523
7524 EOM
7525
7526 val="$undef"
7527 if $test -d /dev/fd; then
7528         echo "#!$ls" >reflect
7529         chmod +x,u+s reflect
7530         ./reflect >flect 2>&1
7531         if $contains "/dev/fd" flect >/dev/null; then
7532                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7533                 val="$define"
7534         else
7535                 $cat <<EOM
7536 If you are not sure if they are secure, I can check but I'll need a
7537 username and password different from the one you are using right now.
7538 If you don't have such a username or don't want me to test, simply
7539 enter 'none'.
7540
7541 EOM
7542                 rp='Other username to test security of setuid scripts with?'
7543                 dflt='none'
7544                 . ./myread
7545                 case "$ans" in
7546                 n|none)
7547                         case "$d_suidsafe" in
7548                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7549                                 dflt=n;;
7550                         "$undef")
7551                                 echo "Well, the $hint value is *not* secure." >&4
7552                                 dflt=n;;
7553                         *)      echo "Well, the $hint value *is* secure." >&4
7554                                 dflt=y;;
7555                         esac
7556                         ;;
7557                 *)
7558                         $rm -f reflect flect
7559                         echo "#!$ls" >reflect
7560                         chmod +x,u+s reflect
7561                         echo >flect
7562                         chmod a+w flect
7563                         echo '"su" will (probably) prompt you for '"$ans's password."
7564                         su $ans -c './reflect >flect'
7565                         if $contains "/dev/fd" flect >/dev/null; then
7566                                 echo "Okay, it looks like setuid scripts are secure." >&4
7567                                 dflt=y
7568                         else
7569                                 echo "I don't think setuid scripts are secure." >&4
7570                                 dflt=n
7571                         fi
7572                         ;;
7573                 esac
7574                 rp='Does your kernel have *secure* setuid scripts?'
7575                 . ./myread
7576                 case "$ans" in
7577                 [yY]*)  val="$define";;
7578                 *)      val="$undef";;
7579                 esac
7580         fi
7581 else
7582         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7583         echo "(That's for file descriptors, not floppy disks.)"
7584         val="$undef"
7585 fi
7586 set d_suidsafe
7587 eval $setvar
7588
7589 $rm -f reflect flect
7590
7591 : now see if they want to do setuid emulation
7592 if $test $patchlevel -lt 11; then
7593 echo " "
7594 val="$undef"
7595 case "$d_suidsafe" in
7596 "$define")
7597         val="$undef"
7598         echo "No need to emulate SUID scripts since they are secure here." >&4
7599         ;;
7600 *)
7601         $cat <<EOM
7602 Some systems have disabled setuid scripts, especially systems where
7603 setuid scripts cannot be secure.  On systems where setuid scripts have
7604 been disabled, the setuid/setgid bits on scripts are currently
7605 useless.  It is possible for $package to detect those bits and emulate
7606 setuid/setgid in a secure fashion.  This emulation will only work if
7607 setuid scripts have been disabled in your kernel.
7608
7609 EOM
7610         case "$d_dosuid" in
7611         "$define") dflt=y ;;
7612         *) dflt=n ;;
7613         esac
7614         rp="Do you want to do setuid/setgid emulation?"
7615         . ./myread
7616         case "$ans" in
7617         [yY]*)  val="$define";;
7618         *)      val="$undef";;
7619         esac
7620         ;;
7621 esac
7622 set d_dosuid
7623 eval $setvar
7624 else
7625     case "$d_dosuid" in
7626         "$define")
7627         cat >&4 <<EOH
7628
7629 SUID emulation has been removed for 5.12
7630 Please re-run Configure without -Dd_dosuid
7631
7632 EOH
7633         exit 1;
7634         ;;
7635     esac
7636     d_dosuid=undef
7637 fi
7638
7639 : Find perl5.005 or later.
7640 echo "Looking for a previously installed perl5.005 or later... "
7641 case "$perl5" in
7642 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7643                 : Check if this perl is recent and can load a simple module
7644                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7645                         perl5=$tdir/perl
7646                         break;
7647                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7648                         perl5=$tdir/perl5
7649                         break;
7650                 fi
7651         done
7652         ;;
7653 *)      perl5="$perl5"
7654         ;;
7655 esac
7656 case "$perl5" in
7657 '')     echo "None found.  That's ok.";;
7658 *)      echo "Using $perl5." ;;
7659 esac
7660
7661 : Set the siteprefix variables
7662 $cat <<EOM
7663
7664 After $package is installed, you may wish to install various
7665 add-on modules and utilities.  Typically, these add-ons will
7666 be installed under $prefix with the rest
7667 of this package.  However, you may wish to install such add-ons
7668 elsewhere under a different prefix.
7669
7670 If you do not wish to put everything under a single prefix, that's
7671 ok.  You will be prompted for the individual locations; this siteprefix
7672 is only used to suggest the defaults.
7673
7674 The default should be fine for most people.
7675
7676 EOM
7677 fn=d~+
7678 rp='Installation prefix to use for add-on modules and utilities?'
7679 : XXX Here might be another good place for an installstyle setting.
7680 case "$siteprefix" in
7681 '') dflt=$prefix ;;
7682 *)  dflt=$siteprefix ;;
7683 esac
7684 . ./getfile
7685 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7686 oldsiteprefix=''
7687 case "$siteprefix" in
7688 '') ;;
7689 *)      case "$ans" in
7690         "$prefix") ;;
7691         *) oldsiteprefix="$prefix";;
7692         esac
7693         ;;
7694 esac
7695 siteprefix="$ans"
7696 siteprefixexp="$ansexp"
7697
7698 : determine where site specific libraries go.
7699 : Usual default is /usr/local/lib/perl5/site_perl/$version
7700 : The default "style" setting is made in installstyle.U
7701 : XXX No longer works with Prefixit stuff.
7702 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7703 case "$sitelib" in
7704 '') case "$installstyle" in
7705         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7706         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7707         esac
7708         ;;
7709 *)      dflt="$sitelib"
7710         ;;
7711 esac
7712 $cat <<EOM
7713
7714 The installation process will create a directory for
7715 site-specific extensions and modules.  Most users find it convenient
7716 to place all site-specific files in this directory rather than in the
7717 main distribution directory.
7718
7719 EOM
7720 fn=d~+
7721 rp='Pathname for the site-specific library files?'
7722 . ./getfile
7723 prefixvar=sitelib
7724 . ./setprefixvar
7725 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7726
7727 : Determine list of previous versions to include in @INC
7728 $cat > getverlist <<EOPL
7729 #!$perl5 -w
7730 use File::Basename;
7731 \$api_versionstring = "$api_versionstring";
7732 \$version = "$version";
7733 \$stem = "$sitelib_stem";
7734 \$archname = "$archname";
7735 EOPL
7736         $cat >> getverlist <<'EOPL'
7737 # The list found is store twice for each entry: the original name, and
7738 # the binary broken down version as pack "sss", so sorting is easy and
7739 # unambiguous. This will work for all versions that have a maximum of
7740 # three digit groups, separate by '.'s or '_'s. Names are extended with
7741 # ".0.0" to ensure at least three elements for the pack.
7742 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7743
7744 # Can't have leading @ because metaconfig interprets it as a command!
7745 ;@inc_version_list=();
7746 # XXX Redo to do opendir/readdir?
7747 if (-d $stem) {
7748     chdir($stem);
7749     ;@candidates = map {
7750         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7751     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7752 }
7753 else {
7754     ;@candidates = ();
7755 }
7756
7757 ($pversion, $aversion, $vsn5005) = map {
7758     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7759 foreach $d (@candidates) {
7760     if ($d->[1] lt $pversion) {
7761         if ($d->[1] ge $aversion) {
7762             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7763         }
7764         elsif ($d->[1] ge $vsn5005) {
7765             unshift(@inc_version_list, grep { -d } $d->[0]);
7766         }
7767     }
7768     else {
7769         # Skip newer version.  I.e. don't look in
7770         # 5.7.0 if we're installing 5.6.1.
7771     }
7772 }
7773
7774 if (@inc_version_list) {
7775     print join(' ', @inc_version_list);
7776 }
7777 else {
7778     # Blank space to preserve value for next Configure run.
7779     print " ";
7780 }
7781 EOPL
7782 chmod +x getverlist
7783 case "$inc_version_list" in
7784 '')     if test -x "$perl5$exe_ext"; then
7785                 dflt=`$perl5 getverlist`
7786         else
7787                 dflt='none'
7788         fi
7789         ;;
7790 $undef) dflt='none' ;;
7791 *)  eval dflt=\"$inc_version_list\" ;;
7792 esac
7793 case "$dflt" in
7794 ''|' ') dflt=none ;;
7795 esac
7796 case "$dflt" in
7797 5.005) dflt=none ;;
7798 esac
7799 $cat <<EOM
7800
7801 In order to ease the process of upgrading, this version of perl
7802 can be configured to use modules built and installed with earlier
7803 versions of perl that were installed under $prefix.  Specify here
7804 the list of earlier versions that this version of perl should check.
7805 If Configure detected no earlier versions of perl installed under
7806 $prefix, then the list will be empty.  Answer 'none' to tell perl
7807 to not search earlier versions.
7808
7809 The default should almost always be sensible, so if you're not sure,
7810 just accept the default.
7811 EOM
7812
7813 rp='List of earlier versions to include in @INC?'
7814 . ./myread
7815 case "$ans" in
7816 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7817 *) inc_version_list="$ans" ;;
7818 esac
7819 case "$inc_version_list" in
7820 ''|' ')
7821         inc_version_list_init='0'
7822         d_inc_version_list="$undef"
7823         ;;
7824 *)      inc_version_list_init=`echo $inc_version_list |
7825                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7826         d_inc_version_list="$define"
7827         ;;
7828 esac
7829 $rm -f getverlist
7830
7831 : see if malloc/malloc.h has to be included
7832 set malloc/malloc.h i_mallocmalloc
7833 eval $inhdr
7834
7835 : see if this is a malloc.h system
7836 : we want a real compile instead of Inhdr because some systems have a
7837 : malloc.h that just gives a compile error saying to use stdlib.h instead
7838 echo " "
7839 $cat >try.c <<EOCP
7840 #include <stdlib.h>
7841 #include <malloc.h>
7842 #$i_mallocmalloc I_MALLOCMALLOC
7843 #ifdef I_MALLOCMALLOC
7844 # include <malloc/malloc.h>
7845 #endif
7846
7847 int main () { return 0; }
7848 EOCP
7849 set try
7850 if eval $compile; then
7851     echo "<malloc.h> found." >&4
7852     val="$define"
7853 else
7854     echo "<malloc.h> NOT found." >&4
7855     val="$undef"
7856 fi
7857 $rm_try
7858 set i_malloc
7859 eval $setvar
7860
7861 : check for length of pointer
7862 echo " "
7863 case "$ptrsize" in
7864 '')
7865         echo "Checking to see how big your pointers are..." >&4
7866         $cat >>try.c <<EOCP
7867 #include <stdio.h>
7868 #$i_stdlib I_STDLIB
7869 #ifdef I_STDLIB
7870 #include <stdlib.h>
7871 #endif
7872 int main()
7873 {
7874     printf("%d\n", (int)sizeof(void *));
7875     exit(0);
7876 }
7877 EOCP
7878         set try
7879         if eval $compile_ok; then
7880                 ptrsize=`$run ./try`
7881                 echo "Your pointers are $ptrsize bytes long."
7882         else
7883                 dflt='4'
7884                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7885                 rp="What is the size of a pointer (in bytes)?"
7886                 . ./myread
7887                 ptrsize="$ans"
7888         fi
7889         ;;
7890 esac
7891 $rm_try
7892 case "$use64bitall" in
7893 "$define"|true|[yY]*)
7894         case "$ptrsize" in
7895         4)      cat <<EOM >&4
7896
7897 *** You have chosen a maximally 64-bit build,
7898 *** but your pointers are only 4 bytes wide.
7899 *** Please rerun Configure without -Duse64bitall.
7900 EOM
7901                 case "$d_quad" in
7902                 define)
7903                         cat <<EOM >&4
7904 *** Since you have quads, you could possibly try with -Duse64bitint.
7905 EOM
7906                         ;;
7907                 esac
7908                 cat <<EOM >&4
7909 *** Cannot continue, aborting.
7910
7911 EOM
7912
7913                 exit 1
7914                 ;;
7915         esac
7916         ;;
7917 esac
7918
7919
7920 : determine whether to use malloc wrapping
7921 echo " "
7922 case "$usemallocwrap" in
7923 [yY]*|true|$define)     dflt='y' ;;
7924 [nN]*|false|$undef)     dflt='n' ;;
7925 *)      case "$usedevel" in
7926         [yY]*|true|$define)     dflt='y' ;;
7927         *) dflt='n' ;;
7928         esac
7929         ;;
7930 esac
7931 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7932 . ./myread
7933 usemallocwrap="$ans"
7934 case "$ans" in
7935 y*|true)
7936         usemallocwrap="$define" ;;
7937 *)
7938         usemallocwrap="$undef" ;;
7939 esac
7940
7941 : determine which malloc to compile in
7942 echo " "
7943 case "$usemymalloc" in
7944 [yY]*|true|$define)     dflt='y' ;;
7945 [nN]*|false|$undef)     dflt='n' ;;
7946 *)      case "$ptrsize" in
7947         4) dflt='y' ;;
7948         *) dflt='n' ;;
7949         esac
7950         if test "$useithreads" = "$define"; then dflt='n'; fi
7951         ;;
7952 esac
7953 rp="Do you wish to attempt to use the malloc that comes with $package?"
7954 . ./myread
7955 usemymalloc="$ans"
7956 case "$ans" in
7957 y*|true)
7958         usemymalloc='y'
7959         mallocsrc='malloc.c'
7960         mallocobj="malloc$_o"
7961         d_mymalloc="$define"
7962         case "$libs" in
7963         *-lmalloc*)
7964                 : Remove malloc from list of libraries to use
7965                 echo "Removing unneeded -lmalloc from library list" >&4
7966                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7967                 shift
7968                 libs="$*"
7969                 echo "libs = $libs" >&4
7970                 ;;
7971         esac
7972         ;;
7973 *)
7974         usemymalloc='n'
7975         mallocsrc=''
7976         mallocobj=''
7977         d_mymalloc="$undef"
7978         ;;
7979 esac
7980
7981 : compute the return types of malloc and free
7982 echo " "
7983 $cat >malloc.c <<END
7984 #$i_malloc I_MALLOC
7985 #$i_stdlib I_STDLIB
7986 #include <stdio.h>
7987 #include <sys/types.h>
7988 #ifdef I_MALLOC
7989 #include <malloc.h>
7990 #endif
7991 #ifdef I_STDLIB
7992 #include <stdlib.h>
7993 #endif
7994 #ifdef TRY_MALLOC
7995 void *malloc();
7996 #endif
7997 #ifdef TRY_FREE
7998 void free();
7999 #endif
8000 END
8001 case "$malloctype" in
8002 '')
8003         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
8004                 malloctype='void *'
8005         else
8006                 malloctype='char *'
8007         fi
8008         ;;
8009 esac
8010 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
8011
8012 case "$freetype" in
8013 '')
8014         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
8015                 freetype='void'
8016         else
8017                 freetype='int'
8018         fi
8019         ;;
8020 esac
8021 echo "Your system uses $freetype free(), it would seem." >&4
8022 $rm -f malloc.[co]
8023 : determine where site specific architecture-dependent libraries go.
8024 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
8025 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
8026 : sitelib may have an optional trailing /share.
8027 case "$sitearch" in
8028 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
8029         dflt="$dflt/$archname"
8030         ;;
8031 *)      dflt="$sitearch"
8032         ;;
8033 esac
8034 set sitearch sitearch none
8035 eval $prefixit
8036 $cat <<EOM
8037
8038 The installation process will also create a directory for
8039 architecture-dependent site-specific extensions and modules.
8040
8041 EOM
8042 fn=d~+
8043 rp='Pathname for the site-specific architecture-dependent library files?'
8044 . ./getfile
8045 prefixvar=sitearch
8046 . ./setprefixvar
8047 if $test X"$sitearch" = X"$sitelib"; then
8048         d_sitearch="$undef"
8049 else
8050         d_sitearch="$define"
8051 fi
8052
8053 : Set the vendorprefix variables
8054 $cat <<EOM
8055
8056 The installation process will also create a directory for
8057 vendor-supplied add-ons.  Vendors who supply perl with their system
8058 may find it convenient to place all vendor-supplied files in this
8059 directory rather than in the main distribution directory.  This will
8060 ease upgrades between binary-compatible maintenance versions of perl.
8061
8062 Of course you may also use these directories in whatever way you see
8063 fit.  For example, you might use them to access modules shared over a
8064 company-wide network.
8065
8066 The default answer should be fine for most people.
8067 This causes further questions about vendor add-ons to be skipped
8068 and no vendor-specific directories will be configured for perl.
8069
8070 EOM
8071 rp='Do you want to configure vendor-specific add-on directories?'
8072 case "$usevendorprefix" in
8073 define|true|[yY]*) dflt=y ;;
8074 *)      : User may have set vendorprefix directly on Configure command line.
8075         case "$vendorprefix" in
8076         ''|' ') dflt=n ;;
8077         *)      dflt=y ;;
8078         esac
8079         ;;
8080 esac
8081 . ./myread
8082 case "$ans" in
8083 [yY]*)  fn=d~+
8084         rp='Installation prefix to use for vendor-supplied add-ons?'
8085         case "$vendorprefix" in
8086         '') dflt="$prefix" ;;
8087         *)  dflt=$vendorprefix ;;
8088         esac
8089         . ./getfile
8090         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
8091         oldvendorprefix=''
8092         case "$vendorprefix" in
8093         '') ;;
8094         *)      case "$ans" in
8095                 "$prefix") ;;
8096                 *) oldvendorprefix="$prefix";;
8097                 esac
8098                 ;;
8099         esac
8100         usevendorprefix="$define"
8101         vendorprefix="$ans"
8102         vendorprefixexp="$ansexp"
8103         ;;
8104 *)      usevendorprefix="$undef"
8105         vendorprefix=''
8106         vendorprefixexp=''
8107         ;;
8108 esac
8109
8110 : Set the vendorlib variables
8111 case "$vendorprefix" in
8112 '')     d_vendorlib="$undef"
8113         vendorlib=''
8114         vendorlibexp=''
8115         ;;
8116 *)      d_vendorlib="$define"
8117         : determine where vendor-supplied modules go.
8118         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
8119         case "$vendorlib" in
8120         '')
8121                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8122                 case "$installstyle" in
8123                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
8124                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
8125                 esac
8126                 ;;
8127         *)      dflt="$vendorlib"
8128                 ;;
8129         esac
8130         fn=d~+
8131         rp='Pathname for the vendor-supplied library files?'
8132         . ./getfile
8133         vendorlib="$ans"
8134         vendorlibexp="$ansexp"
8135         ;;
8136 esac
8137 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
8138 prefixvar=vendorlib
8139 . ./installprefix
8140
8141 : Set the vendorarch variables
8142 case "$vendorprefix" in
8143 '')     d_vendorarch="$undef"
8144         vendorarch=''
8145         vendorarchexp=''
8146         ;;
8147 *)      d_vendorarch="$define"
8148         : determine where vendor-supplied architecture-dependent libraries go.
8149         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
8150         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
8151         : vendorlib may have an optional trailing /share.
8152         case "$vendorarch" in
8153         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
8154                 dflt="$dflt/$archname"
8155                 ;;
8156         *)      dflt="$vendorarch" ;;
8157         esac
8158         fn=d~+
8159         rp='Pathname for vendor-supplied architecture-dependent files?'
8160         . ./getfile
8161         vendorarch="$ans"
8162         vendorarchexp="$ansexp"
8163         ;;
8164 esac
8165 prefixvar=vendorarch
8166 . ./installprefix
8167 if $test X"$vendorarch" = X"$vendorlib"; then
8168         d_vendorarch="$undef"
8169 else
8170         d_vendorarch="$define"
8171 fi
8172
8173 : Final catch-all directories to search
8174 $cat <<EOM
8175
8176 Lastly, you can have perl look in other directories for extensions and
8177 modules in addition to those already specified.
8178 These directories will be searched after
8179         $sitearch
8180         $sitelib
8181 EOM
8182 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8183 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8184 echo ' '
8185 case "$otherlibdirs" in
8186 ''|' ') dflt='none' ;;
8187 *)      dflt="$otherlibdirs" ;;
8188 esac
8189 $cat <<EOM
8190 Enter a colon-separated set of extra paths to include in perl's @INC
8191 search path, or enter 'none' for no extra paths.
8192
8193 EOM
8194
8195 rp='Colon-separated list of additional directories for perl to search?'
8196 . ./myread
8197 case "$ans" in
8198 ' '|''|none)    otherlibdirs=' ' ;;
8199 *)      otherlibdirs="$ans" ;;
8200 esac
8201 case "$otherlibdirs" in
8202 ' ') val=$undef ;;
8203 *)      val=$define ;;
8204 esac
8205 set d_perl_otherlibdirs
8206 eval $setvar
8207
8208 : Cruising for prototypes
8209 echo " "
8210 echo "Checking out function prototypes..." >&4
8211 $cat >prototype.c <<EOCP
8212 #$i_stdlib I_STDLIB
8213 #ifdef I_STDLIB
8214 #include <stdlib.h>
8215 #endif
8216 int main(int argc, char *argv[]) {
8217         exit(0);}
8218 EOCP
8219 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8220         echo "Your C compiler appears to support function prototypes."
8221         val="$define"
8222 else
8223         echo "Your C compiler doesn't seem to understand function prototypes."
8224         val="$undef"
8225 fi
8226 set prototype
8227 eval $setvar
8228 $rm -f prototype*
8229
8230 : Check if ansi2knr is required
8231 case "$prototype" in
8232 "$define") ;;
8233 *)      ansi2knr='ansi2knr'
8234         echo " "
8235         cat <<EOM >&4
8236
8237 $me:  FATAL ERROR:
8238 This version of $package can only be compiled by a compiler that
8239 understands function prototypes.  Unfortunately, your C compiler
8240         $cc $ccflags
8241 doesn't seem to understand them.  Sorry about that.
8242
8243 If GNU cc is available for your system, perhaps you could try that instead.
8244
8245 Eventually, we hope to support building Perl with pre-ANSI compilers.
8246 If you would like to help in that effort, please contact <perlbug@perl.org>.
8247
8248 Aborting Configure now.
8249 EOM
8250         exit 2
8251         ;;
8252 esac
8253
8254 : DTrace support
8255 dflt_dtrace='/usr/sbin/dtrace'
8256 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8257
8258 cat <<EOM
8259
8260 Perl can be built to support DTrace on platforms that support it.
8261 DTrace is a diagnosis and performance analysis tool from Sun.
8262
8263 If this doesn't make any sense to you, just accept the default '$dflt'.
8264 EOM
8265
8266 while $test 1 ; do
8267         case "$usedtrace" in
8268         $define|true|[yY]*)
8269                 dflt='y'
8270                 ;;
8271         ?*)
8272                 dflt='y'
8273                 dflt_dtrace=$usedtrace
8274                 ;;
8275         *)
8276                 dflt='n'
8277                 ;;
8278         esac
8279
8280         rp='Support DTrace if available?'
8281         . ./myread
8282         case "$ans" in
8283         y|Y)    val="$define" ;;
8284         *)      val="$undef" ;;
8285         esac
8286         set usedtrace
8287         eval $setvar
8288
8289         test "X$usedtrace" != "X$define" && break
8290
8291         echo " "
8292         rp='Where is the dtrace executable?'
8293         dflt=$dflt_dtrace
8294         . ./getfile
8295         val="$ans"
8296         set dtrace
8297         eval $setvar
8298
8299         if $test -f $dtrace
8300         then
8301                 if $dtrace -h -s ../perldtrace.d \
8302                         -o perldtrace.tmp >/dev/null 2>&1 \
8303                         && rm -f perldtrace.tmp
8304                 then
8305                         echo " "
8306                         echo "Good: your $dtrace knows about the -h flag."
8307                 else
8308                         cat >&2 <<EOM
8309
8310 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8311 ***
8312 *** Your installed dtrace doesn't support the -h switch to compile a D
8313 *** program into a C header. Can't continue.
8314
8315 EOM
8316                         exit 1
8317                 fi
8318                 break;
8319         fi
8320
8321         case "$fastread" in
8322         yes)
8323                 cat >&2 <<EOM
8324
8325 *** $me:  Fatal Error:  $dtrace not found.
8326 *** Can't continue.
8327
8328 EOM
8329                 exit 1
8330                 ;;
8331         *)
8332                 echo "*** $dtrace was not found."
8333                 echo " "
8334                 ;;
8335         esac
8336 done
8337
8338 : See if we want extra modules installed
8339 echo " "
8340 case "$extras" in
8341 '') dflt='n';;
8342 *) dflt='y';;
8343 esac
8344 cat <<EOM
8345 Perl can be built with extra modules or bundles of modules which
8346 will be fetched from the CPAN and installed alongside Perl.
8347
8348 Notice that you will need access to the CPAN; either via the Internet,
8349 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8350 be asked later to configure the CPAN.pm module which will in turn do
8351 the installation of the rest of the extra modules or bundles.)
8352
8353 Notice also that if the modules require any external software such as
8354 libraries and headers (the libz library and the zlib.h header for the
8355 Compress::Zlib module, for example) you MUST have any such software
8356 already installed, this configuration process will NOT install such
8357 things for you.
8358
8359 If this doesn't make any sense to you, just accept the default '$dflt'.
8360 EOM
8361 rp='Install any extra modules (y or n)?'
8362 . ./myread
8363 case "$ans" in
8364 y|Y)
8365         cat <<EOM
8366
8367 Please list any extra modules or bundles to be installed from CPAN,
8368 with spaces between the names.  The names can be in any format the
8369 'install' command of CPAN.pm will understand.  (Answer 'none',
8370 without the quotes, to install no extra modules or bundles.)
8371 EOM
8372         rp='Extras?'
8373         dflt="$extras"
8374         . ./myread
8375         extras="$ans"
8376 esac
8377 case "$extras" in
8378 ''|'none')
8379         val=''
8380         $rm -f ../extras.lst
8381         ;;
8382 *)      echo "(Saving the list of extras for later...)"
8383         echo "$extras" > ../extras.lst
8384         val="'$extras'"
8385         ;;
8386 esac
8387 set extras
8388 eval $setvar
8389 echo " "
8390
8391 : determine where html pages for programs go
8392 set html1dir html1dir none
8393 eval $prefixit
8394 $cat <<EOM
8395
8396 If you wish to install html files for programs in $spackage, indicate
8397 the appropriate directory here.  To skip installing html files,
8398 answer "none".
8399 EOM
8400 case "$html1dir" in
8401 ''|none|$undef|' ') dflt=none ;;
8402 *) dflt=$html1dir ;;
8403 esac
8404 fn=dn+~
8405 rp="Directory for the main $spackage html pages?"
8406 . ./getfile
8407 prefixvar=html1dir
8408 . ./setprefixvar
8409 : Use ' ' for none so value is preserved next time through Configure
8410 $test X"$html1dir" = "X" && html1dir=' '
8411
8412 : determine where html pages for libraries and modules go
8413 set html3dir html3dir none
8414 eval $prefixit
8415 $cat <<EOM
8416
8417 If you wish to install html files for modules associated with $spackage,
8418 indicate the appropriate directory here.  To skip installing html files,
8419 answer "none".
8420 EOM
8421 : There is no obvious default.  If they have specified html1dir, then
8422 : try to key off that, possibly changing .../html1 into .../html3.
8423 case "$html3dir" in
8424 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8425 *) dflt=$html3dir ;;
8426 esac
8427 fn=dn+~
8428 rp="Directory for the $spackage module html pages?"
8429 . ./getfile
8430 prefixvar=html3dir
8431 . ./setprefixvar
8432 : Use ' ' for none so value is preserved next time through Configure
8433 $test X"$html3dir" = "X" && html3dir=' '
8434
8435 : determine whether to install perl also as /usr/bin/perl
8436
8437 echo " "
8438 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8439         $cat <<EOM
8440 Many scripts expect perl to be installed as /usr/bin/perl.
8441
8442 If you want to, I can install the perl you are about to compile
8443 as /usr/bin/perl (in addition to $bin/perl).
8444 EOM
8445         if test -f /usr/bin/perl; then
8446             $cat <<EOM
8447
8448 However, please note that because you already have a /usr/bin/perl,
8449 overwriting that with a new Perl would very probably cause problems.
8450 Therefore I'm assuming you don't want to do that (unless you insist).
8451
8452 EOM
8453             case "$installusrbinperl" in
8454             "$define"|[yY]*)    dflt='y';;
8455             *)                  dflt='n';;
8456             esac
8457         else
8458             $cat <<EOM
8459
8460 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8461
8462 EOM
8463             case "$installusrbinperl" in
8464             "$undef"|[nN]*)     dflt='n';;
8465             *)                  dflt='y';;
8466             esac
8467         fi
8468         rp="Do you want to install perl as /usr/bin/perl?"
8469         . ./myread
8470         case "$ans" in
8471         [yY]*)  val="$define";;
8472         *)      val="$undef" ;;
8473         esac
8474 else
8475         val="$undef"
8476 fi
8477 set installusrbinperl
8478 eval $setvar
8479
8480 : see if dlopen exists
8481 xxx_runnm="$runnm"
8482 xxx_ccflags="$ccflags"
8483 runnm=false
8484 : with g++ one needs -shared to get is-in-libc to work for dlopen
8485 case "$gccversion" in
8486 '')     ;;
8487 *)      case "$d_cplusplus" in
8488         "$define") ccflags="$ccflags -shared" ;;
8489         esac
8490         ;;
8491 esac
8492 set dlopen d_dlopen
8493 eval $inlibc
8494 runnm="$xxx_runnm"
8495 ccflags="$xxx_ccflags"
8496
8497 : see if this is a unistd.h system
8498 set unistd.h i_unistd
8499 eval $inhdr
8500
8501 : determine which dynamic loading, if any, to compile in
8502 echo " "
8503 dldir="ext/DynaLoader"
8504 case "$usedl" in
8505     $define|y|true)
8506         dflt='y'
8507         usedl="$define"
8508         ;;
8509     $undef|n|false)
8510         dflt='n'
8511         usedl="$undef"
8512         ;;
8513     *)
8514         dflt='n'
8515         case "$d_dlopen" in
8516             $define) dflt='y' ;;
8517         esac
8518         : Does a dl_xxx.xs file exist for this operating system
8519         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8520         ;;
8521 esac
8522 rp="Do you wish to use dynamic loading?"
8523 . ./myread
8524 usedl="$ans"
8525 bin_ELF="$undef"
8526 case "$ans" in
8527     y*) usedl="$define"
8528         case "$dlsrc" in
8529             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8530                     dflt="$dldir/dl_${osname}.xs"
8531                 elif $test "$d_dlopen" = "$define" ; then
8532                     dflt="$dldir/dl_dlopen.xs"
8533                 else
8534                     dflt=''
8535                 fi
8536                 ;;
8537             *)  dflt="$dldir/$dlsrc"
8538                 ;;
8539         esac
8540         echo "The following dynamic loading files are available:"
8541         : Can not go over to $dldir because getfile has path hard-coded in.
8542         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8543         rp="Source file to use for dynamic loading"
8544         fn="fne"
8545         gfpth="$src"
8546         . ./getfile
8547         usedl="$define"
8548         : emulate basename
8549         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8550
8551         $cat << EOM
8552
8553 Some systems may require passing special flags to $cc -c to
8554 compile modules that will be used to create a shared library.
8555 To use no flags, say "none".
8556
8557 EOM
8558         case "$cccdlflags" in
8559             '') case "$gccversion" in
8560                 '') case "$osname" in
8561                         hpux)   dflt='+z' ;;
8562                         irix*)  dflt='-KPIC' ;;
8563                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8564                         sunos)  dflt='-pic' ;;
8565                         *)      dflt='none' ;;
8566                     esac
8567                     ;;
8568                 *)  case "$osname" in
8569                         darwin) dflt='none' ;;
8570                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8571                         *)      dflt='-fpic' ;;
8572                     esac ;;
8573                 esac ;;
8574             ' ') dflt='none' ;;
8575             *)   dflt="$cccdlflags" ;;
8576         esac
8577
8578         case "$dflt" in
8579             none) dflt='' ;;
8580         esac
8581
8582         # If -Dsysroot was specified, now's the time to add it
8583         # to cccdlflags
8584         if test "X$sysroot" != X; then
8585             case "$gccversion" in
8586                 '') ;;
8587                 *)  case "$dflt" in
8588                         *sysroot*) ;;
8589                         'undef'|*)
8590                             dflt="$dflt --sysroot=$sysroot" ;;
8591                     esac
8592                     ;;
8593             esac
8594         fi
8595
8596         case "$dflt" in
8597             '') dflt='none';;
8598         esac
8599
8600         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8601         . ./myread
8602         case "$ans" in
8603             none) cccdlflags=' ' ;;
8604             *)    cccdlflags="$ans" ;;
8605         esac
8606
8607         cat << EOM
8608
8609 Some systems use ld to create libraries that can be dynamically loaded,
8610 while other systems (such as those using ELF) use $cc.
8611
8612 EOM
8613
8614 : Determine if this is ELF
8615         $cat >try.c <<EOM
8616 /* Test for whether ELF binaries are produced */
8617 #include <fcntl.h>
8618 #$i_stdlib I_STDLIB
8619 #ifdef I_STDLIB
8620 #include <stdlib.h>
8621 #endif
8622 #$i_unistd I_UNISTD
8623 #ifdef I_UNISTD
8624 #include <unistd.h>
8625 #endif
8626 int main() {
8627     char b[4];
8628     int i = open("a.out",O_RDONLY);
8629     if(i == -1)
8630         exit(1); /* fail */
8631     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8632         exit(0); /* succeed (yes, it is ELF) */
8633     exit(1); /* fail */
8634 }
8635 EOM
8636         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8637             bin_ELF="$define"
8638         fi
8639         $rm_try
8640
8641         case "$ld" in
8642             '') if $test $bin_ELF = "$define"; then
8643                     cat <<EOM
8644 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8645 EOM
8646                     dflt="$cc"
8647                 else
8648                     echo "I'll use ld to build dynamic libraries."
8649                     dflt='ld'
8650                 fi
8651                 ;;
8652             *)  dflt="$ld"
8653                 ;;
8654         esac
8655
8656         rp="What command should be used to create dynamic libraries?"
8657         . ./myread
8658         ld="$ans"
8659
8660         cat << EOM
8661
8662 Some systems may require passing special flags to $ld to create a
8663 library that can be dynamically loaded.  If your ld flags include
8664 -L/other/path options to locate libraries outside your loader's normal
8665 search path, you may need to specify those -L options here as well.  To
8666 use no flags, say "none".
8667
8668 EOM
8669         case "$lddlflags" in
8670             '') case "$osname" in
8671                     haiku) dflt='-shared' ;;
8672                     hpux) dflt='-b';
8673                           case "$gccversion" in
8674                               '') dflt="$dflt +vnocompatwarnings" ;;
8675                           esac
8676                           ;;
8677                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8678                     solaris) # See [perl #66604].
8679                             # On Solaris 11, gcc -m64 on amd64
8680                             # appears not to understand -G.  gcc versions at
8681                             # least as old as 3.4.3 support -shared, so just
8682                             # use that with Solaris 11 and later, but keep
8683                             # the old behavior for older Solaris versions.
8684                             case "$gccversion" in
8685                                 '') dflt='-G' ;;
8686                                 *)  case "$osvers" in
8687                                         2.?|2.10) dflt='-G' ;;
8688                                         *) dflt='-shared' ;;
8689                                     esac
8690                                     ;;
8691                             esac
8692                             ;;
8693                     sunos) dflt='-assert nodefinitions' ;;
8694                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8695                     *)     dflt='none' ;;
8696                 esac
8697                 ;;
8698             *) dflt="$lddlflags" ;;
8699         esac
8700
8701         : Only do this for gcc, since, for example, qcc has no concept
8702         : of --sysroot.
8703         if $test "X$sysroot" != X; then
8704             case "$gccversion" in
8705                 '') ;;
8706                 *)  dflt="$dflt --sysroot $sysroot" ;;
8707             esac
8708         fi
8709
8710         : Try to guess additional flags to pick up local libraries.
8711         : Be careful not to append to a plain 'none'
8712         case "$dflt" in
8713             none) dflt='' ;;
8714         esac
8715         for thisflag in $ldflags; do
8716             case "$thisflag" in
8717                 -L*|-R*|-Wl,-R*)
8718                     case " $dflt " in
8719                         *" $thisflag "*) ;;
8720                         *) dflt="$dflt $thisflag" ;;
8721                     esac
8722                     ;;
8723             esac
8724         done
8725
8726         case "$dflt" in
8727             ''|' ') dflt='none' ;;
8728         esac
8729
8730         case "$ldflags" in
8731             *-fstack-protector-strong*)
8732                 case "$dflt" in
8733                     *-fstack-protector-strong*) ;; # Don't add it again
8734                     *) dflt="$dflt -fstack-protector-strong" ;;
8735                 esac
8736                 ;;
8737             *-fstack-protector*)
8738                 case "$dflt" in
8739                     *-fstack-protector*) ;; # Don't add it again
8740                     *) dflt="$dflt -fstack-protector" ;;
8741                 esac
8742                 ;;
8743         esac
8744
8745         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8746         . ./myread
8747         case "$ans" in
8748             none) lddlflags=' ' ;;
8749             *) lddlflags="$ans" ;;
8750         esac
8751
8752         cat <<EOM
8753
8754 Some systems may require passing special flags to $cc to indicate that
8755 the resulting executable will use dynamic linking.  To use no flags,
8756 say "none".
8757
8758 EOM
8759         case "$ccdlflags" in
8760             '') case "$osname" in
8761                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8762                     sunos)             dflt='none'   ;;
8763                     *)                 dflt='none'   ;;
8764                 esac ;;
8765             ' ') dflt='none' ;;
8766             *)   dflt="$ccdlflags" ;;
8767         esac
8768         rp="Any special flags to pass to $cc to use dynamic linking?"
8769         . ./myread
8770         case "$ans" in
8771             none) ccdlflags=' ' ;;
8772             *)    ccdlflags="$ans" ;;
8773         esac
8774         ;;
8775
8776     *)  usedl="$undef"
8777         ld='ld'
8778         dlsrc='dl_none.xs'
8779         lddlflags=''
8780         ccdlflags=''
8781         ;;
8782 esac
8783
8784 ld_can_script="$undef"
8785 case "$bin_ELF$usedl" in
8786     $define$define)
8787         # Abuse try.h and a.out names for neat cleanup
8788         $cat >try.c <<EOM
8789 void foo() {}
8790 void bar() {}
8791 EOM
8792         $cat >try.h <<EOM
8793 LIBTEST_42 {
8794  global:
8795   foo;
8796  local: *;
8797  };
8798 EOM
8799         if $cc $cccdlflags $ccdlflags $ccflags \
8800                $ldflags $lddlflags -o a.out try.c \
8801                -Wl,--version-script=try.h >/dev/null 2>&1 \
8802            &&  $test -s a.out ; then
8803             echo "ld supports scripting" >&4
8804             ld_can_script="$define"
8805         else
8806             echo "ld does not support scripting" >&4
8807         fi
8808         $rm_try
8809         ;;
8810 esac
8811
8812 : Do we want a shared libperl?
8813 also=''
8814 case "$usedl" in
8815 $undef)
8816         # No dynamic loading being used, so don't bother even to prompt.
8817         useshrplib='false'
8818         ;;
8819 *)      case "$useshrplib" in
8820         '')     case "$osname" in
8821                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8822                         dflt=y
8823                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8824                         ;;
8825                 *)      dflt=n
8826                         ;;
8827                 esac
8828                 ;;
8829         $define|true|[Yy]*)
8830                 dflt=y
8831                 ;;
8832         *)      dflt=n
8833                 ;;
8834         esac
8835         $cat << EOM
8836
8837 The perl executable is normally obtained by linking perlmain.c with
8838 libperl${_a}, any static extensions (usually just DynaLoader), and
8839 any other libraries needed on this system (such as -lm, etc.).  Since
8840 your system supports dynamic loading, it is probably possible to build
8841 a shared libperl.$so.  If you will have more than one executable linked
8842 to libperl.$so, this will significantly reduce the size of each
8843 executable, but it may have a noticeable effect on performance.  The
8844 default is probably sensible for your system.
8845 $also
8846
8847 EOM
8848         rp="Build a shared libperl.$so (y/n)"
8849         . ./myread
8850         case "$ans" in
8851         true|$define|[Yy]*)
8852                 useshrplib='true'  ;;
8853         *)      useshrplib='false' ;;
8854         esac
8855         ;;
8856 esac
8857
8858 case "$useshrplib" in
8859 true)
8860         case "$userelocatableinc" in
8861         true|define)
8862                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8863                 echo "See INSTALL for an explanation why that won't work." >&4
8864                 exit 4
8865                 ;;
8866         esac
8867         case "$libperl" in
8868         '')
8869                 # Figure out a good name for libperl.so.  Since it gets stored in
8870                 # a version-specific architecture-dependent library, the version
8871                 # number isn't really that important, except for making cc/ld happy.
8872                 #
8873                 # A name such as libperl.so.10.1
8874                 majmin="libperl.$so.$patchlevel.$subversion"
8875                 # A name such as libperl.so.100
8876                 majonly=`echo $patchlevel $subversion |
8877                         $awk '{printf "%d%02d", $1, $2}'`
8878                 majonly=libperl.$so.$majonly
8879                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8880                 # rely on figuring it out from the naming of libc.
8881                 case "${osname}${osvers}" in
8882                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8883                         dflt=libperl.$so
8884                         ;;
8885                 cygwin*) # ld links now against the dll directly
8886                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8887                         majonly=`echo $patchlevel $subversion |
8888                                 $awk '{printf "%03d%03d", $1, $2}'`
8889                         majonly=cygperl5.$majonly.$so
8890                         dflt=$majmin
8891                         ;;
8892                 *)      # Try to guess based on whether libc has major.minor.
8893                         case "$libc" in
8894                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8895                         *libc.$so.[0-9]*) dflt=$majonly ;;
8896                         *)      dflt=libperl.$so ;;
8897                         esac
8898                         ;;
8899                 esac
8900                 ;;
8901         *)      dflt=$libperl
8902                 ;;
8903         esac
8904         cat << EOM
8905
8906 I need to select a good name for the shared libperl.  If your system uses
8907 library names with major and minor numbers, then you might want something
8908 like $majmin.  Alternatively, if your system uses a single version
8909 number for shared libraries, then you might want to use $majonly.
8910 Or, your system might be quite happy with a simple libperl.$so.
8911
8912 Since the shared libperl will get installed into a version-specific
8913 architecture-dependent directory, the version number of the shared perl
8914 library probably isn't important, so the default should be o.k.
8915
8916 EOM
8917         rp='What name do you want to give to the shared libperl?'
8918         . ./myread
8919         libperl=$ans
8920         echo "Ok, I'll use $libperl"
8921         ;;
8922 *)
8923         libperl="libperl${_a}"
8924         ;;
8925 esac
8926
8927 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8928 case "$shrpdir" in
8929 '') ;;
8930 *)      $cat >&4 <<EOM
8931 WARNING:  Use of the shrpdir variable for the installation location of
8932 the shared $libperl is not supported.  It was never documented and
8933 will not work in this version.  Let me (perlbug@perl.org)
8934 know of any problems this may cause.
8935
8936 EOM
8937         case "$shrpdir" in
8938         "$archlibexp/CORE")
8939                 $cat >&4 <<EOM
8940 But your current setting of $shrpdir is
8941 the default anyway, so it's harmless.
8942 EOM
8943                 ;;
8944         *)
8945                 $cat >&4 <<EOM
8946 Further, your current attempted setting of $shrpdir
8947 conflicts with the value of $archlibexp/CORE
8948 that installperl will use.
8949 EOM
8950                 ;;
8951         esac
8952         ;;
8953 esac
8954
8955 # How will the perl executable find the installed shared $libperl?
8956 # Add $xxx to ccdlflags.
8957 # If we can't figure out a command-line option, use $shrpenv to
8958 # set env LD_RUN_PATH.  The main perl makefile uses this.
8959 shrpdir=$archlibexp/CORE
8960 xxx=''
8961 tmp_shrpenv=''
8962 if "$useshrplib"; then
8963     case "$osname" in
8964         aix)
8965                 # We'll set it in Makefile.SH...
8966                 ;;
8967         solaris)
8968                 xxx="-R $shrpdir"
8969                 ;;
8970         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8971                 xxx="-Wl,-R$shrpdir"
8972                 ;;
8973         bsdos|linux|irix*|dec_osf|gnu*)
8974                 xxx="-Wl,-rpath,$shrpdir"
8975                 ;;
8976         haiku)
8977                 # Haiku doesn't like the default, either.
8978                 ;;
8979         hpux*)
8980                 # hpux doesn't like the default, either.
8981                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8982                 ;;
8983         cygwin)
8984                 # cygwin needs only ldlibpth
8985                 ;;
8986         *)
8987                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8988                 ;;
8989         esac
8990         case "$xxx" in
8991         '') ;;
8992         *)
8993                 # Only add $xxx if it isn't already in ccdlflags.
8994                 case " $ccdlflags " in
8995                 *" $xxx "*)     ;;
8996                 *)      ccdlflags="$ccdlflags $xxx"
8997                         cat <<EOM >&4
8998
8999 Adding $xxx to the flags
9000 passed to $ld so that the perl executable will find the
9001 installed shared $libperl.
9002
9003 EOM
9004                         ;;
9005                 esac
9006                 ;;
9007         esac
9008 fi
9009 # Fix ccdlflags in AIX for building external extensions.
9010 # (For building Perl itself bare -bE:perl.exp is needed,
9011 #  Makefile.SH takes care of this.)
9012 case "$osname" in
9013 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
9014 esac
9015 # Respect a hint or command-line value.
9016 case "$shrpenv" in
9017 '') shrpenv="$tmp_shrpenv" ;;
9018 esac
9019 case "$ldlibpthname" in
9020 '')     ldlibpthname=LD_LIBRARY_PATH ;;
9021 none)   ldlibpthname='' ;;
9022 esac
9023
9024 : determine where manual pages are on this system
9025 echo " "
9026 case "$sysman" in
9027 '')
9028         syspath='/usr/share/man/man1 /usr/man/man1'
9029         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
9030         syspath="$syspath /usr/man/u_man/man1"
9031         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
9032         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
9033         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
9034         sysman=`./loc . /usr/man/man1 $syspath`
9035         ;;
9036 esac
9037 if $test -d "$sysman"; then
9038         echo "System manual is in $sysman." >&4
9039 else
9040         echo "Could not find manual pages in source form." >&4
9041 fi
9042
9043 : determine where manual pages go
9044 set man1dir man1dir none
9045 eval $prefixit
9046 $cat <<EOM
9047
9048 $spackage has manual pages available in source form.
9049 EOM
9050 case "$nroff" in
9051 nroff)
9052         echo "However, you don't have nroff, so they're probably useless to you."
9053         case "$man1dir" in
9054         '') man1dir="none";;
9055         esac;;
9056 esac
9057 echo "If you don't want the manual sources installed, answer 'none'."
9058 case "$man1dir" in
9059 ' ') dflt=none
9060         ;;
9061 '')
9062         lookpath="$prefixexp/share/man/man1"
9063         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
9064         lookpath="$lookpath $prefixexp/man/p_man/man1"
9065         lookpath="$lookpath $prefixexp/man/u_man/man1"
9066         lookpath="$lookpath $prefixexp/man/man.1"
9067         case "$sysman" in
9068         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
9069         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
9070         esac
9071         set dflt
9072         eval $prefixup
9073         ;;
9074 *)  dflt="$man1dir"
9075         ;;
9076 esac
9077 echo " "
9078 fn=dn+~
9079 rp="Where do the main $spackage manual pages (source) go?"
9080 . ./getfile
9081 if $test "X$man1direxp" != "X$ansexp"; then
9082         installman1dir=''
9083 fi
9084 prefixvar=man1dir
9085 . ./setprefixvar
9086
9087 case "$man1dir" in
9088 '')     man1dir=' '
9089         installman1dir='';;
9090 esac
9091
9092 : What suffix to use on installed man pages
9093
9094 case "$man1dir" in
9095 ' ')
9096         man1ext='0'
9097         ;;
9098 *)
9099         rp="What suffix should be used for the main $spackage man pages?"
9100         case "$man1ext" in
9101         '')     case "$man1dir" in
9102                 *1)  dflt=1 ;;
9103                 *1p) dflt=1p ;;
9104                 *1pm) dflt=1pm ;;
9105                 *l) dflt=l;;
9106                 *n) dflt=n;;
9107                 *o) dflt=o;;
9108                 *p) dflt=p;;
9109                 *C) dflt=C;;
9110                 *L) dflt=L;;
9111                 *L1) dflt=L1;;
9112                 *) dflt=1;;
9113                 esac
9114                 ;;
9115         *)      dflt="$man1ext";;
9116         esac
9117         . ./myread
9118         man1ext="$ans"
9119         ;;
9120 esac
9121
9122 : see if we can have long filenames
9123 echo " "
9124 first=123456789abcdef
9125 $rm -f $first
9126 if (echo hi >$first) 2>/dev/null; then
9127         if $test -f 123456789abcde; then
9128                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
9129                 val="$undef"
9130         else
9131                 echo 'You can have filenames longer than 14 characters.'>&4
9132                 val="$define"
9133         fi
9134 else
9135         $cat <<'EOM'
9136 You can't have filenames longer than 14 chars.
9137 You can't even think about them!
9138 EOM
9139         val="$undef"
9140 fi
9141 set d_flexfnam
9142 eval $setvar
9143 $rm -rf 123456789abcde*
9144
9145 : determine where library module manual pages go
9146 set man3dir man3dir none
9147 eval $prefixit
9148 $cat <<EOM
9149
9150 $spackage has manual pages for many of the library modules.
9151 EOM
9152
9153 case "$nroff" in
9154 nroff)
9155         $cat <<'EOM'
9156 However, you don't have nroff, so they're probably useless to you.
9157 EOM
9158         case "$man3dir" in
9159         '') man3dir="none";;
9160         esac;;
9161 esac
9162
9163 case "$d_flexfnam" in
9164 undef)
9165         $cat <<'EOM'
9166 However, your system can't handle the long file names like File::Basename.3.
9167 EOM
9168         case "$man3dir" in
9169         '') man3dir="none";;
9170         esac;;
9171 esac
9172
9173 echo "If you don't want the manual sources installed, answer 'none'."
9174 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
9175 case "$man3dir" in
9176 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
9177         if $test -d "$privlib/man/man3"; then
9178                 cat <<EOM >&4
9179
9180 WARNING:  Previous versions of perl installed man3 pages into
9181 $privlib/man/man3.  This version will suggest a
9182 new default of $dflt.
9183 EOM
9184                 tdflt=$dflt
9185                 dflt='n'
9186                 rp='Do you wish to preserve the old behavior?(y/n)'
9187                 . ./myread
9188                 case "$ans" in
9189                 y*) dflt="$privlib/man/man3" ;;
9190                 *)  dflt=$tdflt ;;
9191                 esac
9192     fi
9193         ;;
9194 *)      dflt="$man3dir" ;;
9195 esac
9196 case "$dflt" in
9197 ' ') dflt=none ;;
9198 esac
9199 echo " "
9200 fn=dn+~
9201 rp="Where do the $package library man pages (source) go?"
9202 . ./getfile
9203 prefixvar=man3dir
9204 . ./setprefixvar
9205
9206 case "$man3dir" in
9207 '')     man3dir=' '
9208         installman3dir='';;
9209 esac
9210
9211 : What suffix to use on installed man pages
9212 case "$man3dir" in
9213 ' ')
9214         man3ext='0'
9215         ;;
9216 *)
9217         rp="What suffix should be used for the $package library man pages?"
9218         case "$man3ext" in
9219         '')     case "$man3dir" in
9220                 *3)  dflt=3 ;;
9221                 *3p) dflt=3p ;;
9222                 *3pm) dflt=3pm ;;
9223                 *l) dflt=l;;
9224                 *n) dflt=n;;
9225                 *o) dflt=o;;
9226                 *p) dflt=p;;
9227                 *C) dflt=C;;
9228                 *L) dflt=L;;
9229                 *L3) dflt=L3;;
9230                 *) dflt=3;;
9231                 esac
9232                 ;;
9233         *)      dflt="$man3ext";;
9234         esac
9235         . ./myread
9236         man3ext="$ans"
9237         ;;
9238 esac
9239
9240 : see if we have to deal with yellow pages, now NIS.
9241 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9242         case "$hostcat" in
9243         nidump*) ;;
9244         *)
9245                 case "$hostcat" in
9246                 *ypcat*) dflt=y;;
9247                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9248                                 dflt=y
9249                         else
9250                                 dflt=n
9251                         fi;;
9252                 *) dflt=n;;
9253                 esac
9254                 echo " "
9255                 rp='Are you getting the hosts file via yellow pages?'
9256                 . ./myread
9257                 case "$ans" in
9258                 y*) hostcat='ypcat hosts';;
9259                 *) hostcat='cat /etc/hosts';;
9260                 esac
9261                 ;;
9262         esac
9263 fi
9264 case "$hostcat" in
9265 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9266 esac
9267 case "$groupcat" in
9268 '') test -f /etc/group && groupcat='cat /etc/group';;
9269 esac
9270 case "$passcat" in
9271 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9272 esac
9273
9274 : now get the host name
9275 echo " "
9276 echo "Figuring out host name..." >&4
9277 case "$myhostname" in
9278 '') cont=true
9279         echo 'Maybe "hostname" will work...'
9280         if tans=`sh -c hostname 2>&1` ; then
9281                 myhostname=$tans
9282                 phostname=hostname
9283                 cont=''
9284         fi
9285         ;;
9286 *) cont='';;
9287 esac
9288 if $test "$cont"; then
9289         if ./xenix; then
9290                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9291                 if tans=`cat /etc/systemid 2>&1` ; then
9292                         myhostname=$tans
9293                         phostname='cat /etc/systemid'
9294                         echo "Whadyaknow.  Xenix always was a bit strange..."
9295                         cont=''
9296                 fi
9297         elif $test -r /etc/systemid; then
9298                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9299         fi
9300 fi
9301 if $test "$cont"; then
9302         echo 'No, maybe "uuname -l" will work...'
9303         if tans=`sh -c 'uuname -l' 2>&1` ; then
9304                 myhostname=$tans
9305                 phostname='uuname -l'
9306         else
9307                 echo 'Strange.  Maybe "uname -n" will work...'
9308                 if tans=`sh -c 'uname -n' 2>&1` ; then
9309                         myhostname=$tans
9310                         phostname='uname -n'
9311                 else
9312                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9313                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9314                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9315                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9316                         else
9317                                 case "$myhostname" in
9318                                 '') echo "Does this machine have an identity crisis or something?"
9319                                         phostname='';;
9320                                 *)
9321                                         echo "Well, you said $myhostname before..."
9322                                         phostname='echo $myhostname';;
9323                                 esac
9324                         fi
9325                 fi
9326         fi
9327 fi
9328 case "$myhostname" in
9329 '') myhostname=noname ;;
9330 esac
9331 : you do not want to know about this
9332 set $myhostname
9333 myhostname=$1
9334
9335 : verify guess
9336 if $test "$myhostname" ; then
9337         dflt=y
9338         rp='Your host name appears to be "'$myhostname'".'" Right?"
9339         . ./myread
9340         case "$ans" in
9341         y*) ;;
9342         *) myhostname='';;
9343         esac
9344 fi
9345
9346 : bad guess or no guess
9347 while $test "X$myhostname" = X ; do
9348         dflt=''
9349         rp="Please type the (one word) name of your host:"
9350         . ./myread
9351         myhostname="$ans"
9352 done
9353
9354 : translate upper to lower if necessary
9355 case "$myhostname" in
9356 *[A-Z]*)
9357         echo "(Normalizing case in your host name)"
9358         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9359         ;;
9360 esac
9361
9362 case "$myhostname" in
9363 *.*)
9364         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9365         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9366         echo "(Trimming domain name from host name--host name is now $myhostname)"
9367         ;;
9368 *) case "$mydomain" in
9369         '')
9370                 {
9371                         test "X$hostcat" = "Xypcat hosts" &&
9372                         ypmatch "$myhostname" hosts 2>/dev/null |\
9373                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9374                         $test -s hosts
9375                 } || {
9376                         test "X$hostcat" != "X" &&
9377                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9378                                         /[       ]$myhostname[  . ]/p" > hosts
9379                 }
9380                 tmp_re="[       . ]"
9381                 if $test -f hosts; then
9382                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9383                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9384                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9385                                 hosts | $sort | $uniq | \
9386                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9387                         case `$echo X$dflt` in
9388                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9389                                 dflt=.
9390                                 ;;
9391                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9392                                 ;;
9393                         esac
9394                 else
9395                         echo "(I cannot locate a hosts database anywhere)"
9396                         dflt=.
9397                 fi
9398                 case "$dflt" in
9399                 .)
9400                         tans=`./loc resolv.conf X /etc /usr/etc`
9401                         if $test -f "$tans"; then
9402                                 echo "(Attempting domain name extraction from $tans)"
9403                                 dflt=.`$sed -n -e 's/   / /g' \
9404                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9405                                   -e 1q 2>/dev/null`
9406                                 case "$dflt" in
9407                                 .) dflt=.`$sed -n -e 's/        / /g' \
9408                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9409                                      -e 1q 2>/dev/null`
9410                                         ;;
9411                                 esac
9412                         fi
9413                         ;;
9414                 esac
9415                 case "$dflt" in
9416                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9417                         dflt=.`sh -c domainname 2>/dev/null`
9418                         case "$dflt" in
9419                         '') dflt='.';;
9420                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9421                         esac
9422                         ;;
9423                 esac
9424                 case "$dflt$osname" in
9425                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9426                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9427                         ;;
9428                 esac
9429                 case "$dflt" in
9430                 .) echo "(Lost all hope -- silly guess then)"
9431                         dflt='.nonet'
9432                         ;;
9433                 esac
9434                 $rm -f hosts
9435                 ;;
9436         *) dflt="$mydomain";;
9437         esac;;
9438 esac
9439 echo " "
9440 rp="What is your domain name?"
9441 . ./myread
9442 tans="$ans"
9443 case "$ans" in
9444 '') ;;
9445 .*) ;;
9446 *) tans=".$tans";;
9447 esac
9448 mydomain="$tans"
9449
9450 : translate upper to lower if necessary
9451 case "$mydomain" in
9452 *[A-Z]*)
9453         echo "(Normalizing case in your domain name)"
9454         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9455         ;;
9456 esac
9457
9458 : a little sanity check here
9459 case "$phostname" in
9460 '') ;;
9461 *)
9462         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9463         $myhostname$mydomain|$myhostname) ;;
9464         *)
9465                 case "$phostname" in
9466                 sed*)
9467                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9468                         ;;
9469                 *)
9470                         echo "(That doesn't agree with your $phostname command, by the way.)"
9471                         ;;
9472                 esac
9473         ;;
9474         esac
9475         ;;
9476 esac
9477
9478 : determine the e-mail address of the user who is running us
9479 $cat <<EOM
9480
9481 I need to get your e-mail address in Internet format if possible, i.e.
9482 something like user@host.domain. Please answer accurately since I have
9483 no easy means to double check it. The default value provided below
9484 is most probably close to reality but may not be valid from outside
9485 your organization...
9486
9487 EOM
9488 cont=x
9489 while test "$cont"; do
9490         case "$MAILDOMAIN" in
9491         '')
9492                 if $test -s /etc/mailname; then
9493                         maildomain=`$cat /etc/mailname`
9494                 else
9495                         maildomain="$myhostname$mydomain"
9496                 fi
9497                 ;;
9498         *)  maildomain="$MAILDOMAIN";;
9499         esac
9500         case "$cf_email" in
9501         '') dflt="$cf_by@$maildomain";;
9502         *)  dflt="$cf_email";;
9503         esac
9504         rp='What is your e-mail address?'
9505         . ./myread
9506         cf_email="$ans"
9507         case "$cf_email" in
9508         *@*.*) cont='' ;;
9509         *)
9510                 rp='Address does not look like an Internet one.  Use it anyway?'
9511                 case "$fastread" in
9512                 yes) dflt=y ;;
9513                 *) dflt=n ;;
9514                 esac
9515                 . ./myread
9516                 case "$ans" in
9517                 y*) cont='' ;;
9518                 *) echo " " ;;
9519                 esac
9520                 ;;
9521         esac
9522 done
9523
9524 : Ask e-mail of administrator
9525 $cat <<EOM
9526
9527 If you or somebody else will be maintaining perl at your site, please
9528 fill in the correct e-mail address here so that they may be contacted
9529 if necessary. Currently, the "perlbug" program included with perl
9530 will send mail to this address in addition to perlbug@perl.org. You may
9531 enter "none" for no administrator.
9532
9533 EOM
9534 case "$perladmin" in
9535 '') dflt="$cf_email";;
9536 *) dflt="$perladmin";;
9537 esac
9538 rp='Perl administrator e-mail address'
9539 . ./myread
9540 perladmin="$ans"
9541
9542 : determine whether to only install version-specific parts.
9543 echo " "
9544 $cat <<EOM
9545 Do you want to install only the version-specific parts of the perl
9546 distribution?  Usually you do *not* want to do this.
9547 EOM
9548 case "$versiononly" in
9549 "$define"|[Yy]*|true) dflt='y' ;;
9550 *) dflt='n';
9551 esac
9552 rp="Do you want to install only the version-specific parts of perl?"
9553 . ./myread
9554 case "$ans" in
9555 [yY]*)  val="$define";;
9556 *)      val="$undef" ;;
9557 esac
9558 set versiononly
9559 eval $setvar
9560
9561 case "$versiononly" in
9562 "$define") inc_version_list=''
9563            inc_version_list_init=0
9564            ;;
9565 esac
9566
9567 : figure out how to guarantee perl startup
9568 : XXX Note that this currently takes advantage of the bug that binexp ignores
9569 :     the Configure -Dinstallprefix setting, which in turn means that under
9570 :     relocatable @INC, initialinstalllocation is what binexp started as.
9571 case "$startperl" in
9572 '')
9573         case "$sharpbang" in
9574         *!)
9575                 $cat <<EOH
9576
9577 I can use the #! construct to start perl on your system. This will
9578 make startup of perl scripts faster, but may cause problems if you
9579 want to share those scripts and perl is not in a standard place
9580 ($initialinstalllocation/perl) on all your platforms. The alternative
9581 is to force a shell by starting the script with a single ':' character.
9582
9583 EOH
9584                 case "$versiononly" in
9585                 "$define")      dflt="$initialinstalllocation/perl$version";;
9586                 *)              dflt="$initialinstalllocation/perl";;
9587                 esac
9588                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9589                 . ./myread
9590                 case "$ans" in
9591                 none)   startperl=": # use perl";;
9592                 *)      startperl="#!$ans"
9593                         if $test 30 -lt `echo "$ans" | wc -c`; then
9594                                 $cat >&4 <<EOM
9595
9596 WARNING:  Some systems limit the #! command to 32 characters.
9597 If you experience difficulty running Perl scripts with #!, try
9598 installing Perl in a directory with a shorter pathname.
9599
9600 EOM
9601                         fi ;;
9602                 esac
9603                 ;;
9604         *) startperl=": # use perl"
9605                 ;;
9606         esac
9607         ;;
9608 esac
9609 echo "I'll use $startperl to start perl scripts."
9610
9611 : figure best path for perl in scripts
9612 case "$perlpath" in
9613 '')
9614         case "$versiononly" in
9615         "$define")      perlpath="$initialinstalllocation/perl$version";;
9616         *)              perlpath="$initialinstalllocation/perl";;
9617         esac
9618         case "$startperl" in
9619         *!*) ;;
9620         *)
9621                 $cat <<EOH
9622
9623 I will use the "eval 'exec'" idiom to start Perl on your system.
9624 I can use the full path of your Perl binary for this purpose, but
9625 doing so may cause problems if you want to share those scripts and
9626 Perl is not always in a standard place ($initialinstalllocation/perl).
9627
9628 EOH
9629                 dflt="$initialinstalllocation/perl"
9630                 rp="What path shall I use in \"eval 'exec'\"?"
9631                 . ./myread
9632                 perlpath="$ans"
9633                 ;;
9634         esac
9635         ;;
9636 esac
9637 case "$startperl" in
9638 *!*)    ;;
9639 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9640 esac
9641
9642 : determine where public executable scripts go
9643 set scriptdir scriptdir
9644 eval $prefixit
9645 case "$scriptdir" in
9646 '')
9647         dflt="$bin"
9648         : guess some guesses
9649         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9650         $test -d /usr/share/bin     && dflt=/usr/share/bin
9651         $test -d /usr/local/script  && dflt=/usr/local/script
9652         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9653         $test -d $prefixexp/script  && dflt=$prefixexp/script
9654         set dflt
9655         eval $prefixup
9656         ;;
9657 *)  dflt="$scriptdir"
9658         ;;
9659 esac
9660 $cat <<EOM
9661
9662 Some installations have a separate directory just for executable scripts so
9663 that they can mount it across multiple architectures but keep the scripts in
9664 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9665 Or you might just lump your scripts in with all your other executables.
9666
9667 EOM
9668 fn=d~
9669 rp='Where do you keep publicly executable scripts?'
9670 . ./getfile
9671 if $test "X$ansexp" != "X$scriptdirexp"; then
9672         installscript=''
9673 fi
9674 installscriptdir=''
9675 prefixvar=scriptdir
9676 . ./setprefixvar
9677 : A little fix up for an irregularly named variable.
9678 installscript="$installscriptdir"
9679
9680 : determine where add-on public executables go
9681 case "$sitebin" in
9682 '')     dflt=$siteprefix/bin ;;
9683 *)      dflt=$sitebin ;;
9684 esac
9685 fn=d~
9686 rp='Pathname where the add-on public executables should be installed?'
9687 . ./getfile
9688 prefixvar=sitebin
9689 . ./setprefixvar
9690
9691 : determine where add-on html pages go
9692 : There is no standard location, so try to copy the previously-selected
9693 : directory structure for the core html pages.
9694 case "$sitehtml1dir" in
9695 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9696 *)     dflt=$sitehtml1dir ;;
9697 esac
9698 case "$dflt" in
9699 ''|' ') dflt=none ;;
9700 esac
9701 fn=dn+~
9702 rp='Pathname where the site-specific html pages should be installed?'
9703 . ./getfile
9704 prefixvar=sitehtml1dir
9705 . ./setprefixvar
9706
9707 : determine where add-on library html pages go
9708 : There is no standard location, so try to copy the previously-selected
9709 : directory structure for the core html pages.
9710 case "$sitehtml3dir" in
9711 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9712 *)     dflt=$sitehtml3dir ;;
9713 esac
9714 case "$dflt" in
9715 ''|' ') dflt=none ;;
9716 esac
9717 fn=dn+~
9718 rp='Pathname where the site-specific library html pages should be installed?'
9719 . ./getfile
9720 prefixvar=sitehtml3dir
9721 . ./setprefixvar
9722
9723 : determine where add-on manual pages go
9724 case "$siteman1dir" in
9725 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9726 *)      dflt=$siteman1dir ;;
9727 esac
9728 case "$dflt" in
9729 ''|' ') dflt=none ;;
9730 esac
9731 fn=dn+~
9732 rp='Pathname where the site-specific manual pages should be installed?'
9733 . ./getfile
9734 prefixvar=siteman1dir
9735 . ./setprefixvar
9736
9737 : determine where add-on library man pages go
9738 case "$siteman3dir" in
9739 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9740 *)      dflt=$siteman3dir ;;
9741 esac
9742 case "$dflt" in
9743 ''|' ') dflt=none ;;
9744 esac
9745 fn=dn+~
9746 rp='Pathname where the site-specific library manual pages should be installed?'
9747 . ./getfile
9748 prefixvar=siteman3dir
9749 . ./setprefixvar
9750
9751 : determine where add-on public executable scripts go
9752 case "$sitescript" in
9753 '')     dflt=$siteprefix/script
9754         $test -d $dflt || dflt=$sitebin ;;
9755 *)  dflt="$sitescript" ;;
9756 esac
9757 fn=d~+
9758 rp='Pathname where add-on public executable scripts should be installed?'
9759 . ./getfile
9760 prefixvar=sitescript
9761 . ./setprefixvar
9762
9763 : see if backtrace exists
9764 set backtrace d_backtrace
9765 eval $inlibc
9766
9767 : add flags if using c backtrace
9768 case "$usecbacktrace" in
9769   "") usecbacktrace=$undef ;;
9770   [yY]*|true|$define)
9771     case "$d_backtrace" in
9772       [yY]*|true|$define)
9773         case " $ccflags " in
9774           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9775           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9776           esac
9777         ;;
9778       *)
9779         echo "This system does not support backtrace" >&4
9780         usecbacktrace=$undef
9781         ;;
9782       esac
9783     ;;
9784   esac
9785
9786 : Check if faststdio is requested and available
9787 case "$usefaststdio" in
9788 $define|true|[yY]*|'')
9789         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9790         case "$xversion" in
9791         [68])   dflt='y' ;;
9792         *)      dflt='n' ;;
9793         esac
9794         ;;
9795 *) dflt='n';;
9796 esac
9797 cat <<EOM
9798
9799 Perl can be built to use 'fast stdio', which means using the stdio
9800 library but also directly manipulating the stdio buffers to enable
9801 faster I/O.  Using stdio is better for backward compatibility (especially
9802 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9803 interface has been preferred instead of stdio.
9804
9805 If this doesn't make any sense to you, just accept the default '$dflt'.
9806 EOM
9807 rp='Use the "fast stdio" if available?'
9808 . ./myread
9809 case "$ans" in
9810 y|Y)    val="$define" ;;
9811 *)      val="$undef" ;;
9812 esac
9813 set usefaststdio
9814 eval $setvar
9815
9816
9817 : define an is-a-typedef? function
9818 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9819 case "$inclist" in
9820 "") inclist="sys/types.h";;
9821 esac;
9822 eval "varval=\$$var";
9823 case "$varval" in
9824 "")
9825         $rm -f temp.c;
9826         for inc in $inclist; do
9827                 echo "#include <$inc>" >>temp.c;
9828         done;
9829         echo "#ifdef $type" >> temp.c;
9830         echo "printf(\"We have $type\");" >> temp.c;
9831         echo "#endif" >> temp.c;
9832         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9833         if $contains $type temp.E >/dev/null 2>&1; then
9834                 eval "$var=\$type";
9835         else
9836                 eval "$var=\$def";
9837         fi;
9838         $rm -f temp.?;;
9839 *) eval "$var=\$varval";;
9840 esac'
9841
9842 : define an is-a-typedef? function that prompts if the type is not available.
9843 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9844 case "$inclist" in
9845 "") inclist="sys/types.h";;
9846 esac;
9847 eval "varval=\$$var";
9848 case "$varval" in
9849 "")
9850         $rm -f temp.c;
9851         for inc in $inclist; do
9852                 echo "#include <$inc>" >>temp.c;
9853         done;
9854         echo "#ifdef $type" >> temp.c;
9855         echo "printf(\"We have $type\");" >> temp.c;
9856         echo "#endif" >> temp.c;
9857         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9858         echo " " ;
9859         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9860         if $contains $type temp.E >/dev/null 2>&1; then
9861                 echo "$type found." >&4;
9862                 eval "$var=\$type";
9863         else
9864                 echo "$type NOT found." >&4;
9865                 dflt="$def";
9866                 . ./myread ;
9867                 eval "$var=\$ans";
9868         fi;
9869         $rm -f temp.?;;
9870 *) eval "$var=\$varval";;
9871 esac'
9872
9873 : see what type lseek is declared as in the kernel
9874 rp="What is the type used for lseek's offset on this system?"
9875 set off_t lseektype long stdio.h sys/types.h
9876 eval $typedef_ask
9877
9878 echo " "
9879 echo "Checking to see how big your file offsets are..." >&4
9880 $cat >try.c <<EOCP
9881 #include <sys/types.h>
9882 #include <stdio.h>
9883 int main()
9884 {
9885     printf("%d\n", (int)sizeof($lseektype));
9886     return(0);
9887 }
9888 EOCP
9889 set try
9890 if eval $compile_ok; then
9891         lseeksize=`$run ./try`
9892         echo "Your file offsets are $lseeksize bytes long."
9893 else
9894         dflt=$longsize
9895         echo " "
9896         echo "(I can't seem to compile the test program.  Guessing...)"
9897         rp="What is the size of your file offsets (in bytes)?"
9898         . ./myread
9899         lseeksize="$ans"
9900 fi
9901 $rm_try
9902
9903 : see what type file positions are declared as in the library
9904 rp="What is the type for file position used by fsetpos()?"
9905 set fpos_t fpostype long stdio.h sys/types.h
9906 eval $typedef_ask
9907
9908 : Check size for Fpos_t
9909 echo " "
9910 case "$fpostype" in
9911 *_t) zzz="$fpostype"    ;;
9912 *)   zzz="fpos_t"       ;;
9913 esac
9914 echo "Checking the size of $zzz..." >&4
9915 cat > try.c <<EOCP
9916 #include <sys/types.h>
9917 #include <stdio.h>
9918 #$i_stdlib I_STDLIB
9919 #ifdef I_STDLIB
9920 #include <stdlib.h>
9921 #endif
9922 int main() {
9923     printf("%d\n", (int)sizeof($fpostype));
9924     exit(0);
9925 }
9926 EOCP
9927 set try
9928 if eval $compile_ok; then
9929         yyy=`$run ./try`
9930         case "$yyy" in
9931         '')     fpossize=4
9932                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9933                 ;;
9934         *)      fpossize=$yyy
9935                 echo "Your $zzz is $fpossize bytes long."
9936                 ;;
9937         esac
9938 else
9939         dflt="$longsize"
9940         echo " " >&4
9941         echo "(I can't compile the test program.  Guessing...)" >&4
9942         rp="What is the size of your file positions (in bytes)?"
9943         . ./myread
9944         fpossize="$ans"
9945 fi
9946
9947 : Check for large file support
9948 # Backward compatibility (uselfs is deprecated).
9949 case "$uselfs" in
9950 "$define"|true|[yY]*)
9951         cat <<EOM >&4
9952
9953 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9954 EOM
9955         uselargefiles="$define"
9956         ;;
9957 esac
9958
9959 case "$lseeksize:$fpossize" in
9960 8:8) cat <<EOM
9961
9962 You can have files larger than 2 gigabytes.
9963 EOM
9964    val="$define" ;;
9965 *)    case "$uselargefiles" in
9966    "$undef"|false|[nN]*) dflt='n' ;;
9967    *)   dflt='y' ;;
9968    esac
9969    cat <<EOM
9970
9971 Perl can be built to understand large files (files larger than 2 gigabytes)
9972 on some systems.  To do so, Configure can be run with -Duselargefiles.
9973
9974 If this doesn't make any sense to you, just accept the default '$dflt'.
9975 EOM
9976    rp='Try to understand large files, if available?'
9977    . ./myread
9978    case "$ans" in
9979    y|Y)         val="$define" ;;
9980    *)           val="$undef"  ;;
9981    esac
9982    ;;
9983 esac
9984 set uselargefiles
9985 eval $setvar
9986 : Look for a hint-file generated 'call-back-unit'.  If the
9987 : user has specified that a large files perl is to be built,
9988 : we may need to set or change some other defaults.
9989 if $test -f uselargefiles.cbu; then
9990         echo "Your platform has some specific hints regarding large file builds, using them..."
9991         . ./uselargefiles.cbu
9992 fi
9993 case "$uselargefiles" in
9994 "$define")
9995         if $test -f uselargefiles.cbu; then
9996                 echo " "
9997                 echo "Rechecking to see how big your file offsets are..." >&4
9998                 $cat >try.c <<EOCP
9999 #include <sys/types.h>
10000 #include <stdio.h>
10001 int main()
10002 {
10003     printf("%d\n", (int)sizeof($lseektype));
10004     return(0);
10005 }
10006 EOCP
10007                 set try
10008                 if eval $compile_ok; then
10009                         lseeksize=`$run ./try`
10010                         $echo "Your file offsets are now $lseeksize bytes long."
10011                 else
10012                         dflt="$lseeksize"
10013                         echo " "
10014                         echo "(I can't seem to compile the test program.  Guessing...)"
10015                         rp="What is the size of your file offsets (in bytes)?"
10016                         . ./myread
10017                         lseeksize="$ans"
10018                 fi
10019                 case "$fpostype" in
10020                 *_t) zzz="$fpostype"    ;;
10021                 *)   zzz="fpos_t"       ;;
10022                 esac
10023                 $echo $n "Rechecking the size of $zzz...$c" >&4
10024                 $cat > try.c <<EOCP
10025 #include <sys/types.h>
10026 #include <stdio.h>
10027 #$i_stdlib I_STDLIB
10028 #ifdef I_STDLIB
10029 #include <stdlib.h>
10030 #endif
10031 int main() {
10032     printf("%d\n", (int)sizeof($fpostype));
10033     return(0);
10034 }
10035 EOCP
10036                 set try
10037                 if eval $compile_ok; then
10038                         yyy=`$run ./try`
10039                         dflt="$lseeksize"
10040                         case "$yyy" in
10041                         '')     echo " "
10042                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
10043                                 ;;
10044                         *)      fpossize=$yyy
10045                                 echo " $fpossize bytes." >&4
10046                                 ;;
10047                         esac
10048                 else
10049                         dflt="$fpossize"
10050                         echo " "
10051                         echo "(I can't compile the test program.  Guessing...)" >&4
10052                         rp="What is the size of your file positions (in bytes)?"
10053                         . ./myread
10054                         fpossize="$ans"
10055                 fi
10056                 $rm_try
10057         fi
10058         ;;
10059 esac
10060
10061 : Check if we want perlio
10062 useperlio="$define"
10063
10064 : Set the vendorbin variables
10065 case "$vendorprefix" in
10066 '')     d_vendorbin="$undef"
10067         vendorbin=''
10068         vendorbinexp=''
10069         ;;
10070 *)      d_vendorbin="$define"
10071         : determine where vendor-supplied executables go.
10072         case "$vendorbin" in
10073         '') dflt=$vendorprefix/bin ;;
10074         *)      dflt="$vendorbin" ;;
10075         esac
10076         fn=d~+
10077         rp='Pathname for the vendor-supplied executables directory?'
10078         . ./getfile
10079         vendorbin="$ans"
10080         vendorbinexp="$ansexp"
10081         ;;
10082 esac
10083 prefixvar=vendorbin
10084 . ./installprefix
10085
10086 : Set the vendorhtml1dir variables
10087 case "$vendorprefix" in
10088 '')     vendorhtml1dir=''
10089         vendorhtml1direxp=''
10090         ;;
10091 *)      : determine where vendor-supplied html pages go.
10092         : There is no standard location, so try to copy the previously-selected
10093         : directory structure for the core html pages.
10094         : XXX Better default suggestions would be welcome.
10095         case "$vendorhtml1dir" in
10096         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10097         *)      dflt=$vendorhtml1dir ;;
10098         esac
10099         case "$dflt" in
10100         ''|' ') dflt=none ;;
10101         esac
10102         fn=dn+~
10103         rp='Pathname for the vendor-supplied html pages?'
10104         . ./getfile
10105         vendorhtml1dir="$ans"
10106         vendorhtml1direxp="$ansexp"
10107         ;;
10108 esac
10109 : Use ' ' for none so value is preserved next time through Configure
10110 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
10111 prefixvar=vendorhtml1dir
10112 . ./installprefix
10113
10114 : Set the vendorhtml3dir variables
10115 case "$vendorprefix" in
10116 '')     vendorhtml3dir=''
10117         vendorhtml3direxp=''
10118         ;;
10119 *)      : determine where vendor-supplied module html pages go.
10120         : There is no standard location, so try to copy the previously-selected
10121         : directory structure for the core html pages.
10122         : XXX Better default suggestions would be welcome.
10123         case "$vendorhtml3dir" in
10124         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10125         *)      dflt=$vendorhtml3dir ;;
10126         esac
10127         case "$dflt" in
10128         ''|' ') dflt=none ;;
10129         esac
10130         fn=dn+~
10131         rp='Pathname for the vendor-supplied html pages?'
10132         . ./getfile
10133         vendorhtml3dir="$ans"
10134         vendorhtml3direxp="$ansexp"
10135         ;;
10136 esac
10137 : Use ' ' for none so value is preserved next time through Configure
10138 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
10139 prefixvar=vendorhtml3dir
10140 . ./installprefix
10141
10142 : Set the vendorman1dir variables
10143 case "$vendorprefix" in
10144 '')     vendorman1dir=''
10145         vendorman1direxp=''
10146         ;;
10147 *)      : determine where vendor-supplied manual pages go.
10148         case "$vendorman1dir" in
10149         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10150         *)      dflt=$vendorman1dir ;;
10151         esac
10152         case "$dflt" in
10153         ''|' ') dflt=none ;;
10154         esac
10155         fn=nd~+
10156         rp='Pathname for the vendor-supplied manual section 1 pages?'
10157         . ./getfile
10158         vendorman1dir="$ans"
10159         vendorman1direxp="$ansexp"
10160         ;;
10161 esac
10162 : Use ' ' for none so value is preserved next time through Configure
10163 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
10164 prefixvar=vendorman1dir
10165 . ./installprefix
10166
10167 : Set the vendorman3dir variables
10168 case "$vendorprefix" in
10169 '')     vendorman3dir=''
10170         vendorman3direxp=''
10171         ;;
10172 *)      : determine where vendor-supplied module manual pages go.
10173         case "$vendorman3dir" in
10174         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
10175         *)      dflt=$vendorman3dir ;;
10176         esac
10177         case "$dflt" in
10178         ''|' ') dflt=none ;;
10179         esac
10180         fn=nd~+
10181         rp='Pathname for the vendor-supplied manual section 3 pages?'
10182         . ./getfile
10183         vendorman3dir="$ans"
10184         vendorman3direxp="$ansexp"
10185         ;;
10186 esac
10187 : Use ' ' for none so value is preserved next time through Configure
10188 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10189 prefixvar=vendorman3dir
10190 . ./installprefix
10191
10192 : Set the vendorscript variables
10193 case "$vendorprefix" in
10194 '')     d_vendorscript="$undef"
10195         vendorscript=''
10196         vendorscriptexp=''
10197         ;;
10198 *)      d_vendorscript="$define"
10199         : determine where vendor-supplied scripts go.
10200         case "$vendorscript" in
10201         '')     dflt=$vendorprefix/script
10202                 $test -d $dflt || dflt=$vendorbin ;;
10203         *)  dflt="$vendorscript" ;;
10204         esac
10205         $cat <<EOM
10206
10207 The installation process will create a directory for
10208 vendor-supplied scripts.
10209
10210 EOM
10211         fn=d~+
10212         rp='Pathname for the vendor-supplied scripts directory?'
10213         . ./getfile
10214         vendorscript="$ans"
10215         vendorscriptexp="$ansexp"
10216         ;;
10217 esac
10218 prefixvar=vendorscript
10219 . ./installprefix
10220
10221 : script used to emit important warnings
10222 cat >warn <<EOS
10223 $startsh
10224 if test \$# -gt 0; then
10225         echo "\$@" >msg
10226 else
10227         cat >msg
10228 fi
10229 echo "*** WARNING:" >&4
10230 sed -e 's/^/*** /' <msg >&4
10231 echo "*** " >&4
10232 cat msg >>config.msg
10233 echo " " >>config.msg
10234 rm -f msg
10235 EOS
10236 chmod +x warn
10237 $eunicefix warn
10238
10239 : see which of string.h or strings.h is needed
10240 echo " "
10241 strings=`./findhdr string.h`
10242 if $test "$strings" && $test -r "$strings"; then
10243         echo "Using <string.h> instead of <strings.h>." >&4
10244         val="$define"
10245 else
10246         val="$undef"
10247         strings=`./findhdr strings.h`
10248         if $test "$strings" && $test -r "$strings"; then
10249                 echo "Using <strings.h> instead of <string.h>." >&4
10250         else
10251                 ./warn "No string header found -- You'll surely have problems."
10252         fi
10253 fi
10254 set i_string
10255 eval $setvar
10256 case "$i_string" in
10257 "$undef") strings=`./findhdr strings.h`;;
10258 *)        strings=`./findhdr string.h`;;
10259 esac
10260
10261 : see if qgcvt exists
10262 set qgcvt d_qgcvt
10263 eval $inlibc
10264
10265 : Check how to convert floats to strings.
10266
10267 if test "X$d_Gconvert" = X; then
10268
10269 echo " "
10270 echo "Checking for an efficient way to convert floats to strings."
10271 echo " " > try.c
10272 case "$uselongdouble" in
10273 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10274 esac
10275 case "$d_longdbl" in
10276 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10277 esac
10278 case "$d_PRIgldbl" in
10279 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10280 esac
10281 $cat >>try.c <<EOP
10282 #ifdef TRY_gconvert
10283 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10284 char *myname = "gconvert";
10285 #endif
10286 #ifdef TRY_gcvt
10287 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10288 char *myname = "gcvt";
10289 #endif
10290 #ifdef TRY_qgcvt
10291 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10292 char *myname = "qgcvt";
10293 #define DOUBLETYPE long double
10294 #endif
10295 #ifdef TRY_sprintf
10296 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10297 #ifdef HAS_PRIgldbl
10298 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10299 #else
10300 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10301 #endif
10302 #else
10303 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10304 #endif
10305 char *myname = "sprintf";
10306 #endif
10307
10308 #ifndef DOUBLETYPE
10309 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10310 #define DOUBLETYPE long double
10311 #else
10312 #define DOUBLETYPE double
10313 #endif
10314 #endif
10315
10316 #include <stdio.h>
10317
10318 #$i_stdlib I_STDLIB
10319 #ifdef I_STDLIB
10320 #include <stdlib.h>
10321 #endif
10322 #$i_string I_STRING
10323 #ifdef I_STRING
10324 #  include <string.h>
10325 #else
10326 #  include <strings.h>
10327 #endif
10328
10329 int checkit(char *expect, char *got)
10330 {
10331     if (strcmp(expect, got)) {
10332                 printf("%s oddity:  Expected %s, got %s\n",
10333                         myname, expect, got);
10334                 exit(1);
10335         }
10336 }
10337
10338 int main()
10339 {
10340         char buf[64];
10341         buf[63] = '\0';
10342
10343         /* This must be 1st test on (which?) platform */
10344         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10345         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10346         checkit("0.1", buf);
10347
10348         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10349         checkit("0.01", buf);
10350
10351         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10352         checkit("0.001", buf);
10353
10354         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10355         checkit("0.0001", buf);
10356
10357         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10358         if (strlen(buf) > 5)
10359             checkit("9e-005", buf); /* for Microsoft ?? */
10360         else
10361             checkit("9e-05", buf);
10362
10363         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10364         checkit("1", buf);
10365
10366         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10367         checkit("1.1", buf);
10368
10369         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10370         checkit("1.01", buf);
10371
10372         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10373         checkit("1.001", buf);
10374
10375         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10376         checkit("1.0001", buf);
10377
10378         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10379         checkit("1.00001", buf);
10380
10381         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10382         checkit("1.000001", buf);
10383
10384         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10385         checkit("0", buf);
10386
10387         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10388         checkit("-1", buf);
10389
10390         /* Some Linux gcvt's give 1.e+5 here. */
10391         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10392         checkit("100000", buf);
10393
10394         /* Some Linux gcvt's give -1.e+5 here. */
10395         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10396         checkit("-100000", buf);
10397
10398         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10399         checkit("123.456", buf);
10400
10401         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10402         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10403         /* 34 should be enough to scare even long double
10404          * places into using the e notation. */
10405         if (strlen(buf) > 5)
10406             checkit("1e+034", buf); /* for Microsoft */
10407         else
10408             checkit("1e+34", buf);
10409
10410         /* For Perl, if you add additional tests here, also add them to
10411          * t/base/num.t for benefit of platforms not using Configure or
10412          * overriding d_Gconvert */
10413
10414         exit(0);
10415 }
10416 EOP
10417 : first add preferred functions to our list
10418 xxx_list=""
10419 for xxx_convert in $gconvert_preference; do
10420     case $xxx_convert in
10421     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10422     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10423     esac
10424 done
10425 : then add any others
10426 for xxx_convert in gconvert gcvt sprintf; do
10427     case "$xxx_list" in
10428     *$xxx_convert*) ;;
10429     *) xxx_list="$xxx_list $xxx_convert" ;;
10430     esac
10431 done
10432
10433 case "$d_longdbl$uselongdouble" in
10434 "$define$define")
10435     : again, add preferred functions to our list first
10436     xxx_ld_list=""
10437     for xxx_convert in $gconvert_ld_preference; do
10438         case $xxx_convert in
10439         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10440         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10441         esac
10442     done
10443     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10444     for xxx_convert in qgcvt sprintf $xxx_list; do
10445         case "$xxx_ld_list" in
10446         $xxx_convert*|*" $xxx_convert"*) ;;
10447         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10448         esac
10449     done
10450     : if sprintf cannot do long doubles, move it to the end
10451     if test "$d_PRIgldbl" != "$define"; then
10452         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10453     fi
10454     : if no qgcvt, remove it
10455     if test "$d_qgcvt" != "$define"; then
10456         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10457     fi
10458     : use the ld_list
10459     xxx_list="$xxx_ld_list"
10460     ;;
10461 esac
10462
10463 for xxx_convert in $xxx_list; do
10464         echo "Trying $xxx_convert..."
10465         $rm -f try try$_o core
10466         set try -DTRY_$xxx_convert
10467         if eval $compile; then
10468                 echo "$xxx_convert() found." >&4
10469                 if $run ./try; then
10470                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10471                         break;
10472                 else
10473                         echo "...But $xxx_convert didn't work as I expected."
10474                         xxx_convert=''
10475                 fi
10476         else
10477                 echo "$xxx_convert NOT found." >&4
10478         fi
10479 done
10480
10481 if test X$xxx_convert = X; then
10482     echo "*** WHOA THERE!!! ***" >&4
10483     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10484     xxx_convert=sprintf
10485 fi
10486
10487 case "$xxx_convert" in
10488 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10489 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10490 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10491 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10492    "$define$define$define")
10493       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10494    "$define$define$undef")
10495       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10496    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10497    esac
10498    ;;
10499 esac
10500
10501 fi
10502 $rm_try
10503
10504 : see if _fwalk exists
10505 set fwalk d__fwalk
10506 eval $inlibc
10507
10508 : Initialize h_fcntl
10509 h_fcntl=false
10510
10511 : Initialize h_sysfile
10512 h_sysfile=false
10513
10514 : access call always available on UNIX
10515 set access d_access
10516 eval $inlibc
10517
10518 : locate the flags for 'access()'
10519 case "$d_access" in
10520 "$define")
10521         echo " "
10522         $cat >access.c <<EOCP
10523 #include <sys/types.h>
10524 #ifdef I_FCNTL
10525 #include <fcntl.h>
10526 #endif
10527 #ifdef I_SYS_FILE
10528 #include <sys/file.h>
10529 #endif
10530 #ifdef I_UNISTD
10531 #include <unistd.h>
10532 #endif
10533 #$i_stdlib I_STDLIB
10534 #ifdef I_STDLIB
10535 #include <stdlib.h>
10536 #endif
10537 int main() {
10538         exit(R_OK);
10539 }
10540 EOCP
10541         : check sys/file.h first, no particular reason here
10542         if $test `./findhdr sys/file.h` && \
10543                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10544                 h_sysfile=true;
10545                 echo "<sys/file.h> defines the *_OK access constants." >&4
10546         elif $test `./findhdr fcntl.h` && \
10547                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10548                 h_fcntl=true;
10549                 echo "<fcntl.h> defines the *_OK access constants." >&4
10550         elif $test `./findhdr unistd.h` && \
10551                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10552                 echo "<unistd.h> defines the *_OK access constants." >&4
10553         else
10554                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10555         fi
10556         ;;
10557 esac
10558 $rm -f access*
10559
10560 : see if accessx exists
10561 set accessx d_accessx
10562 eval $inlibc
10563
10564 : see if aintl exists
10565 set aintl d_aintl
10566 eval $inlibc
10567
10568 : see if alarm exists
10569 set alarm d_alarm
10570 eval $inlibc
10571
10572 : see if 64bit time functions exists
10573
10574 set ctime64 d_ctime64
10575 eval $inlibc
10576
10577 set localtime64 d_localtime64
10578 eval $inlibc
10579
10580 set gmtime64 d_gmtime64
10581 eval $inlibc
10582
10583 set mktime64 d_mktime64
10584 eval $inlibc
10585
10586 set difftime64 d_difftime64
10587 eval $inlibc
10588
10589 set asctime64 d_asctime64
10590 eval $inlibc
10591
10592 : see if POSIX threads are available
10593 set pthread.h i_pthread
10594 eval $inhdr
10595
10596 : define a function to check prototypes
10597 $cat > protochk <<EOSH
10598 $startsh
10599 cc="$cc"
10600 optimize="$optimize"
10601 ccflags="$ccflags"
10602 prototype="$prototype"
10603 define="$define"
10604 rm_try="$rm_try"
10605 usethreads=$usethreads
10606 i_pthread=$i_pthread
10607 pthread_h_first=$pthread_h_first
10608 EOSH
10609
10610 $cat >> protochk <<'EOSH'
10611
10612 $rm_try
10613 foo="$1"
10614 shift
10615 while test $# -ge 2; do
10616         case "$1" in
10617                 $define) echo "#include <$2>" >> try.c ;;
10618                 literal) echo "$2" >> try.c ;;
10619         esac
10620     # Extra magic for the benefit of systems that need pthread.h
10621     # to be included early to correctly detect threadsafe functions.
10622     # Such functions must guarantee themselves, though, that the usethreads
10623     # and i_pthread have been defined, before calling protochk.
10624     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10625         echo "#include <pthread.h>" >> try.c
10626         pthread_h_done=yes
10627     fi
10628     shift 2
10629 done
10630 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10631 cat >> try.c <<'EOCP'
10632 #ifdef CAN_PROTOTYPE
10633 #define _(args) args
10634 #else
10635 #define _(args) ()
10636 #endif
10637 EOCP
10638 echo "$foo" >> try.c
10639 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10640 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10641 status=$?
10642 $rm_try
10643 exit $status
10644 EOSH
10645 chmod +x protochk
10646 $eunicefix protochk
10647
10648 : Define hasproto macro for Configure internal use
10649 hasproto='varname=$1; func=$2; shift; shift;
10650 while $test $# -ge 2; do
10651         case "$1" in
10652         $define) echo "#include <$2>";;
10653         esac ;
10654     shift 2;
10655 done > try.c;
10656 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10657 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10658         echo "$func() prototype found.";
10659         val="$define";
10660 else
10661         echo "$func() prototype NOT found.";
10662         val="$undef";
10663 fi;
10664 set $varname;
10665 eval $setvar;
10666 $rm_try tryout.c'
10667
10668 : see if sys/types.h has to be included
10669 set sys/types.h i_systypes
10670 eval $inhdr
10671
10672 : see if sys/select.h has to be included
10673 set sys/select.h i_sysselct
10674 eval $inhdr
10675
10676 : Define hasfield macro for Configure internal use
10677 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10678 while $test $# -ge 2; do
10679         case "$1" in
10680         $define) echo "#include <$2>";;
10681         esac ;
10682     shift 2;
10683 done > try.c;
10684 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10685 set try;
10686 if eval $compile; then
10687         val="$define";
10688 else
10689         val="$undef";
10690 fi;
10691 set $varname;
10692 eval $setvar;
10693 $rm_try'
10694
10695 : see if we should include time.h, sys/time.h, or both
10696 echo " "
10697 if test "X$timeincl" = X; then
10698         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10699         $echo $n "I'm now running the test program...$c"
10700         $cat >try.c <<EOCP
10701 #include <sys/types.h>
10702 #ifdef I_TIME
10703 #include <time.h>
10704 #endif
10705 #ifdef I_SYSTIME
10706 #ifdef SYSTIMEKERNEL
10707 #define KERNEL
10708 #endif
10709 #include <sys/time.h>
10710 #endif
10711 #ifdef I_SYSSELECT
10712 #include <sys/select.h>
10713 #endif
10714 #$i_stdlib I_STDLIB
10715 #ifdef I_STDLIB
10716 #include <stdlib.h>
10717 #endif
10718 int main()
10719 {
10720         struct tm foo;
10721 #ifdef S_TIMEVAL
10722         struct timeval bar;
10723 #endif
10724 #ifdef S_TIMEZONE
10725         struct timezone tzp;
10726 #endif
10727         if (foo.tm_sec == foo.tm_sec)
10728                 exit(0);
10729 #ifdef S_TIMEVAL
10730         if (bar.tv_sec == bar.tv_sec)
10731                 exit(0);
10732 #endif
10733         exit(1);
10734 }
10735 EOCP
10736         flags=''
10737         for s_timezone in '-DS_TIMEZONE' ''; do
10738         sysselect=''
10739         for s_timeval in '-DS_TIMEVAL' ''; do
10740         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10741         for i_time in '' '-DI_TIME'; do
10742         for i_systime in '-DI_SYSTIME' ''; do
10743                 case "$flags" in
10744                 '') $echo $n ".$c"
10745                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10746                         if eval $compile; then
10747                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10748                                 shift
10749                                 flags="$*"
10750                                 echo " "
10751                                 $echo $n "Succeeded with $flags$c"
10752                         fi
10753                         ;;
10754                 esac
10755         done
10756         done
10757         done
10758         done
10759         done
10760         timeincl=''
10761         echo " "
10762         case "$flags" in
10763         *SYSTIMEKERNEL*) i_systimek="$define"
10764                 timeincl=`./findhdr sys/time.h`
10765                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10766         *) i_systimek="$undef";;
10767         esac
10768         case "$flags" in
10769         *I_TIME*) i_time="$define"
10770                 timeincl=`./findhdr time.h`" $timeincl"
10771                 echo "We'll include <time.h>." >&4;;
10772         *) i_time="$undef";;
10773         esac
10774         case "$flags" in
10775         *I_SYSTIME*) i_systime="$define"
10776                 timeincl=`./findhdr sys/time.h`" $timeincl"
10777                 echo "We'll include <sys/time.h>." >&4;;
10778         *) i_systime="$undef";;
10779         esac
10780         $rm_try
10781 fi
10782 : see if struct tm knows about tm_zone
10783 case "$i_systime$i_time" in
10784 *$define*)
10785         echo " "
10786         echo "Checking to see if your struct tm has tm_zone field..." >&4
10787         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10788         eval $hasfield
10789         ;;
10790 *)      val="$undef"
10791         set d_tm_tm_zone
10792         eval $setvar
10793         ;;
10794 esac
10795 case "$d_tm_tm_zone" in
10796 "$define")      echo "Yes, it does."   ;;
10797 *)              echo "No, it doesn't." ;;
10798 esac
10799 : see if struct tm knows about tm_gmtoff
10800 case "$i_systime$i_time" in
10801 *$define*)
10802         echo " "
10803         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10804         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10805         eval $hasfield
10806         ;;
10807 *)      val="$undef"
10808         set d_tm_tm_gmtoff
10809         eval $setvar
10810         ;;
10811 esac
10812 case "$d_tm_tm_gmtoff" in
10813 "$define")      echo "Yes, it does."   ;;
10814 *)              echo "No, it doesn't." ;;
10815 esac
10816
10817 : see if asctime_r exists
10818 set asctime_r d_asctime_r
10819 eval $inlibc
10820 case "$d_asctime_r" in
10821 "$define")
10822         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10823         case "$d_asctime_r_proto:$usethreads" in
10824         ":define")      d_asctime_r_proto=define
10825                 set d_asctime_r_proto asctime_r $hdrs
10826                 eval $hasproto ;;
10827         *)      ;;
10828         esac
10829         case "$d_asctime_r_proto" in
10830         define)
10831         case "$asctime_r_proto" in
10832         ''|0) try='char* asctime_r(const struct tm*, char*);'
10833         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10834         esac
10835         case "$asctime_r_proto" in
10836         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10837         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10838         esac
10839         case "$asctime_r_proto" in
10840         ''|0) try='int asctime_r(const struct tm*, char*);'
10841         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10842         esac
10843         case "$asctime_r_proto" in
10844         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10845         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10846         esac
10847         case "$asctime_r_proto" in
10848         ''|0)   d_asctime_r=undef
10849                 asctime_r_proto=0
10850                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10851         * )     case "$asctime_r_proto" in
10852                 REENTRANT_PROTO*) ;;
10853                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10854                 esac
10855                 echo "Prototype: $try" ;;
10856         esac
10857         ;;
10858         *)      case "$usethreads" in
10859                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10860                 esac
10861                 d_asctime_r=undef
10862                 asctime_r_proto=0
10863                 ;;
10864         esac
10865         ;;
10866 *)      asctime_r_proto=0
10867         ;;
10868 esac
10869
10870 : see if atolf exists
10871 set atolf d_atolf
10872 eval $inlibc
10873
10874 : see if atoll exists
10875 set atoll d_atoll
10876 eval $inlibc
10877
10878 : Look for GCC-style attribute format
10879 case "$d_attribute_format" in
10880 '')
10881 echo " "
10882 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10883 $cat >attrib.c <<'EOCP'
10884 #include <stdio.h>
10885 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10886 EOCP
10887 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10888         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10889                 echo "Your C compiler doesn't support __attribute__((format))."
10890                 val="$undef"
10891         else
10892                 echo "Your C compiler supports __attribute__((format))."
10893                 val="$define"
10894         fi
10895 else
10896         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10897         val="$undef"
10898 fi
10899 ;;
10900 *) val="$d_attribute_format" ;;
10901 esac
10902 set d_attribute_format
10903 eval $setvar
10904 $rm -f attrib*
10905
10906 : Look for GCC-style attribute format with null format allowed
10907 case "$d_printf_format_null" in
10908 '') case "$d_attribute_format" in
10909     $define)
10910         echo " "
10911         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10912 $cat >attrib.c <<EOCP
10913 #include <stdio.h>
10914 #$i_stdlib I_STDLIB
10915 #ifdef I_STDLIB
10916 #include <stdlib.h>
10917 #endif
10918 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10919 int null_printf (char* pat,...) { return (int)pat; }
10920 int main () { exit(null_printf(NULL)); }
10921 EOCP
10922         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10923             : run the executable in case it produces a run-time warning
10924             if $run ./attrib >>attrib.out 2>&1; then
10925                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10926                     echo "Your C compiler doesn't allow __printf__ format to be null."
10927                     val="$undef"
10928                 else
10929                     echo "Your C compiler allows __printf__ format to be null."
10930                     val="$define"
10931                 fi
10932             else
10933             echo "Your C compiler executable failed with __printf__ format null."
10934             val="$undef"
10935         fi
10936     else
10937         echo "Your C compiler fails with __printf__ format null."
10938         val="$undef"
10939     fi
10940     ;;
10941     *)  val="$undef" ;;
10942     esac
10943 ;;
10944 *)  val="$d_printf_format_null" ;;
10945 esac
10946 set d_printf_format_null
10947 eval $setvar
10948 $rm -f attrib*
10949
10950 : Look for GCC-style attribute malloc
10951 case "$d_attribute_malloc" in
10952 '')
10953 echo " "
10954 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10955 $cat >attrib.c <<'EOCP'
10956 #include <stdio.h>
10957 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10958 EOCP
10959 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10960         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10961                 echo "Your C compiler doesn't support __attribute__((malloc))."
10962                 val="$undef"
10963         else
10964                 echo "Your C compiler supports __attribute__((malloc))."
10965                 val="$define"
10966         fi
10967 else
10968         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10969         val="$undef"
10970 fi
10971 ;;
10972 *) val="$d_attribute_malloc" ;;
10973 esac
10974 set d_attribute_malloc
10975 eval $setvar
10976 $rm -f attrib*
10977
10978 : Look for GCC-style attribute nonnull
10979 case "$d_attribute_nonnull" in
10980 '')
10981 echo " "
10982 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10983 $cat >attrib.c <<'EOCP'
10984 #include <stdio.h>
10985 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10986 EOCP
10987 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10988         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10989                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10990                 val="$undef"
10991         else
10992                 echo "Your C compiler supports __attribute__((nonnull))."
10993                 val="$define"
10994         fi
10995 else
10996         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10997         val="$undef"
10998 fi
10999 ;;
11000 *) val="$d_attribute_nonnull" ;;
11001 esac
11002 set d_attribute_nonnull
11003 eval $setvar
11004 $rm -f attrib*
11005
11006 : Look for GCC-style attribute noreturn
11007 case "$d_attribute_noreturn" in
11008 '')
11009 echo " "
11010 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
11011 $cat >attrib.c <<'EOCP'
11012 #include <stdio.h>
11013 void fall_over_dead( void ) __attribute__((noreturn));
11014 EOCP
11015 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11016         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11017                 echo "Your C compiler doesn't support __attribute__((noreturn))."
11018                 val="$undef"
11019         else
11020                 echo "Your C compiler supports __attribute__((noreturn))."
11021                 val="$define"
11022         fi
11023 else
11024         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11025         val="$undef"
11026 fi
11027 ;;
11028 *) val="$d_attribute_noreturn" ;;
11029 esac
11030 set d_attribute_noreturn
11031 eval $setvar
11032 $rm -f attrib*
11033
11034 : Look for GCC-style attribute pure
11035 case "$d_attribute_pure" in
11036 '')
11037 echo " "
11038 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
11039 $cat >attrib.c <<'EOCP'
11040 #include <stdio.h>
11041 int square( int n ) __attribute__((pure));
11042 EOCP
11043 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11044         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11045                 echo "Your C compiler doesn't support __attribute__((pure))."
11046                 val="$undef"
11047         else
11048                 echo "Your C compiler supports __attribute__((pure))."
11049                 val="$define"
11050         fi
11051 else
11052         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11053         val="$undef"
11054 fi
11055 ;;
11056 *) val="$d_attribute_pure" ;;
11057 esac
11058 set d_attribute_pure
11059 eval $setvar
11060 $rm -f attrib*
11061
11062 : Look for GCC-style attribute unused
11063 case "$d_attribute_unused" in
11064 '')
11065 echo " "
11066 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11067 $cat >attrib.c <<'EOCP'
11068 #include <stdio.h>
11069 int do_something( int dummy __attribute__((unused)), int n );
11070 EOCP
11071 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11072         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11073                 echo "Your C compiler doesn't support __attribute__((unused))."
11074                 val="$undef"
11075         else
11076                 echo "Your C compiler supports __attribute__((unused))."
11077                 val="$define"
11078         fi
11079 else
11080         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11081         val="$undef"
11082 fi
11083 ;;
11084 *) val="$d_attribute_unused" ;;
11085 esac
11086 set d_attribute_unused
11087 eval $setvar
11088 $rm -f attrib*
11089
11090 : Look for GCC-style attribute deprecated
11091 case "$d_attribute_deprecated" in
11092 '')
11093 echo " "
11094 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11095 $cat >attrib.c <<'EOCP'
11096 #include <stdio.h>
11097 int I_am_deprecated(void) __attribute__((deprecated));
11098 EOCP
11099 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11100         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11101                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11102                 val="$undef"
11103         else
11104                 echo "Your C compiler supports __attribute__((deprecated))."
11105                 val="$define"
11106         fi
11107 else
11108         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11109         val="$undef"
11110 fi
11111 ;;
11112 *) val="$d_attribute_deprecated" ;;
11113 esac
11114 set d_attribute_deprecated
11115 eval $setvar
11116 $rm -f attrib*
11117
11118 : Look for GCC-style attribute warn_unused_result
11119 case "$d_attribute_warn_unused_result" in
11120 '')
11121 echo " "
11122 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11123 $cat >attrib.c <<'EOCP'
11124 #include <stdio.h>
11125 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11126 EOCP
11127 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11128         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11129                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11130                 val="$undef"
11131         else
11132                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11133                 val="$define"
11134         fi
11135 else
11136         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11137         val="$undef"
11138 fi
11139 ;;
11140 *) val="$d_attribute_warn_unused_result" ;;
11141 esac
11142 set d_attribute_warn_unused_result
11143 eval $setvar
11144 $rm -f attrib*
11145
11146 : see if bcmp exists
11147 set bcmp d_bcmp
11148 eval $inlibc
11149
11150 : see if bcopy exists
11151 set bcopy d_bcopy
11152 eval $inlibc
11153
11154 : see if getpgrp exists
11155 set getpgrp d_getpgrp
11156 eval $inlibc
11157
11158 case "$d_getpgrp" in
11159 "$define")
11160         echo " "
11161         echo "Checking to see which flavor of getpgrp is in use..."
11162         $cat >try.c <<EOP
11163 #$i_unistd I_UNISTD
11164 #include <sys/types.h>
11165 #ifdef I_UNISTD
11166 #  include <unistd.h>
11167 #endif
11168 #$i_stdlib I_STDLIB
11169 #ifdef I_STDLIB
11170 #include <stdlib.h>
11171 #endif
11172 int main()
11173 {
11174         if (getuid() == 0) {
11175                 printf("(I see you are running Configure as super-user...)\n");
11176                 setuid(1);
11177         }
11178 #ifdef TRY_BSD_PGRP
11179         if (getpgrp(1) == 0)
11180                 exit(0);
11181 #else
11182         if (getpgrp() > 0)
11183                 exit(0);
11184 #endif
11185         exit(1);
11186 }
11187 EOP
11188         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11189                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11190                 val="$define"
11191         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11192                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11193                 val="$undef"
11194         else
11195                 echo "I can't seem to compile and run the test program."
11196                 if ./usg; then
11197                         xxx="a USG one, i.e. you use getpgrp()."
11198                 else
11199                         # SVR4 systems can appear rather BSD-ish.
11200                         case "$i_unistd" in
11201                         $undef)
11202                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11203                                 val="$define"
11204                                 ;;
11205                         $define)
11206                                 xxx="probably a USG one, i.e. you use getpgrp()."
11207                                 val="$undef"
11208                                 ;;
11209                         esac
11210                 fi
11211                 echo "Assuming your getpgrp is $xxx" >&4
11212         fi
11213         ;;
11214 *) val="$undef";;
11215 esac
11216 set d_bsdgetpgrp
11217 eval $setvar
11218 $rm_try
11219
11220 : see if setpgrp exists
11221 set setpgrp d_setpgrp
11222 eval $inlibc
11223
11224 case "$d_setpgrp" in
11225 "$define")
11226         echo " "
11227         echo "Checking to see which flavor of setpgrp is in use..."
11228         $cat >try.c <<EOP
11229 #$i_unistd I_UNISTD
11230 #include <sys/types.h>
11231 #ifdef I_UNISTD
11232 #  include <unistd.h>
11233 #endif
11234 #$i_stdlib I_STDLIB
11235 #ifdef I_STDLIB
11236 #include <stdlib.h>
11237 #endif
11238 int main()
11239 {
11240         if (getuid() == 0) {
11241                 printf("(I see you are running Configure as super-user...)\n");
11242                 setuid(1);
11243         }
11244 #ifdef TRY_BSD_PGRP
11245         if (-1 == setpgrp(1, 1))
11246                 exit(0);
11247 #else
11248         if (setpgrp() != -1)
11249                 exit(0);
11250 #endif
11251         exit(1);
11252 }
11253 EOP
11254         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11255                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11256                 val="$define"
11257         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11258                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11259                 val="$undef"
11260         else
11261                 echo "(I can't seem to compile and run the test program.)"
11262                 if ./usg; then
11263                         xxx="a USG one, i.e. you use setpgrp()."
11264                 else
11265                         # SVR4 systems can appear rather BSD-ish.
11266                         case "$i_unistd" in
11267                         $undef)
11268                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11269                                 val="$define"
11270                                 ;;
11271                         $define)
11272                                 xxx="probably a USG one, i.e. you use setpgrp()."
11273                                 val="$undef"
11274                                 ;;
11275                         esac
11276                 fi
11277                 echo "Assuming your setpgrp is $xxx" >&4
11278         fi
11279         ;;
11280 *) val="$undef";;
11281 esac
11282 set d_bsdsetpgrp
11283 eval $setvar
11284 $rm_try
11285
11286 : Look for GCC-style __builtin_choose_expr
11287 case "$d_builtin_choose_expr" in
11288 '')
11289     echo " "
11290     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11291     $cat >try.c <<'EOCP'
11292 #include <assert.h>
11293 #include <stdlib.h>
11294 #include <stdio.h>
11295
11296 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11297
11298 int main(void) {
11299     assert( SYRINX(1) == 2112 );
11300     assert( SYRINX(1) != 5150 );
11301     assert( SYRINX(0) == 5150 );
11302     assert( SYRINX(0) != 2112 );
11303     puts( "All good!" );
11304     exit(0);
11305 }
11306
11307 EOCP
11308     set try
11309     if eval $compile && $run ./try; then
11310         echo "Your C compiler supports __builtin_choose_expr."
11311         val="$define"
11312     else
11313         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11314         val="$undef"
11315     fi
11316 ;;
11317 *) val="$d_builtin_choose_expr" ;;
11318 esac
11319
11320 set d_builtin_choose_expr
11321 eval $setvar
11322 $rm_try
11323
11324 : Look for GCC-style __builtin_expect
11325 case "$d_builtin_expect" in
11326 '')
11327     echo " "
11328     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11329     $cat >try.c <<'EOCP'
11330 int main(void) {
11331     int n = 50;
11332     if ( __builtin_expect(n, 0) ) n = 1;
11333     /* Remember shell exit code truth is 0, C truth is non-zero */
11334     return !(n == 1);
11335 }
11336 EOCP
11337     set try
11338     if eval $compile && $run ./try; then
11339         echo "Your C compiler supports __builtin_expect."
11340         val="$define"
11341     else
11342         echo "Your C compiler doesn't seem to understand __builtin_expect."
11343         val="$undef"
11344     fi
11345     ;;
11346 *) val="$d_builtin_expect" ;;
11347 esac
11348
11349 set d_builtin_expect
11350 eval $setvar
11351 $rm_try
11352
11353 : see if bzero exists
11354 set bzero d_bzero
11355 eval $inlibc
11356
11357 : see if stdarg is available
11358 echo " "
11359 if $test `./findhdr stdarg.h`; then
11360         echo "<stdarg.h> found." >&4
11361         valstd="$define"
11362 else
11363         echo "<stdarg.h> NOT found." >&4
11364         valstd="$undef"
11365 fi
11366
11367 : see if varargs is available
11368 echo " "
11369 if $test `./findhdr varargs.h`; then
11370         echo "<varargs.h> found." >&4
11371 else
11372         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11373 fi
11374
11375 : set up the varargs testing programs
11376 $cat > varargs.c <<EOP
11377 #ifdef I_STDARG
11378 #include <stdarg.h>
11379 #endif
11380 #ifdef I_VARARGS
11381 #include <varargs.h>
11382 #endif
11383
11384 #ifdef I_STDARG
11385 int f(char *p, ...)
11386 #else
11387 int f(va_alist)
11388 va_dcl
11389 #endif
11390 {
11391         va_list ap;
11392 #ifndef I_STDARG
11393         char *p;
11394 #endif
11395 #ifdef I_STDARG
11396         va_start(ap,p);
11397 #else
11398         va_start(ap);
11399         p = va_arg(ap, char *);
11400 #endif
11401         va_end(ap);
11402         return 0;
11403 }
11404 EOP
11405 $cat > varargs <<EOP
11406 $startsh
11407 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11408         echo "true"
11409 else
11410         echo "false"
11411 fi
11412 $rm -f varargs$_o
11413 EOP
11414 chmod +x varargs
11415
11416 : now check which varargs header should be included
11417 echo " "
11418 i_varhdr=''
11419 val=''
11420 case "$valstd" in
11421 "$define")
11422         if `./varargs I_STDARG`; then
11423                 val='stdarg.h'
11424         elif `./varargs I_VARARGS`; then
11425                 val='varargs.h'
11426         fi
11427         ;;
11428 *)
11429         if `./varargs I_VARARGS`; then
11430                 val='varargs.h'
11431         fi
11432         ;;
11433 esac
11434 case "$val" in
11435 '')
11436         echo " "
11437         echo "*** WHOA THERE!!! ***" >&4
11438         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11439         case "$knowitall" in
11440         '')
11441         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11442                 exit 1
11443                 ;;
11444         esac
11445 echo "I could not find the definition for va_dcl... You have problems..." >&4
11446         val="$undef"; set i_stdarg; eval $setvar
11447         val="$undef"; set i_varargs; eval $setvar
11448         ;;
11449 *)
11450         set i_varhdr
11451         eval $setvar
11452         case "$i_varhdr" in
11453         stdarg.h)
11454                 val="$define"; set i_stdarg; eval $setvar
11455                 val="$undef"; set i_varargs; eval $setvar
11456                 ;;
11457         varargs.h)
11458                 val="$undef"; set i_stdarg; eval $setvar
11459                 val="$define"; set i_varargs; eval $setvar
11460                 ;;
11461         esac
11462         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11463 esac
11464 $rm -f varargs*
11465
11466 : see if the Compiler supports C99 variadic macros
11467 case "$i_stdarg$i_stdlib" in
11468     "$define$define")
11469     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11470     $cat >try.c <<EOCP
11471 #include <stdio.h>
11472 #include <stdarg.h>
11473
11474 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11475
11476 int main() {
11477   char buf[20];
11478   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11479   puts(buf);
11480   return 0;
11481 }
11482 EOCP
11483     set try
11484     if eval $compile && $run ./try 2>&1 >/dev/null; then
11485         case "`$run ./try`" in
11486             "123 456 789")
11487             echo "You have C99 variadic macros." >&4
11488             d_c99_variadic_macros="$define"
11489             ;;
11490             *)
11491             echo "You don't have functional C99 variadic macros." >&4
11492             d_c99_variadic_macros="$undef"
11493             ;;
11494         esac
11495     else
11496         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11497         d_c99_variadic_macros="$undef"
11498     fi
11499     $rm_try
11500     ;;
11501     *)
11502     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11503     d_c99_variadic_macros="$undef"
11504     ;;
11505 esac
11506
11507 : see if signal is declared as pointer to function returning int or void
11508 echo " "
11509 xxx=`./findhdr signal.h`
11510 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11511 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11512         echo "You have int (*signal())() instead of void." >&4
11513         val="$undef"
11514 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11515         echo "You have void (*signal())()." >&4
11516         val="$define"
11517 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11518         echo "You have int (*signal())() instead of void." >&4
11519         val="$undef"
11520 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11521         echo "You have void (*signal())()." >&4
11522         val="$define"
11523 else
11524         case "$d_voidsig" in
11525         '')
11526         echo "I can't determine whether signal handler returns void or int..." >&4
11527                 dflt=void
11528                 rp="What type does your signal handler return?"
11529                 . ./myread
11530                 case "$ans" in
11531                 v*) val="$define";;
11532                 *) val="$undef";;
11533                 esac;;
11534         "$define")
11535                 echo "As you already told me, signal handler returns void." >&4
11536                 val="$define"
11537                 ;;
11538         *)      echo "As you already told me, signal handler returns int." >&4
11539                 val="$undef"
11540                 ;;
11541         esac
11542 fi
11543 set d_voidsig
11544 eval $setvar
11545 case "$d_voidsig" in
11546 "$define") signal_t="void";;
11547 *) signal_t="int";;
11548 esac
11549 $rm -f $$.tmp
11550
11551 : check for ability to cast large floats to 32-bit ints.
11552 echo " "
11553 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11554 if $test "$intsize" -ge 4; then
11555         xxx=int
11556 else
11557         xxx=long
11558 fi
11559 $cat >try.c <<EOCP
11560 #include <stdio.h>
11561 #$i_stdlib I_STDLIB
11562 #ifdef I_STDLIB
11563 #include <stdlib.h>
11564 #endif
11565 #include <sys/types.h>
11566 #include <signal.h>
11567 $signal_t blech(int s) { exit(3); }
11568 int main()
11569 {
11570         $xxx i32;
11571         double f, g;
11572         int result = 0;
11573         char str[16];
11574         signal(SIGFPE, blech);
11575
11576         /* Don't let compiler optimize the test away.  Store the number
11577            in a writable string for gcc to pass to sscanf under HP-UX.
11578         */
11579         sprintf(str, "2147483647");
11580         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11581         g = 10 * f;
11582         i32  = ($xxx) g;
11583
11584         /* x86 processors will probably give 0x8000 0000, which is a
11585            sign change.  We don't want that.  We want to mimic SPARC
11586            behavior here, which is to preserve the sign and give
11587            back 0x7fff ffff.
11588         */
11589         if (i32 != ($xxx) f)
11590                 result |= 1;
11591         exit(result);
11592 }
11593 EOCP
11594 set try
11595 if eval $compile_ok; then
11596         $run ./try
11597         yyy=$?
11598 else
11599         echo "(I can't seem to compile the test program--assuming it can't)"
11600         yyy=1
11601 fi
11602 case "$yyy" in
11603 0)      val="$define"
11604         echo "Yup, it can."
11605         ;;
11606 *)      val="$undef"
11607         echo "Nope, it can't."
11608         ;;
11609 esac
11610 set d_casti32
11611 eval $setvar
11612 $rm_try
11613
11614 : check for ability to cast negative floats to unsigned
11615 echo " "
11616 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11617 $cat >try.c <<EOCP
11618 #include <stdio.h>
11619 #$i_stdlib I_STDLIB
11620 #ifdef I_STDLIB
11621 #include <stdlib.h>
11622 #endif
11623 #include <sys/types.h>
11624 #include <signal.h>
11625 $signal_t blech(int s) { exit(7); }
11626 $signal_t blech_in_list(int s) { exit(4); }
11627 unsigned long dummy_long(unsigned long p) { return p; }
11628 unsigned int dummy_int(unsigned int p) { return p; }
11629 unsigned short dummy_short(unsigned short p) { return p; }
11630 int main()
11631 {
11632         double f;
11633         unsigned long along;
11634         unsigned int aint;
11635         unsigned short ashort;
11636         int result = 0;
11637         char str[16];
11638
11639         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11640            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11641            optimized the whole file away
11642         */
11643         /* Store the number in a writable string for gcc to pass to
11644            sscanf under HP-UX.
11645         */
11646         sprintf(str, "-123");
11647         sscanf(str, "%lf", &f);  /* f = -123.; */
11648
11649         signal(SIGFPE, blech);
11650         along = (unsigned long)f;
11651         aint = (unsigned int)f;
11652         ashort = (unsigned short)f;
11653         if (along != (unsigned long)-123)
11654                 result |= 1;
11655         if (aint != (unsigned int)-123)
11656                 result |= 1;
11657         if (ashort != (unsigned short)-123)
11658                 result |= 1;
11659         sprintf(str, "1073741824.");
11660         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11661         f = f + f;
11662         along = 0;
11663         along = (unsigned long)f;
11664         if (along != 0x80000000)
11665                 result |= 2;
11666         f -= 1.;
11667         along = 0;
11668         along = (unsigned long)f;
11669         if (along != 0x7fffffff)
11670                 result |= 1;
11671         f += 2.;
11672         along = 0;
11673         along = (unsigned long)f;
11674         if (along != 0x80000001)
11675                 result |= 2;
11676         if (result)
11677                 exit(result);
11678         signal(SIGFPE, blech_in_list);
11679         sprintf(str, "123.");
11680         sscanf(str, "%lf", &f);  /* f = 123.; */
11681         along = dummy_long((unsigned long)f);
11682         aint = dummy_int((unsigned int)f);
11683         ashort = dummy_short((unsigned short)f);
11684         if (along != (unsigned long)123)
11685                 result |= 4;
11686         if (aint != (unsigned int)123)
11687                 result |= 4;
11688         if (ashort != (unsigned short)123)
11689                 result |= 4;
11690         exit(result);
11691
11692 }
11693 EOCP
11694 set try
11695 if eval $compile_ok; then
11696         $run ./try
11697         castflags=$?
11698 else
11699         echo "(I can't seem to compile the test program--assuming it can't)"
11700         castflags=7
11701 fi
11702 case "$castflags" in
11703 0)      val="$define"
11704         echo "Yup, it can."
11705         ;;
11706 *)      val="$undef"
11707         echo "Nope, it can't."
11708         ;;
11709 esac
11710 set d_castneg
11711 eval $setvar
11712 $rm_try
11713
11714 : see if vprintf exists
11715 echo " "
11716 if set vprintf val -f d_vprintf; eval $csym; $val; then
11717         echo 'vprintf() found.' >&4
11718         val="$define"
11719         $cat >try.c <<EOF
11720 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11721 #$i_varargs I_VARARGS
11722
11723 #$i_stdlib I_STDLIB
11724 #$i_unistd I_UNISTD
11725
11726 #ifdef I_STDARG
11727 #  include <stdarg.h>
11728 #else /* I_VARARGS */
11729 #  include <varargs.h>
11730 #endif
11731
11732 #ifdef I_UNISTD
11733 #  include <unistd.h>
11734 #endif
11735
11736 #ifdef I_STDLIB
11737 #  include <stdlib.h>
11738 #endif
11739
11740 #include <stdio.h> /* vsprintf prototype */
11741
11742 #ifdef I_STDARG
11743 void xxx(int n, ...)
11744 {
11745     va_list args;
11746     char buf[10];
11747     va_start(args, n);
11748     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11749 }
11750 int main() { xxx(1, "foo"); }
11751
11752 #else /* I_VARARGS */
11753
11754 xxx(va_alist)
11755 va_dcl
11756 {
11757     va_list args;
11758     char buf[10];
11759     va_start(args);
11760     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11761 }
11762 int main() { xxx("foo"); }
11763
11764 #endif
11765
11766 EOF
11767         set try
11768         if eval $compile_ok; then
11769                 if $run ./try; then
11770                         echo "Your vsprintf() returns (int)." >&4
11771                         val2="$undef"
11772                 else
11773                         echo "Your vsprintf() returns (char*)." >&4
11774                         val2="$define"
11775                 fi
11776         else
11777                 echo 'I am unable to compile the vsprintf() test program.' >&4
11778                 # We shouldn't get here.  If we do, assume the standard signature,
11779                 # not the old BSD one.
11780                 echo 'Guessing that vsprintf() returns (int).' >&4
11781                 val2="$undef"
11782         fi
11783 else
11784         echo 'vprintf() NOT found.' >&4
11785         val="$undef"
11786         val2="$undef"
11787 fi
11788 $rm_try
11789 set d_vprintf
11790 eval $setvar
11791 val=$val2
11792 set d_charvspr
11793 eval $setvar
11794
11795 : see if chown exists
11796 set chown d_chown
11797 eval $inlibc
11798
11799 : see if chroot exists
11800 set chroot d_chroot
11801 eval $inlibc
11802
11803 : see if chsize exists
11804 set chsize d_chsize
11805 eval $inlibc
11806
11807 : see if class exists
11808 set class d_class
11809 eval $inlibc
11810
11811 : see if clearenv exists
11812 set clearenv d_clearenv
11813 eval $inlibc
11814
11815 : Define hasstruct macro for Configure internal use
11816 hasstruct='varname=$1; struct=$2; shift; shift;
11817 while $test $# -ge 2; do
11818         case "$1" in
11819         $define) echo "#include <$2>";;
11820         esac ;
11821     shift 2;
11822 done > try.c;
11823 echo "int main () { struct $struct foo; }" >> try.c;
11824 set try;
11825 if eval $compile; then
11826         val="$define";
11827 else
11828         val="$undef";
11829 fi;
11830 set $varname;
11831 eval $setvar;
11832 $rm_try'
11833
11834 : see whether socket exists
11835 socketlib=''
11836 sockethdr=''
11837 echo " "
11838 $echo $n "Hmm... $c" >&4
11839 if set socket val -f d_socket; eval $csym; $val; then
11840     echo "Looks like you have Berkeley networking support." >&4
11841     d_socket="$define"
11842     if set setsockopt val -f; eval $csym; $val; then
11843         d_oldsock="$undef"
11844     else
11845         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11846         d_oldsock="$define"
11847     fi
11848 else
11849     if $contains socklib libc.list >/dev/null 2>&1; then
11850         echo "Looks like you have Berkeley networking support." >&4
11851         d_socket="$define"
11852         : we will have to assume that it supports the 4.2 BSD interface
11853         d_oldsock="$undef"
11854     else
11855         echo "You don't have Berkeley networking in libc$_a..." >&4
11856         if test "X$d_socket" = "X$define"; then
11857             echo "...but you seem to believe that you have sockets." >&4
11858         else
11859             for net in net socket
11860             do
11861                 if test -f $sysroot/usr/lib/lib$net$_a; then
11862                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11863                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11864                     if $contains socket libc.list >/dev/null 2>&1; then
11865                         d_socket="$define"
11866                         socketlib="-l$net"
11867                         case "$net" in
11868                         net)
11869                             echo "...but the Wollongong group seems to have hacked it in." >&4
11870                             sockethdr="-I$sysroot/usr/netinclude"
11871                             ;;
11872                         esac
11873                         echo "Found Berkeley sockets interface in lib$net." >&4
11874                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11875                             d_oldsock="$undef"
11876                         else
11877                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11878                             d_oldsock="$define"
11879                         fi
11880                         break
11881                     fi
11882                 fi
11883             done
11884             if test "X$d_socket" != "X$define"; then
11885                echo "or anywhere else I see." >&4
11886                d_socket="$undef"
11887                d_oldsock="$undef"
11888             fi
11889         fi
11890     fi
11891 fi
11892
11893 : see if socketpair exists
11894 set socketpair d_sockpair
11895 eval $inlibc
11896
11897
11898 echo " "
11899 echo "Checking the availability sa_len in the sock struct ..." >&4
11900 $cat >try.c <<EOF
11901 #include <sys/types.h>
11902 #include <sys/socket.h>
11903 int main() {
11904 struct sockaddr sa;
11905 return (sa.sa_len);
11906 }
11907 EOF
11908 val="$undef"
11909 set try; if eval $compile; then
11910     val="$define"
11911 fi
11912 set d_sockaddr_sa_len; eval $setvar
11913 $rm_try
11914
11915 echo " "
11916 echo "Checking the availability struct sockaddr_in6 ..." >&4
11917 $cat >try.c <<EOF
11918 #include <sys/types.h>
11919 #include <sys/socket.h>
11920 #include <netinet/in.h>
11921 int main() {
11922 struct sockaddr_in6 sin6;
11923 return (sin6.sin6_family);
11924 }
11925 EOF
11926 val="$undef"
11927 set try; if eval $compile; then
11928     val="$define"
11929 fi
11930 set d_sockaddr_in6; eval $setvar
11931 $rm_try
11932
11933 echo " "
11934 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11935 $cat >try.c <<EOF
11936 #include <sys/types.h>
11937 #include <sys/socket.h>
11938 #include <netinet/in.h>
11939 int main() {
11940 struct sockaddr_in6 sin6;
11941 return (sin6.sin6_scope_id);
11942 }
11943 EOF
11944 val="$undef"
11945 set try; if eval $compile; then
11946     val="$define"
11947 fi
11948 set d_sin6_scope_id; eval $setvar
11949 $rm_try
11950
11951 echo " "
11952 echo "Checking the availability struct ip_mreq ..." >&4
11953 $cat >try.c <<EOF
11954 #include <sys/types.h>
11955 #include <sys/socket.h>
11956 #include <netinet/in.h>
11957 int main() {
11958 struct ip_mreq mreq;
11959 return (mreq.imr_multiaddr.s_addr);
11960 }
11961 EOF
11962 val="$undef"
11963 set try; if eval $compile; then
11964        val="$define"
11965 fi
11966 set d_ip_mreq; eval $setvar
11967 $rm_try
11968
11969 echo " "
11970 echo "Checking the availability struct ip_mreq_source ..." >&4
11971 $cat >try.c <<EOF
11972 #include <sys/types.h>
11973 #include <sys/socket.h>
11974 #include <netinet/in.h>
11975 int main() {
11976 struct ip_mreq_source mreq;
11977 return (mreq.imr_multiaddr.s_addr);
11978 }
11979 EOF
11980 val="$undef"
11981 set try; if eval $compile; then
11982        val="$define"
11983 fi
11984 set d_ip_mreq_source; eval $setvar
11985 $rm_try
11986
11987 echo " "
11988 echo "Checking the availability struct ipv6_mreq ..." >&4
11989 $cat >try.c <<EOF
11990 #include <sys/types.h>
11991 #include <sys/socket.h>
11992 #include <netinet/in.h>
11993 int main() {
11994 struct ipv6_mreq mreq;
11995 return (mreq.ipv6mr_interface);
11996 }
11997 EOF
11998 val="$undef"
11999 set try; if eval $compile; then
12000     val="$define"
12001 fi
12002 set d_ipv6_mreq; eval $setvar
12003 $rm_try
12004
12005 echo " "
12006 echo "Checking the availability struct ipv6_mreq_source ..." >&4
12007 $cat >try.c <<EOF
12008 #include <sys/types.h>
12009 #include <sys/socket.h>
12010 #include <netinet/in.h>
12011 int main() {
12012 struct ipv6_mreq_source mreq;
12013 return (mreq.imr_multiaddr.s_addr);
12014 }
12015 EOF
12016 val="$undef"
12017 set try; if eval $compile; then
12018        val="$define"
12019 fi
12020 set d_ipv6_mreq_source; eval $setvar
12021 $rm_try
12022
12023 echo " "
12024 echo "Checking the availability of certain socket constants..." >&4
12025 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
12026     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
12027     $cat >try.c <<EOF
12028 #include <sys/types.h>
12029 #include <sys/socket.h>
12030 int main() {
12031     int i = $ENUM;
12032 }
12033 EOF
12034     val="$undef"
12035     set try; if eval $compile; then
12036         val="$define"
12037     fi
12038     set d_${enum}; eval $setvar
12039     $rm_try
12040 done
12041
12042 : see if this is a sys/uio.h system
12043 set sys/uio.h i_sysuio
12044 eval $inhdr
12045
12046 : Check for cmsghdr support
12047 echo " "
12048 echo "Checking to see if your system supports struct cmsghdr..." >&4
12049 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
12050 eval $hasstruct
12051 case "$d_cmsghdr_s" in
12052 "$define")      echo "Yes, it does."   ;;
12053 *)              echo "No, it doesn't." ;;
12054 esac
12055
12056
12057 : check for const keyword
12058 echo " "
12059 echo 'Checking to see if your C compiler knows about "const"...' >&4
12060 $cat >const.c <<'EOCP'
12061 typedef struct spug { int drokk; } spug;
12062 int main()
12063 {
12064         const char *foo;
12065         const spug y = { 0 };
12066 }
12067 EOCP
12068 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12069         val="$define"
12070         echo "Yup, it does."
12071 else
12072         val="$undef"
12073         echo "Nope, it doesn't."
12074 fi
12075 set d_const
12076 eval $setvar
12077
12078 : see if copysignl exists
12079 set copysignl d_copysignl
12080 eval $inlibc
12081
12082 : see if crypt exists
12083 echo " "
12084 set crypt d_crypt
12085 eval $inlibc
12086 case "$d_crypt" in
12087 $define) cryptlib='' ;;
12088 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12089                 echo 'crypt() found.' >&4
12090                 val="$define"
12091                 cryptlib=''
12092         else
12093                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12094                 if $test -z "$cryptlib"; then
12095                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12096                 else
12097                         cryptlib=-lcrypt
12098                 fi
12099                 if $test -z "$cryptlib"; then
12100                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12101                 else
12102                         cryptlib=-lcrypt
12103                 fi
12104                 if $test -z "$cryptlib"; then
12105                         cryptlib=`./loc libcrypt$_a "" $libpth`
12106                 else
12107                         cryptlib=-lcrypt
12108                 fi
12109                 if $test -z "$cryptlib"; then
12110                         echo 'crypt() NOT found.' >&4
12111                         val="$undef"
12112                 else
12113                         val="$define"
12114                 fi
12115         fi
12116         set d_crypt
12117         eval $setvar
12118         ;;
12119 esac
12120
12121 : see if this is a crypt.h system
12122 set crypt.h i_crypt
12123 eval $inhdr
12124
12125 : see if crypt_r exists
12126 set crypt_r d_crypt_r
12127 eval $inlibc
12128 case "$d_crypt_r" in
12129 "$define")
12130         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12131         case "$d_crypt_r_proto:$usethreads" in
12132         ":define")      d_crypt_r_proto=define
12133                 set d_crypt_r_proto crypt_r $hdrs
12134                 eval $hasproto ;;
12135         *)      ;;
12136         esac
12137         case "$d_crypt_r_proto" in
12138         define)
12139         case "$crypt_r_proto" in
12140         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12141         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12142         esac
12143         case "$crypt_r_proto" in
12144         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12145         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12146         esac
12147         case "$crypt_r_proto" in
12148         ''|0)   d_crypt_r=undef
12149                 crypt_r_proto=0
12150                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12151         * )     case "$crypt_r_proto" in
12152                 REENTRANT_PROTO*) ;;
12153                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12154                 esac
12155                 echo "Prototype: $try" ;;
12156         esac
12157         ;;
12158         *)      case "$usethreads" in
12159                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12160                 esac
12161                 d_crypt_r=undef
12162                 crypt_r_proto=0
12163                 ;;
12164         esac
12165         ;;
12166 *)      crypt_r_proto=0
12167         ;;
12168 esac
12169
12170 : get csh whereabouts
12171 case "$csh" in
12172 'csh') val="$undef" ;;
12173 *) val="$define" ;;
12174 esac
12175 set d_csh
12176 eval $setvar
12177 : Respect a hint or command line value for full_csh.
12178 case "$full_csh" in
12179 '') full_csh=$csh ;;
12180 esac
12181
12182 : see if ctermid exists
12183 set ctermid d_ctermid
12184 eval $inlibc
12185
12186 : see if ctermid_r exists
12187 set ctermid_r d_ctermid_r
12188 eval $inlibc
12189 case "$d_ctermid_r" in
12190 "$define")
12191         hdrs="$i_systypes sys/types.h define stdio.h "
12192         case "$d_ctermid_r_proto:$usethreads" in
12193         ":define")      d_ctermid_r_proto=define
12194                 set d_ctermid_r_proto ctermid_r $hdrs
12195                 eval $hasproto ;;
12196         *)      ;;
12197         esac
12198         case "$d_ctermid_r_proto" in
12199         define)
12200         case "$ctermid_r_proto" in
12201         ''|0) try='char* ctermid_r(char*);'
12202         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12203         esac
12204         case "$ctermid_r_proto" in
12205         ''|0)   d_ctermid_r=undef
12206                 ctermid_r_proto=0
12207                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12208         * )     case "$ctermid_r_proto" in
12209                 REENTRANT_PROTO*) ;;
12210                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12211                 esac
12212                 echo "Prototype: $try" ;;
12213         esac
12214         ;;
12215         *)      case "$usethreads" in
12216                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12217                 esac
12218                 d_ctermid_r=undef
12219                 ctermid_r_proto=0
12220                 ;;
12221         esac
12222         ;;
12223 *)      ctermid_r_proto=0
12224         ;;
12225 esac
12226
12227 : see if ctime_r exists
12228 set ctime_r d_ctime_r
12229 eval $inlibc
12230 case "$d_ctime_r" in
12231 "$define")
12232         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12233         case "$d_ctime_r_proto:$usethreads" in
12234         ":define")      d_ctime_r_proto=define
12235                 set d_ctime_r_proto ctime_r $hdrs
12236                 eval $hasproto ;;
12237         *)      ;;
12238         esac
12239         case "$d_ctime_r_proto" in
12240         define)
12241         case "$ctime_r_proto" in
12242         ''|0) try='char* ctime_r(const time_t*, char*);'
12243         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12244         esac
12245         case "$ctime_r_proto" in
12246         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12247         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12248         esac
12249         case "$ctime_r_proto" in
12250         ''|0) try='int ctime_r(const time_t*, char*);'
12251         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12252         esac
12253         case "$ctime_r_proto" in
12254         ''|0) try='int ctime_r(const time_t*, char*, int);'
12255         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12256         esac
12257         case "$ctime_r_proto" in
12258         ''|0)   d_ctime_r=undef
12259                 ctime_r_proto=0
12260                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12261         * )     case "$ctime_r_proto" in
12262                 REENTRANT_PROTO*) ;;
12263                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12264                 esac
12265                 echo "Prototype: $try" ;;
12266         esac
12267         ;;
12268         *)      case "$usethreads" in
12269                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12270                 esac
12271                 d_ctime_r=undef
12272                 ctime_r_proto=0
12273                 ;;
12274         esac
12275         ;;
12276 *)      ctime_r_proto=0
12277         ;;
12278 esac
12279
12280 : see if cuserid exists
12281 set cuserid d_cuserid
12282 eval $inlibc
12283
12284 : see if this is a limits.h system
12285 set limits.h i_limits
12286 eval $inhdr
12287
12288 : See if number of significant digits in a double precision number is known
12289 echo " "
12290 $cat >dbl_dig.c <<EOM
12291 #$i_limits I_LIMITS
12292 #$i_float I_FLOAT
12293 #ifdef I_LIMITS
12294 #include <limits.h>
12295 #endif
12296 #ifdef I_FLOAT
12297 #include <float.h>
12298 #endif
12299 #ifdef DBL_DIG
12300 printf("Contains DBL_DIG");
12301 #endif
12302 EOM
12303 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12304 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12305         echo "DBL_DIG found." >&4
12306         val="$define"
12307 else
12308         echo "DBL_DIG NOT found." >&4
12309         val="$undef"
12310 fi
12311 $rm -f dbl_dig.?
12312 set d_dbl_dig
12313 eval $setvar
12314
12315 : see if dbm.h is available
12316 : see if dbmclose exists
12317 set dbmclose d_dbmclose
12318 eval $inlibc
12319
12320 case "$d_dbmclose" in
12321 $define)
12322         set dbm.h i_dbm
12323         eval $inhdr
12324         case "$i_dbm" in
12325         $define)
12326                 val="$undef"
12327                 set i_rpcsvcdbm
12328                 eval $setvar
12329                 ;;
12330         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12331                 eval $inhdr
12332                 ;;
12333         esac
12334         ;;
12335 *)      echo "We won't be including <dbm.h>"
12336         val="$undef"
12337         set i_dbm
12338         eval $setvar
12339         val="$undef"
12340         set i_rpcsvcdbm
12341         eval $setvar
12342         ;;
12343 esac
12344
12345 : see if prototype for dbminit is available
12346 echo " "
12347 set d_dbminitproto dbminit $i_dbm dbm.h
12348 eval $hasproto
12349
12350 : see if difftime exists
12351 set difftime d_difftime
12352 eval $inlibc
12353
12354 : see if this is a dirent system
12355 echo " "
12356 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12357         val="$define"
12358         echo "<dirent.h> found." >&4
12359 else
12360         val="$undef"
12361         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12362                 echo "<sys/dir.h> found." >&4
12363                 echo " "
12364         else
12365                 xinc=`./findhdr sys/ndir.h`
12366         fi
12367         echo "<dirent.h> NOT found." >&4
12368 fi
12369 set i_dirent
12370 eval $setvar
12371
12372 : Look for type of directory structure.
12373 echo " "
12374 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12375
12376 case "$direntrytype" in
12377 ''|' ')
12378         case "$i_dirent" in
12379         $define) guess1='struct dirent' ;;
12380         *) guess1='struct direct'  ;;
12381         esac
12382         ;;
12383 *)      guess1="$direntrytype"
12384         ;;
12385 esac
12386
12387 case "$guess1" in
12388 'struct dirent') guess2='struct direct' ;;
12389 *) guess2='struct dirent' ;;
12390 esac
12391
12392 if $contains "$guess1" try.c >/dev/null 2>&1; then
12393         direntrytype="$guess1"
12394         echo "Your directory entries are $direntrytype." >&4
12395 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12396         direntrytype="$guess2"
12397         echo "Your directory entries seem to be $direntrytype." >&4
12398 else
12399         echo "I don't recognize your system's directory entries." >&4
12400         rp="What type is used for directory entries on this system?"
12401         dflt="$guess1"
12402         . ./myread
12403         direntrytype="$ans"
12404 fi
12405 $rm_try
12406
12407 : see if the directory entry stores field length
12408 echo " "
12409 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12410 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12411         echo "Good, your directory entry keeps length information in d_namlen." >&4
12412         val="$define"
12413 else
12414         echo "Your directory entry does not know about the d_namlen field." >&4
12415         val="$undef"
12416 fi
12417 set d_dirnamlen
12418 eval $setvar
12419 $rm_try
12420
12421 : Look for DIR.dd_fd
12422 case "$i_dirent" in
12423 "$define")
12424     echo "Checking to see if DIR has a dd_fd member variable" >&4
12425     $cat >try.c <<EOCP
12426 #$i_stdlib I_STDLIB
12427 #ifdef I_STDLIB
12428 #include <stdlib.h>
12429 #endif
12430 #include <dirent.h>
12431
12432 int main() {
12433     DIR dir;
12434     dir.dd_fd = 1;
12435     return 0;
12436 }
12437 EOCP
12438     val=$undef
12439     set try
12440     if eval $compile; then
12441         echo "Yes, it does."
12442         val="$define"
12443     else
12444         echo "No, it does not."
12445         val="$undef"
12446     fi
12447     ;;
12448 *)
12449     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12450     val="$undef"
12451     ;;
12452 esac
12453 set d_dir_dd_fd
12454 eval $setvar
12455 $rm_try
12456
12457 : see if this is an sysdir system
12458 set sys/dir.h i_sysdir
12459 eval $inhdr
12460
12461 : see if this is an sysndir system
12462 set sys/ndir.h i_sysndir
12463 eval $inhdr
12464
12465 : Look for dirfd
12466 echo " "
12467 $cat >dirfd.c <<EOM
12468 #include <stdio.h>
12469 #$i_stdlib I_STDLIB
12470 #ifdef I_STDLIB
12471 #include <stdlib.h>
12472 #endif
12473 #$i_dirent I_DIRENT             /**/
12474 #$i_sysdir I_SYS_DIR            /**/
12475 #$i_sysndir I_SYS_NDIR          /**/
12476 #$i_systypes I_SYS_TYPES        /**/
12477 #if defined(I_SYS_TYPES)
12478 #include <sys/types.h>
12479 #endif
12480 #if defined(I_DIRENT)
12481 #include <dirent.h>
12482 #else
12483 #ifdef I_SYS_NDIR
12484 #include <sys/ndir.h>
12485 #else
12486 #ifdef I_SYS_DIR
12487 #ifdef hp9000s500
12488 #include <ndir.h>       /* may be wrong in the future */
12489 #else
12490 #include <sys/dir.h>
12491 #endif
12492 #endif
12493 #endif
12494 #endif
12495 int main() {
12496         DIR *dirp = opendir(".");
12497         if (dirfd(dirp) >= 0)
12498                 exit(0);
12499         else
12500                 exit(1);
12501 }
12502 EOM
12503 val=$undef
12504 set dirfd
12505 if eval $compile; then
12506         val="$define"
12507 fi
12508 case "$val" in
12509 $define)        echo "dirfd() found." >&4       ;;
12510 *)              echo "dirfd() NOT found." >&4   ;;
12511 esac
12512 set d_dirfd
12513 eval $setvar
12514 $rm -f dirfd*
12515
12516 : see if dladdr exists
12517 set dladdr d_dladdr
12518 eval $inlibc
12519
12520 : see if dlerror exists
12521 xxx_runnm="$runnm"
12522 runnm=false
12523 set dlerror d_dlerror
12524 eval $inlibc
12525 runnm="$xxx_runnm"
12526
12527 : see if dlfcn is available
12528 set dlfcn.h i_dlfcn
12529 eval $inhdr
12530
12531 : Check what extension to use for shared libs
12532 case "$usedl" in
12533 $define|y|true)
12534         $cat << EOM
12535
12536 On a few systems, the dynamically loaded modules that perl generates and uses
12537 will need a different extension than shared libs. The default will probably
12538 be appropriate.
12539
12540 EOM
12541         case "$dlext" in
12542         '')     dflt="$so" ;;
12543         *)      dflt="$dlext" ;;
12544         esac
12545         rp='What is the extension of dynamically loaded modules'
12546         . ./myread
12547         dlext="$ans"
12548         ;;
12549 *)
12550         dlext="none"
12551         ;;
12552 esac
12553
12554 : Check if dlsym need a leading underscore
12555 echo " "
12556 val="$undef"
12557
12558 case "$dlsrc" in
12559 dl_dlopen.xs)
12560         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12561         $cat >dyna.c <<'EOM'
12562 fred () { }
12563 EOM
12564
12565 $cat >fred.c<<EOM
12566
12567 #include <stdio.h>
12568 #$i_stdlib I_STDLIB
12569 #ifdef I_STDLIB
12570 #include <stdlib.h>
12571 #endif
12572 #$i_dlfcn I_DLFCN
12573 #ifdef I_DLFCN
12574 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12575 #else
12576 #include <sys/types.h>
12577 #include <nlist.h>
12578 #include <link.h>
12579 #endif
12580
12581 extern int fred() ;
12582
12583 int main()
12584 {
12585     void * handle ;
12586     void * symbol ;
12587 #ifndef RTLD_LAZY
12588     int mode = 1 ;
12589 #else
12590     int mode = RTLD_LAZY ;
12591 #endif
12592     handle = dlopen("./dyna.$dlext", mode) ;
12593     if (handle == NULL) {
12594         printf ("1\n") ;
12595         fflush (stdout) ;
12596         exit(0);
12597     }
12598     symbol = dlsym(handle, "fred") ;
12599     if (symbol == NULL) {
12600         /* try putting a leading underscore */
12601         symbol = dlsym(handle, "_fred") ;
12602         if (symbol == NULL) {
12603             printf ("2\n") ;
12604             fflush (stdout) ;
12605             exit(0);
12606         }
12607         printf ("3\n") ;
12608     }
12609     else
12610         printf ("4\n") ;
12611     fflush (stdout) ;
12612     exit(0);
12613 }
12614 EOM
12615         : Call the object file tmp-dyna.o in case dlext=o.
12616         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12617                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12618                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12619                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12620                 xxx=`$run ./fred`
12621                 case $xxx in
12622                 1)      echo "Test program failed using dlopen." >&4
12623                         echo "Perhaps you should not use dynamic loading." >&4;;
12624                 2)      echo "Test program failed using dlsym." >&4
12625                         echo "Perhaps you should not use dynamic loading." >&4;;
12626                 3)      echo "dlsym needs a leading underscore" >&4
12627                         val="$define" ;;
12628                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12629                 esac
12630         else
12631                 echo "I can't compile and run the test program." >&4
12632                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12633         fi
12634         ;;
12635 esac
12636
12637 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12638
12639 set d_dlsymun
12640 eval $setvar
12641
12642 : see if drand48_r exists
12643 set drand48_r d_drand48_r
12644 eval $inlibc
12645 case "$d_drand48_r" in
12646 "$define")
12647         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12648         case "$d_drand48_r_proto:$usethreads" in
12649         ":define")      d_drand48_r_proto=define
12650                 set d_drand48_r_proto drand48_r $hdrs
12651                 eval $hasproto ;;
12652         *)      ;;
12653         esac
12654         case "$d_drand48_r_proto" in
12655         define)
12656         case "$drand48_r_proto" in
12657         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12658         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12659         esac
12660         case "$drand48_r_proto" in
12661         ''|0)   d_drand48_r=undef
12662                 drand48_r_proto=0
12663                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12664         * )     case "$drand48_r_proto" in
12665                 REENTRANT_PROTO*) ;;
12666                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12667                 esac
12668                 echo "Prototype: $try" ;;
12669         esac
12670         ;;
12671         *)      case "$usethreads" in
12672                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12673                 esac
12674                 d_drand48_r=undef
12675                 drand48_r_proto=0
12676                 ;;
12677         esac
12678         ;;
12679 *)      drand48_r_proto=0
12680         ;;
12681 esac
12682
12683 : see if prototype for drand48 is available
12684 echo " "
12685 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12686 eval $hasproto
12687
12688 : see if dup2 exists
12689 set dup2 d_dup2
12690 eval $inlibc
12691
12692 : see if eaccess exists
12693 set eaccess d_eaccess
12694 eval $inlibc
12695
12696 : see if endgrent exists
12697 set endgrent d_endgrent
12698 eval $inlibc
12699
12700 : see if this is an grp system
12701 set grp.h i_grp
12702 eval $inhdr
12703
12704 case "$i_grp" in
12705 $define)
12706         xxx=`./findhdr grp.h`
12707         $cppstdin $cppflags $cppminus < $xxx >$$.h
12708
12709         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12710                 val="$define"
12711         else
12712                 val="$undef"
12713         fi
12714         set d_grpasswd
12715         eval $setvar
12716
12717         $rm -f $$.h
12718         ;;
12719 *)
12720         val="$undef";
12721         set d_grpasswd; eval $setvar
12722         ;;
12723 esac
12724
12725 : see if endgrent_r exists
12726 set endgrent_r d_endgrent_r
12727 eval $inlibc
12728 case "$d_endgrent_r" in
12729 "$define")
12730         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12731         case "$d_endgrent_r_proto:$usethreads" in
12732         ":define")      d_endgrent_r_proto=define
12733                 set d_endgrent_r_proto endgrent_r $hdrs
12734                 eval $hasproto ;;
12735         *)      ;;
12736         esac
12737         case "$d_endgrent_r_proto" in
12738         define)
12739         case "$endgrent_r_proto" in
12740         ''|0) try='int endgrent_r(FILE**);'
12741         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12742         esac
12743         case "$endgrent_r_proto" in
12744         ''|0) try='void endgrent_r(FILE**);'
12745         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12746         esac
12747         case "$endgrent_r_proto" in
12748         ''|0)   d_endgrent_r=undef
12749                 endgrent_r_proto=0
12750                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12751         * )     case "$endgrent_r_proto" in
12752                 REENTRANT_PROTO*) ;;
12753                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12754                 esac
12755                 echo "Prototype: $try" ;;
12756         esac
12757         ;;
12758         *)      case "$usethreads" in
12759                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12760                 esac
12761                 d_endgrent_r=undef
12762                 endgrent_r_proto=0
12763                 ;;
12764         esac
12765         ;;
12766 *)      endgrent_r_proto=0
12767         ;;
12768 esac
12769
12770 : see if endhostent exists
12771 set endhostent d_endhent
12772 eval $inlibc
12773
12774 : see if this is a netdb.h system
12775 set netdb.h i_netdb
12776 eval $inhdr
12777
12778 : see if endhostent_r exists
12779 set endhostent_r d_endhostent_r
12780 eval $inlibc
12781 case "$d_endhostent_r" in
12782 "$define")
12783         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12784         case "$d_endhostent_r_proto:$usethreads" in
12785         ":define")      d_endhostent_r_proto=define
12786                 set d_endhostent_r_proto endhostent_r $hdrs
12787                 eval $hasproto ;;
12788         *)      ;;
12789         esac
12790         case "$d_endhostent_r_proto" in
12791         define)
12792         case "$endhostent_r_proto" in
12793         ''|0) try='int endhostent_r(struct hostent_data*);'
12794         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12795         esac
12796         case "$endhostent_r_proto" in
12797         ''|0) try='void endhostent_r(struct hostent_data*);'
12798         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12799         esac
12800         case "$endhostent_r_proto" in
12801         ''|0)   d_endhostent_r=undef
12802                 endhostent_r_proto=0
12803                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12804         * )     case "$endhostent_r_proto" in
12805                 REENTRANT_PROTO*) ;;
12806                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12807                 esac
12808                 echo "Prototype: $try" ;;
12809         esac
12810         ;;
12811         *)      case "$usethreads" in
12812                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12813                 esac
12814                 d_endhostent_r=undef
12815                 endhostent_r_proto=0
12816                 ;;
12817         esac
12818         ;;
12819 *)      endhostent_r_proto=0
12820         ;;
12821 esac
12822
12823 : see if endnetent exists
12824 set endnetent d_endnent
12825 eval $inlibc
12826
12827 : see if endnetent_r exists
12828 set endnetent_r d_endnetent_r
12829 eval $inlibc
12830 case "$d_endnetent_r" in
12831 "$define")
12832         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12833         case "$d_endnetent_r_proto:$usethreads" in
12834         ":define")      d_endnetent_r_proto=define
12835                 set d_endnetent_r_proto endnetent_r $hdrs
12836                 eval $hasproto ;;
12837         *)      ;;
12838         esac
12839         case "$d_endnetent_r_proto" in
12840         define)
12841         case "$endnetent_r_proto" in
12842         ''|0) try='int endnetent_r(struct netent_data*);'
12843         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12844         esac
12845         case "$endnetent_r_proto" in
12846         ''|0) try='void endnetent_r(struct netent_data*);'
12847         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12848         esac
12849         case "$endnetent_r_proto" in
12850         ''|0)   d_endnetent_r=undef
12851                 endnetent_r_proto=0
12852                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12853         * )     case "$endnetent_r_proto" in
12854                 REENTRANT_PROTO*) ;;
12855                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12856                 esac
12857                 echo "Prototype: $try" ;;
12858         esac
12859         ;;
12860         *)      case "$usethreads" in
12861                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12862                 esac
12863                 d_endnetent_r=undef
12864                 endnetent_r_proto=0
12865                 ;;
12866         esac
12867         ;;
12868 *)      endnetent_r_proto=0
12869         ;;
12870 esac
12871
12872 : see if endprotoent exists
12873 set endprotoent d_endpent
12874 eval $inlibc
12875
12876 : see if endprotoent_r exists
12877 set endprotoent_r d_endprotoent_r
12878 eval $inlibc
12879 case "$d_endprotoent_r" in
12880 "$define")
12881         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12882         case "$d_endprotoent_r_proto:$usethreads" in
12883         ":define")      d_endprotoent_r_proto=define
12884                 set d_endprotoent_r_proto endprotoent_r $hdrs
12885                 eval $hasproto ;;
12886         *)      ;;
12887         esac
12888         case "$d_endprotoent_r_proto" in
12889         define)
12890         case "$endprotoent_r_proto" in
12891         ''|0) try='int endprotoent_r(struct protoent_data*);'
12892         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12893         esac
12894         case "$endprotoent_r_proto" in
12895         ''|0) try='void endprotoent_r(struct protoent_data*);'
12896         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12897         esac
12898         case "$endprotoent_r_proto" in
12899         ''|0)   d_endprotoent_r=undef
12900                 endprotoent_r_proto=0
12901                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12902         * )     case "$endprotoent_r_proto" in
12903                 REENTRANT_PROTO*) ;;
12904                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12905                 esac
12906                 echo "Prototype: $try" ;;
12907         esac
12908         ;;
12909         *)      case "$usethreads" in
12910                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12911                 esac
12912                 d_endprotoent_r=undef
12913                 endprotoent_r_proto=0
12914                 ;;
12915         esac
12916         ;;
12917 *)      endprotoent_r_proto=0
12918         ;;
12919 esac
12920
12921 : see if endpwent exists
12922 set endpwent d_endpwent
12923 eval $inlibc
12924
12925 : see if this is a pwd.h system
12926 set pwd.h i_pwd
12927 eval $inhdr
12928
12929 case "$i_pwd" in
12930 $define)
12931         xxx=`./findhdr pwd.h`
12932         $cppstdin $cppflags $cppminus < $xxx >$$.h
12933
12934         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12935                 val="$define"
12936         else
12937                 val="$undef"
12938         fi
12939         set d_pwquota
12940         eval $setvar
12941
12942         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12943                 val="$define"
12944         else
12945                 val="$undef"
12946         fi
12947         set d_pwage
12948         eval $setvar
12949
12950         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12951                 val="$define"
12952         else
12953                 val="$undef"
12954         fi
12955         set d_pwchange
12956         eval $setvar
12957
12958         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12959                 val="$define"
12960         else
12961                 val="$undef"
12962         fi
12963         set d_pwclass
12964         eval $setvar
12965
12966         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12967                 val="$define"
12968         else
12969                 val="$undef"
12970         fi
12971         set d_pwexpire
12972         eval $setvar
12973
12974         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12975                 val="$define"
12976         else
12977                 val="$undef"
12978         fi
12979         set d_pwcomment
12980         eval $setvar
12981
12982         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12983                 val="$define"
12984         else
12985                 val="$undef"
12986         fi
12987         set d_pwgecos
12988         eval $setvar
12989
12990         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12991                 val="$define"
12992         else
12993                 val="$undef"
12994         fi
12995         set d_pwpasswd
12996         eval $setvar
12997
12998         $rm -f $$.h
12999         ;;
13000 *)
13001         val="$undef";
13002         set d_pwquota; eval $setvar
13003         set d_pwage; eval $setvar
13004         set d_pwchange; eval $setvar
13005         set d_pwclass; eval $setvar
13006         set d_pwexpire; eval $setvar
13007         set d_pwcomment; eval $setvar
13008         set d_pwgecos; eval $setvar
13009         set d_pwpasswd; eval $setvar
13010         ;;
13011 esac
13012
13013 : see if endpwent_r exists
13014 set endpwent_r d_endpwent_r
13015 eval $inlibc
13016 case "$d_endpwent_r" in
13017 "$define")
13018         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13019         case "$d_endpwent_r_proto:$usethreads" in
13020         ":define")      d_endpwent_r_proto=define
13021                 set d_endpwent_r_proto endpwent_r $hdrs
13022                 eval $hasproto ;;
13023         *)      ;;
13024         esac
13025         case "$d_endpwent_r_proto" in
13026         define)
13027         case "$endpwent_r_proto" in
13028         ''|0) try='int endpwent_r(FILE**);'
13029         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
13030         esac
13031         case "$endpwent_r_proto" in
13032         ''|0) try='void endpwent_r(FILE**);'
13033         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
13034         esac
13035         case "$endpwent_r_proto" in
13036         ''|0)   d_endpwent_r=undef
13037                 endpwent_r_proto=0
13038                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
13039         * )     case "$endpwent_r_proto" in
13040                 REENTRANT_PROTO*) ;;
13041                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
13042                 esac
13043                 echo "Prototype: $try" ;;
13044         esac
13045         ;;
13046         *)      case "$usethreads" in
13047                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
13048                 esac
13049                 d_endpwent_r=undef
13050                 endpwent_r_proto=0
13051                 ;;
13052         esac
13053         ;;
13054 *)      endpwent_r_proto=0
13055         ;;
13056 esac
13057
13058 : see if endservent exists
13059 set endservent d_endsent
13060 eval $inlibc
13061
13062 : see if endservent_r exists
13063 set endservent_r d_endservent_r
13064 eval $inlibc
13065 case "$d_endservent_r" in
13066 "$define")
13067         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13068         case "$d_endservent_r_proto:$usethreads" in
13069         ":define")      d_endservent_r_proto=define
13070                 set d_endservent_r_proto endservent_r $hdrs
13071                 eval $hasproto ;;
13072         *)      ;;
13073         esac
13074         case "$d_endservent_r_proto" in
13075         define)
13076         case "$endservent_r_proto" in
13077         ''|0) try='int endservent_r(struct servent_data*);'
13078         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13079         esac
13080         case "$endservent_r_proto" in
13081         ''|0) try='void endservent_r(struct servent_data*);'
13082         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13083         esac
13084         case "$endservent_r_proto" in
13085         ''|0)   d_endservent_r=undef
13086                 endservent_r_proto=0
13087                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13088         * )     case "$endservent_r_proto" in
13089                 REENTRANT_PROTO*) ;;
13090                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13091                 esac
13092                 echo "Prototype: $try" ;;
13093         esac
13094         ;;
13095         *)      case "$usethreads" in
13096                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13097                 esac
13098                 d_endservent_r=undef
13099                 endservent_r_proto=0
13100                 ;;
13101         esac
13102         ;;
13103 *)      endservent_r_proto=0
13104         ;;
13105 esac
13106
13107 : Locate the flags for 'open()'
13108 echo " "
13109 $cat >try.c <<EOCP
13110 #include <sys/types.h>
13111 #ifdef I_FCNTL
13112 #include <fcntl.h>
13113 #endif
13114 #ifdef I_SYS_FILE
13115 #include <sys/file.h>
13116 #endif
13117 #$i_stdlib I_STDLIB
13118 #ifdef I_STDLIB
13119 #include <stdlib.h>
13120 #endif
13121 int main() {
13122         if(O_RDONLY);
13123 #ifdef O_TRUNC
13124         exit(0);
13125 #else
13126         exit(1);
13127 #endif
13128 }
13129 EOCP
13130 : check sys/file.h first to get FREAD on Sun
13131 if $test `./findhdr sys/file.h` && \
13132                 set try -DI_SYS_FILE && eval $compile; then
13133         h_sysfile=true;
13134         echo "<sys/file.h> defines the O_* constants..." >&4
13135         if $run ./try; then
13136                 echo "and you have the 3 argument form of open()." >&4
13137                 val="$define"
13138         else
13139                 echo "but not the 3 argument form of open().  Oh, well." >&4
13140                 val="$undef"
13141         fi
13142 elif $test `./findhdr fcntl.h` && \
13143                 set try -DI_FCNTL && eval $compile; then
13144         h_fcntl=true;
13145         echo "<fcntl.h> defines the O_* constants..." >&4
13146         if $run ./try; then
13147                 echo "and you have the 3 argument form of open()." >&4
13148                 val="$define"
13149         else
13150                 echo "but not the 3 argument form of open().  Oh, well." >&4
13151                 val="$undef"
13152         fi
13153 else
13154         val="$undef"
13155         echo "I can't find the O_* constant definitions!  You got problems." >&4
13156 fi
13157 set d_open3
13158 eval $setvar
13159 $rm_try
13160
13161 : see if this is a sys/file.h system
13162 val=''
13163 set sys/file.h val
13164 eval $inhdr
13165
13166 : do we need to include sys/file.h ?
13167 case "$val" in
13168 "$define")
13169         echo " "
13170         if $h_sysfile; then
13171                 val="$define"
13172                 echo "We'll be including <sys/file.h>." >&4
13173         else
13174                 val="$undef"
13175                 echo "We won't be including <sys/file.h>." >&4
13176         fi
13177         ;;
13178 *)
13179         h_sysfile=false
13180         ;;
13181 esac
13182 set i_sysfile
13183 eval $setvar
13184
13185 : see if acosh exists
13186 set acosh d_acosh
13187 eval $inlibc
13188
13189 : see if asinh exists
13190 set asinh d_asinh
13191 eval $inlibc
13192
13193 : see if atanh exists
13194 set atanh d_atanh
13195 eval $inlibc
13196
13197 : see if cbrt exists
13198 set cbrt d_cbrt
13199 eval $inlibc
13200
13201 : see if copysign exists
13202 set copysign d_copysign
13203 eval $inlibc
13204
13205 : see if erf exists
13206 set erf d_erf
13207 eval $inlibc
13208
13209 : see if erfc exists
13210 set erfc d_erfc
13211 eval $inlibc
13212
13213 : see if exp2 exists
13214 set exp2 d_exp2
13215 eval $inlibc
13216
13217 : see if expm1 exists
13218 set expm1 d_expm1
13219 eval $inlibc
13220
13221 : see if fdim exists
13222 set fdim d_fdim
13223 eval $inlibc
13224
13225 : see if fma exists
13226 set fma d_fma
13227 eval $inlibc
13228
13229 : see if fmax exists
13230 set fmax d_fmax
13231 eval $inlibc
13232
13233 : see if fmin exists
13234 set fmin d_fmin
13235 eval $inlibc
13236
13237 : see if hypot exists
13238 set hypot d_hypot
13239 eval $inlibc
13240
13241 : see if ilogb exists
13242 set ilogb d_ilogb
13243 eval $inlibc
13244
13245 : see if lgamma exists
13246 set lgamma d_lgamma
13247 eval $inlibc
13248
13249 : see if lgamma_r exists
13250 set lgamma_r d_lgamma_r
13251 eval $inlibc
13252
13253 : see if llrint exists
13254 set llrint d_llrint
13255 eval $inlibc
13256
13257 : see if llround exists
13258 set llround d_llround
13259 eval $inlibc
13260
13261 : see if log1p exists
13262 set log1p d_log1p
13263 eval $inlibc
13264
13265 : see if log2 exists
13266 set log2 d_log2
13267 eval $inlibc
13268
13269 : see if logb exists
13270 set logb d_logb
13271 eval $inlibc
13272
13273 : see if lrint exists
13274 set lrint d_lrint
13275 eval $inlibc
13276
13277 : see if lround exists
13278 set lround d_lround
13279 eval $inlibc
13280
13281 : see if nan exists
13282 set nan d_nan
13283 eval $inlibc
13284
13285 : see if nearbyint exists
13286 set nearbyint d_nearbyint
13287 eval $inlibc
13288
13289 : see if nextafter exists
13290 set nextafter d_nextafter
13291 eval $inlibc
13292
13293 : see if nexttoward exists
13294 set nexttoward d_nexttoward
13295 eval $inlibc
13296
13297 : see if remainder exists
13298 set remainder d_remainder
13299 eval $inlibc
13300
13301 : see if remquo exists
13302 set remquo d_remquo
13303 eval $inlibc
13304
13305 : see if rint exists
13306 set rint d_rint
13307 eval $inlibc
13308
13309 : see if round exists
13310 set round d_round
13311 eval $inlibc
13312
13313 : see if scalbn exists
13314 set scalbn d_scalbn
13315 eval $inlibc
13316
13317 : see if tgamma exists
13318 set tgamma d_tgamma
13319 eval $inlibc
13320
13321 : see if trunc exists
13322 set trunc d_trunc
13323 eval $inlibc
13324
13325 : see if fcntl.h is there
13326 val=''
13327 set fcntl.h val
13328 eval $inhdr
13329
13330 : see if we can include fcntl.h
13331 case "$val" in
13332 "$define")
13333         echo " "
13334         if $h_fcntl; then
13335                 val="$define"
13336                 echo "We'll be including <fcntl.h>." >&4
13337         else
13338                 val="$undef"
13339                 if $h_sysfile; then
13340         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13341                 else
13342                         echo "We won't be including <fcntl.h>." >&4
13343                 fi
13344         fi
13345         ;;
13346 *)
13347         h_fcntl=false
13348         val="$undef"
13349         ;;
13350 esac
13351 set i_fcntl
13352 eval $setvar
13353
13354 : see if fork exists
13355 set fork d_fork
13356 eval $inlibc
13357
13358 : see if pipe exists
13359 set pipe d_pipe
13360 eval $inlibc
13361
13362 : check for non-blocking I/O stuff
13363 case "$h_sysfile" in
13364 true) echo "#include <sys/file.h>" > head.c;;
13365 *)
13366        case "$h_fcntl" in
13367        true) echo "#include <fcntl.h>" > head.c;;
13368        *) echo "#include <sys/fcntl.h>" > head.c;;
13369        esac
13370        ;;
13371 esac
13372 echo " "
13373 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13374 case "$o_nonblock" in
13375 '')
13376         $cat head.c > try.c
13377         $cat >>try.c <<EOCP
13378 #include <stdio.h>
13379 #$i_stdlib I_STDLIB
13380 #ifdef I_STDLIB
13381 #include <stdlib.h>
13382 #endif
13383 #$i_fcntl I_FCNTL
13384 #ifdef I_FCNTL
13385 #include <fcntl.h>
13386 #endif
13387 int main() {
13388 #ifdef O_NONBLOCK
13389         printf("O_NONBLOCK\n");
13390         exit(0);
13391 #endif
13392 #ifdef O_NDELAY
13393         printf("O_NDELAY\n");
13394         exit(0);
13395 #endif
13396 #ifdef FNDELAY
13397         printf("FNDELAY\n");
13398         exit(0);
13399 #endif
13400         exit(0);
13401 }
13402 EOCP
13403         set try
13404         if eval $compile_ok; then
13405                 o_nonblock=`$run ./try`
13406                 case "$o_nonblock" in
13407                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13408                 *) echo "Seems like we can use $o_nonblock.";;
13409                 esac
13410         else
13411                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13412         fi
13413         ;;
13414 *) echo "Using $hint value $o_nonblock.";;
13415 esac
13416 $rm_try
13417
13418 echo " "
13419 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13420 case "$eagain" in
13421 '')
13422         case "$d_fork:$d_pipe" in
13423         define:define)
13424         $cat head.c > try.c
13425         $cat >>try.c <<EOCP
13426 #include <errno.h>
13427 #include <sys/types.h>
13428 #include <signal.h>
13429 #include <stdio.h>
13430 #$i_stdlib I_STDLIB
13431 #ifdef I_STDLIB
13432 #include <stdlib.h>
13433 #endif
13434 #$i_fcntl I_FCNTL
13435 #ifdef I_FCNTL
13436 #include <fcntl.h>
13437 #endif
13438 #define MY_O_NONBLOCK $o_nonblock
13439 #ifndef errno  /* XXX need better Configure test */
13440 extern int errno;
13441 #endif
13442 #$i_unistd I_UNISTD
13443 #ifdef I_UNISTD
13444 #include <unistd.h>
13445 #endif
13446 #$i_string I_STRING
13447 #ifdef I_STRING
13448 #include <string.h>
13449 #else
13450 #include <strings.h>
13451 #endif
13452 $signal_t blech(int x) { exit(3); }
13453 EOCP
13454         $cat >> try.c <<'EOCP'
13455 int main()
13456 {
13457         int pd[2];
13458         int pu[2];
13459         char buf[1];
13460         char string[100];
13461         int ret;
13462
13463         ret = pipe(pd); /* Down: child -> parent */
13464         if (ret != 0)
13465                 exit(3);
13466         ret = pipe(pu); /* Up: parent -> child */
13467         if (ret != 0)
13468                 exit(3);
13469         if (0 != fork()) {
13470                 close(pd[1]);   /* Parent reads from pd[0] */
13471                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13472 #ifdef F_SETFL
13473                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13474                         exit(1);
13475 #else
13476                 exit(4);
13477 #endif
13478                 signal(SIGALRM, blech);
13479                 alarm(5);
13480                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13481                         exit(2);
13482                 sprintf(string, "%d\n", ret);
13483                 ret = write(2, string, strlen(string));
13484                 if (ret != strlen(string))
13485                         exit(3);
13486                 alarm(0);
13487 #ifdef EAGAIN
13488                 if (errno == EAGAIN) {
13489                         printf("EAGAIN\n");
13490                         goto ok;
13491                 }
13492 #endif
13493 #ifdef EWOULDBLOCK
13494                 if (errno == EWOULDBLOCK)
13495                         printf("EWOULDBLOCK\n");
13496 #endif
13497         ok:
13498                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13499                 if (ret != 1)
13500                         exit(3);
13501                 sleep(2);                               /* Give it time to close our pipe */
13502                 alarm(5);
13503                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13504                 alarm(0);
13505                 sprintf(string, "%d\n", ret);
13506                 ret = write(4, string, strlen(string));
13507                 if (ret != strlen(string))
13508                         exit(3);
13509                 exit(0);
13510         }
13511
13512         close(pd[0]);                   /* We write to pd[1] */
13513         close(pu[1]);                   /* We read from pu[0] */
13514         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13515         if (ret != 1)
13516                 exit(3);
13517         close(pd[1]);                   /* Pipe pd is now fully closed! */
13518         exit(0);                                /* Bye bye, thank you for playing! */
13519 }
13520 EOCP
13521         set try
13522         if eval $compile_ok; then
13523                 echo "$startsh" >mtry
13524                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13525                 chmod +x mtry
13526                 $run ./mtry >/dev/null 2>&1
13527                 case $? in
13528                 0) eagain=`$cat try.out`;;
13529                 1) echo "Could not perform non-blocking setting!";;
13530                 2) echo "I did a successful read() for something that was not there!";;
13531                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13532                 4) echo "Could not find F_SETFL!";;
13533                 *) echo "Something terribly wrong happened during testing.";;
13534                 esac
13535                 rd_nodata=`$cat try.ret`
13536                 echo "A read() system call with no data present returns $rd_nodata."
13537                 case "$rd_nodata" in
13538                 0|-1) ;;
13539                 *)
13540                         echo "(That's peculiar, fixing that to be -1.)"
13541                         rd_nodata=-1
13542                         ;;
13543                 esac
13544                 case "$eagain" in
13545                 '')
13546                         echo "Forcing errno EAGAIN on read() with no data available."
13547                         eagain=EAGAIN
13548                         ;;
13549                 *)
13550                         echo "Your read() sets errno to $eagain when no data is available."
13551                         ;;
13552                 esac
13553                 status=`$cat try.err`
13554                 case "$status" in
13555                 0) echo "And it correctly returns 0 to signal EOF.";;
13556                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13557                 *) echo "However, your read() returns '$status' on EOF??";;
13558                 esac
13559                 val="$define"
13560                 if test "$status" = "$rd_nodata"; then
13561                         echo "WARNING: you can't distinguish between EOF and no data!"
13562                         val="$undef"
13563                 fi
13564         else
13565                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13566                 eagain=EAGAIN
13567         fi
13568         ;;
13569         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13570                 eagain=EAGAIN
13571                 val="$define"
13572                 ;;
13573         esac
13574         set d_eofnblk
13575         eval $setvar
13576         ;;
13577 *)
13578         echo "Using $hint value $eagain."
13579         echo "Your read() returns $rd_nodata when no data is present."
13580         case "$d_eofnblk" in
13581         "$define") echo "And you can see EOF because read() returns 0.";;
13582         "$undef") echo "But you can't see EOF status from read() returned value.";;
13583         *)
13584                 echo "(Assuming you can't see EOF status from read anyway.)"
13585                 d_eofnblk=$undef
13586                 ;;
13587         esac
13588         ;;
13589 esac
13590 $rm_try head.c mtry
13591
13592 : see if _ptr and _cnt from stdio act std
13593 echo " "
13594
13595 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13596         echo "(Looks like you have stdio.h from BSD.)"
13597         case "$stdio_ptr" in
13598         '') stdio_ptr='((fp)->_p)'
13599                 ptr_lval=$define
13600                 ;;
13601         *)      ptr_lval=$d_stdio_ptr_lval;;
13602         esac
13603         case "$stdio_cnt" in
13604         '') stdio_cnt='((fp)->_r)'
13605                 cnt_lval=$define
13606                 ;;
13607         *)      cnt_lval=$d_stdio_cnt_lval;;
13608         esac
13609         case "$stdio_base" in
13610         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13611         esac
13612         case "$stdio_bufsiz" in
13613         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13614         esac
13615 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13616         echo "(Looks like you have stdio.h from Linux.)"
13617         case "$stdio_ptr" in
13618         '') stdio_ptr='((fp)->_IO_read_ptr)'
13619                 ptr_lval=$define
13620                 ;;
13621         *)      ptr_lval=$d_stdio_ptr_lval;;
13622         esac
13623         case "$stdio_cnt" in
13624         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13625                 cnt_lval=$undef
13626                 ;;
13627         *)      cnt_lval=$d_stdio_cnt_lval;;
13628         esac
13629         case "$stdio_base" in
13630         '') stdio_base='((fp)->_IO_read_base)';;
13631         esac
13632         case "$stdio_bufsiz" in
13633         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13634         esac
13635 else
13636         case "$stdio_ptr" in
13637         '') stdio_ptr='((fp)->_ptr)'
13638                 ptr_lval=$define
13639                 ;;
13640         *)      ptr_lval=$d_stdio_ptr_lval;;
13641         esac
13642         case "$stdio_cnt" in
13643         '') stdio_cnt='((fp)->_cnt)'
13644                 cnt_lval=$define
13645                 ;;
13646         *)      cnt_lval=$d_stdio_cnt_lval;;
13647         esac
13648         case "$stdio_base" in
13649         '') stdio_base='((fp)->_base)';;
13650         esac
13651         case "$stdio_bufsiz" in
13652         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13653         esac
13654 fi
13655
13656 : test whether _ptr and _cnt really work
13657 echo "Checking how std your stdio is..." >&4
13658 $cat >try.c <<EOP
13659 #include <stdio.h>
13660 #$i_stdlib I_STDLIB
13661 #ifdef I_STDLIB
13662 #include <stdlib.h>
13663 #endif
13664 #define FILE_ptr(fp)    $stdio_ptr
13665 #define FILE_cnt(fp)    $stdio_cnt
13666 int main() {
13667         FILE *fp = fopen("try.c", "r");
13668         char c = getc(fp);
13669         if (
13670                 18 <= FILE_cnt(fp) &&
13671                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13672         )
13673                 exit(0);
13674         exit(1);
13675 }
13676 EOP
13677 val="$undef"
13678 set try
13679 if eval $compile && $to try.c; then
13680         if $run ./try; then
13681                 echo "Your stdio acts pretty std."
13682                 val="$define"
13683         else
13684                 echo "Your stdio isn't very std."
13685         fi
13686 else
13687         echo "Your stdio doesn't appear very std."
13688 fi
13689 $rm_try
13690
13691 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13692 # direct buffer manipulation no longer works.  The Configure tests
13693 # should be changed to correctly detect this, but until then,
13694 # the following check should at least let perl compile and run.
13695 # (This quick fix should be updated before 5.8.1.)
13696 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13697 # A. Dougherty, June 3, 2002.
13698 case "$d_gnulibc" in
13699 $define)
13700         case "$gnulibc_version" in
13701         2.[01]*)  ;;
13702         2.2) ;;
13703         2.2.[0-9]) ;;
13704         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13705                 val="$undef"
13706                 ;;
13707         esac
13708         ;;
13709 esac
13710 set d_stdstdio
13711 eval $setvar
13712
13713 : Can _ptr be used as an lvalue?
13714 case "$d_stdstdio$ptr_lval" in
13715 $define$define) val=$define ;;
13716 *) val=$undef ;;
13717 esac
13718 set d_stdio_ptr_lval
13719 eval $setvar
13720
13721 : Can _cnt be used as an lvalue?
13722 case "$d_stdstdio$cnt_lval" in
13723 $define$define) val=$define ;;
13724 *) val=$undef ;;
13725 esac
13726 set d_stdio_cnt_lval
13727 eval $setvar
13728
13729
13730 : test whether setting _ptr sets _cnt as a side effect
13731 d_stdio_ptr_lval_sets_cnt="$undef"
13732 d_stdio_ptr_lval_nochange_cnt="$undef"
13733 case "$d_stdio_ptr_lval$d_stdstdio" in
13734 $define$define)
13735         echo "Checking to see what happens if we set the stdio ptr..." >&4
13736 $cat >try.c <<EOP
13737 #include <stdio.h>
13738 /* Can we scream? */
13739 /* Eat dust sed :-) */
13740 /* In the buffer space, no one can hear you scream. */
13741 #$i_stdlib I_STDLIB
13742 #ifdef I_STDLIB
13743 #include <stdlib.h>
13744 #endif
13745 #define FILE_ptr(fp)    $stdio_ptr
13746 #define FILE_cnt(fp)    $stdio_cnt
13747 #include <sys/types.h>
13748 int main() {
13749         FILE *fp = fopen("try.c", "r");
13750         int c;
13751         char *ptr;
13752         size_t cnt;
13753         if (!fp) {
13754             puts("Fail even to read");
13755             exit(1);
13756         }
13757         c = getc(fp); /* Read away the first # */
13758         if (c == EOF) {
13759             puts("Fail even to read");
13760             exit(1);
13761         }
13762         if (!(
13763                 18 <= FILE_cnt(fp) &&
13764                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13765         )) {
13766                 puts("Fail even to read");
13767                 exit (1);
13768         }
13769         ptr = (char*) FILE_ptr(fp);
13770         cnt = (size_t)FILE_cnt(fp);
13771
13772         FILE_ptr(fp) += 42;
13773
13774         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13775                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13776                 exit (1);
13777         }
13778         if (FILE_cnt(fp) <= 20) {
13779                 printf ("Fail (<20 chars to test)");
13780                 exit (1);
13781         }
13782         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13783                 puts("Fail compare");
13784                 exit (1);
13785         }
13786         if (cnt == FILE_cnt(fp)) {
13787                 puts("Pass_unchanged");
13788                 exit (0);
13789         }
13790         if (FILE_cnt(fp) == (cnt - 42)) {
13791                 puts("Pass_changed");
13792                 exit (0);
13793         }
13794         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13795         return 1;
13796
13797 }
13798 EOP
13799         set try
13800         if eval $compile && $to try.c; then
13801                 case `$run ./try` in
13802                 Pass_changed)
13803                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13804                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13805                 Pass_unchanged)
13806                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13807                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13808                 Fail*)
13809                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13810                 *)
13811                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13812         esac
13813         else
13814                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13815         fi
13816         $rm_try
13817         ;;
13818 esac
13819
13820 : see if _base is also standard
13821 val="$undef"
13822 case "$d_stdstdio" in
13823 $define)
13824         $cat >try.c <<EOP
13825 #include <stdio.h>
13826 #$i_stdlib I_STDLIB
13827 #ifdef I_STDLIB
13828 #include <stdlib.h>
13829 #endif
13830 #define FILE_base(fp)   $stdio_base
13831 #define FILE_bufsiz(fp) $stdio_bufsiz
13832 int main() {
13833         FILE *fp = fopen("try.c", "r");
13834         char c = getc(fp);
13835         if (
13836                 19 <= FILE_bufsiz(fp) &&
13837                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13838         )
13839                 exit(0);
13840         exit(1);
13841 }
13842 EOP
13843         set try
13844         if eval $compile && $to try.c; then
13845                 if $run ./try; then
13846                         echo "And its _base field acts std."
13847                         val="$define"
13848                 else
13849                         echo "But its _base field isn't std."
13850                 fi
13851         else
13852                 echo "However, it seems to be lacking the _base field."
13853         fi
13854         $rm_try
13855         ;;
13856 esac
13857 set d_stdiobase
13858 eval $setvar
13859
13860 : see if fast_stdio exists
13861 val="$undef"
13862 case "$d_stdstdio:$d_stdio_ptr_lval" in
13863 "$define:$define")
13864         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13865         *$define*)
13866                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13867                 val="$define"
13868                 ;;
13869         esac
13870         ;;
13871 esac
13872 set d_faststdio
13873 eval $setvar
13874
13875
13876
13877 : see if fchdir exists
13878 set fchdir d_fchdir
13879 eval $inlibc
13880
13881 : see if fchmod exists
13882 set fchmod d_fchmod
13883 eval $inlibc
13884
13885 : see if fchown exists
13886 set fchown d_fchown
13887 eval $inlibc
13888
13889 : see if this is an fcntl system
13890 set fcntl d_fcntl
13891 eval $inlibc
13892
13893 : See if fcntl-based locking works.
13894 echo " "
13895 $cat >try.c <<EOCP
13896 #$i_stdlib I_STDLIB
13897 #ifdef I_STDLIB
13898 #include <stdlib.h>
13899 #endif
13900 #include <unistd.h>
13901 #include <fcntl.h>
13902 #include <signal.h>
13903 $signal_t blech(int x) { exit(3); }
13904 int main() {
13905 #if defined(F_SETLK) && defined(F_SETLKW)
13906      struct flock flock;
13907      int retval, fd;
13908      fd = open("try.c", O_RDONLY);
13909      flock.l_type = F_RDLCK;
13910      flock.l_whence = SEEK_SET;
13911      flock.l_start = flock.l_len = 0;
13912      signal(SIGALRM, blech);
13913      alarm(10);
13914      retval = fcntl(fd, F_SETLK, &flock);
13915      close(fd);
13916      (retval < 0 ? exit(2) : exit(0));
13917 #else
13918      exit(2);
13919 #endif
13920 }
13921 EOCP
13922 echo "Checking if fcntl-based file locking works... "
13923 case "$d_fcntl" in
13924 "$define")
13925         set try
13926         if eval $compile_ok; then
13927                 if $run ./try; then
13928                         echo "Yes, it seems to work."
13929                         val="$define"
13930                 else
13931                         echo "Nope, it didn't work."
13932                         val="$undef"
13933                         case "$?" in
13934                         3) $cat >&4 <<EOM
13935 ***
13936 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13937 *** This is (almost) impossible.
13938 *** If your NFS lock daemons are not feeling well, something like
13939 *** this may happen, please investigate.  Cannot continue, aborting.
13940 ***
13941 EOM
13942                                 exit 1
13943                                 ;;
13944                         esac
13945                 fi
13946         else
13947                 echo "I'm unable to compile the test program, so I'll assume not."
13948                 val="$undef"
13949         fi
13950         ;;
13951 *) val="$undef";
13952         echo "Nope, since you don't even have fcntl()."
13953         ;;
13954 esac
13955 set d_fcntl_can_lock
13956 eval $setvar
13957 $rm_try
13958
13959 : check for fd_set items
13960 $cat <<EOM
13961
13962 Checking to see how well your C compiler handles fd_set and friends ...
13963 EOM
13964 $cat >try.c <<EOCP
13965 #$i_stdlib I_STDLIB
13966 #ifdef I_STDLIB
13967 #include <stdlib.h>
13968 #endif
13969 #$i_systime I_SYS_TIME
13970 #$i_sysselct I_SYS_SELECT
13971 #$d_socket HAS_SOCKET
13972 #include <sys/types.h>
13973 #ifdef HAS_SOCKET
13974 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13975 #endif
13976 #ifdef I_SYS_TIME
13977 #include <sys/time.h>
13978 #endif
13979 #ifdef I_SYS_SELECT
13980 #include <sys/select.h>
13981 #endif
13982 int main() {
13983         fd_set fds;
13984
13985 #ifdef TRYBITS
13986         if(fds.fds_bits);
13987 #endif
13988
13989 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13990         exit(0);
13991 #else
13992         exit(1);
13993 #endif
13994 }
13995 EOCP
13996 set try -DTRYBITS
13997 if eval $compile; then
13998         d_fds_bits="$define"
13999         d_fd_set="$define"
14000         echo "Well, your system knows about the normal fd_set typedef..." >&4
14001         if $run ./try; then
14002                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
14003                 d_fd_macros="$define"
14004         else
14005                 $cat >&4 <<'EOM'
14006 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
14007 EOM
14008                 d_fd_macros="$undef"
14009         fi
14010 else
14011         $cat <<'EOM'
14012 Hmm, your compiler has some difficulty with fd_set.  Checking further...
14013 EOM
14014         set try
14015         if eval $compile; then
14016                 d_fds_bits="$undef"
14017                 d_fd_set="$define"
14018                 echo "Well, your system has some sort of fd_set available..." >&4
14019                 if $run ./try; then
14020                         echo "and you have the normal fd_set macros." >&4
14021                         d_fd_macros="$define"
14022                 else
14023                         $cat <<'EOM'
14024 but not the normal fd_set macros!  Gross!  More work for me...
14025 EOM
14026                         d_fd_macros="$undef"
14027                 fi
14028         else
14029         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
14030                 d_fd_set="$undef"
14031                 d_fds_bits="$undef"
14032                 d_fd_macros="$undef"
14033         fi
14034 fi
14035 $rm_try
14036
14037 : see if fegetround exists
14038 set fegetround d_fegetround
14039 eval $inlibc
14040
14041 : see if fgetpos exists
14042 set fgetpos d_fgetpos
14043 eval $inlibc
14044
14045 : see if finite exists
14046 set finite d_finite
14047 eval $inlibc
14048
14049 : see if finitel exists
14050 set finitel d_finitel
14051 eval $inlibc
14052
14053 : see if flock exists
14054 set flock d_flock
14055 eval $inlibc
14056
14057 : see if prototype for flock is available
14058 echo " "
14059 set d_flockproto flock $i_sysfile sys/file.h
14060 eval $hasproto
14061
14062 : see if fp_class exists
14063 set fp_class d_fp_class
14064 eval $inlibc
14065
14066 : see if this is a math.h system
14067 set math.h i_math
14068 eval $inhdr
14069
14070 : check for fpclassify
14071 echo "Checking to see if you have fpclassify..." >&4
14072 $cat >try.c <<EOCP
14073 #$i_math I_MATH
14074 #ifdef I_MATH
14075 #include <math.h>
14076 #endif
14077 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
14078 EOCP
14079 set try
14080 if eval $compile; then
14081         val="$define"
14082         echo "You have fpclassify."
14083 else
14084         val="$undef"
14085         echo "You do not have fpclassify."
14086 fi
14087 $rm_try
14088 set d_fpclassify
14089 eval $setvar
14090
14091 : see if fp_classify exists
14092 set fp_classify d_fp_classify
14093 eval $inlibc
14094
14095 : see if fp_classl exists
14096 set fp_classl d_fp_classl
14097 eval $inlibc
14098
14099 : see if pathconf exists
14100 set pathconf d_pathconf
14101 eval $inlibc
14102
14103 : see if fpathconf exists
14104 set fpathconf d_fpathconf
14105 eval $inlibc
14106
14107 : see if fpclass exists
14108 set fpclass d_fpclass
14109 eval $inlibc
14110
14111 : see if fpclassl exists
14112 set fpclassl d_fpclassl
14113 eval $inlibc
14114
14115 : see if fpgetround exists
14116 set fpgetround d_fpgetround
14117 eval $inlibc
14118
14119 : check for fpos64_t
14120 echo " "
14121 echo "Checking to see if you have fpos64_t..." >&4
14122 $cat >try.c <<EOCP
14123 #include <stdio.h>
14124 int main() { fpos64_t x = 7; }
14125 EOCP
14126 set try
14127 if eval $compile; then
14128         val="$define"
14129         echo "You have fpos64_t."
14130 else
14131         val="$undef"
14132         echo "You do not have fpos64_t."
14133         case "$fpossize" in
14134         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
14135         esac
14136 fi
14137 $rm_try
14138 set d_fpos64_t
14139 eval $setvar
14140
14141 : see if frexpl exists
14142 set frexpl d_frexpl
14143 eval $inlibc
14144
14145 : see if this is a sys/param system
14146 set sys/param.h i_sysparam
14147 eval $inhdr
14148
14149 : see if this is a sys/mount.h system
14150 set sys/mount.h i_sysmount
14151 eval $inhdr
14152
14153 : Check for fs_data_s
14154 echo " "
14155 echo "Checking to see if your system supports struct fs_data..." >&4
14156 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
14157 eval $hasstruct
14158 case "$d_fs_data_s" in
14159 "$define")      echo "Yes, it does."   ;;
14160 *)              echo "No, it doesn't." ;;
14161 esac
14162
14163 : see if fseeko exists
14164 set fseeko d_fseeko
14165 eval $inlibc
14166 case "$longsize" in
14167 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
14168 esac
14169
14170 : see if fsetpos exists
14171 set fsetpos d_fsetpos
14172 eval $inlibc
14173
14174 : see if fstatfs exists
14175 set fstatfs d_fstatfs
14176 eval $inlibc
14177
14178 : see if statvfs exists
14179 set statvfs d_statvfs
14180 eval $inlibc
14181
14182 : see if fstatvfs exists
14183 set fstatvfs d_fstatvfs
14184 eval $inlibc
14185
14186
14187 : see if fsync exists
14188 set fsync d_fsync
14189 eval $inlibc
14190
14191 : see if ftello exists
14192 set ftello d_ftello
14193 eval $inlibc
14194 case "$longsize" in
14195 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
14196 esac
14197
14198 : check for a working futimes
14199 d_futimes="$undef"
14200 echo " "
14201 echo "Checking if you have a working futimes()" >&4
14202 $cat >try.c <<EOCP
14203 #include <stdio.h>
14204 #include <sys/time.h>
14205 #include <errno.h>
14206 #include <fcntl.h>
14207
14208 int main ()
14209 {
14210     int fd, rv;
14211     fd = open ("try.c", O_RDWR);
14212     if (-1 == fd) exit (1);
14213     rv = futimes (fd, NULL);
14214     exit (rv == -1 ? errno : 0);
14215 }
14216 EOCP
14217 set try
14218 if eval $compile; then
14219     `$run ./try`
14220     rc=$?
14221     case "$rc" in
14222         0)  echo "Yes, you have" >&4
14223             d_futimes="$define"
14224             ;;
14225         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14226             ;;
14227     esac
14228 else
14229     echo "No, it does not (probably harmless)" >&4
14230 fi
14231 $rm_try
14232
14233 : see if ndbm.h is available
14234 set ndbm.h i_ndbm
14235 eval $inhdr
14236 : Compatibility location for RedHat 7.1
14237 set gdbm/ndbm.h i_gdbmndbm
14238 eval $inhdr
14239 : Compatibility location for Debian 4.0
14240 set gdbm-ndbm.h i_gdbm_ndbm
14241 eval $inhdr
14242
14243 val="$undef"
14244 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14245         : see if dbm_open exists
14246         set dbm_open d_dbm_open
14247         eval $inlibc
14248         case "$d_dbm_open" in
14249         $undef)
14250                 i_ndbm="$undef"
14251                 i_gdbmndbm="$undef"
14252                 i_gdbm_ndbm="$undef"
14253                 echo "We won't be including <ndbm.h>"
14254                 val="$undef"
14255                 ;;
14256         *) val="$define"
14257            ;;
14258         esac
14259 fi
14260 set d_ndbm
14261 eval $setvar
14262
14263 ndbm_hdr_protochk='name=$1; hdr=$2;
14264 eval "ihdr=\$""i_$name";
14265 val="$undef";
14266 if $test "$ihdr" = "$define"; then
14267         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14268         case "$d_cplusplus" in
14269         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14270         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14271         esac;
14272         case "$val" in
14273         $define) $echo "Your <$hdr> seems to have prototypes";;
14274         *) $echo "Your <$hdr> does not seem to have prototypes";;
14275         esac;
14276 fi;
14277 set "d_${name}_h_uses_prototypes";
14278 eval $setvar'
14279
14280 set ndbm ndbm.h
14281 eval $ndbm_hdr_protochk
14282 set gdbmndbm gdbm/ndbm.h
14283 eval $ndbm_hdr_protochk
14284 set gdbm_ndbm gdbm-ndbm.h
14285 eval $ndbm_hdr_protochk
14286
14287 : see if getaddrinfo exists
14288 set getaddrinfo d_getaddrinfo
14289 eval $inlibc
14290
14291 : see if getcwd exists
14292 set getcwd d_getcwd
14293 eval $inlibc
14294
14295 : see if getespwnam exists
14296 set getespwnam d_getespwnam
14297 eval $inlibc
14298
14299 : see if getfsstat exists
14300 set getfsstat d_getfsstat
14301 eval $inlibc
14302
14303 : see if getgrent exists
14304 set getgrent d_getgrent
14305 eval $inlibc
14306
14307 : see if getgrent_r exists
14308 set getgrent_r d_getgrent_r
14309 eval $inlibc
14310 case "$d_getgrent_r" in
14311 "$define")
14312         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14313         case "$d_getgrent_r_proto:$usethreads" in
14314         ":define")      d_getgrent_r_proto=define
14315                 set d_getgrent_r_proto getgrent_r $hdrs
14316                 eval $hasproto ;;
14317         *)      ;;
14318         esac
14319         case "$d_getgrent_r_proto" in
14320         define)
14321         case "$getgrent_r_proto" in
14322         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14323         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14324         esac
14325         case "$getgrent_r_proto" in
14326         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14327         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14328         esac
14329         case "$getgrent_r_proto" in
14330         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14331         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14332         esac
14333         case "$getgrent_r_proto" in
14334         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14335         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14336         esac
14337         case "$getgrent_r_proto" in
14338         ''|0) try='int getgrent_r(struct group*, char*, int);'
14339         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14340         esac
14341         case "$getgrent_r_proto" in
14342         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14343         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14344         esac
14345         case "$getgrent_r_proto" in
14346         ''|0)   d_getgrent_r=undef
14347                 getgrent_r_proto=0
14348                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14349         * )     case "$getgrent_r_proto" in
14350                 REENTRANT_PROTO*) ;;
14351                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14352                 esac
14353                 echo "Prototype: $try" ;;
14354         esac
14355         ;;
14356         *)      case "$usethreads" in
14357                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14358                 esac
14359                 d_getgrent_r=undef
14360                 getgrent_r_proto=0
14361                 ;;
14362         esac
14363         ;;
14364 *)      getgrent_r_proto=0
14365         ;;
14366 esac
14367
14368 : see if getgrgid_r exists
14369 set getgrgid_r d_getgrgid_r
14370 eval $inlibc
14371 case "$d_getgrgid_r" in
14372 "$define")
14373         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14374         case "$d_getgrgid_r_proto:$usethreads" in
14375         ":define")      d_getgrgid_r_proto=define
14376                 set d_getgrgid_r_proto getgrgid_r $hdrs
14377                 eval $hasproto ;;
14378         *)      ;;
14379         esac
14380         case "$d_getgrgid_r_proto" in
14381         define)
14382         case "$getgrgid_r_proto" in
14383         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14384         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14385         esac
14386         case "$getgrgid_r_proto" in
14387         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14388         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14389         esac
14390         case "$getgrgid_r_proto" in
14391         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14392         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14393         esac
14394         case "$getgrgid_r_proto" in
14395         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14396         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14397         esac
14398         case "$getgrgid_r_proto" in
14399         ''|0)   d_getgrgid_r=undef
14400                 getgrgid_r_proto=0
14401                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14402         * )     case "$getgrgid_r_proto" in
14403                 REENTRANT_PROTO*) ;;
14404                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14405                 esac
14406                 echo "Prototype: $try" ;;
14407         esac
14408         ;;
14409         *)      case "$usethreads" in
14410                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14411                 esac
14412                 d_getgrgid_r=undef
14413                 getgrgid_r_proto=0
14414                 ;;
14415         esac
14416         ;;
14417 *)      getgrgid_r_proto=0
14418         ;;
14419 esac
14420
14421 : see if getgrnam_r exists
14422 set getgrnam_r d_getgrnam_r
14423 eval $inlibc
14424 case "$d_getgrnam_r" in
14425 "$define")
14426         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14427         case "$d_getgrnam_r_proto:$usethreads" in
14428         ":define")      d_getgrnam_r_proto=define
14429                 set d_getgrnam_r_proto getgrnam_r $hdrs
14430                 eval $hasproto ;;
14431         *)      ;;
14432         esac
14433         case "$d_getgrnam_r_proto" in
14434         define)
14435         case "$getgrnam_r_proto" in
14436         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14437         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14438         esac
14439         case "$getgrnam_r_proto" in
14440         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14441         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14442         esac
14443         case "$getgrnam_r_proto" in
14444         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14445         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14446         esac
14447         case "$getgrnam_r_proto" in
14448         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14449         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14450         esac
14451         case "$getgrnam_r_proto" in
14452         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14453         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14454         esac
14455         case "$getgrnam_r_proto" in
14456         ''|0)   d_getgrnam_r=undef
14457                 getgrnam_r_proto=0
14458                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14459         * )     case "$getgrnam_r_proto" in
14460                 REENTRANT_PROTO*) ;;
14461                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14462                 esac
14463                 echo "Prototype: $try" ;;
14464         esac
14465         ;;
14466         *)      case "$usethreads" in
14467                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14468                 esac
14469                 d_getgrnam_r=undef
14470                 getgrnam_r_proto=0
14471                 ;;
14472         esac
14473         ;;
14474 *)      getgrnam_r_proto=0
14475         ;;
14476 esac
14477
14478 : see if gethostbyaddr exists
14479 set gethostbyaddr d_gethbyaddr
14480 eval $inlibc
14481
14482 : see if gethostbyname exists
14483 set gethostbyname d_gethbyname
14484 eval $inlibc
14485
14486 : see if gethostent exists
14487 set gethostent d_gethent
14488 eval $inlibc
14489
14490 : see how we will look up host name
14491 echo " "
14492 call=''
14493 if set gethostname val -f d_gethname; eval $csym; $val; then
14494         echo 'gethostname() found.' >&4
14495         d_gethname="$define"
14496         call=gethostname
14497 fi
14498 if set uname val -f d_uname; eval $csym; $val; then
14499         if ./xenix; then
14500                 $cat <<'EOM'
14501 uname() was found, but you're running xenix, and older versions of xenix
14502 have a broken uname(). If you don't really know whether your xenix is old
14503 enough to have a broken system call, use the default answer.
14504
14505 EOM
14506                 dflt=y
14507                 case "$d_uname" in
14508                 "$define") dflt=n;;
14509                 esac
14510                 rp='Is your uname() broken?'
14511                 . ./myread
14512                 case "$ans" in
14513                 n*) d_uname="$define"; call=uname;;
14514                 esac
14515         else
14516                 echo 'uname() found.' >&4
14517                 d_uname="$define"
14518                 case "$call" in
14519                 '') call=uname ;;
14520                 esac
14521         fi
14522 fi
14523 case "$d_gethname" in
14524 '') d_gethname="$undef";;
14525 esac
14526 case "$d_uname" in
14527 '') d_uname="$undef";;
14528 esac
14529 case "$d_uname$d_gethname" in
14530 *define*)
14531         dflt=n
14532         cat <<EOM
14533
14534 Every now and then someone has a $call() that lies about the hostname
14535 but can't be fixed for political or economic reasons.  If you wish, I can
14536 pretend $call() isn't there and maybe compute hostname at run-time
14537 thanks to the '$phostname' command.
14538
14539 EOM
14540         rp="Shall I ignore $call() from now on?"
14541         . ./myread
14542         case "$ans" in
14543         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14544         esac;;
14545 esac
14546 case "$phostname" in
14547 '') aphostname='';;
14548 *) case "$aphostname" in
14549         /*) ;;
14550         *) set X $phostname
14551                 shift
14552                 file=$1
14553                 shift
14554                 file=`./loc $file $file $pth`
14555                 aphostname=`echo $file $*`
14556                 ;;
14557         esac
14558         ;;
14559 esac
14560 case "$d_uname$d_gethname" in
14561 *define*) ;;
14562 *)
14563         case "$phostname" in
14564         '')
14565                 echo "There will be no way for $package to get your hostname." >&4;;
14566         *)
14567         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14568                 ;;
14569         esac;;
14570 esac
14571 case "$d_phostname" in
14572 '') d_phostname="$undef";;
14573 esac
14574
14575 : see if gethostbyaddr_r exists
14576 set gethostbyaddr_r d_gethostbyaddr_r
14577 eval $inlibc
14578 case "$d_gethostbyaddr_r" in
14579 "$define")
14580         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14581         case "$d_gethostbyaddr_r_proto:$usethreads" in
14582         ":define")      d_gethostbyaddr_r_proto=define
14583                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14584                 eval $hasproto ;;
14585         *)      ;;
14586         esac
14587         case "$d_gethostbyaddr_r_proto" in
14588         define)
14589         case "$gethostbyaddr_r_proto" in
14590         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14591         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14592         esac
14593         case "$gethostbyaddr_r_proto" in
14594         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14595         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14596         esac
14597         case "$gethostbyaddr_r_proto" in
14598         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14599         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14600         esac
14601         case "$gethostbyaddr_r_proto" in
14602         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14603         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14604         esac
14605         case "$gethostbyaddr_r_proto" in
14606         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14607         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14608         esac
14609         case "$gethostbyaddr_r_proto" in
14610         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14611         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14612         esac
14613         case "$gethostbyaddr_r_proto" in
14614         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14615         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14616         esac
14617         case "$gethostbyaddr_r_proto" in
14618         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14619         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14620         esac
14621         case "$gethostbyaddr_r_proto" in
14622         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14623         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14624         esac
14625         case "$gethostbyaddr_r_proto" in
14626         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14627         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14628         esac
14629         case "$gethostbyaddr_r_proto" in
14630         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14631         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14632         esac
14633         case "$gethostbyaddr_r_proto" in
14634         ''|0)   d_gethostbyaddr_r=undef
14635                 gethostbyaddr_r_proto=0
14636                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14637         * )     case "$gethostbyaddr_r_proto" in
14638                 REENTRANT_PROTO*) ;;
14639                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14640                 esac
14641                 echo "Prototype: $try" ;;
14642         esac
14643         ;;
14644         *)      case "$usethreads" in
14645                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14646                 esac
14647                 d_gethostbyaddr_r=undef
14648                 gethostbyaddr_r_proto=0
14649                 ;;
14650         esac
14651         ;;
14652 *)      gethostbyaddr_r_proto=0
14653         ;;
14654 esac
14655
14656 : see if gethostbyname_r exists
14657 set gethostbyname_r d_gethostbyname_r
14658 eval $inlibc
14659 case "$d_gethostbyname_r" in
14660 "$define")
14661         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14662         case "$d_gethostbyname_r_proto:$usethreads" in
14663         ":define")      d_gethostbyname_r_proto=define
14664                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14665                 eval $hasproto ;;
14666         *)      ;;
14667         esac
14668         case "$d_gethostbyname_r_proto" in
14669         define)
14670         case "$gethostbyname_r_proto" in
14671         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14672         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14673         esac
14674         case "$gethostbyname_r_proto" in
14675         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14676         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14677         esac
14678         case "$gethostbyname_r_proto" in
14679         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14680         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14681         esac
14682         case "$gethostbyname_r_proto" in
14683         ''|0)   d_gethostbyname_r=undef
14684                 gethostbyname_r_proto=0
14685                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14686         * )     case "$gethostbyname_r_proto" in
14687                 REENTRANT_PROTO*) ;;
14688                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14689                 esac
14690                 echo "Prototype: $try" ;;
14691         esac
14692         ;;
14693         *)      case "$usethreads" in
14694                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14695                 esac
14696                 d_gethostbyname_r=undef
14697                 gethostbyname_r_proto=0
14698                 ;;
14699         esac
14700         ;;
14701 *)      gethostbyname_r_proto=0
14702         ;;
14703 esac
14704
14705 : see if gethostent_r exists
14706 set gethostent_r d_gethostent_r
14707 eval $inlibc
14708 case "$d_gethostent_r" in
14709 "$define")
14710         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14711         case "$d_gethostent_r_proto:$usethreads" in
14712         ":define")      d_gethostent_r_proto=define
14713                 set d_gethostent_r_proto gethostent_r $hdrs
14714                 eval $hasproto ;;
14715         *)      ;;
14716         esac
14717         case "$d_gethostent_r_proto" in
14718         define)
14719         case "$gethostent_r_proto" in
14720         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14721         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14722         esac
14723         case "$gethostent_r_proto" in
14724         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14725         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14726         esac
14727         case "$gethostent_r_proto" in
14728         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14729         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14730         esac
14731         case "$gethostent_r_proto" in
14732         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14733         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14734         esac
14735         case "$gethostent_r_proto" in
14736         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14737         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14738         esac
14739         case "$gethostent_r_proto" in
14740         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14741         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14742         esac
14743         case "$gethostent_r_proto" in
14744         ''|0)   d_gethostent_r=undef
14745                 gethostent_r_proto=0
14746                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14747         * )     case "$gethostent_r_proto" in
14748                 REENTRANT_PROTO*) ;;
14749                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14750                 esac
14751                 echo "Prototype: $try" ;;
14752         esac
14753         ;;
14754         *)      case "$usethreads" in
14755                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14756                 esac
14757                 d_gethostent_r=undef
14758                 gethostent_r_proto=0
14759                 ;;
14760         esac
14761         ;;
14762 *)      gethostent_r_proto=0
14763         ;;
14764 esac
14765
14766 : see if prototypes for various gethostxxx netdb.h functions are available
14767 echo " "
14768 set d_gethostprotos gethostent $i_netdb netdb.h
14769 eval $hasproto
14770
14771 : see if getitimer exists
14772 set getitimer d_getitimer
14773 eval $inlibc
14774
14775 : see if getlogin exists
14776 set getlogin d_getlogin
14777 eval $inlibc
14778
14779 : see if getlogin_r exists
14780 set getlogin_r d_getlogin_r
14781 eval $inlibc
14782 case "$d_getlogin_r" in
14783 "$define")
14784         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14785         case "$d_getlogin_r_proto:$usethreads" in
14786         ":define")      d_getlogin_r_proto=define
14787                 set d_getlogin_r_proto getlogin_r $hdrs
14788                 eval $hasproto ;;
14789         *)      ;;
14790         esac
14791         case "$d_getlogin_r_proto" in
14792         define)
14793         case "$getlogin_r_proto" in
14794         ''|0) try='int getlogin_r(char*, size_t);'
14795         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14796         esac
14797         case "$getlogin_r_proto" in
14798         ''|0) try='int getlogin_r(char*, int);'
14799         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14800         esac
14801         case "$getlogin_r_proto" in
14802         ''|0) try='char* getlogin_r(char*, size_t);'
14803         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14804         esac
14805         case "$getlogin_r_proto" in
14806         ''|0) try='char* getlogin_r(char*, int);'
14807         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14808         esac
14809         case "$getlogin_r_proto" in
14810         ''|0)   d_getlogin_r=undef
14811                 getlogin_r_proto=0
14812                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14813         * )     case "$getlogin_r_proto" in
14814                 REENTRANT_PROTO*) ;;
14815                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14816                 esac
14817                 echo "Prototype: $try" ;;
14818         esac
14819         ;;
14820         *)      case "$usethreads" in
14821                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14822                 esac
14823                 d_getlogin_r=undef
14824                 getlogin_r_proto=0
14825                 ;;
14826         esac
14827         ;;
14828 *)      getlogin_r_proto=0
14829         ;;
14830 esac
14831
14832 : see if getmnt exists
14833 set getmnt d_getmnt
14834 eval $inlibc
14835
14836 : see if getmntent exists
14837 set getmntent d_getmntent
14838 eval $inlibc
14839
14840 : see if getnameinfo exists
14841 set getnameinfo d_getnameinfo
14842 eval $inlibc
14843
14844 : see if getnetbyaddr exists
14845 set getnetbyaddr d_getnbyaddr
14846 eval $inlibc
14847
14848 : see if getnetbyname exists
14849 set getnetbyname d_getnbyname
14850 eval $inlibc
14851
14852 : see if getnetent exists
14853 set getnetent d_getnent
14854 eval $inlibc
14855
14856 : see if getnetbyaddr_r exists
14857 set getnetbyaddr_r d_getnetbyaddr_r
14858 eval $inlibc
14859 case "$d_getnetbyaddr_r" in
14860 "$define")
14861         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14862         case "$d_getnetbyaddr_r_proto:$usethreads" in
14863         ":define")      d_getnetbyaddr_r_proto=define
14864                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14865                 eval $hasproto ;;
14866         *)      ;;
14867         esac
14868         case "$d_getnetbyaddr_r_proto" in
14869         define)
14870         case "$getnetbyaddr_r_proto" in
14871         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14872         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14873         esac
14874         case "$getnetbyaddr_r_proto" in
14875         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14876         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14877         esac
14878         case "$getnetbyaddr_r_proto" in
14879         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14880         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14881         esac
14882         case "$getnetbyaddr_r_proto" in
14883         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14884         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14885         esac
14886         case "$getnetbyaddr_r_proto" in
14887         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14888         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14889         esac
14890         case "$getnetbyaddr_r_proto" in
14891         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14892         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14893         esac
14894         case "$getnetbyaddr_r_proto" in
14895         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14896         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14897         esac
14898         case "$getnetbyaddr_r_proto" in
14899         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14900         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14901         esac
14902         case "$getnetbyaddr_r_proto" in
14903         ''|0)   d_getnetbyaddr_r=undef
14904                 getnetbyaddr_r_proto=0
14905                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14906         * )     case "$getnetbyaddr_r_proto" in
14907                 REENTRANT_PROTO*) ;;
14908                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14909                 esac
14910                 echo "Prototype: $try" ;;
14911         esac
14912         ;;
14913         *)      case "$usethreads" in
14914                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14915                 esac
14916                 d_getnetbyaddr_r=undef
14917                 getnetbyaddr_r_proto=0
14918                 ;;
14919         esac
14920         ;;
14921 *)      getnetbyaddr_r_proto=0
14922         ;;
14923 esac
14924
14925 : see if getnetbyname_r exists
14926 set getnetbyname_r d_getnetbyname_r
14927 eval $inlibc
14928 case "$d_getnetbyname_r" in
14929 "$define")
14930         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14931         case "$d_getnetbyname_r_proto:$usethreads" in
14932         ":define")      d_getnetbyname_r_proto=define
14933                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14934                 eval $hasproto ;;
14935         *)      ;;
14936         esac
14937         case "$d_getnetbyname_r_proto" in
14938         define)
14939         case "$getnetbyname_r_proto" in
14940         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14941         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14942         esac
14943         case "$getnetbyname_r_proto" in
14944         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14945         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14946         esac
14947         case "$getnetbyname_r_proto" in
14948         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14949         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14950         esac
14951         case "$getnetbyname_r_proto" in
14952         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14953         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14954         esac
14955         case "$getnetbyname_r_proto" in
14956         ''|0)   d_getnetbyname_r=undef
14957                 getnetbyname_r_proto=0
14958                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14959         * )     case "$getnetbyname_r_proto" in
14960                 REENTRANT_PROTO*) ;;
14961                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14962                 esac
14963                 echo "Prototype: $try" ;;
14964         esac
14965         ;;
14966         *)      case "$usethreads" in
14967                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14968                 esac
14969                 d_getnetbyname_r=undef
14970                 getnetbyname_r_proto=0
14971                 ;;
14972         esac
14973         ;;
14974 *)      getnetbyname_r_proto=0
14975         ;;
14976 esac
14977
14978 : see if getnetent_r exists
14979 set getnetent_r d_getnetent_r
14980 eval $inlibc
14981 case "$d_getnetent_r" in
14982 "$define")
14983         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14984         case "$d_getnetent_r_proto:$usethreads" in
14985         ":define")      d_getnetent_r_proto=define
14986                 set d_getnetent_r_proto getnetent_r $hdrs
14987                 eval $hasproto ;;
14988         *)      ;;
14989         esac
14990         case "$d_getnetent_r_proto" in
14991         define)
14992         case "$getnetent_r_proto" in
14993         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14994         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14995         esac
14996         case "$getnetent_r_proto" in
14997         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14998         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14999         esac
15000         case "$getnetent_r_proto" in
15001         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
15002         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
15003         esac
15004         case "$getnetent_r_proto" in
15005         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
15006         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
15007         esac
15008         case "$getnetent_r_proto" in
15009         ''|0) try='int getnetent_r(struct netent*, char*, int);'
15010         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
15011         esac
15012         case "$getnetent_r_proto" in
15013         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
15014         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
15015         esac
15016         case "$getnetent_r_proto" in
15017         ''|0)   d_getnetent_r=undef
15018                 getnetent_r_proto=0
15019                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
15020         * )     case "$getnetent_r_proto" in
15021                 REENTRANT_PROTO*) ;;
15022                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
15023                 esac
15024                 echo "Prototype: $try" ;;
15025         esac
15026         ;;
15027         *)      case "$usethreads" in
15028                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
15029                 esac
15030                 d_getnetent_r=undef
15031                 getnetent_r_proto=0
15032                 ;;
15033         esac
15034         ;;
15035 *)      getnetent_r_proto=0
15036         ;;
15037 esac
15038
15039 : see if prototypes for various getnetxxx netdb.h functions are available
15040 echo " "
15041 set d_getnetprotos getnetent $i_netdb netdb.h
15042 eval $hasproto
15043
15044 : see if getpagesize exists
15045 set getpagesize d_getpagsz
15046 eval $inlibc
15047
15048 : Optional checks for getprotobyname and getprotobynumber
15049
15050 : see if getprotobyname exists
15051 set getprotobyname d_getpbyname
15052 eval $inlibc
15053
15054 : see if getprotobynumber exists
15055 set getprotobynumber d_getpbynumber
15056 eval $inlibc
15057
15058 : see if getprotoent exists
15059 set getprotoent d_getpent
15060 eval $inlibc
15061
15062 : see if getpgid exists
15063 set getpgid d_getpgid
15064 eval $inlibc
15065
15066 : see if getpgrp2 exists
15067 set getpgrp2 d_getpgrp2
15068 eval $inlibc
15069
15070 : see if getppid exists
15071 set getppid d_getppid
15072 eval $inlibc
15073
15074 : see if getpriority exists
15075 set getpriority d_getprior
15076 eval $inlibc
15077
15078 : see if getprotobyname_r exists
15079 set getprotobyname_r d_getprotobyname_r
15080 eval $inlibc
15081 case "$d_getprotobyname_r" in
15082 "$define")
15083         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15084         case "$d_getprotobyname_r_proto:$usethreads" in
15085         ":define")      d_getprotobyname_r_proto=define
15086                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
15087                 eval $hasproto ;;
15088         *)      ;;
15089         esac
15090         case "$d_getprotobyname_r_proto" in
15091         define)
15092         case "$getprotobyname_r_proto" in
15093         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
15094         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
15095         esac
15096         case "$getprotobyname_r_proto" in
15097         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
15098         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
15099         esac
15100         case "$getprotobyname_r_proto" in
15101         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
15102         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
15103         esac
15104         case "$getprotobyname_r_proto" in
15105         ''|0)   d_getprotobyname_r=undef
15106                 getprotobyname_r_proto=0
15107                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
15108         * )     case "$getprotobyname_r_proto" in
15109                 REENTRANT_PROTO*) ;;
15110                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
15111                 esac
15112                 echo "Prototype: $try" ;;
15113         esac
15114         ;;
15115         *)      case "$usethreads" in
15116                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
15117                 esac
15118                 d_getprotobyname_r=undef
15119                 getprotobyname_r_proto=0
15120                 ;;
15121         esac
15122         ;;
15123 *)      getprotobyname_r_proto=0
15124         ;;
15125 esac
15126
15127 : see if getprotobynumber_r exists
15128 set getprotobynumber_r d_getprotobynumber_r
15129 eval $inlibc
15130 case "$d_getprotobynumber_r" in
15131 "$define")
15132         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15133         case "$d_getprotobynumber_r_proto:$usethreads" in
15134         ":define")      d_getprotobynumber_r_proto=define
15135                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
15136                 eval $hasproto ;;
15137         *)      ;;
15138         esac
15139         case "$d_getprotobynumber_r_proto" in
15140         define)
15141         case "$getprotobynumber_r_proto" in
15142         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
15143         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
15144         esac
15145         case "$getprotobynumber_r_proto" in
15146         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
15147         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
15148         esac
15149         case "$getprotobynumber_r_proto" in
15150         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
15151         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
15152         esac
15153         case "$getprotobynumber_r_proto" in
15154         ''|0)   d_getprotobynumber_r=undef
15155                 getprotobynumber_r_proto=0
15156                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
15157         * )     case "$getprotobynumber_r_proto" in
15158                 REENTRANT_PROTO*) ;;
15159                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
15160                 esac
15161                 echo "Prototype: $try" ;;
15162         esac
15163         ;;
15164         *)      case "$usethreads" in
15165                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
15166                 esac
15167                 d_getprotobynumber_r=undef
15168                 getprotobynumber_r_proto=0
15169                 ;;
15170         esac
15171         ;;
15172 *)      getprotobynumber_r_proto=0
15173         ;;
15174 esac
15175
15176 : see if getprotoent_r exists
15177 set getprotoent_r d_getprotoent_r
15178 eval $inlibc
15179 case "$d_getprotoent_r" in
15180 "$define")
15181         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15182         case "$d_getprotoent_r_proto:$usethreads" in
15183         ":define")      d_getprotoent_r_proto=define
15184                 set d_getprotoent_r_proto getprotoent_r $hdrs
15185                 eval $hasproto ;;
15186         *)      ;;
15187         esac
15188         case "$d_getprotoent_r_proto" in
15189         define)
15190         case "$getprotoent_r_proto" in
15191         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
15192         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
15193         esac
15194         case "$getprotoent_r_proto" in
15195         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
15196         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
15197         esac
15198         case "$getprotoent_r_proto" in
15199         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
15200         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
15201         esac
15202         case "$getprotoent_r_proto" in
15203         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15204         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15205         esac
15206         case "$getprotoent_r_proto" in
15207         ''|0)   d_getprotoent_r=undef
15208                 getprotoent_r_proto=0
15209                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15210         * )     case "$getprotoent_r_proto" in
15211                 REENTRANT_PROTO*) ;;
15212                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15213                 esac
15214                 echo "Prototype: $try" ;;
15215         esac
15216         ;;
15217         *)      case "$usethreads" in
15218                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15219                 esac
15220                 d_getprotoent_r=undef
15221                 getprotoent_r_proto=0
15222                 ;;
15223         esac
15224         ;;
15225 *)      getprotoent_r_proto=0
15226         ;;
15227 esac
15228
15229 : see if prototypes for various getprotoxxx netdb.h functions are available
15230 echo " "
15231 set d_getprotoprotos getprotoent $i_netdb netdb.h
15232 eval $hasproto
15233
15234 : see if getprpwnam exists
15235 set getprpwnam d_getprpwnam
15236 eval $inlibc
15237
15238 : see if getpwent exists
15239 set getpwent d_getpwent
15240 eval $inlibc
15241
15242 : see if getpwent_r exists
15243 set getpwent_r d_getpwent_r
15244 eval $inlibc
15245 case "$d_getpwent_r" in
15246 "$define")
15247         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15248         case "$d_getpwent_r_proto:$usethreads" in
15249         ":define")      d_getpwent_r_proto=define
15250                 set d_getpwent_r_proto getpwent_r $hdrs
15251                 eval $hasproto ;;
15252         *)      ;;
15253         esac
15254         case "$d_getpwent_r_proto" in
15255         define)
15256         case "$getpwent_r_proto" in
15257         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15258         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15259         esac
15260         case "$getpwent_r_proto" in
15261         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15262         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15263         esac
15264         case "$getpwent_r_proto" in
15265         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15266         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15267         esac
15268         case "$getpwent_r_proto" in
15269         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15270         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15271         esac
15272         case "$getpwent_r_proto" in
15273         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15274         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15275         esac
15276         case "$getpwent_r_proto" in
15277         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15278         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15279         esac
15280         case "$getpwent_r_proto" in
15281         ''|0)   d_getpwent_r=undef
15282                 getpwent_r_proto=0
15283                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15284         * )     case "$getpwent_r_proto" in
15285                 REENTRANT_PROTO*) ;;
15286                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15287                 esac
15288                 echo "Prototype: $try" ;;
15289         esac
15290         ;;
15291         *)      case "$usethreads" in
15292                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15293                 esac
15294                 d_getpwent_r=undef
15295                 getpwent_r_proto=0
15296                 ;;
15297         esac
15298         ;;
15299 *)      getpwent_r_proto=0
15300         ;;
15301 esac
15302
15303 : see if getpwnam_r exists
15304 set getpwnam_r d_getpwnam_r
15305 eval $inlibc
15306 case "$d_getpwnam_r" in
15307 "$define")
15308         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15309         case "$d_getpwnam_r_proto:$usethreads" in
15310         ":define")      d_getpwnam_r_proto=define
15311                 set d_getpwnam_r_proto getpwnam_r $hdrs
15312                 eval $hasproto ;;
15313         *)      ;;
15314         esac
15315         case "$d_getpwnam_r_proto" in
15316         define)
15317         case "$getpwnam_r_proto" in
15318         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15319         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15320         esac
15321         case "$getpwnam_r_proto" in
15322         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15323         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15324         esac
15325         case "$getpwnam_r_proto" in
15326         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15327         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15328         esac
15329         case "$getpwnam_r_proto" in
15330         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15331         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15332         esac
15333         case "$getpwnam_r_proto" in
15334         ''|0)   d_getpwnam_r=undef
15335                 getpwnam_r_proto=0
15336                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15337         * )     case "$getpwnam_r_proto" in
15338                 REENTRANT_PROTO*) ;;
15339                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15340                 esac
15341                 echo "Prototype: $try" ;;
15342         esac
15343         ;;
15344         *)      case "$usethreads" in
15345                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15346                 esac
15347                 d_getpwnam_r=undef
15348                 getpwnam_r_proto=0
15349                 ;;
15350         esac
15351         ;;
15352 *)      getpwnam_r_proto=0
15353         ;;
15354 esac
15355
15356 : see if getpwuid_r exists
15357 set getpwuid_r d_getpwuid_r
15358 eval $inlibc
15359 case "$d_getpwuid_r" in
15360 "$define")
15361         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15362         case "$d_getpwuid_r_proto:$usethreads" in
15363         ":define")      d_getpwuid_r_proto=define
15364                 set d_getpwuid_r_proto getpwuid_r $hdrs
15365                 eval $hasproto ;;
15366         *)      ;;
15367         esac
15368         case "$d_getpwuid_r_proto" in
15369         define)
15370         case "$getpwuid_r_proto" in
15371         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15372         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15373         esac
15374         case "$getpwuid_r_proto" in
15375         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15376         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15377         esac
15378         case "$getpwuid_r_proto" in
15379         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15380         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15381         esac
15382         case "$getpwuid_r_proto" in
15383         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15384         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15385         esac
15386         case "$getpwuid_r_proto" in
15387         ''|0)   d_getpwuid_r=undef
15388                 getpwuid_r_proto=0
15389                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15390         * )     case "$getpwuid_r_proto" in
15391                 REENTRANT_PROTO*) ;;
15392                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15393                 esac
15394                 echo "Prototype: $try" ;;
15395         esac
15396         ;;
15397         *)      case "$usethreads" in
15398                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15399                 esac
15400                 d_getpwuid_r=undef
15401                 getpwuid_r_proto=0
15402                 ;;
15403         esac
15404         ;;
15405 *)      getpwuid_r_proto=0
15406         ;;
15407 esac
15408
15409 : Optional checks for getsbyname and getsbyport
15410
15411 : see if getservbyname exists
15412 set getservbyname d_getsbyname
15413 eval $inlibc
15414
15415 : see if getservbyport exists
15416 set getservbyport d_getsbyport
15417 eval $inlibc
15418
15419 : see if getservent exists
15420 set getservent d_getsent
15421 eval $inlibc
15422
15423 : see if getservbyname_r exists
15424 set getservbyname_r d_getservbyname_r
15425 eval $inlibc
15426 case "$d_getservbyname_r" in
15427 "$define")
15428         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15429         case "$d_getservbyname_r_proto:$usethreads" in
15430         ":define")      d_getservbyname_r_proto=define
15431                 set d_getservbyname_r_proto getservbyname_r $hdrs
15432                 eval $hasproto ;;
15433         *)      ;;
15434         esac
15435         case "$d_getservbyname_r_proto" in
15436         define)
15437         case "$getservbyname_r_proto" in
15438         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15439         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15440         esac
15441         case "$getservbyname_r_proto" in
15442         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15443         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15444         esac
15445         case "$getservbyname_r_proto" in
15446         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15447         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15448         esac
15449         case "$getservbyname_r_proto" in
15450         ''|0)   d_getservbyname_r=undef
15451                 getservbyname_r_proto=0
15452                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15453         * )     case "$getservbyname_r_proto" in
15454                 REENTRANT_PROTO*) ;;
15455                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15456                 esac
15457                 echo "Prototype: $try" ;;
15458         esac
15459         ;;
15460         *)      case "$usethreads" in
15461                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15462                 esac
15463                 d_getservbyname_r=undef
15464                 getservbyname_r_proto=0
15465                 ;;
15466         esac
15467         ;;
15468 *)      getservbyname_r_proto=0
15469         ;;
15470 esac
15471
15472 : see if getservbyport_r exists
15473 set getservbyport_r d_getservbyport_r
15474 eval $inlibc
15475 case "$d_getservbyport_r" in
15476 "$define")
15477         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15478         case "$d_getservbyport_r_proto:$usethreads" in
15479         ":define")      d_getservbyport_r_proto=define
15480                 set d_getservbyport_r_proto getservbyport_r $hdrs
15481                 eval $hasproto ;;
15482         *)      ;;
15483         esac
15484         case "$d_getservbyport_r_proto" in
15485         define)
15486         case "$getservbyport_r_proto" in
15487         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15488         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15489         esac
15490         case "$getservbyport_r_proto" in
15491         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15492         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15493         esac
15494         case "$getservbyport_r_proto" in
15495         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15496         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15497         esac
15498         case "$getservbyport_r_proto" in
15499         ''|0)   d_getservbyport_r=undef
15500                 getservbyport_r_proto=0
15501                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15502         * )     case "$getservbyport_r_proto" in
15503                 REENTRANT_PROTO*) ;;
15504                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15505                 esac
15506                 echo "Prototype: $try" ;;
15507         esac
15508         ;;
15509         *)      case "$usethreads" in
15510                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15511                 esac
15512                 d_getservbyport_r=undef
15513                 getservbyport_r_proto=0
15514                 ;;
15515         esac
15516         ;;
15517 *)      getservbyport_r_proto=0
15518         ;;
15519 esac
15520
15521 : see if getservent_r exists
15522 set getservent_r d_getservent_r
15523 eval $inlibc
15524 case "$d_getservent_r" in
15525 "$define")
15526         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15527         case "$d_getservent_r_proto:$usethreads" in
15528         ":define")      d_getservent_r_proto=define
15529                 set d_getservent_r_proto getservent_r $hdrs
15530                 eval $hasproto ;;
15531         *)      ;;
15532         esac
15533         case "$d_getservent_r_proto" in
15534         define)
15535         case "$getservent_r_proto" in
15536         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15537         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15538         esac
15539         case "$getservent_r_proto" in
15540         ''|0) try='int getservent_r(struct servent*, char*, int);'
15541         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15542         esac
15543         case "$getservent_r_proto" in
15544         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15545         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15546         esac
15547         case "$getservent_r_proto" in
15548         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15549         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15550         esac
15551         case "$getservent_r_proto" in
15552         ''|0)   d_getservent_r=undef
15553                 getservent_r_proto=0
15554                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15555         * )     case "$getservent_r_proto" in
15556                 REENTRANT_PROTO*) ;;
15557                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15558                 esac
15559                 echo "Prototype: $try" ;;
15560         esac
15561         ;;
15562         *)      case "$usethreads" in
15563                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15564                 esac
15565                 d_getservent_r=undef
15566                 getservent_r_proto=0
15567                 ;;
15568         esac
15569         ;;
15570 *)      getservent_r_proto=0
15571         ;;
15572 esac
15573
15574 : see if prototypes for various getservxxx netdb.h functions are available
15575 echo " "
15576 set d_getservprotos getservent $i_netdb netdb.h
15577 eval $hasproto
15578
15579 : see if getspnam exists
15580 set getspnam d_getspnam
15581 eval $inlibc
15582
15583 : see if this is a shadow.h system
15584 set shadow.h i_shadow
15585 eval $inhdr
15586
15587 : see if getspnam_r exists
15588 set getspnam_r d_getspnam_r
15589 eval $inlibc
15590 case "$d_getspnam_r" in
15591 "$define")
15592         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15593         case "$d_getspnam_r_proto:$usethreads" in
15594         ":define")      d_getspnam_r_proto=define
15595                 set d_getspnam_r_proto getspnam_r $hdrs
15596                 eval $hasproto ;;
15597         *)      ;;
15598         esac
15599         case "$d_getspnam_r_proto" in
15600         define)
15601         case "$getspnam_r_proto" in
15602         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15603         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15604         esac
15605         case "$getspnam_r_proto" in
15606         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15607         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15608         esac
15609         case "$getspnam_r_proto" in
15610         ''|0)   d_getspnam_r=undef
15611                 getspnam_r_proto=0
15612                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15613         * )     case "$getspnam_r_proto" in
15614                 REENTRANT_PROTO*) ;;
15615                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15616                 esac
15617                 echo "Prototype: $try" ;;
15618         esac
15619         ;;
15620         *)      case "$usethreads" in
15621                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15622                 esac
15623                 d_getspnam_r=undef
15624                 getspnam_r_proto=0
15625                 ;;
15626         esac
15627         ;;
15628 *)      getspnam_r_proto=0
15629         ;;
15630 esac
15631
15632 : see if gettimeofday or ftime exists
15633 set gettimeofday d_gettimeod
15634 eval $inlibc
15635 case "$d_gettimeod" in
15636 "$undef")
15637         set ftime d_ftime 
15638         eval $inlibc
15639         ;;
15640 *)
15641         val="$undef"; set d_ftime; eval $setvar
15642         ;;
15643 esac
15644 case "$d_gettimeod$d_ftime" in
15645 "$undef$undef")
15646         echo " "
15647         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15648         ;;
15649 esac
15650
15651 : see if gmtime_r exists
15652 set gmtime_r d_gmtime_r
15653 eval $inlibc
15654 case "$d_gmtime_r" in
15655 "$define")
15656         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15657         case "$d_gmtime_r_proto:$usethreads" in
15658         ":define")      d_gmtime_r_proto=define
15659                 set d_gmtime_r_proto gmtime_r $hdrs
15660                 eval $hasproto ;;
15661         *)      ;;
15662         esac
15663         case "$d_gmtime_r_proto" in
15664         define)
15665         case "$gmtime_r_proto" in
15666         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15667         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15668         esac
15669         case "$gmtime_r_proto" in
15670         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15671         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15672         esac
15673         case "$gmtime_r_proto" in
15674         ''|0)   d_gmtime_r=undef
15675                 gmtime_r_proto=0
15676                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15677         * )     case "$gmtime_r_proto" in
15678                 REENTRANT_PROTO*) ;;
15679                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15680                 esac
15681                 echo "Prototype: $try" ;;
15682         esac
15683         ;;
15684         *)      case "$usethreads" in
15685                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15686                 esac
15687                 d_gmtime_r=undef
15688                 gmtime_r_proto=0
15689                 ;;
15690         esac
15691         ;;
15692 *)      gmtime_r_proto=0
15693         ;;
15694 esac
15695
15696 : see if hasmntopt exists
15697 set hasmntopt d_hasmntopt
15698 eval $inlibc
15699
15700 : see if this is a netinet/in.h or sys/in.h system
15701 set netinet/in.h i_niin sys/in.h i_sysin
15702 eval $inhdr
15703
15704 : see if arpa/inet.h has to be included
15705 set arpa/inet.h i_arpainet
15706 eval $inhdr
15707
15708 : see if htonl --and friends-- exists
15709 val=''
15710 set htonl val
15711 eval $inlibc
15712
15713 : Maybe they are macros.
15714 case "$val" in
15715 $undef)
15716         $cat >htonl.c <<EOM
15717 #include <stdio.h>
15718 #include <sys/types.h>
15719 #$i_niin I_NETINET_IN
15720 #$i_sysin I_SYS_IN
15721 #$i_arpainet I_ARPA_INET
15722 #ifdef I_NETINET_IN
15723 #include <netinet/in.h>
15724 #endif
15725 #ifdef I_SYS_IN
15726 #include <sys/in.h>
15727 #endif
15728 #ifdef I_ARPA_INET
15729 #include <arpa/inet.h>
15730 #endif
15731 #ifdef htonl
15732 printf("Defined as a macro.");
15733 #endif
15734 EOM
15735         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15736         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15737                 val="$define"
15738                 echo "But it seems to be defined as a macro." >&4
15739         fi
15740         $rm -f htonl.?
15741         ;;
15742 esac
15743 set d_htonl
15744 eval $setvar
15745
15746 : see if ilogbl exists
15747 set ilogbl d_ilogbl
15748 eval $inlibc
15749
15750 : index or strchr
15751 echo " "
15752 if set index val -f; eval $csym; $val; then
15753         if set strchr val -f d_strchr; eval $csym; $val; then
15754                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15755                         val="$define"
15756                         vali="$undef"
15757                         echo "strchr() found." >&4
15758                 else
15759                         val="$undef"
15760                         vali="$define"
15761                         echo "index() found." >&4
15762                 fi
15763         else
15764                 val="$undef"
15765                 vali="$define"
15766                 echo "index() found." >&4
15767         fi
15768 else
15769         if set strchr val -f d_strchr; eval $csym; $val; then
15770                 val="$define"
15771                 vali="$undef"
15772                 echo "strchr() found." >&4
15773         else
15774                 echo "No index() or strchr() found!" >&4
15775                 val="$undef"
15776                 vali="$undef"
15777         fi
15778 fi
15779 set d_strchr; eval $setvar
15780 val="$vali"
15781 set d_index; eval $setvar
15782
15783 : check whether inet_aton exists
15784 set inet_aton d_inetaton
15785 eval $inlibc
15786
15787 : see if inet_ntop exists
15788 set inet_ntop d_inetntop
15789 eval $inlibc
15790
15791 : see if inet_pton exists
15792 set inet_pton d_inetpton
15793 eval $inlibc
15794
15795 : Look for isascii
15796 echo " "
15797 $cat >isascii.c <<EOCP
15798 #include <stdio.h>
15799 #include <ctype.h>
15800 #$i_stdlib I_STDLIB
15801 #ifdef I_STDLIB
15802 #include <stdlib.h>
15803 #endif
15804 int main() {
15805         int c = 'A';
15806         if (isascii(c))
15807                 exit(0);
15808         else
15809                 exit(1);
15810 }
15811 EOCP
15812 set isascii
15813 if eval $compile; then
15814         echo "isascii() found." >&4
15815         val="$define"
15816 else
15817         echo "isascii() NOT found." >&4
15818         val="$undef"
15819 fi
15820 set d_isascii
15821 eval $setvar
15822 $rm -f isascii*
15823
15824 : Look for isblank
15825 echo " "
15826 $cat >isblank.c <<'EOCP'
15827 #include <stdio.h>
15828 #include <ctype.h>
15829 int main() {
15830         int c = ' ';
15831         if (isblank(c))
15832                 return 0 ;
15833         else
15834                 return 1 ;
15835 }
15836 EOCP
15837 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15838         echo "isblank() found." >&4
15839         val="$define"
15840 else
15841         echo "isblank() NOT found." >&4
15842         val="$undef"
15843 fi
15844 set d_isblank
15845 eval $setvar
15846 $rm -f isblank*
15847
15848 : check for isfinite
15849 echo "Checking to see if you have isfinite..." >&4
15850 $cat >try.c <<EOCP
15851 #$i_math I_MATH
15852 #ifdef I_MATH
15853 #include <math.h>
15854 #endif
15855 int main() { return isfinite(0.0); }
15856 EOCP
15857 set try
15858 if eval $compile; then
15859         val="$define"
15860         echo "You have isfinite."
15861 else
15862         val="$undef"
15863         echo "You do not have isfinite."
15864 fi
15865 $rm_try
15866 set d_isfinite
15867 eval $setvar
15868
15869 : see if isfinitel exists
15870 set isfinitel d_isfinitel
15871 eval $inlibc
15872
15873 : check for isinf
15874 echo "Checking to see if you have isinf..." >&4
15875 $cat >try.c <<EOCP
15876 #$i_math I_MATH
15877 #ifdef I_MATH
15878 #include <math.h>
15879 #endif
15880 int main() { return isinf(0.0); }
15881 EOCP
15882 set try
15883 if eval $compile; then
15884         val="$define"
15885         echo "You have isinf."
15886 else
15887         val="$undef"
15888         echo "You do not have isinf."
15889 fi
15890 $rm_try
15891 set d_isinf
15892 eval $setvar
15893
15894 : see if isinfl exists
15895 set isinfl d_isinfl
15896 eval $inlibc
15897
15898 : check for isless
15899 echo "Checking to see if you have isless..." >&4
15900 $cat >try.c <<EOCP
15901 #$i_math I_MATH
15902 #ifdef I_MATH
15903 #include <math.h>
15904 #endif
15905 int main() { return isless(0.0); }
15906 EOCP
15907 set try
15908 if eval $compile; then
15909         val="$define"
15910         echo "You have isless."
15911 else
15912         val="$undef"
15913         echo "You do not have isless."
15914 fi
15915 $rm_try
15916 set d_isless
15917 eval $setvar
15918
15919 : check for isnan
15920 echo "Checking to see if you have isnan..." >&4
15921 $cat >try.c <<EOCP
15922 #$i_math I_MATH
15923 #ifdef I_MATH
15924 #include <math.h>
15925 #endif
15926 int main() { return isnan(0.0); }
15927 EOCP
15928 set try
15929 if eval $compile; then
15930         val="$define"
15931         echo "You have isnan."
15932 else
15933         val="$undef"
15934         echo "You do not have isnan."
15935 fi
15936 $rm_try
15937 set d_isnan
15938 eval $setvar
15939
15940 : see if isnanl exists
15941 set isnanl d_isnanl
15942 eval $inlibc
15943
15944 : check for isnormal
15945 echo "Checking to see if you have isnormal..." >&4
15946 $cat >try.c <<EOCP
15947 #$i_math I_MATH
15948 #ifdef I_MATH
15949 #include <math.h>
15950 #endif
15951 int main() { return isnormal(0.0); }
15952 EOCP
15953 set try
15954 if eval $compile; then
15955         val="$define"
15956         echo "You have isnormal."
15957 else
15958         val="$undef"
15959         echo "You do not have isnormal."
15960 fi
15961 $rm_try
15962 set d_isnormal
15963 eval $setvar
15964
15965 : see if j0 exists
15966 set j0 d_j0
15967 eval $inlibc
15968
15969 : see if j0l exists
15970 set j0l d_j0l
15971 eval $inlibc
15972
15973 : see if killpg exists
15974 set killpg d_killpg
15975 eval $inlibc
15976
15977 : see if lchown exists
15978 echo " "
15979 $cat > try.c <<'EOCP'
15980 /* System header to define __stub macros and hopefully few prototypes,
15981     which can conflict with char lchown(); below.  */
15982 #include <assert.h>
15983 /* Override any gcc2 internal prototype to avoid an error.  */
15984 /* We use char because int might match the return type of a gcc2
15985    builtin and then its argument prototype would still apply.  */
15986 char lchown();
15987 int main() {
15988     /*  The GNU C library defines this for functions which it implements
15989         to always fail with ENOSYS.  Some functions are actually named
15990         something starting with __ and the normal name is an alias.  */
15991 #if defined (__stub_lchown) || defined (__stub___lchown)
15992 choke me
15993 #else
15994 lchown();
15995 #endif
15996 ; return 0; }
15997 EOCP
15998 set try
15999 if eval $compile; then
16000     $echo "lchown() found." >&4
16001     val="$define"
16002 else
16003     $echo "lchown() NOT found." >&4
16004     val="$undef"
16005 fi
16006 set d_lchown
16007 eval $setvar
16008
16009 : See if number of significant digits in a double precision number is known
16010 echo " "
16011 $cat >ldbl_dig.c <<EOM
16012 #$i_limits I_LIMITS
16013 #$i_float I_FLOAT
16014 #ifdef I_LIMITS
16015 #include <limits.h>
16016 #endif
16017 #ifdef I_FLOAT
16018 #include <float.h>
16019 #endif
16020 #ifdef LDBL_DIG
16021 printf("Contains LDBL_DIG");
16022 #endif
16023 EOM
16024 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
16025 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
16026         echo "LDBL_DIG found." >&4
16027         val="$define"
16028 else
16029         echo "LDBL_DIG NOT found." >&4
16030         val="$undef"
16031 fi
16032 $rm -f ldbl_dig.?
16033 set d_ldbl_dig
16034 eval $setvar
16035
16036 : check to see if math.h defines _LIB_VERSION
16037 d_libm_lib_version="$undef"
16038 case $i_math in
16039     $define)
16040         echo " "
16041         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
16042         $cat >try.c <<EOCP
16043 #include <unistd.h>
16044 #include <math.h>
16045 int main (int argc, char *argv[])
16046 {
16047     printf ("%d\n", _LIB_VERSION);
16048     return (0);
16049     } /* main */
16050 EOCP
16051         set try
16052         if eval $compile; then
16053             foo=`$run ./try`
16054             echo "Yes, it does ($foo)" >&4
16055             d_libm_lib_version="$define"
16056         else
16057             echo "No, it does not (probably harmless)" >&4
16058             fi
16059         $rm_try
16060         ;;
16061
16062     esac
16063
16064 : check for fpclassify
16065 echo " "
16066 echo "Checking to see if you have fpclassify..." >&4
16067 $cat >try.c <<EOCP
16068 #$i_math I_MATH
16069 #ifdef I_MATH
16070 #include <math.h>
16071 #endif
16072 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
16073 EOCP
16074 set try
16075 if eval $compile; then
16076         val="$define"
16077         echo "You have fpclassify."
16078 else
16079         val="$undef"
16080         echo "You do not have fpclassify."
16081 fi
16082 $rm_try
16083 set d_fpclassify
16084 eval $setvar
16085
16086 : check for isfinite
16087 echo " "
16088 echo "Checking to see if you have isfinite..." >&4
16089 $cat >try.c <<EOCP
16090 #$i_math I_MATH
16091 #ifdef I_MATH
16092 #include <math.h>
16093 #endif
16094 int main() { return isfinite(0.0); }
16095 EOCP
16096 set try
16097 if eval $compile; then
16098         val="$define"
16099         echo "You have isfinite."
16100 else
16101         val="$undef"
16102         echo "You do not have isfinite."
16103 fi
16104 $rm_try
16105 set d_isfinite
16106 eval $setvar
16107
16108 : check for isinf
16109 echo " "
16110 echo "Checking to see if you have isinf..." >&4
16111 $cat >try.c <<EOCP
16112 #$i_math I_MATH
16113 #ifdef I_MATH
16114 #include <math.h>
16115 #endif
16116 int main() { return isinf(0.0); }
16117 EOCP
16118 set try
16119 if eval $compile; then
16120         val="$define"
16121         echo "You have isinf."
16122 else
16123         val="$undef"
16124         echo "You do not have isinf."
16125 fi
16126 $rm_try
16127 set d_isinf
16128 eval $setvar
16129
16130 : check for isnan
16131 echo " "
16132 echo "Checking to see if you have isnan..." >&4
16133 $cat >try.c <<EOCP
16134 #$i_math I_MATH
16135 #ifdef I_MATH
16136 #include <math.h>
16137 #endif
16138 int main() { return isnan(0.0); }
16139 EOCP
16140 set try
16141 if eval $compile; then
16142         val="$define"
16143         echo "You have isnan."
16144 else
16145         val="$undef"
16146         echo "You do not have isnan."
16147 fi
16148 $rm_try
16149 set d_isnan
16150 eval $setvar
16151
16152 : see if this is a quadmath.h system
16153 set quadmath.h i_quadmath
16154 eval $inhdr
16155
16156 : see if link exists
16157 set link d_link
16158 eval $inlibc
16159
16160 : see if localtime_r exists
16161 set localtime_r d_localtime_r
16162 eval $inlibc
16163 case "$d_localtime_r" in
16164 "$define")
16165         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
16166         case "$d_localtime_r_proto:$usethreads" in
16167         ":define")      d_localtime_r_proto=define
16168                 set d_localtime_r_proto localtime_r $hdrs
16169                 eval $hasproto ;;
16170         *)      ;;
16171         esac
16172         case "$d_localtime_r_proto" in
16173         define)
16174         case "$localtime_r_proto" in
16175         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
16176         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
16177         esac
16178         case "$localtime_r_proto" in
16179         ''|0) try='int localtime_r(const time_t*, struct tm*);'
16180         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
16181         esac
16182         case "$localtime_r_proto" in
16183         ''|0)   d_localtime_r=undef
16184                 localtime_r_proto=0
16185                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
16186         * )     case "$localtime_r_proto" in
16187                 REENTRANT_PROTO*) ;;
16188                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
16189                 esac
16190                 echo "Prototype: $try" ;;
16191         esac
16192         ;;
16193         *)      case "$usethreads" in
16194                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
16195                 esac
16196                 d_localtime_r=undef
16197                 localtime_r_proto=0
16198                 ;;
16199         esac
16200         ;;
16201 *)      localtime_r_proto=0
16202         ;;
16203 esac
16204
16205 : see if localtime_r calls tzset
16206 case "$localtime_r_proto" in
16207 REENTRANT_PROTO*)
16208         $cat >try.c <<EOCP
16209 /*  Does our libc's localtime_r call tzset ?
16210  *  return 0 if so, 1 otherwise.
16211  */
16212 #$i_systypes    I_SYS_TYPES
16213 #$i_unistd      I_UNISTD
16214 #$i_time        I_TIME
16215 #$i_stdlib      I_STDLIB
16216 #$i_string      I_STRING
16217 #$i_malloc      I_MALLOC
16218 #ifdef I_SYS_TYPES
16219 #  include <sys/types.h>
16220 #endif
16221 #ifdef I_UNISTD
16222 #  include <unistd.h>
16223 #endif
16224 #ifdef I_TIME
16225 #  include <time.h>
16226 #endif
16227 #ifdef I_STDLIB
16228 #include <stdlib.h>
16229 #endif
16230 #ifdef I_STRING
16231 #  include <string.h>
16232 #else
16233 #  include <strings.h>
16234 #endif
16235 #ifdef I_MALLOC
16236 #  include <malloc.h>
16237 #endif
16238 int main()
16239 {
16240     time_t t = time(0L);
16241     char w_tz[]="TZ" "=GMT+5",
16242          e_tz[]="TZ" "=GMT-5",
16243         *tz_e = (char*)malloc(16),
16244         *tz_w = (char*)malloc(16);
16245     struct tm tm_e, tm_w;
16246     memset(&tm_e,'\0',sizeof(struct tm));
16247     memset(&tm_w,'\0',sizeof(struct tm));
16248     strcpy(tz_e,e_tz);
16249     strcpy(tz_w,w_tz);
16250
16251     putenv(tz_e);
16252     localtime_r(&t, &tm_e);
16253
16254     putenv(tz_w);
16255     localtime_r(&t, &tm_w);
16256
16257     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16258         return 1;
16259     return 0;
16260 }
16261 EOCP
16262         set try
16263         if eval $compile; then
16264             if $run ./try; then
16265                 d_localtime_r_needs_tzset=undef;
16266             else
16267                 d_localtime_r_needs_tzset=define;
16268             fi;
16269         else
16270             d_localtime_r_needs_tzset=undef;
16271         fi;
16272      ;;
16273   *)
16274      d_localtime_r_needs_tzset=undef;
16275      ;;
16276 esac
16277 $rm_try
16278
16279 : see if localeconv exists
16280 set localeconv d_locconv
16281 eval $inlibc
16282
16283 : see if libc has the POSIX.1-2008 currency locale rules
16284 case "$d_locconv:$d_lc_monetary_2008" in
16285   $define:)
16286         $cat >try.c <<EOCP
16287 #include <locale.h>
16288 int main() {
16289         struct lconv *lc = localeconv();
16290         char int_p_cs_precedes = lc->int_p_cs_precedes;
16291         return 0;
16292 }
16293 EOCP
16294         set try
16295         if eval $compile; then
16296                 d_lc_monetary_2008="$define"
16297         else
16298                 d_lc_monetary_2008="$undef"
16299         fi;
16300         $rm_try
16301         ;;
16302 esac
16303
16304 : see if lockf exists
16305 set lockf d_lockf
16306 eval $inlibc
16307
16308 : see if prototype for lseek is available
16309 echo " "
16310 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16311 eval $hasproto
16312
16313 : see if lstat exists
16314 set lstat d_lstat
16315 eval $inlibc
16316
16317 : see if madvise exists
16318 set madvise d_madvise
16319 eval $inlibc
16320
16321 : see if malloc_size exists
16322 set malloc_size d_malloc_size
16323 eval $inlibc
16324
16325 : see if malloc_size_good exists
16326 set malloc_good_size d_malloc_good_size
16327 eval $inlibc
16328
16329 : see if mblen exists
16330 set mblen d_mblen
16331 eval $inlibc
16332
16333 : see if mbstowcs exists
16334 set mbstowcs d_mbstowcs
16335 eval $inlibc
16336
16337 : see if mbtowc exists
16338 set mbtowc d_mbtowc
16339 eval $inlibc
16340
16341 : see if memchr exists
16342 set memchr d_memchr
16343 eval $inlibc
16344
16345 : see if memcmp exists
16346 set memcmp d_memcmp
16347 eval $inlibc
16348
16349 : see if memcpy exists
16350 set memcpy d_memcpy
16351 eval $inlibc
16352
16353 : see if memmove exists
16354 set memmove d_memmove
16355 eval $inlibc
16356
16357 : see if memset exists
16358 set memset d_memset
16359 eval $inlibc
16360
16361 : see if mkdir exists
16362 set mkdir d_mkdir
16363 eval $inlibc
16364
16365 : see if mkdtemp exists
16366 set mkdtemp d_mkdtemp
16367 eval $inlibc
16368
16369 : see if mkfifo exists
16370 set mkfifo d_mkfifo
16371 eval $inlibc
16372
16373 : see if mkstemp exists
16374 set mkstemp d_mkstemp
16375 eval $inlibc
16376
16377 : see if mkstemps exists
16378 set mkstemps d_mkstemps
16379 eval $inlibc
16380
16381 : see if mktime exists
16382 set mktime d_mktime
16383 eval $inlibc
16384
16385 : see if this is a sys/mman.h system
16386 set sys/mman.h i_sysmman
16387 eval $inhdr
16388
16389 : see if mmap exists
16390 set mmap d_mmap
16391 eval $inlibc
16392 : see what shmat returns
16393 : default to something harmless
16394 mmaptype='void *'
16395 case "$i_sysmman$d_mmap" in
16396 "$define$define")
16397         $cat >mmap.c <<'END'
16398 #include <sys/mman.h>
16399 void *mmap();
16400 END
16401         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16402                 mmaptype='void *'
16403         else
16404                 mmaptype='caddr_t'
16405         fi
16406         echo "and it returns ($mmaptype)." >&4
16407         ;;
16408 esac
16409
16410
16411
16412 : see if sqrtl exists
16413 set sqrtl d_sqrtl
16414 eval $inlibc
16415
16416 : see if scalbnl exists
16417 set scalbnl d_scalbnl
16418 eval $inlibc
16419
16420 : see if truncl exists
16421 set truncl d_truncl
16422 eval $inlibc
16423
16424 : see if modfl exists
16425 set modfl d_modfl
16426 eval $inlibc
16427
16428 : see if prototype for modfl is available
16429 echo " "
16430 set d_modflproto modfl $i_math math.h
16431 eval $hasproto
16432
16433 d_modfl_pow32_bug="$undef"
16434
16435 case "$d_longdbl$d_modfl" in
16436 $define$define)
16437         $cat <<EOM
16438 Checking to see whether your modfl() is okay for large values...
16439 EOM
16440 $cat >try.c <<EOCP
16441 #include <math.h>
16442 #include <stdio.h>
16443 EOCP
16444 if $test "X$d_modflproto" != "X$define"; then
16445         $cat >>try.c <<EOCP
16446 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16447 long double modfl (long double, long double *);
16448 EOCP
16449 fi
16450 $cat >>try.c <<EOCP
16451 int main() {
16452     long double nv = 4294967303.15;
16453     long double v, w;
16454     v = modfl(nv, &w);
16455 #ifdef __GLIBC__
16456     printf("glibc");
16457 #endif
16458     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16459     return 0;
16460 }
16461 EOCP
16462         case "$osname:$gccversion" in
16463         aix:)   saveccflags="$ccflags"
16464                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16465         esac
16466         set try
16467         if eval $compile; then
16468                 foo=`$run ./try`
16469                 case "$foo" in
16470                 *" 4294967303.150000 1.150000 4294967302.000000")
16471                         echo >&4 "Your modfl() is broken for large values."
16472                         d_modfl_pow32_bug="$define"
16473                         case "$foo" in
16474                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16475                         ;;
16476                         esac
16477                         ;;
16478                 *" 4294967303.150000 0.150000 4294967303.000000")
16479                         echo >&4 "Your modfl() seems okay for large values."
16480                         ;;
16481                 *)      echo >&4 "I don't understand your modfl() at all."
16482                         d_modfl="$undef"
16483                         ;;
16484                 esac
16485                 $rm_try
16486         else
16487                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16488                 d_modfl="$undef"
16489         fi
16490         case "$osname:$gccversion" in
16491         aix:)   ccflags="$saveccflags" ;; # restore
16492         esac
16493         ;;
16494 esac
16495
16496 if $test "$uselongdouble" = "$define"; then
16497     message=""
16498     if $test "$d_sqrtl" != "$define"; then
16499         message="$message sqrtl"
16500     fi
16501     if $test "$d_modfl" != "$define"; then
16502         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16503             echo "You have both truncl and copysignl, so I can emulate modfl."
16504         else
16505             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16506                 echo "You have both aintl and copysignl, so I can emulate modfl."
16507             else
16508                 message="$message modfl"
16509             fi
16510         fi
16511     fi
16512     if $test "$d_frexpl" != "$define"; then
16513         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16514             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16515         else
16516             message="$message frexpl"
16517         fi
16518     fi
16519     if $test "$d_ldexpl" != "$define"; then
16520         message="$message ldexpl"
16521     fi
16522
16523     if $test "$message" != ""; then
16524         $cat <<EOM >&4
16525
16526 *** You requested the use of long doubles but you do not seem to have
16527 *** the following mathematical functions needed for long double support:
16528 ***    $message
16529 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16530 *** Cannot continue, aborting.
16531
16532 EOM
16533
16534         exit 1
16535     fi
16536 fi
16537
16538 : see if mprotect exists
16539 set mprotect d_mprotect
16540 eval $inlibc
16541
16542 : see if msgctl exists
16543 set msgctl d_msgctl
16544 eval $inlibc
16545
16546 : see if msgget exists
16547 set msgget d_msgget
16548 eval $inlibc
16549
16550 : see if msgsnd exists
16551 set msgsnd d_msgsnd
16552 eval $inlibc
16553
16554 : see if msgrcv exists
16555 set msgrcv d_msgrcv
16556 eval $inlibc
16557
16558 : see how much of the 'msg*(2)' library is present.
16559 h_msg=true
16560 echo " "
16561 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16562 *"$undef"*) h_msg=false;;
16563 esac
16564 case "$osname" in
16565 freebsd)
16566     case "`ipcs 2>&1`" in
16567     "SVID messages"*"not configured"*)
16568         echo "Your $osname does not have the msg*(2) configured." >&4
16569         h_msg=false
16570         val="$undef"
16571         set msgctl d_msgctl
16572         eval $setvar
16573         set msgget d_msgget
16574         eval $setvar
16575         set msgsnd d_msgsnd
16576         eval $setvar
16577         set msgrcv d_msgrcv
16578         eval $setvar
16579         ;;
16580     esac
16581     ;;
16582 esac
16583 : we could also check for sys/ipc.h ...
16584 if $h_msg && $test `./findhdr sys/msg.h`; then
16585         echo "You have the full msg*(2) library." >&4
16586         val="$define"
16587 else
16588         echo "You don't have the full msg*(2) library." >&4
16589         val="$undef"
16590 fi
16591 set d_msg
16592 eval $setvar
16593
16594 : Check for msghdr_s
16595 echo " "
16596 echo "Checking to see if your system supports struct msghdr..." >&4
16597 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16598 eval $hasstruct
16599 case "$d_msghdr_s" in
16600 "$define")      echo "Yes, it does."   ;;
16601 *)              echo "No, it doesn't." ;;
16602 esac
16603
16604
16605 : see if msync exists
16606 set msync d_msync
16607 eval $inlibc
16608
16609 : see if munmap exists
16610 set munmap d_munmap
16611 eval $inlibc
16612
16613 : see if nice exists
16614 set nice d_nice
16615 eval $inlibc
16616
16617 : see if this is a langinfo.h system
16618 set langinfo.h i_langinfo
16619 eval $inhdr
16620
16621 : see if nl_langinfo exists
16622 set nl_langinfo d_nl_langinfo
16623 eval $inlibc
16624
16625 : check for volatile keyword
16626 echo " "
16627 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16628 $cat >try.c <<'EOCP'
16629 int main()
16630 {
16631         typedef struct _goo_struct goo_struct;
16632         goo_struct * volatile goo = ((goo_struct *)0);
16633         struct _goo_struct {
16634                 long long_int;
16635                 int reg_int;
16636                 char char_var;
16637         };
16638         typedef unsigned short foo_t;
16639         char *volatile foo;
16640         volatile int bar;
16641         volatile foo_t blech;
16642         foo = foo;
16643 }
16644 EOCP
16645 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16646         val="$define"
16647         echo "Yup, it does."
16648 else
16649         val="$undef"
16650         echo "Nope, it doesn't."
16651 fi
16652 set d_volatile
16653 eval $setvar
16654 $rm_try
16655
16656 : Check basic sizes
16657 echo " "
16658 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16659
16660 case "$use64bitint:$d_quad:$quadtype" in
16661 define:define:?*)
16662         ivtype="$quadtype"
16663         uvtype="$uquadtype"
16664         ivsize=8
16665         uvsize=8
16666         ;;
16667 *)      ivtype="long"
16668         uvtype="unsigned long"
16669         ivsize=$longsize
16670         uvsize=$longsize
16671         ;;
16672 esac
16673
16674 case "$uselongdouble:$d_longdbl" in
16675 define:define)
16676         nvtype="long double"
16677         nvsize=$longdblsize
16678         ;;
16679 *)      nvtype=double
16680         nvsize=$doublesize
16681         ;;
16682 esac
16683
16684 case "$usequadmath:$i_quadmath" in
16685 define:define)
16686   nvtype="__float128"
16687   nvsize=16
16688   case "$libs" in
16689   *quadmath*) ;;
16690   *) $cat <<EOM >&4
16691
16692 *** You requested the use of the quadmath library, but you
16693 *** do not seem to have the quadmath library installed.
16694 *** Cannot continue, aborting.
16695 EOM
16696     exit 1
16697     ;;
16698   esac
16699   ;;
16700 define:*) $cat <<EOM >&4
16701
16702 *** You requested the use of the quadmath library, but you
16703 *** do not seem to have the required header, <quadmath.h>.
16704 EOM
16705   case "$gccversion" in
16706   [23].*|4.[0-5]*)
16707    $cat <<EOM >&4
16708 *** Your gcc looks a bit old:
16709 *** $gccversion
16710 EOM
16711     ;;
16712   '')
16713    $cat <<EOM >&4
16714 *** You are not running a gcc.
16715 EOM
16716     ;;
16717   esac
16718   $cat <<EOM >&4
16719 *** For the quadmath library you need at least gcc 4.6.
16720 *** Cannot continue, aborting.
16721 EOM
16722   exit 1
16723   ;;
16724 esac
16725
16726 $echo "(IV will be "$ivtype", $ivsize bytes)"
16727 $echo "(UV will be "$uvtype", $uvsize bytes)"
16728 $echo "(NV will be "$nvtype", $nvsize bytes)"
16729
16730 $cat >try.c <<EOCP
16731 #$i_inttypes I_INTTYPES
16732 #ifdef I_INTTYPES
16733 #include <inttypes.h>
16734 #endif
16735 #include <stdio.h>
16736 int main() {
16737 #ifdef INT8
16738    int8_t i =  INT8_MAX;
16739   uint8_t u = UINT8_MAX;
16740   printf("int8_t\n");
16741 #endif
16742 #ifdef INT16
16743    int16_t i =  INT16_MAX;
16744   uint16_t u = UINT16_MAX;
16745   printf("int16_t\n");
16746 #endif
16747 #ifdef INT32
16748    int32_t i =  INT32_MAX;
16749   uint32_t u = UINT32_MAX;
16750   printf("int32_t\n");
16751 #endif
16752 }
16753 EOCP
16754
16755 i8type="signed char"
16756 u8type="unsigned char"
16757 i8size=1
16758 u8size=1
16759
16760 case "$i16type" in
16761 '')     case "$shortsize" in
16762         2)      i16type=short
16763                 u16type="unsigned short"
16764                 i16size=$shortsize
16765                 u16size=$shortsize
16766                 ;;
16767         esac
16768         ;;
16769 esac
16770 case "$i16type" in
16771 '')     set try -DINT16
16772         if eval $compile; then
16773                 case "`$run ./try`" in
16774                 int16_t)
16775                         i16type=int16_t
16776                         u16type=uint16_t
16777                         i16size=2
16778                         u16size=2
16779                         ;;
16780                 esac
16781         fi
16782         ;;
16783 esac
16784 case "$i16type" in
16785 '')     if $test $shortsize -ge 2; then
16786                 i16type=short
16787                 u16type="unsigned short"
16788                 i16size=$shortsize
16789                 u16size=$shortsize
16790         fi
16791         ;;
16792 esac
16793
16794 case "$i32type" in
16795 '')     case "$longsize" in
16796         4)      i32type=long
16797                 u32type="unsigned long"
16798                 i32size=$longsize
16799                 u32size=$longsize
16800                 ;;
16801         *)      case "$intsize" in
16802                 4)      i32type=int
16803                         u32type="unsigned int"
16804                         i32size=$intsize
16805                         u32size=$intsize
16806                         ;;
16807                 esac
16808                 ;;
16809         esac
16810         ;;
16811 esac
16812 case "$i32type" in
16813 '')     set try -DINT32
16814         if eval $compile; then
16815                 case "`$run ./try`" in
16816                 int32_t)
16817                         i32type=int32_t
16818                         u32type=uint32_t
16819                         i32size=4
16820                         u32size=4
16821                         ;;
16822                 esac
16823         fi
16824         ;;
16825 esac
16826 case "$i32type" in
16827 '')     if $test $intsize -ge 4; then
16828                 i32type=int
16829                 u32type="unsigned int"
16830                 i32size=$intsize
16831                 u32size=$intsize
16832         fi
16833         ;;
16834 esac
16835
16836 case "$i64type" in
16837 '')     case "$d_quad:$quadtype" in
16838         define:?*)
16839                 i64type="$quadtype"
16840                 u64type="$uquadtype"
16841                 i64size=8
16842                 u64size=8
16843                 ;;
16844         esac
16845         ;;
16846 esac
16847
16848 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16849 : volatile so that the compiler has to store it out to memory.
16850 if test X"$d_volatile" = X"$define"; then
16851         volatile=volatile
16852 fi
16853 $cat <<EOP >try.c
16854 #include <stdio.h>
16855 #$i_stdlib I_STDLIB
16856 #ifdef I_STDLIB
16857 #include <stdlib.h>
16858 #endif
16859 #include <sys/types.h>
16860 #include <signal.h>
16861 #ifdef SIGFPE
16862 $volatile int bletched = 0;
16863 $signal_t blech(int s) { bletched = 1; }
16864 #endif
16865 int main() {
16866     $uvtype u = 0;
16867     $nvtype d;
16868     int     n = 8 * $uvsize;
16869     int     i;
16870 #ifdef SIGFPE
16871     signal(SIGFPE, blech);
16872 #endif
16873
16874     for (i = 0; i < n; i++) {
16875       u = u << 1 | ($uvtype)1;
16876       d = ($nvtype)u;
16877       if (($uvtype)d != u)
16878         break;
16879       if (d <= 0)
16880         break;
16881       d = ($nvtype)(u - 1);
16882       if (($uvtype)d != (u - 1))
16883         break;
16884 #ifdef SIGFPE
16885       if (bletched)
16886         break;
16887 #endif
16888     }
16889     printf("%d\n", ((i == n) ? -n : i));
16890     exit(0);
16891 }
16892 EOP
16893 set try
16894
16895 d_nv_preserves_uv="$undef"
16896 if eval $compile; then
16897         nv_preserves_uv_bits="`$run ./try`"
16898 fi
16899 case "$nv_preserves_uv_bits" in
16900 \-[1-9]*)
16901         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16902         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16903         d_nv_preserves_uv="$define"
16904         ;;
16905 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16906         d_nv_preserves_uv="$undef" ;;
16907 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16908         nv_preserves_uv_bits="0" ;;
16909 esac
16910 $rm_try
16911
16912 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16913 : volatile so that the compiler has to store it out to memory.
16914 if test X"$d_volatile" = X"$define"; then
16915         volatile=volatile
16916 fi
16917 $cat <<EOP >try.c
16918 #include <stdio.h>
16919
16920 typedef $nvtype NV;
16921
16922 int
16923 main() {
16924   NV value = 2;
16925   int count = 1;
16926
16927   while(count < 256) {
16928     $volatile NV up = value + 1.0;
16929     $volatile NV negated = -value;
16930     $volatile NV down = negated - 1.0;
16931     $volatile NV got_up = up - value;
16932     int up_good = got_up == 1.0;
16933     int got_down = down - negated;
16934     int down_good = got_down == -1.0;
16935
16936     if (down_good != up_good) {
16937       fprintf(stderr,
16938               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16939               up_good, (double) got_up, down_good, (double) got_down,
16940               count, (double) value);
16941       return 1;
16942     }
16943     if (!up_good) {
16944       while (1) {
16945         if (count > 8) {
16946           count -= 8;
16947           fputs("256.0", stdout);
16948         } else {
16949           count--;
16950           fputs("2.0", stdout);
16951         }
16952         if (!count) {
16953           puts("");
16954           return 0;
16955         }
16956         fputs("*", stdout);
16957       }
16958     }
16959     value *= 2;
16960     ++count;
16961   }
16962   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16963           count, (double) value);
16964   return 1;
16965 }
16966 EOP
16967 set try
16968
16969 nv_overflows_integers_at='0'
16970 if eval $compile; then
16971     xxx="`$run ./try`"
16972     case "$?" in
16973         0)
16974             case "$xxx" in
16975                 2*)  cat >&4 <<EOM
16976 The largest integer your NVs can preserve is equal to $xxx
16977 EOM
16978                     nv_overflows_integers_at="$xxx"
16979                     ;;
16980                 *)  cat >&4 <<EOM
16981 Cannot determine the largest integer value your NVs can hold, unexpected output
16982 '$xxx'
16983 EOM
16984                     ;;
16985             esac
16986             ;;
16987         *)  cat >&4 <<EOM
16988 Cannot determine the largest integer value your NVs can hold
16989 EOM
16990             ;;
16991     esac
16992 fi
16993 $rm_try
16994
16995 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16996 : volatile so that the compiler has to store it out to memory.
16997 if test X"$d_volatile" = X"$define"; then
16998         volatile=volatile
16999 fi
17000 $cat <<EOP >try.c
17001 #include <stdio.h>
17002 #$i_stdlib I_STDLIB
17003 #ifdef I_STDLIB
17004 #include <stdlib.h>
17005 #endif
17006 #$i_string I_STRING
17007 #ifdef I_STRING
17008 #  include <string.h>
17009 #else
17010 #  include <strings.h>
17011 #endif
17012 #include <sys/types.h>
17013 #include <signal.h>
17014 #ifdef SIGFPE
17015 $volatile int bletched = 0;
17016 $signal_t blech(int s) { bletched = 1; }
17017 #endif
17018
17019 int checkit($nvtype d, char *where) {
17020     unsigned char *p = (char *)&d;
17021     unsigned char *end = p + sizeof(d);
17022     int fail = 0;
17023
17024     while (p < end)
17025         fail += *p++;
17026
17027     if (!fail)
17028         return 0;
17029
17030     p = (char *)&d;
17031     printf("No - %s: 0x", where);
17032     while (p < end)
17033         printf ("%02X", *p++);
17034     printf("\n");
17035     return 1;
17036 }
17037
17038 int main(int argc, char **argv) {
17039     $nvtype d = 0.0;
17040     int fail = 0;
17041     fail += checkit(d, "0.0");
17042
17043     /* The compiler shouldn't be assuming that bletched is 0  */
17044     d = bletched;
17045
17046     fail += checkit(d, "bleched");
17047
17048 #ifdef SIGFPE
17049     signal(SIGFPE, blech);
17050 #endif
17051
17052     /* Paranoia - the compiler should have no way of knowing that ANSI says
17053        that argv[argc] will always be NULL.  Actually, if it did assume this it
17054        would be buggy, as this is C and main() can be called from elsewhere in
17055        the program.  */
17056     d = argv[argc] ? 1 : 0;
17057
17058     if (d) {
17059         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
17060     }
17061
17062     fail += checkit(d, "ternary");
17063
17064     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
17065
17066     if (d != 0.0) {
17067         printf("No - memset doesn't give 0.0\n");
17068         /* This might just blow up:  */
17069         printf("(gives %g)\n", d);
17070         return 1;
17071     }
17072
17073 #ifdef SIGFPE
17074     if (bletched) {
17075         printf("No - something bleched\n");
17076         return 1;
17077     }
17078 #endif
17079     if (fail) {
17080       printf("No - %d fail(s)\n", fail);
17081       return 1;
17082     }
17083     printf("Yes\n");
17084     return 0;
17085 }
17086 EOP
17087 set try
17088
17089 d_nv_zero_is_allbits_zero="$undef"
17090 if eval $compile; then
17091     xxx="`$run ./try`"
17092     case "$?" in
17093         0)
17094             case "$xxx" in
17095                 Yes)  cat >&4 <<EOM
17096 0.0 is represented as all bits zero in memory
17097 EOM
17098                     d_nv_zero_is_allbits_zero="$define"
17099                     ;;
17100                 *)  cat >&4 <<EOM
17101 0.0 is not represented as all bits zero in memory
17102 EOM
17103                     d_nv_zero_is_allbits_zero="$undef"
17104                     ;;
17105             esac
17106             ;;
17107         *)  cat >&4 <<EOM
17108 0.0 is not represented as all bits zero in memory
17109 EOM
17110             d_nv_zero_is_allbits_zero="$undef"
17111             ;;
17112     esac
17113 fi
17114 $rm_try
17115
17116 : check for off64_t
17117 echo " "
17118 echo "Checking to see if you have off64_t..." >&4
17119 $cat >try.c <<EOCP
17120 #include <sys/types.h>
17121 #include <unistd.h>
17122 int main() { off64_t x = 7; }
17123 EOCP
17124 set try
17125 if eval $compile; then
17126         val="$define"
17127         echo "You have off64_t."
17128 else
17129         val="$undef"
17130         echo "You do not have off64_t."
17131         case "$lseeksize" in
17132         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
17133         esac
17134 fi
17135 $rm_try
17136 set d_off64_t
17137 eval $setvar
17138
17139 : how to create joinable pthreads
17140 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
17141         echo " "
17142         echo "Checking what constant to use for creating joinable pthreads..." >&4
17143         $cat >try.c <<'EOCP'
17144 #include <pthread.h>
17145 int main() {
17146     int detachstate = JOINABLE;
17147 }
17148 EOCP
17149         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
17150         if eval $compile; then
17151                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
17152                 val="$undef" # Yes, undef.
17153                 set d_old_pthread_create_joinable
17154                 eval $setvar
17155                 val=""
17156                 set old_pthread_create_joinable
17157                 eval $setvar
17158         else
17159                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
17160                 if eval $compile; then
17161                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
17162                         val="$define"
17163                         set d_old_pthread_create_joinable
17164                         eval $setvar
17165                         val=PTHREAD_CREATE_UNDETACHED
17166                         set old_pthread_create_joinable
17167                         eval $setvar
17168                 else
17169                         set try -DJOINABLE=__UNDETACHED
17170                         if eval $compile; then
17171                                 echo "You seem to use __UNDETACHED." >&4
17172                                 val="$define"
17173                                 set d_old_pthread_create_joinable
17174                                 eval $setvar
17175                                 val=__UNDETACHED
17176                                 set old_pthread_create_joinable
17177                                 eval $setvar
17178                         else
17179                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
17180                                 val="$define"
17181                                 set d_old_pthread_create_joinable
17182                                 eval $setvar
17183                                 val=0
17184                                 set old_pthread_create_joinable
17185                                 eval $setvar
17186                         fi
17187                 fi
17188         fi
17189         $rm_try
17190 else
17191     d_old_pthread_create_joinable="$undef"
17192     old_pthread_create_joinable=""
17193 fi
17194
17195 : see if pause exists
17196 set pause d_pause
17197 eval $inlibc
17198
17199 : see if poll exists
17200 set poll d_poll
17201 eval $inlibc
17202
17203 : see if prctl exists
17204 set prctl d_prctl
17205 eval $inlibc
17206
17207 : see if prctl supports PR_SET_NAME
17208 d_prctl_set_name=$undef
17209 case $d_prctl in
17210     $define)
17211         $cat >try.c <<EOM
17212 #ifdef __ANDROID__
17213 #include <unistd.h>
17214 #endif
17215 #include <sys/prctl.h>
17216
17217 int main (int argc, char *argv[])
17218 {
17219     return (prctl (PR_SET_NAME, "Test"));
17220     } /* main */
17221 EOM
17222         set try
17223         if eval $compile_ok && $run ./try; then
17224             echo "Your prctl (PR_SET_NAME, ...) works"
17225             d_prctl_set_name=$define
17226             fi
17227         $rm_try
17228         ;;
17229     esac
17230
17231 : see if readlink exists
17232 set readlink d_readlink
17233 eval $inlibc
17234
17235 : Check if exe is symlink to abs path of executing program
17236 echo " "
17237 procselfexe=''
17238 val="$undef"
17239 case "$d_readlink" in
17240     "$define")
17241         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
17242         : more tidy to avoid an extra level of symlink
17243         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
17244         while test $# -gt 0; do
17245             type=$1; try=$2
17246             shift; shift
17247             if $issymlink $try; then
17248                 $ls -l $try > reflect
17249                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17250                     echo "You have $type-like $try."
17251                     procselfexe='"'$try'"'
17252                     val="$define"
17253                     : This will break out of the loop
17254                     set X; shift
17255                 fi
17256             fi
17257         done
17258         ;;
17259 esac
17260 $rm -f reflect
17261 set d_procselfexe
17262 eval $setvar
17263
17264 : backward compatibility for d_hvfork
17265 if test X$d_hvfork != X; then
17266         d_vfork="$d_hvfork"
17267         d_hvfork=''
17268 fi
17269 : see if there is a vfork
17270 val=''
17271 set vfork val
17272 eval $inlibc
17273
17274 d_pseudofork=$undef
17275
17276 : Ok, but do we want to use it. vfork is reportedly unreliable in
17277 : perl on Solaris 2.x, and probably elsewhere.
17278 case "$val" in
17279 $define)
17280         echo " "
17281         case "$usevfork" in
17282         false) dflt='n';;
17283         *) dflt='y';;
17284         esac
17285         cat <<'EOM'
17286
17287 Perl can only use a vfork() that doesn't suffer from strict
17288 restrictions on calling functions or modifying global data in
17289 the child.  For example, glibc-2.1 contains such a vfork()
17290 that is unsuitable.  If your system provides a proper fork()
17291 call, chances are that you do NOT want perl to use vfork().
17292
17293 EOM
17294         rp="Do you still want to use vfork()?"
17295         . ./myread
17296         case "$ans" in
17297         y|Y) ;;
17298         *)
17299                 echo "Ok, we won't use vfork()."
17300                 val="$undef"
17301                 ;;
17302         esac
17303         ;;
17304 esac
17305 set d_vfork
17306 eval $setvar
17307 case "$d_vfork" in
17308 $define) usevfork='true';;
17309 *) usevfork='false';;
17310 esac
17311
17312 : see whether the pthread_atfork exists
17313 $cat >try.c <<EOP
17314 #include <pthread.h>
17315 #include <stdio.h>
17316 int main() {
17317 #ifdef  PTHREAD_ATFORK
17318         pthread_atfork(NULL,NULL,NULL);
17319 #endif
17320 }
17321 EOP
17322
17323 : see if pthread_atfork exists
17324 set try -DPTHREAD_ATFORK
17325 if eval $compile; then
17326     val="$define"
17327 else
17328     val="$undef"
17329 fi
17330 case "$usethreads" in
17331 $define)
17332         case "$val" in
17333         $define) echo 'pthread_atfork found.' >&4        ;;
17334         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17335         esac
17336 esac
17337 set d_pthread_atfork
17338 eval $setvar
17339
17340 : see if pthread_attr_setscope exists
17341 set pthread_attr_setscope d_pthread_attr_setscope
17342 eval $inlibc
17343
17344 : see whether the various POSIXish _yields exist
17345 $cat >try.c <<EOP
17346 #include <pthread.h>
17347 #include <stdio.h>
17348 int main() {
17349 #ifdef SCHED_YIELD
17350         sched_yield();
17351 #else
17352 #ifdef PTHREAD_YIELD
17353         pthread_yield();
17354 #else
17355 #ifdef PTHREAD_YIELD_NULL
17356         pthread_yield(NULL);
17357 #endif
17358 #endif
17359 #endif
17360 }
17361 EOP
17362 : see if sched_yield exists
17363 set try -DSCHED_YIELD
17364 if eval $compile; then
17365     val="$define"
17366     sched_yield='sched_yield()'
17367 else
17368     val="$undef"
17369 fi
17370 case "$usethreads" in
17371 $define)
17372         case "$val" in
17373         $define) echo 'sched_yield() found.' >&4        ;;
17374         *)       echo 'sched_yield() NOT found.' >&4    ;;
17375         esac
17376 esac
17377 set d_sched_yield
17378 eval $setvar
17379
17380 : see if pthread_yield exists
17381 set try -DPTHREAD_YIELD
17382 if eval $compile; then
17383     val="$define"
17384     case "$sched_yield" in
17385     '') sched_yield='pthread_yield()' ;;
17386     esac
17387 else
17388     set try -DPTHREAD_YIELD_NULL
17389     if eval $compile; then
17390         val="$define"
17391         case "$sched_yield" in
17392         '') sched_yield='pthread_yield(NULL)' ;;
17393         esac
17394     else
17395         val="$undef"
17396     fi
17397 fi
17398 case "$usethreads" in
17399 $define)
17400         case "$val" in
17401         $define) echo 'pthread_yield() found.' >&4      ;;
17402         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17403         esac
17404         ;;
17405 esac
17406 set d_pthread_yield
17407 eval $setvar
17408 case "$sched_yield" in
17409 '') sched_yield=undef ;;
17410 esac
17411 $rm_try
17412
17413 : check for ptrdiff_t
17414 echo " "
17415 echo "Checking to see if you have ptrdiff_t..." >&4
17416 $cat >try.c <<EOCP
17417 #include <stddef.h>
17418 int main() { ptrdiff_t x = 7; }
17419 EOCP
17420 set try
17421 if eval $compile; then
17422         val="$define"
17423         echo "You have ptrdiff_t."
17424 else
17425         val="$undef"
17426         echo "You do not have ptrdiff_t."
17427 fi
17428 $rm_try
17429 set d_ptrdiff_t
17430 eval $setvar
17431
17432 : see if random_r exists
17433 set random_r d_random_r
17434 eval $inlibc
17435 case "$d_random_r" in
17436 "$define")
17437         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17438         case "$d_random_r_proto:$usethreads" in
17439         ":define")      d_random_r_proto=define
17440                 set d_random_r_proto random_r $hdrs
17441                 eval $hasproto ;;
17442         *)      ;;
17443         esac
17444         case "$d_random_r_proto" in
17445         define)
17446         case "$random_r_proto" in
17447         ''|0) try='int random_r(int*, struct random_data*);'
17448         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17449         esac
17450         case "$random_r_proto" in
17451         ''|0) try='int random_r(long*, struct random_data*);'
17452         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17453         esac
17454         case "$random_r_proto" in
17455         ''|0) try='int random_r(struct random_data*, int32_t*);'
17456         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17457         esac
17458         case "$random_r_proto" in
17459         ''|0)   d_random_r=undef
17460                 random_r_proto=0
17461                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17462         * )     case "$random_r_proto" in
17463                 REENTRANT_PROTO*) ;;
17464                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17465                 esac
17466                 echo "Prototype: $try" ;;
17467         esac
17468         ;;
17469         *)      case "$usethreads" in
17470                 define) echo "random_r has no prototype, not using it." >&4 ;;
17471                 esac
17472                 d_random_r=undef
17473                 random_r_proto=0
17474                 ;;
17475         esac
17476         ;;
17477 *)      random_r_proto=0
17478         ;;
17479 esac
17480
17481 : see if readdir and friends exist
17482 set readdir d_readdir
17483 eval $inlibc
17484 set seekdir d_seekdir
17485 eval $inlibc
17486 set telldir d_telldir
17487 eval $inlibc
17488 set rewinddir d_rewinddir
17489 eval $inlibc
17490
17491 : see if readdir64_r exists
17492 set readdir64_r d_readdir64_r
17493 eval $inlibc
17494 case "$d_readdir64_r" in
17495 "$define")
17496         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17497         case "$d_readdir64_r_proto:$usethreads" in
17498         ":define")      d_readdir64_r_proto=define
17499                 set d_readdir64_r_proto readdir64_r $hdrs
17500                 eval $hasproto ;;
17501         *)      ;;
17502         esac
17503         case "$d_readdir64_r_proto" in
17504         define)
17505         case "$readdir64_r_proto" in
17506         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17507         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17508         esac
17509         case "$readdir64_r_proto" in
17510         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17511         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17512         esac
17513         case "$readdir64_r_proto" in
17514         ''|0)   d_readdir64_r=undef
17515                 readdir64_r_proto=0
17516                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17517         * )     case "$readdir64_r_proto" in
17518                 REENTRANT_PROTO*) ;;
17519                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17520                 esac
17521                 echo "Prototype: $try" ;;
17522         esac
17523         ;;
17524         *)      case "$usethreads" in
17525                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17526                 esac
17527                 d_readdir64_r=undef
17528                 readdir64_r_proto=0
17529                 ;;
17530         esac
17531         ;;
17532 *)      readdir64_r_proto=0
17533         ;;
17534 esac
17535
17536 : see if readdir_r exists
17537 set readdir_r d_readdir_r
17538 eval $inlibc
17539 case "$d_readdir_r" in
17540 "$define")
17541         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17542         case "$d_readdir_r_proto:$usethreads" in
17543         ":define")      d_readdir_r_proto=define
17544                 set d_readdir_r_proto readdir_r $hdrs
17545                 eval $hasproto ;;
17546         *)      ;;
17547         esac
17548         case "$d_readdir_r_proto" in
17549         define)
17550         case "$readdir_r_proto" in
17551         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17552         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17553         esac
17554         case "$readdir_r_proto" in
17555         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17556         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17557         esac
17558         case "$readdir_r_proto" in
17559         ''|0)   d_readdir_r=undef
17560                 readdir_r_proto=0
17561                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17562         * )     case "$readdir_r_proto" in
17563                 REENTRANT_PROTO*) ;;
17564                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17565                 esac
17566                 echo "Prototype: $try" ;;
17567         esac
17568         ;;
17569         *)      case "$usethreads" in
17570                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17571                 esac
17572                 d_readdir_r=undef
17573                 readdir_r_proto=0
17574                 ;;
17575         esac
17576         ;;
17577 *)      readdir_r_proto=0
17578         ;;
17579 esac
17580
17581 : see if readv exists
17582 set readv d_readv
17583 eval $inlibc
17584
17585 : see if recvmsg exists
17586 set recvmsg d_recvmsg
17587 eval $inlibc
17588
17589 : see if rename exists
17590 set rename d_rename
17591 eval $inlibc
17592
17593 : see if rmdir exists
17594 set rmdir d_rmdir
17595 eval $inlibc
17596
17597 : see if memory.h is available.
17598 val=''
17599 set memory.h val
17600 eval $inhdr
17601
17602 : See if it conflicts with string.h
17603 case "$val" in
17604 $define)
17605         case "$strings" in
17606         '') ;;
17607         *)
17608                 $cppstdin $cppflags $cppminus < $strings > mem.h
17609                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17610                         echo " "
17611                         echo "We won't be including <memory.h>."
17612                         val="$undef"
17613                 fi
17614                 $rm -f mem.h
17615                 ;;
17616         esac
17617 esac
17618 set i_memory
17619 eval $setvar
17620
17621 : can bcopy handle overlapping blocks?
17622 echo " "
17623 val="$undef"
17624 case "$d_memmove" in
17625 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17626 *)      case "$d_bcopy" in
17627         "$define")
17628                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17629                 $cat >try.c <<EOCP
17630 #$i_memory I_MEMORY
17631 #$i_stdlib I_STDLIB
17632 #$i_string I_STRING
17633 #$i_unistd I_UNISTD
17634 EOCP
17635         $cat >>try.c <<'EOCP'
17636 #include <stdio.h>
17637 #ifdef I_MEMORY
17638 #  include <memory.h>
17639 #endif
17640 #ifdef I_STDLIB
17641 #  include <stdlib.h>
17642 #endif
17643 #ifdef I_STRING
17644 #  include <string.h>
17645 #else
17646 #  include <strings.h>
17647 #endif
17648 #ifdef I_UNISTD
17649 #  include <unistd.h>  /* Needed for NetBSD */
17650 #endif
17651 int main()
17652 {
17653 char buf[128], abc[128];
17654 char *b;
17655 int len;
17656 int off;
17657 int align;
17658
17659 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17660    try to store the string in read-only memory. */
17661 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17662
17663 for (align = 7; align >= 0; align--) {
17664         for (len = 36; len; len--) {
17665                 b = buf+align;
17666                 bcopy(abc, b, len);
17667                 for (off = 1; off <= len; off++) {
17668                         bcopy(b, b+off, len);
17669                         bcopy(b+off, b, len);
17670                         if (bcmp(b, abc, len))
17671                                 exit(1);
17672                 }
17673         }
17674 }
17675 exit(0);
17676 }
17677 EOCP
17678                 set try
17679                 if eval $compile_ok; then
17680                         if $run ./try 2>/dev/null; then
17681                                 echo "Yes, it can."
17682                                 val="$define"
17683                         else
17684                                 echo "It can't, sorry."
17685                         fi
17686                 else
17687                         echo "(I can't compile the test program, so we'll assume not...)"
17688                 fi
17689                 ;;
17690         esac
17691         $rm_try
17692         ;;
17693 esac
17694 set d_safebcpy
17695 eval $setvar
17696
17697 : can memcpy handle overlapping blocks?
17698 echo " "
17699 val="$undef"
17700 case "$d_memmove" in
17701 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17702 *)      case "$d_memcpy" in
17703         "$define")
17704                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17705                 $cat >try.c <<EOCP
17706 #$i_memory I_MEMORY
17707 #$i_stdlib I_STDLIB
17708 #$i_string I_STRING
17709 #$i_unistd I_UNISTD
17710 EOCP
17711         $cat >>try.c <<'EOCP'
17712 #include <stdio.h>
17713 #ifdef I_MEMORY
17714 #  include <memory.h>
17715 #endif
17716 #ifdef I_STDLIB
17717 #  include <stdlib.h>
17718 #endif
17719 #ifdef I_STRING
17720 #  include <string.h>
17721 #else
17722 #  include <strings.h>
17723 #endif
17724 #ifdef I_UNISTD
17725 #  include <unistd.h>  /* Needed for NetBSD */
17726 #endif
17727 int main()
17728 {
17729 char buf[128], abc[128];
17730 char *b;
17731 int len;
17732 int off;
17733 int align;
17734
17735 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17736    try to store the string in read-only memory. */
17737 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17738
17739 for (align = 7; align >= 0; align--) {
17740         for (len = 36; len; len--) {
17741                 b = buf+align;
17742                 memcpy(b, abc, len);
17743                 for (off = 1; off <= len; off++) {
17744                         memcpy(b+off, b, len);
17745                         memcpy(b, b+off, len);
17746                         if (memcmp(b, abc, len))
17747                                 exit(1);
17748                 }
17749         }
17750 }
17751 exit(0);
17752 }
17753 EOCP
17754                 set try
17755                 if eval $compile_ok; then
17756                         if $run ./try 2>/dev/null; then
17757                                 echo "Yes, it can."
17758                                 val="$define"
17759                         else
17760                                 echo "It can't, sorry."
17761                         fi
17762                 else
17763                         echo "(I can't compile the test program, so we'll assume not...)"
17764                 fi
17765                 ;;
17766         esac
17767         $rm_try
17768         ;;
17769 esac
17770 set d_safemcpy
17771 eval $setvar
17772
17773 : can memcmp be trusted to compare relative magnitude?
17774 val="$undef"
17775 case "$d_memcmp" in
17776 "$define")
17777         echo " "
17778         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17779         $cat >try.c <<EOCP
17780 #$i_memory I_MEMORY
17781 #$i_stdlib I_STDLIB
17782 #$i_string I_STRING
17783 #$i_unistd I_UNISTD
17784 EOCP
17785         $cat >>try.c <<'EOCP'
17786 #include <stdio.h>
17787 #ifdef I_MEMORY
17788 #  include <memory.h>
17789 #endif
17790 #ifdef I_STDLIB
17791 #  include <stdlib.h>
17792 #endif
17793 #ifdef I_STRING
17794 #  include <string.h>
17795 #else
17796 #  include <strings.h>
17797 #endif
17798 #ifdef I_UNISTD
17799 #  include <unistd.h>  /* Needed for NetBSD */
17800 #endif
17801 int main()
17802 {
17803 char a = -1;
17804 char b = 0;
17805 if ((a < b) && memcmp(&a, &b, 1) < 0)
17806         exit(1);
17807 exit(0);
17808 }
17809 EOCP
17810         set try
17811         if eval $compile_ok; then
17812                 if $run ./try 2>/dev/null; then
17813                         echo "Yes, it can."
17814                         val="$define"
17815                 else
17816                         echo "No, it can't (it uses signed chars)."
17817                 fi
17818         else
17819                 echo "(I can't compile the test program, so we'll assume not...)"
17820         fi
17821         ;;
17822 esac
17823 $rm_try
17824 set d_sanemcmp
17825 eval $setvar
17826
17827 : see if prototype for sbrk is available
17828 echo " "
17829 set d_sbrkproto sbrk $i_unistd unistd.h
17830 eval $hasproto
17831
17832 : see if select exists
17833 set select d_select
17834 eval $inlibc
17835
17836 : see if semctl exists
17837 set semctl d_semctl
17838 eval $inlibc
17839
17840 : see if semget exists
17841 set semget d_semget
17842 eval $inlibc
17843
17844 : see if semop exists
17845 set semop d_semop
17846 eval $inlibc
17847
17848 : see how much of the 'sem*(2)' library is present.
17849 h_sem=true
17850 echo " "
17851 case "$d_semctl$d_semget$d_semop" in
17852 *"$undef"*) h_sem=false;;
17853 esac
17854 case "$osname" in
17855 freebsd)
17856     case "`ipcs 2>&1`" in
17857     "SVID messages"*"not configured"*)
17858         echo "Your $osname does not have the sem*(2) configured." >&4
17859         h_sem=false
17860         val="$undef"
17861         set semctl d_semctl
17862         eval $setvar
17863         set semget d_semget
17864         eval $setvar
17865         set semop d_semop
17866         eval $setvar
17867         ;;
17868     esac
17869     ;;
17870 esac
17871 : we could also check for sys/ipc.h ...
17872 if $h_sem && $test `./findhdr sys/sem.h`; then
17873         echo "You have the full sem*(2) library." >&4
17874         val="$define"
17875 else
17876         echo "You don't have the full sem*(2) library." >&4
17877         val="$undef"
17878 fi
17879 set d_sem
17880 eval $setvar
17881
17882 : see whether sys/sem.h defines union semun
17883 echo " "
17884 $cat > try.c <<'END'
17885 #include <sys/types.h>
17886 #include <sys/ipc.h>
17887 #include <sys/sem.h>
17888 int main () { union semun semun; semun.buf = 0; }
17889 END
17890 set try
17891 if eval $compile; then
17892     echo "You have union semun in <sys/sem.h>." >&4
17893     val="$define"
17894 else
17895     echo "You do not have union semun in <sys/sem.h>." >&4
17896     val="$undef"
17897 fi
17898 $rm_try
17899 set d_union_semun
17900 eval $setvar
17901
17902 : see how to do semctl IPC_STAT
17903 case "$d_sem" in
17904 $define)
17905     echo " "
17906     $cat > tryh.h <<END
17907 #ifndef S_IRUSR
17908 #   ifdef S_IREAD
17909 #       define S_IRUSR S_IREAD
17910 #       define S_IWUSR S_IWRITE
17911 #       define S_IXUSR S_IEXEC
17912 #   else
17913 #       define S_IRUSR 0400
17914 #       define S_IWUSR 0200
17915 #       define S_IXUSR 0100
17916 #   endif
17917 #   define S_IRGRP (S_IRUSR>>3)
17918 #   define S_IWGRP (S_IWUSR>>3)
17919 #   define S_IXGRP (S_IXUSR>>3)
17920 #   define S_IROTH (S_IRUSR>>6)
17921 #   define S_IWOTH (S_IWUSR>>6)
17922 #   define S_IXOTH (S_IXUSR>>6)
17923 #endif
17924 #ifndef S_IRWXU
17925 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17926 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17927 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17928 #endif
17929 END
17930     : see whether semctl IPC_STAT can use union semun
17931     case "$d_semctl_semun" in
17932     '')
17933       val="$undef"
17934       $cat > try.c <<END
17935 #include <sys/types.h>
17936 #include <sys/ipc.h>
17937 #include <sys/sem.h>
17938 #include <sys/stat.h>
17939 #include <stdio.h>
17940 #include <errno.h>
17941 #include "tryh.h"
17942 #ifndef errno
17943 extern int errno;
17944 #endif
17945 #$d_union_semun HAS_UNION_SEMUN
17946 int main() {
17947     union semun
17948 #ifndef HAS_UNION_SEMUN
17949     {
17950         int val;
17951         struct semid_ds *buf;
17952         unsigned short *array;
17953     }
17954 #endif
17955     arg;
17956     int sem, st;
17957
17958 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17959     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17960     if (sem > -1) {
17961         struct semid_ds argbuf;
17962         arg.buf = &argbuf;
17963 #       ifdef IPC_STAT
17964         st = semctl(sem, 0, IPC_STAT, arg);
17965         if (st == 0)
17966             printf("semun\n");
17967         else
17968 #       endif /* IPC_STAT */
17969             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17970 #       ifdef IPC_RMID
17971         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17972 #       endif /* IPC_RMID */
17973             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17974     } else
17975 #endif /* IPC_PRIVATE && ... */
17976         printf("semget failed: errno = %d\n", errno);
17977   return 0;
17978 }
17979 END
17980       set try
17981       if eval $compile; then
17982           xxx=`$run ./try`
17983           case "$xxx" in
17984           semun) val="$define" ;;
17985           esac
17986       fi
17987       $rm_try
17988       set d_semctl_semun
17989       eval $setvar
17990       ;;
17991     esac
17992     case "$d_semctl_semun" in
17993     $define)
17994         echo "You can use union semun for semctl IPC_STAT." >&4
17995         also='also'
17996         ;;
17997     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17998         also=''
17999         ;;
18000     esac
18001
18002     : see whether semctl IPC_STAT can use struct semid_ds pointer
18003     case "$d_semctl_semid_ds" in
18004     '')
18005       val="$undef"
18006       $cat > try.c <<'END'
18007 #include <sys/types.h>
18008 #include <sys/ipc.h>
18009 #include <sys/sem.h>
18010 #include <sys/stat.h>
18011 #include "tryh.h"
18012 #include <stdio.h>
18013 #include <errno.h>
18014 #ifndef errno
18015 extern int errno;
18016 #endif
18017 int main() {
18018     struct semid_ds arg;
18019     int sem, st;
18020
18021 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
18022     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
18023     if (sem > -1) {
18024 #       ifdef IPC_STAT
18025         st = semctl(sem, 0, IPC_STAT, &arg);
18026         if (st == 0)
18027             printf("semid_ds\n");
18028         else
18029 #       endif /* IPC_STAT */
18030             printf("semctl IPC_STAT failed: errno = %d\n", errno);
18031 #       ifdef IPC_RMID
18032         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
18033 #       endif /* IPC_RMID */
18034             printf("semctl IPC_RMID failed: errno = %d\n", errno);
18035     } else
18036 #endif /* IPC_PRIVATE && ... */
18037         printf("semget failed: errno = %d\n", errno);
18038
18039     return 0;
18040 }
18041 END
18042       set try
18043       if eval $compile; then
18044           xxx=`$run ./try`
18045           case "$xxx" in
18046           semid_ds) val="$define" ;;
18047           esac
18048       fi
18049       $rm_try
18050       set d_semctl_semid_ds
18051       eval $setvar
18052       ;;
18053     esac
18054     case "$d_semctl_semid_ds" in
18055     $define)
18056         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
18057         ;;
18058     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
18059         ;;
18060     esac
18061     ;;
18062 *)  val="$undef"
18063
18064     # We do not have the full sem*(2) library, so assume we can not
18065     # use either.
18066
18067     set d_semctl_semun
18068     eval $setvar
18069
18070     set d_semctl_semid_ds
18071     eval $setvar
18072     ;;
18073 esac
18074 $rm_try tryh.h
18075
18076 : see if sendmsg exists
18077 set sendmsg d_sendmsg
18078 eval $inlibc
18079
18080 : see if setegid exists
18081 set setegid d_setegid
18082 eval $inlibc
18083
18084 : see if seteuid exists
18085 set seteuid d_seteuid
18086 eval $inlibc
18087
18088 : see if setgrent exists
18089 set setgrent d_setgrent
18090 eval $inlibc
18091
18092 : see if setgrent_r exists
18093 set setgrent_r d_setgrent_r
18094 eval $inlibc
18095 case "$d_setgrent_r" in
18096 "$define")
18097         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
18098         case "$d_setgrent_r_proto:$usethreads" in
18099         ":define")      d_setgrent_r_proto=define
18100                 set d_setgrent_r_proto setgrent_r $hdrs
18101                 eval $hasproto ;;
18102         *)      ;;
18103         esac
18104         case "$d_setgrent_r_proto" in
18105         define)
18106         case "$setgrent_r_proto" in
18107         ''|0) try='int setgrent_r(FILE**);'
18108         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
18109         esac
18110         case "$setgrent_r_proto" in
18111         ''|0) try='void setgrent_r(FILE**);'
18112         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
18113         esac
18114         case "$setgrent_r_proto" in
18115         ''|0)   d_setgrent_r=undef
18116                 setgrent_r_proto=0
18117                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
18118         * )     case "$setgrent_r_proto" in
18119                 REENTRANT_PROTO*) ;;
18120                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
18121                 esac
18122                 echo "Prototype: $try" ;;
18123         esac
18124         ;;
18125         *)      case "$usethreads" in
18126                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
18127                 esac
18128                 d_setgrent_r=undef
18129                 setgrent_r_proto=0
18130                 ;;
18131         esac
18132         ;;
18133 *)      setgrent_r_proto=0
18134         ;;
18135 esac
18136
18137 : see if sethostent exists
18138 set sethostent d_sethent
18139 eval $inlibc
18140
18141 : see if sethostent_r exists
18142 set sethostent_r d_sethostent_r
18143 eval $inlibc
18144 case "$d_sethostent_r" in
18145 "$define")
18146         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18147         case "$d_sethostent_r_proto:$usethreads" in
18148         ":define")      d_sethostent_r_proto=define
18149                 set d_sethostent_r_proto sethostent_r $hdrs
18150                 eval $hasproto ;;
18151         *)      ;;
18152         esac
18153         case "$d_sethostent_r_proto" in
18154         define)
18155         case "$sethostent_r_proto" in
18156         ''|0) try='int sethostent_r(int, struct hostent_data*);'
18157         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
18158         esac
18159         case "$sethostent_r_proto" in
18160         ''|0) try='void sethostent_r(int, struct hostent_data*);'
18161         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
18162         esac
18163         case "$sethostent_r_proto" in
18164         ''|0)   d_sethostent_r=undef
18165                 sethostent_r_proto=0
18166                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
18167         * )     case "$sethostent_r_proto" in
18168                 REENTRANT_PROTO*) ;;
18169                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
18170                 esac
18171                 echo "Prototype: $try" ;;
18172         esac
18173         ;;
18174         *)      case "$usethreads" in
18175                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
18176                 esac
18177                 d_sethostent_r=undef
18178                 sethostent_r_proto=0
18179                 ;;
18180         esac
18181         ;;
18182 *)      sethostent_r_proto=0
18183         ;;
18184 esac
18185
18186 : see if setitimer exists
18187 set setitimer d_setitimer
18188 eval $inlibc
18189
18190 : see if setlinebuf exists
18191 set setlinebuf d_setlinebuf
18192 eval $inlibc
18193
18194 : see if setlocale exists
18195 set setlocale d_setlocale
18196 eval $inlibc
18197
18198 : see if locale.h is available
18199 set locale.h i_locale
18200 eval $inhdr
18201
18202 : see if setlocale_r exists
18203 set setlocale_r d_setlocale_r
18204 eval $inlibc
18205 case "$d_setlocale_r" in
18206 "$define")
18207         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
18208         case "$d_setlocale_r_proto:$usethreads" in
18209         ":define")      d_setlocale_r_proto=define
18210                 set d_setlocale_r_proto setlocale_r $hdrs
18211                 eval $hasproto ;;
18212         *)      ;;
18213         esac
18214         case "$d_setlocale_r_proto" in
18215         define)
18216         case "$setlocale_r_proto" in
18217         ''|0) try='int setlocale_r(int, const char*, char*, int);'
18218         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
18219         esac
18220         case "$setlocale_r_proto" in
18221         ''|0)   d_setlocale_r=undef
18222                 setlocale_r_proto=0
18223                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
18224         * )     case "$setlocale_r_proto" in
18225                 REENTRANT_PROTO*) ;;
18226                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
18227                 esac
18228                 echo "Prototype: $try" ;;
18229         esac
18230         ;;
18231         *)      case "$usethreads" in
18232                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
18233                 esac
18234                 d_setlocale_r=undef
18235                 setlocale_r_proto=0
18236                 ;;
18237         esac
18238         ;;
18239 *)      setlocale_r_proto=0
18240         ;;
18241 esac
18242
18243 : see if setnetent exists
18244 set setnetent d_setnent
18245 eval $inlibc
18246
18247 : see if setnetent_r exists
18248 set setnetent_r d_setnetent_r
18249 eval $inlibc
18250 case "$d_setnetent_r" in
18251 "$define")
18252         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18253         case "$d_setnetent_r_proto:$usethreads" in
18254         ":define")      d_setnetent_r_proto=define
18255                 set d_setnetent_r_proto setnetent_r $hdrs
18256                 eval $hasproto ;;
18257         *)      ;;
18258         esac
18259         case "$d_setnetent_r_proto" in
18260         define)
18261         case "$setnetent_r_proto" in
18262         ''|0) try='int setnetent_r(int, struct netent_data*);'
18263         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18264         esac
18265         case "$setnetent_r_proto" in
18266         ''|0) try='void setnetent_r(int, struct netent_data*);'
18267         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18268         esac
18269         case "$setnetent_r_proto" in
18270         ''|0)   d_setnetent_r=undef
18271                 setnetent_r_proto=0
18272                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18273         * )     case "$setnetent_r_proto" in
18274                 REENTRANT_PROTO*) ;;
18275                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18276                 esac
18277                 echo "Prototype: $try" ;;
18278         esac
18279         ;;
18280         *)      case "$usethreads" in
18281                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18282                 esac
18283                 d_setnetent_r=undef
18284                 setnetent_r_proto=0
18285                 ;;
18286         esac
18287         ;;
18288 *)      setnetent_r_proto=0
18289         ;;
18290 esac
18291
18292 : see if setprotoent exists
18293 set setprotoent d_setpent
18294 eval $inlibc
18295
18296 : see if setpgid exists
18297 set setpgid d_setpgid
18298 eval $inlibc
18299
18300 : see if setpgrp2 exists
18301 set setpgrp2 d_setpgrp2
18302 eval $inlibc
18303
18304 : see if setpriority exists
18305 set setpriority d_setprior
18306 eval $inlibc
18307
18308 : see if setproctitle exists
18309 set setproctitle d_setproctitle
18310 eval $inlibc
18311
18312 : see if setprotoent_r exists
18313 set setprotoent_r d_setprotoent_r
18314 eval $inlibc
18315 case "$d_setprotoent_r" in
18316 "$define")
18317         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18318         case "$d_setprotoent_r_proto:$usethreads" in
18319         ":define")      d_setprotoent_r_proto=define
18320                 set d_setprotoent_r_proto setprotoent_r $hdrs
18321                 eval $hasproto ;;
18322         *)      ;;
18323         esac
18324         case "$d_setprotoent_r_proto" in
18325         define)
18326         case "$setprotoent_r_proto" in
18327         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18328         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18329         esac
18330         case "$setprotoent_r_proto" in
18331         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18332         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18333         esac
18334         case "$setprotoent_r_proto" in
18335         ''|0)   d_setprotoent_r=undef
18336                 setprotoent_r_proto=0
18337                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18338         * )     case "$setprotoent_r_proto" in
18339                 REENTRANT_PROTO*) ;;
18340                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18341                 esac
18342                 echo "Prototype: $try" ;;
18343         esac
18344         ;;
18345         *)      case "$usethreads" in
18346                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18347                 esac
18348                 d_setprotoent_r=undef
18349                 setprotoent_r_proto=0
18350                 ;;
18351         esac
18352         ;;
18353 *)      setprotoent_r_proto=0
18354         ;;
18355 esac
18356
18357 : see if setpwent exists
18358 set setpwent d_setpwent
18359 eval $inlibc
18360
18361 : see if setpwent_r exists
18362 set setpwent_r d_setpwent_r
18363 eval $inlibc
18364 case "$d_setpwent_r" in
18365 "$define")
18366         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18367         case "$d_setpwent_r_proto:$usethreads" in
18368         ":define")      d_setpwent_r_proto=define
18369                 set d_setpwent_r_proto setpwent_r $hdrs
18370                 eval $hasproto ;;
18371         *)      ;;
18372         esac
18373         case "$d_setpwent_r_proto" in
18374         define)
18375         case "$setpwent_r_proto" in
18376         ''|0) try='int setpwent_r(FILE**);'
18377         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18378         esac
18379         case "$setpwent_r_proto" in
18380         ''|0) try='void setpwent_r(FILE**);'
18381         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18382         esac
18383         case "$setpwent_r_proto" in
18384         ''|0)   d_setpwent_r=undef
18385                 setpwent_r_proto=0
18386                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18387         * )     case "$setpwent_r_proto" in
18388                 REENTRANT_PROTO*) ;;
18389                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18390                 esac
18391                 echo "Prototype: $try" ;;
18392         esac
18393         ;;
18394         *)      case "$usethreads" in
18395                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18396                 esac
18397                 d_setpwent_r=undef
18398                 setpwent_r_proto=0
18399                 ;;
18400         esac
18401         ;;
18402 *)      setpwent_r_proto=0
18403         ;;
18404 esac
18405
18406 : see if setregid exists
18407 set setregid d_setregid
18408 eval $inlibc
18409 set setresgid d_setresgid
18410 eval $inlibc
18411
18412 : see if setreuid exists
18413 set setreuid d_setreuid
18414 eval $inlibc
18415 set setresuid d_setresuid
18416 eval $inlibc
18417
18418 : see if setrgid exists
18419 set setrgid d_setrgid
18420 eval $inlibc
18421
18422 : see if setruid exists
18423 set setruid d_setruid
18424 eval $inlibc
18425
18426 : see if setservent exists
18427 set setservent d_setsent
18428 eval $inlibc
18429
18430 : see if setservent_r exists
18431 set setservent_r d_setservent_r
18432 eval $inlibc
18433 case "$d_setservent_r" in
18434 "$define")
18435         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18436         case "$d_setservent_r_proto:$usethreads" in
18437         ":define")      d_setservent_r_proto=define
18438                 set d_setservent_r_proto setservent_r $hdrs
18439                 eval $hasproto ;;
18440         *)      ;;
18441         esac
18442         case "$d_setservent_r_proto" in
18443         define)
18444         case "$setservent_r_proto" in
18445         ''|0) try='int setservent_r(int, struct servent_data*);'
18446         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18447         esac
18448         case "$setservent_r_proto" in
18449         ''|0) try='void setservent_r(int, struct servent_data*);'
18450         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18451         esac
18452         case "$setservent_r_proto" in
18453         ''|0)   d_setservent_r=undef
18454                 setservent_r_proto=0
18455                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18456         * )     case "$setservent_r_proto" in
18457                 REENTRANT_PROTO*) ;;
18458                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18459                 esac
18460                 echo "Prototype: $try" ;;
18461         esac
18462         ;;
18463         *)      case "$usethreads" in
18464                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18465                 esac
18466                 d_setservent_r=undef
18467                 setservent_r_proto=0
18468                 ;;
18469         esac
18470         ;;
18471 *)      setservent_r_proto=0
18472         ;;
18473 esac
18474
18475 : see if setsid exists
18476 set setsid d_setsid
18477 eval $inlibc
18478
18479 : see if setvbuf exists
18480 set setvbuf d_setvbuf
18481 eval $inlibc
18482
18483 : see if shmctl exists
18484 set shmctl d_shmctl
18485 eval $inlibc
18486
18487 : see if shmget exists
18488 set shmget d_shmget
18489 eval $inlibc
18490
18491 : see if shmat exists
18492 set shmat d_shmat
18493 eval $inlibc
18494 : see what shmat returns
18495 case "$d_shmat" in
18496 "$define")
18497         $cat >shmat.c <<'END'
18498 #include <sys/shm.h>
18499 void *shmat();
18500 END
18501         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18502                 shmattype='void *'
18503         else
18504                 shmattype='char *'
18505         fi
18506         echo "and it returns ($shmattype)." >&4
18507         : see if a prototype for shmat is available
18508         xxx=`./findhdr sys/shm.h`
18509         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18510         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18511                 val="$define"
18512         else
18513                 val="$undef"
18514         fi
18515         $rm -f shmat.[co]
18516         ;;
18517 *)
18518         val="$undef"
18519         ;;
18520 esac
18521 set d_shmatprototype
18522 eval $setvar
18523
18524 : see if shmdt exists
18525 set shmdt d_shmdt
18526 eval $inlibc
18527
18528 : see how much of the 'shm*(2)' library is present.
18529 h_shm=true
18530 echo " "
18531 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18532 *"$undef"*) h_shm=false;;
18533 esac
18534 case "$osname" in
18535 freebsd)
18536     case "`ipcs 2>&1`" in
18537     "SVID shared memory"*"not configured"*)
18538         echo "Your $osname does not have the shm*(2) configured." >&4
18539         h_shm=false
18540         val="$undef"
18541         set shmctl d_shmctl
18542         eval $setvar
18543         set shmget d_shmget
18544         eval $setvar
18545         set shmat d_shmat
18546         eval $setvar
18547         set shmdt d_shmdt
18548         eval $setvar
18549         ;;
18550     esac
18551     ;;
18552 esac
18553 : we could also check for sys/ipc.h ...
18554 if $h_shm && $test `./findhdr sys/shm.h`; then
18555         echo "You have the full shm*(2) library." >&4
18556         val="$define"
18557 else
18558         echo "You don't have the full shm*(2) library." >&4
18559         val="$undef"
18560 fi
18561 set d_shm
18562 eval $setvar
18563
18564 : see if we have sigaction
18565 echo " "
18566 if set sigaction val -f d_sigaction; eval $csym; $val; then
18567         echo 'sigaction() found.' >&4
18568         $cat > try.c <<EOP
18569 #include <stdio.h>
18570 #include <sys/types.h>
18571 #include <signal.h>
18572 #$i_stdlib I_STDLIB
18573 #ifdef I_STDLIB
18574 #include <stdlib.h>
18575 #endif
18576 int main()
18577 {
18578     struct sigaction act, oact;
18579     act.sa_flags = 0;
18580     oact.sa_handler = 0;
18581     /* so that act and oact are used */
18582     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18583 }
18584 EOP
18585         set try
18586         if eval $compile_ok; then
18587                 val="$define"
18588         else
18589                 echo "But you don't seem to have a usable struct sigaction." >&4
18590                 val="$undef"
18591         fi
18592 else
18593         echo 'sigaction NOT found.' >&4
18594         val="$undef"
18595 fi
18596 set d_sigaction; eval $setvar
18597 $rm_try
18598
18599 : see if this is a sunmath.h system
18600 set sunmath.h i_sunmath
18601 eval $inhdr
18602
18603 : see if signbit exists
18604 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18605 $cat >try.c <<EOCP
18606 #$i_math I_MATH
18607 #$i_sunmath I_SUNMATH
18608 #ifdef I_MATH
18609 #  include <math.h>
18610 #endif
18611 #ifdef I_SUNMATH  /* Solaris special math library */
18612 #  include <sunmath.h>
18613 #endif
18614 #define NV $nvtype
18615 int main(int argc, char **argv)
18616 {
18617     NV x = 0.0;
18618     NV y = -0.0;
18619     if ((signbit(x) == 0) && (signbit(y) != 0))
18620         return 0;
18621     else
18622         return 1;
18623 }
18624 EOCP
18625 val="$undef"
18626 set try
18627 if eval $compile; then
18628     if $run ./try; then
18629         $echo "Yes." >&4
18630         val="$define"
18631     else
18632         $echo "Signbit seems to be available, but doesn't work as I expected."
18633         $echo "I won't use it." >&4
18634         val="$undef"
18635     fi
18636 else
18637     $echo "Nope." >&4
18638     dflt="$undef"
18639 fi
18640 set d_signbit
18641 eval $setvar
18642 $rm_try
18643
18644 : see if sigprocmask exists
18645 set sigprocmask d_sigprocmask
18646 eval $inlibc
18647
18648 : see if sigsetjmp exists
18649 echo " "
18650 case "$d_sigsetjmp" in
18651 '')
18652         $cat >try.c <<EOP
18653 #include <setjmp.h>
18654 #$i_stdlib I_STDLIB
18655 #ifdef I_STDLIB
18656 #include <stdlib.h>
18657 #endif
18658 sigjmp_buf env;
18659 int set = 1;
18660 int main()
18661 {
18662         if (sigsetjmp(env,1))
18663                 exit(set);
18664         set = 0;
18665         siglongjmp(env, 1);
18666         exit(1);
18667 }
18668 EOP
18669         set try
18670         if eval $compile; then
18671                 if $run ./try >/dev/null 2>&1; then
18672                         echo "POSIX sigsetjmp found." >&4
18673                         val="$define"
18674                 else
18675                         $cat >&4 <<EOM
18676 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18677 I'll ignore them.
18678 EOM
18679                         val="$undef"
18680                 fi
18681         else
18682                 echo "sigsetjmp not found." >&4
18683                 val="$undef"
18684         fi
18685         ;;
18686 *) val="$d_sigsetjmp"
18687         case "$d_sigsetjmp" in
18688         $define) echo "POSIX sigsetjmp found." >&4;;
18689         $undef) echo "sigsetjmp not found." >&4;;
18690         esac
18691         ;;
18692 esac
18693 set d_sigsetjmp
18694 eval $setvar
18695 $rm_try
18696
18697 : see if snprintf exists
18698 set snprintf d_snprintf
18699 eval $inlibc
18700
18701 : see if vsnprintf exists
18702 set vsnprintf d_vsnprintf
18703 eval $inlibc
18704
18705 case "$d_snprintf-$d_vsnprintf" in
18706 "$define-$define")
18707     $cat <<EOM
18708 Checking whether your snprintf() and vsnprintf() work okay...
18709 EOM
18710     $cat >try.c <<'EOCP'
18711 /* v?snprintf testing logic courtesy of Russ Allbery.
18712  * According to C99:
18713  * - if the buffer is too short it still must be \0-terminated
18714  * - if the buffer is too short the potentially required length
18715  *   must be returned and not -1
18716  * - if the buffer is NULL the potentially required length
18717  *   must be returned and not -1 or core dump
18718  */
18719 #include <stdio.h>
18720 #include <stdarg.h>
18721
18722 char buf[2];
18723
18724 int test (char *format, ...)
18725 {
18726     va_list args;
18727     int count;
18728
18729     va_start (args, format);
18730     count = vsnprintf (buf, sizeof buf, format, args);
18731     va_end (args);
18732     return count;
18733 }
18734
18735 int main ()
18736 {
18737     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18738              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18739 }
18740 EOCP
18741     set try
18742     if eval $compile; then
18743         `$run ./try`
18744         case "$?" in
18745         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18746         *) cat <<EOM >&4
18747 Your snprintf() and snprintf() don't seem to be working okay.
18748 EOM
18749            d_snprintf="$undef"
18750            d_vsnprintf="$undef"
18751            ;;
18752         esac
18753     else
18754         echo "(I can't seem to compile the test program--assuming they don't)"
18755         d_snprintf="$undef"
18756         d_vsnprintf="$undef"
18757     fi
18758     $rm_try
18759     ;;
18760 esac
18761
18762 : see if sockatmark exists
18763 set sockatmark d_sockatmark
18764 eval $inlibc
18765
18766 : see if prototype for sockatmark is available
18767 echo " "
18768 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18769 eval $hasproto
18770
18771 : see if socks5_init exists
18772 set socks5_init d_socks5_init
18773 eval $inlibc
18774
18775 : see if sprintf returns the length of the string in the buffer as per ANSI
18776 $echo "Checking whether sprintf returns the length of the string..." >&4
18777 $cat <<EOP >try.c
18778 #include <stdio.h>
18779 #$i_stdlib I_STDLIB
18780 #ifdef I_STDLIB
18781 #include <stdlib.h>
18782 #endif
18783 #$i_string I_STRING
18784 #ifdef I_STRING
18785 #  include <string.h>
18786 #else
18787 #  include <strings.h>
18788 #endif
18789 #$i_math I_MATH
18790 #ifdef I_MATH
18791 #include <math.h>
18792 #endif
18793
18794 char buffer[256];
18795
18796 int check (size_t expect, int test) {
18797   size_t got = strlen(buffer);
18798   if (expect == got)
18799     return 0;
18800
18801   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18802        test, buffer);
18803   exit (test);
18804 }
18805
18806 int main(int argc, char **argv) {
18807   int test = 0;
18808
18809   check(sprintf(buffer, ""), ++test);
18810   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18811   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18812
18813   return 0;
18814 }
18815 EOP
18816 set try
18817
18818 if eval $compile; then
18819     xxx="`$run ./try`"
18820     case "$?" in
18821         0) cat >&4 <<EOM
18822 sprintf returns the length of the string (as ANSI says it should)
18823 EOM
18824         d_sprintf_returns_strlen="$define"
18825         ;;
18826         *) cat >&4 <<EOM
18827 sprintf does not return the length of the string (how old is this system?)
18828 EOM
18829         d_sprintf_returns_strlen="$undef"
18830         ;;
18831     esac
18832 else
18833     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18834     d_sprintf_returns_strlen="$undef"
18835 fi
18836 $rm_try
18837
18838 : see if srand48_r exists
18839 set srand48_r d_srand48_r
18840 eval $inlibc
18841 case "$d_srand48_r" in
18842 "$define")
18843         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18844         case "$d_srand48_r_proto:$usethreads" in
18845         ":define")      d_srand48_r_proto=define
18846                 set d_srand48_r_proto srand48_r $hdrs
18847                 eval $hasproto ;;
18848         *)      ;;
18849         esac
18850         case "$d_srand48_r_proto" in
18851         define)
18852         case "$srand48_r_proto" in
18853         ''|0) try='int srand48_r(long, struct drand48_data*);'
18854         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18855         esac
18856         case "$srand48_r_proto" in
18857         ''|0)   d_srand48_r=undef
18858                 srand48_r_proto=0
18859                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18860         * )     case "$srand48_r_proto" in
18861                 REENTRANT_PROTO*) ;;
18862                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18863                 esac
18864                 echo "Prototype: $try" ;;
18865         esac
18866         ;;
18867         *)      case "$usethreads" in
18868                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18869                 esac
18870                 d_srand48_r=undef
18871                 srand48_r_proto=0
18872                 ;;
18873         esac
18874         ;;
18875 *)      srand48_r_proto=0
18876         ;;
18877 esac
18878
18879 : see if srandom_r exists
18880 set srandom_r d_srandom_r
18881 eval $inlibc
18882 case "$d_srandom_r" in
18883 "$define")
18884         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18885         case "$d_srandom_r_proto:$usethreads" in
18886         ":define")      d_srandom_r_proto=define
18887                 set d_srandom_r_proto srandom_r $hdrs
18888                 eval $hasproto ;;
18889         *)      ;;
18890         esac
18891         case "$d_srandom_r_proto" in
18892         define)
18893         case "$srandom_r_proto" in
18894         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18895         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18896         esac
18897         case "$srandom_r_proto" in
18898         ''|0)   d_srandom_r=undef
18899                 srandom_r_proto=0
18900                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18901         * )     case "$srandom_r_proto" in
18902                 REENTRANT_PROTO*) ;;
18903                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18904                 esac
18905                 echo "Prototype: $try" ;;
18906         esac
18907         ;;
18908         *)      case "$usethreads" in
18909                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18910                 esac
18911                 d_srandom_r=undef
18912                 srandom_r_proto=0
18913                 ;;
18914         esac
18915         ;;
18916 *)      srandom_r_proto=0
18917         ;;
18918 esac
18919
18920 : see if prototype for setresgid is available
18921 echo " "
18922 set d_sresgproto setresgid $i_unistd unistd.h
18923 eval $hasproto
18924
18925 : see if prototype for setresuid is available
18926 echo " "
18927 set d_sresuproto setresuid $i_unistd unistd.h
18928 eval $hasproto
18929
18930 : see if sys/stat.h is available
18931 set sys/stat.h i_sysstat
18932 eval $inhdr
18933
18934 : see if stat knows about block sizes
18935 echo " "
18936 echo "Checking to see if your struct stat has st_blocks field..." >&4
18937 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18938 eval $hasfield
18939
18940 : see if this is a sys/vfs.h system
18941 set sys/vfs.h i_sysvfs
18942 eval $inhdr
18943
18944 : see if this is a sys/statfs.h system
18945 set sys/statfs.h i_sysstatfs
18946 eval $inhdr
18947
18948 : Check for statfs_s
18949 echo " "
18950 echo "Checking to see if your system supports struct statfs..." >&4
18951 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
18952 eval $hasstruct
18953 case "$d_statfs_s" in
18954 "$define")      echo "Yes, it does."   ;;
18955 *)              echo "No, it doesn't." ;;
18956 esac
18957
18958
18959 : see if struct statfs knows about f_flags
18960 case "$d_statfs_s" in
18961 define)
18962         echo " "
18963         echo "Checking to see if your struct statfs has f_flags field..." >&4
18964         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
18965         eval $hasfield
18966         ;;
18967 *)      val="$undef"
18968         set d_statfs_f_flags
18969         eval $setvar
18970         ;;
18971 esac
18972 case "$d_statfs_f_flags" in
18973 "$define")      echo "Yes, it does."   ;;
18974 *)              echo "No, it doesn't." ;;
18975 esac
18976
18977 : see what flavor, if any, of static inline is supported
18978 echo " "
18979 echo "Checking to see if your system supports static inline..."
18980 $cat > try.c <<'EOCP'
18981 #include <stdlib.h>
18982 extern int f_via_a(int x);
18983 extern int f_via_b(int x);
18984 int main(int argc, char **argv)
18985 {
18986     int y;
18987
18988     y = f_via_a(0);
18989 #ifdef USE_B
18990     y = f_via_b(0);
18991 #endif
18992     if (y == 42) {
18993         return EXIT_SUCCESS;
18994     }
18995     else {
18996         return EXIT_FAILURE;
18997     }
18998 }
18999 EOCP
19000 $cat > a.c <<'EOCP'
19001 static INLINE int f(int x) {
19002     int y;
19003     y = x + 42;
19004     return y;
19005 }
19006
19007 int f_via_a(int x)
19008 {
19009     return f(x);
19010 }
19011 EOCP
19012 $cat > b.c <<'EOCP'
19013 extern int f(int x);
19014
19015 int f_via_b(int x)
19016 {
19017     return f(x);
19018 }
19019 EOCP
19020
19021 # Respect a hint (or previous) value for perl_static_inline, if there is one.
19022 case "$perl_static_inline" in
19023 '')     # Check the various possibilities, and break out on success.
19024         # For gcc, prefer __inline__, which will still permit
19025         # cflags.SH to add in -ansi.
19026         case "$gccversion" in
19027                 '') xxx="inline __inline__ __inline _inline";;
19028                 *)  xxx="__inline__ inline __inline _inline";;
19029         esac
19030         for inline in $xxx; do
19031                 set try -DINLINE=$inline a.c
19032                 if eval $compile && $run ./try; then
19033                         # Now make sure there is no external linkage of static
19034                         # functions
19035                         set try -DINLINE=$inline -DUSE_B a.c b.c
19036                         if eval $compile && $run ./try; then
19037                                 $echo "Your compiler supports static $inline, " >&4
19038                                 $echo "but it also creates an external definition," >&4
19039                                 $echo "so I won't use it." >&4
19040                                 val=$undef
19041                         else
19042                                 $echo "Your compiler supports static $inline." >&4
19043                                 val=$define
19044                                 perl_static_inline="static $inline";
19045                                 break;
19046                         fi
19047                 else
19048                         $echo "Your compiler does NOT support static $inline." >&4
19049                         val="$undef"
19050                 fi
19051         done
19052         ;;
19053 *inline*) # Some variant of inline exists.
19054         echo "Keeping your $hint value of $perl_static_inline."
19055         val=$define
19056         ;;
19057 static)  # No inline capabilities
19058         echo "Keeping your $hint value of $perl_static_inline."
19059         val=$undef
19060         ;;
19061 *)  # Unrecognized previous value -- blindly trust the supplied
19062         # value and hope it makes sense.  Use old value for
19063         # d_static_inline, if there is one.
19064         echo "Keeping your $hint value of $perl_static_inline."
19065         case "$d_static_inline" in
19066                 '') val=$define ;;
19067                 *)  val=$d_static_inline ;;
19068         esac
19069         ;;
19070 esac
19071 # Fallback to plain 'static' if nothing worked.
19072 case "$perl_static_inline" in
19073 '')
19074         perl_static_inline="static"
19075         val=$undef
19076         ;;
19077 esac
19078 set d_static_inline
19079 eval $setvar
19080 $rm -f a.[co] b.[co]
19081 $rm_try
19082
19083 : Check stream access
19084 $cat >&4 <<EOM
19085 Checking how to access stdio streams by file descriptor number...
19086 EOM
19087 case "$stdio_stream_array" in
19088 '')     $cat >try.c <<EOCP
19089 #include <stdio.h>
19090 int main() {
19091   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
19092     printf("yes\n");
19093 }
19094 EOCP
19095         for s in _iob __iob __sF
19096         do
19097                 set try -DSTDIO_STREAM_ARRAY=$s
19098                 if eval $compile; then
19099                         case "`$run ./try`" in
19100                         yes)    stdio_stream_array=$s; break ;;
19101                         esac
19102                 fi
19103         done
19104         $rm_try
19105 esac
19106 case "$stdio_stream_array" in
19107 '')     $cat >&4 <<EOM
19108 I can't figure out how to access stdio streams by file descriptor number.
19109 EOM
19110         d_stdio_stream_array="$undef"
19111         ;;
19112 *)      $cat >&4 <<EOM
19113 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
19114 EOM
19115         d_stdio_stream_array="$define"
19116         ;;
19117 esac
19118
19119 : see if strcoll exists
19120 set strcoll d_strcoll
19121 eval $inlibc
19122
19123 : check for structure copying
19124 echo " "
19125 echo "Checking to see if your C compiler can copy structs..." >&4
19126 $cat >try.c <<'EOCP'
19127 int main()
19128 {
19129         struct blurfl {
19130                 int dyick;
19131         } foo, bar;
19132
19133         foo = bar;
19134 }
19135 EOCP
19136 if $cc -c try.c >/dev/null 2>&1 ; then
19137         val="$define"
19138         echo "Yup, it can."
19139 else
19140         val="$undef"
19141         echo "Nope, it can't."
19142 fi
19143 set d_strctcpy
19144 eval $setvar
19145 $rm_try
19146
19147 : see if strerror and/or sys_errlist[] exist
19148 echo " "
19149 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
19150     if set strerror val -f d_strerror; eval $csym; $val; then
19151                 echo 'strerror() found.' >&4
19152                 d_strerror="$define"
19153                 d_strerrm='strerror(e)'
19154                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19155                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
19156                         d_syserrlst="$define"
19157                 else
19158                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
19159                         d_syserrlst="$undef"
19160                 fi
19161     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
19162                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
19163                 echo 'strerror() found in string header.' >&4
19164                 d_strerror="$define"
19165                 d_strerrm='strerror(e)'
19166                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19167                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
19168                                 d_syserrlst="$define"
19169                 else
19170                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
19171                         d_syserrlst="$undef"
19172                 fi
19173     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
19174                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
19175                 d_strerror="$undef"
19176                 d_syserrlst="$define"
19177                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
19178     else
19179                 echo 'strerror() and sys_errlist[] NOT found.' >&4
19180                 d_strerror="$undef"
19181                 d_syserrlst="$undef"
19182                 d_strerrm='"unknown"'
19183     fi
19184 fi
19185
19186 : see if strerror_r exists
19187 set strerror_r d_strerror_r
19188 eval $inlibc
19189 case "$d_strerror_r" in
19190 "$define")
19191         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
19192         case "$d_strerror_r_proto:$usethreads" in
19193         ":define")      d_strerror_r_proto=define
19194                 set d_strerror_r_proto strerror_r $hdrs
19195                 eval $hasproto ;;
19196         *)      ;;
19197         esac
19198         case "$d_strerror_r_proto" in
19199         define)
19200         case "$strerror_r_proto" in
19201         ''|0) try='int strerror_r(int, char*, size_t);'
19202         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
19203         esac
19204         case "$strerror_r_proto" in
19205         ''|0) try='int strerror_r(int, char*, int);'
19206         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
19207         esac
19208         case "$strerror_r_proto" in
19209         ''|0) try='char* strerror_r(int, char*, size_t);'
19210         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
19211         esac
19212         case "$strerror_r_proto" in
19213         ''|0)   d_strerror_r=undef
19214                 strerror_r_proto=0
19215                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
19216         * )     case "$strerror_r_proto" in
19217                 REENTRANT_PROTO*) ;;
19218                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
19219                 esac
19220                 echo "Prototype: $try" ;;
19221         esac
19222         ;;
19223         *)      case "$usethreads" in
19224                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
19225                 esac
19226                 d_strerror_r=undef
19227                 strerror_r_proto=0
19228                 ;;
19229         esac
19230         ;;
19231 *)      strerror_r_proto=0
19232         ;;
19233 esac
19234
19235 : see if strftime exists
19236 set strftime d_strftime
19237 eval $inlibc
19238
19239 : see if strlcat exists
19240 set strlcat d_strlcat
19241 eval $inlibc
19242
19243 : see if strlcpy exists
19244 set strlcpy d_strlcpy
19245 eval $inlibc
19246
19247 : see if strtod exists
19248 set strtod d_strtod
19249 eval $inlibc
19250
19251 : see if strtol exists
19252 set strtol d_strtol
19253 eval $inlibc
19254
19255 : see if strtold exists
19256 set strtold d_strtold
19257 eval $inlibc
19258
19259 : see if strtoll exists
19260 set strtoll d_strtoll
19261 eval $inlibc
19262
19263 case "$d_longlong-$d_strtoll" in
19264 "$define-$define")
19265         $cat <<EOM
19266 Checking whether your strtoll() works okay...
19267 EOM
19268         $cat >try.c <<'EOCP'
19269 #include <errno.h>
19270 #ifdef __hpux
19271 #define strtoll __strtoll
19272 #endif
19273 #ifdef __EMX__
19274 #define strtoll _strtoll
19275 #endif
19276 #include <stdio.h>
19277 extern long long int strtoll(char *s, char **, int);
19278 static int bad = 0;
19279 int check(char *s, long long ell, int een) {
19280         long long gll;
19281         errno = 0;
19282         gll = strtoll(s, 0, 10);
19283         if (!((gll == ell) && (errno == een)))
19284                 bad++;
19285 }
19286 int main() {
19287         check(" 1",                                      1LL, 0);
19288         check(" 0",                                      0LL, 0);
19289         check("-1",                                     -1LL, 0);
19290         check("-9223372036854775808", -9223372036854775808LL, 0);
19291         check("-9223372036854775808", -9223372036854775808LL, 0);
19292         check(" 9223372036854775807",  9223372036854775807LL, 0);
19293         check("-9223372036854775808", -9223372036854775808LL, 0);
19294         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19295         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19296         if (!bad)
19297                 printf("ok\n");
19298 }
19299 EOCP
19300         set try
19301         if eval $compile; then
19302                 yyy=`$run ./try`
19303                 case "$yyy" in
19304                 ok) echo "Your strtoll() seems to be working okay." ;;
19305                 *) cat <<EOM >&4
19306 Your strtoll() doesn't seem to be working okay.
19307 EOM
19308                    d_strtoll="$undef"
19309                    ;;
19310                 esac
19311         else
19312                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19313                 d_strtoll="$undef"
19314         fi
19315         ;;
19316 esac
19317
19318 : see if strtoq exists
19319 set strtoq d_strtoq
19320 eval $inlibc
19321
19322 : see if strtoul exists
19323 set strtoul d_strtoul
19324 eval $inlibc
19325
19326 case "$d_strtoul" in
19327 "$define")
19328         $cat <<EOM
19329 Checking whether your strtoul() works okay...
19330 EOM
19331         $cat >try.c <<'EOCP'
19332 #include <errno.h>
19333 #include <stdio.h>
19334 extern unsigned long int strtoul(char *s, char **, int);
19335 static int bad = 0;
19336 void check(char *s, unsigned long eul, int een) {
19337         unsigned long gul;
19338         errno = 0;
19339         gul = strtoul(s, 0, 10);
19340         if (!((gul == eul) && (errno == een)))
19341                 bad++;
19342 }
19343 int main() {
19344         check(" 1", 1L, 0);
19345         check(" 0", 0L, 0);
19346 EOCP
19347         case "$longsize" in
19348         8)
19349             $cat >>try.c <<'EOCP'
19350         check("18446744073709551615", 18446744073709551615UL, 0);
19351         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19352 #if 0 /* strtoul() for /^-/ strings is undefined. */
19353         check("-1", 18446744073709551615UL, 0);
19354         check("-18446744073709551614", 2, 0);
19355         check("-18446744073709551615", 1, 0);
19356         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19357         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19358 #endif
19359 EOCP
19360                 ;;
19361         4)
19362                     $cat >>try.c <<'EOCP'
19363         check("4294967295", 4294967295UL, 0);
19364         check("4294967296", 4294967295UL, ERANGE);
19365 #if 0 /* strtoul() for /^-/ strings is undefined. */
19366         check("-1", 4294967295UL, 0);
19367         check("-4294967294", 2, 0);
19368         check("-4294967295", 1, 0);
19369         check("-4294967296", 4294967295UL, ERANGE);
19370         check("-4294967297", 4294967295UL, ERANGE);
19371 #endif
19372 EOCP
19373                 ;;
19374         *)
19375 : Should we write these tests to be more portable by sprintf-ing
19376 : ~0 and then manipulating that char string as input for strtol?
19377                 ;;
19378         esac
19379         $cat >>try.c <<'EOCP'
19380         if (!bad)
19381                 printf("ok\n");
19382         return 0;
19383 }
19384 EOCP
19385         set try
19386         if eval $compile; then
19387                 case "`$run ./try`" in
19388                 ok) echo "Your strtoul() seems to be working okay." ;;
19389                 *) cat <<EOM >&4
19390 Your strtoul() doesn't seem to be working okay.
19391 EOM
19392                    d_strtoul="$undef"
19393                    ;;
19394                 esac
19395         else
19396                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19397                 d_strtoul="$undef"
19398         fi
19399         ;;
19400 esac
19401
19402 : see if strtoull exists
19403 set strtoull d_strtoull
19404 eval $inlibc
19405
19406 case "$d_longlong-$d_strtoull" in
19407 "$define-$define")
19408         $cat <<EOM
19409 Checking whether your strtoull() works okay...
19410 EOM
19411         $cat >try.c <<'EOCP'
19412 #include <errno.h>
19413 #ifdef __hpux
19414 #define strtoull __strtoull
19415 #endif
19416 #include <stdio.h>
19417 extern unsigned long long int strtoull(char *s, char **, int);
19418 static int bad = 0;
19419 int check(char *s, long long eull, int een) {
19420         long long gull;
19421         errno = 0;
19422         gull = strtoull(s, 0, 10);
19423         if (!((gull == eull) && (errno == een)))
19424                 bad++;
19425 }
19426 int main() {
19427         check(" 1",                                        1LL, 0);
19428         check(" 0",                                        0LL, 0);
19429         check("18446744073709551615",  18446744073709551615ULL, 0);
19430         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19431 #if 0 /* strtoull() for /^-/ strings is undefined. */
19432         check("-1",                    18446744073709551615ULL, 0);
19433         check("-18446744073709551614",                     2LL, 0);
19434         check("-18446744073709551615",                     1LL, 0);
19435         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19436         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19437 #endif
19438         if (!bad)
19439                 printf("ok\n");
19440 }
19441 EOCP
19442         set try
19443         if eval $compile; then
19444                 case "`$run ./try`" in
19445                 ok) echo "Your strtoull() seems to be working okay." ;;
19446                 *) cat <<EOM >&4
19447 Your strtoull() doesn't seem to be working okay.
19448 EOM
19449                    d_strtoull="$undef"
19450                    ;;
19451                 esac
19452         else
19453                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19454                 d_strtoull="$undef"
19455         fi
19456         ;;
19457 esac
19458
19459 : see if strtouq exists
19460 set strtouq d_strtouq
19461 eval $inlibc
19462
19463 case "$d_strtouq" in
19464 "$define")
19465         $cat <<EOM
19466 Checking whether your strtouq() works okay...
19467 EOM
19468         $cat >try.c <<'EOCP'
19469 #include <errno.h>
19470 #include <stdio.h>
19471 extern unsigned long long int strtouq(char *s, char **, int);
19472 static int bad = 0;
19473 void check(char *s, unsigned long long eull, int een) {
19474         unsigned long long gull;
19475         errno = 0;
19476         gull = strtouq(s, 0, 10);
19477         if (!((gull == eull) && (errno == een)))
19478                 bad++;
19479 }
19480 int main() {
19481         check(" 1",                                        1LL, 0);
19482         check(" 0",                                        0LL, 0);
19483         check("18446744073709551615",  18446744073709551615ULL, 0);
19484         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19485 #if 0 /* strtouq() for /^-/ strings is undefined. */
19486         check("-1",                    18446744073709551615ULL, 0);
19487         check("-18446744073709551614",                     2LL, 0);
19488         check("-18446744073709551615",                     1LL, 0);
19489         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19490         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19491 #endif
19492         if (!bad)
19493                 printf("ok\n");
19494         return 0;
19495 }
19496 EOCP
19497         set try
19498         if eval $compile; then
19499                 case "`$run ./try`" in
19500                 ok) echo "Your strtouq() seems to be working okay." ;;
19501                 *) cat <<EOM >&4
19502 Your strtouq() doesn't seem to be working okay.
19503 EOM
19504                    d_strtouq="$undef"
19505                    ;;
19506                 esac
19507         else
19508                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19509                 d_strtouq="$undef"
19510         fi
19511         ;;
19512 esac
19513
19514 : see if strxfrm exists
19515 set strxfrm d_strxfrm
19516 eval $inlibc
19517
19518 : see if symlink exists
19519 set symlink d_symlink
19520 eval $inlibc
19521
19522 : see if syscall exists
19523 set syscall d_syscall
19524 eval $inlibc
19525
19526 : see if prototype for syscall is available
19527 echo " "
19528 set d_syscallproto syscall $i_unistd unistd.h
19529 eval $hasproto
19530
19531 : see if sysconf exists
19532 set sysconf d_sysconf
19533 eval $inlibc
19534
19535 : see if system exists
19536 set system d_system
19537 eval $inlibc
19538
19539 : see if tcgetpgrp exists
19540 set tcgetpgrp d_tcgetpgrp
19541 eval $inlibc
19542
19543 : see if tcsetpgrp exists
19544 set tcsetpgrp d_tcsetpgrp
19545 eval $inlibc
19546
19547 : see if prototype for telldir is available
19548 echo " "
19549 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19550 eval $hasproto
19551
19552 : see if time exists
19553 echo " "
19554 if test "X$d_time" = X -o X"$timetype" = X; then
19555     if set time val -f d_time; eval $csym; $val; then
19556                 echo 'time() found.' >&4
19557                 val="$define"
19558                 rp="What is the type returned by time() on this system?"
19559                 set time_t timetype long stdio.h sys/types.h
19560                 eval $typedef_ask
19561     else
19562                 echo 'time() not found, hope that will do.' >&4
19563                 val="$undef"
19564                 timetype='int';
19565     fi
19566     set d_time
19567     eval $setvar
19568 fi
19569
19570 : see if timegm exists
19571 set timegm d_timegm
19572 eval $inlibc
19573
19574 : see if this is a sys/times.h system
19575 set sys/times.h i_systimes
19576 eval $inhdr
19577
19578 : see if times exists
19579 echo " "
19580 if set times val -f d_times; eval $csym; $val; then
19581         echo 'times() found.' >&4
19582         d_times="$define"
19583         inc=''
19584         case "$i_systimes" in
19585         "$define") inc='sys/times.h';;
19586         esac
19587         rp="What is the type returned by times() on this system?"
19588         set clock_t clocktype long stdio.h sys/types.h $inc
19589         eval $typedef_ask
19590 else
19591         echo 'times() NOT found, hope that will do.' >&4
19592         d_times="$undef"
19593         clocktype='int'
19594 fi
19595
19596 : see if tmpnam_r exists
19597 set tmpnam_r d_tmpnam_r
19598 eval $inlibc
19599 case "$d_tmpnam_r" in
19600 "$define")
19601         hdrs="$i_systypes sys/types.h define stdio.h "
19602         case "$d_tmpnam_r_proto:$usethreads" in
19603         ":define")      d_tmpnam_r_proto=define
19604                 set d_tmpnam_r_proto tmpnam_r $hdrs
19605                 eval $hasproto ;;
19606         *)      ;;
19607         esac
19608         case "$d_tmpnam_r_proto" in
19609         define)
19610         case "$tmpnam_r_proto" in
19611         ''|0) try='char* tmpnam_r(char*);'
19612         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19613         esac
19614         case "$tmpnam_r_proto" in
19615         ''|0)   d_tmpnam_r=undef
19616                 tmpnam_r_proto=0
19617                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19618         * )     case "$tmpnam_r_proto" in
19619                 REENTRANT_PROTO*) ;;
19620                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19621                 esac
19622                 echo "Prototype: $try" ;;
19623         esac
19624         ;;
19625         *)      case "$usethreads" in
19626                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19627                 esac
19628                 d_tmpnam_r=undef
19629                 tmpnam_r_proto=0
19630                 ;;
19631         esac
19632         ;;
19633 *)      tmpnam_r_proto=0
19634         ;;
19635 esac
19636
19637 : see if truncate exists
19638 set truncate d_truncate
19639 eval $inlibc
19640
19641 : see if ttyname_r exists
19642 set ttyname_r d_ttyname_r
19643 eval $inlibc
19644 case "$d_ttyname_r" in
19645 "$define")
19646         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19647         case "$d_ttyname_r_proto:$usethreads" in
19648         ":define")      d_ttyname_r_proto=define
19649                 set d_ttyname_r_proto ttyname_r $hdrs
19650                 eval $hasproto ;;
19651         *)      ;;
19652         esac
19653         case "$d_ttyname_r_proto" in
19654         define)
19655         case "$ttyname_r_proto" in
19656         ''|0) try='int ttyname_r(int, char*, size_t);'
19657         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19658         esac
19659         case "$ttyname_r_proto" in
19660         ''|0) try='int ttyname_r(int, char*, int);'
19661         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19662         esac
19663         case "$ttyname_r_proto" in
19664         ''|0) try='char* ttyname_r(int, char*, int);'
19665         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19666         esac
19667         case "$ttyname_r_proto" in
19668         ''|0)   d_ttyname_r=undef
19669                 ttyname_r_proto=0
19670                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19671         * )     case "$ttyname_r_proto" in
19672                 REENTRANT_PROTO*) ;;
19673                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19674                 esac
19675                 echo "Prototype: $try" ;;
19676         esac
19677         ;;
19678         *)      case "$usethreads" in
19679                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19680                 esac
19681                 d_ttyname_r=undef
19682                 ttyname_r_proto=0
19683                 ;;
19684         esac
19685         ;;
19686 *)      ttyname_r_proto=0
19687         ;;
19688 esac
19689
19690 : see if tzname[] exists
19691 echo " "
19692 if set tzname val -a d_tzname; eval $csym; $val; then
19693         val="$define"
19694         echo 'tzname[] found.' >&4
19695 else
19696         val="$undef"
19697         echo 'tzname[] NOT found.' >&4
19698 fi
19699 set d_tzname
19700 eval $setvar
19701
19702 : Check if is a multiplatform env
19703 case "$osname" in
19704 darwin) multiarch="$define" ;;
19705 esac
19706 case "$multiarch" in
19707 ''|[nN]*) multiarch="$undef" ;;
19708 esac
19709
19710 : check for ordering of bytes in a UV
19711 echo " "
19712 case "$multiarch" in
19713 *$define*)
19714         $cat <<EOM
19715 You seem to be doing a multiarchitecture build,
19716 skipping the byteorder check.
19717
19718 EOM
19719         byteorder='ffff'
19720         ;;
19721 *)
19722         case "$byteorder" in
19723         '')
19724                 $cat <<'EOM'
19725 In the following, larger digits indicate more significance.  A big-endian
19726 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19727 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19728 machines may have weird orders like 3412.  A Cray will report 87654321,
19729 an Alpha will report 12345678. If the test program works the default is
19730 probably right.
19731 I'm now running the test program...
19732 EOM
19733                 $cat >try.c <<EOCP
19734 #include <stdio.h>
19735 #$i_stdlib I_STDLIB
19736 #ifdef I_STDLIB
19737 #include <stdlib.h>
19738 #endif
19739 #include <sys/types.h>
19740 typedef $uvtype UV;
19741 int main()
19742 {
19743         int i;
19744         union {
19745                 UV l;
19746                 char c[$uvsize];
19747         } u;
19748
19749         if ($uvsize > 4)
19750                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19751         else
19752                 u.l = (UV)0x04030201;
19753         for (i = 0; i < $uvsize; i++)
19754                 printf("%c", u.c[i]+'0');
19755         printf("\n");
19756         exit(0);
19757 }
19758 EOCP
19759                 xxx_prompt=y
19760                 set try
19761                 if eval $compile && $run ./try > /dev/null; then
19762                         dflt=`$run ./try`
19763                         case "$dflt" in
19764                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19765                                 echo "(The test program ran ok.)"
19766                                 echo "byteorder=$dflt"
19767                                 xxx_prompt=n
19768                         ;;
19769                         ????|????????) echo "(The test program ran ok.)" ;;
19770                         *) echo "(The test program didn't run right for some reason.)" ;;
19771                         esac
19772                 else
19773                         dflt='4321'
19774                         cat <<'EOM'
19775 (I can't seem to compile the test program.  Guessing big-endian...)
19776 EOM
19777                 fi
19778                 case "$xxx_prompt" in
19779                 y)
19780                         rp="What is the order of bytes in $uvtype?"
19781                         . ./myread
19782                         byteorder="$ans"
19783                         ;;
19784                 *)      byteorder=$dflt
19785                         ;;
19786                 esac
19787                 ;;
19788         esac
19789         $rm_try
19790         ;;
19791 esac
19792
19793 : Checking 32bit alignedness
19794 $cat <<EOM
19795
19796 Checking to see whether you can access character data unalignedly...
19797 EOM
19798 case "$d_u32align" in
19799 '')   $cat >try.c <<EOCP
19800 #include <stdio.h>
19801 #$i_stdlib I_STDLIB
19802 #ifdef I_STDLIB
19803 #include <stdlib.h>
19804 #endif
19805 #define U32 $u32type
19806 #define BYTEORDER 0x$byteorder
19807 #define U8 $u8type
19808 #include <signal.h>
19809 #ifdef SIGBUS
19810 $signal_t bletch(int s) { exit(4); }
19811 #endif
19812 int main() {
19813 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19814     volatile U8 buf[8];
19815     volatile U32 *up;
19816     int i;
19817
19818     if (sizeof(U32) != 4) {
19819         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19820         exit(1);
19821     }
19822
19823     fflush(stdout);
19824
19825 #ifdef SIGBUS
19826     signal(SIGBUS, bletch);
19827 #endif
19828
19829     buf[0] = 0;
19830     buf[1] = 0;
19831     buf[2] = 0;
19832     buf[3] = 1;
19833     buf[4] = 0;
19834     buf[5] = 0;
19835     buf[6] = 0;
19836     buf[7] = 1;
19837
19838     for (i = 0; i < 4; i++) {
19839         up = (U32*)(buf + i);
19840         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19841                (*up == 1 << (8*(3-i)))  /* little-endian */
19842               )
19843            )
19844         {
19845             printf("read failed (%x)\n", *up);
19846             exit(2);
19847         }
19848     }
19849
19850     /* write test */
19851     for (i = 0; i < 4; i++) {
19852         up = (U32*)(buf + i);
19853         *up = 0xBeef;
19854         if (*up != 0xBeef) {
19855             printf("write failed (%x)\n", *up);
19856             exit(3);
19857         }
19858     }
19859
19860     exit(0);
19861 #else
19862     printf("1\n");
19863     exit(1);
19864 #endif
19865     return 0;
19866 }
19867 EOCP
19868 set try
19869 if eval $compile_ok; then
19870         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19871         $run ./try 2>&1 >/dev/null
19872         case "$?" in
19873         0)      cat >&4 <<EOM
19874 You can access character data pretty unalignedly.
19875 EOM
19876                 d_u32align="$undef"
19877                 ;;
19878         *)      cat >&4 <<EOM
19879 It seems that you must access character data in an aligned manner.
19880 EOM
19881                 d_u32align="$define"
19882                 ;;
19883         esac
19884 else
19885         rp='Can you access character data at unaligned addresses?'
19886         dflt='n'
19887         . ./myread
19888         case "$ans" in
19889         [yY]*)  d_u32align="$undef"  ;;
19890         *)      d_u32align="$define" ;;
19891         esac
19892 fi
19893 $rm_try
19894 ;;
19895 esac
19896
19897 : see if ualarm exists
19898 set ualarm d_ualarm
19899 eval $inlibc
19900
19901 : see if umask exists
19902 set umask d_umask
19903 eval $inlibc
19904
19905 : see if unordered exists
19906 set unordered d_unordered
19907 eval $inlibc
19908
19909 : see if unsetenv exists
19910 set unsetenv d_unsetenv
19911 eval $inlibc
19912
19913 : see if usleep exists
19914 set usleep d_usleep
19915 eval $inlibc
19916
19917 : see if prototype for usleep is available
19918 echo " "
19919 set d_usleepproto usleep $i_unistd unistd.h
19920 eval $hasproto
19921
19922 : see if ustat exists
19923 set ustat d_ustat
19924 eval $inlibc
19925
19926 : see if closedir exists
19927 set closedir d_closedir
19928 eval $inlibc
19929
19930 case "$d_closedir" in
19931 "$define")
19932         echo " "
19933         echo "Checking whether closedir() returns a status..." >&4
19934         cat > try.c <<EOM
19935 #$i_dirent I_DIRENT             /**/
19936 #$i_sysdir I_SYS_DIR            /**/
19937 #$i_sysndir I_SYS_NDIR          /**/
19938 #$i_systypes I_SYS_TYPES        /**/
19939
19940 #if defined(I_SYS_TYPES)
19941 #include <sys/types.h>
19942 #endif
19943 #if defined(I_DIRENT)
19944 #include <dirent.h>
19945 #else
19946 #ifdef I_SYS_NDIR
19947 #include <sys/ndir.h>
19948 #else
19949 #ifdef I_SYS_DIR
19950 #ifdef hp9000s500
19951 #include <ndir.h>       /* may be wrong in the future */
19952 #else
19953 #include <sys/dir.h>
19954 #endif
19955 #endif
19956 #endif
19957 #endif
19958 int main() { return closedir(opendir(".")); }
19959 EOM
19960         set try
19961         if eval $compile_ok; then
19962                 if $run ./try > /dev/null 2>&1 ; then
19963                         echo "Yes, it does."
19964                         val="$undef"
19965                 else
19966                         echo "No, it doesn't."
19967                         val="$define"
19968                 fi
19969         else
19970                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19971                 val="$define"
19972         fi
19973         ;;
19974 *)
19975         val="$undef";
19976         ;;
19977 esac
19978 set d_void_closedir
19979 eval $setvar
19980 $rm_try
19981
19982 : see if there is a wait4
19983 set wait4 d_wait4
19984 eval $inlibc
19985
19986 : see if waitpid exists
19987 set waitpid d_waitpid
19988 eval $inlibc
19989
19990 : look for wcscmp
19991 echo " "
19992 $cat >try.c <<'EOCP'
19993 #include <stdio.h>
19994 #include <wchar.h>
19995 int main ()
19996 {
19997     wchar_t *s = L" ";
19998     return (wcscmp (s, s) ? 1 : 0);
19999     }
20000 EOCP
20001 set try
20002 val="$undef"
20003 if eval $compile; then
20004     `$run ./try`
20005     case "$?" in
20006         0)  echo "A working wcscmp() found." >&4
20007             val="$define" ;;
20008         *)  echo "wcscmp() found, but it doesn't work" >&4
20009             ;;
20010         esac
20011 else
20012     echo "wcscmp() NOT found." >&4
20013     fi
20014 set d_wcscmp
20015 eval $setvar
20016 $rm_try
20017
20018 : see if wcstombs exists
20019 set wcstombs d_wcstombs
20020 eval $inlibc
20021
20022 : look for wcsxfrm
20023 echo " "
20024 $cat >try.c <<'EOCP'
20025 #include <errno.h>
20026 #include <wchar.h>
20027 int main ()
20028 {
20029     wchar_t dst[4], *src = L" ";
20030     errno = 0;
20031     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
20032     }
20033 EOCP
20034 set try
20035 val="$undef"
20036 if eval $compile; then
20037     `$run ./try`
20038     case "$?" in
20039         0)  echo "A working wcsxfrm() found." >&4
20040             val="$define" ;;
20041         *)  echo "wcsxfrm() found, but it doesn't work" >&4
20042             ;;
20043         esac
20044 else
20045     echo "wcsxfrm() NOT found." >&4
20046     fi
20047 set d_wcsxfrm
20048 eval $setvar
20049 $rm_try
20050
20051 : see if wctomb exists
20052 set wctomb d_wctomb
20053 eval $inlibc
20054
20055 : see if writev exists
20056 set writev d_writev
20057 eval $inlibc
20058
20059 : check for alignment requirements
20060 echo " "
20061 case "$alignbytes" in
20062     '') echo "Checking alignment constraints..." >&4
20063         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
20064             $cat >try.c <<'EOCP'
20065 typedef long double NV;
20066 EOCP
20067         else
20068             $cat >try.c <<'EOCP'
20069 typedef double NV;
20070 EOCP
20071         fi
20072         $cat >>try.c <<'EOCP'
20073 #include <stdio.h>
20074 struct foobar {
20075     char foo;
20076     NV bar;
20077 } try_algn;
20078 int main()
20079 {
20080     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
20081     return(0);
20082 }
20083 EOCP
20084         set try
20085         if eval $compile_ok; then
20086             dflt=`$run ./try`
20087         else
20088             dflt='8'
20089             echo "(I can't seem to compile the test program...)"
20090         fi
20091         case "$multiarch" in
20092             *$define*)
20093                 : The usual safe value is 8, but Darwin with -Duselongdouble
20094                 : needs 16.  Hence, we will take 8 as a minimum, but allow
20095                 : Configure to pick a larger value if needed.
20096                 if $test "$dflt" -lt 8; then
20097                     dflt='8'
20098                     echo "Setting alignment to 8 for multiarch support.">&4
20099                 fi
20100                 ;;
20101         esac
20102         ;;
20103     *) dflt="$alignbytes"
20104         ;;
20105 esac
20106 rp="Doubles must be aligned on a how-many-byte boundary?"
20107 . ./myread
20108 alignbytes="$ans"
20109 $rm_try
20110
20111 : set the base revision
20112 baserev=5.0
20113
20114 : length of character in bytes. Is always 1, otherwise it is not C
20115 : This used to be a test using sizeof
20116 charsize=1
20117
20118 : Check for the number of bits in a character
20119 case "$charbits" in
20120 '')     echo "Checking how long a character is (in bits)..." >&4
20121         $cat >try.c <<EOCP
20122 #include <stdio.h>
20123 int main ()
20124 {
20125     int n;
20126     unsigned char c;
20127     for (c = 1, n = 0; c; c <<= 1, n++) ;
20128     printf ("%d\n", n);
20129     return (0);
20130     }
20131 EOCP
20132         set try
20133         if eval $compile_ok; then
20134                 dflt=`$run ./try`
20135         else
20136                 dflt='8'
20137                 echo "(I can't seem to compile the test program.  Guessing...)"
20138         fi
20139         ;;
20140 *)
20141         dflt="$charbits"
20142         ;;
20143 esac
20144 rp="What is the length of a character (in bits)?"
20145 . ./myread
20146 charbits="$ans"
20147 $rm_try
20148 case "$charbits" in
20149 8)      ;;
20150 *)      cat >&4 << EOM
20151 Your system has an unsigned character size of $charbits bits, which
20152 is rather unusual (normally it is 8 bits).  Perl likely will not work
20153 correctly on your system, with subtle bugs in various places.
20154 EOM
20155         rp='Do you really want to continue?'
20156         dflt='n'
20157         . ./myread
20158         case "$ans" in
20159                 [yY])   echo >&4 "Okay, continuing."    ;;
20160                 *)      exit 1                          ;;
20161         esac
20162 esac
20163
20164 : how do we concatenate cpp tokens here?
20165 echo " "
20166 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
20167 $cat >cpp_stuff.c <<'EOCP'
20168 #define RCAT(a,b)a/**/b
20169 #define ACAT(a,b)a ## b
20170 RCAT(Rei,ser)
20171 ACAT(Cir,cus)
20172 EOCP
20173 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
20174 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
20175         echo "Oh!  Smells like ANSI's been here." >&4
20176         echo "We can catify or stringify, separately or together!"
20177         cpp_stuff=42
20178 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
20179         echo "Ah, yes!  The good old days!" >&4
20180         echo "However, in the good old days we don't know how to stringify and"
20181         echo "catify at the same time."
20182         cpp_stuff=1
20183 else
20184         $cat >&4 <<EOM
20185 Hmm, I don't seem to be able to concatenate tokens with your cpp.
20186 You're going to have to edit the values of CAT[2-5] in config.h...
20187 EOM
20188         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
20189 fi
20190 $rm -f cpp_stuff.*
20191
20192 : see if this is a db.h system
20193 set db.h i_db
20194 eval $inhdr
20195
20196 case "$i_db" in
20197 $define)
20198         : Check db version.
20199         echo " "
20200         echo "Checking Berkeley DB version ..." >&4
20201         $cat >try.c <<EOCP
20202 #$d_const HASCONST
20203 #ifndef HASCONST
20204 #define const
20205 #endif
20206 #include <sys/types.h>
20207 #include <stdio.h>
20208 #$i_stdlib I_STDLIB
20209 #ifdef I_STDLIB
20210 #include <stdlib.h>
20211 #endif
20212 #include <db.h>
20213 int main(int argc, char *argv[])
20214 {
20215 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
20216     int Major, Minor, Patch ;
20217     unsigned long Version ;
20218     (void)db_version(&Major, &Minor, &Patch) ;
20219     if (argc == 2) {
20220         printf("%d %d %d %d %d %d\n",
20221                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
20222                Major, Minor, Patch);
20223         exit(0);
20224     }
20225     printf("You have Berkeley DB Version 2 or greater.\n");
20226
20227     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
20228                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
20229     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
20230                 Major, Minor, Patch) ;
20231
20232     /* check that db.h & libdb are compatible */
20233     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
20234         printf("db.h and libdb are incompatible.\n") ;
20235         exit(3);
20236     }
20237
20238     printf("db.h and libdb are compatible.\n") ;
20239
20240     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
20241                 + DB_VERSION_PATCH ;
20242
20243     /* needs to be >= 2.3.4 */
20244     if (Version < 2003004) {
20245     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20246         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20247         exit(2);
20248     }
20249
20250     exit(0);
20251 #else
20252 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20253     if (argc == 2) {
20254         printf("1 0 0\n");
20255         exit(0);
20256     }
20257     printf("You have Berkeley DB Version 1.\n");
20258     exit(0);    /* DB version < 2: the coast is clear. */
20259 #else
20260     exit(1);    /* <db.h> not Berkeley DB? */
20261 #endif
20262 #endif
20263 }
20264 EOCP
20265         set try
20266         if eval $compile_ok && $run ./try; then
20267                 echo 'Looks OK.' >&4
20268                 set `$run ./try 1`
20269                 db_version_major=$1
20270                 db_version_minor=$2
20271                 db_version_patch=$3
20272         else
20273                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20274                 i_db=$undef
20275                 case " $libs " in
20276                 *"-ldb "*)
20277                         : Remove db from list of libraries to use
20278                         echo "Removing unusable -ldb from library list" >&4
20279                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20280                         shift
20281                         libs="$*"
20282                         echo "libs = $libs" >&4
20283                         ;;
20284                 esac
20285         fi
20286         $rm_try
20287         ;;
20288 esac
20289
20290 case "$i_db" in
20291 define)
20292         : Check the return type needed for hash
20293         echo " "
20294         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20295         $cat >try.c <<EOCP
20296 #$d_const HASCONST
20297 #ifndef HASCONST
20298 #define const
20299 #endif
20300 #include <sys/types.h>
20301 #include <db.h>
20302
20303 #ifndef DB_VERSION_MAJOR
20304 u_int32_t hash_cb (const void* ptr, size_t size)
20305 {
20306 }
20307 HASHINFO info;
20308 int main()
20309 {
20310         info.hash = hash_cb;
20311 }
20312 #endif
20313 EOCP
20314         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20315                 if $contains warning try.out >>/dev/null 2>&1 ; then
20316                         db_hashtype='int'
20317                 else
20318                         db_hashtype='u_int32_t'
20319                 fi
20320         else
20321                 : XXX Maybe we should just give up here.
20322                 db_hashtype=u_int32_t
20323                 $cat try.out >&4
20324                 echo "Help:  I can't seem to compile the db test program." >&4
20325                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20326         fi
20327         $rm_try
20328         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20329         ;;
20330 *)      db_hashtype=u_int32_t
20331         ;;
20332 esac
20333 case "$i_db" in
20334 define)
20335         : Check the return type needed for prefix
20336         echo " "
20337         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20338         cat >try.c <<EOCP
20339 #$d_const HASCONST
20340 #ifndef HASCONST
20341 #define const
20342 #endif
20343 #include <sys/types.h>
20344 #include <db.h>
20345
20346 #ifndef DB_VERSION_MAJOR
20347 size_t prefix_cb (const DBT *key1, const DBT *key2)
20348 {
20349 }
20350 BTREEINFO info;
20351 int main()
20352 {
20353         info.prefix = prefix_cb;
20354 }
20355 #endif
20356 EOCP
20357         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20358                 if $contains warning try.out >>/dev/null 2>&1 ; then
20359                         db_prefixtype='int'
20360                 else
20361                         db_prefixtype='size_t'
20362                 fi
20363         else
20364                 db_prefixtype='size_t'
20365                 : XXX Maybe we should just give up here.
20366                 $cat try.out >&4
20367                 echo "Help:  I can't seem to compile the db test program." >&4
20368                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20369         fi
20370         $rm_try
20371         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20372         ;;
20373 *)      db_prefixtype='size_t'
20374         ;;
20375 esac
20376
20377 : How can we generate normalized random numbers ?
20378 echo " "
20379 echo "Using our internal random number implementation..." >&4
20380
20381 case "$ccflags" in
20382 *-Dmy_rand=*|*-Dmy_srand=*)
20383         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20384         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20385         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20386         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20387         ;;
20388 esac
20389
20390 randfunc=Perl_drand48
20391 drand01="Perl_drand48()"
20392 seedfunc="Perl_drand48_init"
20393 randbits=48
20394 randseedtype=U32
20395
20396 : Determine if this is an EBCDIC system
20397 echo " "
20398 echo "Determining whether or not we are on an EBCDIC system..." >&4
20399 $cat >try.c <<'EOM'
20400 int main()
20401 {
20402   if ('M'==0xd4) return 0;
20403   return 1;
20404 }
20405 EOM
20406
20407 val=$undef
20408 set try
20409 if eval $compile_ok; then
20410         if $run ./try; then
20411                 echo "You seem to speak EBCDIC." >&4
20412                 val="$define"
20413         else
20414                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20415         fi
20416 else
20417         echo "I'm unable to compile the test program." >&4
20418         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20419 fi
20420 $rm_try
20421 set ebcdic
20422 eval $setvar
20423
20424 : Check how to flush
20425 echo " "
20426 $cat >&4 <<EOM
20427 Checking how to flush all pending stdio output...
20428 EOM
20429 # I only know how to find the first 32 possibly open files on SunOS.
20430 # See also hints/sunos_4_1.sh and util.c  --AD
20431 case "$osname" in
20432 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20433 esac
20434 $cat >>try.c <<EOCP
20435 #include <stdio.h>
20436 #$i_stdlib I_STDLIB
20437 #ifdef I_STDLIB
20438 #include <stdlib.h>
20439 #endif
20440 #$i_unistd I_UNISTD
20441 #ifdef I_UNISTD
20442 # include <unistd.h>
20443 #endif
20444 #$d_sysconf HAS_SYSCONF
20445 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20446 #ifdef HAS_STDIO_STREAM_ARRAY
20447 # define STDIO_STREAM_ARRAY $stdio_stream_array
20448 #endif
20449 int main() {
20450   FILE* p;
20451   unlink("try.out");
20452   p = fopen("try.out", "w");
20453 #ifdef TRY_FPUTC
20454   fputc('x', p);
20455 #else
20456 # ifdef TRY_FPRINTF
20457   fprintf(p, "x");
20458 # endif
20459 #endif
20460 #ifdef TRY_FFLUSH_NULL
20461   fflush(NULL);
20462 #endif
20463 #ifdef TRY_FFLUSH_ALL
20464   {
20465     long open_max = -1;
20466 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20467     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20468 # else
20469 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20470     open_max = sysconf(_SC_OPEN_MAX);
20471 #  else
20472 #   ifdef FOPEN_MAX
20473     open_max = FOPEN_MAX;
20474 #   else
20475 #    ifdef OPEN_MAX
20476     open_max = OPEN_MAX;
20477 #    else
20478 #     ifdef _NFILE
20479     open_max = _NFILE;
20480 #     endif
20481 #    endif
20482 #   endif
20483 #  endif
20484 # endif
20485 # ifdef HAS_STDIO_STREAM_ARRAY
20486     if (open_max > 0) {
20487       long i;
20488       for (i = 0; i < open_max; i++)
20489             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20490                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20491                 STDIO_STREAM_ARRAY[i]._flag)
20492                 fflush(&STDIO_STREAM_ARRAY[i]);
20493     }
20494   }
20495 # endif
20496 #endif
20497   _exit(42);
20498 }
20499 EOCP
20500 : first we have to find out how _not_ to flush
20501 $to try.c
20502 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20503     output=''
20504     set try -DTRY_FPUTC
20505     if eval $compile; then
20506             $run ./try 2>/dev/null
20507             code="$?"
20508             $from try.out
20509             if $test ! -s try.out -a "X$code" = X42; then
20510                 output=-DTRY_FPUTC
20511             fi
20512     fi
20513     case "$output" in
20514     '')
20515             set try -DTRY_FPRINTF
20516             if eval $compile; then
20517                     $run ./try 2>/dev/null
20518                     code="$?"
20519                     $from try.out
20520                     if $test ! -s try.out -a "X$code" = X42; then
20521                         output=-DTRY_FPRINTF
20522                     fi
20523             fi
20524         ;;
20525     esac
20526 fi
20527 : check for fflush NULL behavior
20528 case "$fflushNULL" in
20529 '')     set try -DTRY_FFLUSH_NULL $output
20530         if eval $compile; then
20531                 $run ./try 2>/dev/null
20532                 code="$?"
20533                 $from try.out
20534                 if $test -s try.out -a "X$code" = X42; then
20535                         fflushNULL="`$cat try.out`"
20536                 else
20537                         if $test "X$code" != X42; then
20538                                 $cat >&4 <<EOM
20539 (If this test failed, don't worry, we'll try another method shortly.)
20540 EOM
20541                         fi
20542                 fi
20543         fi
20544         $rm -f core try.core core.try.*
20545         case "$fflushNULL" in
20546         x)      $cat >&4 <<EOM
20547 Your fflush(NULL) works okay for output streams.
20548 Let's see if it clobbers input pipes...
20549 EOM
20550 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20551 # bug that improperly flushes the input end of pipes.  So we avoid the
20552 # autoflush on fork/system/exec support for now. :-(
20553 $cat >tryp.c <<EOCP
20554 #include <stdio.h>
20555 int
20556 main(int argc, char **argv)
20557 {
20558     char buf[1024];
20559     int i;
20560     char *bp = buf;
20561     while (1) {
20562         while ((i = getc(stdin)) != -1
20563                && (*bp++ = i) != '\n'
20564                && bp < &buf[1024])
20565         /* DO NOTHING */ ;
20566         *bp = '\0';
20567         fprintf(stdout, "%s", buf);
20568         fflush(NULL);
20569         if (i == -1)
20570             return 0;
20571         bp = buf;
20572     }
20573 }
20574 EOCP
20575                 fflushNULL="$define"
20576                 set tryp
20577                 if eval $compile; then
20578                     $rm -f tryp.out
20579                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20580                     if $test "X$targethost" != X; then
20581                         $to tryp.c
20582                         $to tryp
20583                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20584                     else
20585                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20586                     fi
20587                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20588                        $cat >&4 <<EOM
20589 fflush(NULL) seems to behave okay with input streams.
20590 EOM
20591                         fflushNULL="$define"
20592                     else
20593                         $cat >&4 <<EOM
20594 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20595 EOM
20596                         fflushNULL="$undef"
20597                     fi
20598                 fi
20599                 $rm -f core tryp.c tryp.core core.tryp.*
20600                 ;;
20601         '')     $cat >&4 <<EOM
20602 Your fflush(NULL) isn't working (contrary to ANSI C).
20603 EOM
20604                 fflushNULL="$undef"
20605                 ;;
20606         *)      $cat >&4 <<EOM
20607 Cannot figure out whether your fflush(NULL) works or not.
20608 I'm assuming it doesn't (contrary to ANSI C).
20609 EOM
20610                 fflushNULL="$undef"
20611                 ;;
20612         esac
20613         ;;
20614 $define|true|[yY]*)
20615         fflushNULL="$define"
20616         ;;
20617 *)
20618         fflushNULL="$undef"
20619         ;;
20620 esac
20621 : check explicit looping only if NULL did not work, and if the pipe
20622 : bug does not show up on an explicit flush too
20623 case "$fflushNULL" in
20624 "$undef")
20625         $cat >tryp.c <<EOCP
20626 #include <stdio.h>
20627 int
20628 main(int argc, char **argv)
20629 {
20630     char buf[1024];
20631     int i;
20632     char *bp = buf;
20633     while (1) {
20634         while ((i = getc(stdin)) != -1
20635                && (*bp++ = i) != '\n'
20636                && bp < &buf[1024])
20637         /* DO NOTHING */ ;
20638         *bp = '\0';
20639         fprintf(stdout, "%s", buf);
20640         fflush(stdin);
20641         if (i == -1)
20642             return 0;
20643         bp = buf;
20644     }
20645 }
20646 EOCP
20647         set tryp
20648         if eval $compile; then
20649             $rm -f tryp.out
20650             if $test "X$targethost" != X; then
20651                 $to tryp.c
20652                 $to tryp
20653                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20654             else
20655                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20656             fi
20657             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20658                $cat >&4 <<EOM
20659 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20660 EOM
20661                 : now check for fflushall behaviour
20662                 case "$fflushall" in
20663                 '')     set try -DTRY_FFLUSH_ALL $output
20664                         if eval $compile; then
20665                                 $cat >&4 <<EOM
20666 (Now testing the other method--but note that this also may fail.)
20667 EOM
20668                                 $run ./try 2>/dev/null
20669                                 code=$?
20670                                 $from try.out
20671                                 if $test -s try.out -a "X$code" = X42; then
20672                                         fflushall="`$cat try.out`"
20673                                 fi
20674                         fi
20675                         $rm_try
20676                         case "$fflushall" in
20677                         x)      $cat >&4 <<EOM
20678 Whew. Flushing explicitly all the stdio streams works.
20679 EOM
20680                                 fflushall="$define"
20681                                 ;;
20682                         '')     $cat >&4 <<EOM
20683 Sigh. Flushing explicitly all the stdio streams doesn't work.
20684 EOM
20685                                 fflushall="$undef"
20686                                 ;;
20687                         *)      $cat >&4 <<EOM
20688 Cannot figure out whether flushing stdio streams explicitly works or not.
20689 I'm assuming it doesn't.
20690 EOM
20691                                 fflushall="$undef"
20692                                 ;;
20693                         esac
20694                         ;;
20695                 "$define"|true|[yY]*)
20696                         fflushall="$define"
20697                         ;;
20698                 *)
20699                         fflushall="$undef"
20700                         ;;
20701                 esac
20702             else
20703                 $cat >&4 <<EOM
20704 All is futile.  Even fflush(stdin) clobbers input pipes!
20705 EOM
20706                 fflushall="$undef"
20707             fi
20708         else
20709             fflushall="$undef"
20710         fi
20711         $rm -f core tryp.c tryp.core core.tryp.*
20712         ;;
20713 *)      fflushall="$undef"
20714         ;;
20715 esac
20716
20717 case "$fflushNULL$fflushall" in
20718 undefundef)
20719         $cat <<EOM
20720 OK, I give up.  I cannot figure out how to flush pending stdio output.
20721 We won't be flushing handles at all before fork/exec/popen.
20722 EOM
20723         ;;
20724 esac
20725 $rm_try tryp
20726
20727 : Store the full pathname to the ar program for use in the C program
20728 : Respect a hint or command line value for full_ar.
20729 case "$full_ar" in
20730 '') full_ar=$ar ;;
20731 esac
20732
20733 : Store the full pathname to the sed program for use in the C program
20734 full_sed=$sed
20735
20736 : see what type gids are declared as in the kernel
20737 echo " "
20738 echo "Looking for the type for group ids returned by getgid()."
20739 set gid_t gidtype xxx stdio.h sys/types.h
20740 eval $typedef
20741 case "$gidtype" in
20742 xxx)
20743         xxx=`./findhdr sys/user.h`
20744         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20745         case $1 in
20746         unsigned) dflt="$1 $2" ;;
20747         *) dflt="$1" ;;
20748         esac
20749         ;;
20750 *) dflt="$gidtype";;
20751 esac
20752 case "$gidtype" in
20753 gid_t) echo "gid_t found." ;;
20754 *)      rp="What is the type for group ids returned by getgid()?"
20755         . ./myread
20756         gidtype="$ans"
20757         ;;
20758 esac
20759
20760 : Check the size of GID
20761 echo " "
20762 case "$gidtype" in
20763 *_t) zzz="$gidtype"     ;;
20764 *)   zzz="gid"          ;;
20765 esac
20766 echo "Checking the size of $zzz..." >&4
20767 cat > try.c <<EOCP
20768 #include <sys/types.h>
20769 #include <stdio.h>
20770 #$i_stdlib I_STDLIB
20771 #ifdef I_STDLIB
20772 #include <stdlib.h>
20773 #endif
20774 int main() {
20775     printf("%d\n", (int)sizeof($gidtype));
20776     exit(0);
20777 }
20778 EOCP
20779 set try
20780 if eval $compile_ok; then
20781         yyy=`$run ./try`
20782         case "$yyy" in
20783         '')     gidsize=4
20784                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20785                 ;;
20786         *)      gidsize=$yyy
20787                 echo "Your $zzz is $gidsize bytes long."
20788                 ;;
20789         esac
20790 else
20791         gidsize=4
20792         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20793 fi
20794
20795
20796 : Check if GID is signed
20797 echo " "
20798 case "$gidtype" in
20799 *_t) zzz="$gidtype"     ;;
20800 *)   zzz="gid"          ;;
20801 esac
20802 echo "Checking the sign of $zzz..." >&4
20803 cat > try.c <<EOCP
20804 #include <sys/types.h>
20805 #include <stdio.h>
20806 int main() {
20807         $gidtype foo = -1;
20808         if (foo < 0)
20809                 printf("-1\n");
20810         else
20811                 printf("1\n");
20812 }
20813 EOCP
20814 set try
20815 if eval $compile; then
20816         yyy=`$run ./try`
20817         case "$yyy" in
20818         '')     gidsign=1
20819                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20820                 ;;
20821         *)      gidsign=$yyy
20822                 case "$gidsign" in
20823                  1) echo "Your $zzz is unsigned." ;;
20824                 -1) echo "Your $zzz is signed."   ;;
20825                 esac
20826                 ;;
20827         esac
20828 else
20829         gidsign=1
20830         echo "(I can't compile the test program--guessing unsigned.)" >&4
20831 fi
20832
20833
20834 : Check 64bit sizes
20835 echo " "
20836
20837 if $test X"$quadtype" != X; then
20838
20839 echo "Checking how to print 64-bit integers..." >&4
20840
20841 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20842         $cat >try.c <<'EOCP'
20843 #include <sys/types.h>
20844 #include <stdio.h>
20845 int main() {
20846   int q = 12345678901;
20847   printf("%ld\n", q);
20848 }
20849 EOCP
20850         set try
20851         if eval $compile; then
20852                 yyy=`$run ./try`
20853                 case "$yyy" in
20854                 12345678901)
20855                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20856                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20857                         echo "We will use %d."
20858                         ;;
20859                 esac
20860         fi
20861 fi
20862
20863 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20864         $cat >try.c <<'EOCP'
20865 #include <sys/types.h>
20866 #include <stdio.h>
20867 int main() {
20868   long q = 12345678901;
20869   printf("%ld\n", q);
20870 }
20871 EOCP
20872         set try
20873         if eval $compile; then
20874                 yyy=`$run ./try`
20875                 case "$yyy" in
20876                 12345678901)
20877                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20878                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20879                         echo "We will use %ld."
20880                         ;;
20881                 esac
20882         fi
20883 fi
20884
20885 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20886         $cat >try.c <<'EOCP'
20887 #include <sys/types.h>
20888 #include <inttypes.h>
20889 #include <stdio.h>
20890 int main() {
20891   int64_t q = 12345678901;
20892   printf("%" PRId64 "\n", q);
20893 }
20894 EOCP
20895         set try
20896         if eval $compile; then
20897                 yyy=`$run ./try`
20898                 case "$yyy" in
20899                 12345678901)
20900                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20901                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20902                         echo "We will use the C9X style."
20903                         ;;
20904                 esac
20905         fi
20906 fi
20907
20908 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20909         $cat >try.c <<EOCP
20910 #include <sys/types.h>
20911 #include <stdio.h>
20912 int main() {
20913   $quadtype q = 12345678901;
20914   printf("%Ld\n", q);
20915 }
20916 EOCP
20917         set try
20918         if eval $compile; then
20919                 yyy=`$run ./try`
20920                 case "$yyy" in
20921                 12345678901)
20922                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20923                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20924                         echo "We will use %Ld."
20925                         ;;
20926                 esac
20927         fi
20928 fi
20929
20930 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20931         $cat >try.c <<'EOCP'
20932 #include <sys/types.h>
20933 #include <stdio.h>
20934 int main() {
20935   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20936   printf("%lld\n", q);
20937 }
20938 EOCP
20939         set try
20940         if eval $compile; then
20941                 yyy=`$run ./try`
20942                 case "$yyy" in
20943                 12345678901)
20944                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20945                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20946                         echo "We will use the %lld style."
20947                         ;;
20948                 esac
20949         fi
20950 fi
20951
20952 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20953         $cat >try.c <<EOCP
20954 #include <sys/types.h>
20955 #include <stdio.h>
20956 int main() {
20957   $quadtype q = 12345678901;
20958   printf("%qd\n", q);
20959 }
20960 EOCP
20961         set try
20962         if eval $compile; then
20963                 yyy=`$run ./try`
20964                 case "$yyy" in
20965                 12345678901)
20966                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20967                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20968                         echo "We will use %qd."
20969                         ;;
20970                 esac
20971         fi
20972 fi
20973
20974 if $test X"$sPRId64" = X; then
20975         echo "Cannot figure out how to print 64-bit integers." >&4
20976 fi
20977 $rm_try
20978
20979 fi
20980
20981 case "$sPRId64" in
20982 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20983         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20984         ;;
20985 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20986         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20987         ;;
20988 esac
20989
20990 : Check format strings for internal types
20991 echo " "
20992 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20993
20994 if $test X"$ivsize" = X8; then
20995         ivdformat="$sPRId64"
20996         uvuformat="$sPRIu64"
20997         uvoformat="$sPRIo64"
20998         uvxformat="$sPRIx64"
20999         uvXUformat="$sPRIXU64"
21000 else
21001         if $test X"$ivsize" = X"$longsize"; then
21002                 ivdformat='"ld"'
21003                 uvuformat='"lu"'
21004                 uvoformat='"lo"'
21005                 uvxformat='"lx"'
21006                 uvXUformat='"lX"'
21007         else
21008                 if $test X"$ivsize" = X"$intsize"; then
21009                         ivdformat='"d"'
21010                         uvuformat='"u"'
21011                         uvoformat='"o"'
21012                         uvxformat='"x"'
21013                         uvXUformat='"X"'
21014                 else
21015                         : far out
21016                         if $test X"$ivsize" = X"$shortsize"; then
21017                                 ivdformat='"hd"'
21018                                 uvuformat='"hu"'
21019                                 uvoformat='"ho"'
21020                                 uvxformat='"hx"'
21021                                 uvXUformat='"hX"'
21022                         fi
21023                 fi
21024         fi
21025 fi
21026
21027 if $test X"$usequadmath" = X"$define"; then
21028     nveformat='"Qe"'
21029     nvfformat='"Qf"'
21030     nvgformat='"Qg"'
21031     nvEUformat='"QE"'
21032     nvFUformat='"QF"'
21033     nvGUformat='"QG"'
21034 else
21035     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
21036         nveformat="$sPRIeldbl"
21037         nvfformat="$sPRIfldbl"
21038         nvgformat="$sPRIgldbl"
21039         nvEUformat="$sPRIEUldbl"
21040         nvFUformat="$sPRIFUldbl"
21041         nvGUformat="$sPRIGUldbl"
21042     else
21043         nveformat='"e"'
21044         nvfformat='"f"'
21045         nvgformat='"g"'
21046         nvEUformat='"E"'
21047         nvFUformat='"F"'
21048         nvGUformat='"G"'
21049     fi
21050 fi
21051
21052 case "$ivdformat" in
21053 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
21054     exit 1
21055     ;;
21056 esac
21057
21058 : Check format string for GID
21059
21060 echo " "
21061 $echo "Checking the format string to be used for gids..." >&4
21062
21063 case "$gidsign" in
21064 -1)     if $test X"$gidsize" = X"$ivsize"; then
21065                 gidformat="$ivdformat"
21066         else
21067                 if $test X"$gidsize" = X"$longsize"; then
21068                         gidformat='"ld"'
21069                 else
21070                         if $test X"$gidsize" = X"$intsize"; then
21071                                 gidformat='"d"'
21072                         else
21073                                 if $test X"$gidsize" = X"$shortsize"; then
21074                                         gidformat='"hd"'
21075                                 fi
21076                         fi
21077                 fi
21078         fi
21079         ;;
21080 *)      if $test X"$gidsize" = X"$uvsize"; then
21081                 gidformat="$uvuformat"
21082         else
21083                 if $test X"$gidsize" = X"$longsize"; then
21084                         gidformat='"lu"'
21085                 else
21086                         if $test X"$gidsize" = X"$intsize"; then
21087                                 gidformat='"u"'
21088                         else
21089                                 if $test X"$gidsize" = X"$shortsize"; then
21090                                         gidformat='"hu"'
21091                                 fi
21092                         fi
21093                 fi
21094         fi
21095         ;;
21096 esac
21097
21098 : see if getgroups exists
21099 set getgroups d_getgrps
21100 eval $inlibc
21101
21102 : see if setgroups exists
21103 set setgroups d_setgrps
21104 eval $inlibc
21105
21106 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
21107 echo " "
21108 case "$d_getgrps$d_setgrps" in
21109 *define*)
21110         case "$groupstype" in
21111         '') dflt="$gidtype" ;;
21112         *)  dflt="$groupstype" ;;
21113         esac
21114         $cat <<EOM
21115 What type of pointer is the second argument to getgroups() and setgroups()?
21116 Usually this is the same as group ids, $gidtype, but not always.
21117
21118 EOM
21119         rp='What type pointer is the second argument to getgroups() and setgroups()?'
21120         . ./myread
21121         groupstype="$ans"
21122         ;;
21123 *)  groupstype="$gidtype";;
21124 esac
21125
21126 : check whether make sets MAKE
21127 echo " "
21128 echo "Checking if your $make program sets \$(MAKE)..." >&4
21129 case "$make_set_make" in
21130 '')
21131         $sed 's/^X //' > testmake.mak << 'EOF'
21132 Xall:
21133 X       @echo 'maketemp="$(MAKE)"'
21134 EOF
21135         case "`$make -f testmake.mak 2>/dev/null`" in
21136         *maketemp=*) make_set_make='#' ;;
21137         *)      make_set_make="MAKE=$make" ;;
21138         esac
21139         $rm -f testmake.mak
21140         ;;
21141 esac
21142 case "$make_set_make" in
21143 '#') echo "Yup, it does.";;
21144 *) echo "Nope, it doesn't.";;
21145 esac
21146
21147 : see what type is used for mode_t
21148 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
21149 set mode_t modetype int stdio.h sys/types.h
21150 eval $typedef_ask
21151
21152 : see if we need va_copy
21153 echo " "
21154 case "$i_stdarg" in
21155 "$define")
21156         $cat >try.c <<EOCP
21157 #include <stdarg.h>
21158 #include <stdio.h>
21159 #$i_stdlib I_STDLIB
21160 #ifdef I_STDLIB
21161 #include <stdlib.h>
21162 #endif
21163 #include <signal.h>
21164
21165 int
21166 ivfprintf(FILE *f, const char *fmt, va_list *valp)
21167 {
21168   return vfprintf(f, fmt, *valp);
21169 }
21170
21171 int
21172 myvfprintf(FILE *f, const  char *fmt, va_list val)
21173 {
21174   return ivfprintf(f, fmt, &val);
21175 }
21176
21177 int
21178 myprintf(char *fmt, ...)
21179 {
21180   va_list val;
21181   va_start(val, fmt);
21182   return myvfprintf(stdout, fmt, val);
21183 }
21184
21185 int
21186 main(int ac, char **av)
21187 {
21188   signal(SIGSEGV, exit);
21189
21190   myprintf("%s%cs all right, then\n", "that", '\'');
21191   exit(0);
21192 }
21193 EOCP
21194         set try
21195         if eval $compile && $run ./try 2>&1 >/dev/null; then
21196                 case "`$run ./try`" in
21197                 "that's all right, then")
21198                         okay=yes
21199                         ;;
21200                 esac
21201         fi
21202         case "$okay" in
21203         yes)    echo "It seems that you don't need va_copy()." >&4
21204                 need_va_copy="$undef"
21205                 ;;
21206         *)      echo "It seems that va_copy() or similar will be needed." >&4
21207                 need_va_copy="$define"
21208                 ;;
21209         esac
21210         $rm_try
21211         ;;
21212 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
21213         need_va_copy="$undef"
21214         ;;
21215 esac
21216
21217 : see what type is used for size_t
21218 rp="What is the type used for the length parameter for string functions?"
21219 set size_t sizetype 'unsigned int' stdio.h sys/types.h
21220 eval $typedef_ask
21221
21222 : check for type of arguments to gethostbyaddr.
21223 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
21224         case "$d_gethbyaddr" in
21225         $define)
21226                 $cat <<EOM
21227
21228 Checking to see what type of arguments are accepted by gethostbyaddr().
21229 EOM
21230                 hdrs="$define sys/types.h
21231                         $d_socket sys/socket.h
21232                         $i_niin netinet/in.h
21233                         $i_netdb netdb.h
21234                         $i_unistd unistd.h"
21235                 : The first arg can 'char *' or 'void *'
21236                 : The second arg is some of integral type
21237                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
21238                         for yyy in size_t long int; do
21239                                 case "$netdb_host_type" in
21240                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
21241                                         if ./protochk "$try" $hdrs; then
21242                                                 echo "Your system accepts $xxx for the first arg."
21243                                                 echo "...and $yyy for the second arg."
21244                                                 netdb_host_type="$xxx"
21245                                                 netdb_hlen_type="$yyy"
21246                                         fi
21247                                         ;;
21248                                 esac
21249                         done
21250                 done
21251                 : In case none of those worked, prompt the user.
21252                 case "$netdb_host_type" in
21253                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21254                         dflt='char *'
21255                         . ./myread
21256                         netdb_host_type=$ans
21257                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21258                         dflt="$sizetype"
21259                         . ./myread
21260                         netdb_hlen_type=$ans
21261                         ;;
21262                 esac
21263                 ;;
21264         *)      : no gethostbyaddr, so pick harmless defaults
21265                 netdb_host_type='char *'
21266                 netdb_hlen_type="$sizetype"
21267                 ;;
21268         esac
21269         # Remove the "const" if needed. -- but then we'll have a
21270         # prototype clash!
21271         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21272 fi
21273
21274 : check for type of argument to gethostbyname.
21275 if test "X$netdb_name_type" = X ; then
21276         case "$d_gethbyname" in
21277         $define)
21278                 $cat <<EOM
21279
21280 Checking to see what type of argument is accepted by gethostbyname().
21281 EOM
21282                 hdrs="$define sys/types.h
21283                         $d_socket sys/socket.h
21284                         $i_niin netinet/in.h
21285                         $i_netdb netdb.h
21286                         $i_unistd unistd.h"
21287                 for xxx in "const char *" "char *"; do
21288                         case "$netdb_name_type" in
21289                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21290                                 if ./protochk "$try" $hdrs; then
21291                                         echo "Your system accepts $xxx."
21292                                         netdb_name_type="$xxx"
21293                                 fi
21294                                 ;;
21295                         esac
21296                 done
21297                 : In case none of those worked, prompt the user.
21298                 case "$netdb_name_type" in
21299                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21300                         dflt='char *'
21301                         . ./myread
21302                         netdb_name_type=$ans
21303                         ;;
21304                 esac
21305                 ;;
21306         *)      : no gethostbyname, so pick harmless default
21307                 netdb_name_type='char *'
21308                 ;;
21309         esac
21310 fi
21311
21312 : check for type of 1st argument to getnetbyaddr.
21313 if test "X$netdb_net_type" = X ; then
21314         case "$d_getnbyaddr" in
21315         $define)
21316                 $cat <<EOM
21317
21318 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21319 EOM
21320                 hdrs="$define sys/types.h
21321                         $d_socket sys/socket.h
21322                         $i_niin netinet/in.h
21323                         $i_netdb netdb.h
21324                         $i_unistd unistd.h"
21325                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21326                         case "$netdb_net_type" in
21327                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21328                                 if ./protochk "$try" $hdrs; then
21329                                         echo "Your system accepts $xxx."
21330                                         netdb_net_type="$xxx"
21331                                 fi
21332                                 ;;
21333                         esac
21334                 done
21335                 : In case none of those worked, prompt the user.
21336                 case "$netdb_net_type" in
21337                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21338                         dflt='long'
21339                         . ./myread
21340                         netdb_net_type=$ans
21341                         ;;
21342                 esac
21343                 ;;
21344         *)      : no getnetbyaddr, so pick harmless default
21345                 netdb_net_type='long'
21346                 ;;
21347         esac
21348 fi
21349 : locate the preferred pager for this system
21350 fn=f/
21351 case "$pager" in
21352 '')
21353         dflt=''
21354         case "$pg" in
21355         /*) dflt=$pg;;
21356         [a-zA-Z]:/*) dflt=$pg;;
21357         esac
21358         case "$more" in
21359         /*) dflt=$more;;
21360         [a-zA-Z]:/*) dflt=$more;;
21361         esac
21362         case "$less" in
21363         /*) dflt=$less;;
21364         [a-zA-Z]:/*) dflt=$less;;
21365         esac
21366         case "$dflt" in
21367         '') dflt=/usr/ucb/more;;
21368         esac
21369         ;;
21370 *)      dflt="$pager"
21371         ;;
21372 esac
21373 fn="f/($dflt)"
21374 echo " "
21375 rp='What pager is used on your system?'
21376 . ./getfile
21377 pager="$ans"
21378
21379 : see what type pids are declared as in the kernel
21380 rp="What is the type of process ids on this system?"
21381 set pid_t pidtype int stdio.h sys/types.h
21382 eval $typedef_ask
21383
21384 : see if ar generates random libraries by itself
21385 echo " "
21386 echo "Checking how to generate random libraries on your machine..." >&4
21387 echo 'int bar1() { return bar2(); }' > bar1.c
21388 echo 'int bar2() { return 2; }' > bar2.c
21389 $cat > foo.c <<EOP
21390 #$i_stdlib I_STDLIB
21391 #ifdef I_STDLIB
21392 #include <stdlib.h>
21393 #endif
21394 int main() { printf("%d\n", bar1()); exit(0); }
21395 EOP
21396 $cc $ccflags -c bar1.c >/dev/null 2>&1
21397 $cc $ccflags -c bar2.c >/dev/null 2>&1
21398 $cc $ccflags -c foo.c >/dev/null 2>&1
21399 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21400 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21401         $run ./foobar >/dev/null 2>&1; then
21402         echo "$ar appears to generate random libraries itself."
21403         orderlib=false
21404         if [ "X$ranlib" = "X" ]; then
21405             ranlib=":"
21406         fi
21407 elif $ar s bar$_a >/dev/null 2>&1 &&
21408         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21409         $run ./foobar >/dev/null 2>&1; then
21410                 echo "a table of contents needs to be added with '$ar s'."
21411                 orderlib=false
21412                 ranlib="$ar s"
21413 elif $ar ts bar$_a >/dev/null 2>&1 &&
21414         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21415         $run ./foobar >/dev/null 2>&1; then
21416                 echo "a table of contents needs to be added with '$ar ts'."
21417                 orderlib=false
21418                 ranlib="$ar ts"
21419 else
21420         case "$ranlib" in
21421         :) ranlib='';;
21422         '')
21423                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21424                 $test -f $ranlib || ranlib=''
21425                 ;;
21426         esac
21427         if $test -n "$ranlib"; then
21428                 echo "your system has '$ranlib'; we'll use that."
21429                 orderlib=false
21430         else
21431                 echo "your system doesn't seem to support random libraries"
21432                 echo "so we'll use lorder and tsort to order the libraries."
21433                 orderlib=true
21434                 ranlib=":"
21435         fi
21436 fi
21437 $rm -f foo* bar*
21438
21439 : see if this is a values.h system
21440 set values.h i_values
21441 eval $inhdr
21442
21443 : Check the max offset that gmtime and localtime accept
21444 echo "Checking max offsets that gmtime () accepts"
21445
21446 case $i_values in
21447     define) yyy="#include <values.h>" ;;
21448     *)      yyy="" ;;
21449     esac
21450
21451 case "$sGMTIME_min/$sGMTIME_max" in
21452     0/0|/)
21453         $cat >try.c <<EOCP
21454 #include <sys/types.h>
21455 #include <stdio.h>
21456 #include <time.h>
21457 $yyy
21458
21459 int i;
21460 struct tm *tmp;
21461 time_t pt;
21462
21463 void gm_check (time_t t, int min_year, int max_year)
21464 {
21465     tmp = gmtime (&t);
21466     if ( tmp == NULL ||
21467         /* Check tm_year overflow */
21468          tmp->tm_year < min_year || tmp->tm_year > max_year)
21469         tmp = NULL;
21470     else
21471         pt = t;
21472     } /* gm_check */
21473
21474 int check_max ()
21475 {
21476     tmp = NULL;
21477     pt  = 0;
21478 #ifdef MAXLONG
21479     gm_check (MAXLONG, 69, 0x7fffffff);
21480 #endif
21481     if (tmp == NULL || tmp->tm_year < 0) {
21482         for (i = 63; i >= 0; i--) {
21483             time_t x = pt | ((time_t)1 << i);
21484             if (x < 0 || x < pt) continue;
21485             gm_check (x, 69, 0x7fffffff);
21486             }
21487         }
21488     printf ("sGMTIME_max=%ld\n", pt);
21489     return (0);
21490     } /* check_max */
21491
21492 int check_min ()
21493 {
21494     tmp = NULL;
21495     pt  = 0;
21496 #ifdef MINLONG
21497     gm_check (MINLONG, -1900, 70);
21498 #endif
21499     if (tmp == NULL) {
21500         for (i = 36; i >= 0; i--) {
21501             time_t x = pt - ((time_t)1 << i);
21502             if (x > 0) continue;
21503             gm_check (x, -1900, 70);
21504             }
21505         }
21506     printf ("sGMTIME_min=%ld\n", pt);
21507     return (0);
21508     } /* check_min */
21509
21510 int main (int argc, char *argv[])
21511 {
21512     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
21513     check_max ();
21514     check_min ();
21515     return (0);
21516     } /* main */
21517 EOCP
21518         set try
21519         if eval $compile; then
21520             eval `$run ./try`
21521         else
21522             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21523             fi
21524         $rm_try
21525         ;;
21526     esac
21527
21528 echo "Checking max offsets that localtime () accepts"
21529
21530 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21531     0/0|/)
21532         $cat >try.c <<EOCP
21533 #include <sys/types.h>
21534 #include <stdio.h>
21535 #include <time.h>
21536 $yyy
21537
21538 int i;
21539 struct tm *tmp;
21540 time_t pt;
21541
21542 void local_check (time_t t, int min_year, int max_year)
21543 {
21544     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21545         tmp = NULL;
21546     else
21547         tmp = localtime (&t);
21548     if ( tmp == NULL ||
21549         /* Check tm_year overflow */
21550          tmp->tm_year < min_year || tmp->tm_year > max_year)
21551         tmp = NULL;
21552     else
21553         pt = t;
21554     } /* local_check */
21555
21556 int check_max ()
21557 {
21558     tmp = NULL;
21559     pt  = 0;
21560 #ifdef MAXLONG
21561     local_check (MAXLONG, 69, 0x7fffffff);
21562 #endif
21563     if (tmp == NULL || tmp->tm_year < 0) {
21564         for (i = 63; i >= 0; i--) {
21565             time_t x = pt | ((time_t)1 << i);
21566             if (x < 0 || x < pt) continue;
21567             local_check (x, 69, 0x7fffffff);
21568             }
21569         }
21570     printf ("sLOCALTIME_max=%ld\n", pt);
21571     return (0);
21572    } /* check_max */
21573
21574 int check_min ()
21575 {
21576     tmp = NULL;
21577     pt  = 0;
21578 #ifdef MINLONG
21579     local_check (MINLONG, -1900, 70);
21580 #endif
21581     if (tmp == NULL) {
21582         for (i = 36; i >= 0; i--) {
21583             time_t x = pt - ((time_t)1 << i);
21584             if (x > 0) continue;
21585             local_check (x, -1900, 70);
21586             }
21587         }
21588     printf ("sLOCALTIME_min=%ld\n", pt);
21589     return (0);
21590     } /* check_min */
21591
21592 int main (int argc, char *argv[])
21593 {
21594     check_max ();
21595     check_min ();
21596     return (0);
21597     } /* main */
21598 EOCP
21599         set try
21600         if eval $compile; then
21601             eval `$run ./try`
21602         else
21603             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21604             fi
21605         $rm_try
21606         ;;
21607     esac
21608
21609 : check for type of arguments to select.
21610 case "$selecttype" in
21611 '') case "$d_select" in
21612         $define)
21613                 echo " "
21614                 $cat <<EOM
21615 Checking to see what type of arguments are accepted by select().
21616 EOM
21617                 hdrs="$define sys/types.h
21618                         $i_systime sys/time.h
21619                         $i_sysselct sys/select.h
21620                         $d_socket sys/socket.h"
21621                 : The first arg can be int, unsigned, or size_t
21622                 : The last arg may or may not be 'const'
21623                 val=''
21624                 : void pointer has been seen but using that
21625                 : breaks the selectminbits test
21626                 for xxx in 'fd_set *' 'int *'; do
21627                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21628                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21629                                         case "$val" in
21630                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21631                                                 if ./protochk "$try" $hdrs; then
21632                                                         echo "Your system accepts $xxx."
21633                                                         val="$xxx"
21634                                                 fi
21635                                                 ;;
21636                                         esac
21637                                 done
21638                         done
21639                 done
21640                 case "$val" in
21641                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21642                         case "$d_fd_set" in
21643                                 $define) dflt="fd_set *" ;;
21644                                 *)              dflt="int *" ;;
21645                         esac
21646                         . ./myread
21647                         val=$ans
21648                         ;;
21649                 esac
21650                 selecttype="$val"
21651                 ;;
21652         *)      : no select, so pick a harmless default
21653                 selecttype='int *'
21654                 ;;
21655         esac
21656         ;;
21657 esac
21658
21659 : check for the select 'width'
21660 case "$selectminbits" in
21661 '') safebits=`expr $ptrsize \* 8`
21662     case "$d_select" in
21663         $define)
21664                 $cat <<EOM
21665
21666 Checking to see on how many bits at a time your select() operates...
21667 EOM
21668                 $cat >try.c <<EOCP
21669 #include <sys/types.h>
21670 #$i_time I_TIME
21671 #$i_systime I_SYS_TIME
21672 #$i_systimek I_SYS_TIME_KERNEL
21673 #ifdef I_TIME
21674 #   include <time.h>
21675 #endif
21676 #ifdef I_SYS_TIME
21677 #   ifdef I_SYS_TIME_KERNEL
21678 #       define KERNEL
21679 #   endif
21680 #   include <sys/time.h>
21681 #   ifdef I_SYS_TIME_KERNEL
21682 #       undef KERNEL
21683 #   endif
21684 #endif
21685 #$i_sysselct I_SYS_SELECT
21686 #ifdef I_SYS_SELECT
21687 #include <sys/select.h>
21688 #endif
21689 #$d_socket HAS_SOCKET
21690 #ifdef HAS_SOCKET
21691 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21692 #endif
21693 #include <stdio.h>
21694 #$i_stdlib I_STDLIB
21695 #ifdef I_STDLIB
21696 #include <stdlib.h>
21697 #endif
21698 $selecttype b;
21699 #define S sizeof(*(b))
21700 #define MINBITS 64
21701 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21702 #define NBITS  (NBYTES * 8)
21703 int main() {
21704     char *s = (char *)malloc(NBYTES);
21705     struct timeval t;
21706     int i;
21707     FILE* fp;
21708     int fd;
21709
21710     if (!s)
21711         exit(1);
21712     fclose(stdin);
21713     fp = fopen("try.c", "r");
21714     if (fp == 0)
21715       exit(2);
21716     fd = fileno(fp);
21717     if (fd < 0)
21718       exit(3);
21719     b = ($selecttype)s;
21720     for (i = 0; i < NBITS; i++)
21721         FD_SET(i, b);
21722     t.tv_sec  = 0;
21723     t.tv_usec = 0;
21724     select(fd + 1, b, 0, 0, &t);
21725     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21726     free(s);
21727     printf("%d\n", i + 1);
21728     return 0;
21729 }
21730 EOCP
21731                 set try
21732                 if eval $compile_ok; then
21733                         selectminbits=`$run ./try`
21734                         case "$selectminbits" in
21735                         '')     cat >&4 <<EOM
21736 Cannot figure out on how many bits at a time your select() operates.
21737 I'll play safe and guess it is $safebits bits.
21738 EOM
21739                                 selectminbits=$safebits
21740                                 bits="$safebits bits"
21741                                 ;;
21742                         1)      bits="1 bit" ;;
21743                         *)      bits="$selectminbits bits" ;;
21744                         esac
21745                         echo "Your select() operates on $bits at a time." >&4
21746                 else
21747                         rp='What is the minimum number of bits your select() operates on?'
21748                         case "$byteorder" in
21749                         12345678)       dflt=64 ;;
21750                         1234)           dflt=32 ;;
21751                         *)              dflt=1  ;;
21752                         esac
21753                         . ./myread
21754                         val=$ans
21755                         selectminbits="$val"
21756                 fi
21757                 $rm_try
21758                 ;;
21759         *)      : no select, so pick a harmless default
21760                 selectminbits=$safebits
21761                 ;;
21762         esac
21763         ;;
21764 esac
21765
21766 : Trace out the files included by signal.h, then look for SIGxxx names.
21767 if [ "X$fieldn" = X ]; then
21768         : Just make some guesses.  We check them later.
21769         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21770 else
21771         xxx=`echo '#include <signal.h>' |
21772         $cppstdin $cppminus $cppflags 2>/dev/null |
21773         $grep '^[       ]*#.*include' |
21774         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21775                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21776 fi
21777 xxxfiles=''
21778 for xx in $xxx /dev/null ; do
21779         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21780 done
21781 case "$xxxfiles" in
21782 '')     xxxfiles=`./findhdr signal.h` ;;
21783 esac
21784 xxx=`awk '
21785 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21786         print substr($2, 4, 20)
21787 }
21788 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21789         print substr($3, 4, 20)
21790 }' $xxxfiles`
21791 : Append some common names just in case the awk scan failed.
21792 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21793 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21794 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21795 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21796 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21797
21798 : generate a few handy files for later
21799 $cat > signal.c <<EOCP
21800 #include <sys/types.h>
21801 #include <signal.h>
21802 #$i_stdlib I_STDLIB
21803 #ifdef I_STDLIB
21804 #include <stdlib.h>
21805 #endif
21806 #include <stdio.h>
21807 int main() {
21808
21809 /* Strange style to avoid deeply-nested #if/#else/#endif */
21810 #ifndef NSIG
21811 #  ifdef _NSIG
21812 #    define NSIG (_NSIG)
21813 #  endif
21814 #endif
21815
21816 #ifndef NSIG
21817 #  ifdef SIGMAX
21818 #    define NSIG (SIGMAX+1)
21819 #  endif
21820 #endif
21821
21822 #ifndef NSIG
21823 #  ifdef SIG_MAX
21824 #    define NSIG (SIG_MAX+1)
21825 #  endif
21826 #endif
21827
21828 #ifndef NSIG
21829 #  ifdef _SIG_MAX
21830 #    define NSIG (_SIG_MAX+1)
21831 #  endif
21832 #endif
21833
21834 #ifndef NSIG
21835 #  ifdef MAXSIG
21836 #    define NSIG (MAXSIG+1)
21837 #  endif
21838 #endif
21839
21840 #ifndef NSIG
21841 #  ifdef MAX_SIG
21842 #    define NSIG (MAX_SIG+1)
21843 #  endif
21844 #endif
21845
21846 #ifndef NSIG
21847 #  ifdef SIGARRAYSIZE
21848 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21849 #  endif
21850 #endif
21851
21852 #ifndef NSIG
21853 #  ifdef _sys_nsig
21854 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21855 #  endif
21856 #endif
21857
21858 /* Default to some arbitrary number that's big enough to get most
21859    of the common signals.
21860 */
21861 #ifndef NSIG
21862 #    define NSIG 50
21863 #endif
21864
21865 printf("NSIG %d\n", NSIG);
21866
21867 #ifndef JUST_NSIG
21868
21869 EOCP
21870
21871 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21872 {
21873         printf "#ifdef SIG"; printf $1; printf "\n"
21874         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21875         printf $1; printf ");\n"
21876         printf "#endif\n"
21877 }
21878 END {
21879         printf "#endif /* JUST_NSIG */\n";
21880         printf "exit(0);\n}\n";
21881 }
21882 ' >>signal.c
21883 $cat >signal.awk <<'EOP'
21884 BEGIN { ndups = 0 }
21885 $1 ~ /^NSIG$/ { nsig = $2 }
21886 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21887     if ($2 > maxsig) { maxsig = $2 }
21888     if (sig_name[$2]) {
21889         dup_name[ndups] = $1
21890         dup_num[ndups] = $2
21891         ndups++
21892     }
21893     else {
21894         sig_name[$2] = $1
21895         sig_num[$2] = $2
21896     }
21897 }
21898 END {
21899     if (nsig == 0) {
21900         nsig = maxsig + 1
21901     }
21902     printf("NSIG %d\n", nsig);
21903     for (n = 1; n < nsig; n++) {
21904         if (sig_name[n]) {
21905             printf("%s %d\n", sig_name[n], sig_num[n])
21906         }
21907         else {
21908             printf("NUM%d %d\n", n, n)
21909         }
21910     }
21911     for (n = 0; n < ndups; n++) {
21912         printf("%s %d\n", dup_name[n], dup_num[n])
21913     }
21914 }
21915 EOP
21916 $cat >signal_cmd <<EOS
21917 $startsh
21918 if $test -s signal.lst; then
21919     echo "Using your existing signal.lst file"
21920         exit 0
21921 fi
21922 xxx="$xxx"
21923 EOS
21924 $cat >>signal_cmd <<'EOS'
21925
21926 set signal
21927 if eval $compile_ok; then
21928         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21929                 $uniq | $awk -f signal.awk >signal.lst
21930 else
21931         echo "(I can't seem be able to compile the whole test program)" >&4
21932         echo "(I'll try it in little pieces.)" >&4
21933         set signal -DJUST_NSIG
21934         if eval $compile_ok; then
21935                 $run ./signal$_exe > signal.nsg
21936                 $cat signal.nsg
21937         else
21938                 echo "I can't seem to figure out how many signals you have." >&4
21939                 echo "Guessing 50." >&4
21940                 echo 'NSIG 50' > signal.nsg
21941         fi
21942         : Now look at all the signal names, one at a time.
21943         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21944                 $cat > signal.c <<EOCP
21945 #include <sys/types.h>
21946 #include <signal.h>
21947 #include <stdio.h>
21948 int main() {
21949 printf("$xx %d\n", SIG${xx});
21950 return 0;
21951 }
21952 EOCP
21953                 set signal
21954                 if eval $compile; then
21955                         echo "SIG${xx} found."
21956                         $run ./signal$_exe  >> signal.ls1
21957                 else
21958                         echo "SIG${xx} NOT found."
21959                 fi
21960         done
21961         if $test -s signal.ls1; then
21962                 $cat signal.nsg signal.ls1 |
21963                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21964         fi
21965
21966 fi
21967 if $test -s signal.lst; then
21968         :
21969 else
21970         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21971         echo 'kill -l' >signal
21972         set X `csh -f <signal`
21973         $rm -f signal
21974         shift
21975         case $# in
21976         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21977         esac
21978         echo $@ | $tr ' ' $trnl | \
21979             $awk '{ printf "%s %d\n", $1, ++s; }
21980                   END { printf "NSIG %d\n", ++s }' >signal.lst
21981 fi
21982 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21983 EOS
21984 chmod a+x signal_cmd
21985 $eunicefix signal_cmd
21986
21987 : generate list of signal names
21988 echo " "
21989 case "$sig_name_init" in
21990 '') doinit=yes ;;
21991 *)  case "$sig_num_init" in
21992     ''|*,*) doinit=yes ;;
21993     esac ;;
21994 esac
21995 case "$doinit" in
21996 yes)
21997         echo "Generating a list of signal names and numbers..." >&4
21998         . ./signal_cmd
21999         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
22000         sig_name=`$awk 'BEGIN { printf "ZERO " }
22001                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
22002         sig_num=`$awk  'BEGIN { printf "0 " }
22003                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
22004         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
22005                              !/^NSIG/   { printf "\"%s\", ", $1 }
22006                              END        { printf "0\n" }' signal.lst`
22007         sig_num_init=`$awk  'BEGIN      { printf "0, " }
22008                              !/^NSIG/   { printf "%d, ", $2}
22009                              END        { printf "0\n"}' signal.lst`
22010         ;;
22011 esac
22012 echo "The following $sig_count signals are available:"
22013 echo " "
22014 echo $sig_name | $awk \
22015 'BEGIN { linelen = 0 }
22016 {
22017         for (i = 1; i <= NF; i++) {
22018                 name = "SIG" $i " "
22019                 linelen = linelen + length(name)
22020                 if (linelen > 70) {
22021                         printf "\n"
22022                         linelen = length(name)
22023                 }
22024                 printf "%s", name
22025         }
22026         printf "\n"
22027 }'
22028 sig_size=`echo $sig_name | awk '{print NF}'`
22029 $rm -f signal signal.c signal.awk signal.lst signal_cmd
22030
22031 : Check size of size
22032 echo " "
22033 case "$sizetype" in
22034 *_t) zzz="$sizetype"    ;;
22035 *)   zzz="filesize"     ;;
22036 esac
22037 echo "Checking the size of $zzz..." >&4
22038 cat > try.c <<EOCP
22039 #include <sys/types.h>
22040 #include <stdio.h>
22041 #$i_stdlib I_STDLIB
22042 #ifdef I_STDLIB
22043 #include <stdlib.h>
22044 #endif
22045 int main() {
22046     printf("%d\n", (int)sizeof($sizetype));
22047     exit(0);
22048 }
22049 EOCP
22050 set try
22051 if eval $compile_ok; then
22052         yyy=`$run ./try`
22053         case "$yyy" in
22054         '')     sizesize=4
22055                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
22056                 ;;
22057         *)      sizesize=$yyy
22058                 echo "Your $zzz size is $sizesize bytes."
22059                 ;;
22060         esac
22061 else
22062         sizesize=4
22063         echo "(I can't compile the test program--guessing $sizesize.)" >&4
22064 fi
22065
22066
22067 : check for socklen_t
22068 echo " "
22069 echo "Checking to see if you have socklen_t..." >&4
22070 $cat >try.c <<EOCP
22071 #include <sys/types.h>
22072 #$d_socket HAS_SOCKET
22073 #ifdef HAS_SOCKET
22074 #include <sys/socket.h>
22075 #endif
22076 int main() { socklen_t x = 16; }
22077 EOCP
22078 set try
22079 if eval $compile; then
22080         val="$define"
22081         echo "You have socklen_t."
22082 else
22083         val="$undef"
22084         echo "You do not have socklen_t."
22085         case "$sizetype" in
22086         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
22087         esac
22088 fi
22089 $rm_try
22090 set d_socklen_t
22091 eval $setvar
22092
22093 : see if this is a socks.h system
22094 set socks.h i_socks
22095 eval $inhdr
22096
22097 : check for type of the size argument to socket calls
22098 case "$d_socket" in
22099 "$define")
22100         $cat <<EOM
22101
22102 Checking to see what type is the last argument of accept().
22103 EOM
22104         yyy=''
22105         case "$d_socklen_t" in
22106         "$define") yyy="$yyy socklen_t"
22107         esac
22108         yyy="$yyy $sizetype int long unsigned"
22109         for xxx in $yyy; do
22110                 case "$socksizetype" in
22111                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
22112                         case "$usesocks" in
22113                         "$define")
22114                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
22115                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22116                                         socksizetype="$xxx"
22117                                 fi
22118                                 ;;
22119                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
22120                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
22121                                         socksizetype="$xxx"
22122                                 fi
22123                                 ;;
22124                         esac
22125                         ;;
22126                 esac
22127         done
22128 : In case none of those worked, prompt the user.
22129         case "$socksizetype" in
22130         '')     rp='What is the type for socket address structure sizes?'
22131                 dflt='int'
22132                 . ./myread
22133                 socksizetype=$ans
22134                 ;;
22135         esac
22136         ;;
22137 *)      : no sockets, so pick relatively harmless default
22138         socksizetype='int'
22139         ;;
22140 esac
22141
22142 : see what type is used for signed size_t
22143 set ssize_t ssizetype int stdio.h sys/types.h
22144 eval $typedef
22145 dflt="$ssizetype"
22146 $cat > try.c <<EOM
22147 #include <stdio.h>
22148 #$i_stdlib I_STDLIB
22149 #ifdef I_STDLIB
22150 #include <stdlib.h>
22151 #endif
22152 #include <sys/types.h>
22153 #define Size_t $sizetype
22154 #define SSize_t $dflt
22155 int main()
22156 {
22157         if (sizeof(Size_t) == sizeof(SSize_t))
22158                 printf("$dflt\n");
22159         else if (sizeof(Size_t) == sizeof(int))
22160                 printf("int\n");
22161         else
22162                 printf("long\n");
22163         exit(0);
22164 }
22165 EOM
22166 echo " "
22167 set try
22168 if eval $compile_ok && $run ./try > /dev/null; then
22169         ssizetype=`$run ./try`
22170         echo "I'll be using $ssizetype for functions returning a byte count." >&4
22171 else
22172         $cat >&4 <<EOM
22173 Help! I can't compile and run the ssize_t test program: please enlighten me!
22174 (This is probably a misconfiguration in your system or libraries, and
22175 you really ought to fix it.  Still, I'll try anyway.)
22176
22177 I need a type that is the same size as $sizetype, but is guaranteed to
22178 be signed.  Common values are ssize_t, int and long.
22179
22180 EOM
22181         rp="What signed type is the same size as $sizetype?"
22182         . ./myread
22183         ssizetype="$ans"
22184 fi
22185 $rm_try
22186
22187 : Check the size of st_ino
22188 $echo " "
22189 $echo "Checking the size of st_ino..." >&4
22190 $cat > try.c <<EOCP
22191 #include <sys/stat.h>
22192 #include <stdio.h>
22193 #$i_stdlib I_STDLIB
22194 #ifdef I_STDLIB
22195 #include <stdlib.h>
22196 #endif
22197 int main() {
22198     struct stat st;
22199     printf("%d\n", (int)sizeof(st.st_ino));
22200     exit(0);
22201 }
22202 EOCP
22203 set try
22204 if eval $compile_ok; then
22205         val=`$run ./try`
22206         case "$val" in
22207         '')     st_ino_size=4
22208                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
22209                 ;;
22210         *)      st_ino_size=$val
22211                 $echo "Your st_ino is $st_ino_size bytes long."
22212                 ;;
22213         esac
22214 else
22215         st_ino_size=4
22216         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
22217 fi
22218 $rm_try
22219
22220 : Check if st_ino is signed
22221 $echo " "
22222 $echo "Checking the sign of st_ino..." >&4
22223 $cat > try.c <<EOCP
22224 #include <sys/stat.h>
22225 #include <stdio.h>
22226 int main() {
22227         struct stat foo;
22228         foo.st_ino = -1;
22229         if (foo.st_ino < 0)
22230                 printf("-1\n");
22231         else
22232                 printf("1\n");
22233 }
22234 EOCP
22235 set try
22236 if eval $compile; then
22237         val=`$run ./try`
22238         case "$val" in
22239         '')     st_ino_sign=1
22240                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
22241                 ;;
22242         *)      st_ino_sign=$val
22243                 case "$st_ino_sign" in
22244                  1) $echo "Your st_ino is unsigned." ;;
22245                 -1) $echo "Your st_ino is signed."   ;;
22246                 esac
22247                 ;;
22248         esac
22249 else
22250         st_ino_sign=1
22251         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22252 fi
22253 $rm_try
22254
22255 : see what type of char stdio uses.
22256 echo " "
22257 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22258 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22259         echo "Your stdio uses unsigned chars." >&4
22260         stdchar="unsigned char"
22261 else
22262         echo "Your stdio uses signed chars." >&4
22263         stdchar="char"
22264 fi
22265 $rm -f stdioh
22266
22267 : see what type uids are declared as in the kernel
22268 echo " "
22269 echo "Looking for the type for user ids returned by getuid()."
22270 set uid_t uidtype xxx stdio.h sys/types.h
22271 eval $typedef
22272 case "$uidtype" in
22273 xxx)
22274         xxx=`./findhdr sys/user.h`
22275         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22276         case $1 in
22277         unsigned) dflt="$1 $2" ;;
22278         *) dflt="$1" ;;
22279         esac
22280         ;;
22281 *) dflt="$uidtype";;
22282 esac
22283 case "$uidtype" in
22284 uid_t)  echo "uid_t found." ;;
22285 *)      rp="What is the type for user ids returned by getuid()?"
22286         . ./myread
22287         uidtype="$ans"
22288         ;;
22289 esac
22290
22291 : Check size of UID
22292 echo " "
22293 case "$uidtype" in
22294 *_t) zzz="$uidtype"     ;;
22295 *)   zzz="uid"          ;;
22296 esac
22297 echo "Checking the size of $zzz..." >&4
22298 cat > try.c <<EOCP
22299 #include <sys/types.h>
22300 #include <stdio.h>
22301 #$i_stdlib I_STDLIB
22302 #ifdef I_STDLIB
22303 #include <stdlib.h>
22304 #endif
22305 int main() {
22306     printf("%d\n", (int)sizeof($uidtype));
22307     exit(0);
22308 }
22309 EOCP
22310 set try
22311 if eval $compile_ok; then
22312         yyy=`$run ./try`
22313         case "$yyy" in
22314         '')     uidsize=4
22315                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22316                 ;;
22317         *)      uidsize=$yyy
22318                 echo "Your $zzz is $uidsize bytes long."
22319                 ;;
22320         esac
22321 else
22322         uidsize=4
22323         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22324 fi
22325
22326 : Check if UID is signed
22327 echo " "
22328 case "$uidtype" in
22329 *_t) zzz="$uidtype"     ;;
22330 *)   zzz="uid"          ;;
22331 esac
22332 echo "Checking the sign of $zzz..." >&4
22333 cat > try.c <<EOCP
22334 #include <sys/types.h>
22335 #include <stdio.h>
22336 int main() {
22337         $uidtype foo = -1;
22338         if (foo < 0)
22339                 printf("-1\n");
22340         else
22341                 printf("1\n");
22342 }
22343 EOCP
22344 set try
22345 if eval $compile; then
22346         yyy=`$run ./try`
22347         case "$yyy" in
22348         '')     uidsign=1
22349                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22350                 ;;
22351         *)      uidsign=$yyy
22352                 case "$uidsign" in
22353                  1) echo "Your $zzz is unsigned." ;;
22354                 -1) echo "Your $zzz is signed."   ;;
22355                 esac
22356                 ;;
22357         esac
22358 else
22359         uidsign=1
22360         echo "(I can't compile the test program--guessing unsigned.)" >&4
22361 fi
22362
22363
22364 : Check format string for UID
22365 echo " "
22366 $echo "Checking the format string to be used for uids..." >&4
22367
22368 case "$uidsign" in
22369 -1)     if $test X"$uidsize" = X"$ivsize"; then
22370                 uidformat="$ivdformat"
22371         else
22372                 if $test X"$uidsize" = X"$longsize"; then
22373                         uidformat='"ld"'
22374                 else
22375                         if $test X"$uidsize" = X"$intsize"; then
22376                                 uidformat='"d"'
22377                         else
22378                                 if $test X"$uidsize" = X"$shortsize"; then
22379                                         uidformat='"hd"'
22380                                 fi
22381                         fi
22382                 fi
22383         fi
22384         ;;
22385 *)      if $test X"$uidsize" = X"$uvsize"; then
22386                 uidformat="$uvuformat"
22387         else
22388                 if $test X"$uidsize" = X"$longsize"; then
22389                         uidformat='"lu"'
22390                 else
22391                         if $test X"$uidsize" = X"$intsize"; then
22392                                 uidformat='"u"'
22393                         else
22394                                 if $test X"$uidsize" = X"$shortsize"; then
22395                                         uidformat='"hu"'
22396                                 fi
22397                         fi
22398                 fi
22399         fi
22400         ;;
22401 esac
22402
22403 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22404 echo " "
22405 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22406 $cat >try.c <<'EOM'
22407 /* Intentionally a long probe as I'd like to sanity check that the exact
22408    approach is going to work, as thinking it will work, but only having it
22409    part working at runtime is worse than not having it.  */
22410
22411 #include <sys/types.h>
22412 #include <sys/sysctl.h>
22413 #include <sys/param.h>
22414 #include <stdio.h>
22415 #include <string.h>
22416 #include <stdlib.h>
22417 #include <unistd.h>
22418
22419 int
22420 main(int argc, char **argv) {
22421     char *buffer;
22422     char *argv_leaf = strrchr(argv[0], '/');
22423     char *buffer_leaf;
22424     size_t size = 0;
22425     int mib[4];
22426
22427     mib[0] = CTL_KERN;
22428     mib[1] = KERN_PROC;
22429     mib[2] = KERN_PROC_PATHNAME;
22430     mib[3] = -1;
22431
22432     if (!argv_leaf) {
22433         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22434         return 1;
22435     }
22436
22437     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22438         perror("sysctl");
22439         return 2;
22440     }
22441
22442     if (size < strlen(argv_leaf) + 1) {
22443         fprintf(stderr, "size %lu is too short for a path\n",
22444                 (unsigned long) size);
22445         return 3;
22446     }
22447
22448     if (size > MAXPATHLEN * MAXPATHLEN) {
22449         fprintf(stderr, "size %lu is too long for a path\n",
22450                 (unsigned long) size);
22451         return 4;
22452     }
22453
22454     buffer = malloc(size);
22455     if (!buffer) {
22456         perror("malloc");
22457         return 5;
22458     }
22459
22460     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22461         perror("sysctl");
22462         return 6;
22463     }
22464
22465     if (strlen(buffer) + 1 != size) {
22466         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22467                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22468         return 7;
22469     }
22470
22471
22472     if (*buffer != '/') {
22473         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22474         return 8;
22475     }
22476
22477     if (strstr(buffer, "/./")) {
22478         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22479         return 9;
22480     }
22481
22482     if (strstr(buffer, "/../")) {
22483         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22484         return 10;
22485     }
22486
22487     buffer_leaf = strrchr(buffer, '/');
22488     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22489         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22490         return 11;
22491     }
22492
22493     free(buffer);
22494
22495     return 0;
22496 }
22497 EOM
22498
22499 val=$undef
22500 set try
22501 if eval $compile; then
22502         if $run ./try; then
22503                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22504                 val="$define"
22505         else
22506                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22507                 val="$undef"
22508         fi
22509 else
22510         echo "I'm unable to compile the test program." >&4
22511         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22512         val="$undef"
22513 fi
22514 $rm_try
22515 set usekernprocpathname
22516 eval $setvar
22517
22518 : Determine if we can use _NSGetExecutablePath to find executing program
22519 echo " "
22520 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22521 $cat >try.c <<'EOM'
22522 /* Intentionally a long probe as I'd like to sanity check that the exact
22523    approach is going to work, as thinking it will work, but only having it
22524    part working at runtime is worse than not having it.  */
22525 #include <mach-o/dyld.h>
22526 #include <stdio.h>
22527 #include <stdlib.h>
22528 #include <sys/param.h>
22529 #include <string.h>
22530
22531 int
22532 main(int argc, char **argv) {
22533     char buf[1];
22534     uint32_t size = sizeof(buf);
22535     int result;
22536     char *buffer;
22537     char *tidied;
22538     char *argv_leaf = strrchr(argv[0], '/');
22539     char *tidied_leaf;
22540
22541     if (!argv_leaf) {
22542         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22543         return 1;
22544     }
22545
22546     _NSGetExecutablePath(buf, &size);
22547     if (size > MAXPATHLEN * MAXPATHLEN) {
22548         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22549                 (unsigned int) size);
22550         return 2;
22551     }
22552
22553     buffer = malloc(size);
22554     if (!buffer) {
22555         perror("malloc");
22556         return 3;
22557     }
22558
22559     result = _NSGetExecutablePath(buffer, &size);
22560     if (result != 0) {
22561         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22562                 result, (unsigned int) size);
22563         return 4;
22564     }
22565
22566     tidied = realpath(buffer, NULL);
22567     if (!tidied) {
22568         perror("realpath");
22569         return 5;
22570     }
22571
22572     free(buffer);
22573
22574     if (*tidied != '/') {
22575         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22576         return 6;
22577     }
22578
22579     if (strstr(tidied, "/./")) {
22580         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22581         return 7;
22582     }
22583
22584     if (strstr(tidied, "/../")) {
22585         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22586         return 8;
22587     }
22588
22589     tidied_leaf = strrchr(tidied, '/');
22590     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22591         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22592         return 9;
22593     }
22594
22595     free(tidied);
22596
22597     return 0;
22598 }
22599 EOM
22600
22601 val=$undef
22602 set try
22603 if eval $compile; then
22604         if $run ./try; then
22605                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22606                 val="$define"
22607         else
22608                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22609         fi
22610 else
22611         echo "I'm unable to compile the test program." >&4
22612         echo "I'll assume no _NSGetExecutablePath here." >&4
22613 fi
22614 $rm_try
22615 set usensgetexecutablepath
22616 eval $setvar
22617
22618 : Check if site customization support was requested
22619 case "$usesitecustomize" in
22620     $define|true|[Yy]*)
22621         usesitecustomize="$define"
22622         ;;
22623     *)
22624         usesitecustomize="$undef"
22625         ;;
22626     esac
22627
22628 : see if prototypes support variable argument declarations
22629 echo " "
22630 case "$prototype$i_stdarg" in
22631 $define$define)
22632         echo "It appears we'll be able to prototype varargs functions." >&4
22633         val="$define"
22634         ;;
22635 *)
22636         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22637         val="$undef"
22638         ;;
22639 esac
22640 set vaproto
22641 eval $setvar
22642
22643 : determine compiler compiler
22644 case "$yacc" in
22645 '')
22646         dflt=yacc;;
22647 *)
22648         dflt="$yacc";;
22649 esac
22650 echo " "
22651 comp='yacc'
22652 if $test -f "$byacc$_exe"; then
22653         dflt="$byacc"
22654         comp="byacc or $comp"
22655 fi
22656 if $test -f "$bison$_exe"; then
22657         comp="$comp or bison -y"
22658 fi
22659 rp="Which compiler compiler ($comp) shall I use?"
22660 . ./myread
22661 yacc="$ans"
22662 case "$yacc" in
22663 *bis*)
22664         case "$yacc" in
22665         *-y*) ;;
22666         *)
22667                 yacc="$yacc -y"
22668                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22669                 ;;
22670         esac
22671         ;;
22672 esac
22673
22674 : see if this is a assert.h system
22675 set assert.h i_assert
22676 eval $inhdr
22677
22678 : see if this is a bfd.h system
22679 set bfd.h i_bfd
22680 eval $inhdr
22681
22682 : see if this is an execinfo.h system
22683 set execinfo.h i_execinfo
22684 eval $inhdr
22685
22686 : see if this is a fenv.h system
22687 set fenv.h i_fenv
22688 eval $inhdr
22689
22690 : see if this is a fp.h system
22691 set fp.h i_fp
22692 eval $inhdr
22693
22694 : see if this is a fp_class.h system
22695 set fp_class.h i_fp_class
22696 eval $inhdr
22697
22698 : see if gdbm.h is available
22699 set gdbm.h t_gdbm
22700 eval $inhdr
22701 case "$t_gdbm" in
22702 $define)
22703         : see if gdbm_open exists
22704         set gdbm_open d_gdbm_open
22705         eval $inlibc
22706         case "$d_gdbm_open" in
22707         $undef)
22708                 t_gdbm="$undef"
22709                 echo "We won't be including <gdbm.h>"
22710                 ;;
22711         esac
22712         ;;
22713 esac
22714 val="$t_gdbm"
22715 set i_gdbm
22716 eval $setvar
22717
22718 : see if this is a ieeefp.h system
22719 case "$i_ieeefp" in
22720 '' ) set ieeefp.h i_ieeefp
22721      eval $inhdr
22722      ;;
22723 esac
22724
22725 : see if this is a libutil.h system
22726 set libutil.h i_libutil
22727 eval $inhdr
22728
22729 : see if mach cthreads are available
22730 if test "X$usethreads" = "X$define"; then
22731         set mach/cthreads.h i_machcthr
22732         eval $inhdr
22733 else
22734         i_machcthr="$undef"
22735 fi
22736
22737 : see if this is a mntent.h system
22738 set mntent.h i_mntent
22739 eval $inhdr
22740
22741 : see if net/errno.h is available
22742 val=''
22743 set net/errno.h val
22744 eval $inhdr
22745
22746 : Unfortunately, it causes problems on some systems.  Arrgh.
22747 case "$val" in
22748 $define)
22749         cat > try.c <<'EOM'
22750 #include <stdio.h>
22751 #include <errno.h>
22752 #include <net/errno.h>
22753 int func()
22754 {
22755         return ENOTSOCK;
22756 }
22757 EOM
22758         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22759                 echo "We'll be including <net/errno.h>." >&4
22760         else
22761                 echo "We won't be including <net/errno.h>." >&4
22762                 val="$undef"
22763         fi
22764         $rm_try
22765         ;;
22766 esac
22767 set i_neterrno
22768 eval $setvar
22769
22770 : see if netinet/tcp.h is available
22771 set netinet/tcp.h i_netinettcp
22772 eval $inhdr
22773
22774 : see if this is a poll.h system
22775 set poll.h i_poll
22776 eval $inhdr
22777
22778 : see if this is a prot.h system
22779 set prot.h i_prot
22780 eval $inhdr
22781
22782 : Preprocessor symbols
22783 echo " "
22784 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22785 $cat <<'EOSH' > Cppsym.know
22786 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22787 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22788 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22789 arch_pwr ardent ARM ARM32 atarist att386 att3b
22790 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22791 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22792 byteorder byte_order
22793 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22794 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22795 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22796 ELF encore EPI EXTENSIONS
22797 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22798 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22799 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22800 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22801 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22802 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22803 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22804 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22805 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22806 ksr1
22807 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22808 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22809 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22810 luna88k Lynx
22811 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22812 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22813 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22814 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22815 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22816 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22817 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22818 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22819 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22820 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22821 ns32000 ns32016 ns32332 ns32k nsc32000
22822 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22823 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22824 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22825 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22826 QK_USER QNX
22827 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22828 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22829 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22830 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22831 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22832 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22833 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22834 SYSV4 SYSV5 sysV68 sysV88
22835 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22836 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22837 tower32_800 tower32_850 tss
22838 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22839 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22840 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22841 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22842 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22843 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22844 uxpm uxps
22845 vax venix VMESA vms
22846 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22847 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22848 z8000 zarch
22849 EOSH
22850 # Maybe put other stuff here too.
22851 ./tr '-' '_' <<EOSH >>Cppsym.know
22852 $osname
22853 EOSH
22854 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22855 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22856 $cat Cppsym.know > Cppsym.c
22857 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22858 $rm -f Cppsym.a Cppsym.b Cppsym.c
22859 cat <<EOSH > Cppsym
22860 $startsh
22861 if $test \$# -gt 0; then
22862     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22863     if $test -s Cppsym.got; then
22864         $rm -f Cppsym.got
22865         exit 0
22866     fi
22867     $rm -f Cppsym.got
22868     exit 1
22869 else
22870     $tr " " "$trnl" | ./Cppsym.try
22871     exit 0
22872 fi
22873 EOSH
22874 chmod +x Cppsym
22875 $eunicefix Cppsym
22876 cat <<EOSH > Cppsym.try
22877 $startsh
22878 cat <<'EOCP' > try.c
22879 #include <stdio.h>
22880 #if cpp_stuff == 1
22881 #define STRINGIFY(a)    "a"
22882 #endif
22883 #if cpp_stuff == 42
22884 #define StGiFy(a)  #a
22885 #define STRINGIFY(a)    StGiFy(a)
22886 #endif
22887 #if $cpp_stuff != 1 && $cpp_stuff != 42
22888 #   include "Bletch: How does this C preprocessor stringify macros?"
22889 #endif
22890 int main() {
22891 EOCP
22892 $awk \\
22893 EOSH
22894 cat <<'EOSH' >> Cppsym.try
22895 'length($1) > 0 {
22896     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22897     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22898     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22899     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22900 }'       >> try.c
22901 echo 'return 0;}' >> try.c
22902 EOSH
22903 cat <<EOSH >> Cppsym.try
22904 ccflags="$ccflags"
22905 case "$osname-$gccversion" in
22906 irix-) ccflags="\$ccflags -woff 1178" ;;
22907 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22908 esac
22909 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22910 EOSH
22911 chmod +x Cppsym.try
22912 $eunicefix Cppsym.try
22913 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22914 : Add in any Linux cpp "predefined macros":
22915 case "$osname::$gccversion" in
22916   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22917     tHdrH=_tmpHdr
22918     rm -f $tHdrH'.h' $tHdrH
22919     touch $tHdrH'.h'
22920     # Filter out macro arguments, such as Linux's __INT8_C(c)
22921     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22922        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22923        if [ -s $tHdrH'_cppsym.real' ]; then
22924           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22925        fi
22926     fi
22927     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22928   ;;
22929 esac
22930 : now check the C compiler for additional symbols
22931 postprocess_cc_v=''
22932 case "$osname" in
22933 aix) postprocess_cc_v="|$tr , ' '" ;;
22934 esac
22935 $cat >ccsym <<EOS
22936 $startsh
22937 $cat >tmp.c <<EOF
22938 extern int foo;
22939 EOF
22940 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22941 do
22942         case "\$i" in
22943         -D*) echo "\$i" | $sed 's/^-D//';;
22944         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22945         esac
22946 done
22947 $rm_try
22948 EOS
22949 postprocess_cc_v=''
22950 chmod +x ccsym
22951 $eunicefix ccsym
22952 ./ccsym > ccsym1.raw
22953 if $test -s ccsym1.raw; then
22954     $sort ccsym1.raw | $uniq >ccsym.raw
22955 else
22956     mv ccsym1.raw ccsym.raw
22957 fi
22958
22959 $awk '/\=/ { print $0; next }
22960         { print $0"=1" }' ccsym.raw >ccsym.list
22961 $comm -13 Cppsym.true ccsym.list >ccsym.own
22962 $comm -12 Cppsym.true ccsym.list >ccsym.com
22963 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22964 also=''
22965 if $test -z ccsym.raw; then
22966         echo "Your C compiler doesn't seem to define any symbols!" >&4
22967         echo " "
22968         echo "However, your C preprocessor defines the following symbols:"
22969         $cat Cppsym.true
22970         ccsymbols=''
22971         cppsymbols=`$cat Cppsym.true`
22972         cppsymbols=`echo $cppsymbols`
22973         cppccsymbols="$cppsymbols"
22974 else
22975         if $test -s ccsym.com; then
22976                 echo "Your C compiler and pre-processor define these symbols:"
22977                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22978                 also='also '
22979                 symbols='ones'
22980                 cppccsymbols=`$cat ccsym.com`
22981                 cppccsymbols=`echo $cppccsymbols`
22982                 $test "$silent" || sleep 1
22983         fi
22984         if $test -s ccsym.cpp; then
22985                 $test "$also" && echo " "
22986                 echo "Your C pre-processor ${also}defines the following symbols:"
22987                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22988                 also='further '
22989                 cppsymbols=`$cat ccsym.cpp`
22990                 cppsymbols=`echo $cppsymbols`
22991                 $test "$silent" || sleep 1
22992         fi
22993         if $test -s ccsym.own; then
22994                 $test "$also" && echo " "
22995                 echo "Your C compiler ${also}defines the following cpp symbols:"
22996                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22997                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22998                 ccsymbols=`$cat ccsym.own`
22999                 ccsymbols=`echo $ccsymbols`
23000                 $test "$silent" || sleep 1
23001         fi
23002 fi
23003
23004 : add -D_FORTIFY_SOURCE if feasible and not already there
23005 case "$gccversion" in
23006 4.*)    case "$optimize$ccflags" in
23007         *-O*)   case "$ccflags$cppsymbols" in
23008                 *_FORTIFY_SOURCE=*) # Don't add it again.
23009                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
23010                         ;;
23011                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
23012                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
23013                         ;;
23014                 esac
23015                 ;;
23016         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
23017                 ;;
23018         esac
23019         ;;
23020 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
23021         ;;
23022 esac
23023
23024 : see if this is a termio system
23025 val="$undef"
23026 val2="$undef"
23027 val3="$undef"
23028 if $test `./findhdr termios.h`; then
23029     set tcsetattr i_termios
23030     eval $inlibc
23031     val3="$i_termios"
23032 fi
23033 echo " "
23034 case "$val3" in
23035     "$define") echo "You have POSIX termios.h... good!" >&4;;
23036     *)  if ./Cppsym pyr; then
23037             case "`$run /bin/universe`" in
23038                 ucb) if $test `./findhdr sgtty.h`; then
23039                         val2="$define"
23040                         echo "<sgtty.h> found." >&4
23041                     else
23042                         echo "System is pyramid with BSD universe."
23043                         ./warn "<sgtty.h> not found--you could have problems."
23044                     fi;;
23045                 *)  if $test `./findhdr termio.h`; then
23046                         val="$define"
23047                         echo "<termio.h> found." >&4
23048                     else
23049                         echo "System is pyramid with USG universe."
23050                         ./warn "<termio.h> not found--you could have problems."
23051                     fi;;
23052             esac
23053         elif ./usg; then
23054             if $test `./findhdr termio.h`; then
23055                 echo "<termio.h> found." >&4
23056                 val="$define"
23057             elif $test `./findhdr sgtty.h`; then
23058                 echo "<sgtty.h> found." >&4
23059                 val2="$define"
23060             else
23061                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
23062             fi
23063         else
23064             if $test `./findhdr sgtty.h`; then
23065                 echo "<sgtty.h> found." >&4
23066                 val2="$define"
23067             elif $test `./findhdr termio.h`; then
23068                 echo "<termio.h> found." >&4
23069                 val="$define"
23070             else
23071                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
23072             fi
23073         fi;;
23074 esac
23075 set i_termio; eval $setvar
23076 val=$val2; set i_sgtty; eval $setvar
23077 val=$val3; set i_termios; eval $setvar
23078
23079 : see if stdbool is available
23080 : we want a real compile instead of Inhdr because some Solaris systems
23081 : have stdbool.h, but it can only be used if the compiler indicates it
23082 : is sufficiently c99-compliant.
23083 echo " "
23084 $cat >try.c <<EOCP
23085 #include <stdio.h>
23086 #include <stdbool.h>
23087 int func(bool x)
23088 {
23089     return x ? 1 : 0;
23090 }
23091 int main(int argc, char **argv)
23092 {
23093     return func(0);
23094 }
23095 EOCP
23096 set try
23097 if eval $compile; then
23098         echo "<stdbool.h> found." >&4
23099         val="$define"
23100 else
23101         echo "<stdbool.h> NOT found." >&4
23102         val="$undef"
23103 fi
23104 $rm_try
23105 set i_stdbool
23106 eval $setvar
23107
23108 : see if stddef is available
23109 set stddef.h i_stddef
23110 eval $inhdr
23111
23112 : see if stdint is available
23113 set stdint.h i_stdint
23114 eval $inhdr
23115
23116 : see if sys/access.h is available
23117 set sys/access.h i_sysaccess
23118 eval $inhdr
23119
23120 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
23121 set sys/filio.h i_sysfilio
23122 eval $inhdr
23123 echo " "
23124 if $test `./findhdr sys/ioctl.h`; then
23125         val="$define"
23126         echo '<sys/ioctl.h> found.' >&4
23127 else
23128         val="$undef"
23129         if $test $i_sysfilio = "$define"; then
23130             echo '<sys/ioctl.h> NOT found.' >&4
23131         else
23132                 $test $i_sgtty = "$define" && xxx="sgtty.h"
23133                 $test $i_termio = "$define" && xxx="termio.h"
23134                 $test $i_termios = "$define" && xxx="termios.h"
23135 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
23136         fi
23137 fi
23138 set i_sysioctl
23139 eval $setvar
23140
23141 : see if socket ioctl defs are in sys/sockio.h
23142 echo " "
23143 xxx=`./findhdr sys/sockio.h`
23144 if $test "$xxx"; then
23145         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
23146                 val="$define"
23147                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
23148         else
23149                 val="$undef"
23150                 echo "No socket ioctls found in <sys/sockio.h>." >&4
23151         fi
23152 else
23153         val="$undef"
23154         $cat <<EOM
23155 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
23156 EOM
23157 fi
23158 set i_syssockio
23159 eval $setvar
23160
23161 : see if this is a syslog.h system
23162 set syslog.h i_syslog
23163 eval $inhdr
23164
23165 : see if this is a sys/mode.h system
23166 set sys/mode.h i_sysmode
23167 eval $inhdr
23168
23169 : see if there is a sys/poll.h file
23170 set sys/poll.h i_syspoll
23171 eval $inhdr
23172
23173 : see if sys/resource.h has to be included
23174 set sys/resource.h i_sysresrc
23175 eval $inhdr
23176
23177 : see if sys/security.h is available
23178 set sys/security.h i_syssecrt
23179 eval $inhdr
23180
23181 : see if this is a sys/statvfs.h system
23182 set sys/statvfs.h i_sysstatvfs
23183 eval $inhdr
23184
23185 : see if this is a sys/un.h system
23186 set sys/un.h i_sysun
23187 eval $inhdr
23188
23189 : see if this is a sys/utsname.h system
23190 set sys/utsname.h i_sysutsname
23191 eval $inhdr
23192
23193 : see if this is a syswait system
23194 set sys/wait.h i_syswait
23195 eval $inhdr
23196
23197 : see if this is a ustat.h system
23198 set ustat.h i_ustat
23199 eval $inhdr
23200
23201 : see if this is an utime system
23202 set utime.h i_utime
23203 eval $inhdr
23204
23205 : see if this is a vfork system
23206 case "$d_vfork" in
23207 "$define")
23208         set vfork.h i_vfork
23209         eval $inhdr
23210         ;;
23211 *)
23212         i_vfork="$undef"
23213         ;;
23214 esac
23215
23216 : Check extensions
23217 echo " "
23218 echo "Looking for extensions..." >&4
23219 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
23220 : contain old or inaccurate or duplicate values.
23221 nonxs_extensions=''
23222 xs_extensions=''
23223 : We do not use find because it might not be available.
23224 : We do not just use MANIFEST because the user may have dropped
23225 : some additional extensions into the source tree and expect them
23226 : to be built.
23227
23228 : Function to recursively find available extensions, ignoring DynaLoader
23229 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
23230 : In 5.10.1 and later, extensions are stored in directories
23231 : like File-Glob instead of the older File/Glob/.
23232 find_extensions='
23233     for xxx in *; do
23234         case "$xxx" in
23235             DynaLoader|dynaload) ;;
23236             *)
23237             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
23238             case "$this_ext" in
23239                 Scalar/List/Utils) this_ext="List/Util" ;;
23240                 PathTools)         this_ext="Cwd"       ;;
23241             esac;
23242             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
23243             if $contains " $this_ext " $tdir/$$.tmp; then
23244                 echo >&4;
23245                 echo "Duplicate directories detected for extension $xxx" >&4;
23246                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23247                 case "$knowitall" in
23248                 "") dflt=y;;
23249                 *) dflt=n;;
23250                 esac;
23251                 . ../UU/myread;
23252                 case "$ans" in
23253                 n*|N*) ;;
23254                 *) echo >&4;
23255                     echo "Ok.  Stopping Configure." >&4;
23256                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23257                     exit 1;;
23258                 esac;
23259                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23260             fi;
23261             $ls -1 $xxx > $tdir/$$.tmp;
23262             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
23263                 xs_extensions="$xs_extensions $this_ext";
23264             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
23265                 xs_extensions="$xs_extensions $this_ext";
23266             elif $test -d $xxx; then
23267                 nonxs_extensions="$nonxs_extensions $this_ext";
23268             fi;
23269             $rm -f $tdir/$$.tmp;
23270             ;;
23271         esac;
23272     done'
23273 tdir=`pwd`
23274 cd "$rsrc/cpan"
23275 set X
23276 shift
23277 eval $find_extensions
23278 cd "$rsrc/dist"
23279 set X
23280 shift
23281 eval $find_extensions
23282 cd "$rsrc/ext"
23283 set X
23284 shift
23285 eval $find_extensions
23286 set X $xs_extensions
23287 shift
23288 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23289 set X $nonxs_extensions
23290 shift
23291 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23292 cd "$tdir"
23293 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23294
23295 : Now see which are supported on this system.
23296 avail_ext=''
23297 for xxx in $xs_extensions ; do
23298         case "$xxx" in
23299         DB_File|db_file)
23300                 case "$i_db" in
23301                 $define) avail_ext="$avail_ext $xxx" ;;
23302                 esac
23303                 ;;
23304         GDBM_File|gdbm_fil)
23305                 case "$i_gdbm" in
23306                 $define) avail_ext="$avail_ext $xxx" ;;
23307                 esac
23308                 ;;
23309         I18N/Langinfo|i18n_lan)
23310                 case "$i_langinfo$d_nl_langinfo" in
23311                 $define$define) avail_ext="$avail_ext $xxx" ;;
23312                 esac
23313                 ;;
23314         IPC/SysV|ipc/sysv)
23315                 : XXX Do we need a useipcsysv variable here
23316                 case "${d_msg}${d_sem}${d_shm}" in
23317                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23318                 esac
23319                 ;;
23320         NDBM_File|ndbm_fil)
23321                 case "$d_ndbm" in
23322                 $define)
23323                     case "$osname-$use64bitint" in
23324                     hpux-define)
23325                         case "$libs" in
23326                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23327                         esac
23328                         ;;
23329                     *) avail_ext="$avail_ext $xxx" ;;
23330                     esac
23331                     ;;
23332                 esac
23333                 ;;
23334         ODBM_File|odbm_fil)
23335                 case "${i_dbm}${i_rpcsvcdbm}" in
23336                 *"${define}"*)
23337                     case "$d_cplusplus" in
23338                     define) ;; # delete as a function name will not work
23339                     *)  case "$osname-$use64bitint" in
23340                         hpux-define)
23341                             case "$libs" in
23342                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23343                             esac
23344                             ;;
23345                         *) avail_ext="$avail_ext $xxx" ;;
23346                         esac
23347                         ;;
23348                     esac
23349                     ;;
23350                 esac
23351                 ;;
23352         Opcode|opcode)
23353                 case "$useopcode" in
23354                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23355                 esac
23356                 ;;
23357         POSIX|posix)
23358                 case "$useposix" in
23359                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23360                 esac
23361                 ;;
23362         Socket|socket)
23363                 case "$d_socket" in
23364                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23365                 esac
23366                 ;;
23367         Sys/Syslog|sys/syslog)
23368                 : XXX syslog requires socket
23369                 case "$d_socket" in
23370                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23371                 esac
23372                 ;;
23373         Thread|thread)
23374                 case "$usethreads" in
23375                 true|$define|y)
23376                         case "$use5005threads" in
23377                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23378                         esac
23379                 esac
23380                 ;;
23381         threads|threads/shared)
23382                 # threads and threads::shared are special cases.
23383                 # To stop people from asking "Perl 5.8.0 was supposed
23384                 # to have this new fancy threads implementation but my
23385                 # perl doesn't have it" and from people trying to
23386                 # (re)install the threads module using CPAN.pm and
23387                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23388                 # the threads.pm and threads/shared.pm will always be
23389                 # there, croaking informatively ("you need to rebuild
23390                 # all of Perl with threads, sorry") when threads haven't
23391                 # been compiled in.
23392                 # --jhi
23393                 avail_ext="$avail_ext $xxx"
23394                 ;;
23395         VMS*)
23396                 ;;
23397         Win32*)
23398                 case "$osname" in
23399                 cygwin) avail_ext="$avail_ext $xxx" ;;
23400                 esac
23401                 ;;
23402         XS/APItest|xs/apitest)
23403                 # This is just for testing.  Skip it unless we have dynamic loading.
23404
23405                 case "$usedl" in
23406                 $define) avail_ext="$avail_ext $xxx" ;;
23407                 esac
23408                 ;;
23409         XS/Typemap|xs/typemap)
23410                 # This is just for testing.  Skip it unless we have dynamic loading.
23411                 case "$usedl" in
23412                 $define) avail_ext="$avail_ext $xxx" ;;
23413                 esac
23414                 ;;
23415         *)      avail_ext="$avail_ext $xxx"
23416                 ;;
23417         esac
23418 done
23419
23420 set X $avail_ext
23421 shift
23422 avail_ext="$*"
23423
23424 case "$onlyextensions" in
23425 '') ;;
23426 *)  keepextensions=''
23427     echo "You have requested that only certain extensions be included..." >&4
23428     for i in $onlyextensions; do
23429         case " $avail_ext " in
23430         *" $i "*)
23431             echo "Keeping extension $i."
23432             keepextensions="$keepextensions $i"
23433             ;;
23434         *) echo "Ignoring extension $i." ;;
23435         esac
23436     done
23437     avail_ext="$keepextensions"
23438     ;;
23439 esac
23440
23441 case "$noextensions" in
23442 '') ;;
23443 *)  keepextensions=''
23444     echo "You have requested that certain extensions be ignored..." >&4
23445     for i in $avail_ext; do
23446         case " $noextensions " in
23447         *" $i "*) echo "Ignoring extension $i." ;;
23448         *) echo "Keeping extension $i.";
23449            keepextensions="$keepextensions $i"
23450            ;;
23451         esac
23452     done
23453     avail_ext="$keepextensions"
23454     ;;
23455 esac
23456
23457 : Now see which nonxs extensions are supported on this system.
23458 : For now assume all are.
23459 nonxs_ext=''
23460 for xxx in $nonxs_extensions ; do
23461         case "$xxx" in
23462         VMS*)
23463                 ;;
23464         *)      nonxs_ext="$nonxs_ext $xxx"
23465                 ;;
23466         esac
23467 done
23468
23469 set X $nonxs_ext
23470 shift
23471 nonxs_ext="$*"
23472
23473 case $usedl in
23474 $define)
23475         $cat <<EOM
23476 A number of extensions are supplied with $package.  You may choose to
23477 compile these extensions for dynamic loading (the default), compile
23478 them into the $package executable (static loading), or not include
23479 them at all.  Answer "none" to include no extensions.
23480 Note that DynaLoader is always built and need not be mentioned here.
23481
23482 EOM
23483         case "$dynamic_ext" in
23484         '')
23485                 : Exclude those listed in static_ext
23486                 dflt=''
23487                 for xxx in $avail_ext; do
23488                         case " $static_ext " in
23489                         *" $xxx "*) ;;
23490                         *) dflt="$dflt $xxx" ;;
23491                         esac
23492                 done
23493                 set X $dflt
23494                 shift
23495                 dflt="$*"
23496                 ;;
23497         *)      dflt="$dynamic_ext"
23498                 # Perhaps we are reusing an old out-of-date config.sh.
23499                 case "$hint" in
23500                 previous)
23501                         if test X"$dynamic_ext" != X"$avail_ext"; then
23502                                 $cat <<EOM
23503 NOTICE:  Your previous config.sh list may be incorrect.
23504 The extensions now available to you are
23505         ${avail_ext}
23506 but the default list from your previous config.sh is
23507         ${dynamic_ext}
23508
23509 EOM
23510                         fi
23511                         ;;
23512                 esac
23513                 ;;
23514         esac
23515         case "$dflt" in
23516         '')     dflt=none;;
23517         esac
23518         rp="What extensions do you wish to load dynamically?"
23519         . ./myread
23520         case "$ans" in
23521         none) dynamic_ext=' ' ;;
23522         *) dynamic_ext="$ans" ;;
23523         esac
23524
23525         case "$static_ext" in
23526         '')
23527                 : Exclude those already listed in dynamic linking
23528                 dflt=''
23529                 for xxx in $avail_ext; do
23530                         case " $dynamic_ext " in
23531                         *" $xxx "*) ;;
23532                         *) dflt="$dflt $xxx" ;;
23533                         esac
23534                 done
23535                 set X $dflt
23536                 shift
23537                 dflt="$*"
23538                 ;;
23539         *)  dflt="$static_ext"
23540                 ;;
23541         esac
23542
23543         case "$dflt" in
23544         '')     dflt=none;;
23545         esac
23546         rp="What extensions do you wish to load statically?"
23547         . ./myread
23548         case "$ans" in
23549         none) static_ext=' ' ;;
23550         *) static_ext="$ans" ;;
23551         esac
23552         ;;
23553 *)
23554         $cat <<EOM
23555 A number of extensions are supplied with $package.  Answer "none"
23556 to include no extensions.
23557 Note that DynaLoader is always built and need not be mentioned here.
23558
23559 EOM
23560         case "$static_ext" in
23561         '') dflt="$avail_ext" ;;
23562         *)      dflt="$static_ext"
23563                 # Perhaps we are reusing an old out-of-date config.sh.
23564                 case "$hint" in
23565                 previous)
23566                         if test X"$static_ext" != X"$avail_ext"; then
23567                                 $cat <<EOM
23568 NOTICE:  Your previous config.sh list may be incorrect.
23569 The extensions now available to you are
23570         ${avail_ext}
23571 but the default list from your previous config.sh is
23572         ${static_ext}
23573
23574 EOM
23575                         fi
23576                         ;;
23577                 esac
23578                 ;;
23579         esac
23580         : Exclude those that are not xs extensions
23581         case "$dflt" in
23582         '')     dflt=none;;
23583         esac
23584         rp="What extensions do you wish to include?"
23585         . ./myread
23586         case "$ans" in
23587         none) static_ext=' ' ;;
23588         *) static_ext="$ans" ;;
23589         esac
23590         ;;
23591 esac
23592 #
23593 # Encode is a special case.  If we are building Encode as a static
23594 # extension, we need to explicitly list its subextensions as well.
23595 # For other nested extensions, this is handled automatically by
23596 # the appropriate Makefile.PL.
23597 case " $static_ext " in
23598         *" Encode "*) # Add the subextensions of Encode
23599         cd "$rsrc/cpan"
23600         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23601                 static_ext="$static_ext Encode/$xxx"
23602                 known_extensions="$known_extensions Encode/$xxx"
23603         done
23604         cd "$tdir"
23605         ;;
23606 esac
23607
23608 set X $dynamic_ext $static_ext $nonxs_ext
23609 shift
23610 extensions="$*"
23611
23612 # Sanity check:  We require an extension suitable for use with
23613 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23614 # should show up as failures in the test suite, but it's helpful to
23615 # catch them now.) The 'extensions' list is normally sorted
23616 # alphabetically, so we need to accept either
23617 #    DB_File ... Fcntl ... IO  ....
23618 # or something like
23619 #    Fcntl ... NDBM_File ... IO  ....
23620 case " $extensions"  in
23621 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23622 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23623 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23624 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23625    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23626    ;;
23627 esac
23628
23629 : Remove libraries needed only for extensions
23630 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23631 : The exception is SunOS 4.x, which needs them.
23632 case "${osname}X${osvers}" in
23633 sunos*X4*)
23634     perllibs="$libs"
23635     ;;
23636 *) case "$usedl" in
23637     $define|true|[yY]*)
23638             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23639             shift
23640             perllibs="$*"
23641             ;;
23642     *)  perllibs="$libs"
23643             ;;
23644     esac
23645     ;;
23646 esac
23647
23648 : Remove build directory name from cppstdin so it can be used from
23649 : either the present location or the final installed location.
23650 echo " "
23651 : Get out of the UU directory to get correct path name.
23652 cd ..
23653 case "$cppstdin" in
23654 `pwd`/cppstdin)
23655         echo "Stripping down cppstdin path name"
23656         cppstdin=cppstdin
23657         ;;
23658 esac
23659 cd UU
23660
23661 : end of configuration questions
23662 echo " "
23663 echo "End of configuration questions."
23664 echo " "
23665
23666 : back to where it started
23667 if test -d ../UU; then
23668         cd ..
23669 fi
23670
23671 : configuration may be unconditionally patched via a 'config.arch' file
23672 if $test -f config.arch; then
23673         echo "I see a config.arch file, loading it." >&4
23674         . ./config.arch
23675 fi
23676
23677 : configuration may be patched via a 'config.over' file
23678 if $test -f config.over; then
23679         echo " "
23680         dflt=y
23681         rp='I see a config.over file.  Do you wish to load it?'
23682         . UU/myread
23683         case "$ans" in
23684         n*) echo "OK, I'll ignore it.";;
23685         *)      . ./config.over
23686                 echo "Configuration override changes have been loaded."
23687                 ;;
23688         esac
23689 fi
23690
23691 : in case they want portability, strip down executable paths
23692 case "$d_portable" in
23693 "$define")
23694         echo " "
23695         echo "Stripping down executable paths..." >&4
23696         for file in $loclist $trylist; do
23697                 eval temp=\$$file
23698                 eval $file=`basename $temp`
23699         done
23700         ;;
23701 esac
23702
23703 : create config.sh file
23704 echo " "
23705 echo "Creating config.sh..." >&4
23706 $spitshell <<EOT >config.sh
23707 $startsh
23708 #
23709 # This file was produced by running the Configure script. It holds all the
23710 # definitions figured out by Configure. Should you modify one of these values,
23711 # do not forget to propagate your changes by running "Configure -der". You may
23712 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23713 #
23714
23715 # Package name      : $package
23716 # Source directory  : $src
23717 # Configuration time: $cf_time
23718 # Configured by     : $cf_by
23719 # Target system     : $myuname
23720
23721 EOT
23722 : Add in command line options if available
23723 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23724
23725 $spitshell <<EOT >>config.sh
23726
23727 Author='$Author'
23728 Date='$Date'
23729 Header='$Header'
23730 Id='$Id'
23731 Locker='$Locker'
23732 Log='$Log'
23733 RCSfile='$RCSfile'
23734 Revision='$Revision'
23735 Source='$Source'
23736 State='$State'
23737 _a='$_a'
23738 _exe='$_exe'
23739 _o='$_o'
23740 afs='$afs'
23741 afsroot='$afsroot'
23742 alignbytes='$alignbytes'
23743 ansi2knr='$ansi2knr'
23744 aphostname='$aphostname'
23745 api_revision='$api_revision'
23746 api_subversion='$api_subversion'
23747 api_version='$api_version'
23748 api_versionstring='$api_versionstring'
23749 ar='$ar'
23750 archlib='$archlib'
23751 archlibexp='$archlibexp'
23752 archname64='$archname64'
23753 archname='$archname'
23754 archobjs='$archobjs'
23755 asctime_r_proto='$asctime_r_proto'
23756 awk='$awk'
23757 baserev='$baserev'
23758 bash='$bash'
23759 bin='$bin'
23760 bin_ELF='$bin_ELF'
23761 binexp='$binexp'
23762 bison='$bison'
23763 byacc='$byacc'
23764 byteorder='$byteorder'
23765 c='$c'
23766 castflags='$castflags'
23767 cat='$cat'
23768 cc='$cc'
23769 cccdlflags='$cccdlflags'
23770 ccdlflags='$ccdlflags'
23771 ccflags='$ccflags'
23772 ccflags_uselargefiles='$ccflags_uselargefiles'
23773 ccname='$ccname'
23774 ccsymbols='$ccsymbols'
23775 ccversion='$ccversion'
23776 cf_by='$cf_by'
23777 cf_email='$cf_email'
23778 cf_time='$cf_time'
23779 charbits='$charbits'
23780 charsize='$charsize'
23781 chgrp='$chgrp'
23782 chmod='$chmod'
23783 chown='$chown'
23784 clocktype='$clocktype'
23785 comm='$comm'
23786 compress='$compress'
23787 contains='$contains'
23788 cp='$cp'
23789 cpio='$cpio'
23790 cpp='$cpp'
23791 cpp_stuff='$cpp_stuff'
23792 cppccsymbols='$cppccsymbols'
23793 cppflags='$cppflags'
23794 cpplast='$cpplast'
23795 cppminus='$cppminus'
23796 cpprun='$cpprun'
23797 cppstdin='$cppstdin'
23798 cppsymbols='$cppsymbols'
23799 crypt_r_proto='$crypt_r_proto'
23800 cryptlib='$cryptlib'
23801 csh='$csh'
23802 ctermid_r_proto='$ctermid_r_proto'
23803 ctime_r_proto='$ctime_r_proto'
23804 d_Gconvert='$d_Gconvert'
23805 d_PRIEUldbl='$d_PRIEUldbl'
23806 d_PRIFUldbl='$d_PRIFUldbl'
23807 d_PRIGUldbl='$d_PRIGUldbl'
23808 d_PRIXU64='$d_PRIXU64'
23809 d_PRId64='$d_PRId64'
23810 d_PRIeldbl='$d_PRIeldbl'
23811 d_PRIfldbl='$d_PRIfldbl'
23812 d_PRIgldbl='$d_PRIgldbl'
23813 d_PRIi64='$d_PRIi64'
23814 d_PRIo64='$d_PRIo64'
23815 d_PRIu64='$d_PRIu64'
23816 d_PRIx64='$d_PRIx64'
23817 d_SCNfldbl='$d_SCNfldbl'
23818 d__fwalk='$d__fwalk'
23819 d_access='$d_access'
23820 d_accessx='$d_accessx'
23821 d_acosh='$d_acosh'
23822 d_aintl='$d_aintl'
23823 d_alarm='$d_alarm'
23824 d_archlib='$d_archlib'
23825 d_asctime64='$d_asctime64'
23826 d_asctime_r='$d_asctime_r'
23827 d_asinh='$d_asinh'
23828 d_atanh='$d_atanh'
23829 d_atolf='$d_atolf'
23830 d_atoll='$d_atoll'
23831 d_attribute_deprecated='$d_attribute_deprecated'
23832 d_attribute_format='$d_attribute_format'
23833 d_attribute_malloc='$d_attribute_malloc'
23834 d_attribute_nonnull='$d_attribute_nonnull'
23835 d_attribute_noreturn='$d_attribute_noreturn'
23836 d_attribute_pure='$d_attribute_pure'
23837 d_attribute_unused='$d_attribute_unused'
23838 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23839 d_backtrace='$d_backtrace'
23840 d_bcmp='$d_bcmp'
23841 d_bcopy='$d_bcopy'
23842 d_bsd='$d_bsd'
23843 d_bsdgetpgrp='$d_bsdgetpgrp'
23844 d_bsdsetpgrp='$d_bsdsetpgrp'
23845 d_builtin_choose_expr='$d_builtin_choose_expr'
23846 d_builtin_expect='$d_builtin_expect'
23847 d_bzero='$d_bzero'
23848 d_c99_variadic_macros='$d_c99_variadic_macros'
23849 d_casti32='$d_casti32'
23850 d_castneg='$d_castneg'
23851 d_cbrt='$d_cbrt'
23852 d_charvspr='$d_charvspr'
23853 d_chown='$d_chown'
23854 d_chroot='$d_chroot'
23855 d_chsize='$d_chsize'
23856 d_class='$d_class'
23857 d_clearenv='$d_clearenv'
23858 d_closedir='$d_closedir'
23859 d_cmsghdr_s='$d_cmsghdr_s'
23860 d_const='$d_const'
23861 d_copysign='$d_copysign'
23862 d_copysignl='$d_copysignl'
23863 d_cplusplus='$d_cplusplus'
23864 d_crypt='$d_crypt'
23865 d_crypt_r='$d_crypt_r'
23866 d_csh='$d_csh'
23867 d_ctermid='$d_ctermid'
23868 d_ctermid_r='$d_ctermid_r'
23869 d_ctime64='$d_ctime64'
23870 d_ctime_r='$d_ctime_r'
23871 d_cuserid='$d_cuserid'
23872 d_dbl_dig='$d_dbl_dig'
23873 d_dbminitproto='$d_dbminitproto'
23874 d_difftime64='$d_difftime64'
23875 d_difftime='$d_difftime'
23876 d_dir_dd_fd='$d_dir_dd_fd'
23877 d_dirfd='$d_dirfd'
23878 d_dirnamlen='$d_dirnamlen'
23879 d_dladdr='$d_dladdr'
23880 d_dlerror='$d_dlerror'
23881 d_dlopen='$d_dlopen'
23882 d_dlsymun='$d_dlsymun'
23883 d_dosuid='$d_dosuid'
23884 d_drand48_r='$d_drand48_r'
23885 d_drand48proto='$d_drand48proto'
23886 d_dup2='$d_dup2'
23887 d_eaccess='$d_eaccess'
23888 d_endgrent='$d_endgrent'
23889 d_endgrent_r='$d_endgrent_r'
23890 d_endhent='$d_endhent'
23891 d_endhostent_r='$d_endhostent_r'
23892 d_endnent='$d_endnent'
23893 d_endnetent_r='$d_endnetent_r'
23894 d_endpent='$d_endpent'
23895 d_endprotoent_r='$d_endprotoent_r'
23896 d_endpwent='$d_endpwent'
23897 d_endpwent_r='$d_endpwent_r'
23898 d_endsent='$d_endsent'
23899 d_endservent_r='$d_endservent_r'
23900 d_eofnblk='$d_eofnblk'
23901 d_erf='$d_erf'
23902 d_erfc='$d_erfc'
23903 d_eunice='$d_eunice'
23904 d_exp2='$d_exp2'
23905 d_expm1='$d_expm1'
23906 d_faststdio='$d_faststdio'
23907 d_fchdir='$d_fchdir'
23908 d_fchmod='$d_fchmod'
23909 d_fchown='$d_fchown'
23910 d_fcntl='$d_fcntl'
23911 d_fcntl_can_lock='$d_fcntl_can_lock'
23912 d_fd_macros='$d_fd_macros'
23913 d_fd_set='$d_fd_set'
23914 d_fdim='$d_fdim'
23915 d_fds_bits='$d_fds_bits'
23916 d_fegetround='$d_fegetround'
23917 d_fgetpos='$d_fgetpos'
23918 d_finite='$d_finite'
23919 d_finitel='$d_finitel'
23920 d_flexfnam='$d_flexfnam'
23921 d_flock='$d_flock'
23922 d_flockproto='$d_flockproto'
23923 d_fma='$d_fma'
23924 d_fmax='$d_fmax'
23925 d_fmin='$d_fmin'
23926 d_fork='$d_fork'
23927 d_fp_class='$d_fp_class'
23928 d_fp_classify='$d_fp_classify'
23929 d_fp_classl='$d_fp_classl'
23930 d_fpathconf='$d_fpathconf'
23931 d_fpclass='$d_fpclass'
23932 d_fpclassify='$d_fpclassify'
23933 d_fpclassl='$d_fpclassl'
23934 d_fpgetround='$d_fpgetround'
23935 d_fpos64_t='$d_fpos64_t'
23936 d_frexpl='$d_frexpl'
23937 d_fs_data_s='$d_fs_data_s'
23938 d_fseeko='$d_fseeko'
23939 d_fsetpos='$d_fsetpos'
23940 d_fstatfs='$d_fstatfs'
23941 d_fstatvfs='$d_fstatvfs'
23942 d_fsync='$d_fsync'
23943 d_ftello='$d_ftello'
23944 d_ftime='$d_ftime'
23945 d_futimes='$d_futimes'
23946 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23947 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23948 d_getaddrinfo='$d_getaddrinfo'
23949 d_getcwd='$d_getcwd'
23950 d_getespwnam='$d_getespwnam'
23951 d_getfsstat='$d_getfsstat'
23952 d_getgrent='$d_getgrent'
23953 d_getgrent_r='$d_getgrent_r'
23954 d_getgrgid_r='$d_getgrgid_r'
23955 d_getgrnam_r='$d_getgrnam_r'
23956 d_getgrps='$d_getgrps'
23957 d_gethbyaddr='$d_gethbyaddr'
23958 d_gethbyname='$d_gethbyname'
23959 d_gethent='$d_gethent'
23960 d_gethname='$d_gethname'
23961 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23962 d_gethostbyname_r='$d_gethostbyname_r'
23963 d_gethostent_r='$d_gethostent_r'
23964 d_gethostprotos='$d_gethostprotos'
23965 d_getitimer='$d_getitimer'
23966 d_getlogin='$d_getlogin'
23967 d_getlogin_r='$d_getlogin_r'
23968 d_getmnt='$d_getmnt'
23969 d_getmntent='$d_getmntent'
23970 d_getnameinfo='$d_getnameinfo'
23971 d_getnbyaddr='$d_getnbyaddr'
23972 d_getnbyname='$d_getnbyname'
23973 d_getnent='$d_getnent'
23974 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23975 d_getnetbyname_r='$d_getnetbyname_r'
23976 d_getnetent_r='$d_getnetent_r'
23977 d_getnetprotos='$d_getnetprotos'
23978 d_getpagsz='$d_getpagsz'
23979 d_getpbyname='$d_getpbyname'
23980 d_getpbynumber='$d_getpbynumber'
23981 d_getpent='$d_getpent'
23982 d_getpgid='$d_getpgid'
23983 d_getpgrp2='$d_getpgrp2'
23984 d_getpgrp='$d_getpgrp'
23985 d_getppid='$d_getppid'
23986 d_getprior='$d_getprior'
23987 d_getprotobyname_r='$d_getprotobyname_r'
23988 d_getprotobynumber_r='$d_getprotobynumber_r'
23989 d_getprotoent_r='$d_getprotoent_r'
23990 d_getprotoprotos='$d_getprotoprotos'
23991 d_getprpwnam='$d_getprpwnam'
23992 d_getpwent='$d_getpwent'
23993 d_getpwent_r='$d_getpwent_r'
23994 d_getpwnam_r='$d_getpwnam_r'
23995 d_getpwuid_r='$d_getpwuid_r'
23996 d_getsbyname='$d_getsbyname'
23997 d_getsbyport='$d_getsbyport'
23998 d_getsent='$d_getsent'
23999 d_getservbyname_r='$d_getservbyname_r'
24000 d_getservbyport_r='$d_getservbyport_r'
24001 d_getservent_r='$d_getservent_r'
24002 d_getservprotos='$d_getservprotos'
24003 d_getspnam='$d_getspnam'
24004 d_getspnam_r='$d_getspnam_r'
24005 d_gettimeod='$d_gettimeod'
24006 d_gmtime64='$d_gmtime64'
24007 d_gmtime_r='$d_gmtime_r'
24008 d_gnulibc='$d_gnulibc'
24009 d_grpasswd='$d_grpasswd'
24010 d_hasmntopt='$d_hasmntopt'
24011 d_htonl='$d_htonl'
24012 d_hypot='$d_hypot'
24013 d_ilogb='$d_ilogb'
24014 d_ilogbl='$d_ilogbl'
24015 d_inc_version_list='$d_inc_version_list'
24016 d_index='$d_index'
24017 d_inetaton='$d_inetaton'
24018 d_inetntop='$d_inetntop'
24019 d_inetpton='$d_inetpton'
24020 d_int64_t='$d_int64_t'
24021 d_ip_mreq='$d_ip_mreq'
24022 d_ip_mreq_source='$d_ip_mreq_source'
24023 d_ipv6_mreq='$d_ipv6_mreq'
24024 d_ipv6_mreq_source='$d_ipv6_mreq_source'
24025 d_isascii='$d_isascii'
24026 d_isblank='$d_isblank'
24027 d_isfinite='$d_isfinite'
24028 d_isfinitel='$d_isfinitel'
24029 d_isinf='$d_isinf'
24030 d_isinfl='$d_isinfl'
24031 d_isnan='$d_isnan'
24032 d_isnanl='$d_isnanl'
24033 d_isnormal='$d_isnormal'
24034 d_j0='$d_j0'
24035 d_j0l='$d_j0l'
24036 d_killpg='$d_killpg'
24037 d_lchown='$d_lchown'
24038 d_lc_monetary_2008='$d_lc_monetary_2008'
24039 d_ldbl_dig='$d_ldbl_dig'
24040 d_ldexpl='$d_ldexpl'
24041 d_lgamma='$d_lgamma'
24042 d_lgamma_r='$d_lgamma_r'
24043 d_libm_lib_version='$d_libm_lib_version'
24044 d_libname_unique='$d_libname_unique'
24045 d_link='$d_link'
24046 d_llrint='$d_llrint'
24047 d_llround='$d_llround'
24048 d_localtime64='$d_localtime64'
24049 d_localtime_r='$d_localtime_r'
24050 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
24051 d_locconv='$d_locconv'
24052 d_lgamma='$d_lgamma'
24053 d_lockf='$d_lockf'
24054 d_log1p='$d_log1p'
24055 d_log2='$d_log2'
24056 d_logb='$d_logb'
24057 d_longdbl='$d_longdbl'
24058 d_longlong='$d_longlong'
24059 d_lrint='$d_lrint'
24060 d_lround='$d_lround'
24061 d_lseekproto='$d_lseekproto'
24062 d_lstat='$d_lstat'
24063 d_madvise='$d_madvise'
24064 d_malloc_good_size='$d_malloc_good_size'
24065 d_malloc_size='$d_malloc_size'
24066 d_mblen='$d_mblen'
24067 d_mbstowcs='$d_mbstowcs'
24068 d_mbtowc='$d_mbtowc'
24069 d_memchr='$d_memchr'
24070 d_memcmp='$d_memcmp'
24071 d_memcpy='$d_memcpy'
24072 d_memmove='$d_memmove'
24073 d_memset='$d_memset'
24074 d_mkdir='$d_mkdir'
24075 d_mkdtemp='$d_mkdtemp'
24076 d_mkfifo='$d_mkfifo'
24077 d_mkstemp='$d_mkstemp'
24078 d_mkstemps='$d_mkstemps'
24079 d_mktime64='$d_mktime64'
24080 d_mktime='$d_mktime'
24081 d_mmap='$d_mmap'
24082 d_modfl='$d_modfl'
24083 d_modfl_pow32_bug='$d_modfl_pow32_bug'
24084 d_modflproto='$d_modflproto'
24085 d_mprotect='$d_mprotect'
24086 d_msg='$d_msg'
24087 d_msg_ctrunc='$d_msg_ctrunc'
24088 d_msg_dontroute='$d_msg_dontroute'
24089 d_msg_oob='$d_msg_oob'
24090 d_msg_peek='$d_msg_peek'
24091 d_msg_proxy='$d_msg_proxy'
24092 d_msgctl='$d_msgctl'
24093 d_msgget='$d_msgget'
24094 d_msghdr_s='$d_msghdr_s'
24095 d_msgrcv='$d_msgrcv'
24096 d_msgsnd='$d_msgsnd'
24097 d_msync='$d_msync'
24098 d_munmap='$d_munmap'
24099 d_mymalloc='$d_mymalloc'
24100 d_nan='$d_nan'
24101 d_ndbm='$d_ndbm'
24102 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
24103 d_nearbyint='$d_nearbyint'
24104 d_nextafter='$d_nextafter'
24105 d_nexttoward='$d_nexttoward'
24106 d_nice='$d_nice'
24107 d_nl_langinfo='$d_nl_langinfo'
24108 d_nv_preserves_uv='$d_nv_preserves_uv'
24109 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
24110 d_off64_t='$d_off64_t'
24111 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
24112 d_oldpthreads='$d_oldpthreads'
24113 d_oldsock='$d_oldsock'
24114 d_open3='$d_open3'
24115 d_pathconf='$d_pathconf'
24116 d_pause='$d_pause'
24117 d_perl_otherlibdirs='$d_perl_otherlibdirs'
24118 d_phostname='$d_phostname'
24119 d_pipe='$d_pipe'
24120 d_poll='$d_poll'
24121 d_portable='$d_portable'
24122 d_prctl='$d_prctl'
24123 d_prctl_set_name='$d_prctl_set_name'
24124 d_printf_format_null='$d_printf_format_null'
24125 d_procselfexe='$d_procselfexe'
24126 d_pseudofork='$d_pseudofork'
24127 d_pthread_atfork='$d_pthread_atfork'
24128 d_pthread_attr_setscope='$d_pthread_attr_setscope'
24129 d_pthread_yield='$d_pthread_yield'
24130 d_ptrdiff_t='$d_ptrdiff_t'
24131 d_pwage='$d_pwage'
24132 d_pwchange='$d_pwchange'
24133 d_pwclass='$d_pwclass'
24134 d_pwcomment='$d_pwcomment'
24135 d_pwexpire='$d_pwexpire'
24136 d_pwgecos='$d_pwgecos'
24137 d_pwpasswd='$d_pwpasswd'
24138 d_pwquota='$d_pwquota'
24139 d_qgcvt='$d_qgcvt'
24140 d_quad='$d_quad'
24141 d_random_r='$d_random_r'
24142 d_readdir64_r='$d_readdir64_r'
24143 d_readdir='$d_readdir'
24144 d_readdir_r='$d_readdir_r'
24145 d_readlink='$d_readlink'
24146 d_readv='$d_readv'
24147 d_recvmsg='$d_recvmsg'
24148 d_remainder='$d_remainder'
24149 d_remquo='$d_remquo'
24150 d_rename='$d_rename'
24151 d_rewinddir='$d_rewinddir'
24152 d_rint='$d_rint'
24153 d_rmdir='$d_rmdir'
24154 d_round='$d_round'
24155 d_safebcpy='$d_safebcpy'
24156 d_safemcpy='$d_safemcpy'
24157 d_sanemcmp='$d_sanemcmp'
24158 d_sbrkproto='$d_sbrkproto'
24159 d_scalbn='$d_scalbn'
24160 d_scalbnl='$d_scalbnl'
24161 d_sched_yield='$d_sched_yield'
24162 d_scm_rights='$d_scm_rights'
24163 d_seekdir='$d_seekdir'
24164 d_select='$d_select'
24165 d_sem='$d_sem'
24166 d_semctl='$d_semctl'
24167 d_semctl_semid_ds='$d_semctl_semid_ds'
24168 d_semctl_semun='$d_semctl_semun'
24169 d_semget='$d_semget'
24170 d_semop='$d_semop'
24171 d_sendmsg='$d_sendmsg'
24172 d_setegid='$d_setegid'
24173 d_seteuid='$d_seteuid'
24174 d_setgrent='$d_setgrent'
24175 d_setgrent_r='$d_setgrent_r'
24176 d_setgrps='$d_setgrps'
24177 d_sethent='$d_sethent'
24178 d_sethostent_r='$d_sethostent_r'
24179 d_setitimer='$d_setitimer'
24180 d_setlinebuf='$d_setlinebuf'
24181 d_setlocale='$d_setlocale'
24182 d_setlocale_r='$d_setlocale_r'
24183 d_setnent='$d_setnent'
24184 d_setnetent_r='$d_setnetent_r'
24185 d_setpent='$d_setpent'
24186 d_setpgid='$d_setpgid'
24187 d_setpgrp2='$d_setpgrp2'
24188 d_setpgrp='$d_setpgrp'
24189 d_setprior='$d_setprior'
24190 d_setproctitle='$d_setproctitle'
24191 d_setprotoent_r='$d_setprotoent_r'
24192 d_setpwent='$d_setpwent'
24193 d_setpwent_r='$d_setpwent_r'
24194 d_setregid='$d_setregid'
24195 d_setresgid='$d_setresgid'
24196 d_setresuid='$d_setresuid'
24197 d_setreuid='$d_setreuid'
24198 d_setrgid='$d_setrgid'
24199 d_setruid='$d_setruid'
24200 d_setsent='$d_setsent'
24201 d_setservent_r='$d_setservent_r'
24202 d_setsid='$d_setsid'
24203 d_setvbuf='$d_setvbuf'
24204 d_shm='$d_shm'
24205 d_shmat='$d_shmat'
24206 d_shmatprototype='$d_shmatprototype'
24207 d_shmctl='$d_shmctl'
24208 d_shmdt='$d_shmdt'
24209 d_shmget='$d_shmget'
24210 d_sigaction='$d_sigaction'
24211 d_signbit='$d_signbit'
24212 d_sigprocmask='$d_sigprocmask'
24213 d_sigsetjmp='$d_sigsetjmp'
24214 d_sin6_scope_id='$d_sin6_scope_id'
24215 d_sitearch='$d_sitearch'
24216 d_snprintf='$d_snprintf'
24217 d_sockaddr_in6='$d_sockaddr_in6'
24218 d_sockaddr_sa_len='$d_sockaddr_sa_len'
24219 d_sockatmark='$d_sockatmark'
24220 d_sockatmarkproto='$d_sockatmarkproto'
24221 d_socket='$d_socket'
24222 d_socklen_t='$d_socklen_t'
24223 d_sockpair='$d_sockpair'
24224 d_socks5_init='$d_socks5_init'
24225 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
24226 d_sqrtl='$d_sqrtl'
24227 d_srand48_r='$d_srand48_r'
24228 d_srandom_r='$d_srandom_r'
24229 d_sresgproto='$d_sresgproto'
24230 d_sresuproto='$d_sresuproto'
24231 d_statblks='$d_statblks'
24232 d_statfs_f_flags='$d_statfs_f_flags'
24233 d_statfs_s='$d_statfs_s'
24234 d_static_inline='$d_static_inline'
24235 d_statvfs='$d_statvfs'
24236 d_stdio_cnt_lval='$d_stdio_cnt_lval'
24237 d_stdio_ptr_lval='$d_stdio_ptr_lval'
24238 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
24239 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
24240 d_stdio_stream_array='$d_stdio_stream_array'
24241 d_stdiobase='$d_stdiobase'
24242 d_stdstdio='$d_stdstdio'
24243 d_strchr='$d_strchr'
24244 d_strcoll='$d_strcoll'
24245 d_strctcpy='$d_strctcpy'
24246 d_strerrm='$d_strerrm'
24247 d_strerror='$d_strerror'
24248 d_strerror_r='$d_strerror_r'
24249 d_strftime='$d_strftime'
24250 d_strlcat='$d_strlcat'
24251 d_strlcpy='$d_strlcpy'
24252 d_strtod='$d_strtod'
24253 d_strtol='$d_strtol'
24254 d_strtold='$d_strtold'
24255 d_strtoll='$d_strtoll'
24256 d_strtoq='$d_strtoq'
24257 d_strtoul='$d_strtoul'
24258 d_strtoull='$d_strtoull'
24259 d_strtouq='$d_strtouq'
24260 d_strxfrm='$d_strxfrm'
24261 d_suidsafe='$d_suidsafe'
24262 d_symlink='$d_symlink'
24263 d_syscall='$d_syscall'
24264 d_syscallproto='$d_syscallproto'
24265 d_sysconf='$d_sysconf'
24266 d_sysernlst='$d_sysernlst'
24267 d_syserrlst='$d_syserrlst'
24268 d_system='$d_system'
24269 d_tcgetpgrp='$d_tcgetpgrp'
24270 d_tcsetpgrp='$d_tcsetpgrp'
24271 d_telldir='$d_telldir'
24272 d_telldirproto='$d_telldirproto'
24273 d_tgamma='$d_tgamma'
24274 d_time='$d_time'
24275 d_timegm='$d_timegm'
24276 d_times='$d_times'
24277 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
24278 d_tm_tm_zone='$d_tm_tm_zone'
24279 d_tmpnam_r='$d_tmpnam_r'
24280 d_truncate='$d_truncate'
24281 d_trunc='$d_trunc'
24282 d_truncl='$d_truncl'
24283 d_ttyname_r='$d_ttyname_r'
24284 d_tzname='$d_tzname'
24285 d_u32align='$d_u32align'
24286 d_ualarm='$d_ualarm'
24287 d_umask='$d_umask'
24288 d_uname='$d_uname'
24289 d_union_semun='$d_union_semun'
24290 d_unordered='$d_unordered'
24291 d_unsetenv='$d_unsetenv'
24292 d_usleep='$d_usleep'
24293 d_usleepproto='$d_usleepproto'
24294 d_ustat='$d_ustat'
24295 d_vendorarch='$d_vendorarch'
24296 d_vendorbin='$d_vendorbin'
24297 d_vendorlib='$d_vendorlib'
24298 d_vendorscript='$d_vendorscript'
24299 d_vfork='$d_vfork'
24300 d_void_closedir='$d_void_closedir'
24301 d_voidsig='$d_voidsig'
24302 d_voidtty='$d_voidtty'
24303 d_volatile='$d_volatile'
24304 d_vprintf='$d_vprintf'
24305 d_vsnprintf='$d_vsnprintf'
24306 d_wait4='$d_wait4'
24307 d_waitpid='$d_waitpid'
24308 d_wcscmp='$d_wcscmp'
24309 d_wcstombs='$d_wcstombs'
24310 d_wcsxfrm='$d_wcsxfrm'
24311 d_wctomb='$d_wctomb'
24312 d_writev='$d_writev'
24313 d_xenix='$d_xenix'
24314 date='$date'
24315 db_hashtype='$db_hashtype'
24316 db_prefixtype='$db_prefixtype'
24317 db_version_major='$db_version_major'
24318 db_version_minor='$db_version_minor'
24319 db_version_patch='$db_version_patch'
24320 direntrytype='$direntrytype'
24321 dlext='$dlext'
24322 dlsrc='$dlsrc'
24323 doublekind='$doublekind'
24324 doublesize='$doublesize'
24325 drand01='$drand01'
24326 drand48_r_proto='$drand48_r_proto'
24327 dtrace='$dtrace'
24328 dynamic_ext='$dynamic_ext'
24329 eagain='$eagain'
24330 ebcdic='$ebcdic'
24331 echo='$echo'
24332 egrep='$egrep'
24333 emacs='$emacs'
24334 endgrent_r_proto='$endgrent_r_proto'
24335 endhostent_r_proto='$endhostent_r_proto'
24336 endnetent_r_proto='$endnetent_r_proto'
24337 endprotoent_r_proto='$endprotoent_r_proto'
24338 endpwent_r_proto='$endpwent_r_proto'
24339 endservent_r_proto='$endservent_r_proto'
24340 eunicefix='$eunicefix'
24341 exe_ext='$exe_ext'
24342 expr='$expr'
24343 extensions='$extensions'
24344 extern_C='$extern_C'
24345 extras='$extras'
24346 fflushNULL='$fflushNULL'
24347 fflushall='$fflushall'
24348 find='$find'
24349 firstmakefile='$firstmakefile'
24350 flex='$flex'
24351 fpossize='$fpossize'
24352 fpostype='$fpostype'
24353 freetype='$freetype'
24354 from='$from'
24355 full_ar='$full_ar'
24356 full_csh='$full_csh'
24357 full_sed='$full_sed'
24358 gccansipedantic='$gccansipedantic'
24359 gccosandvers='$gccosandvers'
24360 gccversion='$gccversion'
24361 getgrent_r_proto='$getgrent_r_proto'
24362 getgrgid_r_proto='$getgrgid_r_proto'
24363 getgrnam_r_proto='$getgrnam_r_proto'
24364 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24365 gethostbyname_r_proto='$gethostbyname_r_proto'
24366 gethostent_r_proto='$gethostent_r_proto'
24367 getlogin_r_proto='$getlogin_r_proto'
24368 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24369 getnetbyname_r_proto='$getnetbyname_r_proto'
24370 getnetent_r_proto='$getnetent_r_proto'
24371 getprotobyname_r_proto='$getprotobyname_r_proto'
24372 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24373 getprotoent_r_proto='$getprotoent_r_proto'
24374 getpwent_r_proto='$getpwent_r_proto'
24375 getpwnam_r_proto='$getpwnam_r_proto'
24376 getpwuid_r_proto='$getpwuid_r_proto'
24377 getservbyname_r_proto='$getservbyname_r_proto'
24378 getservbyport_r_proto='$getservbyport_r_proto'
24379 getservent_r_proto='$getservent_r_proto'
24380 getspnam_r_proto='$getspnam_r_proto'
24381 gidformat='$gidformat'
24382 gidsign='$gidsign'
24383 gidsize='$gidsize'
24384 gidtype='$gidtype'
24385 glibpth='$glibpth'
24386 gmake='$gmake'
24387 gmtime_r_proto='$gmtime_r_proto'
24388 gnulibc_version='$gnulibc_version'
24389 grep='$grep'
24390 groupcat='$groupcat'
24391 groupstype='$groupstype'
24392 gzip='$gzip'
24393 h_fcntl='$h_fcntl'
24394 h_sysfile='$h_sysfile'
24395 hint='$hint'
24396 hostcat='$hostcat'
24397 hostgenerate='$hostgenerate'
24398 hostosname='$hostosname'
24399 hostperl='$hostperl'
24400 html1dir='$html1dir'
24401 html1direxp='$html1direxp'
24402 html3dir='$html3dir'
24403 html3direxp='$html3direxp'
24404 i16size='$i16size'
24405 i16type='$i16type'
24406 i32size='$i32size'
24407 i32type='$i32type'
24408 i64size='$i64size'
24409 i64type='$i64type'
24410 i8size='$i8size'
24411 i8type='$i8type'
24412 i_arpainet='$i_arpainet'
24413 i_assert='$i_assert'
24414 i_bfd='$i_bfd'
24415 i_bsdioctl='$i_bsdioctl'
24416 i_crypt='$i_crypt'
24417 i_db='$i_db'
24418 i_dbm='$i_dbm'
24419 i_dirent='$i_dirent'
24420 i_dlfcn='$i_dlfcn'
24421 i_execinfo='$i_execinfo'
24422 i_fcntl='$i_fcntl'
24423 i_fenv='$i_fenv'
24424 i_float='$i_float'
24425 i_fp='$i_fp'
24426 i_fp_class='$i_fp_class'
24427 i_gdbm='$i_gdbm'
24428 i_gdbm_ndbm='$i_gdbm_ndbm'
24429 i_gdbmndbm='$i_gdbmndbm'
24430 i_grp='$i_grp'
24431 i_ieeefp='$i_ieeefp'
24432 i_inttypes='$i_inttypes'
24433 i_langinfo='$i_langinfo'
24434 i_libutil='$i_libutil'
24435 i_limits='$i_limits'
24436 i_locale='$i_locale'
24437 i_machcthr='$i_machcthr'
24438 i_malloc='$i_malloc'
24439 i_mallocmalloc='$i_mallocmalloc'
24440 i_math='$i_math'
24441 i_memory='$i_memory'
24442 i_mntent='$i_mntent'
24443 i_ndbm='$i_ndbm'
24444 i_netdb='$i_netdb'
24445 i_neterrno='$i_neterrno'
24446 i_netinettcp='$i_netinettcp'
24447 i_niin='$i_niin'
24448 i_poll='$i_poll'
24449 i_prot='$i_prot'
24450 i_pthread='$i_pthread'
24451 i_pwd='$i_pwd'
24452 i_quadmath='$i_quadmath'
24453 i_rpcsvcdbm='$i_rpcsvcdbm'
24454 i_sgtty='$i_sgtty'
24455 i_shadow='$i_shadow'
24456 i_socks='$i_socks'
24457 i_stdarg='$i_stdarg'
24458 i_stdbool='$i_stdbool'
24459 i_stddef='$i_stddef'
24460 i_stdint='$i_stdint'
24461 i_stdlib='$i_stdlib'
24462 i_string='$i_string'
24463 i_sunmath='$i_sunmath'
24464 i_sysaccess='$i_sysaccess'
24465 i_sysdir='$i_sysdir'
24466 i_sysfile='$i_sysfile'
24467 i_sysfilio='$i_sysfilio'
24468 i_sysin='$i_sysin'
24469 i_sysioctl='$i_sysioctl'
24470 i_syslog='$i_syslog'
24471 i_sysmman='$i_sysmman'
24472 i_sysmode='$i_sysmode'
24473 i_sysmount='$i_sysmount'
24474 i_sysndir='$i_sysndir'
24475 i_sysparam='$i_sysparam'
24476 i_syspoll='$i_syspoll'
24477 i_sysresrc='$i_sysresrc'
24478 i_syssecrt='$i_syssecrt'
24479 i_sysselct='$i_sysselct'
24480 i_syssockio='$i_syssockio'
24481 i_sysstat='$i_sysstat'
24482 i_sysstatfs='$i_sysstatfs'
24483 i_sysstatvfs='$i_sysstatvfs'
24484 i_systime='$i_systime'
24485 i_systimek='$i_systimek'
24486 i_systimes='$i_systimes'
24487 i_systypes='$i_systypes'
24488 i_sysuio='$i_sysuio'
24489 i_sysun='$i_sysun'
24490 i_sysutsname='$i_sysutsname'
24491 i_sysvfs='$i_sysvfs'
24492 i_syswait='$i_syswait'
24493 i_termio='$i_termio'
24494 i_termios='$i_termios'
24495 i_time='$i_time'
24496 i_unistd='$i_unistd'
24497 i_ustat='$i_ustat'
24498 i_utime='$i_utime'
24499 i_values='$i_values'
24500 i_varargs='$i_varargs'
24501 i_varhdr='$i_varhdr'
24502 i_vfork='$i_vfork'
24503 ignore_versioned_solibs='$ignore_versioned_solibs'
24504 inc_version_list='$inc_version_list'
24505 inc_version_list_init='$inc_version_list_init'
24506 incpath='$incpath'
24507 incpth='$incpth'
24508 inews='$inews'
24509 initialinstalllocation='$initialinstalllocation'
24510 installarchlib='$installarchlib'
24511 installbin='$installbin'
24512 installhtml1dir='$installhtml1dir'
24513 installhtml3dir='$installhtml3dir'
24514 installman1dir='$installman1dir'
24515 installman3dir='$installman3dir'
24516 installprefix='$installprefix'
24517 installprefixexp='$installprefixexp'
24518 installprivlib='$installprivlib'
24519 installscript='$installscript'
24520 installsitearch='$installsitearch'
24521 installsitebin='$installsitebin'
24522 installsitehtml1dir='$installsitehtml1dir'
24523 installsitehtml3dir='$installsitehtml3dir'
24524 installsitelib='$installsitelib'
24525 installsiteman1dir='$installsiteman1dir'
24526 installsiteman3dir='$installsiteman3dir'
24527 installsitescript='$installsitescript'
24528 installstyle='$installstyle'
24529 installusrbinperl='$installusrbinperl'
24530 installvendorarch='$installvendorarch'
24531 installvendorbin='$installvendorbin'
24532 installvendorhtml1dir='$installvendorhtml1dir'
24533 installvendorhtml3dir='$installvendorhtml3dir'
24534 installvendorlib='$installvendorlib'
24535 installvendorman1dir='$installvendorman1dir'
24536 installvendorman3dir='$installvendorman3dir'
24537 installvendorscript='$installvendorscript'
24538 intsize='$intsize'
24539 issymlink='$issymlink'
24540 ivdformat='$ivdformat'
24541 ivsize='$ivsize'
24542 ivtype='$ivtype'
24543 known_extensions='$known_extensions'
24544 ksh='$ksh'
24545 ld='$ld'
24546 ld_can_script='$ld_can_script'
24547 lddlflags='$lddlflags'
24548 ldflags='$ldflags'
24549 ldflags_uselargefiles='$ldflags_uselargefiles'
24550 ldlibpthname='$ldlibpthname'
24551 less='$less'
24552 lib_ext='$lib_ext'
24553 libc='$libc'
24554 libperl='$libperl'
24555 libpth='$libpth'
24556 libs='$libs'
24557 libsdirs='$libsdirs'
24558 libsfiles='$libsfiles'
24559 libsfound='$libsfound'
24560 libspath='$libspath'
24561 libswanted='$libswanted'
24562 libswanted_uselargefiles='$libswanted_uselargefiles'
24563 line='$line'
24564 lint='$lint'
24565 lkflags='$lkflags'
24566 ln='$ln'
24567 lns='$lns'
24568 localtime_r_proto='$localtime_r_proto'
24569 locincpth='$locincpth'
24570 loclibpth='$loclibpth'
24571 longdblkind='$longdblkind'
24572 longdblsize='$longdblsize'
24573 longlongsize='$longlongsize'
24574 longsize='$longsize'
24575 lp='$lp'
24576 lpr='$lpr'
24577 ls='$ls'
24578 lseeksize='$lseeksize'
24579 lseektype='$lseektype'
24580 mail='$mail'
24581 mailx='$mailx'
24582 make='$make'
24583 make_set_make='$make_set_make'
24584 mallocobj='$mallocobj'
24585 mallocsrc='$mallocsrc'
24586 malloctype='$malloctype'
24587 man1dir='$man1dir'
24588 man1direxp='$man1direxp'
24589 man1ext='$man1ext'
24590 man3dir='$man3dir'
24591 man3direxp='$man3direxp'
24592 man3ext='$man3ext'
24593 mips_type='$mips_type'
24594 mistrustnm='$mistrustnm'
24595 mkdir='$mkdir'
24596 mmaptype='$mmaptype'
24597 modetype='$modetype'
24598 more='$more'
24599 multiarch='$multiarch'
24600 mv='$mv'
24601 myarchname='$myarchname'
24602 mydomain='$mydomain'
24603 myhostname='$myhostname'
24604 myuname='$myuname'
24605 n='$n'
24606 need_va_copy='$need_va_copy'
24607 netdb_hlen_type='$netdb_hlen_type'
24608 netdb_host_type='$netdb_host_type'
24609 netdb_name_type='$netdb_name_type'
24610 netdb_net_type='$netdb_net_type'
24611 nm='$nm'
24612 nm_opt='$nm_opt'
24613 nm_so_opt='$nm_so_opt'
24614 nonxs_ext='$nonxs_ext'
24615 nroff='$nroff'
24616 nvEUformat='$nvEUformat'
24617 nvFUformat='$nvFUformat'
24618 nvGUformat='$nvGUformat'
24619 nv_overflows_integers_at='$nv_overflows_integers_at'
24620 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24621 nveformat='$nveformat'
24622 nvfformat='$nvfformat'
24623 nvgformat='$nvgformat'
24624 nvsize='$nvsize'
24625 nvtype='$nvtype'
24626 o_nonblock='$o_nonblock'
24627 obj_ext='$obj_ext'
24628 old_pthread_create_joinable='$old_pthread_create_joinable'
24629 optimize='$optimize'
24630 orderlib='$orderlib'
24631 osname='$osname'
24632 osvers='$osvers'
24633 otherlibdirs='$otherlibdirs'
24634 package='$package'
24635 pager='$pager'
24636 passcat='$passcat'
24637 patchlevel='$patchlevel'
24638 path_sep='$path_sep'
24639 perl5='$perl5'
24640 perl='$perl'
24641 perl_patchlevel='$perl_patchlevel'
24642 perl_static_inline='$perl_static_inline'
24643 perladmin='$perladmin'
24644 perllibs='$perllibs'
24645 perlpath='$perlpath'
24646 pg='$pg'
24647 phostname='$phostname'
24648 pidtype='$pidtype'
24649 plibpth='$plibpth'
24650 pmake='$pmake'
24651 pr='$pr'
24652 prefix='$prefix'
24653 prefixexp='$prefixexp'
24654 privlib='$privlib'
24655 privlibexp='$privlibexp'
24656 procselfexe='$procselfexe'
24657 prototype='$prototype'
24658 ptrsize='$ptrsize'
24659 quadkind='$quadkind'
24660 quadtype='$quadtype'
24661 randbits='$randbits'
24662 randfunc='$randfunc'
24663 random_r_proto='$random_r_proto'
24664 randseedtype='$randseedtype'
24665 ranlib='$ranlib'
24666 rd_nodata='$rd_nodata'
24667 readdir64_r_proto='$readdir64_r_proto'
24668 readdir_r_proto='$readdir_r_proto'
24669 revision='$revision'
24670 rm='$rm'
24671 rm_try='$rm_try'
24672 rmail='$rmail'
24673 run='$run'
24674 runnm='$runnm'
24675 sGMTIME_max='$sGMTIME_max'
24676 sGMTIME_min='$sGMTIME_min'
24677 sLOCALTIME_max='$sLOCALTIME_max'
24678 sLOCALTIME_min='$sLOCALTIME_min'
24679 sPRIEUldbl='$sPRIEUldbl'
24680 sPRIFUldbl='$sPRIFUldbl'
24681 sPRIGUldbl='$sPRIGUldbl'
24682 sPRIXU64='$sPRIXU64'
24683 sPRId64='$sPRId64'
24684 sPRIeldbl='$sPRIeldbl'
24685 sPRIfldbl='$sPRIfldbl'
24686 sPRIgldbl='$sPRIgldbl'
24687 sPRIi64='$sPRIi64'
24688 sPRIo64='$sPRIo64'
24689 sPRIu64='$sPRIu64'
24690 sPRIx64='$sPRIx64'
24691 sSCNfldbl='$sSCNfldbl'
24692 sched_yield='$sched_yield'
24693 scriptdir='$scriptdir'
24694 scriptdirexp='$scriptdirexp'
24695 sed='$sed'
24696 seedfunc='$seedfunc'
24697 selectminbits='$selectminbits'
24698 selecttype='$selecttype'
24699 sendmail='$sendmail'
24700 setgrent_r_proto='$setgrent_r_proto'
24701 sethostent_r_proto='$sethostent_r_proto'
24702 setlocale_r_proto='$setlocale_r_proto'
24703 setnetent_r_proto='$setnetent_r_proto'
24704 setprotoent_r_proto='$setprotoent_r_proto'
24705 setpwent_r_proto='$setpwent_r_proto'
24706 setservent_r_proto='$setservent_r_proto'
24707 sh='$sh'
24708 shar='$shar'
24709 sharpbang='$sharpbang'
24710 shmattype='$shmattype'
24711 shortsize='$shortsize'
24712 shrpenv='$shrpenv'
24713 shsharp='$shsharp'
24714 sig_count='$sig_count'
24715 sig_name='$sig_name'
24716 sig_name_init='$sig_name_init'
24717 sig_num='$sig_num'
24718 sig_num_init='$sig_num_init'
24719 sig_size='$sig_size'
24720 signal_t='$signal_t'
24721 sitearch='$sitearch'
24722 sitearchexp='$sitearchexp'
24723 sitebin='$sitebin'
24724 sitebinexp='$sitebinexp'
24725 sitehtml1dir='$sitehtml1dir'
24726 sitehtml1direxp='$sitehtml1direxp'
24727 sitehtml3dir='$sitehtml3dir'
24728 sitehtml3direxp='$sitehtml3direxp'
24729 sitelib='$sitelib'
24730 sitelib_stem='$sitelib_stem'
24731 sitelibexp='$sitelibexp'
24732 siteman1dir='$siteman1dir'
24733 siteman1direxp='$siteman1direxp'
24734 siteman3dir='$siteman3dir'
24735 siteman3direxp='$siteman3direxp'
24736 siteprefix='$siteprefix'
24737 siteprefixexp='$siteprefixexp'
24738 sitescript='$sitescript'
24739 sitescriptexp='$sitescriptexp'
24740 sizesize='$sizesize'
24741 sizetype='$sizetype'
24742 sleep='$sleep'
24743 smail='$smail'
24744 so='$so'
24745 sockethdr='$sockethdr'
24746 socketlib='$socketlib'
24747 socksizetype='$socksizetype'
24748 sort='$sort'
24749 spackage='$spackage'
24750 spitshell='$spitshell'
24751 srand48_r_proto='$srand48_r_proto'
24752 srandom_r_proto='$srandom_r_proto'
24753 src='$src'
24754 ssizetype='$ssizetype'
24755 st_ino_sign='$st_ino_sign'
24756 st_ino_size='$st_ino_size'
24757 startperl='$startperl'
24758 startsh='$startsh'
24759 static_ext='$static_ext'
24760 stdchar='$stdchar'
24761 stdio_base='$stdio_base'
24762 stdio_bufsiz='$stdio_bufsiz'
24763 stdio_cnt='$stdio_cnt'
24764 stdio_filbuf='$stdio_filbuf'
24765 stdio_ptr='$stdio_ptr'
24766 stdio_stream_array='$stdio_stream_array'
24767 strerror_r_proto='$strerror_r_proto'
24768 strings='$strings'
24769 submit='$submit'
24770 subversion='$subversion'
24771 sysman='$sysman'
24772 sysroot='$sysroot'
24773 tail='$tail'
24774 tar='$tar'
24775 targetarch='$targetarch'
24776 targetdir='$targetdir'
24777 targetenv='$targetenv'
24778 targethost='$targethost'
24779 targetmkdir='$targetmkdir'
24780 targetport='$targetport'
24781 targetsh='$targetsh'
24782 tbl='$tbl'
24783 tee='$tee'
24784 test='$test'
24785 timeincl='$timeincl'
24786 timetype='$timetype'
24787 tmpnam_r_proto='$tmpnam_r_proto'
24788 to='$to'
24789 touch='$touch'
24790 tr='$tr'
24791 trnl='$trnl'
24792 troff='$troff'
24793 ttyname_r_proto='$ttyname_r_proto'
24794 u16size='$u16size'
24795 u16type='$u16type'
24796 u32size='$u32size'
24797 u32type='$u32type'
24798 u64size='$u64size'
24799 u64type='$u64type'
24800 u8size='$u8size'
24801 u8type='$u8type'
24802 uidformat='$uidformat'
24803 uidsign='$uidsign'
24804 uidsize='$uidsize'
24805 uidtype='$uidtype'
24806 uname='$uname'
24807 uniq='$uniq'
24808 uquadtype='$uquadtype'
24809 use5005threads='$use5005threads'
24810 use64bitall='$use64bitall'
24811 use64bitint='$use64bitint'
24812 usecbacktrace='$usecbacktrace'
24813 usecrosscompile='$usecrosscompile'
24814 usedevel='$usedevel'
24815 usedl='$usedl'
24816 usedtrace='$usedtrace'
24817 usefaststdio='$usefaststdio'
24818 useithreads='$useithreads'
24819 usekernprocpathname='$usekernprocpathname'
24820 uselargefiles='$uselargefiles'
24821 uselongdouble='$uselongdouble'
24822 usemallocwrap='$usemallocwrap'
24823 usemorebits='$usemorebits'
24824 usemultiplicity='$usemultiplicity'
24825 usemymalloc='$usemymalloc'
24826 usenm='$usenm'
24827 usensgetexecutablepath='$usensgetexecutablepath'
24828 useopcode='$useopcode'
24829 useperlio='$useperlio'
24830 useposix='$useposix'
24831 usequadmath='$usequadmath'
24832 usereentrant='$usereentrant'
24833 userelocatableinc='$userelocatableinc'
24834 useshrplib='$useshrplib'
24835 usesitecustomize='$usesitecustomize'
24836 usesocks='$usesocks'
24837 usethreads='$usethreads'
24838 usevendorprefix='$usevendorprefix'
24839 useversionedarchname='$useversionedarchname'
24840 usevfork='$usevfork'
24841 usrinc='$usrinc'
24842 uuname='$uuname'
24843 uvXUformat='$uvXUformat'
24844 uvoformat='$uvoformat'
24845 uvsize='$uvsize'
24846 uvtype='$uvtype'
24847 uvuformat='$uvuformat'
24848 uvxformat='$uvxformat'
24849 vaproto='$vaproto'
24850 vendorarch='$vendorarch'
24851 vendorarchexp='$vendorarchexp'
24852 vendorbin='$vendorbin'
24853 vendorbinexp='$vendorbinexp'
24854 vendorhtml1dir='$vendorhtml1dir'
24855 vendorhtml1direxp='$vendorhtml1direxp'
24856 vendorhtml3dir='$vendorhtml3dir'
24857 vendorhtml3direxp='$vendorhtml3direxp'
24858 vendorlib='$vendorlib'
24859 vendorlib_stem='$vendorlib_stem'
24860 vendorlibexp='$vendorlibexp'
24861 vendorman1dir='$vendorman1dir'
24862 vendorman1direxp='$vendorman1direxp'
24863 vendorman3dir='$vendorman3dir'
24864 vendorman3direxp='$vendorman3direxp'
24865 vendorprefix='$vendorprefix'
24866 vendorprefixexp='$vendorprefixexp'
24867 vendorscript='$vendorscript'
24868 vendorscriptexp='$vendorscriptexp'
24869 version='$version'
24870 version_patchlevel_string='$version_patchlevel_string'
24871 versiononly='$versiononly'
24872 vi='$vi'
24873 xlibpth='$xlibpth'
24874 yacc='$yacc'
24875 yaccflags='$yaccflags'
24876 zcat='$zcat'
24877 zip='$zip'
24878 EOT
24879
24880 : add special variables
24881 $test -f $src/patchlevel.h && \
24882 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24883 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24884 echo "PERL_CONFIG_SH=true" >>config.sh
24885
24886 : propagate old symbols
24887 if $test -f UU/config.sh; then
24888         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24889         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24890                 config.sh config.sh UU/oldconfig.sh |\
24891                 $sort | $uniq -u >UU/oldsyms
24892         set X `$cat UU/oldsyms`
24893         shift
24894         case $# in
24895         0) ;;
24896         *)
24897                 $cat <<EOM
24898 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24899 EOM
24900                 echo ": Variables propagated from previous config.sh file." >>config.sh
24901                 for sym in `$cat UU/oldsyms`; do
24902                         echo "    Propagating $hint variable "'$'"$sym..."
24903                         eval 'tmp="$'"${sym}"'"'
24904                         echo "$tmp" | \
24905                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24906                 done
24907                 ;;
24908         esac
24909 fi
24910
24911 : preserve RCS keywords in files with variable substitution, grrr
24912 Id='$Id'
24913
24914 : Finish up by extracting the .SH files
24915 case "$alldone" in
24916 exit)
24917         $rm -rf UU
24918         echo "Extraction done."
24919         exit 0
24920         ;;
24921 cont)
24922         ;;
24923 '')
24924         dflt=''
24925         nostick=true
24926         $cat <<EOM
24927
24928 If you'd like to make any changes to the config.sh file before I begin
24929 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24930
24931 EOM
24932         rp="Press return or use a shell escape to edit config.sh:"
24933         . UU/myread
24934         nostick=''
24935         case "$ans" in
24936         '') ;;
24937         *) : in case they cannot read
24938                 sh 1>&4 -c "$ans";;
24939         esac
24940         ;;
24941 esac
24942
24943 : if this fails, just run all the .SH files by hand
24944 . ./config.sh
24945
24946 echo " "
24947 exec 1>&4
24948 pwd=`pwd`
24949 . ./UU/extract
24950 cd "$pwd"
24951
24952 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24953         dflt=y
24954         case "$silent" in
24955         true) ;;
24956         *)
24957                 $cat <<EOM
24958
24959 Now you need to generate make dependencies by running "$make depend".
24960 You might prefer to run it in background: "$make depend > makedepend.out &"
24961 It can take a while, so you might not want to run it right now.
24962
24963 EOM
24964                 ;;
24965         esac
24966         rp="Run $make depend now?"
24967         . UU/myread
24968         case "$ans" in
24969         y*)
24970                 $make depend && echo "Now you must run '$make'."
24971                 ;;
24972         *)
24973                 echo "You must run '$make depend' then '$make'."
24974                 ;;
24975         esac
24976 elif test -f [Mm]akefile; then
24977         echo " "
24978         echo "Now you must run a $make."
24979 else
24980         echo "Configure done."
24981 fi
24982
24983 if $test -f Policy.sh; then
24984     $cat <<EOM
24985
24986 If you compile $package on a different machine or from a different object
24987 directory, copy the Policy.sh file from this object directory to the
24988 new one before you run Configure -- this will help you with most of
24989 the policy defaults.
24990
24991 EOM
24992 fi
24993 if $test -f config.msg; then
24994     echo "Hmm.  I also noted the following information while running:"
24995     echo " "
24996     $cat config.msg >&4
24997     $rm -f config.msg
24998 fi
24999 $rm -f kit*isdone ark*isdone
25000 $rm -rf UU
25001
25002 : End of Configure
25003