Add a new Porting/podtidy to reformat pod using Pod::Tidy
[p5sagit/p5-mst-13.2.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.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Wed Dec  3 15:26:54 CET 2008 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 extern_C=''
211 mistrustnm=''
212 usedevel=''
213 perllibs=''
214 dynamic_ext=''
215 extensions=''
216 known_extensions=''
217 nonxs_ext=''
218 static_ext=''
219 useopcode=''
220 useposix=''
221 extras=''
222 d_bsd=''
223 d_eunice=''
224 d_xenix=''
225 eunicefix=''
226 ar=''
227 awk=''
228 bash=''
229 bison=''
230 byacc=''
231 cat=''
232 chgrp=''
233 chmod=''
234 chown=''
235 comm=''
236 compress=''
237 cp=''
238 cpio=''
239 cpp=''
240 csh=''
241 date=''
242 echo=''
243 egrep=''
244 emacs=''
245 expr=''
246 find=''
247 flex=''
248 gmake=''
249 grep=''
250 gzip=''
251 inews=''
252 ksh=''
253 less=''
254 line=''
255 lint=''
256 ln=''
257 lp=''
258 lpr=''
259 ls=''
260 mail=''
261 mailx=''
262 make=''
263 mkdir=''
264 more=''
265 mv=''
266 nm=''
267 nroff=''
268 perl=''
269 pg=''
270 pmake=''
271 pr=''
272 rm=''
273 rmail=''
274 sed=''
275 sendmail=''
276 shar=''
277 sleep=''
278 smail=''
279 sort=''
280 submit=''
281 tail=''
282 tar=''
283 tbl=''
284 tee=''
285 test=''
286 touch=''
287 tr=''
288 troff=''
289 uname=''
290 uniq=''
291 uuname=''
292 vi=''
293 zcat=''
294 zip=''
295 full_ar=''
296 full_sed=''
297 libswanted=''
298 hint=''
299 myuname=''
300 osname=''
301 osvers=''
302 Author=''
303 Date=''
304 Header=''
305 Id=''
306 Locker=''
307 Log=''
308 RCSfile=''
309 Revision=''
310 Source=''
311 State=''
312 _a=''
313 _exe=''
314 _o=''
315 archobjs=''
316 exe_ext=''
317 firstmakefile=''
318 lib_ext=''
319 obj_ext=''
320 path_sep=''
321 rm_try=''
322 afs=''
323 afsroot=''
324 alignbytes=''
325 ansi2knr=''
326 archlib=''
327 archlibexp=''
328 d_archlib=''
329 installarchlib=''
330 archname=''
331 myarchname=''
332 d_atolf=''
333 d_atoll=''
334 baserev=''
335 bin=''
336 binexp=''
337 initialinstalllocation=''
338 installbin=''
339 userelocatableinc=''
340 byteorder=''
341 cc=''
342 ccflags=''
343 cppflags=''
344 ldflags=''
345 lkflags=''
346 locincpth=''
347 optimize=''
348 cf_email=''
349 cf_by=''
350 cf_time=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_deprecated=''
365 d_attribute_format=''
366 d_attribute_malloc=''
367 d_attribute_nonnull=''
368 d_attribute_noreturn=''
369 d_attribute_pure=''
370 d_attribute_unused=''
371 d_attribute_warn_unused_result=''
372 d_printf_format_null=''
373 d_bcmp=''
374 d_bcopy=''
375 d_builtin_choose_expr=''
376 d_builtin_expect=''
377 d_bzero=''
378 d_c99_variadic_macros=''
379 d_casti32=''
380 castflags=''
381 d_castneg=''
382 d_chown=''
383 d_chroot=''
384 d_chsize=''
385 d_class=''
386 d_clearenv=''
387 d_closedir=''
388 d_void_closedir=''
389 d_cmsghdr_s=''
390 d_const=''
391 d_copysignl=''
392 d_cplusplus=''
393 cryptlib=''
394 d_crypt=''
395 crypt_r_proto=''
396 d_crypt_r=''
397 d_csh=''
398 full_csh=''
399 d_ctermid=''
400 ctermid_r_proto=''
401 d_ctermid_r=''
402 ctime_r_proto=''
403 d_ctime_r=''
404 d_cuserid=''
405 d_dbl_dig=''
406 d_dbminitproto=''
407 d_difftime=''
408 d_dir_dd_fd=''
409 d_dirfd=''
410 d_dlerror=''
411 d_dlopen=''
412 d_dlsymun=''
413 d_dosuid=''
414 d_suidsafe=''
415 d_drand48_r=''
416 drand48_r_proto=''
417 d_drand48proto=''
418 d_dup2=''
419 d_eaccess=''
420 d_endgrent=''
421 d_endgrent_r=''
422 endgrent_r_proto=''
423 d_endhent=''
424 d_endhostent_r=''
425 endhostent_r_proto=''
426 d_endnent=''
427 d_endnetent_r=''
428 endnetent_r_proto=''
429 d_endpent=''
430 d_endprotoent_r=''
431 endprotoent_r_proto=''
432 d_endpwent=''
433 d_endpwent_r=''
434 endpwent_r_proto=''
435 d_endsent=''
436 d_endservent_r=''
437 endservent_r_proto=''
438 d_faststdio=''
439 d_fchdir=''
440 d_fchmod=''
441 d_fchown=''
442 d_fcntl=''
443 d_fcntl_can_lock=''
444 d_fd_macros=''
445 d_fd_set=''
446 d_fds_bits=''
447 d_fgetpos=''
448 d_finite=''
449 d_finitel=''
450 d_flexfnam=''
451 d_flock=''
452 d_flockproto=''
453 d_fork=''
454 d_fp_class=''
455 d_fpclass=''
456 d_fpclassify=''
457 d_fpclassl=''
458 d_fpos64_t=''
459 d_frexpl=''
460 d_fs_data_s=''
461 d_fseeko=''
462 d_fsetpos=''
463 d_fstatfs=''
464 d_fsync=''
465 d_ftello=''
466 d_ftime=''
467 d_gettimeod=''
468 d_futimes=''
469 d_Gconvert=''
470 d_getcwd=''
471 d_getespwnam=''
472 d_getfsstat=''
473 d_getgrent=''
474 d_getgrent_r=''
475 getgrent_r_proto=''
476 d_getgrgid_r=''
477 getgrgid_r_proto=''
478 d_getgrnam_r=''
479 getgrnam_r_proto=''
480 d_getgrps=''
481 d_gethbyaddr=''
482 d_gethbyname=''
483 d_gethent=''
484 aphostname=''
485 d_gethname=''
486 d_phostname=''
487 d_uname=''
488 d_gethostbyaddr_r=''
489 gethostbyaddr_r_proto=''
490 d_gethostbyname_r=''
491 gethostbyname_r_proto=''
492 d_gethostent_r=''
493 gethostent_r_proto=''
494 d_gethostprotos=''
495 d_getitimer=''
496 d_getlogin=''
497 d_getlogin_r=''
498 getlogin_r_proto=''
499 d_getmnt=''
500 d_getmntent=''
501 d_getnbyaddr=''
502 d_getnbyname=''
503 d_getnent=''
504 d_getnetbyaddr_r=''
505 getnetbyaddr_r_proto=''
506 d_getnetbyname_r=''
507 getnetbyname_r_proto=''
508 d_getnetent_r=''
509 getnetent_r_proto=''
510 d_getnetprotos=''
511 d_getpagsz=''
512 d_getpent=''
513 d_getpgid=''
514 d_getpgrp2=''
515 d_bsdgetpgrp=''
516 d_getpgrp=''
517 d_getppid=''
518 d_getprior=''
519 d_getpbyname=''
520 d_getpbynumber=''
521 d_getprotobyname_r=''
522 getprotobyname_r_proto=''
523 d_getprotobynumber_r=''
524 getprotobynumber_r_proto=''
525 d_getprotoent_r=''
526 getprotoent_r_proto=''
527 d_getprotoprotos=''
528 d_getprpwnam=''
529 d_getpwent=''
530 d_getpwent_r=''
531 getpwent_r_proto=''
532 d_getpwnam_r=''
533 getpwnam_r_proto=''
534 d_getpwuid_r=''
535 getpwuid_r_proto=''
536 d_getsent=''
537 d_getservbyname_r=''
538 getservbyname_r_proto=''
539 d_getservbyport_r=''
540 getservbyport_r_proto=''
541 d_getservent_r=''
542 getservent_r_proto=''
543 d_getservprotos=''
544 d_getspnam=''
545 d_getspnam_r=''
546 getspnam_r_proto=''
547 d_getsbyname=''
548 d_getsbyport=''
549 d_gmtime_r=''
550 gmtime_r_proto=''
551 d_gnulibc=''
552 gnulibc_version=''
553 d_hasmntopt=''
554 d_htonl=''
555 d_ilogbl=''
556 d_inetaton=''
557 d_int64_t=''
558 d_isascii=''
559 d_isfinite=''
560 d_isinf=''
561 d_isnan=''
562 d_isnanl=''
563 d_killpg=''
564 d_lchown=''
565 d_ldbl_dig=''
566 d_libm_lib_version=''
567 d_link=''
568 d_localtime_r=''
569 d_localtime_r_needs_tzset=''
570 localtime_r_proto=''
571 d_locconv=''
572 d_lockf=''
573 d_longdbl=''
574 longdblsize=''
575 d_longlong=''
576 longlongsize=''
577 d_lseekproto=''
578 d_lstat=''
579 d_madvise=''
580 d_malloc_good_size=''
581 d_malloc_size=''
582 d_mblen=''
583 d_mbstowcs=''
584 d_mbtowc=''
585 d_memchr=''
586 d_memcmp=''
587 d_memcpy=''
588 d_memmove=''
589 d_memset=''
590 d_mkdir=''
591 d_mkdtemp=''
592 d_mkfifo=''
593 d_mkstemp=''
594 d_mkstemps=''
595 d_mktime=''
596 d_mmap=''
597 mmaptype=''
598 d_modfl=''
599 d_modfl_pow32_bug=''
600 d_modflproto=''
601 d_mprotect=''
602 d_msg=''
603 d_msgctl=''
604 d_msgget=''
605 d_msghdr_s=''
606 d_msgrcv=''
607 d_msgsnd=''
608 d_msync=''
609 d_munmap=''
610 d_nice=''
611 d_nl_langinfo=''
612 d_off64_t=''
613 d_open3=''
614 d_fpathconf=''
615 d_pathconf=''
616 d_pause=''
617 d_pipe=''
618 d_poll=''
619 d_portable=''
620 d_procselfexe=''
621 procselfexe=''
622 d_old_pthread_create_joinable=''
623 old_pthread_create_joinable=''
624 d_pthread_atfork=''
625 d_pthread_attr_setscope=''
626 d_pthread_yield=''
627 d_sched_yield=''
628 sched_yield=''
629 d_qgcvt=''
630 d_random_r=''
631 random_r_proto=''
632 d_readdir64_r=''
633 readdir64_r_proto=''
634 d_readdir=''
635 d_rewinddir=''
636 d_seekdir=''
637 d_telldir=''
638 d_readdir_r=''
639 readdir_r_proto=''
640 d_readlink=''
641 d_readv=''
642 d_recvmsg=''
643 d_rename=''
644 d_rmdir=''
645 d_safebcpy=''
646 d_safemcpy=''
647 d_sanemcmp=''
648 d_sbrkproto=''
649 d_scalbnl=''
650 d_select=''
651 d_sem=''
652 d_semctl=''
653 d_semget=''
654 d_semop=''
655 d_sendmsg=''
656 d_setegid=''
657 d_seteuid=''
658 d_setgrent=''
659 d_setgrent_r=''
660 setgrent_r_proto=''
661 d_setgrps=''
662 d_sethent=''
663 d_sethostent_r=''
664 sethostent_r_proto=''
665 d_setitimer=''
666 d_setlinebuf=''
667 d_setlocale=''
668 d_setlocale_r=''
669 setlocale_r_proto=''
670 d_setnent=''
671 d_setnetent_r=''
672 setnetent_r_proto=''
673 d_setpent=''
674 d_setpgid=''
675 d_setpgrp2=''
676 d_bsdsetpgrp=''
677 d_setpgrp=''
678 d_setprior=''
679 d_setproctitle=''
680 d_setprotoent_r=''
681 setprotoent_r_proto=''
682 d_setpwent=''
683 d_setpwent_r=''
684 setpwent_r_proto=''
685 d_setregid=''
686 d_setresgid=''
687 d_setresuid=''
688 d_setreuid=''
689 d_setrgid=''
690 d_setruid=''
691 d_setsent=''
692 d_setservent_r=''
693 setservent_r_proto=''
694 d_setsid=''
695 d_setvbuf=''
696 d_sfio=''
697 usesfio=''
698 d_shm=''
699 d_shmat=''
700 d_shmatprototype=''
701 shmattype=''
702 d_shmctl=''
703 d_shmdt=''
704 d_shmget=''
705 d_sigaction=''
706 d_signbit=''
707 d_sigprocmask=''
708 d_sigsetjmp=''
709 usesitecustomize=''
710 d_snprintf=''
711 d_vsnprintf=''
712 d_sockatmark=''
713 d_sockatmarkproto=''
714 d_msg_ctrunc=''
715 d_msg_dontroute=''
716 d_msg_oob=''
717 d_msg_peek=''
718 d_msg_proxy=''
719 d_oldsock=''
720 d_scm_rights=''
721 d_socket=''
722 d_sockpair=''
723 sockethdr=''
724 socketlib=''
725 d_socklen_t=''
726 d_socks5_init=''
727 d_sprintf_returns_strlen=''
728 d_sqrtl=''
729 d_srand48_r=''
730 srand48_r_proto=''
731 d_srandom_r=''
732 srandom_r_proto=''
733 d_sresgproto=''
734 d_sresuproto=''
735 d_statblks=''
736 d_statfs_f_flags=''
737 d_statfs_s=''
738 d_fstatvfs=''
739 d_statvfs=''
740 d_stdio_cnt_lval=''
741 d_stdio_ptr_lval=''
742 d_stdio_ptr_lval_nochange_cnt=''
743 d_stdio_ptr_lval_sets_cnt=''
744 d_stdiobase=''
745 d_stdstdio=''
746 stdio_base=''
747 stdio_bufsiz=''
748 stdio_cnt=''
749 stdio_filbuf=''
750 stdio_ptr=''
751 d_index=''
752 d_strchr=''
753 d_strcoll=''
754 d_strctcpy=''
755 d_strerrm=''
756 d_strerror=''
757 d_sysernlst=''
758 d_syserrlst=''
759 d_strerror_r=''
760 strerror_r_proto=''
761 d_strftime=''
762 d_strlcat=''
763 d_strlcpy=''
764 d_strtod=''
765 d_strtol=''
766 d_strtold=''
767 d_strtoll=''
768 d_strtoq=''
769 d_strtoul=''
770 d_strtoull=''
771 d_strtouq=''
772 d_strxfrm=''
773 d_symlink=''
774 d_syscall=''
775 d_syscallproto=''
776 d_sysconf=''
777 d_system=''
778 d_tcgetpgrp=''
779 d_tcsetpgrp=''
780 d_telldirproto=''
781 d_time=''
782 timetype=''
783 d_asctime64=''
784 d_ctime64=''
785 d_difftime64=''
786 d_gmtime64=''
787 d_localtime64=''
788 d_mktime64=''
789 d_timegm=''
790 clocktype=''
791 d_times=''
792 d_tmpnam_r=''
793 tmpnam_r_proto=''
794 d_truncate=''
795 d_ttyname_r=''
796 ttyname_r_proto=''
797 d_tzname=''
798 d_u32align=''
799 d_ualarm=''
800 d_umask=''
801 d_semctl_semid_ds=''
802 d_semctl_semun=''
803 d_union_semun=''
804 d_unordered=''
805 d_unsetenv=''
806 d_usleep=''
807 d_usleepproto=''
808 d_ustat=''
809 d_pseudofork=''
810 d_vfork=''
811 usevfork=''
812 d_voidsig=''
813 signal_t=''
814 d_volatile=''
815 d_charvspr=''
816 d_vprintf=''
817 d_wait4=''
818 d_waitpid=''
819 d_wcstombs=''
820 d_wctomb=''
821 d_writev=''
822 dlext=''
823 cccdlflags=''
824 ccdlflags=''
825 dlsrc=''
826 ld=''
827 lddlflags=''
828 usedl=''
829 doublesize=''
830 ebcdic=''
831 fflushNULL=''
832 fflushall=''
833 fpossize=''
834 fpostype=''
835 gccansipedantic=''
836 gccosandvers=''
837 gccversion=''
838 gidformat=''
839 gidsign=''
840 gidsize=''
841 gidtype=''
842 groupstype=''
843 h_fcntl=''
844 h_sysfile=''
845 html1dir=''
846 html1direxp=''
847 installhtml1dir=''
848 html3dir=''
849 html3direxp=''
850 installhtml3dir=''
851 i_arpainet=''
852 i_assert=''
853 i_crypt=''
854 db_hashtype=''
855 db_prefixtype=''
856 db_version_major=''
857 db_version_minor=''
858 db_version_patch=''
859 i_db=''
860 i_dbm=''
861 i_rpcsvcdbm=''
862 d_dirnamlen=''
863 direntrytype=''
864 i_dirent=''
865 i_dld=''
866 i_dlfcn=''
867 i_fcntl=''
868 i_float=''
869 i_fp=''
870 i_fp_class=''
871 i_gdbm=''
872 d_grpasswd=''
873 i_grp=''
874 i_ieeefp=''
875 i_inttypes=''
876 i_langinfo=''
877 i_libutil=''
878 i_limits=''
879 i_locale=''
880 i_machcthr=''
881 i_malloc=''
882 i_mallocmalloc=''
883 i_math=''
884 i_memory=''
885 i_mntent=''
886 d_gdbm_ndbm_h_uses_prototypes=''
887 d_gdbmndbm_h_uses_prototypes=''
888 d_ndbm=''
889 d_ndbm_h_uses_prototypes=''
890 i_gdbm_ndbm=''
891 i_gdbmndbm=''
892 i_ndbm=''
893 i_netdb=''
894 i_neterrno=''
895 i_netinettcp=''
896 i_niin=''
897 i_sysin=''
898 i_poll=''
899 i_prot=''
900 i_pthread=''
901 d_pwage=''
902 d_pwchange=''
903 d_pwclass=''
904 d_pwcomment=''
905 d_pwexpire=''
906 d_pwgecos=''
907 d_pwpasswd=''
908 d_pwquota=''
909 i_pwd=''
910 i_sfio=''
911 i_shadow=''
912 i_socks=''
913 i_stddef=''
914 i_stdlib=''
915 i_string=''
916 strings=''
917 i_sunmath=''
918 i_sysaccess=''
919 i_sysdir=''
920 i_sysfile=''
921 d_voidtty=''
922 i_bsdioctl=''
923 i_sysfilio=''
924 i_sysioctl=''
925 i_syssockio=''
926 i_syslog=''
927 i_sysmman=''
928 i_sysmode=''
929 i_sysmount=''
930 i_sysndir=''
931 i_sysparam=''
932 i_syspoll=''
933 i_sysresrc=''
934 i_syssecrt=''
935 i_sysselct=''
936 i_sysstat=''
937 i_sysstatfs=''
938 i_sysstatvfs=''
939 i_systimes=''
940 i_systypes=''
941 i_sysuio=''
942 i_sysun=''
943 i_sysutsname=''
944 i_sysvfs=''
945 i_syswait=''
946 i_sgtty=''
947 i_termio=''
948 i_termios=''
949 d_tm_tm_gmtoff=''
950 d_tm_tm_zone=''
951 i_systime=''
952 i_systimek=''
953 i_time=''
954 timeincl=''
955 i_unistd=''
956 i_ustat=''
957 i_utime=''
958 i_values=''
959 i_stdarg=''
960 i_varargs=''
961 i_varhdr=''
962 i_vfork=''
963 d_inc_version_list=''
964 inc_version_list=''
965 inc_version_list_init=''
966 installprefix=''
967 installprefixexp=''
968 installstyle=''
969 installusrbinperl=''
970 intsize=''
971 longsize=''
972 shortsize=''
973 issymlink=''
974 libc=''
975 ldlibpthname=''
976 libperl=''
977 shrpenv=''
978 useshrplib=''
979 glibpth=''
980 libpth=''
981 loclibpth=''
982 plibpth=''
983 xlibpth=''
984 ignore_versioned_solibs=''
985 libs=''
986 libsdirs=''
987 libsfiles=''
988 libsfound=''
989 libspath=''
990 lns=''
991 d_PRIEUldbl=''
992 d_PRIFUldbl=''
993 d_PRIGUldbl=''
994 d_PRIeldbl=''
995 d_PRIfldbl=''
996 d_PRIgldbl=''
997 d_SCNfldbl=''
998 sPRIEUldbl=''
999 sPRIFUldbl=''
1000 sPRIGUldbl=''
1001 sPRIeldbl=''
1002 sPRIfldbl=''
1003 sPRIgldbl=''
1004 sSCNfldbl=''
1005 lseeksize=''
1006 lseektype=''
1007 mad=''
1008 madlyh=''
1009 madlyobj=''
1010 madlysrc=''
1011 make_set_make=''
1012 d_mymalloc=''
1013 freetype=''
1014 mallocobj=''
1015 mallocsrc=''
1016 malloctype=''
1017 usemallocwrap=''
1018 usemymalloc=''
1019 installman1dir=''
1020 man1dir=''
1021 man1direxp=''
1022 man1ext=''
1023 installman3dir=''
1024 man3dir=''
1025 man3direxp=''
1026 man3ext=''
1027 modetype=''
1028 multiarch=''
1029 mydomain=''
1030 myhostname=''
1031 phostname=''
1032 c=''
1033 n=''
1034 d_eofnblk=''
1035 eagain=''
1036 o_nonblock=''
1037 rd_nodata=''
1038 need_va_copy=''
1039 netdb_hlen_type=''
1040 netdb_host_type=''
1041 netdb_name_type=''
1042 netdb_net_type=''
1043 groupcat=''
1044 hostcat=''
1045 passcat=''
1046 orderlib=''
1047 ranlib=''
1048 d_perl_otherlibdirs=''
1049 otherlibdirs=''
1050 package=''
1051 spackage=''
1052 pager=''
1053 api_revision=''
1054 api_subversion=''
1055 api_version=''
1056 api_versionstring=''
1057 patchlevel=''
1058 perl_patchlevel=''
1059 revision=''
1060 subversion=''
1061 version=''
1062 version_patchlevel_string=''
1063 perl5=''
1064 perladmin=''
1065 perlpath=''
1066 d_nv_preserves_uv=''
1067 d_nv_zero_is_allbits_zero=''
1068 i16size=''
1069 i16type=''
1070 i32size=''
1071 i32type=''
1072 i64size=''
1073 i64type=''
1074 i8size=''
1075 i8type=''
1076 ivsize=''
1077 ivtype=''
1078 nv_overflows_integers_at=''
1079 nv_preserves_uv_bits=''
1080 nvsize=''
1081 nvtype=''
1082 u16size=''
1083 u16type=''
1084 u32size=''
1085 u32type=''
1086 u64size=''
1087 u64type=''
1088 u8size=''
1089 u8type=''
1090 uvsize=''
1091 uvtype=''
1092 ivdformat=''
1093 nvEUformat=''
1094 nvFUformat=''
1095 nvGUformat=''
1096 nveformat=''
1097 nvfformat=''
1098 nvgformat=''
1099 uvXUformat=''
1100 uvoformat=''
1101 uvuformat=''
1102 uvxformat=''
1103 pidtype=''
1104 prefix=''
1105 prefixexp=''
1106 installprivlib=''
1107 privlib=''
1108 privlibexp=''
1109 prototype=''
1110 ptrsize=''
1111 d_PRIXU64=''
1112 d_PRId64=''
1113 d_PRIi64=''
1114 d_PRIo64=''
1115 d_PRIu64=''
1116 d_PRIx64=''
1117 sPRIXU64=''
1118 sPRId64=''
1119 sPRIi64=''
1120 sPRIo64=''
1121 sPRIu64=''
1122 sPRIx64=''
1123 d_quad=''
1124 quadkind=''
1125 quadtype=''
1126 uquadtype=''
1127 drand01=''
1128 randbits=''
1129 randfunc=''
1130 randseedtype=''
1131 seedfunc=''
1132 installscript=''
1133 scriptdir=''
1134 scriptdirexp=''
1135 selectminbits=''
1136 selecttype=''
1137 sh=''
1138 sig_count=''
1139 sig_name=''
1140 sig_name_init=''
1141 sig_num=''
1142 sig_num_init=''
1143 sig_size=''
1144 d_sitearch=''
1145 installsitearch=''
1146 sitearch=''
1147 sitearchexp=''
1148 installsitebin=''
1149 sitebin=''
1150 sitebinexp=''
1151 installsitehtml1dir=''
1152 sitehtml1dir=''
1153 sitehtml1direxp=''
1154 installsitehtml3dir=''
1155 sitehtml3dir=''
1156 sitehtml3direxp=''
1157 installsitelib=''
1158 sitelib=''
1159 sitelib_stem=''
1160 sitelibexp=''
1161 installsiteman1dir=''
1162 siteman1dir=''
1163 siteman1direxp=''
1164 installsiteman3dir=''
1165 siteman3dir=''
1166 siteman3direxp=''
1167 siteprefix=''
1168 siteprefixexp=''
1169 installsitescript=''
1170 sitescript=''
1171 sitescriptexp=''
1172 sizesize=''
1173 sizetype=''
1174 so=''
1175 socksizetype=''
1176 sharpbang=''
1177 shsharp=''
1178 spitshell=''
1179 src=''
1180 ssizetype=''
1181 startperl=''
1182 startsh=''
1183 stdchar=''
1184 d_stdio_stream_array=''
1185 stdio_stream_array=''
1186 sysman=''
1187 sGMTIME_max=''
1188 sGMTIME_min=''
1189 sLOCALTIME_max=''
1190 sLOCALTIME_min=''
1191 trnl=''
1192 uidformat=''
1193 uidsign=''
1194 uidsize=''
1195 uidtype=''
1196 archname64=''
1197 use64bitall=''
1198 use64bitint=''
1199 dtrace=''
1200 usedtrace=''
1201 usefaststdio=''
1202 ccflags_uselargefiles=''
1203 ldflags_uselargefiles=''
1204 libswanted_uselargefiles=''
1205 uselargefiles=''
1206 uselongdouble=''
1207 usemorebits=''
1208 usemultiplicity=''
1209 nm_opt=''
1210 nm_so_opt=''
1211 runnm=''
1212 usenm=''
1213 useperlio=''
1214 usesocks=''
1215 d_oldpthreads=''
1216 use5005threads=''
1217 useithreads=''
1218 usereentrant=''
1219 usethreads=''
1220 incpath=''
1221 mips_type=''
1222 usrinc=''
1223 d_vendorarch=''
1224 installvendorarch=''
1225 vendorarch=''
1226 vendorarchexp=''
1227 d_vendorbin=''
1228 installvendorbin=''
1229 vendorbin=''
1230 vendorbinexp=''
1231 installvendorhtml1dir=''
1232 vendorhtml1dir=''
1233 vendorhtml1direxp=''
1234 installvendorhtml3dir=''
1235 vendorhtml3dir=''
1236 vendorhtml3direxp=''
1237 d_vendorlib=''
1238 installvendorlib=''
1239 vendorlib=''
1240 vendorlib_stem=''
1241 vendorlibexp=''
1242 installvendorman1dir=''
1243 vendorman1dir=''
1244 vendorman1direxp=''
1245 installvendorman3dir=''
1246 vendorman3dir=''
1247 vendorman3direxp=''
1248 usevendorprefix=''
1249 vendorprefix=''
1250 vendorprefixexp=''
1251 d_vendorscript=''
1252 installvendorscript=''
1253 vendorscript=''
1254 vendorscriptexp=''
1255 versiononly=''
1256 defvoidused=''
1257 voidflags=''
1258 yacc=''
1259 yaccflags=''
1260 CONFIG=''
1261
1262 : Detect odd OSs
1263 define='define'
1264 undef='undef'
1265 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1266 rmlist=''
1267
1268 : We must find out about Eunice early
1269 eunicefix=':'
1270 if test -f /etc/unixtovms; then
1271         eunicefix=/etc/unixtovms
1272 fi
1273 if test -f /etc/unixtovms.exe; then
1274         eunicefix=/etc/unixtovms.exe
1275 fi
1276
1277 : Set executable suffix now -- needed before hints available
1278 if test -f "/libs/version.library"; then
1279 : Amiga OS
1280     _exe=""
1281 elif test -f "/system/gnu_library/bin/ar.pm"; then
1282 : Stratus VOS
1283     _exe=".pm"
1284 elif test -n "$DJGPP"; then
1285 : DOS DJGPP
1286     _exe=".exe"
1287 elif test -d c:/. -o -n "$is_os2" ; then
1288 : OS/2 or cygwin
1289     _exe=".exe"
1290 fi
1291
1292 groupstype=''
1293 i_whoami=''
1294 : Trailing extension.  Override this in a hint file, if needed.
1295 : Extra object files, if any, needed on this platform.
1296 archobjs=''
1297 archname=''
1298 libnames=''
1299 : change the next line if compiling for Xenix/286 on Xenix/386
1300 xlibpth='/usr/lib/386 /lib/386'
1301 : Possible local library directories to search.
1302 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1303 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1304
1305 : general looking path for locating libraries
1306 glibpth="/lib /usr/lib $xlibpth"
1307 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1308 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1309 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1310 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1311
1312 : Private path used by Configure to find libraries.  Its value
1313 : is prepended to libpth. This variable takes care of special
1314 : machines, like the mips.  Usually, it should be empty.
1315 plibpth=''
1316
1317 : default library list
1318 libswanted=''
1319 : some systems want to use only the non-versioned libso:s
1320 ignore_versioned_solibs=''
1321 : set usethreads on the Configure command line to enable threads.
1322 usereentrant='undef'
1323 : full support for void wanted by default
1324 defvoidused=15
1325
1326 : Possible local include directories to search.
1327 : Set locincpth to "" in a hint file to defeat local include searches.
1328 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1329 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1330 :
1331 : no include file wanted by default
1332 inclwanted=''
1333
1334 : Enable -DEBUGGING and -DDEBUGGING from the command line
1335 EBUGGING=''
1336 DEBUGGING=old
1337
1338 ccname=''
1339 ccversion=''
1340 perllibs=''
1341 : set useposix=false in your hint file to disable the POSIX extension.
1342 useposix=true
1343 : set useopcode=false in your hint file to disable the Opcode extension.
1344 useopcode=true
1345 archname64=''
1346 ccflags_uselargefiles=''
1347 ldflags_uselargefiles=''
1348 libswanted_uselargefiles=''
1349 : set usemultiplicity on the Configure command line to enable multiplicity.
1350 : set usesocks on the Configure command line to enable socks.
1351 : List of libraries we want.
1352 : If anyone needs extra -lxxx, put those in a hint file.
1353 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1354 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1355 : We probably want to search /usr/shlib before most other libraries.
1356 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1357 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1358 glibpth="/usr/shlib $glibpth"
1359 : Do not use vfork unless overridden by a hint file.
1360 usevfork=false
1361
1362 : Find the basic shell for Bourne shell scripts
1363 case "$sh" in
1364 '')
1365         case "$SYSTYPE" in
1366         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1367         *) xxx='/bin/sh';;
1368         esac
1369         if test -f "$xxx"; then
1370                 sh="$xxx"
1371         else
1372                 : Build up a list and do a single loop so we can 'break' out.
1373                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1374                 for xxx in sh bash ksh pdksh ash; do
1375                         for p in $pth; do
1376                                 try="$try ${p}/${xxx}"
1377                         done
1378                 done
1379                 for xxx in $try; do
1380                         if test -f "$xxx"; then
1381                                 sh="$xxx";
1382                                 break
1383                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1384                                 sh="$xxx";
1385                                 break
1386                         elif test -f "$xxx.exe"; then
1387                                 sh="$xxx";
1388                                 break
1389                         fi
1390                 done
1391         fi
1392         ;;
1393 esac
1394
1395 case "$sh" in
1396 '')     cat >&2 <<EOM
1397 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1398
1399 Usually it's in /bin/sh.  How did you even get this far?
1400 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1401 we'll try to straighten this all out.
1402 EOM
1403         exit 1
1404         ;;
1405 esac
1406
1407 : see if sh knows # comments
1408 if `$sh -c '#' >/dev/null 2>&1`; then
1409         shsharp=true
1410         spitshell=cat
1411         xcat=/bin/cat
1412         test -f $xcat$_exe || xcat=/usr/bin/cat
1413         if test ! -f $xcat$_exe; then
1414                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1415                         if test -f $p/cat$_exe; then
1416                                 xcat=$p/cat
1417                                 break
1418                         fi
1419                 done
1420                 if test ! -f $xcat$_exe; then
1421                         echo "Can't find cat anywhere!"
1422                         exit 1
1423                 fi
1424         fi
1425         echo "#!$xcat" >sharp
1426         $eunicefix sharp
1427         chmod +x sharp
1428         ./sharp > today 2>/dev/null
1429         if test -s today; then
1430                 sharpbang='#!'
1431         else
1432                 echo "#! $xcat" > sharp
1433                 $eunicefix sharp
1434                 chmod +x sharp
1435                 ./sharp > today 2>/dev/null
1436                 if test -s today; then
1437                         sharpbang='#! '
1438                 else
1439                         sharpbang=': use '
1440                 fi
1441         fi
1442 else
1443         echo " "
1444         echo "Your $sh doesn't grok # comments--I will strip them later on."
1445         shsharp=false
1446         cd ..
1447         echo "exec grep -v '^[  ]*#'" >spitshell
1448         chmod +x spitshell
1449         $eunicefix spitshell
1450         spitshell=`pwd`/spitshell
1451         cd UU
1452         echo "I presume that if # doesn't work, #! won't work either!"
1453         sharpbang=': use '
1454 fi
1455 rm -f sharp today
1456
1457 : figure out how to guarantee sh startup
1458 case "$startsh" in
1459 '') startsh=${sharpbang}${sh} ;;
1460 *)
1461 esac
1462 cat >sharp <<EOSS
1463 $startsh
1464 set abc
1465 test "$?abc" != 1
1466 EOSS
1467
1468 chmod +x sharp
1469 $eunicefix sharp
1470 if ./sharp; then
1471         : echo "Yup, it does."
1472 else
1473         echo "Hmm... '$startsh' does not guarantee sh startup..."
1474         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1475 fi
1476 rm -f sharp
1477
1478 : Save command line options in file UU/cmdline.opt for later use in
1479 : generating config.sh.
1480 cat > cmdline.opt <<EOSH
1481 : Configure command line arguments.
1482 config_arg0='$0'
1483 config_args='$*'
1484 config_argc=$#
1485 EOSH
1486 argn=1
1487 args_exp=''
1488 args_sep=''
1489 for arg in "$@"; do
1490         cat >>cmdline.opt <<EOSH
1491 config_arg$argn='$arg'
1492 EOSH
1493         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1494 $arg
1495 EOC
1496         arg_exp=`cat cmdl.opt`
1497         args_exp="$args_exp$args_sep'$arg_exp'"
1498         argn=`expr $argn + 1`
1499         args_sep=' '
1500 done
1501 rm -f cmdl.opt
1502
1503 : produce awk script to parse command line options
1504 cat >options.awk <<'EOF'
1505 BEGIN {
1506         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1507
1508         len = length(optstr);
1509         for (i = 1; i <= len; i++) {
1510                 c = substr(optstr, i, 1);
1511                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1512                 if (a == ":") {
1513                         arg[c] = 1;
1514                         i++;
1515                 }
1516                 opt[c] = 1;
1517         }
1518 }
1519 {
1520         expect = 0;
1521         str = $0;
1522         if (substr(str, 1, 1) != "-") {
1523                 printf("'%s'\n", str);
1524                 next;
1525         }
1526         len = length($0);
1527         for (i = 2; i <= len; i++) {
1528                 c = substr(str, i, 1);
1529                 if (!opt[c]) {
1530                         printf("-%s\n", substr(str, i));
1531                         next;
1532                 }
1533                 printf("-%s\n", c);
1534                 if (arg[c]) {
1535                         if (i < len)
1536                                 printf("'%s'\n", substr(str, i + 1));
1537                         else
1538                                 expect = 1;
1539                         next;
1540                 }
1541         }
1542 }
1543 END {
1544         if (expect)
1545                 print "?";
1546 }
1547 EOF
1548
1549 : process the command line options
1550 set X `for arg in "$@"; do echo "X$arg"; done |
1551         sed -e s/X// | awk -f options.awk`
1552 eval "set $*"
1553 shift
1554 rm -f options.awk
1555
1556 : set up default values
1557 fastread=''
1558 reuseval=false
1559 config_sh=''
1560 alldone=''
1561 error=''
1562 silent=''
1563 extractsh=''
1564 override=''
1565 knowitall=''
1566 rm -f optdef.sh posthint.sh
1567 cat >optdef.sh <<EOS
1568 $startsh
1569 EOS
1570
1571
1572 : option parsing
1573 while test $# -gt 0; do
1574         case "$1" in
1575         -d) shift; fastread=yes;;
1576         -e) shift; alldone=cont;;
1577         -f)
1578                 shift
1579                 cd ..
1580                 if test -r "$1"; then
1581                         config_sh="$1"
1582                 else
1583                         echo "$me: cannot read config file $1." >&2
1584                         error=true
1585                 fi
1586                 cd UU
1587                 shift;;
1588         --help|\
1589         -h) shift; error=true;;
1590         -r) shift; reuseval=true;;
1591         -s) shift; silent=true; realsilent=true;;
1592         -E) shift; alldone=exit;;
1593         -K) shift; knowitall=true;;
1594         -O) shift; override=true;;
1595         -S) shift; silent=true; extractsh=true;;
1596         -D)
1597                 shift
1598                 case "$1" in
1599                 *=)
1600                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1601                         echo "$me: ignoring -D $1" >&2
1602                         ;;
1603                 *=*) echo "$1" | \
1604                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1605                 *) echo "$1='define'" >> optdef.sh;;
1606                 esac
1607                 shift
1608                 ;;
1609         -U)
1610                 shift
1611                 case "$1" in
1612                 *=) echo "$1" >> optdef.sh;;
1613                 *=*)
1614                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1615                         echo "$me: ignoring -U $1" >&2
1616                         ;;
1617                 *) echo "$1='undef'" >> optdef.sh;;
1618                 esac
1619                 shift
1620                 ;;
1621         -A)
1622             shift
1623             xxx=''
1624             yyy="$1"
1625             zzz=''
1626             uuu=undef
1627             case "$yyy" in
1628             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1629                  case "$zzz" in
1630                  *:*) zzz='' ;;
1631                  *)   xxx=append
1632                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1633                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1634                  esac
1635                  ;;
1636             esac
1637             case "$xxx" in
1638             '')  case "$yyy" in
1639                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1640                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1641                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1642                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1643                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1644                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1645                  esac
1646                  ;;
1647             esac
1648             case "$xxx" in
1649             append)
1650                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1651             clear)
1652                 echo "$yyy=''"                  >> posthint.sh ;;
1653             define)
1654                 case "$zzz" in
1655                 '') zzz=define ;;
1656                 esac
1657                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1658             eval)
1659                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1660             prepend)
1661                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1662             undef)
1663                 case "$zzz" in
1664                 '') zzz="$uuu" ;;
1665                 esac
1666                 echo "$yyy=$zzz"                >> posthint.sh ;;
1667             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1668             esac
1669             shift
1670             ;;
1671         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1672             exit 0;;
1673         --) break;;
1674         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1675         *) break;;
1676         esac
1677 done
1678
1679 case "$error" in
1680 true)
1681         cat >&2 <<EOM
1682 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1683                  [-U symbol] [-U symbol=] [-A command:symbol...]
1684   -d : use defaults for all answers.
1685   -e : go on without questioning past the production of config.sh.
1686   -f : specify an alternate default configuration file.
1687   -h : print this help message and exit (with an error status).
1688   -r : reuse C symbols value if possible (skips costly nm extraction).
1689   -s : silent mode, only echoes questions and essential information.
1690   -D : define symbol to have some value:
1691          -D symbol         symbol gets the value 'define'
1692          -D symbol=value   symbol gets the value 'value'
1693        common used examples (see INSTALL for more info):
1694          -Duse64bitint            use 64bit integers
1695          -Duse64bitall            use 64bit integers and pointers
1696          -Dusethreads             use thread support
1697          -Dinc_version_list=none  do not include older perl trees in @INC
1698          -DEBUGGING=none          DEBUGGING options
1699          -Dcc=gcc                 choose your compiler
1700          -Dprefix=/opt/perl5      choose your destination
1701   -E : stop at the end of questions, after having produced config.sh.
1702   -K : do not use unless you know what you are doing.
1703   -O : let -D and -U override definitions from loaded configuration file.
1704   -S : perform variable substitutions on all .SH files (can mix with -f)
1705   -U : undefine symbol:
1706          -U symbol    symbol gets the value 'undef'
1707          -U symbol=   symbol gets completely empty
1708        e.g.:  -Uversiononly
1709   -A : manipulate symbol after the platform specific hints have been applied:
1710          -A append:symbol=value   append value to symbol
1711          -A symbol=value          like append:, but with a separating space
1712          -A define:symbol=value   define symbol to have value
1713          -A clear:symbol          define symbol to be ''
1714          -A define:symbol         define symbol to be 'define'
1715          -A eval:symbol=value     define symbol to be eval of value
1716          -A prepend:symbol=value  prepend value to symbol
1717          -A undef:symbol          define symbol to be 'undef'
1718          -A undef:symbol=         define symbol to be ''
1719        e.g.:  -A prepend:libswanted='cl pthread '
1720               -A ccflags=-DSOME_MACRO
1721   -V : print version number and exit (with a zero status).
1722 EOM
1723         exit 1
1724         ;;
1725 esac
1726
1727 : Sanity checks
1728 case "$fastread$alldone" in
1729 yescont|yesexit) ;;
1730 *)
1731         case "$extractsh" in
1732         true) ;;
1733         *)
1734                 if test ! -t 0; then
1735                         echo "Say 'sh Configure', not 'sh <Configure'"
1736                         exit 1
1737                 fi
1738                 ;;
1739         esac
1740         ;;
1741 esac
1742
1743 exec 4>&1
1744 case "$silent" in
1745 true) exec 1>/dev/null;;
1746 esac
1747
1748 : run the defines and the undefines, if any, but leave the file out there...
1749 touch optdef.sh
1750 . ./optdef.sh
1751 : create the posthint manipulation script and leave the file out there...
1752 touch posthint.sh
1753
1754 : set package name
1755 package='perl5'
1756 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1757 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1758 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1759 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1760 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1761 esac
1762
1763 : Some greps do not return status, grrr.
1764 echo "grimblepritz" >grimble
1765 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1766         contains=contains
1767 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1768         contains=grep
1769 else
1770         contains=contains
1771 fi
1772 rm -f grimble
1773 : the following should work in any shell
1774 case "$contains" in
1775 contains*)
1776         echo " "
1777         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1778         cat >contains <<'EOSS'
1779 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1780 EOSS
1781 chmod +x contains
1782 esac
1783
1784 : Find the path to the source tree
1785 case "$src" in
1786 '') case "$0" in
1787     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1788          case "$src" in
1789          /*)    ;;
1790          .)     ;;
1791          *)     src=`cd ../$src && pwd` ;;
1792          esac
1793          ;;
1794     *)   src='.';;
1795     esac;;
1796 esac
1797 case "$src" in
1798 '')     src=/
1799         rsrc=/
1800         ;;
1801 /*)     rsrc="$src";;
1802 *)      rsrc="../$src";;
1803 esac
1804 if test -f $rsrc/Configure && \
1805         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1806 then
1807    : found it, so we are ok.
1808 else
1809         rsrc=''
1810         for src in . .. ../.. ../../.. ../../../..; do
1811                 if test -f ../$src/Configure && \
1812                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1813                 then
1814                         rsrc=../$src
1815                         break
1816                 fi
1817         done
1818 fi
1819 case "$rsrc" in
1820 '')
1821         cat <<EOM >&4
1822
1823 Sorry, I can't seem to locate the source dir for $package.  Please start
1824 Configure with an explicit path -- i.e. /some/path/Configure.
1825
1826 EOM
1827         exit 1
1828         ;;
1829 ../.)   rsrc='..';;
1830 *)
1831         echo " "
1832         echo "Sources for $package found in \"$src\"." >&4
1833         ;;
1834 esac
1835
1836 : script used to extract .SH files with variable substitutions
1837 cat >extract <<'EOS'
1838 PERL_CONFIG_SH=true
1839 echo "Doing variable substitutions on .SH files..."
1840 if test -f MANIFEST; then
1841         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1842 else
1843         echo "(Looking for .SH files under the source directory.)"
1844         set x `(cd "$src"; find . -name "*.SH" -print)`
1845 fi
1846 shift
1847 case $# in
1848 0) set x `(cd "$src"; echo *.SH)`; shift;;
1849 esac
1850 if test ! -f "$src/$1"; then
1851         shift
1852 fi
1853 mkdir_p='
1854 name=$1;
1855 create="";
1856 while test $name; do
1857         if test ! -d "$name"; then
1858                 create="$name $create";
1859                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1860                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1861         else
1862                 name="";
1863         fi;
1864 done;
1865 for file in $create; do
1866         mkdir $file;
1867 done
1868 '
1869 for file in $*; do
1870         case "$src" in
1871         ".")
1872                 case "$file" in
1873                 */*)
1874                         dir=`expr X$file : 'X\(.*\)/'`
1875                         file=`expr X$file : 'X.*/\(.*\)'`
1876                         (cd "$dir" && . ./$file)
1877                         ;;
1878                 *)
1879                         . ./$file
1880                         ;;
1881                 esac
1882                 ;;
1883         *)
1884                 case "$file" in
1885                 */*)
1886                         dir=`expr X$file : 'X\(.*\)/'`
1887                         file=`expr X$file : 'X.*/\(.*\)'`
1888                         (set x $dir; shift; eval $mkdir_p)
1889                         sh <"$src/$dir/$file"
1890                         ;;
1891                 *)
1892                         sh <"$src/$file"
1893                         ;;
1894                 esac
1895                 ;;
1896         esac
1897 done
1898 if test -f "$src/config_h.SH"; then
1899         if test ! -f config.h; then
1900         : oops, they left it out of MANIFEST, probably, so do it anyway.
1901         . "$src/config_h.SH"
1902         fi
1903 fi
1904 EOS
1905
1906 : extract files and exit if asked to do so
1907 case "$extractsh" in
1908 true)
1909         case "$realsilent" in
1910         true) ;;
1911         *) exec 1>&4;;
1912         esac
1913         case "$config_sh" in
1914         '') config_sh='config.sh';;
1915         esac
1916         echo " "
1917         echo "Fetching answers from $config_sh..."
1918         cd ..
1919         . $config_sh
1920         test "$override" && . ./optdef.sh
1921         echo " "
1922         . UU/extract
1923         rm -rf UU
1924         echo "Extraction done."
1925         exit 0
1926         ;;
1927 esac
1928
1929 : Eunice requires " " instead of "", can you believe it
1930 echo " "
1931 : Here we go...
1932 echo "Beginning of configuration questions for $package."
1933
1934 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1935
1936 : first determine how to suppress newline on echo command
1937 echo " "
1938 echo "Checking echo to see how to suppress newlines..."
1939 (echo "hi there\c" ; echo " ") >.echotmp
1940 if $contains c .echotmp >/dev/null 2>&1 ; then
1941         echo "...using -n."
1942         n='-n'
1943         c=''
1944 else
1945         cat <<'EOM'
1946 ...using \c
1947 EOM
1948         n=''
1949         c='\c'
1950 fi
1951 echo $n "The star should be here-->$c"
1952 echo '*'
1953 rm -f .echotmp
1954
1955 : Now test for existence of everything in MANIFEST
1956 echo " "
1957 if test -f "$rsrc/MANIFEST"; then
1958         echo "First let's make sure your kit is complete.  Checking..." >&4
1959         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1960                 (split -l 50 2>/dev/null || split -50)
1961         rm -f missing
1962         tmppwd=`pwd`
1963         for filelist in x??; do
1964                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1965                         >/dev/null 2>>"$tmppwd/missing")
1966         done
1967         if test -s missing; then
1968                 cat missing >&4
1969                 cat >&4 <<'EOM'
1970
1971 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1972
1973 You have the option of continuing the configuration process, despite the
1974 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1975 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1976 and contact the author (perlbug@perl.org).
1977
1978 EOM
1979                 echo $n "Continue? [n] $c" >&4
1980                 read ans
1981                 case "$ans" in
1982                 y*)
1983                         echo "Continuing..." >&4
1984                         rm -f missing
1985                         ;;
1986                 *)
1987                         echo "ABORTING..." >&4
1988                         kill $$
1989                         ;;
1990                 esac
1991         else
1992                 echo "Looks good..."
1993         fi
1994 else
1995         echo "There is no MANIFEST file.  I hope your kit is complete !"
1996 fi
1997 rm -f missing x??
1998
1999 : Find the appropriate value for a newline for tr
2000 echo " "
2001 if test -n "$DJGPP"; then
2002        trnl='\012'
2003 fi
2004 if test X"$trnl" = X; then
2005         case "`echo foo|tr '\n' x 2>/dev/null`" in
2006         foox) trnl='\n' ;;
2007         esac
2008 fi
2009 if test X"$trnl" = X; then
2010         case "`echo foo|tr '\012' x 2>/dev/null`" in
2011         foox) trnl='\012' ;;
2012         esac
2013 fi
2014 if test X"$trnl" = X; then
2015        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2016        fooxy) trnl='\n\r' ;;
2017        esac
2018 fi
2019 if test X"$trnl" = X; then
2020         cat <<EOM >&2
2021
2022 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2023
2024 EOM
2025         exit 1
2026 fi
2027
2028 : compute the number of columns on the terminal for proper question formatting
2029 case "$COLUMNS" in
2030 '') COLUMNS='80';;
2031 esac
2032
2033 : set up the echo used in my read
2034 myecho="case \"\$xxxm\" in
2035 '') echo $n \"\$rp $c\" >&4;;
2036 *) case \"\$rp\" in
2037         '') echo $n \"[\$xxxm] $c\";;
2038         *)
2039                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2040                         echo \"\$rp\" >&4
2041                         echo $n \"[\$xxxm] $c\" >&4
2042                 else
2043                         echo $n \"\$rp [\$xxxm] $c\" >&4
2044                 fi
2045                 ;;
2046         esac;;
2047 esac"
2048
2049 : now set up to do reads with possible shell escape and default assignment
2050 cat <<EOSC >myread
2051 $startsh
2052 xxxm=\$dflt
2053 $myecho
2054 ans='!'
2055 case "\$fastread" in
2056 yes) case "\$dflt" in
2057         '') ;;
2058         *) ans='';
2059                 case "\$silent-\$rp" in
2060                 true-) ;;
2061                 *) echo " " >&4;;
2062                 esac;;
2063         esac;;
2064 *) case "\$silent" in
2065         true) case "\$rp" in
2066                 '') ans='';;
2067                 esac;;
2068         esac;;
2069 esac
2070 while expr "X\$ans" : "X!" >/dev/null; do
2071         read answ
2072         set x \$xxxm
2073         shift
2074         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2075         case  "\$answ" in
2076         "!")
2077                 sh 1>&4
2078                 echo " "
2079                 $myecho
2080                 ;;
2081         !*)
2082                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2083                 shift
2084                 sh 1>&4 -c "\$*"
2085                 echo " "
2086                 $myecho
2087                 ;;
2088         "\$ans")
2089                 case "\$ans" in
2090                 \\&*)
2091                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2092                         shift
2093                         case "\$1" in
2094                         -d)
2095                                 fastread=yes
2096                                 echo "(OK, I'll run with -d after this question.)" >&4
2097                                 ;;
2098                         -*)
2099                                 echo "*** Sorry, \$1 not supported yet." >&4
2100                                 ;;
2101                         esac
2102                         $myecho
2103                         ans=!
2104                         ;;
2105                 esac;;
2106         *)
2107                 case "\$aok" in
2108                 y)
2109                         echo "*** Substitution done -- please confirm."
2110                         xxxm="\$ans"
2111                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2112                         xxxm="\$ans"
2113                         ans=!
2114                         ;;
2115                 *)
2116                         echo "*** Error -- try again."
2117                         ans=!
2118                         ;;
2119                 esac
2120                 $myecho
2121                 ;;
2122         esac
2123         case "\$ans\$xxxm\$nostick" in
2124         '')
2125                 ans=!
2126                 $myecho
2127                 ;;
2128         esac
2129 done
2130 case "\$ans" in
2131 '') ans="\$xxxm";;
2132 esac
2133 EOSC
2134
2135 : create .config dir to save info across Configure sessions
2136 test -d ../.config || mkdir ../.config
2137 cat >../.config/README <<EOF
2138 This directory created by Configure to save information that should
2139 persist across sessions for $package.
2140
2141 You may safely delete it if you wish.
2142 EOF
2143
2144 : See if we are using a devel version and want that
2145 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2146 case "$usedevel" in
2147 $define|true|[yY]*)
2148     usedevel="$define" ;;
2149 *) case "$xversion" in
2150    *[13579])
2151         cat >&4 <<EOH
2152 *** WHOA THERE!!! ***
2153
2154     This is an UNSTABLE DEVELOPMENT release.
2155     The version of this $package distribution is $xversion, that is, odd,
2156     (as opposed to even) and that signifies a development release.
2157     If you want a maintenance release, you want an even-numbered version.
2158
2159     Do ***NOT*** install this into production use.
2160     Data corruption and crashes are possible.
2161
2162     It is most seriously suggested that you do not continue any further
2163     unless you want to help in developing and debugging Perl.
2164
2165     If you *still* want to build perl, you can answer 'y' now,
2166     or pass -Dusedevel to Configure.
2167
2168 EOH
2169         rp='Do you really want to continue?'
2170         dflt='n'
2171         . ./myread
2172         case "$ans" in
2173         [yY]) echo >&4 "Okay, continuing."
2174               usedevel="$define" ;;
2175         *) echo >&4 "Okay, bye."
2176            exit 1
2177            ;;
2178         esac
2179         ;;
2180     esac
2181     usedevel="$undef"
2182     ;;
2183 esac
2184 case "$usedevel" in
2185 $define|true|[yY]*)
2186         case "$versiononly" in
2187         '') versiononly="$define" ;;
2188         esac
2189         case "$installusrbinperl" in
2190         '') installusrbinperl="$undef" ;;
2191         esac
2192         ;;
2193 esac
2194
2195 : general instructions
2196 needman=true
2197 firsttime=true
2198 user=`(logname) 2>/dev/null`
2199 case "$user" in
2200 '') user=`whoami 2>&1`;;
2201 esac
2202 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2203         firsttime=false
2204         echo " "
2205         rp='Would you like to see the instructions?'
2206         dflt=n
2207         . ./myread
2208         case "$ans" in
2209         [yY]*) ;;
2210         *) needman=false;;
2211         esac
2212 fi
2213 if $needman; then
2214         cat <<EOH
2215
2216 This installation shell script will examine your system and ask you questions
2217 to determine how the perl5 package should be installed. If you get
2218 stuck on a question, you may use a ! shell escape to start a subshell or
2219 execute a command.  Many of the questions will have default answers in square
2220 brackets; typing carriage return will give you the default.
2221
2222 On some of the questions which ask for file or directory names you are allowed
2223 to use the ~name construct to specify the login directory belonging to "name",
2224 even if you don't have a shell which knows about that.  Questions where this is
2225 allowed will be marked "(~name ok)".
2226
2227 EOH
2228         rp=''
2229         dflt='Type carriage return to continue'
2230         . ./myread
2231         cat <<'EOH'
2232
2233 The prompter used in this script allows you to use shell variables and
2234 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2235 in the default answer, as if the default line was a set of arguments given to a
2236 script shell.  This means you may also use $* to repeat the whole default line,
2237 so you do not have to re-type everything to add something to the default.
2238
2239 Everytime there is a substitution, you will have to confirm.  If there is an
2240 error (e.g. an unmatched backtick), the default answer will remain unchanged
2241 and you will be prompted again.
2242
2243 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2244 the questions and use the computed defaults (or the previous answers if there
2245 was already a config.sh file). Type 'Configure -h' for a list of options.
2246 You may also start interactively and then answer '& -d' at any prompt to turn
2247 on the non-interactive behaviour for the remainder of the execution.
2248
2249 EOH
2250         . ./myread
2251         cat <<EOH
2252
2253 Much effort has been expended to ensure that this shell script will run on any
2254 Unix system.  If despite that it blows up on yours, your best bet is to edit
2255 Configure and run it again.  If you can't run Configure for some reason,
2256 you'll have to generate a config.sh file by hand.  Whatever problems you
2257 have, let me (perlbug@perl.org) know how I blew it.
2258
2259 This installation script affects things in two ways:
2260
2261 1) it may do direct variable substitutions on some of the files included
2262    in this kit.
2263 2) it builds a config.h file for inclusion in C programs.  You may edit
2264    any of these files as the need arises after running this script.
2265
2266 If you make a mistake on a question, there is no easy way to back up to it
2267 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2268 files.  Configure will offer to let you do this before it runs the SH files.
2269
2270 EOH
2271         dflt='Type carriage return to continue'
2272         . ./myread
2273         case "$firsttime" in
2274         true) echo $user >>../.config/instruct;;
2275         esac
2276 fi
2277
2278 : find out where common programs are
2279 echo " "
2280 echo "Locating common programs..." >&4
2281 cat <<EOSC >loc
2282 $startsh
2283 case \$# in
2284 0) exit 1;;
2285 esac
2286 thing=\$1
2287 shift
2288 dflt=\$1
2289 shift
2290 for dir in \$*; do
2291         case "\$thing" in
2292         .)
2293         if test -d \$dir/\$thing; then
2294                 echo \$dir
2295                 exit 0
2296         fi
2297         ;;
2298         *)
2299         for thisthing in \$dir/\$thing; do
2300                 : just loop through to pick last item
2301         done
2302         if test -f \$thisthing; then
2303                 echo \$thisthing
2304                 exit 0
2305         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2306                 echo \$thisthing
2307                 exit 0
2308         elif test -f \$dir/\$thing.exe; then
2309                 if test -n "$DJGPP"; then
2310                         echo \$dir/\$thing.exe
2311                 elif test "$eunicefix" != ":"; then
2312                         : on Eunice apparently
2313                         echo \$dir/\$thing
2314                 fi
2315                 exit 0
2316         fi
2317         ;;
2318         esac
2319 done
2320 echo \$dflt
2321 exit 1
2322 EOSC
2323 chmod +x loc
2324 $eunicefix loc
2325 loclist="
2326 awk
2327 cat
2328 chmod
2329 comm
2330 cp
2331 echo
2332 expr
2333 grep
2334 ls
2335 mkdir
2336 rm
2337 sed
2338 sort
2339 touch
2340 tr
2341 uniq
2342 "
2343 trylist="
2344 ar
2345 bison
2346 byacc
2347 cpp
2348 csh
2349 date
2350 egrep
2351 gmake
2352 gzip
2353 less
2354 ln
2355 make
2356 more
2357 nm
2358 nroff
2359 pg
2360 test
2361 uname
2362 zip
2363 "
2364 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2365 pth="$pth /lib /usr/lib"
2366 for file in $loclist; do
2367         eval xxx=\$$file
2368         case "$xxx" in
2369         /*|?:[\\/]*)
2370                 if test -f "$xxx"; then
2371                         : ok
2372                 else
2373                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2374                         xxx=`./loc $file $file $pth`
2375                 fi
2376                 ;;
2377         '') xxx=`./loc $file $file $pth`;;
2378         *) xxx=`./loc $xxx $xxx $pth`;;
2379         esac
2380         eval $file=$xxx$_exe
2381         eval _$file=$xxx
2382         case "$xxx" in
2383         /*)
2384                 echo $file is in $xxx.
2385                 ;;
2386         ?:[\\/]*)
2387                 echo $file is in $xxx.
2388                 ;;
2389         *)
2390                 echo "I don't know where '$file' is, and my life depends on it." >&4
2391                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2392                 exit 1
2393                 ;;
2394         esac
2395 done
2396 echo " "
2397 echo "Don't worry if any of the following aren't found..."
2398 say=offhand
2399 for file in $trylist; do
2400         eval xxx=\$$file
2401         case "$xxx" in
2402         /*|?:[\\/]*)
2403                 if test -f "$xxx"; then
2404                         : ok
2405                 else
2406                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2407                         xxx=`./loc $file $file $pth`
2408                 fi
2409                 ;;
2410         '') xxx=`./loc $file $file $pth`;;
2411         *) xxx=`./loc $xxx $xxx $pth`;;
2412         esac
2413         eval $file=$xxx$_exe
2414         eval _$file=$xxx
2415         case "$xxx" in
2416         /*)
2417                 echo $file is in $xxx.
2418                 ;;
2419         ?:[\\/]*)
2420                 echo $file is in $xxx.
2421                 ;;
2422         *)
2423                 echo "I don't see $file out there, $say."
2424                 say=either
2425                 ;;
2426         esac
2427 done
2428 case "$egrep" in
2429 egrep)
2430         echo "Substituting grep for egrep."
2431         egrep=$grep
2432         _egrep=$grep
2433         ;;
2434 esac
2435 case "$ln" in
2436 ln)
2437         echo "Substituting cp for ln."
2438         ln=$cp
2439         _ln=$cp
2440         ;;
2441 esac
2442 case "$make" in
2443 make)
2444         case "$gmake" in
2445         gmake)
2446         echo "I can't find make or gmake, and my life depends on it." >&4
2447         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2448         exit 1
2449         ;;
2450         esac
2451         ;;
2452 esac
2453 case "$gmake" in
2454 gmake)  ;;
2455 *)      # We can't have osname yet.
2456         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2457                 # Assume that gmake, if found, is definitely GNU make
2458                 # and prefer it over the system make.
2459                 echo "Substituting gmake for make."
2460                 make=$gmake
2461                 _make=$gmake
2462         fi
2463         ;;
2464 esac
2465 case "$test" in
2466 test)
2467         echo "Hopefully test is built into your sh."
2468         ;;
2469 *)
2470         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2471                 echo "Using the test built into your sh."
2472                 test=test
2473                 _test=test
2474         fi
2475         ;;
2476 esac
2477 case "$echo" in
2478 echo)
2479         echo "Hopefully echo is built into your sh."
2480         ;;
2481 '') ;;
2482 *)
2483         echo " "
2484 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2485         $echo $n "hi there$c" >foo1
2486         echo $n "hi there$c" >foo2
2487         if cmp foo1 foo2 >/dev/null 2>&1; then
2488                 echo "They are compatible.  In fact, they may be identical."
2489         else
2490                 case "$n" in
2491                 '-n') n='' c='\c';;
2492                 *) n='-n' c='';;
2493                 esac
2494                 cat <<FOO
2495 They are not compatible!  You are probably running ksh on a non-USG system.
2496 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2497 have echo built in and we may have to run some Bourne shell scripts.  That
2498 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2499
2500 FOO
2501                 $echo $n "The star should be here-->$c"
2502                 $echo "*"
2503         fi
2504         $rm -f foo1 foo2
2505         ;;
2506 esac
2507
2508 # This question was auctioned at YAPC::Europe-2007 in Vienna
2509 # I never promised you could answer it. I only auctioned the question.
2510 cat <<FOO
2511 The following message is sponsored by
2512
2513   Dresden.pm<--The stars should be here.
2514
2515 Dear Perl user, system administrator or package
2516 maintainer, the Perl community sends greetings to
2517 you. Do you (emblematical) greet back [Y/n]? n
2518
2519 FOO
2520
2521 : Check what type of C compiler we use
2522 cat <<EOS >trygcc
2523 $startsh
2524 EOS
2525 cat <<'EOSC' >>trygcc
2526 case "$cc" in
2527 '') ;;
2528 *)  $rm -f try try.*
2529     $cat >try.c <<EOM
2530 int main(int argc, char *argv[]) {
2531   return 0;
2532 }
2533 EOM
2534     if $cc -o try $ccflags $ldflags try.c; then
2535        :
2536     else
2537         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2538         despair=yes
2539         trygcc=yes
2540         case "$cc" in
2541         *gcc*) trygcc=no ;;
2542         esac
2543         # Skip this test because it gives a false match on output like:
2544         #    ./trygcc: line 23: cc: command not found
2545         # case "`$cc -v -c try.c 2>&1`" in
2546         # *gcc*) trygcc=no ;;
2547         # esac
2548         if $test X"$trygcc" = Xyes; then
2549             if gcc -o try -c try.c; then
2550                 echo " "
2551                 echo "You seem to have a working gcc, though." >&4
2552                 # Switching compilers may undo the work of hints files.
2553                 # The most common problem is -D_REENTRANT for threads.
2554                 # This heuristic catches that case, but gets false positives
2555                 # if -Dusethreads was not actually specified.  Better to
2556                 # bail out here with a useful message than fail 
2557                 # mysteriously later. Should we perhaps just try to
2558                 # re-invoke Configure -Dcc=gcc config_args ?
2559                 if $test -f usethreads.cbu; then
2560                         $cat >&4 <<EOM 
2561
2562 *** However, any setting of the C compiler flags (e.g. for thread support)
2563 *** will be lost.  It may be necessary for you to restart Configure and
2564 *** add -Dcc=gcc to your Configure command line.
2565
2566 EOM
2567                         rp="Would you like to go ahead and try gcc anyway?"
2568                         dflt=n
2569                 else
2570                         rp="Would you like to use it?"
2571                         dflt=y
2572                 fi
2573                 if $test -f myread; then
2574                     . ./myread
2575                 else
2576                     if $test -f UU/myread; then
2577                         . ./UU/myread
2578                     else
2579                         echo "Cannot find myread, sorry.  Aborting." >&2
2580                         exit 1
2581                     fi
2582                 fi  
2583                 case "$ans" in
2584                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2585                 esac
2586             fi
2587         fi
2588     fi
2589     $rm -f try try.*
2590     ;;
2591 esac
2592 EOSC
2593
2594 cat <<EOS >checkcc
2595 $startsh
2596 EOS
2597 cat <<'EOSC' >>checkcc
2598 case "$cc" in        
2599 '') ;;
2600 *)  $rm -f try try.*              
2601     $cat >try.c <<EOM
2602 int main(int argc, char *argv[]) {
2603   return 0;
2604 }
2605 EOM
2606     if $cc -o try $ccflags $ldflags try.c; then
2607        :
2608     else
2609         if $test X"$despair" = Xyes; then
2610            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2611         fi
2612         $cat >&4 <<EOM         
2613 You need to find a working C compiler.
2614 Either (purchase and) install the C compiler supplied by your OS vendor,
2615 or for a free C compiler try http://gcc.gnu.org/
2616 I cannot continue any further, aborting.
2617 EOM
2618         exit 1
2619     fi
2620     $rm -f try try.*
2621     ;;
2622 esac
2623 EOSC
2624
2625 : determine whether symbolic links are supported
2626 echo " "
2627 $touch blurfl
2628 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2629         echo "Symbolic links are supported." >&4
2630         lns="$ln -s"
2631 else
2632         echo "Symbolic links are NOT supported." >&4
2633         lns="$ln"
2634 fi
2635 $rm -f blurfl sym
2636
2637 : determine whether symbolic links are supported
2638 echo " "
2639 case "$lns" in
2640 *"ln"*" -s")
2641         echo "Checking how to test for symbolic links..." >&4
2642         $lns blurfl sym
2643         if $test "X$issymlink" = X; then
2644                 case "$newsh" in
2645                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2646                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2647                 esac
2648                 if test $? = 0; then
2649                         issymlink="test -h"
2650                 else
2651                         echo "Your builtin 'test -h' may be broken." >&4
2652                         case "$test" in
2653                         /*)     ;;
2654                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2655                                 for p in $pth
2656                                 do
2657                                         if test -f "$p/$test"; then
2658                                                 test="$p/$test"
2659                                                 break
2660                                         fi
2661                                 done
2662                                 ;;
2663                         esac
2664                         case "$test" in
2665                         /*)
2666                                 echo "Trying external '$test -h'." >&4
2667                                 issymlink="$test -h"
2668                                 if $test ! -h sym >/dev/null 2>&1; then
2669                                         echo "External '$test -h' is broken, too." >&4
2670                                         issymlink=''
2671                                 fi
2672                                 ;;
2673                         *)      issymlink='' ;;
2674                         esac
2675                 fi              
2676         fi
2677         if $test "X$issymlink" = X; then
2678                 if $test -L sym 2>/dev/null; then
2679                         issymlink="$test -L"
2680                         echo "The builtin '$test -L' worked." >&4
2681                 fi
2682         fi
2683         if $test "X$issymlink" != X; then
2684                 echo "You can test for symbolic links with '$issymlink'." >&4
2685         else
2686                 echo "I do not know how you can test for symbolic links." >&4
2687         fi
2688         $rm -f blurfl sym
2689         ;;
2690 *)      echo "No symbolic links, so not testing for their testing..." >&4
2691         ;;
2692 esac
2693 echo " "
2694
2695 : Make symlinks util
2696 case "$mksymlinks" in
2697 $define|true|[yY]*)
2698         case "$src" in
2699         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2700                 exit 1
2701                 ;;
2702         *)      case "$lns:$issymlink" in
2703                 *"ln"*" -s:"*"test -"?)
2704                         echo "Creating the symbolic links..." >&4
2705                         echo "(First creating the subdirectories...)" >&4
2706                         cd ..
2707                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2708                                 read directory
2709                                 test -z "$directory" && break
2710                                 mkdir -p $directory
2711                         done
2712                         # Sanity check 1.
2713                         if test ! -d t/base; then
2714                                 echo "Failed to create the subdirectories.  Aborting." >&4
2715                                 exit 1
2716                         fi
2717                         echo "(Then creating the symlinks...)" >&4
2718                         awk '{print $1}' $src/MANIFEST | while true; do
2719                                 read filename
2720                                 test -z "$filename" && break
2721                                 if test -f $filename; then
2722                                         if $issymlink $filename; then
2723                                                 rm -f $filename
2724                                         fi
2725                                 fi
2726                                 if test -f $filename; then
2727                                         echo "$filename already exists, not symlinking."
2728                                 else
2729                                         ln -s $src/$filename $filename
2730                                 fi
2731                         done
2732                         # Sanity check 2.
2733                         if test ! -f t/base/lex.t; then
2734                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2735                                 exit 1
2736                         fi
2737                         cd UU
2738                         ;;
2739                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2740                         ;;
2741                 esac
2742                 ;;
2743         esac
2744         ;;
2745 esac
2746
2747 : Check for Cross-Compilation
2748 case "$usecrosscompile" in
2749 $define|true|[yY]*)
2750         $echo "Cross-compiling..."
2751         croak=''
2752         case "$cc" in
2753         *-*-gcc) # A cross-compiling gcc, probably.
2754             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2755             ar=$targetarch-ar
2756             # leave out ld, choosing it is more complex
2757             nm=$targetarch-nm
2758             ranlib=$targetarch-ranlib
2759             $echo 'extern int foo;' > try.c
2760             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2761             shift
2762             if $test $# -gt 0; then
2763                 incpth="$incpth $*"
2764                 incpth="`$echo $incpth|$sed 's/^ //'`"
2765                 echo "Guessing incpth '$incpth'." >&4
2766                 for i in $*; do
2767                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2768                     if $test -d $j; then
2769                         libpth="$libpth $j"
2770                     fi
2771                 done   
2772                 libpth="`$echo $libpth|$sed 's/^ //'`"
2773                 echo "Guessing libpth '$libpth'." >&4
2774             fi
2775             $rm -f try.c
2776             ;;
2777         esac
2778         case "$targetarch" in
2779         '') echo "Targetarch not defined." >&4; croak=y ;;
2780         *)  echo "Using targetarch $targetarch." >&4 ;;
2781         esac
2782         case "$incpth" in
2783         '') echo "Incpth not defined." >&4; croak=y ;;
2784         *)  echo "Using incpth '$incpth'." >&4 ;;
2785         esac
2786         case "$libpth" in
2787         '') echo "Libpth not defined." >&4; croak=y ;;
2788         *)  echo "Using libpth '$libpth'." >&4 ;;
2789         esac
2790         case "$usrinc" in
2791         '') for i in $incpth; do
2792                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2793                     usrinc=$i
2794                     echo "Guessing usrinc $usrinc." >&4
2795                     break
2796                 fi
2797             done
2798             case "$usrinc" in
2799             '') echo "Usrinc not defined." >&4; croak=y ;;
2800             esac
2801             ;;
2802         *)  echo "Using usrinc $usrinc." >&4 ;;
2803         esac
2804         case "$targethost" in
2805         '') echo "Targethost not defined." >&4; croak=y ;;
2806         *)  echo "Using targethost $targethost." >&4
2807         esac
2808         locincpth=' '
2809         loclibpth=' '
2810         case "$croak" in
2811         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2812         esac
2813         case "$src" in
2814         /*) run=$src/Cross/run
2815             targetmkdir=$src/Cross/mkdir
2816             to=$src/Cross/to
2817             from=$src/Cross/from
2818             ;;
2819         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2820             run=$pwd/Cross/run
2821             targetmkdir=$pwd/Cross/mkdir
2822             to=$pwd/Cross/to
2823             from=$pwd/Cross/from
2824             ;;
2825         esac
2826         case "$targetrun" in
2827         '') targetrun=ssh ;;
2828         esac
2829         case "$targetto" in
2830         '') targetto=scp ;;
2831         esac
2832         case "$targetfrom" in
2833         '') targetfrom=scp ;;
2834         esac
2835         run=$run-$targetrun
2836         to=$to-$targetto
2837         from=$from-$targetfrom
2838         case "$targetdir" in
2839         '')  targetdir=/tmp
2840              echo "Guessing targetdir $targetdir." >&4
2841              ;;
2842         esac
2843         case "$targetuser" in
2844         '')  targetuser=root
2845              echo "Guessing targetuser $targetuser." >&4
2846              ;;
2847         esac
2848         case "$targetfrom" in
2849         scp)    q=-q ;;
2850         *)      q='' ;;
2851         esac
2852         case "$targetrun" in
2853         ssh|rsh)
2854             cat >$run <<EOF
2855 #!/bin/sh
2856 case "\$1" in
2857 -cwd)
2858   shift
2859   cwd=\$1
2860   shift
2861   ;;
2862 esac
2863 case "\$cwd" in
2864 '') cwd=$targetdir ;;
2865 esac
2866 exe=\$1
2867 shift
2868 if $test ! -f \$exe.xok; then
2869   $to \$exe
2870   $touch \$exe.xok
2871 fi
2872 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2873 EOF
2874             ;;
2875         *)  echo "Unknown targetrun '$targetrun'" >&4
2876             exit 1
2877             ;;
2878         esac
2879         case "$targetmkdir" in
2880         */Cross/mkdir)
2881             cat >$targetmkdir <<EOF
2882 #!/bin/sh
2883 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2884 EOF
2885             $chmod a+rx $targetmkdir
2886             ;;
2887         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2888             exit 1
2889             ;;
2890         esac
2891         case "$targetto" in
2892         scp|rcp)
2893             cat >$to <<EOF
2894 #!/bin/sh
2895 for f in \$@
2896 do
2897   case "\$f" in
2898   /*)
2899     $targetmkdir \`dirname \$f\`
2900     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2901     ;;
2902   *)
2903     $targetmkdir $targetdir/\`dirname \$f\`
2904     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2905     ;;
2906   esac
2907 done
2908 exit 0
2909 EOF
2910             ;;
2911         cp) cat >$to <<EOF
2912 #!/bin/sh
2913 for f in \$@
2914 do
2915   case "\$f" in
2916   /*)
2917     $mkdir -p $targetdir/\`dirname \$f\`
2918     $cp \$f $targetdir/\$f || exit 1
2919     ;;
2920   *)
2921     $targetmkdir $targetdir/\`dirname \$f\`
2922     $cp \$f $targetdir/\$f || exit 1
2923     ;;
2924   esac
2925 done
2926 exit 0
2927 EOF
2928             ;;
2929         *)  echo "Unknown targetto '$targetto'" >&4
2930             exit 1
2931             ;;
2932         esac
2933         case "$targetfrom" in
2934         scp|rcp)
2935           cat >$from <<EOF
2936 #!/bin/sh
2937 for f in \$@
2938 do
2939   $rm -f \$f
2940   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2941 done
2942 exit 0
2943 EOF
2944             ;;
2945         cp) cat >$from <<EOF
2946 #!/bin/sh
2947 for f in \$@
2948 do
2949   $rm -f \$f
2950   cp $targetdir/\$f . || exit 1
2951 done
2952 exit 0
2953 EOF
2954             ;;
2955         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2956             exit 1
2957             ;;
2958         esac
2959         if $test ! -f $run; then
2960             echo "Target 'run' script '$run' not found." >&4
2961         else
2962             $chmod a+rx $run
2963         fi
2964         if $test ! -f $to; then
2965             echo "Target 'to' script '$to' not found." >&4
2966         else
2967             $chmod a+rx $to
2968         fi
2969         if $test ! -f $from; then
2970             echo "Target 'from' script '$from' not found." >&4
2971         else
2972             $chmod a+rx $from
2973         fi
2974         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2975             exit 1
2976         fi
2977         cat >&4 <<EOF
2978 Using '$run' for remote execution,
2979 and '$from' and '$to'
2980 for remote file transfer.
2981 EOF
2982         ;;
2983 *)      run=''
2984         to=:
2985         from=:
2986         usecrosscompile='undef'
2987         targetarch=''
2988         ;;
2989 esac
2990
2991 : see whether [:lower:] and [:upper:] are supported character classes
2992 echo " "
2993 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2994 ABYZ)
2995         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2996         up='[:upper:]'
2997         low='[:lower:]'
2998         ;;
2999 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3000         # (0xd9 and 0xe2), therefore that is a nice testing point.
3001         if test "X$up" = X -o "X$low" = X; then
3002             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3003             rs) up='[A-Z]'
3004                 low='[a-z]'
3005                 ;;
3006             esac
3007         fi
3008         if test "X$up" = X -o "X$low" = X; then
3009             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3010             rs) up='A-Z'
3011                 low='a-z'
3012                 ;;
3013             esac
3014         fi
3015         if test "X$up" = X -o "X$low" = X; then
3016             case "`echo RS | od -x 2>/dev/null`" in
3017             *D9E2*|*d9e2*)
3018                 echo "Hey, this might be EBCDIC." >&4
3019                 if test "X$up" = X -o "X$low" = X; then
3020                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3021                     rs) up='[A-IJ-RS-Z]'
3022                         low='[a-ij-rs-z]'
3023                         ;;
3024                     esac
3025                 fi
3026                 if test "X$up" = X -o "X$low" = X; then
3027                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3028                     rs) up='A-IJ-RS-Z'
3029                         low='a-ij-rs-z'
3030                         ;;
3031                     esac
3032                 fi
3033                 ;;
3034             esac
3035         fi
3036 esac
3037 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3038 rs)
3039     echo "Using $up and $low to convert case." >&4
3040     ;;
3041 *)
3042     echo "I don't know how to translate letters from upper to lower case." >&4
3043     echo "Your tr is not acting any way I know of." >&4
3044     exit 1
3045     ;;
3046 esac
3047 : set up the translation script tr, must be called with ./tr of course
3048 cat >tr <<EOSC
3049 $startsh
3050 case "\$1\$2" in
3051 '[A-Z][a-z]') exec $tr '$up' '$low';;
3052 '[a-z][A-Z]') exec $tr '$low' '$up';;
3053 esac
3054 exec $tr "\$@"
3055 EOSC
3056 chmod +x tr
3057 $eunicefix tr
3058
3059 : Try to determine whether config.sh was made on this system
3060 case "$config_sh" in
3061 '')
3062 myuname=`$uname -a 2>/dev/null`
3063 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3064 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3065 # because the A-Z/a-z are not consecutive.
3066 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3067         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3068 newmyuname="$myuname"
3069 dflt=n
3070 case "$knowitall" in
3071 '')
3072         if test -f ../config.sh; then
3073                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3074                         eval "`grep myuname= ../config.sh`"
3075                 fi
3076                 if test "X$myuname" = "X$newmyuname"; then
3077                         dflt=y
3078                 fi
3079         fi
3080         ;;
3081 *) dflt=y;;
3082 esac
3083
3084 : Get old answers from old config file if Configure was run on the
3085 : same system, otherwise use the hints.
3086 hint=default
3087 cd ..
3088 if test -f config.sh; then
3089         echo " "
3090         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3091         . UU/myread
3092         case "$ans" in
3093         n*|N*) echo "OK, I'll ignore it."
3094                 mv config.sh config.sh.old
3095                 myuname="$newmyuname"
3096                 ;;
3097         *)  echo "Fetching default answers from your old config.sh file..." >&4
3098                 tmp_n="$n"
3099                 tmp_c="$c"
3100                 tmp_sh="$sh"
3101                 . ./config.sh
3102                 cp config.sh UU
3103                 n="$tmp_n"
3104                 c="$tmp_c"
3105                 : Older versions did not always set $sh.  Catch re-use of such
3106                 : an old config.sh.
3107                 case "$sh" in
3108                 '') sh="$tmp_sh" ;;
3109                 esac
3110                 hint=previous
3111                 ;;
3112         esac
3113 fi
3114 . ./UU/checkcc
3115 if test ! -f config.sh; then
3116         $cat <<EOM
3117
3118 First time through, eh?  I have some defaults handy for some systems
3119 that need some extra help getting the Configure answers right:
3120
3121 EOM
3122         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3123         dflt=''
3124         : Half the following guesses are probably wrong... If you have better
3125         : tests or hints, please send them to perlbug@perl.org
3126         : The metaconfig authors would also appreciate a copy...
3127         $test -f /irix && osname=irix
3128         $test -f /xenix && osname=sco_xenix
3129         $test -f /dynix && osname=dynix
3130         $test -f /dnix && osname=dnix
3131         $test -f /lynx.os && osname=lynxos
3132         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3133         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3134         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3135         $test -f /bin/mips && /bin/mips && osname=mips
3136         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3137                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3138         $test -d /usr/apollo/bin && osname=apollo
3139         $test -f /etc/saf/_sactab && osname=svr4
3140         $test -d /usr/include/minix && osname=minix
3141         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3142         if $test -d /MachTen -o -d /MachTen_Folder; then
3143                 osname=machten
3144                 if $test -x /sbin/version; then
3145                         osvers=`/sbin/version | $awk '{print $2}' |
3146                         $sed -e 's/[A-Za-z]$//'`
3147                 elif $test -x /usr/etc/version; then
3148                         osvers=`/usr/etc/version | $awk '{print $2}' |
3149                         $sed -e 's/[A-Za-z]$//'`
3150                 else
3151                         osvers="$2.$3"
3152                 fi
3153         fi
3154
3155         $test -f /sys/posix.dll &&
3156                 $test -f /usr/bin/what &&
3157                 set X `/usr/bin/what /sys/posix.dll` &&
3158                 $test "$3" = UWIN &&
3159                 osname=uwin &&
3160                 osvers="$5"
3161
3162         if $test -f $uname; then
3163                 set X $myuname
3164                 shift
3165
3166                 case "$5" in
3167                 fps*) osname=fps ;;
3168                 mips*)
3169                         case "$4" in
3170                         umips) osname=umips ;;
3171                         *) osname=mips ;;
3172                         esac;;
3173                 [23]100) osname=mips ;;
3174                 next*) osname=next ;;
3175                 i386*)
3176                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3177                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3178                                 osname='sco'
3179                                 osvers=$tmp
3180                         elif $test -f /etc/kconfig; then
3181                                 osname=isc
3182                                 if test "$lns" = "$ln -s"; then
3183                                         osvers=4
3184                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3185                                         osvers=3
3186                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3187                                         osvers=2
3188                                 fi
3189                         fi
3190                         tmp=''
3191                         ;;
3192                 pc*)
3193                         if test -n "$DJGPP"; then
3194                                 osname=dos
3195                                 osvers=djgpp
3196                         fi
3197                         ;;
3198                 esac
3199
3200                 case "$1" in
3201                 aix) osname=aix
3202                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3203                         case "$tmp" in
3204                         # oslevel can fail with:
3205                         # oslevel: Unable to acquire lock.
3206                         *not\ found) osvers="$4"."$3" ;;
3207                         '<3240'|'<>3240') osvers=3.2.0 ;;
3208                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3209                         '=3250'|'>3250') osvers=3.2.5 ;;
3210                         *) osvers=$tmp;;
3211                         esac
3212                         ;;
3213                 bsd386) osname=bsd386
3214                         osvers=`$uname -r`
3215                         ;;
3216                 cygwin*) osname=cygwin
3217                         osvers="$3"
3218                         ;;
3219                 *dc.osx) osname=dcosx
3220                         osvers="$3"
3221                         ;;
3222                 dnix) osname=dnix
3223                         osvers="$3"
3224                         ;;
3225                 domainos) osname=apollo
3226                         osvers="$3"
3227                         ;;
3228                 dgux)   osname=dgux
3229                         osvers="$3"
3230                         ;;
3231                 dragonfly) osname=dragonfly
3232                         osvers="$3"
3233                         ;;
3234                 dynixptx*) osname=dynixptx
3235                         osvers=`echo "$4"|sed 's/^v//'`
3236                         ;;
3237                 freebsd) osname=freebsd
3238                         osvers="$3" ;;
3239                 genix)  osname=genix ;;
3240                 gnu)    osname=gnu
3241                         osvers="$3" ;;
3242                 hp*)    osname=hpux
3243                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3244                         ;;
3245                 irix*)  osname=irix
3246                         case "$3" in
3247                         4*) osvers=4 ;;
3248                         5*) osvers=5 ;;
3249                         *)      osvers="$3" ;;
3250                         esac
3251                         ;;
3252                 linux)  osname=linux
3253                         case "$3" in
3254                         *)      osvers="$3" ;;
3255                         esac
3256                         ;;
3257                 MiNT)   osname=mint
3258                         ;;
3259                 netbsd*) osname=netbsd
3260                         osvers="$3"
3261                         ;;
3262                 news-os) osvers="$3"
3263                         case "$3" in
3264                         4*) osname=newsos4 ;;
3265                         *) osname=newsos ;;
3266                         esac
3267                         ;;
3268                 next*) osname=next ;;
3269                 nonstop-ux) osname=nonstopux ;;
3270                 openbsd) osname=openbsd
3271                         osvers="$3"
3272                         ;;
3273                 os2)    osname=os2
3274                         osvers="$4"
3275                         ;;
3276                 POSIX-BC | posix-bc ) osname=posix-bc
3277                         osvers="$3"
3278                         ;;
3279                 powerux | power_ux | powermax_os | powermaxos | \
3280                 powerunix | power_unix) osname=powerux
3281                         osvers="$3"
3282                         ;;
3283                 qnx) osname=qnx
3284                         osvers="$4"
3285                         ;;
3286                 solaris) osname=solaris
3287                         case "$3" in
3288                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 sunos) osname=sunos
3293                         case "$3" in
3294                         5*) osname=solaris
3295                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3296                         *)      osvers="$3" ;;
3297                         esac
3298                         ;;
3299                 titanos) osname=titanos
3300                         case "$3" in
3301                         1*) osvers=1 ;;
3302                         2*) osvers=2 ;;
3303                         3*) osvers=3 ;;
3304                         4*) osvers=4 ;;
3305                         *)      osvers="$3" ;;
3306                         esac
3307                         ;;
3308                 ultrix) osname=ultrix
3309                         osvers="$3"
3310                         ;;
3311                 osf1|mls+)      case "$5" in
3312                                 alpha)
3313                                         osname=dec_osf
3314                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3315                                         case "$osvers" in
3316                                         [1-9].[0-9]*) ;;
3317                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3318                                         esac
3319                                         ;;
3320                         hp*)    osname=hp_osf1  ;;
3321                         mips)   osname=mips_osf1 ;;
3322                         esac
3323                         ;;
3324                 # UnixWare 7.1.2 is known as Open UNIX 8
3325                 openunix|unixware) osname=svr5
3326                         osvers="$4"
3327                         ;;
3328                 uts)    osname=uts
3329                         osvers="$3"
3330                         ;;
3331                 vos) osvers="$3"
3332                         ;;
3333                 $2) case "$osname" in
3334                         *isc*) ;;
3335                         *freebsd*) ;;
3336                         svr*)
3337                                 : svr4.x or possibly later
3338                                 case "svr$3" in
3339                                 ${osname}*)
3340                                         osname=svr$3
3341                                         osvers=$4
3342                                         ;;
3343                                 esac
3344                                 case "$osname" in
3345                                 svr4.0)
3346                                         : Check for ESIX
3347                                         if test -f /stand/boot ; then
3348                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3349                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3350                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3351                                                         if test -n "$isesix"; then
3352                                                                 osname=esix4
3353                                                         fi
3354                                                 fi
3355                                         fi
3356                                         ;;
3357                                 esac
3358                                 ;;
3359                         *)      if test -f /etc/systemid; then
3360                                         osname=sco
3361                                         set `echo $3 | $sed 's/\./ /g'` $4
3362                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3363                                                 osvers=$1.$2.$3
3364                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3365                                                 osvers=$1.$2
3366                                         elif $test -f $src/hints/sco_$1.sh; then
3367                                                 osvers=$1
3368                                         fi
3369                                 else
3370                                         case "$osname" in
3371                                         '') : Still unknown.  Probably a generic Sys V.
3372                                                 osname="sysv"
3373                                                 osvers="$3"
3374                                                 ;;
3375                                         esac
3376                                 fi
3377                                 ;;
3378                         esac
3379                         ;;
3380                 *)      case "$osname" in
3381                         '') : Still unknown.  Probably a generic BSD.
3382                                 osname="$1"
3383                                 osvers="$3"
3384                                 ;;
3385                         esac
3386                         ;;
3387                 esac
3388         else
3389                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3390                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3391                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3392                                 osname=news_os
3393                         fi
3394                         $rm -f UU/kernel.what
3395                 elif test -d c:/. -o -n "$is_os2" ; then
3396                         set X $myuname
3397                         osname=os2
3398                         osvers="$5"
3399                 fi
3400         fi
3401
3402         case "$targetarch" in
3403         '') ;;
3404         *)  hostarch=$osname
3405             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3406             osvers=''
3407             ;;
3408         esac
3409
3410         : Now look for a hint file osname_osvers, unless one has been
3411         : specified already.
3412         case "$hintfile" in
3413         ''|' ')
3414                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3415                 : Also try without trailing minor version numbers.
3416                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3417                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3418                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3419                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3420                 case "$file" in
3421                 '') dflt=none ;;
3422                 *)  case "$osvers" in
3423                         '') dflt=$file
3424                                 ;;
3425                         *)  if $test -f $src/hints/$file.sh ; then
3426                                         dflt=$file
3427                                 elif $test -f $src/hints/$xfile.sh ; then
3428                                         dflt=$xfile
3429                                 elif $test -f $src/hints/$xxfile.sh ; then
3430                                         dflt=$xxfile
3431                                 elif $test -f $src/hints/$xxxfile.sh ; then
3432                                         dflt=$xxxfile
3433                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3434                                         dflt=$xxxxfile
3435                                 elif $test -f "$src/hints/${osname}.sh" ; then
3436                                         dflt="${osname}"
3437                                 else
3438                                         dflt=none
3439                                 fi
3440                                 ;;
3441                         esac
3442                         ;;
3443                 esac
3444                 if $test -f Policy.sh ; then
3445                         case "$dflt" in
3446                         *Policy*) ;;
3447                         none) dflt="Policy" ;;
3448                         *) dflt="Policy $dflt" ;;
3449                         esac
3450                 fi
3451                 ;;
3452         *)
3453                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3454                 ;;
3455         esac
3456
3457         if $test -f Policy.sh ; then
3458                 $cat <<EOM
3459
3460 There's also a Policy hint file available, which should make the
3461 site-specific (policy) questions easier to answer.
3462 EOM
3463
3464         fi
3465
3466         $cat <<EOM
3467
3468 You may give one or more space-separated answers, or "none" if appropriate.
3469 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3470 previous run of Configure, you may specify it as well as or instead of
3471 OS-specific hints.  If hints are provided for your OS, you should use them:
3472 although Perl can probably be built without hints on many platforms, using
3473 hints often improve performance and may enable features that Configure can't
3474 set up on its own. If there are no hints that match your OS, specify "none";
3475 DO NOT give a wrong version or a wrong OS.
3476
3477 EOM
3478
3479         rp="Which of these apply, if any?"
3480         . UU/myread
3481         tans=$ans
3482         for file in $tans; do
3483                 if $test X$file = XPolicy -a -f Policy.sh; then
3484                         . Policy.sh
3485                         $cat Policy.sh >> UU/config.sh
3486                 elif $test -f $src/hints/$file.sh; then
3487                         . $src/hints/$file.sh
3488                         $cat $src/hints/$file.sh >> UU/config.sh
3489                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3490                         : nothing
3491                 else
3492                         : Give one chance to correct a possible typo.
3493                         echo "$file.sh does not exist"
3494                         dflt=$file
3495                         rp="hint to use instead?"
3496                         . UU/myread
3497                         for file in $ans; do
3498                                 if $test -f "$src/hints/$file.sh"; then
3499                                         . $src/hints/$file.sh
3500                                         $cat $src/hints/$file.sh >> UU/config.sh
3501                                 elif $test X$ans = X -o X$ans = Xnone ; then
3502                                         : nothing
3503                                 else
3504                                         echo "$file.sh does not exist -- ignored."
3505                                 fi
3506                         done
3507                 fi
3508         done
3509
3510         hint=recommended
3511         : Remember our hint file for later.
3512         if $test -f "$src/hints/$file.sh" ; then
3513                 hintfile="$file"
3514         else
3515                 hintfile=''
3516         fi
3517 fi
3518 cd UU
3519 ;;
3520 *)
3521         echo " "
3522         echo "Fetching default answers from $config_sh..." >&4
3523         tmp_n="$n"
3524         tmp_c="$c"
3525         cd ..
3526         cp $config_sh config.sh 2>/dev/null
3527         chmod +w config.sh
3528         . ./config.sh
3529         cd UU
3530         cp ../config.sh .
3531         n="$tmp_n"
3532         c="$tmp_c"
3533         hint=previous
3534         ;;
3535 esac
3536 test "$override" && . ./optdef.sh
3537
3538 : Restore computed paths
3539 for file in $loclist $trylist; do
3540         eval $file="\$_$file"
3541 done
3542
3543 cat << EOM
3544
3545 Configure uses the operating system name and version to set some defaults.
3546 The default value is probably right if the name rings a bell. Otherwise,
3547 since spelling matters for me, either accept the default or answer "none"
3548 to leave it blank.
3549
3550 EOM
3551 case "$osname" in
3552         ''|' ')
3553                 case "$hintfile" in
3554                 ''|' '|none) dflt=none ;;
3555                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3556                 esac
3557                 ;;
3558         *) dflt="$osname" ;;
3559 esac
3560 rp="Operating system name?"
3561 . ./myread
3562 case "$ans" in
3563 none)  osname='' ;;
3564 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3565 esac
3566 echo " "
3567 case "$osvers" in
3568         ''|' ')
3569                 case "$hintfile" in
3570                 ''|' '|none) dflt=none ;;
3571                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3572                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3573                         case "$dflt" in
3574                         ''|' ') dflt=none ;;
3575                         esac
3576                         ;;
3577                 esac
3578                 ;;
3579         *) dflt="$osvers" ;;
3580 esac
3581 rp="Operating system version?"
3582 . ./myread
3583 case "$ans" in
3584 none)  osvers='' ;;
3585 *) osvers="$ans" ;;
3586 esac
3587
3588
3589 . ./posthint.sh
3590
3591 : who configured the system
3592 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3593 case "$cf_by" in
3594 "")
3595         cf_by=`(logname) 2>/dev/null`
3596         case "$cf_by" in
3597         "")
3598                 cf_by=`(whoami) 2>/dev/null`
3599                 case "$cf_by" in
3600                 "") cf_by=unknown ;;
3601                 esac ;;
3602         esac ;;
3603 esac
3604
3605 : decide how portable to be.  Allow command line overrides.
3606 case "$d_portable" in
3607 "$undef") ;;
3608 *)      d_portable="$define" ;;
3609 esac
3610
3611 : set up shell script to do ~ expansion
3612 cat >filexp <<EOSS
3613 $startsh
3614 : expand filename
3615 case "\$1" in
3616  \~/*|\~)
3617         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3618         ;;
3619  \~*)
3620         if $test -f /bin/csh; then
3621                 /bin/csh -f -c "glob \$1"
3622                 failed=\$?
3623                 echo ""
3624                 exit \$failed
3625         else
3626                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3627                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3628                 if $test ! -d "\$dir"; then
3629                         me=\`basename \$0\`
3630                         echo "\$me: can't locate home directory for: \$name" >&2
3631                         exit 1
3632                 fi
3633                 case "\$1" in
3634                 */*)
3635                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3636                         ;;
3637                 *)
3638                         echo \$dir
3639                         ;;
3640                 esac
3641         fi
3642         ;;
3643 *)
3644         echo \$1
3645         ;;
3646 esac
3647 EOSS
3648 chmod +x filexp
3649 $eunicefix filexp
3650
3651 : now set up to get a file name
3652 cat <<EOS >getfile
3653 $startsh
3654 EOS
3655 cat <<'EOSC' >>getfile
3656 tilde=''
3657 fullpath=''
3658 already=''
3659 skip=''
3660 none_ok=''
3661 exp_file=''
3662 nopath_ok=''
3663 orig_rp="$rp"
3664 orig_dflt="$dflt"
3665 case "$gfpth" in
3666 '') gfpth='.' ;;
3667 esac
3668
3669 case "$fn" in
3670 *\(*)
3671         : getfile will accept an answer from the comma-separated list
3672         : enclosed in parentheses even if it does not meet other criteria.
3673         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3674         fn=`echo $fn | sed 's/(.*)//'`
3675         ;;
3676 esac
3677
3678 case "$fn" in
3679 *:*)
3680         loc_file=`expr $fn : '.*:\(.*\)'`
3681         fn=`expr $fn : '\(.*\):.*'`
3682         ;;
3683 esac
3684
3685 case "$fn" in
3686 *~*) tilde=true;;
3687 esac
3688 case "$fn" in
3689 */*) fullpath=true;;
3690 esac
3691 case "$fn" in
3692 *+*) skip=true;;
3693 esac
3694 case "$fn" in
3695 *n*) none_ok=true;;
3696 esac
3697 case "$fn" in
3698 *e*) exp_file=true;;
3699 esac
3700 case "$fn" in
3701 *p*) nopath_ok=true;;
3702 esac
3703
3704 case "$fn" in
3705 *f*) type='File';;
3706 *d*) type='Directory';;
3707 *l*) type='Locate';;
3708 esac
3709
3710 what="$type"
3711 case "$what" in
3712 Locate) what='File';;
3713 esac
3714
3715 case "$exp_file" in
3716 '')
3717         case "$d_portable" in
3718         "$define") ;;
3719         *) exp_file=true;;
3720         esac
3721         ;;
3722 esac
3723
3724 cd ..
3725 while test "$type"; do
3726         redo=''
3727         rp="$orig_rp"
3728         dflt="$orig_dflt"
3729         case "$tilde" in
3730         true) rp="$rp (~name ok)";;
3731         esac
3732         . UU/myread
3733         if test -f UU/getfile.ok && \
3734                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3735         then
3736                 value="$ans"
3737                 ansexp="$ans"
3738                 break
3739         fi
3740         case "$ans" in
3741         none)
3742                 value=''
3743                 ansexp=''
3744                 case "$none_ok" in
3745                 true) type='';;
3746                 esac
3747                 ;;
3748         *)
3749                 case "$tilde" in
3750                 '') value="$ans"
3751                         ansexp="$ans";;
3752                 *)
3753                         value=`UU/filexp $ans`
3754                         case $? in
3755                         0)
3756                                 if test "$ans" != "$value"; then
3757                                         echo "(That expands to $value on this system.)"
3758                                 fi
3759                                 ;;
3760                         *) value="$ans";;
3761                         esac
3762                         ansexp="$value"
3763                         case "$exp_file" in
3764                         '') value="$ans";;
3765                         esac
3766                         ;;
3767                 esac
3768                 case "$fullpath" in
3769                 true)
3770                         case "$ansexp" in
3771                         /*) value="$ansexp" ;;
3772                         [a-zA-Z]:/*) value="$ansexp" ;;
3773                         *)
3774                                 redo=true
3775                                 case "$already" in
3776                                 true)
3777                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3778                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3779                                         ;;
3780                                 *)
3781                                 echo "Please give a full path name, starting with slash." >&4
3782                                         case "$tilde" in
3783                                         true)
3784                                 echo "Note that using ~name is ok provided it expands well." >&4
3785                                                 already=true
3786                                                 ;;
3787                                         esac
3788                                 esac
3789                                 ;;
3790                         esac
3791                         ;;
3792                 esac
3793                 case "$redo" in
3794                 '')
3795                         case "$type" in
3796                         File)
3797                                 for fp in $gfpth; do
3798                                         if test "X$fp" = X.; then
3799                                             pf="$ansexp"
3800                                         else    
3801                                             pf="$fp/$ansexp"
3802                                         fi
3803                                         if test -f "$pf"; then
3804                                                 type=''
3805                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3806                                         then
3807                                                 echo "($value is not a plain file, but that's ok.)"
3808                                                 type=''
3809                                         fi
3810                                         if test X"$type" = X; then
3811                                             value="$pf"
3812                                             break
3813                                         fi
3814                                 done
3815                                 ;;
3816                         Directory)
3817                                 for fp in $gfpth; do
3818                                         if test "X$fp" = X.; then
3819                                             dir="$ans"
3820                                             direxp="$ansexp"
3821                                         else    
3822                                             dir="$fp/$ansexp"
3823                                             direxp="$fp/$ansexp"
3824                                         fi
3825                                         if test -d "$direxp"; then
3826                                                 type=''
3827                                                 value="$dir"
3828                                                 break
3829                                         fi
3830                                 done
3831                                 ;;
3832                         Locate)
3833                                 if test -d "$ansexp"; then
3834                                         echo "(Looking for $loc_file in directory $value.)"
3835                                         value="$value/$loc_file"
3836                                         ansexp="$ansexp/$loc_file"
3837                                 fi
3838                                 if test -f "$ansexp"; then
3839                                         type=''
3840                                 fi
3841                                 case "$nopath_ok" in
3842                                 true)   case "$value" in
3843                                         */*) ;;
3844                                         *)      echo "Assuming $value will be in people's path."
3845                                                 type=''
3846                                                 ;;
3847                                         esac
3848                                         ;;
3849                                 esac
3850                                 ;;
3851                         esac
3852
3853                         case "$skip" in
3854                         true) type='';
3855                         esac
3856
3857                         case "$type" in
3858                         '') ;;
3859                         *)
3860                                 if test "$fastread" = yes; then
3861                                         dflt=y
3862                                 else
3863                                         dflt=n
3864                                 fi
3865                                 rp="$what $value doesn't exist.  Use that name anyway?"
3866                                 . UU/myread
3867                                 dflt=''
3868                                 case "$ans" in
3869                                 y*) type='';;
3870                                 *) echo " ";;
3871                                 esac
3872                                 ;;
3873                         esac
3874                         ;;
3875                 esac
3876                 ;;
3877         esac
3878 done
3879 cd UU
3880 ans="$value"
3881 rp="$orig_rp"
3882 dflt="$orig_dflt"
3883 rm -f getfile.ok
3884 test "X$gfpthkeep" != Xy && gfpth=""
3885 EOSC
3886
3887 : determine root of directory hierarchy where package will be installed.
3888 case "$prefix" in
3889 '')
3890         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3891         ;;
3892 *?/)
3893         dflt=`echo "$prefix" | sed 's/.$//'`
3894         ;;
3895 *)
3896         dflt="$prefix"
3897         ;;
3898 esac
3899 $cat <<EOM
3900
3901 By default, $package will be installed in $dflt/bin, manual pages
3902 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3903 installation directories. Typically this is something like /usr/local.
3904 If you wish to have binaries under /usr/bin but other parts of the
3905 installation under /usr/local, that's ok: you will be prompted
3906 separately for each of the installation directories, the prefix being
3907 only used to set the defaults.
3908
3909 EOM
3910 fn=d~
3911 rp='Installation prefix to use?'
3912 . ./getfile
3913 oldprefix=''
3914 case "$prefix" in
3915 '') ;;
3916 *)
3917         case "$ans" in
3918         "$prefix") ;;
3919         *) oldprefix="$prefix";;
3920         esac
3921         ;;
3922 esac
3923 prefix="$ans"
3924 prefixexp="$ansexp"
3925
3926 : allow them to override the AFS root
3927 case "$afsroot" in
3928 '')     afsroot=/afs ;;
3929 *)      afsroot=$afsroot ;;
3930 esac
3931
3932 : is AFS running?
3933 echo " "
3934 case "$afs" in
3935 $define|true)   afs=true ;;
3936 $undef|false)   afs=false ;;
3937 *)      if $test -d $afsroot; then
3938                 afs=true
3939         else
3940                 afs=false
3941         fi
3942         ;;
3943 esac
3944 if $afs; then
3945         echo "AFS may be running... I'll be extra cautious then..." >&4
3946 else
3947         echo "AFS does not seem to be running..." >&4
3948 fi
3949
3950 : determine installation prefix for where package is to be installed.
3951 if $afs; then 
3952 $cat <<EOM
3953
3954 Since you are running AFS, I need to distinguish the directory in which
3955 files will reside from the directory in which they are installed (and from
3956 which they are presumably copied to the former directory by occult means).
3957
3958 EOM
3959         case "$installprefix" in
3960         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3961         *) dflt="$installprefix";;
3962         esac
3963 else
3964 $cat <<EOM
3965
3966 In some special cases, particularly when building $package for distribution,
3967 it is convenient to distinguish the directory in which files should be
3968 installed from the directory ($prefix) in which they will
3969 eventually reside.  For most users, these two directories are the same.
3970
3971 EOM
3972         case "$installprefix" in
3973         '') dflt=$prefix ;;
3974         *) dflt=$installprefix;;
3975         esac
3976 fi
3977 fn=d~
3978 rp='What installation prefix should I use for installing files?'
3979 . ./getfile
3980 installprefix="$ans"
3981 installprefixexp="$ansexp"
3982
3983 : Perform the prefixexp/installprefixexp correction if necessary
3984 cat <<EOS >installprefix
3985 $startsh
3986 EOS
3987 cat <<'EOSC' >>installprefix
3988 : Change installation prefix, if necessary.
3989 if $test X"$prefix" != X"$installprefix"; then
3990     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3991 else
3992     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3993 fi
3994 EOSC
3995 chmod +x installprefix
3996 $eunicefix installprefix
3997
3998 : Set variables such as privlib and privlibexp from the output of ./getfile
3999 : performing the prefixexp/installprefixexp correction if necessary.
4000 cat <<EOS >setprefixvar
4001 $startsh
4002 EOS
4003 cat <<'EOSC' >>setprefixvar
4004 eval "${prefixvar}=\"\$ans\""
4005 eval "${prefixvar}exp=\"\$ansexp\""
4006 . ./installprefix
4007 EOSC
4008 chmod +x setprefixvar
4009 $eunicefix setprefixvar
4010
4011 : set up the script used to warn in case of inconsistency
4012 cat <<EOS >whoa
4013 $startsh
4014 EOS
4015 cat <<'EOSC' >>whoa
4016 dflt=y
4017 case "$hint" in
4018     recommended)
4019         case "$hintfile" in
4020         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4021                 ;;
4022         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4023                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4024                 ;;
4025         esac
4026         ;;
4027     *)  echo " "
4028         echo "*** WHOA THERE!!! ***" >&4
4029         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4030         ;;
4031 esac
4032 rp="    Keep the $hint value?"
4033 . ./myread
4034 case "$ans" in
4035 y) td=$was; tu=$was;;
4036 esac
4037 EOSC
4038
4039 : function used to set '$1' to '$val'
4040 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4041 case "$val$was" in
4042 $define$undef) . ./whoa; eval "$var=\$td";;
4043 $undef$define) . ./whoa; eval "$var=\$tu";;
4044 *) eval "$var=$val";;
4045 esac'
4046
4047 : Check is we will use socks
4048 case "$usesocks" in
4049 $define|true|[yY]*)     dflt='y';;
4050 *) dflt='n';;
4051 esac
4052 cat <<EOM
4053
4054 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4055 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4056 to use the PerlIO abstraction layer, this will be implicitly selected.
4057
4058 If this doesn't make any sense to you, just accept the default '$dflt'.
4059 EOM
4060 rp='Build Perl for SOCKS?'
4061 . ./myread
4062 case "$ans" in
4063 y|Y)    val="$define" ;;
4064 *)      val="$undef" ;;
4065 esac
4066 set usesocks
4067 eval $setvar
4068
4069 case "$usesocks" in
4070 $define|true|[yY]*) useperlio="$define";;
4071 esac
4072
4073 : Check if we want perlio
4074 case "$useperlio" in
4075 $define|true|[yY]*|'')  dflt='y';;
4076 *) dflt='n';;
4077 esac
4078 cat <<EOM
4079
4080 Previous version of $package used the standard IO mechanisms as
4081 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4082 alternate IO mechanisms via the PerlIO abstraction layer, but the
4083 stdio mechanism is still available if needed.  The abstraction layer
4084 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4085 Using PerlIO with sfio may cause problems with some extension modules.
4086
4087 If this doesn't make any sense to you, just accept the default '$dflt'.
4088 EOM
4089 rp='Use the PerlIO abstraction layer?'
4090 . ./myread
4091 case "$ans" in
4092 y|Y)
4093         val="$define"
4094         ;;
4095 *)
4096         echo "Ok, doing things the stdio way."
4097         val="$undef"
4098         ;;
4099 esac
4100 set useperlio
4101 eval $setvar
4102
4103 case "$usesocks" in
4104 $define|true|[yY]*)
4105         case "$useperlio" in
4106         $define|true|[yY]*) ;;
4107         *)      cat >&4 <<EOM
4108
4109 You are using the SOCKS proxy protocol library which means that you
4110 should also use the PerlIO layer.  You may be headed for trouble.
4111
4112 EOM
4113                 ;;
4114         esac
4115         ;;
4116 esac
4117
4118 : get the patchlevel
4119 echo " "
4120 echo "Getting the current patchlevel..." >&4
4121 if $test -r $rsrc/patchlevel.h;then
4122         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4123         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4124         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4125         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4126         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4127         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4128         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4129 else
4130         revision=0
4131         patchlevel=0
4132         subversion=0
4133         api_revision=0
4134         api_version=0
4135         api_subversion=0
4136         perl_patchlevel=0
4137         $echo "(You do not have patchlevel.h.  Eek.)"
4138 fi
4139 if $test -r $rsrc/.patch ; then
4140         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4141                 perl_patchlevel=`cat $rsrc/.patch`
4142         fi
4143 fi
4144 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4145 version_patchlevel_string="version $patchlevel subversion $subversion"
4146 case "$perl_patchlevel" in
4147 0|'') ;;
4148 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4149 esac
4150
4151 $echo "(You have $package $version_patchlevel_string.)"
4152
4153 case "$osname" in
4154 dos|vms)
4155         : XXX Should be a Configure test for double-dots in filenames.
4156         version=`echo $revision $patchlevel $subversion | \
4157                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4158         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4159                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4160         ;;
4161 *)
4162         version=`echo $revision $patchlevel $subversion | \
4163                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4164         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4165                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4166         ;;
4167 esac
4168 : Special case the 5.005_xx maintenance series, which used 5.005
4169 : without any subversion label as a subdirectory in $sitelib
4170 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4171         api_versionstring='5.005'
4172 fi
4173
4174 : Do we want threads support and if so, what type
4175 case "$usethreads" in
4176 $define|true|[yY]*)     dflt='y';;
4177 *)     # Catch case where user specified ithreads or 5005threads but
4178        # forgot -Dusethreads (A.D. 4/2002)
4179        case "$useithreads$use5005threads" in
4180        *$define*)
4181                 case "$useperlio" in
4182                 "$define")      dflt='y' ;;
4183                 *)              dflt='n' ;;
4184                 esac
4185                 ;;
4186        *)       dflt='n';;
4187        esac
4188        ;;
4189 esac
4190 cat <<EOM
4191
4192 Perl can be built to take advantage of threads on some systems.
4193 To do so, Configure can be run with -Dusethreads.
4194
4195 Note that Perl built with threading support runs slightly slower
4196 and uses more memory than plain Perl. The current implementation
4197 is believed to be stable, but it is fairly new, and so should be
4198 treated with caution.
4199
4200 If this doesn't make any sense to you, just accept the default '$dflt'.
4201 EOM
4202 rp='Build a threading Perl?'
4203 . ./myread
4204 case "$ans" in
4205 y|Y)    val="$define" ;;
4206 *)      val="$undef" ;;
4207 esac
4208 set usethreads
4209 eval $setvar
4210
4211 if $test $patchlevel -lt 9; then
4212     case "$usethreads" in
4213     $define)
4214         $cat <<EOM
4215
4216 Since release 5.6, Perl has had two different threading implementations,
4217 the newer interpreter-based version (ithreads) with one interpreter per
4218 thread, and the older 5.005 version (5005threads).
4219 The 5005threads version is effectively unmaintained and will probably be
4220 removed in Perl 5.10, so there should be no need to build a Perl using it
4221 unless needed for backwards compatibility with some existing 5.005threads
4222 code.
4223
4224 EOM
4225         : Default to ithreads unless overridden on command line or with
4226         : old config.sh
4227         dflt='y'
4228         case "$use5005threads" in
4229                 $define|true|[yY]*) dflt='n';;
4230         esac
4231         case "$useithreads" in
4232                 $undef|false|[nN]*) dflt='n';;
4233         esac
4234         rp='Use the newer interpreter-based ithreads?'
4235         . ./myread
4236         case "$ans" in
4237         y|Y)    val="$define" ;;
4238         *)      val="$undef" ;;
4239         esac
4240         set useithreads
4241         eval $setvar
4242         : Now set use5005threads to the opposite value.
4243         case "$useithreads" in
4244         $define) val="$undef" ;;
4245         *) val="$define" ;;
4246         esac
4247         set use5005threads
4248         eval $setvar
4249         ;;
4250     *)
4251         useithreads="$undef"
4252         use5005threads="$undef"
4253         ;;
4254     esac
4255
4256     case "$useithreads$use5005threads" in
4257     "$define$define")
4258         $cat >&4 <<EOM
4259
4260 You cannot have both the ithreads and the 5.005 threads enabled
4261 at the same time.  Disabling the 5.005 threads since they are
4262 much less stable than the ithreads.
4263
4264 EOM
4265         use5005threads="$undef"
4266         ;;
4267     esac
4268
4269 else
4270 : perl-5.9.x and later
4271
4272     if test X"$usethreads" = "X$define"; then
4273         case "$use5005threads" in
4274             $define|true|[yY]*)
4275                 $cat >&4 <<EOM
4276
4277 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4278
4279 EOM
4280             ;;
4281         esac
4282     fi
4283
4284     use5005threads="$undef"
4285     useithreads="$usethreads"
4286 fi
4287
4288 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4289         cat >&4 <<EOF
4290 ***
4291 *** To build with ithreads you must also use the PerlIO layer.
4292 *** Cannot continue, aborting.
4293 ***
4294 EOF
4295         exit 1
4296 fi
4297
4298 case "$d_oldpthreads" in
4299 '')     : Configure tests would be welcome here.  For now, assume undef.
4300         val="$undef" ;;
4301 *)      val="$d_oldpthreads" ;;
4302 esac
4303 set d_oldpthreads
4304 eval $setvar
4305
4306
4307 : Look for a hint-file generated 'call-back-unit'.  If the
4308 : user has specified that a threading perl is to be built,
4309 : we may need to set or change some other defaults.
4310 if $test -f usethreads.cbu; then
4311     echo "Your platform has some specific hints regarding threaded builds, using them..."
4312     . ./usethreads.cbu
4313 else
4314     case "$usethreads" in
4315         "$define"|true|[yY]*)
4316                 $cat <<EOM
4317 (Your platform does not have any specific hints for threaded builds.
4318  Assuming POSIX threads, then.)
4319 EOM
4320         ;;
4321     esac
4322 fi
4323
4324 : Check if multiplicity is required
4325 cat <<EOM
4326
4327 Perl can be built so that multiple Perl interpreters can coexist
4328 within the same Perl executable.
4329 EOM
4330
4331 case "$useithreads" in
4332 $define)
4333         cat <<EOM
4334 This multiple interpreter support is required for interpreter-based threads.
4335 EOM
4336         val="$define"
4337         ;;
4338 *)      case "$usemultiplicity" in
4339         $define|true|[yY]*)     dflt='y';;
4340         *) dflt='n';;
4341         esac
4342         echo " "
4343         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4344         rp='Build Perl for multiplicity?'
4345         . ./myread
4346         case "$ans" in
4347         y|Y)    val="$define" ;;
4348         *)      val="$undef" ;;
4349         esac
4350         ;;
4351 esac
4352 set usemultiplicity
4353 eval $setvar
4354
4355 : Check if morebits is requested
4356 case "$usemorebits" in
4357 "$define"|true|[yY]*)
4358         use64bitint="$define"
4359         uselongdouble="$define"
4360         usemorebits="$define"
4361         ;;
4362 *)      usemorebits="$undef"
4363         ;;
4364 esac
4365
4366 : Determine the C compiler to be used
4367 echo " "
4368 case "$cc" in
4369 '') dflt=cc;;
4370 *) dflt="$cc";;
4371 esac
4372 rp="Use which C compiler?"
4373 . ./myread
4374 cc="$ans"
4375
4376 : See whether they have no cc but they do have gcc
4377 . ./trygcc
4378 if $test -f cc.cbu; then
4379     . ./cc.cbu
4380 fi
4381 . ./checkcc
4382
4383 : make some quick guesses about what we are up against
4384 echo " "
4385 $echo $n "Hmm...  $c"
4386 echo exit 1 >bsd
4387 echo exit 1 >usg
4388 echo exit 1 >v7
4389 echo exit 1 >osf1
4390 echo exit 1 >eunice
4391 echo exit 1 >xenix
4392 echo exit 1 >venix
4393 echo exit 1 >os2
4394 d_bsd="$undef"
4395 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4396 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4397 then
4398         echo "Looks kind of like an OSF/1 system, but we'll see..."
4399         echo exit 0 >osf1
4400 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4401         xxx=`./loc addbib blurfl $pth`
4402         if $test -f $xxx; then
4403         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4404                 echo exit 0 >bsd
4405                 echo exit 0 >usg
4406         else
4407                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4408                         echo "Looks kind of like an extended USG system, but we'll see..."
4409                 else
4410                         echo "Looks kind of like a USG system, but we'll see..."
4411                 fi
4412                 echo exit 0 >usg
4413         fi
4414 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4415         echo "Looks kind of like a BSD system, but we'll see..."
4416         d_bsd="$define"
4417         echo exit 0 >bsd
4418 else
4419         echo "Looks kind of like a Version 7 system, but we'll see..."
4420         echo exit 0 >v7
4421 fi
4422 case "$eunicefix" in
4423 *unixtovms*)
4424         $cat <<'EOI'
4425 There is, however, a strange, musty smell in the air that reminds me of
4426 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4427 EOI
4428         echo exit 0 >eunice
4429         d_eunice="$define"
4430 : it so happens the Eunice I know will not run shell scripts in Unix format
4431         ;;
4432 *)
4433         echo " "
4434         echo "Congratulations.  You aren't running Eunice."
4435         d_eunice="$undef"
4436         ;;
4437 esac
4438 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4439 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4440 : semicolon as a patch separator
4441 case "$p_" in
4442 :) ;;
4443 *)
4444         $cat <<'EOI'
4445 I have the feeling something is not exactly right, however...don't tell me...
4446 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4447 (Or you may be running DOS with DJGPP.)
4448 EOI
4449         echo exit 0 >os2
4450         ;;
4451 esac
4452 if test -f /xenix; then
4453         echo "Actually, this looks more like a XENIX system..."
4454         echo exit 0 >xenix
4455         d_xenix="$define"
4456 else
4457         echo " "
4458         echo "It's not Xenix..."
4459         d_xenix="$undef"
4460 fi
4461 chmod +x xenix
4462 $eunicefix xenix
4463 if test -f /venix; then
4464         echo "Actually, this looks more like a VENIX system..."
4465         echo exit 0 >venix
4466 else
4467         echo " "
4468         if ./xenix; then
4469                 : null
4470         else
4471                 echo "Nor is it Venix..."
4472         fi
4473 fi
4474 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4475 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4476 $rm -f foo
4477
4478 : Check if we are using GNU gcc and what its version is
4479 echo " "
4480 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4481 $cat >try.c <<EOM
4482 #include <stdio.h>
4483 int main() {
4484 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4485 #ifdef __VERSION__
4486         printf("%s\n", __VERSION__);
4487 #else
4488         printf("%s\n", "1");
4489 #endif
4490 #endif
4491         return(0);
4492 }
4493 EOM
4494 if $cc -o try $ccflags $ldflags try.c; then
4495         gccversion=`$run ./try`
4496         case "$gccversion" in
4497         '') echo "You are not using GNU cc." ;;
4498         *)  echo "You are using GNU cc $gccversion."
4499             ccname=gcc
4500             ;;
4501         esac
4502 else
4503         echo " "
4504         echo "*** WHOA THERE!!! ***" >&4
4505         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4506         case "$knowitall" in
4507         '')
4508         echo "    You'd better start hunting for one and let me know about it." >&4
4509                 exit 1
4510                 ;;
4511         esac
4512 fi
4513 $rm -f try try.*
4514 case "$gccversion" in
4515 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4516 esac
4517 case "$gccversion" in
4518 '') gccosandvers='' ;;
4519 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4520    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4521    gccshortvers=''
4522    case "$gccosandvers" in
4523    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4524    $osname$osvers) ;; # looking good
4525    $osname*) cat <<EOM >&4
4526
4527 *** WHOA THERE!!! ***
4528
4529     Your gcc has not been compiled for the exact release of
4530     your operating system ($gccosandvers versus $osname$osvers).
4531
4532     In general it is a good idea to keep gcc synchronized with
4533     the operating system because otherwise serious problems
4534     may ensue when trying to compile software, like Perl.
4535
4536     I'm trying to be optimistic here, though, and will continue.
4537     If later during the configuration and build icky compilation
4538     problems appear (headerfile conflicts being the most common
4539     manifestation), I suggest reinstalling the gcc to match
4540     your operating system release.
4541
4542 EOM
4543       ;;
4544    *) gccosandvers='' ;; # failed to parse, better be silent
4545    esac
4546    ;;
4547 esac
4548 case "$ccname" in
4549 '') ccname="$cc" ;;
4550 esac
4551
4552 # gcc 3.* complain about adding -Idirectories that they already know about,
4553 # so we will take those off from locincpth.
4554 case "$gccversion" in
4555 3*)
4556     echo "main(){}">try.c
4557     for incdir in $locincpth; do
4558        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4559              grep '^c[cp]p*[01]: warning: changing search order '`
4560        if test "X$warn" != X; then
4561            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4562        fi
4563     done
4564     $rm -f try try.*
4565 esac
4566
4567 : What should the include directory be ?
4568 echo " "
4569 $echo $n "Hmm...  $c"
4570 dflt='/usr/include'
4571 incpath=''
4572 mips_type=''
4573 if $test -f /bin/mips && /bin/mips; then
4574         echo "Looks like a MIPS system..."
4575         $cat >usr.c <<'EOCP'
4576 #ifdef SYSTYPE_BSD43
4577 /bsd43
4578 #endif
4579 EOCP
4580         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4581                 dflt='/bsd43/usr/include'
4582                 incpath='/bsd43'
4583                 mips_type='BSD 4.3'
4584         else
4585                 mips_type='System V'
4586         fi
4587         $rm -f usr.c usr.out
4588         echo "and you're compiling with the $mips_type compiler and libraries."
4589         xxx_prompt=y
4590         echo "exit 0" >mips
4591 else
4592         echo "Doesn't look like a MIPS system."
4593         xxx_prompt=n
4594         echo "exit 1" >mips
4595 fi
4596 chmod +x mips
4597 $eunicefix mips
4598 case "$usrinc" in
4599 '') ;;
4600 *) dflt="$usrinc";;
4601 esac
4602 case "$xxx_prompt" in
4603 y)      fn=d/
4604         echo " "
4605         rp='Where are the include files you want to use?'
4606         . ./getfile
4607         usrinc="$ans"
4608         ;;
4609 *)      usrinc="$dflt"
4610         ;;
4611 esac
4612
4613 : see how we invoke the C preprocessor
4614 echo " "
4615 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4616 cat <<'EOT' >testcpp.c
4617 #define ABC abc
4618 #define XYZ xyz
4619 ABC.XYZ
4620 EOT
4621 cd ..
4622 if test ! -f cppstdin; then
4623         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4624                 # AIX cc -E doesn't show the absolute headerfile
4625                 # locations but we'll cheat by using the -M flag.
4626                 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
4627         else
4628                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4629         fi
4630 else
4631         echo "Keeping your $hint cppstdin wrapper."
4632 fi
4633 chmod 755 cppstdin
4634 wrapper=`pwd`/cppstdin
4635 ok='false'
4636 cd UU
4637
4638 if $test "X$cppstdin" != "X" && \
4639         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4640         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4641 then
4642         echo "You used to use $cppstdin $cppminus so we'll use that again."
4643         case "$cpprun" in
4644         '') echo "But let's see if we can live without a wrapper..." ;;
4645         *)
4646                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4647                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4648                 then
4649                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4650                         ok='true'
4651                 else
4652                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4653                 fi
4654                 ;;
4655         esac
4656 else
4657         case "$cppstdin" in
4658         '') ;;
4659         *)
4660                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4661                 ;;
4662         esac
4663 fi
4664
4665 if $ok; then
4666         : nothing
4667 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4668         $cc -E <testcpp.c >testcpp.out 2>&1; \
4669         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4670         echo "Yup, it does."
4671         x_cpp="$cc -E"
4672         x_minus='';
4673 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4674         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4675         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4676         echo "Yup, it does."
4677         x_cpp="$cc -E"
4678         x_minus='-';
4679 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4680         $cc -P <testcpp.c >testcpp.out 2>&1; \
4681         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4682         echo "Yipee, that works!"
4683         x_cpp="$cc -P"
4684         x_minus='';
4685 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4686         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4687         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4688         echo "At long last!"
4689         x_cpp="$cc -P"
4690         x_minus='-';
4691 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4692         $cpp <testcpp.c >testcpp.out 2>&1; \
4693         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694         echo "It works!"
4695         x_cpp="$cpp"
4696         x_minus='';
4697 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4698         $cpp - <testcpp.c >testcpp.out 2>&1; \
4699         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700         echo "Hooray, it works!  I was beginning to wonder."
4701         x_cpp="$cpp"
4702         x_minus='-';
4703 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4704         $wrapper <testcpp.c >testcpp.out 2>&1; \
4705         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706         x_cpp="$wrapper"
4707         x_minus=''
4708         echo "Eureka!"
4709 else
4710         dflt=''
4711         rp="No dice.  I can't find a C preprocessor.  Name one:"
4712         . ./myread
4713         x_cpp="$ans"
4714         x_minus=''
4715         $x_cpp <testcpp.c >testcpp.out 2>&1
4716         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4717                 echo "OK, that will do." >&4
4718         else
4719 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4720                 exit 1
4721         fi
4722 fi
4723
4724 case "$ok" in
4725 false)
4726         cppstdin="$x_cpp"
4727         cppminus="$x_minus"
4728         cpprun="$x_cpp"
4729         cpplast="$x_minus"
4730         set X $x_cpp
4731         shift
4732         case "$1" in
4733         "$cpp")
4734                 echo "Perhaps can we force $cc -E using a wrapper..."
4735                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4736                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4737                 then
4738                         echo "Yup, we can."
4739                         cppstdin="$wrapper"
4740                         cppminus='';
4741                 else
4742                         echo "Nope, we'll have to live without it..."
4743                 fi
4744                 ;;
4745         esac
4746         case "$cpprun" in
4747         "$wrapper")
4748                 cpprun=''
4749                 cpplast=''
4750                 ;;
4751         esac
4752         ;;
4753 esac
4754
4755 case "$cppstdin" in
4756 "$wrapper"|'cppstdin') ;;
4757 *) $rm -f $wrapper;;
4758 esac
4759 $rm -f testcpp.c testcpp.out
4760
4761 : Set private lib path
4762 case "$plibpth" in
4763 '') if ./mips; then
4764                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4765         fi;;
4766 esac
4767 case "$libpth" in
4768 ' ') dlist='';;
4769 '') dlist="$loclibpth $plibpth $glibpth";;
4770 *) dlist="$libpth";;
4771 esac
4772
4773 : Now check and see which directories actually exist, avoiding duplicates
4774 libpth=''
4775 for xxx in $dlist
4776 do
4777     if $test -d $xxx; then
4778                 case " $libpth " in
4779                 *" $xxx "*) ;;
4780                 *) libpth="$libpth $xxx";;
4781                 esac
4782     fi
4783 done
4784 $cat <<'EOM'
4785
4786 Some systems have incompatible or broken versions of libraries.  Among
4787 the directories listed in the question below, please remove any you
4788 know not to be holding relevant libraries, and add any that are needed.
4789 Say "none" for none.
4790
4791 EOM
4792 case "$libpth" in
4793 '') dflt='none';;
4794 *)
4795         set X $libpth
4796         shift
4797         dflt=${1+"$@"}
4798         ;;
4799 esac
4800 rp="Directories to use for library searches?"
4801 . ./myread
4802 case "$ans" in
4803 none) libpth=' ';;
4804 *) libpth="$ans";;
4805 esac
4806
4807 : compute shared library extension
4808 case "$so" in
4809 '')
4810         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4811                 dflt='sl'
4812         else
4813                 dflt='so'
4814         fi
4815         ;;
4816 *) dflt="$so";;
4817 esac
4818 $cat <<EOM
4819
4820 On some systems, shared libraries may be available.  Answer 'none' if
4821 you want to suppress searching of shared libraries for the remainder
4822 of this configuration.
4823
4824 EOM
4825 rp='What is the file extension used for shared libraries?'
4826 . ./myread
4827 so="$ans"
4828
4829 : Define several unixisms.
4830 : Hints files or command line option can be used to override them.
4831 : The convoluted testing is in case hints files set either the old
4832 : or the new name.
4833 case "$_exe" in
4834 '')     case "$exe_ext" in
4835         '')     ;;
4836         *)      _exe="$exe_ext" ;;
4837         esac
4838         ;;
4839 esac
4840 case "$_a" in
4841 '')     case "$lib_ext" in
4842     '') _a='.a';;
4843         *)      _a="$lib_ext" ;;
4844         esac
4845         ;;
4846 esac
4847 case "$_o" in
4848 '') case "$obj_ext" in
4849         '')     _o='.o';;
4850         *)      _o="$obj_ext";;
4851         esac
4852         ;;
4853 esac
4854 case "$p_" in
4855 '') case "$path_sep" in
4856         '')     p_=':';;
4857         *)      p_="$path_sep";;
4858         esac
4859         ;;
4860 esac
4861 exe_ext=$_exe
4862 lib_ext=$_a
4863 obj_ext=$_o
4864 path_sep=$p_
4865
4866 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4867
4868 : Which makefile gets called first.  This is used by make depend.
4869 case "$firstmakefile" in
4870 '') firstmakefile='makefile';;
4871 esac
4872
4873 : Check for uselongdouble support
4874 case "$ccflags" in
4875 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4876 esac
4877
4878 case "$uselongdouble" in
4879 $define|true|[yY]*)     dflt='y';;
4880 *) dflt='n';;
4881 esac
4882 cat <<EOM
4883
4884 Perl can be built to take advantage of long doubles which
4885 (if available) may give more accuracy and range for floating point numbers.
4886
4887 If this doesn't make any sense to you, just accept the default '$dflt'.
4888 EOM
4889 rp='Try to use long doubles if available?'
4890 . ./myread
4891 case "$ans" in
4892 y|Y)    val="$define"   ;;
4893 *)      val="$undef"    ;;
4894 esac
4895 set uselongdouble
4896 eval $setvar
4897
4898 case "$uselongdouble" in
4899 true|[yY]*) uselongdouble="$define" ;;
4900 esac
4901
4902 : Look for a hint-file generated 'call-back-unit'.  If the
4903 : user has specified that long doubles should be used,
4904 : we may need to set or change some other defaults.
4905 if $test -f uselongdouble.cbu; then
4906     echo "Your platform has some specific hints regarding long doubles, using them..."
4907     . ./uselongdouble.cbu
4908 else
4909     case "$uselongdouble" in
4910         $define)
4911                 $cat <<EOM
4912 (Your platform does not have any specific hints for long doubles.)
4913 EOM
4914         ;;
4915     esac
4916 fi
4917
4918 : Looking for optional libraries
4919 echo " "
4920 echo "Checking for optional libraries..." >&4
4921 case "$libs" in
4922 ' '|'') dflt='';;
4923 *) dflt="$libs";;
4924 esac
4925 case "$libswanted" in
4926 '') libswanted='c_s';;
4927 esac
4928 case "$usesocks" in
4929 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4930 esac
4931 libsfound=''
4932 libsfiles=''
4933 libsdirs=''
4934 libspath=''
4935 for thisdir in $libpth $xlibpth; do
4936   test -d $thisdir && libspath="$libspath $thisdir"
4937 done
4938 for thislib in $libswanted; do
4939         for thisdir in $libspath; do
4940             xxx=''
4941             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4942                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4943                 $test -f "$xxx" && eval $libscheck
4944                 $test -f "$xxx" && libstyle=shared
4945             fi
4946             if test ! -f "$xxx"; then
4947                 xxx=$thisdir/lib$thislib.$so
4948                 $test -f "$xxx" && eval $libscheck
4949                 $test -f "$xxx" && libstyle=shared
4950             fi
4951             if test ! -f "$xxx"; then
4952                 xxx=$thisdir/lib$thislib$_a
4953                 $test -f "$xxx" && eval $libscheck
4954                 $test -f "$xxx" && libstyle=static
4955             fi
4956             if test ! -f "$xxx"; then
4957                 xxx=$thisdir/$thislib$_a
4958                 $test -f "$xxx" && eval $libscheck
4959                 $test -f "$xxx" && libstyle=static
4960             fi
4961             if test ! -f "$xxx"; then
4962                 xxx=$thisdir/lib${thislib}_s$_a
4963                 $test -f "$xxx" && eval $libscheck
4964                 $test -f "$xxx" && libstyle=static
4965                 $test -f "$xxx" && thislib=${thislib}_s
4966             fi
4967             if test ! -f "$xxx"; then
4968                 xxx=$thisdir/Slib$thislib$_a
4969                 $test -f "$xxx" && eval $libscheck
4970                 $test -f "$xxx" && libstyle=static
4971             fi
4972             if $test -f "$xxx"; then
4973                 case "$libstyle" in
4974                 shared) echo "Found -l$thislib (shared)." ;;
4975                 static) echo "Found -l$thislib." ;;
4976                 *)      echo "Found -l$thislib ($libstyle)." ;;
4977                 esac
4978                 case " $dflt " in
4979                 *"-l$thislib "*);;
4980                 *) dflt="$dflt -l$thislib"
4981                    libsfound="$libsfound $xxx"
4982                    yyy=`basename $xxx`
4983                    libsfiles="$libsfiles $yyy"
4984                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4985                    case " $libsdirs " in
4986                    *" $yyy "*) ;;
4987                    *) libsdirs="$libsdirs $yyy" ;;
4988                    esac
4989                    ;;
4990                 esac
4991                 break
4992             fi
4993         done
4994         if $test ! -f "$xxx"; then
4995             echo "No -l$thislib."
4996         fi
4997 done
4998 set X $dflt
4999 shift
5000 dflt="$*"
5001 case "$libs" in
5002 '') dflt="$dflt";;
5003 *) dflt="$libs";;
5004 esac
5005 case "$dflt" in
5006 ' '|'') dflt='none';;
5007 esac
5008
5009 $cat <<EOM
5010
5011 In order to compile $package on your machine, a number of libraries
5012 are usually needed.  Include any other special libraries here as well.
5013 Say "none" for none.  The default list is almost always right.
5014 EOM
5015
5016 echo " "
5017 rp="What libraries to use?"
5018 . ./myread
5019 case "$ans" in
5020 none) libs=' ';;
5021 *) libs="$ans";;
5022 esac
5023
5024 : determine optimization, if desired, or use for debug flag also
5025 case "$optimize" in
5026 ' '|$undef) dflt='none';;
5027 '') dflt='-O';;
5028 *) dflt="$optimize";;
5029 esac
5030 $cat <<EOH
5031
5032 By default, $package compiles with the -O flag to use the optimizer.
5033 Alternately, you might want to use the symbolic debugger, which uses
5034 the -g flag (on traditional Unix systems).  Either flag can be
5035 specified here.  To use neither flag, specify the word "none".
5036
5037 EOH
5038 rp="What optimizer/debugger flag should be used?"
5039 . ./myread
5040 optimize="$ans"
5041 case "$optimize" in
5042 'none') optimize=" ";;
5043 esac
5044
5045 : Check what DEBUGGING is required from the command line
5046 : -DEBUGGING      or -DDEBUGGING or
5047 : -DEBUGGING=both                       = -g + -DDEBUGGING
5048 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5049 : -DEBUGGING=none or -UDEBUGGING        =
5050 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5051 case "$EBUGGING" in
5052 '')     ;;
5053 *)      DEBUGGING=$EBUGGING ;;
5054 esac
5055
5056 case "$DEBUGGING" in
5057 -g|both|$define)
5058     case "$optimize" in
5059         *-g*) ;;
5060         *)    optimize="$optimize -g" ;;
5061     esac ;;
5062 none|$undef)
5063     case "$optimize" in
5064         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5065                 shift
5066                 optimize="$*"
5067                 ;;
5068     esac ;;
5069 esac
5070
5071 dflt=''
5072 case "$DEBUGGING" in
5073 both|$define) dflt='-DDEBUGGING'
5074 esac
5075
5076 : argument order is deliberate, as the flag will start with - which set could
5077 : think is an option
5078 checkccflag='check=$1; flag=$2; callback=$3;
5079 echo " ";
5080 echo "Checking if your compiler accepts $flag" 2>&1;
5081 echo "int main(void) { return 0; }" > gcctest.c;
5082 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5083     echo "Yes, it does." 2>&1;
5084     if $test -s gcctest.out ; then
5085         echo "But your platform does not like it:";
5086         cat gcctest.out;
5087     else
5088         case "$ccflags" in
5089         *$check*)
5090             echo "Leaving current flags $ccflags alone." 2>&1
5091             ;;
5092         *) dflt="$dflt $flag";
5093             eval $callback
5094             ;;
5095         esac
5096     fi
5097 else
5098     echo "Nope, it does not, but that is ok." 2>&1;
5099 fi
5100 '
5101
5102 : We will not override a previous value, but we might want to
5103 : augment a hint file
5104 case "$hint" in
5105 default|recommended)
5106         case "$gccversion" in
5107         1*) dflt="$dflt -fpcc-struct-return" ;;
5108         esac
5109         case "$optimize:$DEBUGGING" in
5110         *-g*:old) dflt="$dflt -DDEBUGGING";;
5111         esac
5112         case "$gccversion" in
5113         2*) if $test -d /etc/conf/kconfig.d &&
5114                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5115                 then
5116                         # Interactive Systems (ISC) POSIX mode.
5117                         dflt="$dflt -posix"
5118                 fi
5119                 ;;
5120         esac
5121         case "$gccversion" in
5122         1*) ;;
5123         2.[0-8]*) ;;
5124         ?*)     set strict-aliasing -fno-strict-aliasing
5125                 eval $checkccflag
5126                 ;;
5127         esac
5128         # For gcc, adding -pipe speeds up compilations for some, but apparently
5129         # some assemblers can't read from stdin.  (It also slows down compilations
5130         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5131         case "$gccversion" in
5132         ?*)     set pipe -pipe
5133                 eval $checkccflag
5134                 ;;
5135         esac
5136
5137         # on x86_64 (at least) we require an extra library (libssp) in the
5138         # link command line. This library is not named, so I infer that it is
5139         # an implementation detail that may change. Hence the safest approach
5140         # is to add the flag to the flags passed to the compiler at link time,
5141         # as that way the compiler can do the right implementation dependant
5142         # thing. (NWC)
5143         case "$gccversion" in
5144         ?*)     set stack-protector -fstack-protector
5145                 eval $checkccflag
5146                 ;;
5147         esac
5148         ;;
5149 esac
5150
5151 case "$mips_type" in
5152 *BSD*|'') inclwanted="$locincpth $usrinc";;
5153 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5154 esac
5155 for thisincl in $inclwanted; do
5156         if $test -d $thisincl; then
5157                 if $test x$thisincl != x$usrinc; then
5158                         case "$dflt" in
5159                         *" -I$thisincl "*);;
5160                         *) dflt="$dflt -I$thisincl ";;
5161                         esac
5162                 fi
5163         fi
5164 done
5165
5166 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5167         xxx=true;
5168 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5169         xxx=true;
5170 else
5171         xxx=false;
5172 fi;
5173 if $xxx; then
5174         case "$dflt" in
5175         *$2*);;
5176         *) dflt="$dflt -D$2";;
5177         esac;
5178 fi'
5179
5180 set signal.h LANGUAGE_C; eval $inctest
5181
5182 case "$usesocks" in
5183 $define)
5184         ccflags="$ccflags -DSOCKS"
5185         ;;
5186 esac
5187
5188 case "$hint" in
5189 default|recommended) dflt="$ccflags $dflt" ;;
5190 *) dflt="$ccflags";;
5191 esac
5192
5193 case "$dflt" in
5194 ''|' ') dflt=none;;
5195 esac
5196
5197 $cat <<EOH
5198
5199 Your C compiler may want other flags.  For this question you should include
5200 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5201 but you should NOT include libraries or ld flags like -lwhatever.  If you
5202 want $package to honor its debug switch, you should include -DDEBUGGING here.
5203 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5204
5205 To use no flags, specify the word "none".
5206
5207 EOH
5208 set X $dflt
5209 shift
5210 dflt=${1+"$@"}
5211 rp="Any additional cc flags?"
5212 . ./myread
5213 case "$ans" in
5214 none) ccflags='';;
5215 *) ccflags="$ans";;
5216 esac
5217
5218 : the following weeds options from ccflags that are of no interest to cpp
5219 case "$cppflags" in
5220 '') cppflags="$ccflags" ;;
5221 *)  cppflags="$cppflags $ccflags" ;;
5222 esac
5223 case "$gccversion" in
5224 1*) cppflags="$cppflags -D__GNUC__"
5225 esac
5226 case "$mips_type" in
5227 '');;
5228 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5229 esac
5230 case "$cppflags" in
5231 '');;
5232 *)
5233         echo " "
5234         echo "Let me guess what the preprocessor flags are..." >&4
5235         set X $cppflags
5236         shift
5237         cppflags=''
5238         $cat >cpp.c <<'EOM'
5239 #define BLURFL foo
5240
5241 BLURFL xx LFRULB
5242 EOM
5243         previous=''
5244         for flag in $*
5245         do
5246                 case "$flag" in
5247                 -*) ftry="$flag";;
5248                 *) ftry="$previous $flag";;
5249                 esac
5250                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5251                         >cpp1.out 2>/dev/null && \
5252                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5253                         >cpp2.out 2>/dev/null && \
5254                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5255                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5256                 then
5257                         cppflags="$cppflags $ftry"
5258                         previous=''
5259                 else
5260                         previous="$flag"
5261                 fi
5262         done
5263         set X $cppflags
5264         shift
5265         cppflags=${1+"$@"}
5266         case "$cppflags" in
5267         *-*)  echo "They appear to be: $cppflags";;
5268         esac
5269         $rm -f cpp.c cpp?.out
5270         ;;
5271 esac
5272
5273 : flags used in final linking phase
5274 case "$ldflags" in
5275 '') if ./venix; then
5276                 dflt='-i -z'
5277         else
5278                 dflt=''
5279         fi
5280         case "$ccflags" in
5281         *-posix*) dflt="$dflt -posix" ;;
5282         esac
5283         ;;
5284 *) dflt="$ldflags";;
5285 esac
5286 # See note above about -fstack-protector
5287 case "$ccflags" in
5288 *-fstack-protector*) 
5289         case "$dflt" in
5290         *-fstack-protector*) ;; # Don't add it again
5291         *) dflt="$dflt -fstack-protector" ;; 
5292         esac
5293         ;;
5294 esac
5295
5296 : Try to guess additional flags to pick up local libraries.
5297 for thislibdir in $libpth; do
5298         case " $loclibpth " in
5299         *" $thislibdir "*)
5300                 case "$dflt " in
5301                 *"-L$thislibdir "*) ;;
5302                 *)  dflt="$dflt -L$thislibdir" ;;
5303                 esac
5304                 ;;
5305         esac
5306 done
5307
5308 case "$dflt" in
5309 '') dflt='none' ;;
5310 esac
5311
5312 $cat <<EOH
5313
5314 Your C linker may need flags.  For this question you should
5315 include -L/whatever and any other flags used by the C linker, but you
5316 should NOT include libraries like -lwhatever.
5317
5318 Make sure you include the appropriate -L/path flags if your C linker
5319 does not normally search all of the directories you specified above,
5320 namely
5321         $libpth
5322 To use no flags, specify the word "none".
5323
5324 EOH
5325
5326 rp="Any additional ld flags (NOT including libraries)?"
5327 . ./myread
5328 case "$ans" in
5329 none) ldflags='';;
5330 *) ldflags="$ans";;
5331 esac
5332 rmlist="$rmlist pdp11"
5333
5334 : coherency check
5335 echo " "
5336 echo "Checking your choice of C compiler and flags for coherency..." >&4
5337 $cat > try.c <<'EOF'
5338 #include <stdio.h>
5339 int main() { printf("Ok\n"); return(0); }
5340 EOF
5341 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5342 shift
5343 $cat >try.msg <<'EOM'
5344 I've tried to compile and run the following simple program:
5345
5346 EOM
5347 $cat try.c >> try.msg
5348
5349 $cat >> try.msg <<EOM
5350
5351 I used the command:
5352
5353         $*
5354         $run ./try
5355
5356 and I got the following output:
5357
5358 EOM
5359 dflt=y
5360 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5361         if $sh -c "$run ./try " >>try.msg 2>&1; then
5362                 xxx=`$run ./try`
5363                 case "$xxx" in
5364                 "Ok") dflt=n ;;
5365                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5366                         case " $libs " in
5367                         *" -lsfio "*)
5368                                 cat >> try.msg <<'EOQS'
5369 If $libs contains -lsfio, and sfio is mis-configured, then it
5370 sometimes (apparently) runs and exits with a 0 status, but with no
5371 output!  It may have to do with sfio's use of _exit vs. exit.
5372
5373 EOQS
5374                                 rp="You have a big problem.  Shall I abort Configure"
5375                                 dflt=y
5376                                 ;;
5377                         esac
5378                         ;;
5379                 esac
5380         else
5381                 echo "The program compiled OK, but exited with status $?." >>try.msg
5382                 rp="You have a problem.  Shall I abort Configure"
5383                 dflt=y
5384         fi
5385 else
5386         echo "I can't compile the test program." >>try.msg
5387         rp="You have a BIG problem.  Shall I abort Configure"
5388         dflt=y
5389 fi
5390 case "$dflt" in
5391 y)
5392         $cat try.msg >&4
5393         case "$knowitall" in
5394         '')
5395                 echo "(The supplied flags or libraries might be incorrect.)"
5396                 ;;
5397         *) dflt=n;;
5398         esac
5399         echo " "
5400         . ./myread
5401         case "$ans" in
5402         n*|N*) ;;
5403         *)      echo "Ok.  Stopping Configure." >&4
5404                 exit 1
5405                 ;;
5406         esac
5407         ;;
5408 n) echo "OK, that should do.";;
5409 esac
5410 $rm_try gcctest gcctest.out
5411
5412 : define a shorthand compile call
5413 compile='
5414 mc_file=$1;
5415 shift;
5416 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5417 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5418 exit 1;
5419 fi;
5420 esac;
5421 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5422 : define a shorthand compile call for compilations that should be ok.
5423 compile_ok='
5424 mc_file=$1;
5425 shift;
5426 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5427
5428 : determine filename position in cpp output
5429 echo " "
5430 echo "Computing filename position in cpp output for #include directives..." >&4
5431 case "$osname" in
5432 vos) testaccess=-e ;;
5433 *)   testaccess=-r ;;
5434 esac
5435 echo '#include <stdio.h>' > foo.c
5436 $cat >fieldn <<EOF
5437 $startsh
5438 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5439 $grep '^[       ]*#.*stdio\.h' | \
5440 while read cline; do
5441         pos=1
5442         set \$cline
5443         while $test \$# -gt 0; do
5444                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5445                         echo "\$pos"
5446                         exit 0
5447                 fi
5448                 shift
5449                 pos=\`expr \$pos + 1\`
5450         done
5451 done
5452 EOF
5453 chmod +x fieldn
5454 fieldn=`./fieldn`
5455 $rm -f foo.c fieldn
5456 case $fieldn in
5457 '') pos='???';;
5458 1) pos=first;;
5459 2) pos=second;;
5460 3) pos=third;;
5461 *) pos="${fieldn}th";;
5462 esac
5463 echo "Your cpp writes the filename in the $pos field of the line."
5464
5465 case "$osname" in
5466 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5467 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5468 *)   cppfilter='' ;;
5469 esac
5470 : locate header file
5471 $cat >findhdr <<EOF
5472 $startsh
5473 wanted=\$1
5474 name=''
5475 for usrincdir in $usrinc
5476 do
5477         if test -f \$usrincdir/\$wanted; then
5478                 echo "\$usrincdir/\$wanted"
5479                 exit 0
5480         fi
5481 done
5482 awkprg='{ print \$$fieldn }'
5483 echo "#include <\$wanted>" > foo\$\$.c
5484 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5485 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5486 while read cline; do
5487         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5488         case "\$name" in
5489         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5490         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5491         *) exit 2;;
5492         esac;
5493 done;
5494 #
5495 # status = 0: grep returned 0 lines, case statement not executed
5496 # status = 1: headerfile found
5497 # status = 2: while loop executed, no headerfile found
5498 #
5499 status=\$?
5500 $rm -f foo\$\$.c;
5501 if test \$status -eq 1; then
5502         exit 0;
5503 fi
5504 exit 1
5505 EOF
5506 chmod +x findhdr
5507
5508 : define an alternate in-header-list? function
5509 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5510 cont=true; xxf="echo \"<\$1> found.\" >&4";
5511 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5512 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5513 esac;
5514 case $# in 4) instead=instead;; *) instead="at last";; esac;
5515 while $test "$cont"; do
5516         xxx=`./findhdr $1`
5517         var=$2; eval "was=\$$2";
5518         if $test "$xxx" && $test -r "$xxx";
5519         then eval $xxf;
5520         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5521                 cont="";
5522         else eval $xxnf;
5523         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5524         set $yyy; shift; shift; yyy=$@;
5525         case $# in 0) cont="";;
5526         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5527                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5528         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5529                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5530         esac;
5531 done;
5532 while $test "$yyy";
5533 do set $yyy; var=$2; eval "was=\$$2";
5534         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5535         set $yyy; shift; shift; yyy=$@;
5536 done'
5537
5538 : see if stdlib is available
5539 set stdlib.h i_stdlib
5540 eval $inhdr
5541
5542 : check for lengths of integral types
5543 echo " "
5544 case "$intsize" in
5545 '')
5546         echo "Checking to see how big your integers are..." >&4
5547         $cat >try.c <<EOCP
5548 #include <stdio.h>
5549 #$i_stdlib I_STDLIB
5550 #ifdef I_STDLIB
5551 #include <stdlib.h>
5552 #endif
5553 int main()
5554 {
5555         printf("intsize=%d;\n", (int)sizeof(int));
5556         printf("longsize=%d;\n", (int)sizeof(long));
5557         printf("shortsize=%d;\n", (int)sizeof(short));
5558         exit(0);
5559 }
5560 EOCP
5561         set try
5562         if eval $compile_ok && $run ./try > /dev/null; then
5563                 eval `$run ./try`
5564                 echo "Your integers are $intsize bytes long."
5565                 echo "Your long integers are $longsize bytes long."
5566                 echo "Your short integers are $shortsize bytes long."
5567         else
5568                 $cat >&4 <<EOM
5569 !
5570 Help! I can't compile and run the intsize test program: please enlighten me!
5571 (This is probably a misconfiguration in your system or libraries, and
5572 you really ought to fix it.  Still, I'll try anyway.)
5573 !
5574 EOM
5575                 dflt=4
5576                 rp="What is the size of an integer (in bytes)?"
5577                 . ./myread
5578                 intsize="$ans"
5579                 dflt=$intsize
5580                 rp="What is the size of a long integer (in bytes)?"
5581                 . ./myread
5582                 longsize="$ans"
5583                 dflt=2
5584                 rp="What is the size of a short integer (in bytes)?"
5585                 . ./myread
5586                 shortsize="$ans"
5587         fi
5588         ;;
5589 esac
5590 $rm_try
5591
5592 : check for long long
5593 echo " "
5594 echo "Checking to see if you have long long..." >&4
5595 echo 'int main() { long long x = 7; return 0; }' > try.c
5596 set try
5597 if eval $compile; then
5598         val="$define"
5599         echo "You have long long."
5600 else
5601         val="$undef"
5602         echo "You do not have long long."
5603 fi
5604 $rm_try
5605 set d_longlong
5606 eval $setvar
5607
5608 : check for length of long long
5609 case "${d_longlong}${longlongsize}" in
5610 $define)
5611         echo " "
5612         echo "Checking to see how big your long longs are..." >&4
5613         $cat >try.c <<'EOCP'
5614 #include <stdio.h>
5615 int main()
5616 {
5617     printf("%d\n", (int)sizeof(long long));
5618     return(0);
5619 }
5620 EOCP
5621         set try
5622         if eval $compile_ok; then
5623                 longlongsize=`$run ./try`
5624                 echo "Your long longs are $longlongsize bytes long."
5625         else
5626                 dflt='8'
5627                 echo " "
5628                 echo "(I can't seem to compile the test program.  Guessing...)"
5629                 rp="What is the size of a long long (in bytes)?"
5630                 . ./myread
5631                 longlongsize="$ans"
5632         fi
5633         if $test "X$longsize" = "X$longlongsize"; then
5634                 echo "(That isn't any different from an ordinary long.)"
5635         fi
5636         ;;
5637 esac
5638 $rm_try
5639
5640 : see if inttypes.h is available
5641 : we want a real compile instead of Inhdr because some systems
5642 : have an inttypes.h which includes non-existent headers
5643 echo " "
5644 $cat >try.c <<EOCP
5645 #include <inttypes.h>
5646 int main() {
5647         static int32_t foo32 = 0x12345678;
5648 }
5649 EOCP
5650 set try
5651 if eval $compile; then
5652         echo "<inttypes.h> found." >&4
5653         val="$define"
5654 else
5655         echo "<inttypes.h> NOT found." >&4
5656         val="$undef"
5657 fi
5658 $rm_try
5659 set i_inttypes
5660 eval $setvar
5661
5662 : check for int64_t
5663 echo " "
5664 echo "Checking to see if you have int64_t..." >&4
5665 $cat >try.c <<EOCP
5666 #include <sys/types.h>
5667 #$i_inttypes I_INTTYPES
5668 #ifdef I_INTTYPES
5669 #include <inttypes.h>
5670 #endif
5671 int main() { int64_t x = 7; }
5672 EOCP
5673 set try
5674 if eval $compile; then
5675         val="$define"
5676         echo "You have int64_t."
5677 else
5678         val="$undef"
5679         echo "You do not have int64_t."
5680 fi
5681 $rm_try
5682 set d_int64_t
5683 eval $setvar
5684
5685 : Check if 64bit ints have a quad type
5686 echo " "
5687 echo "Checking which 64-bit integer type we could use..." >&4
5688
5689 case "$intsize" in
5690 8) val=int
5691    set quadtype
5692    eval $setvar
5693    val='"unsigned int"'
5694    set uquadtype
5695    eval $setvar
5696    quadkind=1
5697    ;;
5698 *) case "$longsize" in
5699    8) val=long
5700       set quadtype
5701       eval $setvar
5702       val='"unsigned long"'
5703       set uquadtype
5704       eval $setvar
5705       quadkind=2
5706       ;;
5707    *) case "$d_longlong:$longlongsize" in
5708       define:8)
5709         val='"long long"'
5710         set quadtype
5711         eval $setvar
5712         val='"unsigned long long"'
5713         set uquadtype
5714         eval $setvar
5715         quadkind=3
5716         ;;
5717       *) case "$d_int64_t" in
5718          define)
5719            val=int64_t
5720            set quadtype
5721            eval $setvar
5722            val=uint64_t
5723            set uquadtype
5724            eval $setvar
5725            quadkind=4
5726            ;;
5727          esac
5728          ;;
5729       esac
5730       ;;
5731    esac
5732    ;;
5733 esac
5734
5735 case "$quadtype" in
5736 '')     echo "Alas, no 64-bit integer types in sight." >&4
5737         d_quad="$undef"
5738         ;;
5739 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5740         d_quad="$define"
5741         ;;
5742 esac
5743
5744 : Do we want 64bit support
5745 case "$uselonglong" in
5746 "$define"|true|[yY]*)
5747         cat <<EOM >&4
5748
5749 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5750 EOM
5751         use64bitint="$define"
5752         ;;
5753 esac
5754 case "$use64bits" in
5755 "$define"|true|[yY]*)
5756         cat <<EOM >&4
5757
5758 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5759 EOM
5760         use64bitint="$define"
5761         ;;
5762 esac
5763 case "$use64bitints" in
5764 "$define"|true|[yY]*)
5765         cat <<EOM >&4
5766
5767 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5768 EOM
5769         use64bitint="$define"
5770         ;;
5771 esac
5772 case "$use64bitsint" in
5773 "$define"|true|[yY]*)
5774         cat <<EOM >&4
5775
5776 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5777 EOM
5778         use64bitint="$define"
5779         ;;
5780 esac
5781 case "$uselonglongs" in
5782 "$define"|true|[yY]*)
5783         cat <<EOM >&4
5784
5785 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5786 EOM
5787         use64bitint="$define"
5788         ;;
5789 esac
5790 case "$use64bitsall" in
5791 "$define"|true|[yY]*)
5792         cat <<EOM >&4
5793
5794 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5795 EOM
5796         use64bitall="$define"
5797         ;;
5798 esac
5799
5800 case "$ccflags" in
5801 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5802 esac
5803 case "$use64bitall" in
5804 "$define"|true|[yY]*) use64bitint="$define" ;;
5805 esac
5806
5807 case "$longsize" in
5808 8) cat <<EOM
5809
5810 You have natively 64-bit long integers.
5811 EOM
5812    val="$define"
5813    ;;
5814 *) case "$use64bitint" in
5815    "$define"|true|[yY]*) dflt='y';;
5816    *) dflt='n';;
5817    esac
5818    case "$d_quad" in
5819    "$define") ;;
5820    *) dflt='n' ;;
5821    esac
5822    cat <<EOM
5823
5824 Perl can be built to take advantage of 64-bit integer types
5825 on some systems.  To do so, Configure can be run with -Duse64bitint.
5826 Choosing this option will most probably introduce binary incompatibilities.
5827
5828 If this doesn't make any sense to you, just accept the default '$dflt'.
5829 (The default has been chosen based on your configuration.)
5830 EOM
5831    rp='Try to use 64-bit integers, if available?'
5832    . ./myread
5833    case "$ans" in
5834    [yY]*) val="$define" ;;
5835    *)     val="$undef"  ;;
5836    esac
5837    ;;
5838 esac
5839 set use64bitint
5840 eval $setvar
5841
5842 case "$use64bitall" in
5843 "$define"|true|[yY]*) dflt='y' ;;
5844 *) case "$longsize" in
5845    8) dflt='y' ;;
5846    *) dflt='n' ;;
5847    esac
5848    ;;
5849 esac
5850 cat <<EOM
5851
5852 You may also choose to try maximal 64-bitness.  It means using as much
5853 64-bitness as possible on the platform.  This in turn means even more
5854 binary incompatibilities.  On the other hand, your platform may not
5855 have any more 64-bitness available than what you already have chosen.
5856
5857 If this doesn't make any sense to you, just accept the default '$dflt'.
5858 (The default has been chosen based on your configuration.)
5859 EOM
5860 rp='Try to use maximal 64-bit support, if available?'
5861 . ./myread
5862 case "$ans" in
5863 [yY]*) val="$define" ;;
5864 *)     val="$undef"  ;;
5865 esac
5866 set use64bitall
5867 eval $setvar
5868 case "$use64bitall" in
5869 "$define")
5870         case "$use64bitint" in
5871         "$undef")
5872                 cat <<EOM
5873
5874 Since you have chosen a maximally 64-bit build, I'm also turning on
5875 the use of 64-bit integers.
5876 EOM
5877                 use64bitint="$define" ;;
5878         esac
5879         ;;
5880 esac
5881
5882 : Look for a hint-file generated 'call-back-unit'.  If the
5883 : user has specified that a 64-bit perl is to be built,
5884 : we may need to set or change some other defaults.
5885 if $test -f use64bitint.cbu; then
5886         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5887         . ./use64bitint.cbu
5888 fi
5889 case "$use64bitint" in
5890 "$define"|true|[yY]*)
5891         case "$longsize" in
5892         4) case "$archname64" in
5893            '') archname64=64int ;;
5894            esac
5895            ;;
5896         esac
5897         ;;
5898 esac
5899
5900 : Look for a hint-file generated 'call-back-unit'.  If the
5901 : user has specified that a maximally 64-bit perl is to be built,
5902 : we may need to set or change some other defaults.
5903 if $test -f use64bitall.cbu; then
5904         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5905         . ./use64bitall.cbu
5906 fi
5907 case "$use64bitall" in
5908 "$define"|true|[yY]*)
5909         case "$longsize" in
5910         4) case "$archname64" in
5911            ''|64int) archname64=64all ;;
5912            esac
5913            ;;
5914         esac
5915         ;;
5916 esac
5917
5918 case "$d_quad:$use64bitint" in
5919 $undef:$define)
5920         cat >&4 <<EOF
5921
5922 *** You have chosen to use 64-bit integers,
5923 *** but none can be found.
5924 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5925 *** Cannot continue, aborting.
5926
5927 EOF
5928         exit 1
5929         ;;
5930 esac
5931
5932 : check for length of double
5933 echo " "
5934 case "$doublesize" in
5935 '')
5936         echo "Checking to see how big your double precision numbers are..." >&4
5937         $cat >try.c <<EOCP
5938 #include <stdio.h>
5939 #$i_stdlib I_STDLIB
5940 #ifdef I_STDLIB
5941 #include <stdlib.h>
5942 #endif
5943 int main()
5944 {
5945     printf("%d\n", (int)sizeof(double));
5946     exit(0);
5947 }
5948 EOCP
5949         set try
5950         if eval $compile_ok; then
5951                 doublesize=`$run ./try`
5952                 echo "Your double is $doublesize bytes long."
5953         else
5954                 dflt='8'
5955                 echo "(I can't seem to compile the test program.  Guessing...)"
5956                 rp="What is the size of a double precision number (in bytes)?"
5957                 . ./myread
5958                 doublesize="$ans"
5959         fi
5960         ;;
5961 esac
5962 $rm_try
5963
5964 : check for long doubles
5965 echo " "
5966 echo "Checking to see if you have long double..." >&4
5967 echo 'int main() { long double x = 7.0; }' > try.c
5968 set try
5969 if eval $compile; then
5970         val="$define"
5971         echo "You have long double."
5972 else
5973         val="$undef"
5974         echo "You do not have long double."
5975 fi
5976 $rm_try
5977 set d_longdbl
5978 eval $setvar
5979
5980 : check for length of long double
5981 case "${d_longdbl}${longdblsize}" in
5982 $define)
5983         echo " "
5984         echo "Checking to see how big your long doubles are..." >&4
5985         $cat >try.c <<'EOCP'
5986 #include <stdio.h>
5987 int main()
5988 {
5989         printf("%d\n", sizeof(long double));
5990 }
5991 EOCP
5992         set try
5993         set try
5994         if eval $compile; then
5995                 longdblsize=`$run ./try`
5996                 echo "Your long doubles are $longdblsize bytes long."
5997         else
5998                 dflt='8'
5999                 echo " "
6000                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6001                 rp="What is the size of a long double (in bytes)?"
6002                 . ./myread
6003                 longdblsize="$ans"
6004         fi
6005         if $test "X$doublesize" = "X$longdblsize"; then
6006                 echo "That isn't any different from an ordinary double."
6007                 echo "I'll keep your setting anyway, but you may see some"
6008                 echo "harmless compilation warnings."
6009         fi
6010         ;;
6011 esac
6012 $rm_try
6013
6014 : determine the architecture name
6015 echo " "
6016 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6017         tarch=`arch`"-$osname"
6018 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6019         if uname -m > tmparch 2>&1 ; then
6020                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6021                         -e 's/$/'"-$osname/" tmparch`
6022         else
6023                 tarch="$osname"
6024         fi
6025         $rm -f tmparch
6026 else
6027         tarch="$osname"
6028 fi
6029 case "$myarchname" in
6030 ''|"$tarch") ;;
6031 *)
6032         echo "(Your architecture name used to be $myarchname.)"
6033         archname=''
6034         ;;
6035 esac
6036 case "$targetarch" in
6037 '') ;;
6038 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6039 esac
6040 myarchname="$tarch"
6041 case "$archname" in
6042 '') dflt="$tarch";;
6043 *) dflt="$archname";;
6044 esac
6045 rp='What is your architecture name'
6046 . ./myread
6047 archname="$ans"
6048 case "$usethreads" in
6049 $define)
6050         echo "Threads selected." >&4
6051         case "$archname" in
6052         *-thread*) echo "...and architecture name already has -thread." >&4
6053                 ;;
6054         *)      archname="$archname-thread"
6055                 echo "...setting architecture name to $archname." >&4
6056                 ;;
6057         esac
6058         ;;
6059 esac
6060 case "$usemultiplicity" in
6061 $define)
6062         echo "Multiplicity selected." >&4
6063         case "$archname" in
6064         *-multi*) echo "...and architecture name already has -multi." >&4
6065                 ;;
6066         *)      archname="$archname-multi"
6067                 echo "...setting architecture name to $archname." >&4
6068                 ;;
6069         esac
6070         ;;
6071 esac
6072 case "$use64bitint$use64bitall" in
6073 *"$define"*)
6074         case "$archname64" in
6075         '')
6076                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6077                 ;;
6078         *)
6079                 case "$use64bitint" in
6080                 "$define") echo "64 bit integers selected." >&4 ;;
6081                 esac
6082                 case "$use64bitall" in
6083                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6084                 esac
6085                 case "$archname" in
6086                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6087                         ;;
6088                 *)      archname="$archname-$archname64"
6089                         echo "...setting architecture name to $archname." >&4
6090                         ;;
6091                 esac
6092                 ;;
6093         esac
6094 esac
6095 case "$uselongdouble" in
6096 $define)
6097         echo "Long doubles selected." >&4
6098         case "$longdblsize" in
6099         $doublesize)
6100                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6101                 ;;
6102         *)
6103                 case "$archname" in
6104                 *-ld*) echo "...and architecture name already has -ld." >&4
6105                         ;;
6106                 *)      archname="$archname-ld"
6107                         echo "...setting architecture name to $archname." >&4
6108                         ;;
6109                 esac
6110                 ;;
6111         esac
6112         ;;
6113 esac
6114 case "$useperlio" in
6115 $define)
6116         echo "Perlio selected." >&4
6117         ;;
6118 *)
6119         echo "Perlio not selected, using stdio." >&4
6120         case "$archname" in
6121         *-stdio*) echo "...and architecture name already has -stdio." >&4
6122                 ;;
6123         *)      archname="$archname-stdio"
6124                 echo "...setting architecture name to $archname." >&4
6125                 ;;
6126         esac
6127         ;;
6128 esac
6129 if $test -f archname.cbu; then
6130         echo "Your platform has some specific hints for architecture name, using them..."
6131         . ./archname.cbu
6132 fi
6133
6134 : set the prefixit variable, to compute a suitable default value
6135 prefixit='case "$3" in
6136 ""|none)
6137         case "$oldprefix" in
6138         "") eval "$1=\"\$$2\"";;
6139         *)
6140                 case "$3" in
6141                 "") eval "$1=";;
6142                 none)
6143                         eval "tp=\"\$$2\"";
6144                         case "$tp" in
6145                         ""|" ") eval "$1=\"\$$2\"";;
6146                         *) eval "$1=";;
6147                         esac;;
6148                 esac;;
6149         esac;;
6150 *)
6151         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6152         case "$tp" in
6153         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6154         /*-$oldprefix/*|\~*-$oldprefix/*)
6155                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6156         *) eval "$1=\"\$$2\"";;
6157         esac;;
6158 esac'
6159
6160 : determine installation style
6161 : For now, try to deduce it from prefix unless it is already set.
6162 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6163 case "$installstyle" in
6164 '')     case "$prefix" in
6165                 *perl*) dflt='lib';;
6166                 *) dflt='lib/perl5' ;;
6167         esac
6168         ;;
6169 *)      dflt="$installstyle" ;;
6170 esac
6171 : Probably not worth prompting for this since we prompt for all
6172 : the directories individually, and the prompt would be too long and
6173 : confusing anyway.
6174 installstyle=$dflt
6175
6176 : determine where public executables go
6177 echo " "
6178 set dflt bin bin
6179 eval $prefixit
6180 fn=d~
6181 rp='Pathname where the public executables will reside?'
6182 . ./getfile
6183 if $test "X$ansexp" != "X$binexp"; then
6184         installbin=''
6185 fi
6186 prefixvar=bin
6187 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6188 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6189 :     this via initialinstalllocation
6190 . ./setprefixvar
6191
6192 case "$userelocatableinc" in
6193 $define|true|[yY]*)     dflt='y' ;;
6194 *)                      dflt='n' ;;
6195 esac
6196 cat <<EOM
6197
6198 Would you like to build Perl so that the installation is relocatable, so that
6199 library paths in @INC are determined relative to the path of the perl binary?
6200 This is not advised for system Perl installs, or if you need to run setid
6201 scripts or scripts under taint mode.
6202
6203 If this doesn't make any sense to you, just accept the default '$dflt'.
6204 EOM
6205 rp='Use relocatable @INC?'
6206 . ./myread
6207 case "$ans" in
6208 y|Y)    val="$define" ;;
6209 *)      val="$undef"  ;;
6210 esac
6211 set userelocatableinc
6212 eval $setvar
6213
6214 initialinstalllocation="$binexp"
6215 : Default prefix is now "up one level from where the binaries are"
6216 case "$userelocatableinc" in
6217 $define|true|[yY]*)
6218     bin=".../"
6219     binexp=".../"
6220     prefix=".../.."
6221     prefixexp=".../.."
6222     installprefixexp=".../.."
6223     ;;
6224 esac
6225
6226 : determine where private library files go
6227 : Usual default is /usr/local/lib/perl5/$version.
6228 : Also allow things like /opt/perl/lib/$version, since
6229 : /opt/perl/lib/perl5... would be redundant.
6230 : The default "style" setting is made in installstyle.U
6231 case "$installstyle" in
6232 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6233 *)       set dflt privlib lib/$version ;;
6234 esac
6235 eval $prefixit
6236 $cat <<EOM
6237
6238 There are some auxiliary files for $package that need to be put into a
6239 private library directory that is accessible by everyone.
6240
6241 EOM
6242 fn=$binexp
6243 fn=d~+
6244 rp='Pathname where the private library files will reside?'
6245 . ./getfile
6246 prefixvar=privlib
6247 . ./setprefixvar
6248
6249 : set the prefixup variable, to restore leading tilda escape
6250 prefixup='case "$prefixexp" in
6251 "$prefix") ;;
6252 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6253 esac'
6254
6255 : determine where public architecture dependent libraries go
6256 set archlib archlib
6257 eval $prefixit
6258 : privlib default is /usr/local/lib/$package/$version
6259 : archlib default is /usr/local/lib/$package/$version/$archname
6260 : privlib may have an optional trailing /share.
6261 tdflt=`echo $privlib | $sed 's,/share$,,'`
6262 tdflt=$tdflt/$archname
6263 case "$archlib" in
6264 '')     dflt=$tdflt
6265         ;;
6266 *)      dflt="$archlib"
6267     ;;
6268 esac
6269 $cat <<EOM
6270
6271 $spackage contains architecture-dependent library files.  If you are
6272 sharing libraries in a heterogeneous environment, you might store
6273 these files in a separate location.  Otherwise, you can just include
6274 them with the rest of the public library files.
6275
6276 EOM
6277 fn=$binexp
6278 fn=d+~
6279 rp='Where do you want to put the public architecture-dependent libraries?'
6280 . ./getfile
6281 prefixvar=archlib
6282 . ./setprefixvar
6283 if $test X"$archlib" = X"$privlib"; then
6284         d_archlib="$undef"
6285 else
6286         d_archlib="$define"
6287 fi
6288
6289 : see if setuid scripts can be secure
6290 $cat <<EOM
6291
6292 Some kernels have a bug that prevents setuid #! scripts from being
6293 secure.  Some sites have disabled setuid #! scripts because of this.
6294
6295 First let's decide if your kernel supports secure setuid #! scripts.
6296 (If setuid #! scripts would be secure but have been disabled anyway,
6297 don't say that they are secure if asked.)
6298
6299 EOM
6300
6301 val="$undef"
6302 if $test -d /dev/fd; then
6303         echo "#!$ls" >reflect
6304         chmod +x,u+s reflect
6305         ./reflect >flect 2>&1
6306         if $contains "/dev/fd" flect >/dev/null; then
6307                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6308                 val="$define"
6309         else
6310                 $cat <<EOM
6311 If you are not sure if they are secure, I can check but I'll need a
6312 username and password different from the one you are using right now.
6313 If you don't have such a username or don't want me to test, simply
6314 enter 'none'.
6315
6316 EOM
6317                 rp='Other username to test security of setuid scripts with?'
6318                 dflt='none'
6319                 . ./myread
6320                 case "$ans" in
6321                 n|none)
6322                         case "$d_suidsafe" in
6323                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6324                                 dflt=n;;
6325                         "$undef")
6326                                 echo "Well, the $hint value is *not* secure." >&4
6327                                 dflt=n;;
6328                         *)      echo "Well, the $hint value *is* secure." >&4
6329                                 dflt=y;;
6330                         esac
6331                         ;;
6332                 *)
6333                         $rm -f reflect flect
6334                         echo "#!$ls" >reflect
6335                         chmod +x,u+s reflect
6336                         echo >flect
6337                         chmod a+w flect
6338                         echo '"su" will (probably) prompt you for '"$ans's password."
6339                         su $ans -c './reflect >flect'
6340                         if $contains "/dev/fd" flect >/dev/null; then
6341                                 echo "Okay, it looks like setuid scripts are secure." >&4
6342                                 dflt=y
6343                         else
6344                                 echo "I don't think setuid scripts are secure." >&4
6345                                 dflt=n
6346                         fi
6347                         ;;
6348                 esac
6349                 rp='Does your kernel have *secure* setuid scripts?'
6350                 . ./myread
6351                 case "$ans" in
6352                 [yY]*)  val="$define";;
6353                 *)      val="$undef";;
6354                 esac
6355         fi
6356 else
6357         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6358         echo "(That's for file descriptors, not floppy disks.)"
6359         val="$undef"
6360 fi
6361 set d_suidsafe
6362 eval $setvar
6363
6364 $rm -f reflect flect
6365
6366 : now see if they want to do setuid emulation
6367 echo " "
6368 val="$undef"
6369 case "$d_suidsafe" in
6370 "$define")
6371         val="$undef"
6372         echo "No need to emulate SUID scripts since they are secure here." >&4
6373         ;;
6374 *)
6375         $cat <<EOM
6376 Some systems have disabled setuid scripts, especially systems where
6377 setuid scripts cannot be secure.  On systems where setuid scripts have
6378 been disabled, the setuid/setgid bits on scripts are currently
6379 useless.  It is possible for $package to detect those bits and emulate
6380 setuid/setgid in a secure fashion.  This emulation will only work if
6381 setuid scripts have been disabled in your kernel.
6382
6383 EOM
6384         case "$d_dosuid" in
6385         "$define") dflt=y ;;
6386         *) dflt=n ;;
6387         esac
6388         rp="Do you want to do setuid/setgid emulation?"
6389         . ./myread
6390         case "$ans" in
6391         [yY]*)  val="$define";;
6392         *)      val="$undef";;
6393         esac
6394         ;;
6395 esac
6396 set d_dosuid
6397 eval $setvar
6398
6399 : Find perl5.005 or later.
6400 echo "Looking for a previously installed perl5.005 or later... "
6401 case "$perl5" in
6402 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6403                 : Check if this perl is recent and can load a simple module
6404                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6405                         perl5=$tdir/perl
6406                         break;
6407                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6408                         perl5=$tdir/perl5
6409                         break;
6410                 fi
6411         done
6412         ;;
6413 *)      perl5="$perl5"
6414         ;;
6415 esac
6416 case "$perl5" in
6417 '')     echo "None found.  That's ok.";;
6418 *)      echo "Using $perl5." ;;
6419 esac
6420
6421 : Set the siteprefix variables
6422 $cat <<EOM
6423
6424 After $package is installed, you may wish to install various
6425 add-on modules and utilities.  Typically, these add-ons will
6426 be installed under $prefix with the rest
6427 of this package.  However, you may wish to install such add-ons
6428 elsewhere under a different prefix.
6429
6430 If you do not wish to put everything under a single prefix, that's
6431 ok.  You will be prompted for the individual locations; this siteprefix
6432 is only used to suggest the defaults.
6433
6434 The default should be fine for most people.
6435
6436 EOM
6437 fn=d~+
6438 rp='Installation prefix to use for add-on modules and utilities?'
6439 : XXX Here might be another good place for an installstyle setting.
6440 case "$siteprefix" in
6441 '') dflt=$prefix ;;
6442 *)  dflt=$siteprefix ;;
6443 esac
6444 . ./getfile
6445 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6446 oldsiteprefix=''
6447 case "$siteprefix" in
6448 '') ;;
6449 *)      case "$ans" in
6450         "$prefix") ;;
6451         *) oldsiteprefix="$prefix";;
6452         esac
6453         ;;
6454 esac
6455 siteprefix="$ans"
6456 siteprefixexp="$ansexp"
6457
6458 : determine where site specific libraries go.
6459 : Usual default is /usr/local/lib/perl5/site_perl/$version
6460 : The default "style" setting is made in installstyle.U
6461 : XXX No longer works with Prefixit stuff.
6462 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6463 case "$sitelib" in
6464 '') case "$installstyle" in
6465         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6466         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6467         esac
6468         ;;
6469 *)      dflt="$sitelib"
6470         ;;
6471 esac
6472 $cat <<EOM
6473
6474 The installation process will create a directory for
6475 site-specific extensions and modules.  Most users find it convenient
6476 to place all site-specific files in this directory rather than in the
6477 main distribution directory.
6478
6479 EOM
6480 fn=d~+
6481 rp='Pathname for the site-specific library files?'
6482 . ./getfile
6483 prefixvar=sitelib
6484 . ./setprefixvar
6485 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6486
6487 : Determine list of previous versions to include in @INC
6488 $cat > getverlist <<EOPL
6489 #!$perl5 -w
6490 use File::Basename;
6491 \$api_versionstring = "$api_versionstring";
6492 \$version = "$version";
6493 \$stem = "$sitelib_stem";
6494 \$archname = "$archname";
6495 EOPL
6496         $cat >> getverlist <<'EOPL'
6497 # The list found is store twice for each entry: the original name, and
6498 # the binary broken down version as pack "sss", so sorting is easy and
6499 # unambiguous. This will work for all versions that have a maximum of
6500 # three digit groups, separate by '.'s or '_'s. Names are extended with
6501 # ".0.0" to ensure at least three elements for the pack.
6502 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6503
6504 # Can't have leading @ because metaconfig interprets it as a command!
6505 ;@inc_version_list=();
6506 # XXX Redo to do opendir/readdir?
6507 if (-d $stem) {
6508     chdir($stem);
6509     ;@candidates = map {
6510         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6511 }
6512 else {
6513     ;@candidates = ();
6514 }
6515
6516 ($pversion, $aversion, $vsn5005) = map {
6517     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6518 foreach $d (@candidates) {
6519     if ($d->[1] lt $pversion) {
6520         if ($d->[1] ge $aversion) {
6521             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6522         }
6523         elsif ($d->[1] ge $vsn5005) {
6524             unshift(@inc_version_list, grep { -d } $d->[0]);
6525         }
6526     }
6527     else {
6528         # Skip newer version.  I.e. don't look in
6529         # 5.7.0 if we're installing 5.6.1.
6530     }
6531 }
6532
6533 if (@inc_version_list) {
6534     print join(' ', @inc_version_list);
6535 }
6536 else {
6537     # Blank space to preserve value for next Configure run.
6538     print " ";
6539 }
6540 EOPL
6541 chmod +x getverlist
6542 case "$inc_version_list" in
6543 '')     if test -x "$perl5$exe_ext"; then
6544                 dflt=`$perl5 getverlist`
6545         else
6546                 dflt='none'
6547         fi
6548         ;;
6549 $undef) dflt='none' ;;
6550 *)  eval dflt=\"$inc_version_list\" ;;
6551 esac
6552 case "$dflt" in
6553 ''|' ') dflt=none ;;
6554 esac
6555 case "$dflt" in
6556 5.005) dflt=none ;;
6557 esac
6558 $cat <<EOM
6559
6560 In order to ease the process of upgrading, this version of perl
6561 can be configured to use modules built and installed with earlier
6562 versions of perl that were installed under $prefix.  Specify here
6563 the list of earlier versions that this version of perl should check.
6564 If Configure detected no earlier versions of perl installed under
6565 $prefix, then the list will be empty.  Answer 'none' to tell perl
6566 to not search earlier versions.
6567
6568 The default should almost always be sensible, so if you're not sure,
6569 just accept the default.
6570 EOM
6571
6572 rp='List of earlier versions to include in @INC?'
6573 . ./myread
6574 case "$ans" in
6575 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6576 *) inc_version_list="$ans" ;;
6577 esac
6578 case "$inc_version_list" in
6579 ''|' ')
6580         inc_version_list_init='0'
6581         d_inc_version_list="$undef"
6582         ;;
6583 *)      inc_version_list_init=`echo $inc_version_list |
6584                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6585         d_inc_version_list="$define"
6586         ;;
6587 esac
6588 $rm -f getverlist
6589
6590 : see if malloc/malloc.h has to be included
6591 set malloc/malloc.h i_mallocmalloc
6592 eval $inhdr
6593
6594 : see if this is a malloc.h system
6595 : we want a real compile instead of Inhdr because some systems have a
6596 : malloc.h that just gives a compile error saying to use stdlib.h instead
6597 echo " "
6598 $cat >try.c <<EOCP
6599 #include <stdlib.h>
6600 #include <malloc.h>
6601 #$i_mallocmalloc I_MALLOCMALLOC
6602 #ifdef I_MALLOCMALLOC
6603 # include <malloc/malloc.h>
6604 #endif
6605
6606 int main () { return 0; }
6607 EOCP
6608 set try
6609 if eval $compile; then
6610     echo "<malloc.h> found." >&4
6611     val="$define"
6612 else
6613     echo "<malloc.h> NOT found." >&4
6614     val="$undef"
6615 fi
6616 $rm_try
6617 set i_malloc
6618 eval $setvar
6619
6620 : check for void type
6621 echo " "
6622 echo "Checking to see how well your C compiler groks the void type..." >&4
6623 case "$voidflags" in
6624 '')
6625         $cat >try.c <<EOCP
6626 #$i_stdlib I_STDLIB
6627 #ifdef I_STDLIB
6628 #include <stdlib.h>
6629 #endif
6630 #if TRY & 1
6631 void sub() {
6632 #else
6633 sub() {
6634 #endif
6635         extern void moo();      /* function returning void */
6636         void (*goo)();          /* ptr to func returning void */
6637 #if TRY & 8
6638         void *hue;              /* generic ptr */
6639 #endif
6640 #if TRY & 2
6641         void (*foo[10])();
6642 #endif
6643
6644 #if TRY & 4
6645         if(goo == moo) {
6646                 exit(0);
6647         }
6648 #endif
6649         exit(0);
6650 }
6651 int main() { sub(); }
6652 EOCP
6653         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6654                 voidflags=$defvoidused
6655         echo "Good.  It appears to support void to the level $package wants.">&4
6656                 if $contains warning .out >/dev/null 2>&1; then
6657                         echo "However, you might get some warnings that look like this:"
6658                         $cat .out
6659                 fi
6660         else
6661 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6662                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6663                         echo "It supports 1..."
6664                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6665                                 echo "It also supports 2..."
6666                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6667                                         voidflags=7
6668                                         echo "And it supports 4 but not 8 definitely."
6669                                 else
6670                                         echo "It doesn't support 4..."
6671                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6672                                                 voidflags=11
6673                                                 echo "But it supports 8."
6674                                         else
6675                                                 voidflags=3
6676                                                 echo "Neither does it support 8."
6677                                         fi
6678                                 fi
6679                         else
6680                                 echo "It does not support 2..."
6681                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6682                                         voidflags=13
6683                                         echo "But it supports 4 and 8."
6684                                 else
6685                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6686                                                 voidflags=5
6687                                                 echo "And it supports 4 but has not heard about 8."
6688                                         else
6689                                                 echo "However it supports 8 but not 4."
6690                                         fi
6691                                 fi
6692                         fi
6693                 else
6694                         echo "There is no support at all for void."
6695                         voidflags=0
6696                 fi
6697         fi
6698 esac
6699 case "$voidflags" in
6700 "$defvoidused") ;;
6701 *)      $cat >&4 <<'EOM'
6702   Support flag bits are:
6703     1: basic void declarations.
6704     2: arrays of pointers to functions returning void.
6705     4: operations between pointers to and addresses of void functions.
6706     8: generic void pointers.
6707 EOM
6708         dflt="$voidflags";
6709         rp="Your void support flags add up to what?"
6710         . ./myread
6711         voidflags="$ans"
6712         ;;
6713 esac
6714 $rm_try
6715
6716 : check for length of pointer
6717 echo " "
6718 case "$ptrsize" in
6719 '')
6720         echo "Checking to see how big your pointers are..." >&4
6721         if test "$voidflags" -gt 7; then
6722                 echo '#define VOID_PTR char *' > try.c
6723         else
6724                 echo '#define VOID_PTR void *' > try.c
6725         fi
6726         $cat >>try.c <<EOCP
6727 #include <stdio.h>
6728 #$i_stdlib I_STDLIB
6729 #ifdef I_STDLIB
6730 #include <stdlib.h>
6731 #endif
6732 int main()
6733 {
6734     printf("%d\n", (int)sizeof(VOID_PTR));
6735     exit(0);
6736 }
6737 EOCP
6738         set try
6739         if eval $compile_ok; then
6740                 ptrsize=`$run ./try`
6741                 echo "Your pointers are $ptrsize bytes long."
6742         else
6743                 dflt='4'
6744                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6745                 rp="What is the size of a pointer (in bytes)?"
6746                 . ./myread
6747                 ptrsize="$ans"
6748         fi
6749         ;;
6750 esac
6751 $rm_try
6752 case "$use64bitall" in
6753 "$define"|true|[yY]*)
6754         case "$ptrsize" in
6755         4)      cat <<EOM >&4
6756
6757 *** You have chosen a maximally 64-bit build,
6758 *** but your pointers are only 4 bytes wide.
6759 *** Please rerun Configure without -Duse64bitall.
6760 EOM
6761                 case "$d_quad" in
6762                 define)
6763                         cat <<EOM >&4
6764 *** Since you have quads, you could possibly try with -Duse64bitint.
6765 EOM
6766                         ;;
6767                 esac
6768                 cat <<EOM >&4
6769 *** Cannot continue, aborting.
6770
6771 EOM
6772
6773                 exit 1
6774                 ;;
6775         esac
6776         ;;
6777 esac
6778
6779
6780 : determine whether to use malloc wrapping
6781 echo " "
6782 case "$usemallocwrap" in
6783 [yY]*|true|$define)     dflt='y' ;;
6784 [nN]*|false|$undef)     dflt='n' ;;
6785 *)      case "$usedevel" in
6786         [yY]*|true|$define)     dflt='y' ;;
6787         *) dflt='n' ;;
6788         esac
6789         ;;
6790 esac
6791 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6792 . ./myread
6793 usemallocwrap="$ans"
6794 case "$ans" in
6795 y*|true)
6796         usemallocwrap="$define" ;;
6797 *)
6798         usemallocwrap="$undef" ;;
6799 esac
6800
6801 : determine which malloc to compile in
6802 echo " "
6803 case "$usemymalloc" in
6804 [yY]*|true|$define)     dflt='y' ;;
6805 [nN]*|false|$undef)     dflt='n' ;;
6806 *)      case "$ptrsize" in
6807         4) dflt='y' ;;
6808         *) dflt='n' ;;
6809         esac
6810         ;;
6811 esac
6812 rp="Do you wish to attempt to use the malloc that comes with $package?"
6813 . ./myread
6814 usemymalloc="$ans"
6815 case "$ans" in
6816 y*|true)
6817         usemymalloc='y'
6818         mallocsrc='malloc.c'
6819         mallocobj="malloc$_o"
6820         d_mymalloc="$define"
6821         case "$libs" in
6822         *-lmalloc*)
6823                 : Remove malloc from list of libraries to use
6824                 echo "Removing unneeded -lmalloc from library list" >&4
6825                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6826                 shift
6827                 libs="$*"
6828                 echo "libs = $libs" >&4
6829                 ;;
6830         esac
6831         ;;
6832 *)
6833         usemymalloc='n'
6834         mallocsrc=''
6835         mallocobj=''
6836         d_mymalloc="$undef"
6837         ;;
6838 esac
6839
6840 : compute the return types of malloc and free
6841 echo " "
6842 $cat >malloc.c <<END
6843 #$i_malloc I_MALLOC
6844 #$i_stdlib I_STDLIB
6845 #include <stdio.h>
6846 #include <sys/types.h>
6847 #ifdef I_MALLOC
6848 #include <malloc.h>
6849 #endif
6850 #ifdef I_STDLIB
6851 #include <stdlib.h>
6852 #endif
6853 #ifdef TRY_MALLOC
6854 void *malloc();
6855 #endif
6856 #ifdef TRY_FREE
6857 void free();
6858 #endif
6859 END
6860 case "$malloctype" in
6861 '')
6862         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6863                 malloctype='void *'
6864         else
6865                 malloctype='char *'
6866         fi
6867         ;;
6868 esac
6869 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6870
6871 case "$freetype" in
6872 '')
6873         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6874                 freetype='void'
6875         else
6876                 freetype='int'
6877         fi
6878         ;;
6879 esac
6880 echo "Your system uses $freetype free(), it would seem." >&4
6881 $rm -f malloc.[co]
6882 : determine where site specific architecture-dependent libraries go.
6883 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6884 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6885 : sitelib may have an optional trailing /share.
6886 case "$sitearch" in
6887 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6888         dflt="$dflt/$archname"
6889         ;;
6890 *)      dflt="$sitearch"
6891         ;;
6892 esac
6893 set sitearch sitearch none
6894 eval $prefixit
6895 $cat <<EOM
6896
6897 The installation process will also create a directory for
6898 architecture-dependent site-specific extensions and modules.
6899
6900 EOM
6901 fn=d~+
6902 rp='Pathname for the site-specific architecture-dependent library files?'
6903 . ./getfile
6904 prefixvar=sitearch
6905 . ./setprefixvar
6906 if $test X"$sitearch" = X"$sitelib"; then
6907         d_sitearch="$undef"
6908 else
6909         d_sitearch="$define"
6910 fi
6911
6912 : Set the vendorprefix variables
6913 $cat <<EOM
6914
6915 The installation process will also create a directory for
6916 vendor-supplied add-ons.  Vendors who supply perl with their system
6917 may find it convenient to place all vendor-supplied files in this
6918 directory rather than in the main distribution directory.  This will
6919 ease upgrades between binary-compatible maintenance versions of perl.
6920
6921 Of course you may also use these directories in whatever way you see
6922 fit.  For example, you might use them to access modules shared over a
6923 company-wide network.
6924
6925 The default answer should be fine for most people.
6926 This causes further questions about vendor add-ons to be skipped
6927 and no vendor-specific directories will be configured for perl.
6928
6929 EOM
6930 rp='Do you want to configure vendor-specific add-on directories?'
6931 case "$usevendorprefix" in
6932 define|true|[yY]*) dflt=y ;;
6933 *)      : User may have set vendorprefix directly on Configure command line.
6934         case "$vendorprefix" in
6935         ''|' ') dflt=n ;;
6936         *)      dflt=y ;;
6937         esac
6938         ;;
6939 esac
6940 . ./myread
6941 case "$ans" in
6942 [yY]*)  fn=d~+
6943         rp='Installation prefix to use for vendor-supplied add-ons?'
6944         case "$vendorprefix" in
6945         '') dflt='' ;;
6946         *)  dflt=$vendorprefix ;;
6947         esac
6948         . ./getfile
6949         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6950         oldvendorprefix=''
6951         case "$vendorprefix" in
6952         '') ;;
6953         *)      case "$ans" in
6954                 "$prefix") ;;
6955                 *) oldvendorprefix="$prefix";;
6956                 esac
6957                 ;;
6958         esac
6959         usevendorprefix="$define"
6960         vendorprefix="$ans"
6961         vendorprefixexp="$ansexp"
6962         ;;
6963 *)      usevendorprefix="$undef"
6964         vendorprefix=''
6965         vendorprefixexp=''
6966         ;;
6967 esac
6968
6969 : Set the vendorlib variables
6970 case "$vendorprefix" in
6971 '')     d_vendorlib="$undef"
6972         vendorlib=''
6973         vendorlibexp=''
6974         ;;
6975 *)      d_vendorlib="$define"
6976         : determine where vendor-supplied modules go.
6977         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6978         case "$vendorlib" in
6979         '')
6980                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6981                 case "$installstyle" in
6982                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6983                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6984                 esac
6985                 ;;
6986         *)      dflt="$vendorlib"
6987                 ;;
6988         esac
6989         fn=d~+
6990         rp='Pathname for the vendor-supplied library files?'
6991         . ./getfile
6992         vendorlib="$ans"
6993         vendorlibexp="$ansexp"
6994         ;;
6995 esac
6996 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6997 prefixvar=vendorlib
6998 . ./installprefix
6999
7000 : Set the vendorarch variables
7001 case "$vendorprefix" in
7002 '')     d_vendorarch="$undef"
7003         vendorarch=''
7004         vendorarchexp=''
7005         ;;
7006 *)      d_vendorarch="$define"
7007         : determine where vendor-supplied architecture-dependent libraries go.
7008         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7009         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7010         : vendorlib may have an optional trailing /share.
7011         case "$vendorarch" in
7012         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7013                 dflt="$dflt/$archname"
7014                 ;;
7015         *)      dflt="$vendorarch" ;;
7016         esac
7017         fn=d~+
7018         rp='Pathname for vendor-supplied architecture-dependent files?'
7019         . ./getfile
7020         vendorarch="$ans"
7021         vendorarchexp="$ansexp"
7022         ;;
7023 esac
7024 prefixvar=vendorarch
7025 . ./installprefix
7026 if $test X"$vendorarch" = X"$vendorlib"; then
7027         d_vendorarch="$undef"
7028 else
7029         d_vendorarch="$define"
7030 fi
7031
7032 : Final catch-all directories to search
7033 $cat <<EOM
7034
7035 Lastly, you can have perl look in other directories for extensions and
7036 modules in addition to those already specified.
7037 These directories will be searched after 
7038         $sitearch 
7039         $sitelib 
7040 EOM
7041 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7042 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7043 echo ' '
7044 case "$otherlibdirs" in
7045 ''|' ') dflt='none' ;;
7046 *)      dflt="$otherlibdirs" ;;
7047 esac
7048 $cat <<EOM
7049 Enter a colon-separated set of extra paths to include in perl's @INC
7050 search path, or enter 'none' for no extra paths.
7051
7052 EOM
7053
7054 rp='Colon-separated list of additional directories for perl to search?'
7055 . ./myread
7056 case "$ans" in
7057 ' '|''|none)    otherlibdirs=' ' ;;     
7058 *)      otherlibdirs="$ans" ;;
7059 esac
7060 case "$otherlibdirs" in
7061 ' ') val=$undef ;;
7062 *)      val=$define ;;
7063 esac
7064 set d_perl_otherlibdirs
7065 eval $setvar
7066
7067 : Cruising for prototypes
7068 echo " "
7069 echo "Checking out function prototypes..." >&4
7070 $cat >prototype.c <<EOCP
7071 #$i_stdlib I_STDLIB
7072 #ifdef I_STDLIB
7073 #include <stdlib.h>
7074 #endif
7075 int main(int argc, char *argv[]) {
7076         exit(0);}
7077 EOCP
7078 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7079         echo "Your C compiler appears to support function prototypes."
7080         val="$define"
7081 else
7082         echo "Your C compiler doesn't seem to understand function prototypes."
7083         val="$undef"
7084 fi
7085 set prototype
7086 eval $setvar
7087 $rm -f prototype*
7088
7089 : Check if ansi2knr is required
7090 case "$prototype" in
7091 "$define") ;;
7092 *)      ansi2knr='ansi2knr'
7093         echo " "
7094         cat <<EOM >&4
7095
7096 $me:  FATAL ERROR:
7097 This version of $package can only be compiled by a compiler that 
7098 understands function prototypes.  Unfortunately, your C compiler 
7099         $cc $ccflags
7100 doesn't seem to understand them.  Sorry about that.
7101
7102 If GNU cc is available for your system, perhaps you could try that instead.  
7103
7104 Eventually, we hope to support building Perl with pre-ANSI compilers.
7105 If you would like to help in that effort, please contact <perlbug@perl.org>.
7106
7107 Aborting Configure now.
7108 EOM
7109         exit 2
7110         ;;
7111 esac
7112
7113 : DTrace support
7114 dflt_dtrace='/usr/sbin/dtrace'
7115 cat <<EOM
7116
7117 Perl can be built to support DTrace on platforms that support it.
7118 DTrace is a diagnosis and performance analysis tool from Sun.
7119
7120 If this doesn't make any sense to you, just accept the default '$dflt'.
7121 EOM
7122
7123 while $test 1 ; do
7124         case "$usedtrace" in
7125         $define|true|[yY]*)
7126                 dflt='y'
7127                 ;;
7128         ?*)
7129                 dflt='y'
7130                 dflt_dtrace=$usedtrace
7131                 ;;
7132         *)
7133                 dflt='n'
7134                 ;;
7135         esac
7136
7137         rp='Support DTrace if available?'
7138         . ./myread
7139         case "$ans" in
7140         y|Y)    val="$define" ;;
7141         *)      val="$undef" ;;
7142         esac
7143         set usedtrace
7144         eval $setvar
7145
7146         test "X$usedtrace" != "X$define" && break
7147
7148         echo " "
7149         rp='Where is the dtrace executable?'
7150         dflt=$dflt_dtrace
7151         . ./getfile
7152         val="$ans"
7153         set dtrace
7154         eval $setvar
7155
7156         if $test -f $dtrace
7157         then
7158                 if $dtrace -h -s ../perldtrace.d \
7159                         -o perldtrace.tmp >/dev/null 2>&1 \
7160                         && rm -f perldtrace.tmp
7161                 then
7162                         echo " "
7163                         echo "Good: your $dtrace knows about the -h flag."
7164                 else
7165                         cat >&2 <<EOM
7166
7167 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7168 ***
7169 *** Your installed dtrace doesn't support the -h switch to compile a D
7170 *** program into a C header. Can't continue.
7171
7172 EOM
7173                         exit 1
7174                 fi
7175                 break;
7176         fi
7177
7178         case "$fastread" in
7179         yes)
7180                 cat >&2 <<EOM
7181
7182 *** $me:  Fatal Error:  $dtrace not found.
7183 *** Can't continue.
7184
7185 EOM
7186                 exit 1
7187                 ;;
7188         *)
7189                 echo "*** $dtrace was not found."
7190                 echo " "
7191                 ;;
7192         esac
7193 done
7194
7195 : See if we want extra modules installed
7196 echo " "
7197 case "$extras" in
7198 '') dflt='n';;
7199 *) dflt='y';;
7200 esac
7201 cat <<EOM
7202 Perl can be built with extra modules or bundles of modules which
7203 will be fetched from the CPAN and installed alongside Perl.
7204
7205 Notice that you will need access to the CPAN; either via the Internet,
7206 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7207 be asked later to configure the CPAN.pm module which will in turn do
7208 the installation of the rest of the extra modules or bundles.)
7209
7210 Notice also that if the modules require any external software such as
7211 libraries and headers (the libz library and the zlib.h header for the
7212 Compress::Zlib module, for example) you MUST have any such software
7213 already installed, this configuration process will NOT install such
7214 things for you.
7215
7216 If this doesn't make any sense to you, just accept the default '$dflt'.
7217 EOM
7218 rp='Install any extra modules (y or n)?'
7219 . ./myread
7220 case "$ans" in
7221 y|Y)
7222         cat <<EOM
7223
7224 Please list any extra modules or bundles to be installed from CPAN,
7225 with spaces between the names.  The names can be in any format the
7226 'install' command of CPAN.pm will understand.  (Answer 'none',
7227 without the quotes, to install no extra modules or bundles.)
7228 EOM
7229         rp='Extras?'
7230         dflt="$extras"
7231         . ./myread
7232         extras="$ans"
7233 esac
7234 case "$extras" in
7235 ''|'none')
7236         val=''
7237         $rm -f ../extras.lst
7238         ;;
7239 *)      echo "(Saving the list of extras for later...)"
7240         echo "$extras" > ../extras.lst
7241         val="'$extras'"
7242         ;;
7243 esac
7244 set extras
7245 eval $setvar
7246 echo " "
7247
7248 : determine where html pages for programs go
7249 set html1dir html1dir none
7250 eval $prefixit
7251 $cat <<EOM
7252
7253 If you wish to install html files for programs in $spackage, indicate
7254 the appropriate directory here.  To skip installing html files,
7255 answer "none".
7256 EOM
7257 case "$html1dir" in
7258 ''|none|$undef|' ') dflt=none ;;
7259 *) dflt=$html1dir ;;
7260 esac
7261 fn=dn+~
7262 rp="Directory for the main $spackage html pages?"
7263 . ./getfile
7264 prefixvar=html1dir
7265 . ./setprefixvar
7266 : Use ' ' for none so value is preserved next time through Configure
7267 $test X"$html1dir" = "X" && html1dir=' '
7268
7269 : determine where html pages for libraries and modules go
7270 set html3dir html3dir none
7271 eval $prefixit
7272 $cat <<EOM
7273
7274 If you wish to install html files for modules associated with $spackage,
7275 indicate the appropriate directory here.  To skip installing html files,
7276 answer "none".
7277 EOM
7278 : There is no obvious default.  If they have specified html1dir, then
7279 : try to key off that, possibly changing .../html1 into .../html3.
7280 case "$html3dir" in
7281 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7282 *) dflt=$html3dir ;;
7283 esac
7284 fn=dn+~
7285 rp="Directory for the $spackage module html pages?"
7286 . ./getfile
7287 prefixvar=html3dir
7288 . ./setprefixvar
7289 : Use ' ' for none so value is preserved next time through Configure
7290 $test X"$html3dir" = "X" && html3dir=' '
7291
7292 : determine whether to install perl also as /usr/bin/perl
7293
7294 echo " "
7295 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7296         $cat <<EOM
7297 Many scripts expect perl to be installed as /usr/bin/perl.
7298
7299 If you want to, I can install the perl you are about to compile
7300 as /usr/bin/perl (in addition to $bin/perl).
7301 EOM
7302         if test -f /usr/bin/perl; then
7303             $cat <<EOM
7304
7305 However, please note that because you already have a /usr/bin/perl,
7306 overwriting that with a new Perl would very probably cause problems.
7307 Therefore I'm assuming you don't want to do that (unless you insist).
7308
7309 EOM
7310             case "$installusrbinperl" in
7311             "$define"|[yY]*)    dflt='y';;
7312             *)                  dflt='n';;
7313             esac
7314         else
7315             $cat <<EOM
7316
7317 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7318
7319 EOM
7320             case "$installusrbinperl" in
7321             "$undef"|[nN]*)     dflt='n';;
7322             *)                  dflt='y';;
7323             esac
7324         fi
7325         rp="Do you want to install perl as /usr/bin/perl?"
7326         . ./myread
7327         case "$ans" in
7328         [yY]*)  val="$define";;
7329         *)      val="$undef" ;;
7330         esac
7331 else
7332         val="$undef"
7333 fi
7334 set installusrbinperl
7335 eval $setvar
7336
7337 : Check if we are using the GNU C library
7338 echo " "
7339 echo "Checking for GNU C Library..." >&4
7340 cat >try.c <<'EOCP'
7341 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7342    alone are insufficient to distinguish different versions, such as
7343    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7344    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7345 */
7346 #include <stdio.h>
7347 int main(void)
7348 {
7349 #ifdef __GLIBC__
7350 #   ifdef __GLIBC_MINOR__
7351 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7352 #           include <gnu/libc-version.h>
7353             printf("%s\n",  gnu_get_libc_version());
7354 #       else
7355             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7356 #       endif
7357 #   else
7358         printf("%d\n",  __GLIBC__);
7359 #   endif
7360     return 0;
7361 #else
7362     return 1;
7363 #endif
7364 }
7365 EOCP
7366 set try
7367 if eval $compile_ok && $run ./try > glibc.ver; then
7368         val="$define"
7369         gnulibc_version=`$cat glibc.ver`
7370         echo "You are using the GNU C Library version $gnulibc_version"
7371 else
7372         val="$undef"
7373         gnulibc_version=''
7374         echo "You are not using the GNU C Library"
7375 fi
7376 $rm_try glibc.ver
7377 set d_gnulibc
7378 eval $setvar
7379
7380 : see if nm is to be used to determine whether a symbol is defined or not
7381 case "$usenm" in
7382 '')
7383         dflt=''
7384         case "$d_gnulibc" in
7385         "$define")
7386                 echo " "
7387                 echo "nm probably won't work on the GNU C Library." >&4
7388                 dflt=n
7389                 ;;
7390         esac
7391         case "$dflt" in
7392         '') 
7393                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7394                         echo " "
7395                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7396                         echo "'nm' won't be sufficient on this sytem." >&4
7397                         dflt=n
7398                 fi
7399                 ;;
7400         esac
7401         case "$dflt" in
7402         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7403                 if $test $dflt -gt 20; then
7404                         dflt=y
7405                 else
7406                         dflt=n
7407                 fi
7408                 ;;
7409         esac
7410         ;;
7411 *)
7412         case "$usenm" in
7413         true|$define) dflt=y;;
7414         *) dflt=n;;
7415         esac
7416         ;;
7417 esac
7418 $cat <<EOM
7419
7420 I can use $nm to extract the symbols from your C libraries. This
7421 is a time consuming task which may generate huge output on the disk (up
7422 to 3 megabytes) but that should make the symbols extraction faster. The
7423 alternative is to skip the 'nm' extraction part and to compile a small
7424 test program instead to determine whether each symbol is present. If
7425 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7426 this may be the best solution.
7427
7428 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7429
7430 EOM
7431 rp="Shall I use $nm to extract C symbols from the libraries?"
7432 . ./myread
7433 case "$ans" in
7434 [Nn]*) usenm=false;;
7435 *) usenm=true;;
7436 esac
7437
7438 runnm=$usenm
7439 case "$reuseval" in
7440 true) runnm=false;;
7441 esac
7442
7443 : nm options which may be necessary
7444 case "$nm_opt" in
7445 '') if $test -f /mach_boot; then
7446                 nm_opt=''       # Mach
7447         elif $test -d /usr/ccs/lib; then
7448                 nm_opt='-p'     # Solaris (and SunOS?)
7449         elif $test -f /dgux; then
7450                 nm_opt='-p'     # DG-UX
7451         elif $test -f /lib64/rld; then
7452                 nm_opt='-p'     # 64-bit Irix
7453         else
7454                 nm_opt=''
7455         fi;;
7456 esac
7457
7458 : nm options which may be necessary for shared libraries but illegal
7459 : for archive libraries.  Thank you, Linux.
7460 case "$nm_so_opt" in
7461 '')     case "$myuname" in
7462         *linux*|gnu*)
7463                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7464                         nm_so_opt='--dynamic'
7465                 fi
7466                 ;;
7467         esac
7468         ;;
7469 esac
7470
7471 : Figure out where the libc is located
7472 case "$runnm" in
7473 true)
7474 : get list of predefined functions in a handy place
7475 echo " "
7476 case "$libc" in
7477 '') libc=unknown
7478         case "$libs" in
7479         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7480         esac
7481         ;;
7482 esac
7483 case "$libs" in
7484 '') ;;
7485 *)  for thislib in $libs; do
7486         case "$thislib" in
7487         -lc|-lc_s)
7488                 : Handle C library specially below.
7489                 ;;
7490         -l*)
7491                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7492                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7493                         :
7494                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7495                         :
7496                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7497                         :
7498                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7499                         :
7500                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7501                         :
7502                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7503                         :
7504                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7505                         :
7506                 else
7507                         try=''
7508                 fi
7509                 libnames="$libnames $try"
7510                 ;;
7511         *) libnames="$libnames $thislib" ;;
7512         esac
7513         done
7514         ;;
7515 esac
7516 xxx=normal
7517 case "$libc" in
7518 unknown)
7519         set /lib/libc.$so
7520         for xxx in $libpth; do
7521                 $test -r $1 || set $xxx/libc.$so
7522                 : The messy sed command sorts on library version numbers.
7523                 $test -r $1 || \
7524                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7525                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7526                                 h
7527                                 s/[0-9][0-9]*/0000&/g
7528                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7529                                 G
7530                                 s/\n/ /' | \
7531                          $sort | $sed -e 's/^.* //'`
7532                 eval set \$$#
7533         done
7534         $test -r $1 || set /usr/ccs/lib/libc.$so
7535         $test -r $1 || set /lib/libsys_s$_a
7536         ;;
7537 *)
7538         set blurfl
7539         ;;
7540 esac
7541 if $test -r "$1"; then
7542         echo "Your (shared) C library seems to be in $1."
7543         libc="$1"
7544 elif $test -r /lib/libc && $test -r /lib/clib; then
7545         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7546         xxx=apollo
7547         libc='/lib/clib /lib/libc'
7548         if $test -r /lib/syslib; then
7549                 echo "(Your math library is in /lib/syslib.)"
7550                 libc="$libc /lib/syslib"
7551         fi
7552 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7553         echo "Your C library seems to be in $libc, as you said before."
7554 elif $test -r $incpath/usr/lib/libc$_a; then
7555         libc=$incpath/usr/lib/libc$_a;
7556         echo "Your C library seems to be in $libc.  That's fine."
7557 elif $test -r /lib/libc$_a; then
7558         libc=/lib/libc$_a;
7559         echo "Your C library seems to be in $libc.  You're normal."
7560 else
7561         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7562                 :
7563         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7564                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7565         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7566                 :
7567         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7568                 :
7569         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7570                 :
7571         else
7572                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7573         fi
7574         if $test -r "$tans"; then
7575                 echo "Your C library seems to be in $tans, of all places."
7576                 libc=$tans
7577         else
7578                 libc='blurfl'
7579         fi
7580 fi
7581 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7582         dflt="$libc"
7583         cat <<EOM
7584
7585 If the guess above is wrong (which it might be if you're using a strange
7586 compiler, or your machine supports multiple models), you can override it here.
7587
7588 EOM
7589 else
7590         dflt=''
7591         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7592         cat >&4 <<EOM
7593 I can't seem to find your C library.  I've looked in the following places:
7594
7595 EOM
7596         $sed 's/^/      /' libpath
7597         cat <<EOM
7598
7599 None of these seems to contain your C library. I need to get its name...
7600
7601 EOM
7602 fi
7603 fn=f
7604 rp='Where is your C library?'
7605 . ./getfile
7606 libc="$ans"
7607
7608 echo " "
7609 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7610 set X `cat libnames`
7611 shift
7612 xxx=files
7613 case $# in 1) xxx=file; esac
7614 echo "Extracting names from the following $xxx for later perusal:" >&4
7615 echo " "
7616 $sed 's/^/      /' libnames >&4
7617 echo " "
7618 $echo $n "This may take a while...$c" >&4
7619
7620 for file in $*; do
7621         case $file in
7622         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7623         *) $nm $nm_opt $file 2>/dev/null;;
7624         esac
7625 done >libc.tmp
7626
7627 $echo $n ".$c"
7628 $grep fprintf libc.tmp > libc.ptf
7629 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7630 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7631 xxx='[ADTSIW]'
7632 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7657                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7678         eval $xscan;\
7679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680                 eval $xrun
7681 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7682         eval $xscan;\
7683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684                 eval $xrun
7685 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7686         eval $xscan;\
7687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688                 eval $xrun
7689 else
7690         $nm -p $* 2>/dev/null >libc.tmp
7691         $grep fprintf libc.tmp > libc.ptf
7692         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7693                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7694         then
7695                 nm_opt='-p'
7696                 eval $xrun
7697         else
7698                 echo " "
7699                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7700                 com=''
7701                 if $ar t $libc > libc.tmp && \
7702                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7703                 then
7704                         for thisname in $libnames $libc; do
7705                                 $ar t $thisname >>libc.tmp
7706                         done
7707                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7708                         echo "Ok." >&4
7709                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7710                         for thisname in $libnames $libc; do
7711                                 $ar tv $thisname >>libc.tmp
7712                                 emximp -o tmp.imp $thisname \
7713                                     2>/dev/null && \
7714                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7715                                     < tmp.imp >>libc.tmp
7716                                 $rm -f tmp.imp
7717                         done
7718                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7719                         echo "Ok." >&4
7720                 else
7721                         echo "$ar didn't seem to work right." >&4
7722                         echo "Maybe this is a Cray...trying bld instead..." >&4
7723                         if  bld t $libc | \
7724                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7725                                 $test -s libc.list
7726                         then
7727                                 for thisname in $libnames; do
7728                                         bld t $libnames | \
7729                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7730                                         $ar t $thisname >>libc.tmp
7731                                 done
7732                                 echo "Ok." >&4
7733                         else
7734                                 echo "That didn't work either.  Giving up." >&4
7735                                 exit 1
7736                         fi
7737                 fi
7738         fi
7739 fi
7740 nm_extract="$com"
7741 case "$PASE" in
7742 define)
7743     echo " "
7744     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7745     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7746     ;;
7747 *)  if $test -f /lib/syscalls.exp; then
7748         echo " "
7749         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7750         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7751                 /lib/syscalls.exp >>libc.list
7752     fi
7753     ;;
7754 esac
7755 ;;
7756 esac
7757 $rm -f libnames libpath
7758
7759 : see if dld is available
7760 set dld.h i_dld
7761 eval $inhdr
7762
7763 : Check if we are using C++
7764 echo " "
7765 echo "Checking for C++..." >&4
7766 $cat >try.c <<'EOCP'
7767 #include <stdio.h>
7768 int main(void)
7769 {
7770 #ifdef __cplusplus
7771     return 0;
7772 #else
7773     return 1;
7774 #endif
7775 }
7776 EOCP
7777 set try
7778 if eval $compile_ok && $run ./try; then
7779         val="$define"
7780         echo "You are using a C++ compiler."
7781 else
7782         val="$undef"
7783         echo "You are not using a C++ compiler."
7784 fi
7785 $rm_try cplusplus$$
7786 set d_cplusplus
7787 eval $setvar
7788
7789 : is a C symbol defined?
7790 csym='tlook=$1;
7791 case "$3" in
7792 -v) tf=libc.tmp; tdc="";;
7793 -a) tf=libc.tmp; tdc="[]";;
7794 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7795 esac;
7796 case "$d_cplusplus" in
7797     $define)    extern_C="extern \"C\"" ;;
7798     *)          extern_C="extern"       ;;
7799 esac;
7800 tx=yes;
7801 case "$reuseval-$4" in
7802 true-) ;;
7803 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7804 esac;
7805 case "$tx" in
7806 yes)
7807         tval=false;
7808         if $test "$runnm" = true; then
7809                 if $contains $tlook $tf >/dev/null 2>&1; then
7810                         tval=true;
7811                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7812                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7813                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7814                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7815                         $rm_try;
7816                 fi;
7817         else
7818                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7819                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7820                 $rm_try;
7821         fi;
7822         ;;
7823 *)
7824         case "$tval" in
7825         $define) tval=true;;
7826         *) tval=false;;
7827         esac;
7828         ;;
7829 esac;
7830 eval "$2=$tval"'
7831
7832 : define an is-in-libc? function
7833 inlibc='echo " "; td=$define; tu=$undef;
7834 sym=$1; var=$2; eval "was=\$$2";
7835 tx=yes;
7836 case "$reuseval$was" in
7837 true) ;;
7838 true*) tx=no;;
7839 esac;
7840 case "$tx" in
7841 yes)
7842         set $sym tres -f;
7843         eval $csym;
7844         case "$tres" in
7845         true)
7846                 echo "$sym() found." >&4;
7847                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7848         *)
7849                 echo "$sym() NOT found." >&4;
7850                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7851         esac;;
7852 *)
7853         case "$was" in
7854         $define) echo "$sym() found." >&4;;
7855         *) echo "$sym() NOT found." >&4;;
7856         esac;;
7857 esac'
7858
7859 : see if dlopen exists
7860 xxx_runnm="$runnm"
7861 xxx_ccflags="$ccflags"
7862 runnm=false
7863 : with g++ one needs -shared to get is-in-libc to work for dlopen
7864 case "$gccversion" in
7865 '')     ;;
7866 *)      case "$d_cplusplus" in
7867         "$define") ccflags="$ccflags -shared" ;;
7868         esac
7869         ;;
7870 esac
7871 set dlopen d_dlopen
7872 eval $inlibc
7873 runnm="$xxx_runnm"
7874 ccflags="$xxx_ccflags"
7875
7876 : see if this is a unistd.h system
7877 set unistd.h i_unistd
7878 eval $inhdr
7879
7880 : determine which dynamic loading, if any, to compile in
7881 echo " "
7882 dldir="ext/DynaLoader"
7883 case "$usedl" in
7884 $define|y|true)
7885         dflt='y'
7886         usedl="$define"
7887         ;;
7888 $undef|n|false)
7889         dflt='n'
7890         usedl="$undef"
7891         ;;
7892 *)
7893         dflt='n'
7894         case "$d_dlopen" in
7895             $define) dflt='y' ;;
7896         esac
7897         case "$i_dld" in
7898             $define) dflt='y' ;;
7899         esac
7900         : Does a dl_xxx.xs file exist for this operating system
7901         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7902         ;;
7903 esac
7904 rp="Do you wish to use dynamic loading?"
7905 . ./myread
7906 usedl="$ans"
7907 case "$ans" in
7908 y*) usedl="$define"
7909         case "$dlsrc" in
7910         '')
7911                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7912                         dflt="$dldir/dl_${osname}.xs"
7913                 elif $test "$d_dlopen" = "$define" ; then
7914                         dflt="$dldir/dl_dlopen.xs"
7915                 elif $test "$i_dld" = "$define" ; then
7916                         dflt="$dldir/dl_dld.xs"
7917                 else
7918                         dflt=''
7919                 fi
7920                 ;;
7921         *)      dflt="$dldir/$dlsrc"
7922                 ;;
7923         esac
7924     echo "The following dynamic loading files are available:"
7925         : Can not go over to $dldir because getfile has path hard-coded in.
7926         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7927         rp="Source file to use for dynamic loading"
7928         fn="fne"
7929         gfpth="$src"
7930         . ./getfile
7931         usedl="$define"
7932         : emulate basename
7933         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7934
7935         $cat << EOM
7936
7937 Some systems may require passing special flags to $cc -c to
7938 compile modules that will be used to create a shared library.
7939 To use no flags, say "none".
7940
7941 EOM
7942     case "$cccdlflags" in
7943     '') case "$gccversion" in
7944                 '') case "$osname" in
7945                         hpux)   dflt='+z' ;;
7946                         next)   dflt='none' ;;
7947                         irix*)  dflt='-KPIC' ;;
7948                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7949                         sunos)  dflt='-pic' ;;
7950                         *)      dflt='none' ;;
7951                     esac
7952                         ;;
7953                 *)  case "$osname" in
7954                         darwin) dflt='none' ;;
7955                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7956                         *)      dflt='-fpic' ;;
7957                     esac ;;
7958             esac ;;
7959         ' ') dflt='none' ;;
7960     *)  dflt="$cccdlflags" ;;
7961     esac
7962     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7963     . ./myread
7964     case "$ans" in
7965     none) cccdlflags=' ' ;;
7966     *) cccdlflags="$ans" ;;
7967     esac
7968
7969     cat << EOM
7970
7971 Some systems use ld to create libraries that can be dynamically loaded,
7972 while other systems (such as those using ELF) use $cc.
7973
7974 EOM
7975         case "$ld" in
7976         '')     $cat >try.c <<EOM
7977 /* Test for whether ELF binaries are produced */
7978 #include <fcntl.h>
7979 #$i_stdlib I_STDLIB
7980 #ifdef I_STDLIB
7981 #include <stdlib.h>
7982 #endif
7983 #$i_unistd I_UNISTD
7984 #ifdef I_UNISTD
7985 #include <unistd.h>
7986 #endif
7987 int main() {
7988         char b[4];
7989         int i = open("a.out",O_RDONLY);
7990         if(i == -1)
7991                 exit(1); /* fail */
7992         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7993                 exit(0); /* succeed (yes, it's ELF) */
7994         else
7995                 exit(1); /* fail */
7996 }
7997 EOM
7998                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7999                         cat <<EOM
8000 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8001 EOM
8002                         dflt="$cc"
8003                 else
8004                         echo "I'll use ld to build dynamic libraries."
8005                         dflt='ld'
8006                 fi
8007                 $rm_try
8008                 ;;
8009         *)      dflt="$ld"
8010                 ;;
8011         esac
8012
8013     rp="What command should be used to create dynamic libraries?"
8014     . ./myread
8015         ld="$ans"
8016
8017     cat << EOM
8018
8019 Some systems may require passing special flags to $ld to create a
8020 library that can be dynamically loaded.  If your ld flags include
8021 -L/other/path options to locate libraries outside your loader's normal
8022 search path, you may need to specify those -L options here as well.  To
8023 use no flags, say "none".
8024
8025 EOM
8026     case "$lddlflags" in
8027     '') case "$osname" in
8028                         beos) dflt='-nostart' ;;
8029                         haiku) dflt='-shared' ;;
8030                         hpux) dflt='-b';
8031                               case "$gccversion" in
8032                               '') dflt="$dflt +vnocompatwarnings" ;;
8033                               esac
8034                               ;;
8035                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8036                         next)  dflt='none' ;;
8037                         solaris) dflt='-G' ;;
8038                         sunos) dflt='-assert nodefinitions' ;;
8039                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8040                 *)     dflt='none' ;;
8041                         esac
8042                         ;;
8043     *) dflt="$lddlflags" ;;
8044     esac
8045
8046         : Try to guess additional flags to pick up local libraries.
8047         : Be careful not to append to a plain 'none'
8048         case "$dflt" in
8049         none) dflt='' ;;
8050         esac
8051         for thisflag in $ldflags; do
8052                 case "$thisflag" in
8053                 -L*|-R*|-Wl,-R*)
8054                         case " $dflt " in
8055                         *" $thisflag "*) ;;
8056                         *) dflt="$dflt $thisflag" ;;
8057                         esac
8058                         ;;
8059                 esac
8060         done
8061
8062         case "$dflt" in
8063         ''|' ') dflt='none' ;;
8064         esac
8065
8066         case "$ldflags" in
8067         *-fstack-protector*)
8068             case "$dflt" in
8069                         *-fstack-protector*) ;; # Don't add it again
8070                         *) dflt="$dflt -fstack-protector" ;; 
8071                 esac
8072                 ;;
8073         esac
8074
8075
8076     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8077     . ./myread
8078     case "$ans" in
8079     none) lddlflags=' ' ;;
8080     *) lddlflags="$ans" ;;
8081     esac
8082
8083         cat <<EOM
8084
8085 Some systems may require passing special flags to $cc to indicate that
8086 the resulting executable will use dynamic linking.  To use no flags,
8087 say "none".
8088
8089 EOM
8090     case "$ccdlflags" in
8091     '') case "$osname" in
8092             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8093             next|sunos) dflt='none' ;;
8094             *)          dflt='none' ;;
8095             esac ;;
8096     ' ')  dflt='none' ;;
8097     *)  dflt="$ccdlflags" ;;
8098     esac
8099     rp="Any special flags to pass to $cc to use dynamic linking?"
8100     . ./myread
8101     case "$ans" in
8102     none) ccdlflags=' ' ;;
8103     *) ccdlflags="$ans" ;;
8104     esac
8105     ;;
8106 *)  usedl="$undef"
8107         ld='ld'
8108     dlsrc='dl_none.xs'
8109     lddlflags=''
8110     ccdlflags=''
8111     ;;
8112 esac
8113
8114 : Do we want a shared libperl?
8115 also=''
8116 case "$usedl" in
8117 $undef)
8118         # No dynamic loading being used, so don't bother even to prompt.
8119         useshrplib='false'
8120         ;;
8121 *)      case "$useshrplib" in
8122         '')     case "$osname" in
8123                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8124                         dflt=y
8125                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8126                         ;;
8127                 next*)
8128                         case "$osvers" in
8129                         4*)     dflt=y
8130                                 also='Building a shared libperl is needed for MAB support.'
8131                                 ;;
8132                         *)      dflt=n
8133                                 ;;
8134                         esac
8135                         ;;
8136                 *)      dflt=n
8137                         ;;
8138                 esac
8139                 ;;
8140         $define|true|[Yy]*)
8141                 dflt=y
8142                 ;;
8143         *)      dflt=n
8144                 ;;
8145         esac
8146         $cat << EOM
8147
8148 The perl executable is normally obtained by linking perlmain.c with
8149 libperl${_a}, any static extensions (usually just DynaLoader), and
8150 any other libraries needed on this system (such as -lm, etc.).  Since
8151 your system supports dynamic loading, it is probably possible to build
8152 a shared libperl.$so.  If you will have more than one executable linked
8153 to libperl.$so, this will significantly reduce the size of each
8154 executable, but it may have a noticeable effect on performance.  The
8155 default is probably sensible for your system.
8156 $also
8157
8158 EOM
8159         rp="Build a shared libperl.$so (y/n)"
8160         . ./myread
8161         case "$ans" in
8162         true|$define|[Yy]*)
8163                 useshrplib='true'  ;;
8164         *)      useshrplib='false' ;;
8165         esac
8166         ;;
8167 esac
8168
8169 case "$useshrplib" in
8170 true)
8171         case "$libperl" in
8172         '')
8173                 # Figure out a good name for libperl.so.  Since it gets stored in
8174                 # a version-specific architecture-dependent library, the version
8175                 # number isn't really that important, except for making cc/ld happy.
8176                 #
8177                 # A name such as libperl.so.10.1
8178                 majmin="libperl.$so.$patchlevel.$subversion"
8179                 # A name such as libperl.so.100
8180                 majonly=`echo $patchlevel $subversion |
8181                         $awk '{printf "%d%02d", $1, $2}'`
8182                 majonly=libperl.$so.$majonly
8183                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8184                 # rely on figuring it out from the naming of libc.
8185                 case "${osname}${osvers}" in
8186                 next4*)
8187                         dflt=libperl.5.$so
8188                         # XXX How handle the --version stuff for MAB?
8189                         ;;
8190                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8191                         dflt=libperl.$so
8192                         ;;
8193                 cygwin*) # ld links now against the dll directly
8194                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8195                         majonly=`echo $patchlevel $subversion |
8196                                 $awk '{printf "%03d%03d", $1, $2}'`
8197                         majonly=cygperl5.$majonly.$so
8198                         dflt=$majmin
8199                         ;;
8200                 *)      # Try to guess based on whether libc has major.minor.
8201                         case "$libc" in
8202                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8203                         *libc.$so.[0-9]*) dflt=$majonly ;;
8204                         *)      dflt=libperl.$so ;;
8205                         esac
8206                         ;;
8207                 esac
8208                 ;;
8209         *)      dflt=$libperl
8210                 ;;
8211         esac
8212         cat << EOM
8213
8214 I need to select a good name for the shared libperl.  If your system uses
8215 library names with major and minor numbers, then you might want something
8216 like $majmin.  Alternatively, if your system uses a single version
8217 number for shared libraries, then you might want to use $majonly.
8218 Or, your system might be quite happy with a simple libperl.$so.
8219
8220 Since the shared libperl will get installed into a version-specific
8221 architecture-dependent directory, the version number of the shared perl
8222 library probably isn't important, so the default should be o.k.
8223
8224 EOM
8225         rp='What name do you want to give to the shared libperl?'
8226         . ./myread
8227         libperl=$ans
8228         echo "Ok, I'll use $libperl"
8229         ;;
8230 *)
8231         libperl="libperl${_a}"
8232         ;;
8233 esac
8234
8235 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8236 case "$shrpdir" in
8237 '') ;;
8238 *)      $cat >&4 <<EOM
8239 WARNING:  Use of the shrpdir variable for the installation location of
8240 the shared $libperl is not supported.  It was never documented and
8241 will not work in this version.  Let me (perlbug@perl.org)
8242 know of any problems this may cause.
8243
8244 EOM
8245         case "$shrpdir" in
8246         "$archlibexp/CORE")
8247                 $cat >&4 <<EOM
8248 But your current setting of $shrpdir is
8249 the default anyway, so it's harmless.
8250 EOM
8251                 ;;
8252         *)
8253                 $cat >&4 <<EOM
8254 Further, your current attempted setting of $shrpdir
8255 conflicts with the value of $archlibexp/CORE
8256 that installperl will use.
8257 EOM
8258                 ;;
8259         esac
8260         ;;
8261 esac
8262
8263 # How will the perl executable find the installed shared $libperl?
8264 # Add $xxx to ccdlflags.
8265 # If we can't figure out a command-line option, use $shrpenv to
8266 # set env LD_RUN_PATH.  The main perl makefile uses this.
8267 shrpdir=$archlibexp/CORE
8268 xxx=''
8269 tmp_shrpenv=''
8270 if "$useshrplib"; then
8271     case "$osname" in
8272         aix)
8273                 # We'll set it in Makefile.SH...
8274                 ;;
8275         solaris)
8276                 xxx="-R $shrpdir"
8277                 ;;
8278         freebsd|netbsd|openbsd|interix|dragonfly)
8279                 xxx="-Wl,-R$shrpdir"
8280                 ;;
8281         bsdos|linux|irix*|dec_osf|gnu*)
8282                 xxx="-Wl,-rpath,$shrpdir"
8283                 ;;
8284         next)
8285                 # next doesn't like the default...
8286                 ;;
8287         beos)
8288                 # beos doesn't like the default, either.
8289                 ;;
8290         haiku)
8291                 # Haiku doesn't like the default, either.
8292                 ;;
8293         hpux*)
8294                 # hpux doesn't like the default, either.
8295                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8296                 ;;
8297         cygwin)
8298                 # cygwin needs only ldlibpth
8299                 ;;
8300         *)
8301                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8302                 ;;
8303         esac
8304         case "$xxx" in
8305         '') ;;
8306         *)
8307                 # Only add $xxx if it isn't already in ccdlflags.
8308                 case " $ccdlflags " in
8309                 *" $xxx "*)     ;;
8310                 *)      ccdlflags="$ccdlflags $xxx"
8311                         cat <<EOM >&4
8312
8313 Adding $xxx to the flags
8314 passed to $ld so that the perl executable will find the
8315 installed shared $libperl.
8316
8317 EOM
8318                         ;;
8319                 esac
8320                 ;;
8321         esac
8322 fi
8323 # Fix ccdlflags in AIX for building external extensions.
8324 # (For building Perl itself bare -bE:perl.exp is needed,
8325 #  Makefile.SH takes care of this.)
8326 case "$osname" in
8327 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8328 esac
8329 # Respect a hint or command-line value.
8330 case "$shrpenv" in
8331 '') shrpenv="$tmp_shrpenv" ;;
8332 esac
8333 case "$ldlibpthname" in
8334 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8335 none)   ldlibpthname='' ;;
8336 esac
8337
8338 : determine where manual pages are on this system
8339 echo " "
8340 case "$sysman" in
8341 '') 
8342         syspath='/usr/share/man/man1 /usr/man/man1'
8343         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8344         syspath="$syspath /usr/man/u_man/man1"
8345         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8346         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8347         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8348         sysman=`./loc . /usr/man/man1 $syspath`
8349         ;;
8350 esac
8351 if $test -d "$sysman"; then
8352         echo "System manual is in $sysman." >&4
8353 else
8354         echo "Could not find manual pages in source form." >&4
8355 fi
8356
8357 : determine where manual pages go
8358 set man1dir man1dir none
8359 eval $prefixit
8360 $cat <<EOM
8361
8362 $spackage has manual pages available in source form.
8363 EOM
8364 case "$nroff" in
8365 nroff)
8366         echo "However, you don't have nroff, so they're probably useless to you."
8367         case "$man1dir" in
8368         '') man1dir="none";;
8369         esac;;
8370 esac
8371 echo "If you don't want the manual sources installed, answer 'none'."
8372 case "$man1dir" in
8373 ' ') dflt=none
8374         ;;
8375 '')
8376         lookpath="$prefixexp/share/man/man1"
8377         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8378         lookpath="$lookpath $prefixexp/man/p_man/man1"
8379         lookpath="$lookpath $prefixexp/man/u_man/man1"
8380         lookpath="$lookpath $prefixexp/man/man.1"
8381         case "$sysman" in
8382         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8383         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8384         esac
8385         set dflt
8386         eval $prefixup
8387         ;;
8388 *)  dflt="$man1dir"
8389         ;;
8390 esac
8391 echo " "
8392 fn=dn+~
8393 rp="Where do the main $spackage manual pages (source) go?"
8394 . ./getfile
8395 if $test "X$man1direxp" != "X$ansexp"; then
8396         installman1dir=''
8397 fi
8398 prefixvar=man1dir
8399 . ./setprefixvar
8400
8401 case "$man1dir" in
8402 '')     man1dir=' '
8403         installman1dir='';;
8404 esac
8405
8406 : What suffix to use on installed man pages
8407
8408 case "$man1dir" in
8409 ' ')
8410         man1ext='0'
8411         ;;
8412 *)
8413         rp="What suffix should be used for the main $spackage man pages?"
8414         case "$man1ext" in
8415         '')     case "$man1dir" in
8416                 *1)  dflt=1 ;;
8417                 *1p) dflt=1p ;;
8418                 *1pm) dflt=1pm ;;
8419                 *l) dflt=l;;
8420                 *n) dflt=n;;
8421                 *o) dflt=o;;
8422                 *p) dflt=p;;
8423                 *C) dflt=C;;
8424                 *L) dflt=L;;
8425                 *L1) dflt=L1;;
8426                 *) dflt=1;;
8427                 esac
8428                 ;;
8429         *)      dflt="$man1ext";;
8430         esac
8431         . ./myread
8432         man1ext="$ans"
8433         ;;
8434 esac
8435
8436 : see if we can have long filenames
8437 echo " "
8438 first=123456789abcdef
8439 $rm -f $first
8440 if (echo hi >$first) 2>/dev/null; then
8441         if $test -f 123456789abcde; then
8442                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8443                 val="$undef"
8444         else
8445                 echo 'You can have filenames longer than 14 characters.'>&4
8446                 val="$define"
8447         fi
8448 else
8449         $cat <<'EOM'
8450 You can't have filenames longer than 14 chars.
8451 You can't even think about them!
8452 EOM
8453         val="$undef"
8454 fi
8455 set d_flexfnam
8456 eval $setvar
8457 $rm -rf 123456789abcde*
8458
8459 : determine where library module manual pages go
8460 set man3dir man3dir none
8461 eval $prefixit
8462 $cat <<EOM
8463
8464 $spackage has manual pages for many of the library modules.
8465 EOM
8466
8467 case "$nroff" in
8468 nroff)
8469         $cat <<'EOM'
8470 However, you don't have nroff, so they're probably useless to you.
8471 EOM
8472         case "$man3dir" in
8473         '') man3dir="none";;
8474         esac;;
8475 esac
8476
8477 case "$d_flexfnam" in
8478 undef)
8479         $cat <<'EOM'
8480 However, your system can't handle the long file names like File::Basename.3.
8481 EOM
8482         case "$man3dir" in
8483         '') man3dir="none";;
8484         esac;;
8485 esac
8486
8487 echo "If you don't want the manual sources installed, answer 'none'."
8488 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8489 case "$man3dir" in
8490 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8491         if $test -d "$privlib/man/man3"; then
8492                 cat <<EOM >&4
8493
8494 WARNING:  Previous versions of perl installed man3 pages into
8495 $privlib/man/man3.  This version will suggest a
8496 new default of $dflt.
8497 EOM
8498                 tdflt=$dflt
8499                 dflt='n'
8500                 rp='Do you wish to preserve the old behavior?(y/n)'
8501                 . ./myread
8502                 case "$ans" in
8503                 y*) dflt="$privlib/man/man3" ;;
8504                 *)  dflt=$tdflt ;;
8505                 esac
8506     fi
8507         ;;
8508 *)      dflt="$man3dir" ;;
8509 esac
8510 case "$dflt" in
8511 ' ') dflt=none ;;
8512 esac
8513 echo " "
8514 fn=dn+~
8515 rp="Where do the $package library man pages (source) go?"
8516 . ./getfile
8517 prefixvar=man3dir
8518 . ./setprefixvar
8519
8520 case "$man3dir" in
8521 '')     man3dir=' '
8522         installman3dir='';;
8523 esac
8524
8525 : What suffix to use on installed man pages
8526 case "$man3dir" in
8527 ' ')
8528         man3ext='0'
8529         ;;
8530 *)
8531         rp="What suffix should be used for the $package library man pages?"
8532         case "$man3ext" in
8533         '')     case "$man3dir" in
8534                 *3)  dflt=3 ;;
8535                 *3p) dflt=3p ;;
8536                 *3pm) dflt=3pm ;;
8537                 *l) dflt=l;;
8538                 *n) dflt=n;;
8539                 *o) dflt=o;;
8540                 *p) dflt=p;;
8541                 *C) dflt=C;;
8542                 *L) dflt=L;;
8543                 *L3) dflt=L3;;
8544                 *) dflt=3;;
8545                 esac
8546                 ;;
8547         *)      dflt="$man3ext";;
8548         esac
8549         . ./myread
8550         man3ext="$ans"
8551         ;;
8552 esac
8553
8554 : see if we have to deal with yellow pages, now NIS.
8555 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8556         if $test -f /usr/etc/nibindd; then
8557                 echo " "
8558                 echo "I'm fairly confident you're on a NeXT."
8559                 echo " "
8560                 rp='Do you get the hosts file via NetInfo?'
8561                 dflt=y
8562                 case "$hostcat" in
8563                 nidump*) ;;
8564                 '') ;;
8565                 *) dflt=n;;
8566                 esac
8567                 . ./myread
8568                 case "$ans" in
8569                 y*) hostcat='nidump hosts .';;
8570                 *)      case "$hostcat" in
8571                         nidump*) hostcat='';;
8572                         esac
8573                         ;;
8574                 esac
8575         fi
8576         case "$hostcat" in
8577         nidump*) ;;
8578         *)
8579                 case "$hostcat" in
8580                 *ypcat*) dflt=y;;
8581                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8582                                 dflt=y
8583                         else
8584                                 dflt=n
8585                         fi;;
8586                 *) dflt=n;;
8587                 esac
8588                 echo " "
8589                 rp='Are you getting the hosts file via yellow pages?'
8590                 . ./myread
8591                 case "$ans" in
8592                 y*) hostcat='ypcat hosts';;
8593                 *) hostcat='cat /etc/hosts';;
8594                 esac
8595                 ;;
8596         esac
8597 fi
8598 case "$hostcat" in
8599 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8600 esac
8601 case "$groupcat" in
8602 '') test -f /etc/group && groupcat='cat /etc/group';;
8603 esac
8604 case "$passcat" in
8605 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8606 esac
8607
8608 : now get the host name
8609 echo " "
8610 echo "Figuring out host name..." >&4
8611 case "$myhostname" in
8612 '') cont=true
8613         echo 'Maybe "hostname" will work...'
8614         if tans=`sh -c hostname 2>&1` ; then
8615                 myhostname=$tans
8616                 phostname=hostname
8617                 cont=''
8618         fi
8619         ;;
8620 *) cont='';;
8621 esac
8622 if $test "$cont"; then
8623         if ./xenix; then
8624                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8625                 if tans=`cat /etc/systemid 2>&1` ; then
8626                         myhostname=$tans
8627                         phostname='cat /etc/systemid'
8628                         echo "Whadyaknow.  Xenix always was a bit strange..."
8629                         cont=''
8630                 fi
8631         elif $test -r /etc/systemid; then
8632                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8633         fi
8634 fi
8635 if $test "$cont"; then
8636         echo 'No, maybe "uuname -l" will work...'
8637         if tans=`sh -c 'uuname -l' 2>&1` ; then
8638                 myhostname=$tans
8639                 phostname='uuname -l'
8640         else
8641                 echo 'Strange.  Maybe "uname -n" will work...'
8642                 if tans=`sh -c 'uname -n' 2>&1` ; then
8643                         myhostname=$tans
8644                         phostname='uname -n'
8645                 else
8646                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8647                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8648                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8649                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8650                         else
8651                                 case "$myhostname" in
8652                                 '') echo "Does this machine have an identity crisis or something?"
8653                                         phostname='';;
8654                                 *)
8655                                         echo "Well, you said $myhostname before..."
8656                                         phostname='echo $myhostname';;
8657                                 esac
8658                         fi
8659                 fi
8660         fi
8661 fi
8662 case "$myhostname" in
8663 '') myhostname=noname ;;
8664 esac
8665 : you do not want to know about this
8666 set $myhostname
8667 myhostname=$1
8668
8669 : verify guess
8670 if $test "$myhostname" ; then
8671         dflt=y
8672         rp='Your host name appears to be "'$myhostname'".'" Right?"
8673         . ./myread
8674         case "$ans" in
8675         y*) ;;
8676         *) myhostname='';;
8677         esac
8678 fi
8679
8680 : bad guess or no guess
8681 while $test "X$myhostname" = X ; do
8682         dflt=''
8683         rp="Please type the (one word) name of your host:"
8684         . ./myread
8685         myhostname="$ans"
8686 done
8687
8688 : translate upper to lower if necessary
8689 case "$myhostname" in
8690 *[A-Z]*)
8691         echo "(Normalizing case in your host name)"
8692         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8693         ;;
8694 esac
8695
8696 case "$myhostname" in
8697 *.*)
8698         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8699         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8700         echo "(Trimming domain name from host name--host name is now $myhostname)"
8701         ;;
8702 *) case "$mydomain" in
8703         '')
8704                 {
8705                         test "X$hostcat" = "Xypcat hosts" &&
8706                         ypmatch "$myhostname" hosts 2>/dev/null |\
8707                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8708                         $test -s hosts
8709                 } || {
8710                         test "X$hostcat" != "X" &&
8711                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8712                                         /[       ]$myhostname[  . ]/p" > hosts
8713                 }
8714                 tmp_re="[       . ]"
8715                 if $test -f hosts; then
8716                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8717                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8718                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8719                                 hosts | $sort | $uniq | \
8720                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8721                         case `$echo X$dflt` in
8722                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8723                                 dflt=.
8724                                 ;;
8725                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8726                                 ;;
8727                         esac
8728                 else
8729                         echo "(I cannot locate a hosts database anywhere)"
8730                         dflt=.
8731                 fi
8732                 case "$dflt" in
8733                 .)
8734                         tans=`./loc resolv.conf X /etc /usr/etc`
8735                         if $test -f "$tans"; then
8736                                 echo "(Attempting domain name extraction from $tans)"
8737                                 dflt=.`$sed -n -e 's/   / /g' \
8738                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8739                                   -e 1q 2>/dev/null`
8740                                 case "$dflt" in
8741                                 .) dflt=.`$sed -n -e 's/        / /g' \
8742                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8743                                      -e 1q 2>/dev/null`
8744                                         ;;
8745                                 esac
8746                         fi
8747                         ;;
8748                 esac
8749                 case "$dflt" in
8750                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8751                         dflt=.`sh -c domainname 2>/dev/null`
8752                         case "$dflt" in
8753                         '') dflt='.';;
8754                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8755                         esac
8756                         ;;
8757                 esac
8758                 case "$dflt$osname" in
8759                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8760                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8761                         ;;
8762                 esac
8763                 case "$dflt" in
8764                 .) echo "(Lost all hope -- silly guess then)"
8765                         dflt='.nonet'
8766                         ;;
8767                 esac
8768                 $rm -f hosts
8769                 ;;
8770         *) dflt="$mydomain";;
8771         esac;;
8772 esac
8773 echo " "
8774 rp="What is your domain name?"
8775 . ./myread
8776 tans="$ans"
8777 case "$ans" in
8778 '') ;;
8779 .*) ;;
8780 *) tans=".$tans";;
8781 esac
8782 mydomain="$tans"
8783
8784 : translate upper to lower if necessary
8785 case "$mydomain" in
8786 *[A-Z]*)
8787         echo "(Normalizing case in your domain name)"
8788         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8789         ;;
8790 esac
8791
8792 : a little sanity check here
8793 case "$phostname" in
8794 '') ;;
8795 *)
8796         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8797         $myhostname$mydomain|$myhostname) ;;
8798         *)
8799                 case "$phostname" in
8800                 sed*)
8801                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8802                         ;;
8803                 *)
8804                         echo "(That doesn't agree with your $phostname command, by the way.)"
8805                         ;;
8806                 esac
8807         ;;
8808         esac
8809         ;;
8810 esac
8811
8812 : determine the e-mail address of the user who is running us
8813 $cat <<EOM
8814
8815 I need to get your e-mail address in Internet format if possible, i.e.
8816 something like user@host.domain. Please answer accurately since I have
8817 no easy means to double check it. The default value provided below
8818 is most probably close to reality but may not be valid from outside
8819 your organization...
8820
8821 EOM
8822 cont=x
8823 while test "$cont"; do
8824         case "$cf_email" in
8825         '') dflt="$cf_by@$myhostname$mydomain";;
8826         *) dflt="$cf_email";;
8827         esac
8828         rp='What is your e-mail address?'
8829         . ./myread
8830         cf_email="$ans"
8831         case "$cf_email" in
8832         *@*.*) cont='' ;;
8833         *)
8834                 rp='Address does not look like an Internet one.  Use it anyway?'
8835                 case "$fastread" in
8836                 yes) dflt=y ;;
8837                 *) dflt=n ;;
8838                 esac
8839                 . ./myread
8840                 case "$ans" in
8841                 y*) cont='' ;;
8842                 *) echo " " ;;
8843                 esac
8844                 ;;
8845         esac
8846 done
8847
8848 : Ask e-mail of administrator
8849 $cat <<EOM
8850
8851 If you or somebody else will be maintaining perl at your site, please
8852 fill in the correct e-mail address here so that they may be contacted
8853 if necessary. Currently, the "perlbug" program included with perl
8854 will send mail to this address in addition to perlbug@perl.org. You may
8855 enter "none" for no administrator.
8856
8857 EOM
8858 case "$perladmin" in
8859 '') dflt="$cf_email";;
8860 *) dflt="$perladmin";;
8861 esac
8862 rp='Perl administrator e-mail address'
8863 . ./myread
8864 perladmin="$ans"
8865
8866 : determine whether to only install version-specific parts.
8867 echo " "
8868 $cat <<EOM
8869 Do you want to install only the version-specific parts of the perl
8870 distribution?  Usually you do *not* want to do this.
8871 EOM
8872 case "$versiononly" in
8873 "$define"|[Yy]*|true) dflt='y' ;;
8874 *) dflt='n';
8875 esac
8876 rp="Do you want to install only the version-specific parts of perl?"
8877 . ./myread
8878 case "$ans" in
8879 [yY]*)  val="$define";;
8880 *)      val="$undef" ;;
8881 esac
8882 set versiononly
8883 eval $setvar
8884
8885 case "$versiononly" in
8886 "$define") inc_version_list=''
8887            inc_version_list_init=0
8888            ;;
8889 esac
8890
8891 : figure out how to guarantee perl startup
8892 : XXX Note that this currently takes advantage of the bug that binexp ignores
8893 :     the Configure -Dinstallprefix setting, which in turn means that under
8894 :     relocatable @INC, initialinstalllocation is what binexp started as.
8895 case "$startperl" in
8896 '')
8897         case "$sharpbang" in
8898         *!)
8899                 $cat <<EOH
8900
8901 I can use the #! construct to start perl on your system. This will
8902 make startup of perl scripts faster, but may cause problems if you
8903 want to share those scripts and perl is not in a standard place
8904 ($initialinstalllocation/perl) on all your platforms. The alternative
8905 is to force a shell by starting the script with a single ':' character.
8906
8907 EOH
8908                 case "$versiononly" in
8909                 "$define")      dflt="$initialinstalllocation/perl$version";;
8910                 *)              dflt="$initialinstalllocation/perl";;
8911                 esac
8912                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8913                 . ./myread
8914                 case "$ans" in
8915                 none)   startperl=": # use perl";;
8916                 *)      startperl="#!$ans"
8917                         if $test 30 -lt `echo "$ans" | wc -c`; then
8918                                 $cat >&4 <<EOM
8919
8920 WARNING:  Some systems limit the #! command to 32 characters.
8921 If you experience difficulty running Perl scripts with #!, try
8922 installing Perl in a directory with a shorter pathname.
8923
8924 EOM
8925                         fi ;;
8926                 esac
8927                 ;;
8928         *) startperl=": # use perl"
8929                 ;;
8930         esac
8931         ;;
8932 esac
8933 echo "I'll use $startperl to start perl scripts."
8934
8935 : figure best path for perl in scripts
8936 case "$perlpath" in
8937 '')
8938         case "$versiononly" in
8939         "$define")      perlpath="$initialinstalllocation/perl$version";;
8940         *)              perlpath="$initialinstalllocation/perl";;
8941         esac
8942         case "$startperl" in
8943         *!*) ;;
8944         *)
8945                 $cat <<EOH
8946
8947 I will use the "eval 'exec'" idiom to start Perl on your system.
8948 I can use the full path of your Perl binary for this purpose, but
8949 doing so may cause problems if you want to share those scripts and
8950 Perl is not always in a standard place ($initialinstalllocation/perl).
8951
8952 EOH
8953                 dflt="$initialinstalllocation/perl"
8954                 rp="What path shall I use in \"eval 'exec'\"?"
8955                 . ./myread
8956                 perlpath="$ans"
8957                 ;;
8958         esac
8959         ;;
8960 esac
8961 case "$startperl" in
8962 *!*)    ;;
8963 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8964 esac
8965
8966 : determine where public executable scripts go
8967 set scriptdir scriptdir
8968 eval $prefixit
8969 case "$scriptdir" in
8970 '')
8971         dflt="$bin"
8972         : guess some guesses
8973         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8974         $test -d /usr/share/bin     && dflt=/usr/share/bin
8975         $test -d /usr/local/script  && dflt=/usr/local/script
8976         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8977         $test -d $prefixexp/script  && dflt=$prefixexp/script
8978         set dflt
8979         eval $prefixup
8980         ;;
8981 *)  dflt="$scriptdir"
8982         ;;
8983 esac
8984 $cat <<EOM
8985
8986 Some installations have a separate directory just for executable scripts so
8987 that they can mount it across multiple architectures but keep the scripts in
8988 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8989 Or you might just lump your scripts in with all your other executables.
8990
8991 EOM
8992 fn=d~
8993 rp='Where do you keep publicly executable scripts?'
8994 . ./getfile
8995 if $test "X$ansexp" != "X$scriptdirexp"; then
8996         installscript=''
8997 fi
8998 installscriptdir=''
8999 prefixvar=scriptdir
9000 . ./setprefixvar
9001 : A little fix up for an irregularly named variable.
9002 installscript="$installscriptdir"
9003
9004 : determine where add-on public executables go
9005 case "$sitebin" in
9006 '')     dflt=$siteprefix/bin ;;
9007 *)      dflt=$sitebin ;;
9008 esac
9009 fn=d~
9010 rp='Pathname where the add-on public executables should be installed?'
9011 . ./getfile
9012 prefixvar=sitebin
9013 . ./setprefixvar
9014
9015 : determine where add-on html pages go
9016 : There is no standard location, so try to copy the previously-selected
9017 : directory structure for the core html pages.
9018 case "$sitehtml1dir" in
9019 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9020 *)     dflt=$sitehtml1dir ;;
9021 esac
9022 case "$dflt" in
9023 ''|' ') dflt=none ;;
9024 esac
9025 fn=dn+~
9026 rp='Pathname where the site-specific html pages should be installed?'
9027 . ./getfile
9028 prefixvar=sitehtml1dir
9029 . ./setprefixvar
9030
9031 : determine where add-on library html pages go
9032 : There is no standard location, so try to copy the previously-selected
9033 : directory structure for the core html pages.
9034 case "$sitehtml3dir" in
9035 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9036 *)     dflt=$sitehtml3dir ;;
9037 esac
9038 case "$dflt" in
9039 ''|' ') dflt=none ;;
9040 esac
9041 fn=dn+~
9042 rp='Pathname where the site-specific library html pages should be installed?'
9043 . ./getfile
9044 prefixvar=sitehtml3dir
9045 . ./setprefixvar
9046
9047 : determine where add-on manual pages go
9048 case "$siteman1dir" in
9049 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9050 *)      dflt=$siteman1dir ;;
9051 esac
9052 case "$dflt" in
9053 ''|' ') dflt=none ;;
9054 esac
9055 fn=dn+~
9056 rp='Pathname where the site-specific manual pages should be installed?'
9057 . ./getfile
9058 prefixvar=siteman1dir
9059 . ./setprefixvar
9060
9061 : determine where add-on library man pages go
9062 case "$siteman3dir" in
9063 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9064 *)      dflt=$siteman3dir ;;
9065 esac
9066 case "$dflt" in
9067 ''|' ') dflt=none ;;
9068 esac
9069 fn=dn+~
9070 rp='Pathname where the site-specific library manual pages should be installed?'
9071 . ./getfile
9072 prefixvar=siteman3dir
9073 . ./setprefixvar
9074
9075 : determine where add-on public executable scripts go
9076 case "$sitescript" in
9077 '')     dflt=$siteprefix/script
9078         $test -d $dflt || dflt=$sitebin ;;
9079 *)  dflt="$sitescript" ;;
9080 esac
9081 fn=d~+
9082 rp='Pathname where add-on public executable scripts should be installed?'
9083 . ./getfile
9084 prefixvar=sitescript
9085 . ./setprefixvar
9086
9087 : Check if faststdio is requested and available
9088 case "$usefaststdio" in
9089 $define|true|[yY]*|'')
9090         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9091         case "$xversion" in
9092         [68])   dflt='y' ;;
9093         *)      dflt='n' ;;
9094         esac
9095         ;;
9096 *) dflt='n';;
9097 esac
9098 cat <<EOM
9099
9100 Perl can be built to use 'fast stdio', which means using the stdio
9101 library but also directly manipulating the stdio buffers to enable
9102 faster I/O.  Using stdio is better for backward compatibility (especially
9103 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9104 interface has been preferred instead of stdio.
9105
9106 If this doesn't make any sense to you, just accept the default '$dflt'.
9107 EOM
9108 rp='Use the "fast stdio" if available?'
9109 . ./myread
9110 case "$ans" in
9111 y|Y)    val="$define" ;;
9112 *)      val="$undef" ;;
9113 esac
9114 set usefaststdio
9115 eval $setvar
9116
9117
9118 : define an is-a-typedef? function
9119 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9120 case "$inclist" in
9121 "") inclist="sys/types.h";;
9122 esac;
9123 eval "varval=\$$var";
9124 case "$varval" in
9125 "")
9126         $rm -f temp.c;
9127         for inc in $inclist; do
9128                 echo "#include <$inc>" >>temp.c;
9129         done;
9130         echo "#ifdef $type" >> temp.c;
9131         echo "printf(\"We have $type\");" >> temp.c;
9132         echo "#endif" >> temp.c;
9133         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9134         if $contains $type temp.E >/dev/null 2>&1; then
9135                 eval "$var=\$type";
9136         else
9137                 eval "$var=\$def";
9138         fi;
9139         $rm -f temp.?;;
9140 *) eval "$var=\$varval";;
9141 esac'
9142
9143 : define an is-a-typedef? function that prompts if the type is not available.
9144 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9145 case "$inclist" in
9146 "") inclist="sys/types.h";;
9147 esac;
9148 eval "varval=\$$var";
9149 case "$varval" in
9150 "")
9151         $rm -f temp.c;
9152         for inc in $inclist; do
9153                 echo "#include <$inc>" >>temp.c;
9154         done;
9155         echo "#ifdef $type" >> temp.c;
9156         echo "printf(\"We have $type\");" >> temp.c;
9157         echo "#endif" >> temp.c;
9158         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9159         echo " " ;
9160         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9161         if $contains $type temp.E >/dev/null 2>&1; then
9162                 echo "$type found." >&4;
9163                 eval "$var=\$type";
9164         else
9165                 echo "$type NOT found." >&4;
9166                 dflt="$def";
9167                 . ./myread ;
9168                 eval "$var=\$ans";
9169         fi;
9170         $rm -f temp.?;;
9171 *) eval "$var=\$varval";;
9172 esac'
9173
9174 : see what type lseek is declared as in the kernel
9175 rp="What is the type used for lseek's offset on this system?"
9176 set off_t lseektype long stdio.h sys/types.h
9177 eval $typedef_ask
9178
9179 echo " "
9180 echo "Checking to see how big your file offsets are..." >&4
9181 $cat >try.c <<EOCP
9182 #include <sys/types.h>
9183 #include <stdio.h>
9184 int main()
9185 {
9186     printf("%d\n", (int)sizeof($lseektype));
9187     return(0);
9188 }
9189 EOCP
9190 set try
9191 if eval $compile_ok; then
9192         lseeksize=`$run ./try`
9193         echo "Your file offsets are $lseeksize bytes long."
9194 else
9195         dflt=$longsize
9196         echo " "
9197         echo "(I can't seem to compile the test program.  Guessing...)"
9198         rp="What is the size of your file offsets (in bytes)?"
9199         . ./myread
9200         lseeksize="$ans"
9201 fi
9202 $rm_try
9203
9204 : see what type file positions are declared as in the library
9205 rp="What is the type for file position used by fsetpos()?"
9206 set fpos_t fpostype long stdio.h sys/types.h
9207 eval $typedef_ask
9208
9209 : Check size for Fpos_t
9210 echo " "
9211 case "$fpostype" in
9212 *_t) zzz="$fpostype"    ;;
9213 *)   zzz="fpos_t"       ;;
9214 esac
9215 echo "Checking the size of $zzz..." >&4
9216 cat > try.c <<EOCP
9217 #include <sys/types.h>
9218 #include <stdio.h>
9219 #$i_stdlib I_STDLIB
9220 #ifdef I_STDLIB
9221 #include <stdlib.h>
9222 #endif
9223 int main() {
9224     printf("%d\n", (int)sizeof($fpostype));
9225     exit(0);
9226 }
9227 EOCP
9228 set try
9229 if eval $compile_ok; then
9230         yyy=`$run ./try`
9231         case "$yyy" in
9232         '')     fpossize=4
9233                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9234                 ;;
9235         *)      fpossize=$yyy
9236                 echo "Your $zzz is $fpossize bytes long."
9237                 ;;
9238         esac
9239 else
9240         dflt="$longsize"
9241         echo " " >&4
9242         echo "(I can't compile the test program.  Guessing...)" >&4
9243         rp="What is the size of your file positions (in bytes)?"
9244         . ./myread
9245         fpossize="$ans"
9246 fi
9247
9248 : Check for large file support
9249 # Backward compatibility (uselfs is deprecated).
9250 case "$uselfs" in
9251 "$define"|true|[yY]*)
9252         cat <<EOM >&4
9253
9254 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9255 EOM
9256         uselargefiles="$define"
9257         ;;
9258 esac
9259
9260 case "$lseeksize:$fpossize" in
9261 8:8) cat <<EOM
9262
9263 You can have files larger than 2 gigabytes.
9264 EOM
9265    val="$define" ;;
9266 *)    case "$uselargefiles" in
9267    "$undef"|false|[nN]*) dflt='n' ;;
9268    *)   dflt='y' ;;
9269    esac
9270    cat <<EOM
9271
9272 Perl can be built to understand large files (files larger than 2 gigabytes)
9273 on some systems.  To do so, Configure can be run with -Duselargefiles.
9274
9275 If this doesn't make any sense to you, just accept the default '$dflt'.
9276 EOM
9277    rp='Try to understand large files, if available?'
9278    . ./myread
9279    case "$ans" in
9280    y|Y)         val="$define" ;;
9281    *)           val="$undef"  ;;
9282    esac
9283    ;;
9284 esac
9285 set uselargefiles
9286 eval $setvar
9287 : Look for a hint-file generated 'call-back-unit'.  If the
9288 : user has specified that a large files perl is to be built,
9289 : we may need to set or change some other defaults.
9290 if $test -f uselargefiles.cbu; then
9291         echo "Your platform has some specific hints regarding large file builds, using them..."
9292         . ./uselargefiles.cbu
9293 fi
9294 case "$uselargefiles" in
9295 "$define")
9296         if $test -f uselargefiles.cbu; then
9297                 echo " "
9298                 echo "Rechecking to see how big your file offsets are..." >&4
9299                 $cat >try.c <<EOCP
9300 #include <sys/types.h>
9301 #include <stdio.h>
9302 int main()
9303 {
9304     printf("%d\n", (int)sizeof($lseektype));
9305     return(0);
9306 }
9307 EOCP
9308                 set try
9309                 if eval $compile_ok; then
9310                         lseeksize=`$run ./try`
9311                         $echo "Your file offsets are now $lseeksize bytes long."
9312                 else
9313                         dflt="$lseeksize"
9314                         echo " "
9315                         echo "(I can't seem to compile the test program.  Guessing...)"
9316                         rp="What is the size of your file offsets (in bytes)?"
9317                         . ./myread
9318                         lseeksize="$ans"
9319                 fi
9320                 case "$fpostype" in
9321                 *_t) zzz="$fpostype"    ;;
9322                 *)   zzz="fpos_t"       ;;
9323                 esac
9324                 $echo $n "Rechecking the size of $zzz...$c" >&4
9325                 $cat > try.c <<EOCP
9326 #include <sys/types.h>
9327 #include <stdio.h>
9328 #$i_stdlib I_STDLIB
9329 #ifdef I_STDLIB
9330 #include <stdlib.h>
9331 #endif
9332 int main() {
9333     printf("%d\n", (int)sizeof($fpostype));
9334     return(0);
9335 }
9336 EOCP
9337                 set try
9338                 if eval $compile_ok; then
9339                         yyy=`$run ./try`
9340                         dflt="$lseeksize"
9341                         case "$yyy" in
9342                         '')     echo " "
9343                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9344                                 ;;
9345                         *)      fpossize=$yyy
9346                                 echo " $fpossize bytes." >&4
9347                                 ;;
9348                         esac
9349                 else
9350                         dflt="$fpossize"
9351                         echo " "
9352                         echo "(I can't compile the test program.  Guessing...)" >&4
9353                         rp="What is the size of your file positions (in bytes)?"
9354                         . ./myread
9355                         fpossize="$ans"
9356                 fi
9357                 $rm_try
9358         fi
9359         ;;
9360 esac
9361
9362 : Set the vendorbin variables
9363 case "$vendorprefix" in
9364 '')     d_vendorbin="$undef"
9365         vendorbin=''
9366         vendorbinexp=''
9367         ;;
9368 *)      d_vendorbin="$define"
9369         : determine where vendor-supplied executables go.
9370         case "$vendorbin" in
9371         '') dflt=$vendorprefix/bin ;;
9372         *)      dflt="$vendorbin" ;;
9373         esac
9374         fn=d~+
9375         rp='Pathname for the vendor-supplied executables directory?'
9376         . ./getfile
9377         vendorbin="$ans"
9378         vendorbinexp="$ansexp"
9379         ;;
9380 esac
9381 prefixvar=vendorbin
9382 . ./installprefix
9383
9384 : Set the vendorhtml1dir variables
9385 case "$vendorprefix" in
9386 '')     vendorhtml1dir=''
9387         vendorhtml1direxp=''
9388         ;;
9389 *)      : determine where vendor-supplied html pages go.
9390         : There is no standard location, so try to copy the previously-selected
9391         : directory structure for the core html pages.
9392         : XXX Better default suggestions would be welcome.
9393         case "$vendorhtml1dir" in
9394         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9395         *)      dflt=$vendorhtml1dir ;;
9396         esac
9397         case "$dflt" in
9398         ''|' ') dflt=none ;;
9399         esac
9400         fn=dn+~
9401         rp='Pathname for the vendor-supplied html pages?'
9402         . ./getfile
9403         vendorhtml1dir="$ans"
9404         vendorhtml1direxp="$ansexp"
9405         ;;
9406 esac
9407 : Use ' ' for none so value is preserved next time through Configure
9408 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9409 prefixvar=vendorhtml1dir
9410 . ./installprefix
9411
9412 : Set the vendorhtml3dir variables
9413 case "$vendorprefix" in
9414 '')     vendorhtml3dir=''
9415         vendorhtml3direxp=''
9416         ;;
9417 *)      : determine where vendor-supplied module html pages go.
9418         : There is no standard location, so try to copy the previously-selected
9419         : directory structure for the core html pages.
9420         : XXX Better default suggestions would be welcome.
9421         case "$vendorhtml3dir" in
9422         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9423         *)      dflt=$vendorhtml3dir ;;
9424         esac
9425         case "$dflt" in
9426         ''|' ') dflt=none ;;
9427         esac
9428         fn=dn+~
9429         rp='Pathname for the vendor-supplied html pages?'
9430         . ./getfile
9431         vendorhtml3dir="$ans"
9432         vendorhtml3direxp="$ansexp"
9433         ;;
9434 esac
9435 : Use ' ' for none so value is preserved next time through Configure
9436 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9437 prefixvar=vendorhtml3dir
9438 . ./installprefix
9439
9440 : Set the vendorman1dir variables
9441 case "$vendorprefix" in
9442 '')     vendorman1dir=''
9443         vendorman1direxp=''
9444         ;;
9445 *)      : determine where vendor-supplied manual pages go.
9446         case "$vendorman1dir" in
9447         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9448         *)      dflt=$vendorman1dir ;;
9449         esac
9450         case "$dflt" in
9451         ''|' ') dflt=none ;;
9452         esac
9453         fn=nd~+
9454         rp='Pathname for the vendor-supplied manual section 1 pages?'
9455         . ./getfile
9456         vendorman1dir="$ans"
9457         vendorman1direxp="$ansexp"
9458         ;;
9459 esac
9460 : Use ' ' for none so value is preserved next time through Configure
9461 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9462 prefixvar=vendorman1dir
9463 . ./installprefix
9464
9465 : Set the vendorman3dir variables
9466 case "$vendorprefix" in
9467 '')     vendorman3dir=''
9468         vendorman3direxp=''
9469         ;;
9470 *)      : determine where vendor-supplied module manual pages go.
9471         case "$vendorman3dir" in
9472         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9473         *)      dflt=$vendorman3dir ;;
9474         esac
9475         case "$dflt" in
9476         ''|' ') dflt=none ;;
9477         esac
9478         fn=nd~+
9479         rp='Pathname for the vendor-supplied manual section 3 pages?'
9480         . ./getfile
9481         vendorman3dir="$ans"
9482         vendorman3direxp="$ansexp"
9483         ;;
9484 esac
9485 : Use ' ' for none so value is preserved next time through Configure
9486 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9487 prefixvar=vendorman3dir
9488 . ./installprefix
9489
9490 : Set the vendorscript variables
9491 case "$vendorprefix" in
9492 '')     d_vendorscript="$undef"
9493         vendorscript=''
9494         vendorscriptexp=''
9495         ;;
9496 *)      d_vendorscript="$define"
9497         : determine where vendor-supplied scripts go.
9498         case "$vendorscript" in
9499         '')     dflt=$vendorprefix/script
9500                 $test -d $dflt || dflt=$vendorbin ;;
9501         *)  dflt="$vendorscript" ;;
9502         esac
9503         $cat <<EOM
9504
9505 The installation process will create a directory for
9506 vendor-supplied scripts.
9507
9508 EOM
9509         fn=d~+
9510         rp='Pathname for the vendor-supplied scripts directory?'
9511         . ./getfile
9512         vendorscript="$ans"
9513         vendorscriptexp="$ansexp"
9514         ;;
9515 esac
9516 prefixvar=vendorscript
9517 . ./installprefix
9518
9519 : script used to emit important warnings
9520 cat >warn <<EOS
9521 $startsh
9522 if test \$# -gt 0; then
9523         echo "\$@" >msg
9524 else
9525         cat >msg
9526 fi
9527 echo "*** WARNING:" >&4
9528 sed -e 's/^/*** /' <msg >&4
9529 echo "*** " >&4
9530 cat msg >>config.msg
9531 echo " " >>config.msg
9532 rm -f msg
9533 EOS
9534 chmod +x warn
9535 $eunicefix warn
9536
9537 : see which of string.h or strings.h is needed
9538 echo " "
9539 strings=`./findhdr string.h`
9540 if $test "$strings" && $test -r "$strings"; then
9541         echo "Using <string.h> instead of <strings.h>." >&4
9542         val="$define"
9543 else
9544         val="$undef"
9545         strings=`./findhdr strings.h`
9546         if $test "$strings" && $test -r "$strings"; then
9547                 echo "Using <strings.h> instead of <string.h>." >&4
9548         else
9549                 ./warn "No string header found -- You'll surely have problems."
9550         fi
9551 fi
9552 set i_string
9553 eval $setvar
9554 case "$i_string" in
9555 "$undef") strings=`./findhdr strings.h`;;
9556 *)        strings=`./findhdr string.h`;;
9557 esac
9558
9559 : see if qgcvt exists
9560 set qgcvt d_qgcvt
9561 eval $inlibc
9562
9563 : Check print/scan long double stuff
9564 echo " "
9565
9566 if $test X"$d_longdbl" = X"$define"; then
9567
9568 echo "Checking how to print long doubles..." >&4
9569
9570 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9571         $cat >try.c <<'EOCP'
9572 #include <sys/types.h>
9573 #include <stdio.h>
9574 int main() {
9575   double d = 123.456;
9576   printf("%.3f\n", d);
9577 }
9578 EOCP
9579         set try
9580         if eval $compile; then
9581                 yyy=`$run ./try`
9582                 case "$yyy" in
9583                 123.456)
9584                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9585                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9586                         echo "We will use %f."
9587                         ;;
9588                 esac
9589         fi
9590 fi
9591
9592 if $test X"$sPRIfldbl" = X; then
9593         $cat >try.c <<'EOCP'
9594 #include <sys/types.h>
9595 #include <stdio.h>
9596 int main() {
9597   long double d = 123.456;
9598   printf("%.3Lf\n", d);
9599 }
9600 EOCP
9601         set try
9602         if eval $compile; then
9603                 yyy=`$run ./try`
9604                 case "$yyy" in
9605                 123.456)
9606                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9607                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9608                         echo "We will use %Lf."
9609                         ;;
9610                 esac
9611         fi
9612 fi
9613
9614 if $test X"$sPRIfldbl" = X; then
9615         $cat >try.c <<'EOCP'
9616 #include <sys/types.h>
9617 #include <stdio.h>
9618 int main() {
9619   long double d = 123.456;
9620   printf("%.3llf\n", d);
9621 }
9622 EOCP
9623         set try
9624         if eval $compile; then
9625                 yyy=`$run ./try`
9626                 case "$yyy" in
9627                 123.456)
9628                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9629                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9630                         echo "We will use %llf."
9631                         ;;
9632                 esac
9633         fi
9634 fi
9635
9636 if $test X"$sPRIfldbl" = X; then
9637         $cat >try.c <<'EOCP'
9638 #include <sys/types.h>
9639 #include <stdio.h>
9640 int main() {
9641   long double d = 123.456;
9642   printf("%.3lf\n", d);
9643 }
9644 EOCP
9645         set try
9646         if eval $compile; then
9647                 yyy=`$run ./try`
9648                 case "$yyy" in
9649                 123.456)
9650                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9651                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9652                         echo "We will use %lf."
9653                         ;;
9654                 esac
9655         fi
9656 fi
9657
9658 if $test X"$sPRIfldbl" = X; then
9659         echo "Cannot figure out how to print long doubles." >&4
9660 else
9661         sSCNfldbl=$sPRIfldbl    # expect consistency
9662 fi
9663
9664 $rm_try
9665
9666 fi # d_longdbl
9667
9668 case "$sPRIfldbl" in
9669 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9670         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9671         d_SCNfldbl="$undef";
9672         ;;
9673 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9674         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9675         d_SCNfldbl="$define";
9676         ;;
9677 esac
9678
9679 : Check how to convert floats to strings.
9680
9681 if test "X$d_Gconvert" = X; then
9682
9683 echo " "
9684 echo "Checking for an efficient way to convert floats to strings."
9685 echo " " > try.c
9686 case "$uselongdouble" in
9687 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9688 esac
9689 case "$d_longdbl" in
9690 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9691 esac
9692 case "$d_PRIgldbl" in
9693 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9694 esac
9695 $cat >>try.c <<EOP
9696 #ifdef TRY_gconvert
9697 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9698 char *myname = "gconvert";
9699 #endif
9700 #ifdef TRY_gcvt
9701 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9702 char *myname = "gcvt";
9703 #endif
9704 #ifdef TRY_qgcvt
9705 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9706 char *myname = "qgcvt";
9707 #define DOUBLETYPE long double
9708 #endif
9709 #ifdef TRY_sprintf
9710 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9711 #ifdef HAS_PRIgldbl
9712 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9713 #else
9714 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9715 #endif
9716 #else
9717 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9718 #endif
9719 char *myname = "sprintf";
9720 #endif
9721
9722 #ifndef DOUBLETYPE
9723 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9724 #define DOUBLETYPE long double
9725 #else
9726 #define DOUBLETYPE double
9727 #endif
9728 #endif
9729
9730 #include <stdio.h>
9731
9732 #$i_stdlib I_STDLIB
9733 #ifdef I_STDLIB
9734 #include <stdlib.h>
9735 #endif
9736 #$i_string I_STRING
9737 #ifdef I_STRING
9738 #  include <string.h>
9739 #else
9740 #  include <strings.h>
9741 #endif
9742
9743 int checkit(char *expect, char *got)
9744 {
9745     if (strcmp(expect, got)) {
9746                 printf("%s oddity:  Expected %s, got %s\n",
9747                         myname, expect, got);
9748                 exit(1);
9749         }
9750 }
9751
9752 int main()
9753 {
9754         char buf[64];
9755         buf[63] = '\0';
9756
9757         /* This must be 1st test on (which?) platform */
9758         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9759         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9760         checkit("0.1", buf);
9761
9762         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9763         checkit("0.01", buf);
9764
9765         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9766         checkit("0.001", buf);
9767
9768         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9769         checkit("0.0001", buf);
9770
9771         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9772         if (strlen(buf) > 5)
9773             checkit("9e-005", buf); /* for Microsoft ?? */
9774         else
9775             checkit("9e-05", buf);
9776
9777         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9778         checkit("1", buf);
9779
9780         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9781         checkit("1.1", buf);
9782
9783         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9784         checkit("1.01", buf);
9785
9786         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9787         checkit("1.001", buf);
9788
9789         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9790         checkit("1.0001", buf);
9791
9792         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9793         checkit("1.00001", buf);
9794
9795         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9796         checkit("1.000001", buf);
9797
9798         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9799         checkit("0", buf);
9800
9801         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9802         checkit("-1", buf);
9803
9804         /* Some Linux gcvt's give 1.e+5 here. */
9805         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9806         checkit("100000", buf);
9807
9808         /* Some Linux gcvt's give -1.e+5 here. */
9809         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9810         checkit("-100000", buf);
9811
9812         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9813         checkit("123.456", buf);
9814
9815         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9816         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9817         /* 34 should be enough to scare even long double
9818          * places into using the e notation. */
9819         if (strlen(buf) > 5)
9820             checkit("1e+034", buf); /* for Microsoft */
9821         else
9822             checkit("1e+34", buf);
9823
9824         /* For Perl, if you add additional tests here, also add them to
9825          * t/base/num.t for benefit of platforms not using Configure or
9826          * overriding d_Gconvert */
9827
9828         exit(0);
9829 }
9830 EOP
9831 : first add preferred functions to our list
9832 xxx_list=""
9833 for xxx_convert in $gconvert_preference; do
9834     case $xxx_convert in
9835     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9836     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9837     esac
9838 done
9839 : then add any others
9840 for xxx_convert in gconvert gcvt sprintf; do
9841     case "$xxx_list" in
9842     *$xxx_convert*) ;;
9843     *) xxx_list="$xxx_list $xxx_convert" ;;
9844     esac
9845 done
9846
9847 case "$d_longdbl$uselongdouble" in
9848 "$define$define")
9849     : again, add prefered functions to our list first
9850     xxx_ld_list=""
9851     for xxx_convert in $gconvert_ld_preference; do
9852         case $xxx_convert in
9853         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9854         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9855         esac
9856     done
9857     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9858     for xxx_convert in qgcvt sprintf $xxx_list; do
9859         case "$xxx_ld_list" in
9860         $xxx_convert*|*" $xxx_convert"*) ;;
9861         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9862         esac
9863     done
9864     : if sprintf cannot do long doubles, move it to the end
9865     if test "$d_PRIgldbl" != "$define"; then
9866         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9867     fi
9868     : if no qgcvt, remove it
9869     if test "$d_qgcvt" != "$define"; then
9870         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9871     fi
9872     : use the ld_list
9873     xxx_list="$xxx_ld_list"
9874     ;;
9875 esac
9876
9877 for xxx_convert in $xxx_list; do
9878         echo "Trying $xxx_convert..."
9879         $rm -f try try$_o core
9880         set try -DTRY_$xxx_convert
9881         if eval $compile; then
9882                 echo "$xxx_convert() found." >&4
9883                 if $run ./try; then
9884                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9885                         break;
9886                 else
9887                         echo "...But $xxx_convert didn't work as I expected."
9888                         xxx_convert=''
9889                 fi
9890         else
9891                 echo "$xxx_convert NOT found." >&4
9892         fi
9893 done
9894
9895 if test X$xxx_convert = X; then
9896     echo "*** WHOA THERE!!! ***" >&4
9897     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9898     xxx_convert=sprintf
9899 fi
9900
9901 case "$xxx_convert" in
9902 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9903 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9904 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9905 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9906    "$define$define$define")
9907       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9908    "$define$define$undef")
9909       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9910    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9911    esac
9912    ;;
9913 esac
9914
9915 fi
9916 $rm_try
9917
9918 : see if _fwalk exists
9919 set fwalk d__fwalk
9920 eval $inlibc
9921
9922 : Initialize h_fcntl
9923 h_fcntl=false
9924
9925 : Initialize h_sysfile
9926 h_sysfile=false
9927
9928 : access call always available on UNIX
9929 set access d_access
9930 eval $inlibc
9931
9932 : locate the flags for 'access()'
9933 case "$d_access" in
9934 "$define")
9935         echo " "
9936         $cat >access.c <<EOCP
9937 #include <sys/types.h>
9938 #ifdef I_FCNTL
9939 #include <fcntl.h>
9940 #endif
9941 #ifdef I_SYS_FILE
9942 #include <sys/file.h>
9943 #endif
9944 #ifdef I_UNISTD
9945 #include <unistd.h>
9946 #endif
9947 #$i_stdlib I_STDLIB
9948 #ifdef I_STDLIB
9949 #include <stdlib.h>
9950 #endif
9951 int main() {
9952         exit(R_OK);
9953 }
9954 EOCP
9955         : check sys/file.h first, no particular reason here
9956         if $test `./findhdr sys/file.h` && \
9957                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9958                 h_sysfile=true;
9959                 echo "<sys/file.h> defines the *_OK access constants." >&4
9960         elif $test `./findhdr fcntl.h` && \
9961                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9962                 h_fcntl=true;
9963                 echo "<fcntl.h> defines the *_OK access constants." >&4
9964         elif $test `./findhdr unistd.h` && \
9965                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9966                 echo "<unistd.h> defines the *_OK access constants." >&4
9967         else
9968                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9969         fi
9970         ;;
9971 esac
9972 $rm -f access*
9973
9974 : see if accessx exists
9975 set accessx d_accessx
9976 eval $inlibc
9977
9978 : see if aintl exists
9979 set aintl d_aintl
9980 eval $inlibc
9981
9982 : see if alarm exists
9983 set alarm d_alarm
9984 eval $inlibc
9985
9986 : see if 64bit time functions exists
9987
9988 set ctime64 d_ctime64
9989 eval $inlibc
9990
9991 set localtime64 d_localtime64
9992 eval $inlibc
9993
9994 set gmtime64 d_gmtime64
9995 eval $inlibc
9996
9997 set mktime64 d_mktime64
9998 eval $inlibc
9999
10000 set difftime64 d_difftime64
10001 eval $inlibc
10002
10003 set asctime64 d_asctime64
10004 eval $inlibc
10005
10006 : see if POSIX threads are available
10007 set pthread.h i_pthread
10008 eval $inhdr
10009
10010 : define a fucntion to check prototypes
10011 $cat > protochk <<EOSH
10012 $startsh
10013 cc="$cc"
10014 optimize="$optimize"
10015 ccflags="$ccflags"
10016 prototype="$prototype"
10017 define="$define"
10018 rm_try="$rm_try"
10019 usethreads=$usethreads
10020 i_pthread=$i_pthread
10021 pthread_h_first=$pthread_h_first
10022 EOSH
10023
10024 $cat >> protochk <<'EOSH'
10025
10026 $rm_try
10027 foo="$1"
10028 shift
10029 while test $# -ge 2; do
10030         case "$1" in
10031                 $define) echo "#include <$2>" >> try.c ;;
10032                 literal) echo "$2" >> try.c ;;
10033         esac
10034     # Extra magic for the benefit of systems that need pthread.h
10035     # to be included early to correctly detect threadsafe functions.
10036     # Such functions must guarantee themselves, though, that the usethreads
10037     # and i_pthread have been defined, before calling protochk.
10038     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10039         echo "#include <pthread.h>" >> try.c
10040         pthread_h_done=yes
10041     fi
10042     shift 2
10043 done
10044 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10045 cat >> try.c <<'EOCP'
10046 #ifdef CAN_PROTOTYPE
10047 #define _(args) args
10048 #else
10049 #define _(args) ()
10050 #endif
10051 EOCP
10052 echo "$foo" >> try.c
10053 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10054 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10055 status=$?
10056 $rm_try
10057 exit $status
10058 EOSH
10059 chmod +x protochk
10060 $eunicefix protochk
10061
10062 : Define hasproto macro for Configure internal use
10063 hasproto='varname=$1; func=$2; shift; shift;
10064 while $test $# -ge 2; do
10065         case "$1" in
10066         $define) echo "#include <$2>";;
10067         esac ;
10068     shift 2;
10069 done > try.c;
10070 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10071 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10072         echo "$func() prototype found.";
10073         val="$define";
10074 else
10075         echo "$func() prototype NOT found.";
10076         val="$undef";
10077 fi;
10078 set $varname;
10079 eval $setvar;
10080 $rm_try tryout.c'
10081
10082 : see if sys/types.h has to be included
10083 set sys/types.h i_systypes
10084 eval $inhdr
10085
10086 : see if sys/select.h has to be included
10087 set sys/select.h i_sysselct
10088 eval $inhdr
10089
10090 : Define hasfield macro for Configure internal use
10091 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10092 while $test $# -ge 2; do
10093         case "$1" in
10094         $define) echo "#include <$2>";;
10095         esac ;
10096     shift 2;
10097 done > try.c;
10098 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10099 set try;
10100 if eval $compile; then
10101         val="$define";
10102 else
10103         val="$undef";
10104 fi;
10105 set $varname;
10106 eval $setvar;
10107 $rm_try'
10108
10109 : see if we should include time.h, sys/time.h, or both
10110 echo " "
10111 if test "X$timeincl" = X; then
10112         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10113         $echo $n "I'm now running the test program...$c"
10114         $cat >try.c <<EOCP
10115 #include <sys/types.h>
10116 #ifdef I_TIME
10117 #include <time.h>
10118 #endif
10119 #ifdef I_SYSTIME
10120 #ifdef SYSTIMEKERNEL
10121 #define KERNEL
10122 #endif
10123 #include <sys/time.h>
10124 #endif
10125 #ifdef I_SYSSELECT
10126 #include <sys/select.h>
10127 #endif
10128 #$i_stdlib I_STDLIB
10129 #ifdef I_STDLIB
10130 #include <stdlib.h>
10131 #endif
10132 int main()
10133 {
10134         struct tm foo;
10135 #ifdef S_TIMEVAL
10136         struct timeval bar;
10137 #endif
10138 #ifdef S_TIMEZONE
10139         struct timezone tzp;
10140 #endif
10141         if (foo.tm_sec == foo.tm_sec)
10142                 exit(0);
10143 #ifdef S_TIMEVAL
10144         if (bar.tv_sec == bar.tv_sec)
10145                 exit(0);
10146 #endif
10147         exit(1);
10148 }
10149 EOCP
10150         flags=''
10151         for s_timezone in '-DS_TIMEZONE' ''; do
10152         sysselect=''
10153         for s_timeval in '-DS_TIMEVAL' ''; do
10154         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10155         for i_time in '' '-DI_TIME'; do
10156         for i_systime in '-DI_SYSTIME' ''; do
10157                 case "$flags" in
10158                 '') $echo $n ".$c"
10159                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10160                         if eval $compile; then
10161                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10162                                 shift
10163                                 flags="$*"
10164                                 echo " "
10165                                 $echo $n "Succeeded with $flags$c"
10166                         fi
10167                         ;;
10168                 esac
10169         done
10170         done
10171         done
10172         done
10173         done
10174         timeincl=''
10175         echo " "
10176         case "$flags" in
10177         *SYSTIMEKERNEL*) i_systimek="$define"
10178                 timeincl=`./findhdr sys/time.h`
10179                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10180         *) i_systimek="$undef";;
10181         esac
10182         case "$flags" in
10183         *I_TIME*) i_time="$define"
10184                 timeincl=`./findhdr time.h`" $timeincl"
10185                 echo "We'll include <time.h>." >&4;;
10186         *) i_time="$undef";;
10187         esac
10188         case "$flags" in
10189         *I_SYSTIME*) i_systime="$define"
10190                 timeincl=`./findhdr sys/time.h`" $timeincl"
10191                 echo "We'll include <sys/time.h>." >&4;;
10192         *) i_systime="$undef";;
10193         esac
10194         $rm_try
10195 fi
10196 : see if struct tm knows about tm_zone
10197 case "$i_systime$i_time" in
10198 *$define*)
10199         echo " "
10200         echo "Checking to see if your struct tm has tm_zone field..." >&4
10201         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10202         eval $hasfield
10203         ;;
10204 *)      val="$undef"
10205         set d_tm_tm_zone
10206         eval $setvar
10207         ;;
10208 esac
10209 case "$d_tm_tm_zone" in
10210 "$define")      echo "Yes, it does."   ;;
10211 *)              echo "No, it doesn't." ;;
10212 esac
10213 : see if struct tm knows about tm_gmtoff
10214 case "$i_systime$i_time" in
10215 *$define*)
10216         echo " "
10217         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10218         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10219         eval $hasfield
10220         ;;
10221 *)      val="$undef"
10222         set d_tm_tm_gmtoff
10223         eval $setvar
10224         ;;
10225 esac
10226 case "$d_tm_tm_gmtoff" in
10227 "$define")      echo "Yes, it does."   ;;
10228 *)              echo "No, it doesn't." ;;
10229 esac
10230
10231 : see if asctime_r exists
10232 set asctime_r d_asctime_r
10233 eval $inlibc
10234 case "$d_asctime_r" in
10235 "$define")
10236         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10237         case "$d_asctime_r_proto:$usethreads" in
10238         ":define")      d_asctime_r_proto=define
10239                 set d_asctime_r_proto asctime_r $hdrs
10240                 eval $hasproto ;;
10241         *)      ;;
10242         esac
10243         case "$d_asctime_r_proto" in
10244         define)
10245         case "$asctime_r_proto" in
10246         ''|0) try='char* asctime_r(const struct tm*, char*);'
10247         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10248         esac
10249         case "$asctime_r_proto" in
10250         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10251         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10252         esac
10253         case "$asctime_r_proto" in
10254         ''|0) try='int asctime_r(const struct tm*, char*);'
10255         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10256         esac
10257         case "$asctime_r_proto" in
10258         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10259         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10260         esac
10261         case "$asctime_r_proto" in
10262         ''|0)   d_asctime_r=undef
10263                 asctime_r_proto=0
10264                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10265         * )     case "$asctime_r_proto" in
10266                 REENTRANT_PROTO*) ;;
10267                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10268                 esac
10269                 echo "Prototype: $try" ;;
10270         esac
10271         ;;
10272         *)      case "$usethreads" in
10273                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10274                 esac
10275                 d_asctime_r=undef
10276                 asctime_r_proto=0
10277                 ;;
10278         esac
10279         ;;
10280 *)      asctime_r_proto=0
10281         ;;
10282 esac
10283
10284 : see if atolf exists
10285 set atolf d_atolf
10286 eval $inlibc
10287
10288 : see if atoll exists
10289 set atoll d_atoll
10290 eval $inlibc
10291
10292 : Look for GCC-style attribute format
10293 case "$d_attribute_format" in
10294 '')
10295 echo " "
10296 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10297 $cat >attrib.c <<'EOCP'
10298 #include <stdio.h>
10299 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10300 EOCP
10301 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10302         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10303                 echo "Your C compiler doesn't support __attribute__((format))."
10304                 val="$undef"
10305         else
10306                 echo "Your C compiler supports __attribute__((format))."
10307                 val="$define"
10308         fi
10309 else
10310         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10311         val="$undef"
10312 fi
10313 ;;
10314 *) val="$d_attribute_format" ;;
10315 esac
10316 set d_attribute_format
10317 eval $setvar
10318 $rm -f attrib*
10319
10320 : Look for GCC-style attribute format with null format allowed
10321 case "$d_printf_format_null" in
10322 '') case "$d_attribute_format" in
10323     $define)
10324         echo " "
10325         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10326 $cat >attrib.c <<EOCP
10327 #include <stdio.h>
10328 #$i_stdlib I_STDLIB
10329 #ifdef I_STDLIB
10330 #include <stdlib.h>
10331 #endif
10332 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10333 int null_printf (char* pat,...) { return (int)pat; }
10334 int main () { exit(null_printf(NULL)); }
10335 EOCP
10336         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10337             : run the executable in case it produces a run-time warning
10338             if $run ./attrib >>attrib.out 2>&1; then
10339                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10340                     echo "Your C compiler doesn't allow __printf__ format to be null."
10341                     val="$undef"
10342                 else
10343                     echo "Your C compiler allows __printf__ format to be null."
10344                     val="$define"
10345                 fi
10346             else
10347             echo "Your C compiler executable failed with __printf__ format null."
10348             val="$undef"
10349         fi
10350     else
10351         echo "Your C compiler fails with __printf__ format null."
10352         val="$undef"
10353     fi
10354     ;;
10355     *)  val="$undef" ;;
10356     esac
10357 ;;
10358 *)  val="$d_printf_format_null" ;;
10359 esac
10360 set d_printf_format_null
10361 eval $setvar
10362 $rm -f attrib*
10363
10364 : Look for GCC-style attribute malloc
10365 case "$d_attribute_malloc" in
10366 '')
10367 echo " "
10368 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10369 $cat >attrib.c <<'EOCP'
10370 #include <stdio.h>
10371 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10372 EOCP
10373 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10374         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10375                 echo "Your C compiler doesn't support __attribute__((malloc))."
10376                 val="$undef"
10377         else
10378                 echo "Your C compiler supports __attribute__((malloc))."
10379                 val="$define"
10380         fi
10381 else
10382         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10383         val="$undef"
10384 fi
10385 ;;
10386 *) val="$d_attribute_malloc" ;;
10387 esac
10388 set d_attribute_malloc
10389 eval $setvar
10390 $rm -f attrib*
10391
10392 : Look for GCC-style attribute nonnull
10393 case "$d_attribute_nonnull" in
10394 '')
10395 echo " "
10396 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10397 $cat >attrib.c <<'EOCP'
10398 #include <stdio.h>
10399 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10400 EOCP
10401 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10402         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10403                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10404                 val="$undef"
10405         else
10406                 echo "Your C compiler supports __attribute__((nonnull))."
10407                 val="$define"
10408         fi
10409 else
10410         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10411         val="$undef"
10412 fi
10413 ;;
10414 *) val="$d_attribute_nonnull" ;;
10415 esac
10416 set d_attribute_nonnull
10417 eval $setvar
10418 $rm -f attrib*
10419
10420 : Look for GCC-style attribute noreturn
10421 case "$d_attribute_noreturn" in
10422 '')
10423 echo " "
10424 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10425 $cat >attrib.c <<'EOCP'
10426 #include <stdio.h>
10427 void fall_over_dead( void ) __attribute__((noreturn));
10428 EOCP
10429 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10430         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10431                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10432                 val="$undef"
10433         else
10434                 echo "Your C compiler supports __attribute__((noreturn))."
10435                 val="$define"
10436         fi
10437 else
10438         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10439         val="$undef"
10440 fi
10441 ;;
10442 *) val="$d_attribute_noreturn" ;;
10443 esac
10444 set d_attribute_noreturn
10445 eval $setvar
10446 $rm -f attrib*
10447
10448 : Look for GCC-style attribute pure
10449 case "$d_attribute_pure" in
10450 '')
10451 echo " "
10452 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10453 $cat >attrib.c <<'EOCP'
10454 #include <stdio.h>
10455 int square( int n ) __attribute__((pure));
10456 EOCP
10457 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10458         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10459                 echo "Your C compiler doesn't support __attribute__((pure))."
10460                 val="$undef"
10461         else
10462                 echo "Your C compiler supports __attribute__((pure))."
10463                 val="$define"
10464         fi
10465 else
10466         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10467         val="$undef"
10468 fi
10469 ;;
10470 *) val="$d_attribute_pure" ;;
10471 esac
10472 set d_attribute_pure
10473 eval $setvar
10474 $rm -f attrib*
10475
10476 : Look for GCC-style attribute unused
10477 case "$d_attribute_unused" in
10478 '')
10479 echo " "
10480 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10481 $cat >attrib.c <<'EOCP'
10482 #include <stdio.h>
10483 int do_something( int dummy __attribute__((unused)), int n );
10484 EOCP
10485 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10486         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10487                 echo "Your C compiler doesn't support __attribute__((unused))."
10488                 val="$undef"
10489         else
10490                 echo "Your C compiler supports __attribute__((unused))."
10491                 val="$define"
10492         fi
10493 else
10494         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10495         val="$undef"
10496 fi
10497 ;;
10498 *) val="$d_attribute_unused" ;;
10499 esac
10500 set d_attribute_unused
10501 eval $setvar
10502 $rm -f attrib*
10503
10504 : Look for GCC-style attribute deprecated
10505 case "$d_attribute_deprecated" in
10506 '')
10507 echo " "
10508 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10509 $cat >attrib.c <<'EOCP'
10510 #include <stdio.h>
10511 int I_am_deprecated(void) __attribute__((deprecated));
10512 EOCP
10513 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10514         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10515                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10516                 val="$undef"
10517         else
10518                 echo "Your C compiler supports __attribute__((deprecated))."
10519                 val="$define"
10520         fi
10521 else
10522         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10523         val="$undef"
10524 fi
10525 ;;
10526 *) val="$d_attribute_deprecated" ;;
10527 esac
10528 set d_attribute_deprecated
10529 eval $setvar
10530 $rm -f attrib*
10531
10532 : Look for GCC-style attribute warn_unused_result
10533 case "$d_attribute_warn_unused_result" in
10534 '')
10535 echo " "
10536 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10537 $cat >attrib.c <<'EOCP'
10538 #include <stdio.h>
10539 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10540 EOCP
10541 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10542         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10543                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10544                 val="$undef"
10545         else
10546                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10547                 val="$define"
10548         fi
10549 else
10550         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10551         val="$undef"
10552 fi
10553 ;;
10554 *) val="$d_attribute_warn_unused_result" ;;
10555 esac
10556 set d_attribute_warn_unused_result
10557 eval $setvar
10558 $rm -f attrib*
10559
10560 : see if bcmp exists
10561 set bcmp d_bcmp
10562 eval $inlibc
10563
10564 : see if bcopy exists
10565 set bcopy d_bcopy
10566 eval $inlibc
10567
10568 : see if getpgrp exists
10569 set getpgrp d_getpgrp
10570 eval $inlibc
10571
10572 case "$d_getpgrp" in
10573 "$define")
10574         echo " "
10575         echo "Checking to see which flavor of getpgrp is in use..."
10576         $cat >try.c <<EOP
10577 #$i_unistd I_UNISTD
10578 #include <sys/types.h>
10579 #ifdef I_UNISTD
10580 #  include <unistd.h>
10581 #endif
10582 #$i_stdlib I_STDLIB
10583 #ifdef I_STDLIB
10584 #include <stdlib.h>
10585 #endif
10586 int main()
10587 {
10588         if (getuid() == 0) {
10589                 printf("(I see you are running Configure as super-user...)\n");
10590                 setuid(1);
10591         }
10592 #ifdef TRY_BSD_PGRP
10593         if (getpgrp(1) == 0)
10594                 exit(0);
10595 #else
10596         if (getpgrp() > 0)
10597                 exit(0);
10598 #endif
10599         exit(1);
10600 }
10601 EOP
10602         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10603                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10604                 val="$define"
10605         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10606                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10607                 val="$undef"
10608         else
10609                 echo "I can't seem to compile and run the test program."
10610                 if ./usg; then
10611                         xxx="a USG one, i.e. you use getpgrp()."
10612                 else
10613                         # SVR4 systems can appear rather BSD-ish.
10614                         case "$i_unistd" in
10615                         $undef)
10616                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10617                                 val="$define"
10618                                 ;;
10619                         $define)
10620                                 xxx="probably a USG one, i.e. you use getpgrp()."
10621                                 val="$undef"
10622                                 ;;
10623                         esac
10624                 fi
10625                 echo "Assuming your getpgrp is $xxx" >&4
10626         fi
10627         ;;
10628 *) val="$undef";;
10629 esac
10630 set d_bsdgetpgrp
10631 eval $setvar
10632 $rm_try
10633
10634 : see if setpgrp exists
10635 set setpgrp d_setpgrp
10636 eval $inlibc
10637
10638 case "$d_setpgrp" in
10639 "$define")
10640         echo " "
10641         echo "Checking to see which flavor of setpgrp is in use..."
10642         $cat >try.c <<EOP
10643 #$i_unistd I_UNISTD
10644 #include <sys/types.h>
10645 #ifdef I_UNISTD
10646 #  include <unistd.h>
10647 #endif
10648 #$i_stdlib I_STDLIB
10649 #ifdef I_STDLIB
10650 #include <stdlib.h>
10651 #endif
10652 int main()
10653 {
10654         if (getuid() == 0) {
10655                 printf("(I see you are running Configure as super-user...)\n");
10656                 setuid(1);
10657         }
10658 #ifdef TRY_BSD_PGRP
10659         if (-1 == setpgrp(1, 1))
10660                 exit(0);
10661 #else
10662         if (setpgrp() != -1)
10663                 exit(0);
10664 #endif
10665         exit(1);
10666 }
10667 EOP
10668         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10669                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10670                 val="$define"
10671         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10672                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10673                 val="$undef"
10674         else
10675                 echo "(I can't seem to compile and run the test program.)"
10676                 if ./usg; then
10677                         xxx="a USG one, i.e. you use setpgrp()."
10678                 else
10679                         # SVR4 systems can appear rather BSD-ish.
10680                         case "$i_unistd" in
10681                         $undef)
10682                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10683                                 val="$define"
10684                                 ;;
10685                         $define)
10686                                 xxx="probably a USG one, i.e. you use setpgrp()."
10687                                 val="$undef"
10688                                 ;;
10689                         esac
10690                 fi
10691                 echo "Assuming your setpgrp is $xxx" >&4
10692         fi
10693         ;;
10694 *) val="$undef";;
10695 esac
10696 set d_bsdsetpgrp
10697 eval $setvar
10698 $rm_try
10699
10700 : Look for GCC-style __builtin_choose_expr
10701 case "$d_builtin_choose_expr" in
10702 '')
10703     echo " "
10704     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10705     $cat >try.c <<'EOCP'
10706 #include <assert.h>
10707 #include <stdlib.h>
10708 #include <stdio.h>
10709
10710 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10711
10712 int main(void) {
10713     assert( SYRINX(1) == 2112 );
10714     assert( SYRINX(1) != 5150 );
10715     assert( SYRINX(0) == 5150 );
10716     assert( SYRINX(0) != 2112 );
10717     puts( "All good!" );
10718     exit(0);
10719 }
10720
10721 EOCP
10722     set try
10723     if eval $compile && $run ./try; then
10724         echo "Your C compiler supports __builtin_choose_expr."
10725         val="$define"
10726     else
10727         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10728         val="$undef"
10729     fi
10730 ;;
10731 *) val="$d_builtin_choose_expr" ;;
10732 esac
10733
10734 set d_builtin_choose_expr
10735 eval $setvar
10736 $rm_try
10737
10738 : Look for GCC-style __builtin_expect
10739 case "$d_builtin_expect" in
10740 '')
10741     echo " "
10742     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10743     $cat >try.c <<'EOCP'
10744 int main(void) {
10745     int n = 50;
10746     if ( __builtin_expect(n, 0) ) n = 1;
10747     /* Remember shell exit code truth is 0, C truth is non-zero */
10748     return !(n == 1);
10749 }
10750 EOCP
10751     set try
10752     if eval $compile && $run ./try; then
10753         echo "Your C compiler supports __builtin_expect."
10754         val="$define"
10755     else
10756         echo "Your C compiler doesn't seem to understand __builtin_expect."
10757         val="$undef"
10758     fi
10759     ;;
10760 *) val="$d_builtin_expect" ;;
10761 esac
10762
10763 set d_builtin_expect
10764 eval $setvar
10765 $rm_try
10766
10767 : see if bzero exists
10768 set bzero d_bzero
10769 eval $inlibc
10770
10771 : see if stdarg is available
10772 echo " "
10773 if $test `./findhdr stdarg.h`; then
10774         echo "<stdarg.h> found." >&4
10775         valstd="$define"
10776 else
10777         echo "<stdarg.h> NOT found." >&4
10778         valstd="$undef"
10779 fi
10780
10781 : see if varags is available
10782 echo " "
10783 if $test `./findhdr varargs.h`; then
10784         echo "<varargs.h> found." >&4
10785 else
10786         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10787 fi
10788
10789 : set up the varargs testing programs
10790 $cat > varargs.c <<EOP
10791 #ifdef I_STDARG
10792 #include <stdarg.h>
10793 #endif
10794 #ifdef I_VARARGS
10795 #include <varargs.h>
10796 #endif
10797
10798 #ifdef I_STDARG
10799 int f(char *p, ...)
10800 #else
10801 int f(va_alist)
10802 va_dcl
10803 #endif
10804 {
10805         va_list ap;
10806 #ifndef I_STDARG
10807         char *p;
10808 #endif
10809 #ifdef I_STDARG
10810         va_start(ap,p);
10811 #else
10812         va_start(ap);
10813         p = va_arg(ap, char *);
10814 #endif
10815         va_end(ap);
10816         return 0;
10817 }
10818 EOP
10819 $cat > varargs <<EOP
10820 $startsh
10821 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10822         echo "true"
10823 else
10824         echo "false"
10825 fi
10826 $rm -f varargs$_o
10827 EOP
10828 chmod +x varargs
10829
10830 : now check which varargs header should be included
10831 echo " "
10832 i_varhdr=''
10833 case "$valstd" in
10834 "$define")
10835         if `./varargs I_STDARG`; then
10836                 val='stdarg.h'
10837         elif `./varargs I_VARARGS`; then
10838                 val='varargs.h'
10839         fi
10840         ;;
10841 *)
10842         if `./varargs I_VARARGS`; then
10843                 val='varargs.h'
10844         fi
10845         ;;
10846 esac
10847 case "$val" in
10848 '')
10849 echo "I could not find the definition for va_dcl... You have problems..." >&4
10850         val="$undef"; set i_stdarg; eval $setvar
10851         val="$undef"; set i_varargs; eval $setvar
10852         ;;
10853 *)
10854         set i_varhdr
10855         eval $setvar
10856         case "$i_varhdr" in
10857         stdarg.h)
10858                 val="$define"; set i_stdarg; eval $setvar
10859                 val="$undef"; set i_varargs; eval $setvar
10860                 ;;
10861         varargs.h)
10862                 val="$undef"; set i_stdarg; eval $setvar
10863                 val="$define"; set i_varargs; eval $setvar
10864                 ;;
10865         esac
10866         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10867 esac
10868 $rm -f varargs*
10869
10870 : see if the Compiler supports C99 variadic macros
10871 case "$i_stdarg$i_stdlib" in
10872     "$define$define")
10873     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10874     $cat >try.c <<EOCP
10875 #include <stdio.h>
10876 #include <stdarg.h>
10877
10878 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10879
10880 int main() {
10881   char buf[20];
10882   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10883   puts(buf);
10884   return 0;
10885 }
10886 EOCP
10887     set try
10888     if eval $compile && $run ./try 2>&1 >/dev/null; then
10889         case "`$run ./try`" in
10890             "123 456 789")
10891             echo "You have C99 variadic macros." >&4
10892             d_c99_variadic_macros="$define"
10893             ;;
10894             *)
10895             echo "You don't have functional C99 variadic macros." >&4
10896             d_c99_variadic_macros="$undef"
10897             ;;
10898         esac
10899     else
10900         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10901         d_c99_variadic_macros="$undef"
10902     fi
10903     $rm_try
10904     ;;
10905     *)
10906     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10907     d_c99_variadic_macros="$undef"
10908     ;;
10909 esac
10910
10911 : see if signal is declared as pointer to function returning int or void
10912 echo " "
10913 xxx=`./findhdr signal.h`
10914 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10915 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10916         echo "You have int (*signal())() instead of void." >&4
10917         val="$undef"
10918 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10919         echo "You have void (*signal())()." >&4
10920         val="$define"
10921 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10922         echo "You have int (*signal())() instead of void." >&4
10923         val="$undef"
10924 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10925         echo "You have void (*signal())()." >&4
10926         val="$define"
10927 else
10928         case "$d_voidsig" in
10929         '')
10930         echo "I can't determine whether signal handler returns void or int..." >&4
10931                 dflt=void
10932                 rp="What type does your signal handler return?"
10933                 . ./myread
10934                 case "$ans" in
10935                 v*) val="$define";;
10936                 *) val="$undef";;
10937                 esac;;
10938         "$define")
10939                 echo "As you already told me, signal handler returns void." >&4
10940                 val="$define"
10941                 ;;
10942         *)      echo "As you already told me, signal handler returns int." >&4
10943                 val="$undef"
10944                 ;;
10945         esac
10946 fi
10947 set d_voidsig
10948 eval $setvar
10949 case "$d_voidsig" in
10950 "$define") signal_t="void";;
10951 *) signal_t="int";;
10952 esac
10953 $rm -f $$.tmp
10954
10955 : check for ability to cast large floats to 32-bit ints.
10956 echo " "
10957 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10958 if $test "$intsize" -ge 4; then
10959         xxx=int
10960 else
10961         xxx=long
10962 fi
10963 $cat >try.c <<EOCP
10964 #include <stdio.h>
10965 #$i_stdlib I_STDLIB
10966 #ifdef I_STDLIB
10967 #include <stdlib.h>
10968 #endif
10969 #include <sys/types.h>
10970 #include <signal.h>
10971 $signal_t blech(int s) { exit(3); }
10972 int main()
10973 {
10974         $xxx i32;
10975         double f, g;
10976         int result = 0;
10977         char str[16];
10978         signal(SIGFPE, blech);
10979
10980         /* Don't let compiler optimize the test away.  Store the number
10981            in a writable string for gcc to pass to sscanf under HP/UX.
10982         */
10983         sprintf(str, "2147483647");
10984         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10985         g = 10 * f;
10986         i32  = ($xxx) g;
10987
10988         /* x86 processors will probably give 0x8000 0000, which is a
10989            sign change.  We don't want that.  We want to mimic SPARC
10990            behavior here, which is to preserve the sign and give
10991            back 0x7fff ffff.
10992         */
10993         if (i32 != ($xxx) f)
10994                 result |= 1;
10995         exit(result);
10996 }
10997 EOCP
10998 set try
10999 if eval $compile_ok; then
11000         $run ./try
11001         yyy=$?
11002 else
11003         echo "(I can't seem to compile the test program--assuming it can't)"
11004         yyy=1
11005 fi
11006 case "$yyy" in
11007 0)      val="$define"
11008         echo "Yup, it can."
11009         ;;
11010 *)      val="$undef"
11011         echo "Nope, it can't."
11012         ;;
11013 esac
11014 set d_casti32
11015 eval $setvar
11016 $rm_try
11017
11018 : check for ability to cast negative floats to unsigned
11019 echo " "
11020 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11021 $cat >try.c <<EOCP
11022 #include <stdio.h>
11023 #$i_stdlib I_STDLIB
11024 #ifdef I_STDLIB
11025 #include <stdlib.h>
11026 #endif
11027 #include <sys/types.h>
11028 #include <signal.h>
11029 $signal_t blech(int s) { exit(7); }
11030 $signal_t blech_in_list(int s) { exit(4); }
11031 unsigned long dummy_long(unsigned long p) { return p; }
11032 unsigned int dummy_int(unsigned int p) { return p; }
11033 unsigned short dummy_short(unsigned short p) { return p; }
11034 int main()
11035 {
11036         double f;
11037         unsigned long along;
11038         unsigned int aint;
11039         unsigned short ashort;
11040         int result = 0;
11041         char str[16];
11042
11043         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11044            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11045            optimized the whole file away
11046         */
11047         /* Store the number in a writable string for gcc to pass to
11048            sscanf under HP/UX.
11049         */
11050         sprintf(str, "-123");
11051         sscanf(str, "%lf", &f);  /* f = -123.; */
11052
11053         signal(SIGFPE, blech);
11054         along = (unsigned long)f;
11055         aint = (unsigned int)f;
11056         ashort = (unsigned short)f;
11057         if (along != (unsigned long)-123)
11058                 result |= 1;
11059         if (aint != (unsigned int)-123)
11060                 result |= 1;
11061         if (ashort != (unsigned short)-123)
11062                 result |= 1;
11063         sprintf(str, "1073741824.");
11064         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11065         f = f + f;
11066         along = 0;
11067         along = (unsigned long)f;
11068         if (along != 0x80000000)
11069                 result |= 2;
11070         f -= 1.;
11071         along = 0;
11072         along = (unsigned long)f;
11073         if (along != 0x7fffffff)
11074                 result |= 1;
11075         f += 2.;
11076         along = 0;
11077         along = (unsigned long)f;
11078         if (along != 0x80000001)
11079                 result |= 2;
11080         if (result)
11081                 exit(result);
11082         signal(SIGFPE, blech_in_list);
11083         sprintf(str, "123.");
11084         sscanf(str, "%lf", &f);  /* f = 123.; */
11085         along = dummy_long((unsigned long)f);
11086         aint = dummy_int((unsigned int)f);
11087         ashort = dummy_short((unsigned short)f);
11088         if (along != (unsigned long)123)
11089                 result |= 4;
11090         if (aint != (unsigned int)123)
11091                 result |= 4;
11092         if (ashort != (unsigned short)123)
11093                 result |= 4;
11094         exit(result);
11095
11096 }
11097 EOCP
11098 set try
11099 if eval $compile_ok; then
11100         $run ./try
11101         castflags=$?
11102 else
11103         echo "(I can't seem to compile the test program--assuming it can't)"
11104         castflags=7
11105 fi
11106 case "$castflags" in
11107 0)      val="$define"
11108         echo "Yup, it can."
11109         ;;
11110 *)      val="$undef"
11111         echo "Nope, it can't."
11112         ;;
11113 esac
11114 set d_castneg
11115 eval $setvar
11116 $rm_try
11117
11118 : see if vprintf exists
11119 echo " "
11120 if set vprintf val -f d_vprintf; eval $csym; $val; then
11121         echo 'vprintf() found.' >&4
11122         val="$define"
11123         $cat >try.c <<EOF
11124 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11125 #$i_varargs I_VARARGS
11126
11127 #$i_stdlib I_STDLIB
11128 #$i_unistd I_UNISTD
11129
11130 #ifdef I_STDARG
11131 #  include <stdarg.h>
11132 #else /* I_VARARGS */
11133 #  include <varargs.h>
11134 #endif
11135
11136 #ifdef I_UNISTD
11137 #  include <unistd.h>
11138 #endif
11139
11140 #ifdef I_STDLIB
11141 #  include <stdlib.h>
11142 #endif
11143
11144 #include <stdio.h> /* vsprintf prototype */
11145
11146 #ifdef I_STDARG
11147 void xxx(int n, ...)
11148 {
11149     va_list args;
11150     char buf[10];
11151     va_start(args, n);
11152     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11153 }
11154 int main() { xxx(1, "foo"); }
11155
11156 #else /* I_VARARGS */
11157
11158 xxx(va_alist)
11159 va_dcl
11160 {
11161     va_list args;
11162     char buf[10];
11163     va_start(args);
11164     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11165 }
11166 int main() { xxx("foo"); }
11167
11168 #endif
11169
11170 EOF
11171         set try
11172         if eval $compile_ok; then
11173                 if $run ./try; then
11174                         echo "Your vsprintf() returns (int)." >&4
11175                         val2="$undef"
11176                 else
11177                         echo "Your vsprintf() returns (char*)." >&4
11178                         val2="$define"
11179                 fi
11180         else
11181                 echo 'I am unable to compile the vsprintf() test program.' >&4
11182                 # We shouldn't get here.  If we do, assume the standard signature,
11183                 # not the old BSD one.
11184                 echo 'Guessing that vsprintf() returns (int).' >&4
11185                 val2="$undef"
11186         fi
11187 else
11188         echo 'vprintf() NOT found.' >&4
11189         val="$undef"
11190         val2="$undef"
11191 fi
11192 $rm_try
11193 set d_vprintf
11194 eval $setvar
11195 val=$val2
11196 set d_charvspr
11197 eval $setvar
11198
11199 : see if chown exists
11200 set chown d_chown
11201 eval $inlibc
11202
11203 : see if chroot exists
11204 set chroot d_chroot
11205 eval $inlibc
11206
11207 : see if chsize exists
11208 set chsize d_chsize
11209 eval $inlibc
11210
11211 : see if class exists
11212 set class d_class
11213 eval $inlibc
11214
11215 : see if clearenv exists
11216 set clearenv d_clearenv
11217 eval $inlibc
11218
11219 : Define hasstruct macro for Configure internal use
11220 hasstruct='varname=$1; struct=$2; shift; shift;
11221 while $test $# -ge 2; do
11222         case "$1" in
11223         $define) echo "#include <$2>";;
11224         esac ;
11225     shift 2;
11226 done > try.c;
11227 echo "int main () { struct $struct foo; }" >> try.c;
11228 set try;
11229 if eval $compile; then
11230         val="$define";
11231 else
11232         val="$undef";
11233 fi;
11234 set $varname;
11235 eval $setvar;
11236 $rm_try'
11237
11238 : see whether socket exists
11239 socketlib=''
11240 sockethdr=''
11241 echo " "
11242 $echo $n "Hmm... $c" >&4
11243 if set socket val -f d_socket; eval $csym; $val; then
11244         echo "Looks like you have Berkeley networking support." >&4
11245         d_socket="$define"
11246         if set setsockopt val -f; eval $csym; $val; then
11247                 d_oldsock="$undef"
11248         else
11249                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11250                 d_oldsock="$define"
11251         fi
11252 else
11253         if $contains socklib libc.list >/dev/null 2>&1; then
11254                 echo "Looks like you have Berkeley networking support." >&4
11255                 d_socket="$define"
11256                 : we will have to assume that it supports the 4.2 BSD interface
11257                 d_oldsock="$undef"
11258         else
11259                 echo "You don't have Berkeley networking in libc$_a..." >&4
11260                 if test "X$d_socket" = "X$define"; then
11261                    echo "...but you seem to believe that you have sockets." >&4
11262                 else
11263                         for net in net socket
11264                         do
11265                                 if test -f /usr/lib/lib$net$_a; then
11266                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11267                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11268                                         if $contains socket libc.list >/dev/null 2>&1; then
11269                                                 d_socket="$define"
11270                                                 socketlib="-l$net"
11271                                                 case "$net" in
11272                                                 net)
11273                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11274                                                         sockethdr="-I/usr/netinclude"
11275                                                         ;;
11276                                                 esac
11277                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11278                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11279                                                         d_oldsock="$undef"
11280                                                 else
11281                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11282                                                         d_oldsock="$define"
11283                                                 fi
11284                                                 break
11285                                         fi
11286                                 fi
11287                         done
11288                         if test "X$d_socket" != "X$define"; then
11289                            echo "or anywhere else I see." >&4
11290                            d_socket="$undef"
11291                            d_oldsock="$undef"
11292                         fi
11293                 fi
11294         fi
11295 fi
11296
11297 : see if socketpair exists
11298 set socketpair d_sockpair
11299 eval $inlibc
11300
11301
11302 echo " "
11303 echo "Checking the availability of certain socket constants..." >&4
11304 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11305         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11306         $cat >try.c <<EOF
11307 #include <sys/types.h>
11308 #include <sys/socket.h>
11309 int main() {
11310     int i = $ENUM;
11311 }
11312 EOF
11313         val="$undef"
11314         set try; if eval $compile; then
11315                 val="$define"
11316         fi
11317         set d_${enum}; eval $setvar
11318         $rm_try
11319 done
11320
11321 : see if this is a sys/uio.h system
11322 set sys/uio.h i_sysuio
11323 eval $inhdr
11324
11325 : Check for cmsghdr support
11326 echo " "
11327 echo "Checking to see if your system supports struct cmsghdr..." >&4
11328 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11329 eval $hasstruct
11330 case "$d_cmsghdr_s" in
11331 "$define")      echo "Yes, it does."   ;;
11332 *)              echo "No, it doesn't." ;;
11333 esac
11334
11335
11336 : check for const keyword
11337 echo " "
11338 echo 'Checking to see if your C compiler knows about "const"...' >&4
11339 $cat >const.c <<'EOCP'
11340 typedef struct spug { int drokk; } spug;
11341 int main()
11342 {
11343         const char *foo;
11344         const spug y = { 0 };
11345 }
11346 EOCP
11347 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11348         val="$define"
11349         echo "Yup, it does."
11350 else
11351         val="$undef"
11352         echo "Nope, it doesn't."
11353 fi
11354 set d_const
11355 eval $setvar
11356
11357 : see if copysignl exists
11358 set copysignl d_copysignl
11359 eval $inlibc
11360
11361 : see if crypt exists
11362 echo " "
11363 set crypt d_crypt
11364 eval $inlibc
11365 case "$d_crypt" in
11366 $define) cryptlib='' ;;
11367 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11368                 echo 'crypt() found.' >&4
11369                 val="$define"
11370                 cryptlib=''
11371         else
11372                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11373                 if $test -z "$cryptlib"; then
11374                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11375                 else
11376                         cryptlib=-lcrypt
11377                 fi
11378                 if $test -z "$cryptlib"; then
11379                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11380                 else
11381                         cryptlib=-lcrypt
11382                 fi
11383                 if $test -z "$cryptlib"; then
11384                         cryptlib=`./loc libcrypt$_a "" $libpth`
11385                 else
11386                         cryptlib=-lcrypt
11387                 fi
11388                 if $test -z "$cryptlib"; then
11389                         echo 'crypt() NOT found.' >&4
11390                         val="$undef"
11391                 else
11392                         val="$define"
11393                 fi
11394         fi
11395         set d_crypt
11396         eval $setvar
11397         ;;
11398 esac
11399
11400 : see if this is a crypt.h system
11401 set crypt.h i_crypt
11402 eval $inhdr
11403
11404 : see if crypt_r exists
11405 set crypt_r d_crypt_r
11406 eval $inlibc
11407 case "$d_crypt_r" in
11408 "$define")
11409         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11410         case "$d_crypt_r_proto:$usethreads" in
11411         ":define")      d_crypt_r_proto=define
11412                 set d_crypt_r_proto crypt_r $hdrs
11413                 eval $hasproto ;;
11414         *)      ;;
11415         esac
11416         case "$d_crypt_r_proto" in
11417         define)
11418         case "$crypt_r_proto" in
11419         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11420         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11421         esac
11422         case "$crypt_r_proto" in
11423         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11424         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11425         esac
11426         case "$crypt_r_proto" in
11427         ''|0)   d_crypt_r=undef
11428                 crypt_r_proto=0
11429                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11430         * )     case "$crypt_r_proto" in
11431                 REENTRANT_PROTO*) ;;
11432                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11433                 esac
11434                 echo "Prototype: $try" ;;
11435         esac
11436         ;;
11437         *)      case "$usethreads" in
11438                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11439                 esac
11440                 d_crypt_r=undef
11441                 crypt_r_proto=0
11442                 ;;
11443         esac
11444         ;;
11445 *)      crypt_r_proto=0
11446         ;;
11447 esac
11448
11449 : get csh whereabouts
11450 case "$csh" in
11451 'csh') val="$undef" ;;
11452 *) val="$define" ;;
11453 esac
11454 set d_csh
11455 eval $setvar
11456 : Respect a hint or command line value for full_csh.
11457 case "$full_csh" in
11458 '') full_csh=$csh ;;
11459 esac
11460
11461 : see if ctermid exists
11462 set ctermid d_ctermid
11463 eval $inlibc
11464
11465 : see if ctermid_r exists
11466 set ctermid_r d_ctermid_r
11467 eval $inlibc
11468 case "$d_ctermid_r" in
11469 "$define")
11470         hdrs="$i_systypes sys/types.h define stdio.h "
11471         case "$d_ctermid_r_proto:$usethreads" in
11472         ":define")      d_ctermid_r_proto=define
11473                 set d_ctermid_r_proto ctermid_r $hdrs
11474                 eval $hasproto ;;
11475         *)      ;;
11476         esac
11477         case "$d_ctermid_r_proto" in
11478         define)
11479         case "$ctermid_r_proto" in
11480         ''|0) try='char* ctermid_r(char*);'
11481         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11482         esac
11483         case "$ctermid_r_proto" in
11484         ''|0)   d_ctermid_r=undef
11485                 ctermid_r_proto=0
11486                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11487         * )     case "$ctermid_r_proto" in
11488                 REENTRANT_PROTO*) ;;
11489                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11490                 esac
11491                 echo "Prototype: $try" ;;
11492         esac
11493         ;;
11494         *)      case "$usethreads" in
11495                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11496                 esac
11497                 d_ctermid_r=undef
11498                 ctermid_r_proto=0
11499                 ;;
11500         esac
11501         ;;
11502 *)      ctermid_r_proto=0
11503         ;;
11504 esac
11505
11506 : see if ctime_r exists
11507 set ctime_r d_ctime_r
11508 eval $inlibc
11509 case "$d_ctime_r" in
11510 "$define")
11511         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11512         case "$d_ctime_r_proto:$usethreads" in
11513         ":define")      d_ctime_r_proto=define
11514                 set d_ctime_r_proto ctime_r $hdrs
11515                 eval $hasproto ;;
11516         *)      ;;
11517         esac
11518         case "$d_ctime_r_proto" in
11519         define)
11520         case "$ctime_r_proto" in
11521         ''|0) try='char* ctime_r(const time_t*, char*);'
11522         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11523         esac
11524         case "$ctime_r_proto" in
11525         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11526         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11527         esac
11528         case "$ctime_r_proto" in
11529         ''|0) try='int ctime_r(const time_t*, char*);'
11530         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11531         esac
11532         case "$ctime_r_proto" in
11533         ''|0) try='int ctime_r(const time_t*, char*, int);'
11534         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11535         esac
11536         case "$ctime_r_proto" in
11537         ''|0)   d_ctime_r=undef
11538                 ctime_r_proto=0
11539                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11540         * )     case "$ctime_r_proto" in
11541                 REENTRANT_PROTO*) ;;
11542                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11543                 esac
11544                 echo "Prototype: $try" ;;
11545         esac
11546         ;;
11547         *)      case "$usethreads" in
11548                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11549                 esac
11550                 d_ctime_r=undef
11551                 ctime_r_proto=0
11552                 ;;
11553         esac
11554         ;;
11555 *)      ctime_r_proto=0
11556         ;;
11557 esac
11558
11559 : see if cuserid exists
11560 set cuserid d_cuserid
11561 eval $inlibc
11562
11563 : see if this is a limits.h system
11564 set limits.h i_limits
11565 eval $inhdr
11566
11567 : see if this is a float.h system
11568 set float.h i_float
11569 eval $inhdr
11570
11571 : See if number of significant digits in a double precision number is known
11572 echo " "
11573 $cat >dbl_dig.c <<EOM
11574 #$i_limits I_LIMITS
11575 #$i_float I_FLOAT
11576 #ifdef I_LIMITS
11577 #include <limits.h>
11578 #endif
11579 #ifdef I_FLOAT
11580 #include <float.h>
11581 #endif
11582 #ifdef DBL_DIG
11583 printf("Contains DBL_DIG");
11584 #endif
11585 EOM
11586 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11587 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11588         echo "DBL_DIG found." >&4
11589         val="$define"
11590 else
11591         echo "DBL_DIG NOT found." >&4
11592         val="$undef"
11593 fi
11594 $rm -f dbl_dig.?
11595 set d_dbl_dig
11596 eval $setvar
11597
11598 : see if dbm.h is available
11599 : see if dbmclose exists
11600 set dbmclose d_dbmclose
11601 eval $inlibc
11602
11603 case "$d_dbmclose" in
11604 $define)
11605         set dbm.h i_dbm
11606         eval $inhdr
11607         case "$i_dbm" in
11608         $define)
11609                 val="$undef"
11610                 set i_rpcsvcdbm
11611                 eval $setvar
11612                 ;;
11613         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11614                 eval $inhdr
11615                 ;;
11616         esac
11617         ;;
11618 *)      echo "We won't be including <dbm.h>"
11619         val="$undef"
11620         set i_dbm
11621         eval $setvar
11622         val="$undef"
11623         set i_rpcsvcdbm
11624         eval $setvar
11625         ;;
11626 esac
11627
11628 : see if prototype for dbminit is available
11629 echo " "
11630 set d_dbminitproto dbminit $i_dbm dbm.h
11631 eval $hasproto
11632
11633 : see if difftime exists
11634 set difftime d_difftime
11635 eval $inlibc
11636
11637 : see if this is a dirent system
11638 echo " "
11639 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11640         val="$define"
11641         echo "<dirent.h> found." >&4
11642 else
11643         val="$undef"
11644         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11645                 echo "<sys/dir.h> found." >&4
11646                 echo " "
11647         else
11648                 xinc=`./findhdr sys/ndir.h`
11649         fi
11650         echo "<dirent.h> NOT found." >&4
11651 fi
11652 set i_dirent
11653 eval $setvar
11654
11655 : Look for type of directory structure.
11656 echo " "
11657 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11658
11659 case "$direntrytype" in
11660 ''|' ')
11661         case "$i_dirent" in
11662         $define) guess1='struct dirent' ;;
11663         *) guess1='struct direct'  ;;
11664         esac
11665         ;;
11666 *)      guess1="$direntrytype"
11667         ;;
11668 esac
11669
11670 case "$guess1" in
11671 'struct dirent') guess2='struct direct' ;;
11672 *) guess2='struct dirent' ;;
11673 esac
11674
11675 if $contains "$guess1" try.c >/dev/null 2>&1; then
11676         direntrytype="$guess1"
11677         echo "Your directory entries are $direntrytype." >&4
11678 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11679         direntrytype="$guess2"
11680         echo "Your directory entries seem to be $direntrytype." >&4
11681 else
11682         echo "I don't recognize your system's directory entries." >&4
11683         rp="What type is used for directory entries on this system?"
11684         dflt="$guess1"
11685         . ./myread
11686         direntrytype="$ans"
11687 fi
11688 $rm_try
11689
11690 : see if the directory entry stores field length
11691 echo " "
11692 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11693 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11694         echo "Good, your directory entry keeps length information in d_namlen." >&4
11695         val="$define"
11696 else
11697         echo "Your directory entry does not know about the d_namlen field." >&4
11698         val="$undef"
11699 fi
11700 set d_dirnamlen
11701 eval $setvar
11702 $rm_try
11703
11704 : Look for DIR.dd_fd
11705 case "$i_dirent" in
11706 "$define")
11707     echo "Checking to see if DIR has a dd_fd member variable" >&4
11708     $cat >try.c <<EOCP
11709 #$i_stdlib I_STDLIB
11710 #ifdef I_STDLIB
11711 #include <stdlib.h>
11712 #endif
11713 #include <dirent.h>
11714
11715 int main() {
11716     DIR dir;
11717     dir.dd_fd = 1;
11718     return 0;
11719 }
11720 EOCP
11721     val=$undef
11722     set try
11723     if eval $compile; then
11724         echo "Yes, it does."
11725         val="$define"
11726     else
11727         echo "No, it does not."
11728         val="$undef"
11729     fi
11730     ;;
11731 *)
11732     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11733     val="$undef"
11734     ;;
11735 esac
11736 set d_dir_dd_fd
11737 eval $setvar
11738 $rm_try
11739
11740 : see if this is an sysdir system
11741 set sys/dir.h i_sysdir
11742 eval $inhdr
11743
11744 : see if this is an sysndir system
11745 set sys/ndir.h i_sysndir
11746 eval $inhdr
11747
11748 : Look for dirfd
11749 echo " "
11750 $cat >dirfd.c <<EOM
11751 #include <stdio.h>
11752 #$i_stdlib I_STDLIB
11753 #ifdef I_STDLIB
11754 #include <stdlib.h>
11755 #endif
11756 #$i_dirent I_DIRENT             /**/
11757 #$i_sysdir I_SYS_DIR            /**/
11758 #$i_sysndir I_SYS_NDIR          /**/
11759 #$i_systypes I_SYS_TYPES        /**/
11760 #if defined(I_SYS_TYPES)
11761 #include <sys/types.h>
11762 #endif
11763 #if defined(I_DIRENT)
11764 #include <dirent.h>
11765 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11766 #include <sys/dir.h>
11767 #endif
11768 #else
11769 #ifdef I_SYS_NDIR
11770 #include <sys/ndir.h>
11771 #else
11772 #ifdef I_SYS_DIR
11773 #ifdef hp9000s500
11774 #include <ndir.h>       /* may be wrong in the future */
11775 #else
11776 #include <sys/dir.h>
11777 #endif
11778 #endif
11779 #endif
11780 #endif 
11781 int main() {
11782         DIR *dirp = opendir(".");
11783         if (dirfd(dirp) >= 0)
11784                 exit(0);
11785         else
11786                 exit(1);
11787 }
11788 EOM
11789 val=$undef
11790 set dirfd
11791 if eval $compile; then
11792         val="$define"
11793 fi
11794 case "$val" in
11795 $define)        echo "dirfd() found." >&4       ;;
11796 *)              echo "dirfd() NOT found." >&4   ;;
11797 esac
11798 set d_dirfd
11799 eval $setvar
11800 $rm -f dirfd*
11801
11802 : see if dlerror exists
11803 xxx_runnm="$runnm"
11804 runnm=false
11805 set dlerror d_dlerror
11806 eval $inlibc
11807 runnm="$xxx_runnm"
11808
11809 : see if dlfcn is available
11810 set dlfcn.h i_dlfcn
11811 eval $inhdr
11812
11813 : Check what extension to use for shared libs
11814 case "$usedl" in
11815 $define|y|true)
11816         $cat << EOM
11817
11818 On a few systems, the dynamically loaded modules that perl generates and uses
11819 will need a different extension than shared libs. The default will probably
11820 be appropriate.
11821
11822 EOM
11823         case "$dlext" in
11824         '')     dflt="$so" ;;
11825         *)      dflt="$dlext" ;;
11826         esac
11827         rp='What is the extension of dynamically loaded modules'
11828         . ./myread
11829         dlext="$ans"
11830         ;;
11831 *)
11832         dlext="none"
11833         ;;
11834 esac
11835
11836 : Check if dlsym need a leading underscore
11837 echo " "
11838 val="$undef"
11839
11840 case "$dlsrc" in
11841 dl_dlopen.xs)
11842         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11843         $cat >dyna.c <<'EOM'
11844 fred () { }
11845 EOM
11846
11847 $cat >fred.c<<EOM
11848
11849 #include <stdio.h>
11850 #$i_stdlib I_STDLIB
11851 #ifdef I_STDLIB
11852 #include <stdlib.h>
11853 #endif
11854 #$i_dlfcn I_DLFCN
11855 #ifdef I_DLFCN
11856 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11857 #else
11858 #include <sys/types.h>
11859 #include <nlist.h>
11860 #include <link.h>
11861 #endif
11862
11863 extern int fred() ;
11864
11865 int main()
11866 {
11867     void * handle ;
11868     void * symbol ;
11869 #ifndef RTLD_LAZY
11870     int mode = 1 ;
11871 #else
11872     int mode = RTLD_LAZY ;
11873 #endif
11874     handle = dlopen("./dyna.$dlext", mode) ;
11875     if (handle == NULL) {
11876         printf ("1\n") ;
11877         fflush (stdout) ;
11878         exit(0);
11879     }
11880     symbol = dlsym(handle, "fred") ;
11881     if (symbol == NULL) {
11882         /* try putting a leading underscore */
11883         symbol = dlsym(handle, "_fred") ;
11884         if (symbol == NULL) {
11885             printf ("2\n") ;
11886             fflush (stdout) ;
11887             exit(0);
11888         }
11889         printf ("3\n") ;
11890     }
11891     else
11892         printf ("4\n") ;
11893     fflush (stdout) ;
11894     exit(0);
11895 }
11896 EOM
11897         : Call the object file tmp-dyna.o in case dlext=o.
11898         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11899                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11900                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11901                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11902                 xxx=`$run ./fred`
11903                 case $xxx in
11904                 1)      echo "Test program failed using dlopen." >&4
11905                         echo "Perhaps you should not use dynamic loading." >&4;;
11906                 2)      echo "Test program failed using dlsym." >&4
11907                         echo "Perhaps you should not use dynamic loading." >&4;;
11908                 3)      echo "dlsym needs a leading underscore" >&4
11909                         val="$define" ;;
11910                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11911                 esac
11912         else
11913                 echo "I can't compile and run the test program." >&4
11914                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11915         fi
11916         ;;
11917 esac
11918
11919 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11920
11921 set d_dlsymun
11922 eval $setvar
11923
11924 : see if drand48_r exists
11925 set drand48_r d_drand48_r
11926 eval $inlibc
11927 case "$d_drand48_r" in
11928 "$define")
11929         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11930         case "$d_drand48_r_proto:$usethreads" in
11931         ":define")      d_drand48_r_proto=define
11932                 set d_drand48_r_proto drand48_r $hdrs
11933                 eval $hasproto ;;
11934         *)      ;;
11935         esac
11936         case "$d_drand48_r_proto" in
11937         define)
11938         case "$drand48_r_proto" in
11939         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11940         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11941         esac
11942         case "$drand48_r_proto" in
11943         ''|0)   d_drand48_r=undef
11944                 drand48_r_proto=0
11945                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11946         * )     case "$drand48_r_proto" in
11947                 REENTRANT_PROTO*) ;;
11948                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11949                 esac
11950                 echo "Prototype: $try" ;;
11951         esac
11952         ;;
11953         *)      case "$usethreads" in
11954                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11955                 esac
11956                 d_drand48_r=undef
11957                 drand48_r_proto=0
11958                 ;;
11959         esac
11960         ;;
11961 *)      drand48_r_proto=0
11962         ;;
11963 esac
11964
11965 : see if prototype for drand48 is available
11966 echo " "
11967 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11968 eval $hasproto
11969
11970 : see if dup2 exists
11971 set dup2 d_dup2
11972 eval $inlibc
11973
11974 : see if eaccess exists
11975 set eaccess d_eaccess
11976 eval $inlibc
11977
11978 : see if endgrent exists
11979 set endgrent d_endgrent
11980 eval $inlibc
11981
11982 : see if this is an grp system
11983 set grp.h i_grp
11984 eval $inhdr
11985
11986 case "$i_grp" in
11987 $define)
11988         xxx=`./findhdr grp.h`
11989         $cppstdin $cppflags $cppminus < $xxx >$$.h
11990
11991         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11992                 val="$define"
11993         else
11994                 val="$undef"
11995         fi
11996         set d_grpasswd
11997         eval $setvar
11998
11999         $rm -f $$.h
12000         ;;
12001 *)
12002         val="$undef";
12003         set d_grpasswd; eval $setvar
12004         ;;
12005 esac
12006
12007 : see if endgrent_r exists
12008 set endgrent_r d_endgrent_r
12009 eval $inlibc
12010 case "$d_endgrent_r" in
12011 "$define")
12012         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12013         case "$d_endgrent_r_proto:$usethreads" in
12014         ":define")      d_endgrent_r_proto=define
12015                 set d_endgrent_r_proto endgrent_r $hdrs
12016                 eval $hasproto ;;
12017         *)      ;;
12018         esac
12019         case "$d_endgrent_r_proto" in
12020         define)
12021         case "$endgrent_r_proto" in
12022         ''|0) try='int endgrent_r(FILE**);'
12023         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12024         esac
12025         case "$endgrent_r_proto" in
12026         ''|0) try='void endgrent_r(FILE**);'
12027         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12028         esac
12029         case "$endgrent_r_proto" in
12030         ''|0)   d_endgrent_r=undef
12031                 endgrent_r_proto=0
12032                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12033         * )     case "$endgrent_r_proto" in
12034                 REENTRANT_PROTO*) ;;
12035                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12036                 esac
12037                 echo "Prototype: $try" ;;
12038         esac
12039         ;;
12040         *)      case "$usethreads" in
12041                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12042                 esac
12043                 d_endgrent_r=undef
12044                 endgrent_r_proto=0
12045                 ;;
12046         esac
12047         ;;
12048 *)      endgrent_r_proto=0
12049         ;;
12050 esac
12051
12052 : see if endhostent exists
12053 set endhostent d_endhent
12054 eval $inlibc
12055
12056 : see if this is a netdb.h system
12057 set netdb.h i_netdb
12058 eval $inhdr
12059
12060 : see if endhostent_r exists
12061 set endhostent_r d_endhostent_r
12062 eval $inlibc
12063 case "$d_endhostent_r" in
12064 "$define")
12065         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12066         case "$d_endhostent_r_proto:$usethreads" in
12067         ":define")      d_endhostent_r_proto=define
12068                 set d_endhostent_r_proto endhostent_r $hdrs
12069                 eval $hasproto ;;
12070         *)      ;;
12071         esac
12072         case "$d_endhostent_r_proto" in
12073         define)
12074         case "$endhostent_r_proto" in
12075         ''|0) try='int endhostent_r(struct hostent_data*);'
12076         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12077         esac
12078         case "$endhostent_r_proto" in
12079         ''|0) try='void endhostent_r(struct hostent_data*);'
12080         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12081         esac
12082         case "$endhostent_r_proto" in
12083         ''|0)   d_endhostent_r=undef
12084                 endhostent_r_proto=0
12085                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12086         * )     case "$endhostent_r_proto" in
12087                 REENTRANT_PROTO*) ;;
12088                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12089                 esac
12090                 echo "Prototype: $try" ;;
12091         esac
12092         ;;
12093         *)      case "$usethreads" in
12094                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12095                 esac
12096                 d_endhostent_r=undef
12097                 endhostent_r_proto=0
12098                 ;;
12099         esac
12100         ;;
12101 *)      endhostent_r_proto=0
12102         ;;
12103 esac
12104
12105 : see if endnetent exists
12106 set endnetent d_endnent
12107 eval $inlibc
12108
12109 : see if endnetent_r exists
12110 set endnetent_r d_endnetent_r
12111 eval $inlibc
12112 case "$d_endnetent_r" in
12113 "$define")
12114         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12115         case "$d_endnetent_r_proto:$usethreads" in
12116         ":define")      d_endnetent_r_proto=define
12117                 set d_endnetent_r_proto endnetent_r $hdrs
12118                 eval $hasproto ;;
12119         *)      ;;
12120         esac
12121         case "$d_endnetent_r_proto" in
12122         define)
12123         case "$endnetent_r_proto" in
12124         ''|0) try='int endnetent_r(struct netent_data*);'
12125         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12126         esac
12127         case "$endnetent_r_proto" in
12128         ''|0) try='void endnetent_r(struct netent_data*);'
12129         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12130         esac
12131         case "$endnetent_r_proto" in
12132         ''|0)   d_endnetent_r=undef
12133                 endnetent_r_proto=0
12134                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12135         * )     case "$endnetent_r_proto" in
12136                 REENTRANT_PROTO*) ;;
12137                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12138                 esac
12139                 echo "Prototype: $try" ;;
12140         esac
12141         ;;
12142         *)      case "$usethreads" in
12143                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12144                 esac
12145                 d_endnetent_r=undef
12146                 endnetent_r_proto=0
12147                 ;;
12148         esac
12149         ;;
12150 *)      endnetent_r_proto=0
12151         ;;
12152 esac
12153
12154 : see if endprotoent exists
12155 set endprotoent d_endpent
12156 eval $inlibc
12157
12158 : see if endprotoent_r exists
12159 set endprotoent_r d_endprotoent_r
12160 eval $inlibc
12161 case "$d_endprotoent_r" in
12162 "$define")
12163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12164         case "$d_endprotoent_r_proto:$usethreads" in
12165         ":define")      d_endprotoent_r_proto=define
12166                 set d_endprotoent_r_proto endprotoent_r $hdrs
12167                 eval $hasproto ;;
12168         *)      ;;
12169         esac
12170         case "$d_endprotoent_r_proto" in
12171         define)
12172         case "$endprotoent_r_proto" in
12173         ''|0) try='int endprotoent_r(struct protoent_data*);'
12174         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12175         esac
12176         case "$endprotoent_r_proto" in
12177         ''|0) try='void endprotoent_r(struct protoent_data*);'
12178         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12179         esac
12180         case "$endprotoent_r_proto" in
12181         ''|0)   d_endprotoent_r=undef
12182                 endprotoent_r_proto=0
12183                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12184         * )     case "$endprotoent_r_proto" in
12185                 REENTRANT_PROTO*) ;;
12186                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12187                 esac
12188                 echo "Prototype: $try" ;;
12189         esac
12190         ;;
12191         *)      case "$usethreads" in
12192                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12193                 esac
12194                 d_endprotoent_r=undef
12195                 endprotoent_r_proto=0
12196                 ;;
12197         esac
12198         ;;
12199 *)      endprotoent_r_proto=0
12200         ;;
12201 esac
12202
12203 : see if endpwent exists
12204 set endpwent d_endpwent
12205 eval $inlibc
12206
12207 : see if this is a pwd.h system
12208 set pwd.h i_pwd
12209 eval $inhdr
12210
12211 case "$i_pwd" in
12212 $define)
12213         xxx=`./findhdr pwd.h`
12214         $cppstdin $cppflags $cppminus < $xxx >$$.h
12215
12216         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12217                 val="$define"
12218         else
12219                 val="$undef"
12220         fi
12221         set d_pwquota
12222         eval $setvar
12223
12224         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12225                 val="$define"
12226         else
12227                 val="$undef"
12228         fi
12229         set d_pwage
12230         eval $setvar
12231
12232         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12233                 val="$define"
12234         else
12235                 val="$undef"
12236         fi
12237         set d_pwchange
12238         eval $setvar
12239
12240         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12241                 val="$define"
12242         else
12243                 val="$undef"
12244         fi
12245         set d_pwclass
12246         eval $setvar
12247
12248         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12249                 val="$define"
12250         else
12251                 val="$undef"
12252         fi
12253         set d_pwexpire
12254         eval $setvar
12255
12256         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12257                 val="$define"
12258         else
12259                 val="$undef"
12260         fi
12261         set d_pwcomment
12262         eval $setvar
12263
12264         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12265                 val="$define"
12266         else
12267                 val="$undef"
12268         fi
12269         set d_pwgecos
12270         eval $setvar
12271
12272         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12273                 val="$define"
12274         else
12275                 val="$undef"
12276         fi
12277         set d_pwpasswd
12278         eval $setvar
12279
12280         $rm -f $$.h
12281         ;;
12282 *)
12283         val="$undef"; 
12284         set d_pwquota; eval $setvar
12285         set d_pwage; eval $setvar
12286         set d_pwchange; eval $setvar
12287         set d_pwclass; eval $setvar
12288         set d_pwexpire; eval $setvar
12289         set d_pwcomment; eval $setvar
12290         set d_pwgecos; eval $setvar
12291         set d_pwpasswd; eval $setvar
12292         ;;
12293 esac
12294
12295 : see if endpwent_r exists
12296 set endpwent_r d_endpwent_r
12297 eval $inlibc
12298 case "$d_endpwent_r" in
12299 "$define")
12300         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12301         case "$d_endpwent_r_proto:$usethreads" in
12302         ":define")      d_endpwent_r_proto=define
12303                 set d_endpwent_r_proto endpwent_r $hdrs
12304                 eval $hasproto ;;
12305         *)      ;;
12306         esac
12307         case "$d_endpwent_r_proto" in
12308         define)
12309         case "$endpwent_r_proto" in
12310         ''|0) try='int endpwent_r(FILE**);'
12311         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12312         esac
12313         case "$endpwent_r_proto" in
12314         ''|0) try='void endpwent_r(FILE**);'
12315         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12316         esac
12317         case "$endpwent_r_proto" in
12318         ''|0)   d_endpwent_r=undef
12319                 endpwent_r_proto=0
12320                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12321         * )     case "$endpwent_r_proto" in
12322                 REENTRANT_PROTO*) ;;
12323                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12324                 esac
12325                 echo "Prototype: $try" ;;
12326         esac
12327         ;;
12328         *)      case "$usethreads" in
12329                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12330                 esac
12331                 d_endpwent_r=undef
12332                 endpwent_r_proto=0
12333                 ;;
12334         esac
12335         ;;
12336 *)      endpwent_r_proto=0
12337         ;;
12338 esac
12339
12340 : see if endservent exists
12341 set endservent d_endsent
12342 eval $inlibc
12343
12344 : see if endservent_r exists
12345 set endservent_r d_endservent_r
12346 eval $inlibc
12347 case "$d_endservent_r" in
12348 "$define")
12349         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12350         case "$d_endservent_r_proto:$usethreads" in
12351         ":define")      d_endservent_r_proto=define
12352                 set d_endservent_r_proto endservent_r $hdrs
12353                 eval $hasproto ;;
12354         *)      ;;
12355         esac
12356         case "$d_endservent_r_proto" in
12357         define)
12358         case "$endservent_r_proto" in
12359         ''|0) try='int endservent_r(struct servent_data*);'
12360         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12361         esac
12362         case "$endservent_r_proto" in
12363         ''|0) try='void endservent_r(struct servent_data*);'
12364         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12365         esac
12366         case "$endservent_r_proto" in
12367         ''|0)   d_endservent_r=undef
12368                 endservent_r_proto=0
12369                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12370         * )     case "$endservent_r_proto" in
12371                 REENTRANT_PROTO*) ;;
12372                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12373                 esac
12374                 echo "Prototype: $try" ;;
12375         esac
12376         ;;
12377         *)      case "$usethreads" in
12378                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12379                 esac
12380                 d_endservent_r=undef
12381                 endservent_r_proto=0
12382                 ;;
12383         esac
12384         ;;
12385 *)      endservent_r_proto=0
12386         ;;
12387 esac
12388
12389 : Locate the flags for 'open()'
12390 echo " "
12391 $cat >try.c <<EOCP
12392 #include <sys/types.h>
12393 #ifdef I_FCNTL
12394 #include <fcntl.h>
12395 #endif
12396 #ifdef I_SYS_FILE
12397 #include <sys/file.h>
12398 #endif
12399 #$i_stdlib I_STDLIB
12400 #ifdef I_STDLIB
12401 #include <stdlib.h>
12402 #endif
12403 int main() {
12404         if(O_RDONLY);
12405 #ifdef O_TRUNC
12406         exit(0);
12407 #else
12408         exit(1);
12409 #endif
12410 }
12411 EOCP
12412 : check sys/file.h first to get FREAD on Sun
12413 if $test `./findhdr sys/file.h` && \
12414                 set try -DI_SYS_FILE && eval $compile; then
12415         h_sysfile=true;
12416         echo "<sys/file.h> defines the O_* constants..." >&4
12417         if $run ./try; then
12418                 echo "and you have the 3 argument form of open()." >&4
12419                 val="$define"
12420         else
12421                 echo "but not the 3 argument form of open().  Oh, well." >&4
12422                 val="$undef"
12423         fi
12424 elif $test `./findhdr fcntl.h` && \
12425                 set try -DI_FCNTL && eval $compile; then
12426         h_fcntl=true;
12427         echo "<fcntl.h> defines the O_* constants..." >&4
12428         if $run ./try; then
12429                 echo "and you have the 3 argument form of open()." >&4
12430                 val="$define"
12431         else
12432                 echo "but not the 3 argument form of open().  Oh, well." >&4
12433                 val="$undef"
12434         fi
12435 else
12436         val="$undef"
12437         echo "I can't find the O_* constant definitions!  You got problems." >&4
12438 fi
12439 set d_open3
12440 eval $setvar
12441 $rm_try
12442
12443 : see if this is a sys/file.h system
12444 val=''
12445 set sys/file.h val
12446 eval $inhdr
12447
12448 : do we need to include sys/file.h ?
12449 case "$val" in
12450 "$define")
12451         echo " "
12452         if $h_sysfile; then
12453                 val="$define"
12454                 echo "We'll be including <sys/file.h>." >&4
12455         else
12456                 val="$undef"
12457                 echo "We won't be including <sys/file.h>." >&4
12458         fi
12459         ;;
12460 *)
12461         h_sysfile=false
12462         ;;
12463 esac
12464 set i_sysfile
12465 eval $setvar
12466
12467 : see if fcntl.h is there
12468 val=''
12469 set fcntl.h val
12470 eval $inhdr
12471
12472 : see if we can include fcntl.h
12473 case "$val" in
12474 "$define")
12475         echo " "
12476         if $h_fcntl; then
12477                 val="$define"
12478                 echo "We'll be including <fcntl.h>." >&4
12479         else
12480                 val="$undef"
12481                 if $h_sysfile; then
12482         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12483                 else
12484                         echo "We won't be including <fcntl.h>." >&4
12485                 fi
12486         fi
12487         ;;
12488 *)
12489         h_fcntl=false
12490         val="$undef"
12491         ;;
12492 esac
12493 set i_fcntl
12494 eval $setvar
12495
12496 : see if fork exists
12497 set fork d_fork
12498 eval $inlibc
12499
12500 : see if pipe exists
12501 set pipe d_pipe
12502 eval $inlibc
12503
12504 : check for non-blocking I/O stuff
12505 case "$h_sysfile" in
12506 true) echo "#include <sys/file.h>" > head.c;;
12507 *)
12508        case "$h_fcntl" in
12509        true) echo "#include <fcntl.h>" > head.c;;
12510        *) echo "#include <sys/fcntl.h>" > head.c;;
12511        esac
12512        ;;
12513 esac
12514 echo " "
12515 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12516 case "$o_nonblock" in
12517 '')
12518         $cat head.c > try.c
12519         $cat >>try.c <<EOCP
12520 #include <stdio.h>
12521 #$i_stdlib I_STDLIB
12522 #ifdef I_STDLIB
12523 #include <stdlib.h>
12524 #endif
12525 #$i_fcntl I_FCNTL
12526 #ifdef I_FCNTL
12527 #include <fcntl.h>
12528 #endif
12529 int main() {
12530 #ifdef O_NONBLOCK
12531         printf("O_NONBLOCK\n");
12532         exit(0);
12533 #endif
12534 #ifdef O_NDELAY
12535         printf("O_NDELAY\n");
12536         exit(0);
12537 #endif
12538 #ifdef FNDELAY
12539         printf("FNDELAY\n");
12540         exit(0);
12541 #endif
12542         exit(0);
12543 }
12544 EOCP
12545         set try
12546         if eval $compile_ok; then
12547                 o_nonblock=`$run ./try`
12548                 case "$o_nonblock" in
12549                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12550                 *) echo "Seems like we can use $o_nonblock.";;
12551                 esac
12552         else
12553                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12554         fi
12555         ;;
12556 *) echo "Using $hint value $o_nonblock.";;
12557 esac
12558 $rm_try
12559
12560 echo " "
12561 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12562 case "$eagain" in
12563 '')
12564         case "$d_fork:$d_pipe" in
12565         define:define)
12566         $cat head.c > try.c
12567         $cat >>try.c <<EOCP
12568 #include <errno.h>
12569 #include <sys/types.h>
12570 #include <signal.h>
12571 #include <stdio.h>
12572 #$i_stdlib I_STDLIB
12573 #ifdef I_STDLIB
12574 #include <stdlib.h>
12575 #endif
12576 #$i_fcntl I_FCNTL
12577 #ifdef I_FCNTL
12578 #include <fcntl.h>
12579 #endif
12580 #define MY_O_NONBLOCK $o_nonblock
12581 #ifndef errno  /* XXX need better Configure test */
12582 extern int errno;
12583 #endif
12584 #$i_unistd I_UNISTD
12585 #ifdef I_UNISTD
12586 #include <unistd.h>
12587 #endif
12588 #$i_string I_STRING
12589 #ifdef I_STRING
12590 #include <string.h>
12591 #else
12592 #include <strings.h>
12593 #endif
12594 $signal_t blech(int x) { exit(3); }
12595 EOCP
12596         $cat >> try.c <<'EOCP'
12597 int main()
12598 {
12599         int pd[2];
12600         int pu[2];
12601         char buf[1];
12602         char string[100];
12603
12604         pipe(pd);       /* Down: child -> parent */
12605         pipe(pu);       /* Up: parent -> child */
12606         if (0 != fork()) {
12607                 int ret;
12608                 close(pd[1]);   /* Parent reads from pd[0] */
12609                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12610 #ifdef F_SETFL
12611                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12612                         exit(1);
12613 #else
12614                 exit(4);
12615 #endif
12616                 signal(SIGALRM, blech);
12617                 alarm(5);
12618                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12619                         exit(2);
12620                 sprintf(string, "%d\n", ret);
12621                 write(2, string, strlen(string));
12622                 alarm(0);
12623 #ifdef EAGAIN
12624                 if (errno == EAGAIN) {
12625                         printf("EAGAIN\n");
12626                         goto ok;
12627                 }
12628 #endif
12629 #ifdef EWOULDBLOCK
12630                 if (errno == EWOULDBLOCK)
12631                         printf("EWOULDBLOCK\n");
12632 #endif
12633         ok:
12634                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12635                 sleep(2);                               /* Give it time to close our pipe */
12636                 alarm(5);
12637                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12638                 alarm(0);
12639                 sprintf(string, "%d\n", ret);
12640                 write(4, string, strlen(string));
12641                 exit(0);
12642         }
12643
12644         close(pd[0]);                   /* We write to pd[1] */
12645         close(pu[1]);                   /* We read from pu[0] */
12646         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12647         close(pd[1]);                   /* Pipe pd is now fully closed! */
12648         exit(0);                                /* Bye bye, thank you for playing! */
12649 }
12650 EOCP
12651         set try
12652         if eval $compile_ok; then
12653                 echo "$startsh" >mtry
12654                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12655                 chmod +x mtry
12656                 ./mtry >/dev/null 2>&1
12657                 case $? in
12658                 0) eagain=`$cat try.out`;;
12659                 1) echo "Could not perform non-blocking setting!";;
12660                 2) echo "I did a successful read() for something that was not there!";;
12661                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12662                 4) echo "Could not find F_SETFL!";;
12663                 *) echo "Something terribly wrong happened during testing.";;
12664                 esac
12665                 rd_nodata=`$cat try.ret`
12666                 echo "A read() system call with no data present returns $rd_nodata."
12667                 case "$rd_nodata" in
12668                 0|-1) ;;
12669                 *)
12670                         echo "(That's peculiar, fixing that to be -1.)"
12671                         rd_nodata=-1
12672                         ;;
12673                 esac
12674                 case "$eagain" in
12675                 '')
12676                         echo "Forcing errno EAGAIN on read() with no data available."
12677                         eagain=EAGAIN
12678                         ;;
12679                 *)
12680                         echo "Your read() sets errno to $eagain when no data is available."
12681                         ;;
12682                 esac
12683                 status=`$cat try.err`
12684                 case "$status" in
12685                 0) echo "And it correctly returns 0 to signal EOF.";;
12686                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12687                 *) echo "However, your read() returns '$status' on EOF??";;
12688                 esac
12689                 val="$define"
12690                 if test "$status" = "$rd_nodata"; then
12691                         echo "WARNING: you can't distinguish between EOF and no data!"
12692                         val="$undef"
12693                 fi
12694         else
12695                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12696                 eagain=EAGAIN
12697         fi
12698         ;;
12699         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12700                 eagain=EAGAIN
12701                 val="$define"
12702                 ;;
12703         esac
12704         set d_eofnblk
12705         eval $setvar
12706         ;;
12707 *)
12708         echo "Using $hint value $eagain."
12709         echo "Your read() returns $rd_nodata when no data is present."
12710         case "$d_eofnblk" in
12711         "$define") echo "And you can see EOF because read() returns 0.";;
12712         "$undef") echo "But you can't see EOF status from read() returned value.";;
12713         *)
12714                 echo "(Assuming you can't see EOF status from read anyway.)"
12715                 d_eofnblk=$undef
12716                 ;;
12717         esac
12718         ;;
12719 esac
12720 $rm_try head.c mtry
12721
12722 : see if _ptr and _cnt from stdio act std
12723 echo " "
12724
12725 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12726         echo "(Looks like you have stdio.h from BSD.)"
12727         case "$stdio_ptr" in
12728         '') stdio_ptr='((fp)->_p)'
12729                 ptr_lval=$define
12730                 ;;
12731         *)      ptr_lval=$d_stdio_ptr_lval;;
12732         esac
12733         case "$stdio_cnt" in
12734         '') stdio_cnt='((fp)->_r)'
12735                 cnt_lval=$define
12736                 ;;
12737         *)      cnt_lval=$d_stdio_cnt_lval;;
12738         esac
12739         case "$stdio_base" in
12740         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12741         esac
12742         case "$stdio_bufsiz" in
12743         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12744         esac
12745 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12746         echo "(Looks like you have stdio.h from Linux.)"
12747         case "$stdio_ptr" in
12748         '') stdio_ptr='((fp)->_IO_read_ptr)'
12749                 ptr_lval=$define
12750                 ;;
12751         *)      ptr_lval=$d_stdio_ptr_lval;;
12752         esac
12753         case "$stdio_cnt" in
12754         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12755                 cnt_lval=$undef
12756                 ;;
12757         *)      cnt_lval=$d_stdio_cnt_lval;;
12758         esac
12759         case "$stdio_base" in
12760         '') stdio_base='((fp)->_IO_read_base)';;
12761         esac
12762         case "$stdio_bufsiz" in
12763         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12764         esac
12765 else
12766         case "$stdio_ptr" in
12767         '') stdio_ptr='((fp)->_ptr)'
12768                 ptr_lval=$define
12769                 ;;
12770         *)      ptr_lval=$d_stdio_ptr_lval;;
12771         esac
12772         case "$stdio_cnt" in
12773         '') stdio_cnt='((fp)->_cnt)'
12774                 cnt_lval=$define
12775                 ;;
12776         *)      cnt_lval=$d_stdio_cnt_lval;;
12777         esac
12778         case "$stdio_base" in
12779         '') stdio_base='((fp)->_base)';;
12780         esac
12781         case "$stdio_bufsiz" in
12782         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12783         esac
12784 fi
12785
12786 : test whether _ptr and _cnt really work
12787 echo "Checking how std your stdio is..." >&4
12788 $cat >try.c <<EOP
12789 #include <stdio.h>
12790 #$i_stdlib I_STDLIB
12791 #ifdef I_STDLIB
12792 #include <stdlib.h>
12793 #endif
12794 #define FILE_ptr(fp)    $stdio_ptr
12795 #define FILE_cnt(fp)    $stdio_cnt
12796 int main() {
12797         FILE *fp = fopen("try.c", "r");
12798         char c = getc(fp);
12799         if (
12800                 18 <= FILE_cnt(fp) &&
12801                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12802         )
12803                 exit(0);
12804         exit(1);
12805 }
12806 EOP
12807 val="$undef"
12808 set try
12809 if eval $compile && $to try.c; then
12810         if $run ./try; then
12811                 echo "Your stdio acts pretty std."
12812                 val="$define"
12813         else
12814                 echo "Your stdio isn't very std."
12815         fi
12816 else
12817         echo "Your stdio doesn't appear very std."
12818 fi
12819 $rm_try
12820
12821 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12822 # direct buffer manipulation no longer works.  The Configure tests
12823 # should be changed to correctly detect this, but until then,
12824 # the following check should at least let perl compile and run.
12825 # (This quick fix should be updated before 5.8.1.)
12826 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12827 # A. Dougherty, June 3, 2002.
12828 case "$d_gnulibc" in
12829 $define)
12830         case "$gnulibc_version" in
12831         2.[01]*)  ;;
12832         2.2) ;;
12833         2.2.[0-9]) ;;
12834         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12835                 val="$undef"
12836                 ;;
12837         esac
12838         ;;
12839 esac
12840 set d_stdstdio
12841 eval $setvar
12842
12843 : Can _ptr be used as an lvalue?
12844 case "$d_stdstdio$ptr_lval" in
12845 $define$define) val=$define ;;
12846 *) val=$undef ;;
12847 esac
12848 set d_stdio_ptr_lval
12849 eval $setvar
12850
12851 : Can _cnt be used as an lvalue?
12852 case "$d_stdstdio$cnt_lval" in
12853 $define$define) val=$define ;;
12854 *) val=$undef ;;
12855 esac
12856 set d_stdio_cnt_lval
12857 eval $setvar
12858
12859
12860 : test whether setting _ptr sets _cnt as a side effect
12861 d_stdio_ptr_lval_sets_cnt="$undef"
12862 d_stdio_ptr_lval_nochange_cnt="$undef"
12863 case "$d_stdio_ptr_lval$d_stdstdio" in
12864 $define$define)
12865         echo "Checking to see what happens if we set the stdio ptr..." >&4
12866 $cat >try.c <<EOP
12867 #include <stdio.h>
12868 /* Can we scream? */
12869 /* Eat dust sed :-) */
12870 /* In the buffer space, no one can hear you scream. */
12871 #$i_stdlib I_STDLIB
12872 #ifdef I_STDLIB
12873 #include <stdlib.h>
12874 #endif
12875 #define FILE_ptr(fp)    $stdio_ptr
12876 #define FILE_cnt(fp)    $stdio_cnt
12877 #include <sys/types.h>
12878 int main() {
12879         FILE *fp = fopen("try.c", "r");
12880         int c;
12881         char *ptr;
12882         size_t cnt;
12883         if (!fp) {
12884             puts("Fail even to read");
12885             exit(1);
12886         }
12887         c = getc(fp); /* Read away the first # */
12888         if (c == EOF) {
12889             puts("Fail even to read");
12890             exit(1);
12891         }
12892         if (!(
12893                 18 <= FILE_cnt(fp) &&
12894                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12895         )) {
12896                 puts("Fail even to read");
12897                 exit (1);
12898         }
12899         ptr = (char*) FILE_ptr(fp);
12900         cnt = (size_t)FILE_cnt(fp);
12901
12902         FILE_ptr(fp) += 42;
12903
12904         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12905                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12906                 exit (1);
12907         }
12908         if (FILE_cnt(fp) <= 20) {
12909                 printf ("Fail (<20 chars to test)");
12910                 exit (1);
12911         }
12912         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12913                 puts("Fail compare");
12914                 exit (1);
12915         }
12916         if (cnt == FILE_cnt(fp)) {
12917                 puts("Pass_unchanged");
12918                 exit (0);
12919         }
12920         if (FILE_cnt(fp) == (cnt - 42)) {
12921                 puts("Pass_changed");
12922                 exit (0);
12923         }
12924         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12925         return 1;
12926
12927 }
12928 EOP
12929         set try
12930         if eval $compile && $to try.c; then
12931                 case `$run ./try` in
12932                 Pass_changed)
12933                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12934                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12935                 Pass_unchanged)
12936                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12937                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12938                 Fail*)
12939                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12940                 *)
12941                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12942         esac
12943         else
12944                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12945         fi
12946         $rm_try
12947         ;;
12948 esac
12949
12950 : see if _base is also standard
12951 val="$undef"
12952 case "$d_stdstdio" in
12953 $define)
12954         $cat >try.c <<EOP
12955 #include <stdio.h>
12956 #$i_stdlib I_STDLIB
12957 #ifdef I_STDLIB
12958 #include <stdlib.h>
12959 #endif
12960 #define FILE_base(fp)   $stdio_base
12961 #define FILE_bufsiz(fp) $stdio_bufsiz
12962 int main() {
12963         FILE *fp = fopen("try.c", "r");
12964         char c = getc(fp);
12965         if (
12966                 19 <= FILE_bufsiz(fp) &&
12967                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12968         )
12969                 exit(0);
12970         exit(1);
12971 }
12972 EOP
12973         set try
12974         if eval $compile && $to try.c; then
12975                 if $run ./try; then
12976                         echo "And its _base field acts std."
12977                         val="$define"
12978                 else
12979                         echo "But its _base field isn't std."
12980                 fi
12981         else
12982                 echo "However, it seems to be lacking the _base field."
12983         fi
12984         $rm_try
12985         ;;
12986 esac
12987 set d_stdiobase
12988 eval $setvar
12989
12990 : see if fast_stdio exists
12991 val="$undef"
12992 case "$d_stdstdio:$d_stdio_ptr_lval" in
12993 "$define:$define")
12994         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12995         *$define*)
12996                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12997                 val="$define"
12998                 ;;
12999         esac
13000         ;;
13001 esac
13002 set d_faststdio
13003 eval $setvar
13004
13005
13006
13007 : see if fchdir exists
13008 set fchdir d_fchdir
13009 eval $inlibc
13010
13011 : see if fchmod exists
13012 set fchmod d_fchmod
13013 eval $inlibc
13014
13015 : see if fchown exists
13016 set fchown d_fchown
13017 eval $inlibc
13018
13019 : see if this is an fcntl system
13020 set fcntl d_fcntl
13021 eval $inlibc
13022
13023 : See if fcntl-based locking works.
13024 echo " "
13025 $cat >try.c <<EOCP
13026 #$i_stdlib I_STDLIB
13027 #ifdef I_STDLIB
13028 #include <stdlib.h>
13029 #endif
13030 #include <unistd.h>
13031 #include <fcntl.h>
13032 #include <signal.h>
13033 $signal_t blech(int x) { exit(3); }
13034 int main() {
13035 #if defined(F_SETLK) && defined(F_SETLKW)
13036      struct flock flock;
13037      int retval, fd;
13038      fd = open("try.c", O_RDONLY);
13039      flock.l_type = F_RDLCK;
13040      flock.l_whence = SEEK_SET;
13041      flock.l_start = flock.l_len = 0;
13042      signal(SIGALRM, blech);
13043      alarm(10);
13044      retval = fcntl(fd, F_SETLK, &flock);
13045      close(fd);
13046      (retval < 0 ? exit(2) : exit(0));
13047 #else
13048      exit(2);
13049 #endif
13050 }
13051 EOCP
13052 echo "Checking if fcntl-based file locking works... "
13053 case "$d_fcntl" in
13054 "$define")
13055         set try
13056         if eval $compile_ok; then
13057                 if $run ./try; then
13058                         echo "Yes, it seems to work."
13059                         val="$define"
13060                 else
13061                         echo "Nope, it didn't work."
13062                         val="$undef"
13063                         case "$?" in
13064                         3) $cat >&4 <<EOM
13065 ***
13066 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13067 *** This is (almost) impossible.
13068 *** If your NFS lock daemons are not feeling well, something like
13069 *** this may happen, please investigate.  Cannot continue, aborting.
13070 ***
13071 EOM
13072                                 exit 1
13073                                 ;;
13074                         esac
13075                 fi
13076         else
13077                 echo "I'm unable to compile the test program, so I'll assume not."
13078                 val="$undef"
13079         fi
13080         ;;
13081 *) val="$undef";
13082         echo "Nope, since you don't even have fcntl()."
13083         ;;
13084 esac
13085 set d_fcntl_can_lock
13086 eval $setvar
13087 $rm_try
13088
13089 : check for fd_set items
13090 $cat <<EOM
13091
13092 Checking to see how well your C compiler handles fd_set and friends ...
13093 EOM
13094 $cat >try.c <<EOCP
13095 #$i_stdlib I_STDLIB
13096 #ifdef I_STDLIB
13097 #include <stdlib.h>
13098 #endif
13099 #$i_systime I_SYS_TIME
13100 #$i_sysselct I_SYS_SELECT
13101 #$d_socket HAS_SOCKET
13102 #include <sys/types.h>
13103 #ifdef HAS_SOCKET
13104 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13105 #endif
13106 #ifdef I_SYS_TIME
13107 #include <sys/time.h>
13108 #endif
13109 #ifdef I_SYS_SELECT
13110 #include <sys/select.h>
13111 #endif
13112 int main() {
13113         fd_set fds;
13114
13115 #ifdef TRYBITS
13116         if(fds.fds_bits);
13117 #endif
13118
13119 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13120         exit(0);
13121 #else
13122         exit(1);
13123 #endif
13124 }
13125 EOCP
13126 set try -DTRYBITS
13127 if eval $compile; then
13128         d_fds_bits="$define"
13129         d_fd_set="$define"
13130         echo "Well, your system knows about the normal fd_set typedef..." >&4
13131         if $run ./try; then
13132                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13133                 d_fd_macros="$define"
13134         else
13135                 $cat >&4 <<'EOM'
13136 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13137 EOM
13138                 d_fd_macros="$undef"
13139         fi
13140 else
13141         $cat <<'EOM'
13142 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13143 EOM
13144         set try
13145         if eval $compile; then
13146                 d_fds_bits="$undef"
13147                 d_fd_set="$define"
13148                 echo "Well, your system has some sort of fd_set available..." >&4
13149                 if $run ./try; then
13150                         echo "and you have the normal fd_set macros." >&4
13151                         d_fd_macros="$define"
13152                 else
13153                         $cat <<'EOM'
13154 but not the normal fd_set macros!  Gross!  More work for me...
13155 EOM
13156                         d_fd_macros="$undef"
13157                 fi
13158         else
13159         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13160                 d_fd_set="$undef"
13161                 d_fds_bits="$undef"
13162                 d_fd_macros="$undef"
13163         fi
13164 fi
13165 $rm_try
13166
13167 : see if fgetpos exists
13168 set fgetpos d_fgetpos
13169 eval $inlibc
13170
13171 : see if finite exists
13172 set finite d_finite
13173 eval $inlibc
13174
13175 : see if finitel exists
13176 set finitel d_finitel
13177 eval $inlibc
13178
13179 : see if flock exists
13180 set flock d_flock
13181 eval $inlibc
13182
13183 : see if prototype for flock is available
13184 echo " "
13185 set d_flockproto flock $i_sysfile sys/file.h
13186 eval $hasproto
13187
13188 : see if fp_class exists
13189 set fp_class d_fp_class
13190 eval $inlibc
13191
13192 : see if pathconf exists
13193 set pathconf d_pathconf
13194 eval $inlibc
13195
13196 : see if fpathconf exists
13197 set fpathconf d_fpathconf
13198 eval $inlibc
13199
13200 : see if fpclass exists
13201 set fpclass d_fpclass
13202 eval $inlibc
13203
13204 : see if fpclassify exists
13205 set fpclassify d_fpclassify
13206 eval $inlibc
13207
13208 : see if fpclassl exists
13209 set fpclassl d_fpclassl
13210 eval $inlibc
13211
13212 : check for fpos64_t
13213 echo " "
13214 echo "Checking to see if you have fpos64_t..." >&4
13215 $cat >try.c <<EOCP
13216 #include <stdio.h>
13217 int main() { fpos64_t x = 7; }
13218 EOCP
13219 set try
13220 if eval $compile; then
13221         val="$define"
13222         echo "You have fpos64_t."
13223 else
13224         val="$undef"
13225         echo "You do not have fpos64_t."
13226         case "$fpossize" in
13227         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13228         esac
13229 fi
13230 $rm_try
13231 set d_fpos64_t
13232 eval $setvar
13233
13234 : see if frexpl exists
13235 set frexpl d_frexpl
13236 eval $inlibc
13237
13238 : see if this is a sys/param system
13239 set sys/param.h i_sysparam
13240 eval $inhdr
13241
13242 : see if this is a sys/mount.h system
13243 set sys/mount.h i_sysmount
13244 eval $inhdr
13245
13246 : Check for fs_data_s
13247 echo " "
13248 echo "Checking to see if your system supports struct fs_data..." >&4
13249 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13250 eval $hasstruct
13251 case "$d_fs_data_s" in
13252 "$define")      echo "Yes, it does."   ;;
13253 *)              echo "No, it doesn't." ;;
13254 esac
13255
13256 : see if fseeko exists
13257 set fseeko d_fseeko
13258 eval $inlibc
13259 case "$longsize" in
13260 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13261 esac
13262
13263 : see if fsetpos exists
13264 set fsetpos d_fsetpos
13265 eval $inlibc
13266
13267 : see if fstatfs exists
13268 set fstatfs d_fstatfs
13269 eval $inlibc
13270
13271 : see if statvfs exists
13272 set statvfs d_statvfs
13273 eval $inlibc
13274
13275 : see if fstatvfs exists
13276 set fstatvfs d_fstatvfs
13277 eval $inlibc
13278
13279
13280 : see if fsync exists
13281 set fsync d_fsync
13282 eval $inlibc
13283
13284 : see if ftello exists
13285 set ftello d_ftello
13286 eval $inlibc
13287 case "$longsize" in
13288 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13289 esac
13290
13291 : check for a working futimes
13292 d_futimes="$undef"
13293 echo " "
13294 echo "Checking if you have a working futimes()" >&4
13295 $cat >try.c <<EOCP
13296 #include <stdio.h>
13297 #include <sys/time.h>
13298 #include <errno.h>
13299 #include <fcntl.h>
13300
13301 int main ()
13302 {
13303     int fd, rv;
13304     fd = open ("try.c", O_RDWR);
13305     if (-1 == fd) exit (1);
13306     rv = futimes (fd, NULL);
13307     exit (rv == -1 ? errno : 0);
13308 }
13309 EOCP
13310 set try
13311 if eval $compile; then
13312     `$run ./try`
13313     rc=$?
13314     case "$rc" in
13315         0)  echo "Yes, you have" >&4
13316             d_futimes="$define"
13317             ;;
13318         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13319             ;;
13320     esac
13321 else
13322     echo "No, it does not (probably harmless)" >&4
13323 fi
13324 $rm_try
13325
13326 : see if ndbm.h is available
13327 set ndbm.h i_ndbm
13328 eval $inhdr
13329 : Compatibility location for RedHat 7.1
13330 set gdbm/ndbm.h i_gdbmndbm
13331 eval $inhdr
13332 : Compatibility location for Debian 4.0
13333 set gdbm-ndbm.h i_gdbm_ndbm
13334 eval $inhdr
13335
13336 val="$undef"
13337 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13338         : see if dbm_open exists
13339         set dbm_open d_dbm_open
13340         eval $inlibc
13341         case "$d_dbm_open" in
13342         $undef)
13343                 i_ndbm="$undef"
13344                 i_gdbmndbm="$undef"
13345                 i_gdbm_ndbm="$undef"
13346                 echo "We won't be including <ndbm.h>"
13347                 val="$undef"
13348                 ;;
13349         *) val="$define"
13350            ;;
13351         esac
13352 fi
13353 set d_ndbm
13354 eval $setvar
13355
13356 ndbm_hdr_protochk='name=$1; hdr=$2;
13357 eval "ihdr=\$""i_$name";
13358 val="$undef";
13359 if $test "$ihdr" = "$define"; then
13360         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13361         case "$d_cplusplus" in
13362         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13363         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13364         esac;
13365         case "$val" in
13366         $define) $echo "Your <$hdr> seems to have prototypes";;
13367         *) $echo "Your <$hdr> does not seem to have prototypes";;
13368         esac;
13369 fi;
13370 set "d_${name}_h_uses_prototypes";
13371 eval $setvar'
13372
13373 set ndbm ndbm.h
13374 eval $ndbm_hdr_protochk
13375 set gdbmndbm gdbm/ndbm.h
13376 eval $ndbm_hdr_protochk
13377 set gdbm_ndbm gdbm-ndbm.h
13378 eval $ndbm_hdr_protochk
13379
13380 : see if getcwd exists
13381 set getcwd d_getcwd
13382 eval $inlibc
13383
13384 : see if getespwnam exists
13385 set getespwnam d_getespwnam
13386 eval $inlibc
13387
13388 : see if getfsstat exists
13389 set getfsstat d_getfsstat
13390 eval $inlibc
13391
13392 : see if getgrent exists
13393 set getgrent d_getgrent
13394 eval $inlibc
13395
13396 : see if getgrent_r exists
13397 set getgrent_r d_getgrent_r
13398 eval $inlibc
13399 case "$d_getgrent_r" in
13400 "$define")
13401         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13402         case "$d_getgrent_r_proto:$usethreads" in
13403         ":define")      d_getgrent_r_proto=define
13404                 set d_getgrent_r_proto getgrent_r $hdrs
13405                 eval $hasproto ;;
13406         *)      ;;
13407         esac
13408         case "$d_getgrent_r_proto" in
13409         define)
13410         case "$getgrent_r_proto" in
13411         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13412         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13413         esac
13414         case "$getgrent_r_proto" in
13415         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13416         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13417         esac
13418         case "$getgrent_r_proto" in
13419         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13420         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13421         esac
13422         case "$getgrent_r_proto" in
13423         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13424         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13425         esac
13426         case "$getgrent_r_proto" in
13427         ''|0) try='int getgrent_r(struct group*, char*, int);'
13428         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13429         esac
13430         case "$getgrent_r_proto" in
13431         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13432         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13433         esac
13434         case "$getgrent_r_proto" in
13435         ''|0)   d_getgrent_r=undef
13436                 getgrent_r_proto=0
13437                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13438         * )     case "$getgrent_r_proto" in
13439                 REENTRANT_PROTO*) ;;
13440                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13441                 esac
13442                 echo "Prototype: $try" ;;
13443         esac
13444         ;;
13445         *)      case "$usethreads" in
13446                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13447                 esac
13448                 d_getgrent_r=undef
13449                 getgrent_r_proto=0
13450                 ;;
13451         esac
13452         ;;
13453 *)      getgrent_r_proto=0
13454         ;;
13455 esac
13456
13457 : see if getgrgid_r exists
13458 set getgrgid_r d_getgrgid_r
13459 eval $inlibc
13460 case "$d_getgrgid_r" in
13461 "$define")
13462         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13463         case "$d_getgrgid_r_proto:$usethreads" in
13464         ":define")      d_getgrgid_r_proto=define
13465                 set d_getgrgid_r_proto getgrgid_r $hdrs
13466                 eval $hasproto ;;
13467         *)      ;;
13468         esac
13469         case "$d_getgrgid_r_proto" in
13470         define)
13471         case "$getgrgid_r_proto" in
13472         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13473         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13474         esac
13475         case "$getgrgid_r_proto" in
13476         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13477         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13478         esac
13479         case "$getgrgid_r_proto" in
13480         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13481         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13482         esac
13483         case "$getgrgid_r_proto" in
13484         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13485         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13486         esac
13487         case "$getgrgid_r_proto" in
13488         ''|0)   d_getgrgid_r=undef
13489                 getgrgid_r_proto=0
13490                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13491         * )     case "$getgrgid_r_proto" in
13492                 REENTRANT_PROTO*) ;;
13493                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13494                 esac
13495                 echo "Prototype: $try" ;;
13496         esac
13497         ;;
13498         *)      case "$usethreads" in
13499                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13500                 esac
13501                 d_getgrgid_r=undef
13502                 getgrgid_r_proto=0
13503                 ;;
13504         esac
13505         ;;
13506 *)      getgrgid_r_proto=0
13507         ;;
13508 esac
13509
13510 : see if getgrnam_r exists
13511 set getgrnam_r d_getgrnam_r
13512 eval $inlibc
13513 case "$d_getgrnam_r" in
13514 "$define")
13515         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13516         case "$d_getgrnam_r_proto:$usethreads" in
13517         ":define")      d_getgrnam_r_proto=define
13518                 set d_getgrnam_r_proto getgrnam_r $hdrs
13519                 eval $hasproto ;;
13520         *)      ;;
13521         esac
13522         case "$d_getgrnam_r_proto" in
13523         define)
13524         case "$getgrnam_r_proto" in
13525         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13526         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13527         esac
13528         case "$getgrnam_r_proto" in
13529         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13530         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13531         esac
13532         case "$getgrnam_r_proto" in
13533         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13534         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13535         esac
13536         case "$getgrnam_r_proto" in
13537         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13538         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13539         esac
13540         case "$getgrnam_r_proto" in
13541         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13542         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13543         esac
13544         case "$getgrnam_r_proto" in
13545         ''|0)   d_getgrnam_r=undef
13546                 getgrnam_r_proto=0
13547                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13548         * )     case "$getgrnam_r_proto" in
13549                 REENTRANT_PROTO*) ;;
13550                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13551                 esac
13552                 echo "Prototype: $try" ;;
13553         esac
13554         ;;
13555         *)      case "$usethreads" in
13556                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13557                 esac
13558                 d_getgrnam_r=undef
13559                 getgrnam_r_proto=0
13560                 ;;
13561         esac
13562         ;;
13563 *)      getgrnam_r_proto=0
13564         ;;
13565 esac
13566
13567 : see if gethostbyaddr exists
13568 set gethostbyaddr d_gethbyaddr
13569 eval $inlibc
13570
13571 : see if gethostbyname exists
13572 set gethostbyname d_gethbyname
13573 eval $inlibc
13574
13575 : see if gethostent exists
13576 set gethostent d_gethent
13577 eval $inlibc
13578
13579 : see how we will look up host name
13580 echo " "
13581 call=''
13582 if set gethostname val -f d_gethname; eval $csym; $val; then
13583         echo 'gethostname() found.' >&4
13584         d_gethname="$define"
13585         call=gethostname
13586 fi
13587 if set uname val -f d_uname; eval $csym; $val; then
13588         if ./xenix; then
13589                 $cat <<'EOM'
13590 uname() was found, but you're running xenix, and older versions of xenix
13591 have a broken uname(). If you don't really know whether your xenix is old
13592 enough to have a broken system call, use the default answer.
13593
13594 EOM
13595                 dflt=y
13596                 case "$d_uname" in
13597                 "$define") dflt=n;;
13598                 esac
13599                 rp='Is your uname() broken?'
13600                 . ./myread
13601                 case "$ans" in
13602                 n*) d_uname="$define"; call=uname;;
13603                 esac
13604         else
13605                 echo 'uname() found.' >&4
13606                 d_uname="$define"
13607                 case "$call" in
13608                 '') call=uname ;;
13609                 esac
13610         fi
13611 fi
13612 case "$d_gethname" in
13613 '') d_gethname="$undef";;
13614 esac
13615 case "$d_uname" in
13616 '') d_uname="$undef";;
13617 esac
13618 case "$d_uname$d_gethname" in
13619 *define*)
13620         dflt=n
13621         cat <<EOM
13622
13623 Every now and then someone has a $call() that lies about the hostname
13624 but can't be fixed for political or economic reasons.  If you wish, I can
13625 pretend $call() isn't there and maybe compute hostname at run-time
13626 thanks to the '$phostname' command.
13627
13628 EOM
13629         rp="Shall I ignore $call() from now on?"
13630         . ./myread
13631         case "$ans" in
13632         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13633         esac;;
13634 esac
13635 case "$phostname" in
13636 '') aphostname='';;
13637 *) case "$aphostname" in
13638         /*) ;;
13639         *) set X $phostname
13640                 shift
13641                 file=$1
13642                 shift
13643                 file=`./loc $file $file $pth`
13644                 aphostname=`echo $file $*`
13645                 ;;
13646         esac
13647         ;;
13648 esac
13649 case "$d_uname$d_gethname" in
13650 *define*) ;;
13651 *)
13652         case "$phostname" in
13653         '')
13654                 echo "There will be no way for $package to get your hostname." >&4;;
13655         *)
13656         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13657                 ;;
13658         esac;;
13659 esac
13660 case "$d_phostname" in
13661 '') d_phostname="$undef";;
13662 esac
13663
13664 : see if gethostbyaddr_r exists
13665 set gethostbyaddr_r d_gethostbyaddr_r
13666 eval $inlibc
13667 case "$d_gethostbyaddr_r" in
13668 "$define")
13669         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13670         case "$d_gethostbyaddr_r_proto:$usethreads" in
13671         ":define")      d_gethostbyaddr_r_proto=define
13672                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13673                 eval $hasproto ;;
13674         *)      ;;
13675         esac
13676         case "$d_gethostbyaddr_r_proto" in
13677         define)
13678         case "$gethostbyaddr_r_proto" in
13679         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13680         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13681         esac
13682         case "$gethostbyaddr_r_proto" in
13683         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13684         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13685         esac
13686         case "$gethostbyaddr_r_proto" in
13687         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13688         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13689         esac
13690         case "$gethostbyaddr_r_proto" in
13691         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13692         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13693         esac
13694         case "$gethostbyaddr_r_proto" in
13695         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13696         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13697         esac
13698         case "$gethostbyaddr_r_proto" in
13699         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13700         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13701         esac
13702         case "$gethostbyaddr_r_proto" in
13703         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13704         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13705         esac
13706         case "$gethostbyaddr_r_proto" in
13707         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13708         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13709         esac
13710         case "$gethostbyaddr_r_proto" in
13711         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13712         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13713         esac
13714         case "$gethostbyaddr_r_proto" in
13715         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13716         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13717         esac
13718         case "$gethostbyaddr_r_proto" in
13719         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13720         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13721         esac
13722         case "$gethostbyaddr_r_proto" in
13723         ''|0)   d_gethostbyaddr_r=undef
13724                 gethostbyaddr_r_proto=0
13725                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13726         * )     case "$gethostbyaddr_r_proto" in
13727                 REENTRANT_PROTO*) ;;
13728                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13729                 esac
13730                 echo "Prototype: $try" ;;
13731         esac
13732         ;;
13733         *)      case "$usethreads" in
13734                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13735                 esac
13736                 d_gethostbyaddr_r=undef
13737                 gethostbyaddr_r_proto=0
13738                 ;;
13739         esac
13740         ;;
13741 *)      gethostbyaddr_r_proto=0
13742         ;;
13743 esac
13744
13745 : see if gethostbyname_r exists
13746 set gethostbyname_r d_gethostbyname_r
13747 eval $inlibc
13748 case "$d_gethostbyname_r" in
13749 "$define")
13750         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13751         case "$d_gethostbyname_r_proto:$usethreads" in
13752         ":define")      d_gethostbyname_r_proto=define
13753                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13754                 eval $hasproto ;;
13755         *)      ;;
13756         esac
13757         case "$d_gethostbyname_r_proto" in
13758         define)
13759         case "$gethostbyname_r_proto" in
13760         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13761         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13762         esac
13763         case "$gethostbyname_r_proto" in
13764         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13765         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13766         esac
13767         case "$gethostbyname_r_proto" in
13768         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13769         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13770         esac
13771         case "$gethostbyname_r_proto" in
13772         ''|0)   d_gethostbyname_r=undef
13773                 gethostbyname_r_proto=0
13774                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13775         * )     case "$gethostbyname_r_proto" in
13776                 REENTRANT_PROTO*) ;;
13777                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13778                 esac
13779                 echo "Prototype: $try" ;;
13780         esac
13781         ;;
13782         *)      case "$usethreads" in
13783                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13784                 esac
13785                 d_gethostbyname_r=undef
13786                 gethostbyname_r_proto=0
13787                 ;;
13788         esac
13789         ;;
13790 *)      gethostbyname_r_proto=0
13791         ;;
13792 esac
13793
13794 : see if gethostent_r exists
13795 set gethostent_r d_gethostent_r
13796 eval $inlibc
13797 case "$d_gethostent_r" in
13798 "$define")
13799         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13800         case "$d_gethostent_r_proto:$usethreads" in
13801         ":define")      d_gethostent_r_proto=define
13802                 set d_gethostent_r_proto gethostent_r $hdrs
13803                 eval $hasproto ;;
13804         *)      ;;
13805         esac
13806         case "$d_gethostent_r_proto" in
13807         define)
13808         case "$gethostent_r_proto" in
13809         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13810         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13811         esac
13812         case "$gethostent_r_proto" in
13813         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13814         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13815         esac
13816         case "$gethostent_r_proto" in
13817         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13818         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13819         esac
13820         case "$gethostent_r_proto" in
13821         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13822         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13823         esac
13824         case "$gethostent_r_proto" in
13825         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13826         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13827         esac
13828         case "$gethostent_r_proto" in
13829         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13830         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13831         esac
13832         case "$gethostent_r_proto" in
13833         ''|0)   d_gethostent_r=undef
13834                 gethostent_r_proto=0
13835                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13836         * )     case "$gethostent_r_proto" in
13837                 REENTRANT_PROTO*) ;;
13838                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13839                 esac
13840                 echo "Prototype: $try" ;;
13841         esac
13842         ;;
13843         *)      case "$usethreads" in
13844                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13845                 esac
13846                 d_gethostent_r=undef
13847                 gethostent_r_proto=0
13848                 ;;
13849         esac
13850         ;;
13851 *)      gethostent_r_proto=0
13852         ;;
13853 esac
13854
13855 : see if prototypes for various gethostxxx netdb.h functions are available
13856 echo " "
13857 set d_gethostprotos gethostent $i_netdb netdb.h
13858 eval $hasproto
13859
13860 : see if getitimer exists
13861 set getitimer d_getitimer
13862 eval $inlibc
13863
13864 : see if getlogin exists
13865 set getlogin d_getlogin
13866 eval $inlibc
13867
13868 : see if getlogin_r exists
13869 set getlogin_r d_getlogin_r
13870 eval $inlibc
13871 case "$d_getlogin_r" in
13872 "$define")
13873         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13874         case "$d_getlogin_r_proto:$usethreads" in
13875         ":define")      d_getlogin_r_proto=define
13876                 set d_getlogin_r_proto getlogin_r $hdrs
13877                 eval $hasproto ;;
13878         *)      ;;
13879         esac
13880         case "$d_getlogin_r_proto" in
13881         define)
13882         case "$getlogin_r_proto" in
13883         ''|0) try='int getlogin_r(char*, size_t);'
13884         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13885         esac
13886         case "$getlogin_r_proto" in
13887         ''|0) try='int getlogin_r(char*, int);'
13888         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13889         esac
13890         case "$getlogin_r_proto" in
13891         ''|0) try='char* getlogin_r(char*, size_t);'
13892         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13893         esac
13894         case "$getlogin_r_proto" in
13895         ''|0) try='char* getlogin_r(char*, int);'
13896         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13897         esac
13898         case "$getlogin_r_proto" in
13899         ''|0)   d_getlogin_r=undef
13900                 getlogin_r_proto=0
13901                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13902         * )     case "$getlogin_r_proto" in
13903                 REENTRANT_PROTO*) ;;
13904                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13905                 esac
13906                 echo "Prototype: $try" ;;
13907         esac
13908         ;;
13909         *)      case "$usethreads" in
13910                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13911                 esac
13912                 d_getlogin_r=undef
13913                 getlogin_r_proto=0
13914                 ;;
13915         esac
13916         ;;
13917 *)      getlogin_r_proto=0
13918         ;;
13919 esac
13920
13921 : see if getmnt exists
13922 set getmnt d_getmnt
13923 eval $inlibc
13924
13925 : see if getmntent exists
13926 set getmntent d_getmntent
13927 eval $inlibc
13928
13929 : see if getnetbyaddr exists
13930 set getnetbyaddr d_getnbyaddr
13931 eval $inlibc
13932
13933 : see if getnetbyname exists
13934 set getnetbyname d_getnbyname
13935 eval $inlibc
13936
13937 : see if getnetent exists
13938 set getnetent d_getnent
13939 eval $inlibc
13940
13941 : see if getnetbyaddr_r exists
13942 set getnetbyaddr_r d_getnetbyaddr_r
13943 eval $inlibc
13944 case "$d_getnetbyaddr_r" in
13945 "$define")
13946         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13947         case "$d_getnetbyaddr_r_proto:$usethreads" in
13948         ":define")      d_getnetbyaddr_r_proto=define
13949                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13950                 eval $hasproto ;;
13951         *)      ;;
13952         esac
13953         case "$d_getnetbyaddr_r_proto" in
13954         define)
13955         case "$getnetbyaddr_r_proto" in
13956         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13957         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13958         esac
13959         case "$getnetbyaddr_r_proto" in
13960         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13961         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13962         esac
13963         case "$getnetbyaddr_r_proto" in
13964         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13965         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13966         esac
13967         case "$getnetbyaddr_r_proto" in
13968         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13969         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13970         esac
13971         case "$getnetbyaddr_r_proto" in
13972         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13973         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13974         esac
13975         case "$getnetbyaddr_r_proto" in
13976         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13977         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13978         esac
13979         case "$getnetbyaddr_r_proto" in
13980         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13981         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13982         esac
13983         case "$getnetbyaddr_r_proto" in
13984         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13985         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13986         esac
13987         case "$getnetbyaddr_r_proto" in
13988         ''|0)   d_getnetbyaddr_r=undef
13989                 getnetbyaddr_r_proto=0
13990                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13991         * )     case "$getnetbyaddr_r_proto" in
13992                 REENTRANT_PROTO*) ;;
13993                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13994                 esac
13995                 echo "Prototype: $try" ;;
13996         esac
13997         ;;
13998         *)      case "$usethreads" in
13999                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14000                 esac
14001                 d_getnetbyaddr_r=undef
14002                 getnetbyaddr_r_proto=0
14003                 ;;
14004         esac
14005         ;;
14006 *)      getnetbyaddr_r_proto=0
14007         ;;
14008 esac
14009
14010 : see if getnetbyname_r exists
14011 set getnetbyname_r d_getnetbyname_r
14012 eval $inlibc
14013 case "$d_getnetbyname_r" in
14014 "$define")
14015         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14016         case "$d_getnetbyname_r_proto:$usethreads" in
14017         ":define")      d_getnetbyname_r_proto=define
14018                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14019                 eval $hasproto ;;
14020         *)      ;;
14021         esac
14022         case "$d_getnetbyname_r_proto" in
14023         define)
14024         case "$getnetbyname_r_proto" in
14025         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14026         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14027         esac
14028         case "$getnetbyname_r_proto" in
14029         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14030         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14031         esac
14032         case "$getnetbyname_r_proto" in
14033         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14034         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14035         esac
14036         case "$getnetbyname_r_proto" in
14037         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14038         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14039         esac
14040         case "$getnetbyname_r_proto" in
14041         ''|0)   d_getnetbyname_r=undef
14042                 getnetbyname_r_proto=0
14043                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14044         * )     case "$getnetbyname_r_proto" in
14045                 REENTRANT_PROTO*) ;;
14046                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14047                 esac
14048                 echo "Prototype: $try" ;;
14049         esac
14050         ;;
14051         *)      case "$usethreads" in
14052                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14053                 esac
14054                 d_getnetbyname_r=undef
14055                 getnetbyname_r_proto=0
14056                 ;;
14057         esac
14058         ;;
14059 *)      getnetbyname_r_proto=0
14060         ;;
14061 esac
14062
14063 : see if getnetent_r exists
14064 set getnetent_r d_getnetent_r
14065 eval $inlibc
14066 case "$d_getnetent_r" in
14067 "$define")
14068         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14069         case "$d_getnetent_r_proto:$usethreads" in
14070         ":define")      d_getnetent_r_proto=define
14071                 set d_getnetent_r_proto getnetent_r $hdrs
14072                 eval $hasproto ;;
14073         *)      ;;
14074         esac
14075         case "$d_getnetent_r_proto" in
14076         define)
14077         case "$getnetent_r_proto" in
14078         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14079         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14080         esac
14081         case "$getnetent_r_proto" in
14082         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14083         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14084         esac
14085         case "$getnetent_r_proto" in
14086         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14087         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14088         esac
14089         case "$getnetent_r_proto" in
14090         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14091         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14092         esac
14093         case "$getnetent_r_proto" in
14094         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14095         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14096         esac
14097         case "$getnetent_r_proto" in
14098         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14099         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14100         esac
14101         case "$getnetent_r_proto" in
14102         ''|0)   d_getnetent_r=undef
14103                 getnetent_r_proto=0
14104                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14105         * )     case "$getnetent_r_proto" in
14106                 REENTRANT_PROTO*) ;;
14107                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14108                 esac
14109                 echo "Prototype: $try" ;;
14110         esac
14111         ;;
14112         *)      case "$usethreads" in
14113                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14114                 esac
14115                 d_getnetent_r=undef
14116                 getnetent_r_proto=0
14117                 ;;
14118         esac
14119         ;;
14120 *)      getnetent_r_proto=0
14121         ;;
14122 esac
14123
14124 : see if prototypes for various getnetxxx netdb.h functions are available
14125 echo " "
14126 set d_getnetprotos getnetent $i_netdb netdb.h
14127 eval $hasproto
14128
14129 : see if getpagesize exists
14130 set getpagesize d_getpagsz
14131 eval $inlibc
14132
14133 : Optional checks for getprotobyname and getprotobynumber
14134
14135 : see if getprotobyname exists
14136 set getprotobyname d_getpbyname
14137 eval $inlibc
14138
14139 : see if getprotobynumber exists
14140 set getprotobynumber d_getpbynumber
14141 eval $inlibc
14142
14143 : see if getprotoent exists
14144 set getprotoent d_getpent
14145 eval $inlibc
14146
14147 : see if getpgid exists
14148 set getpgid d_getpgid
14149 eval $inlibc
14150
14151 : see if getpgrp2 exists
14152 set getpgrp2 d_getpgrp2
14153 eval $inlibc
14154
14155 : see if getppid exists
14156 set getppid d_getppid
14157 eval $inlibc
14158
14159 : see if getpriority exists
14160 set getpriority d_getprior
14161 eval $inlibc
14162
14163 : see if getprotobyname_r exists
14164 set getprotobyname_r d_getprotobyname_r
14165 eval $inlibc
14166 case "$d_getprotobyname_r" in
14167 "$define")
14168         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14169         case "$d_getprotobyname_r_proto:$usethreads" in
14170         ":define")      d_getprotobyname_r_proto=define
14171                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14172                 eval $hasproto ;;
14173         *)      ;;
14174         esac
14175         case "$d_getprotobyname_r_proto" in
14176         define)
14177         case "$getprotobyname_r_proto" in
14178         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14179         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14180         esac
14181         case "$getprotobyname_r_proto" in
14182         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14183         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14184         esac
14185         case "$getprotobyname_r_proto" in
14186         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14187         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14188         esac
14189         case "$getprotobyname_r_proto" in
14190         ''|0)   d_getprotobyname_r=undef
14191                 getprotobyname_r_proto=0
14192                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14193         * )     case "$getprotobyname_r_proto" in
14194                 REENTRANT_PROTO*) ;;
14195                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14196                 esac
14197                 echo "Prototype: $try" ;;
14198         esac
14199         ;;
14200         *)      case "$usethreads" in
14201                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14202                 esac
14203                 d_getprotobyname_r=undef
14204                 getprotobyname_r_proto=0
14205                 ;;
14206         esac
14207         ;;
14208 *)      getprotobyname_r_proto=0
14209         ;;
14210 esac
14211
14212 : see if getprotobynumber_r exists
14213 set getprotobynumber_r d_getprotobynumber_r
14214 eval $inlibc
14215 case "$d_getprotobynumber_r" in
14216 "$define")
14217         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14218         case "$d_getprotobynumber_r_proto:$usethreads" in
14219         ":define")      d_getprotobynumber_r_proto=define
14220                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14221                 eval $hasproto ;;
14222         *)      ;;
14223         esac
14224         case "$d_getprotobynumber_r_proto" in
14225         define)
14226         case "$getprotobynumber_r_proto" in
14227         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14228         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14229         esac
14230         case "$getprotobynumber_r_proto" in
14231         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14232         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14233         esac
14234         case "$getprotobynumber_r_proto" in
14235         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14236         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14237         esac
14238         case "$getprotobynumber_r_proto" in
14239         ''|0)   d_getprotobynumber_r=undef
14240                 getprotobynumber_r_proto=0
14241                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14242         * )     case "$getprotobynumber_r_proto" in
14243                 REENTRANT_PROTO*) ;;
14244                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14245                 esac
14246                 echo "Prototype: $try" ;;
14247         esac
14248         ;;
14249         *)      case "$usethreads" in
14250                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14251                 esac
14252                 d_getprotobynumber_r=undef
14253                 getprotobynumber_r_proto=0
14254                 ;;
14255         esac
14256         ;;
14257 *)      getprotobynumber_r_proto=0
14258         ;;
14259 esac
14260
14261 : see if getprotoent_r exists
14262 set getprotoent_r d_getprotoent_r
14263 eval $inlibc
14264 case "$d_getprotoent_r" in
14265 "$define")
14266         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14267         case "$d_getprotoent_r_proto:$usethreads" in
14268         ":define")      d_getprotoent_r_proto=define
14269                 set d_getprotoent_r_proto getprotoent_r $hdrs
14270                 eval $hasproto ;;
14271         *)      ;;
14272         esac
14273         case "$d_getprotoent_r_proto" in
14274         define)
14275         case "$getprotoent_r_proto" in
14276         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14277         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14278         esac
14279         case "$getprotoent_r_proto" in
14280         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14281         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14282         esac
14283         case "$getprotoent_r_proto" in
14284         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14285         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14286         esac
14287         case "$getprotoent_r_proto" in
14288         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14289         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14290         esac
14291         case "$getprotoent_r_proto" in
14292         ''|0)   d_getprotoent_r=undef
14293                 getprotoent_r_proto=0
14294                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14295         * )     case "$getprotoent_r_proto" in
14296                 REENTRANT_PROTO*) ;;
14297                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14298                 esac
14299                 echo "Prototype: $try" ;;
14300         esac
14301         ;;
14302         *)      case "$usethreads" in
14303                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14304                 esac
14305                 d_getprotoent_r=undef
14306                 getprotoent_r_proto=0
14307                 ;;
14308         esac
14309         ;;
14310 *)      getprotoent_r_proto=0
14311         ;;
14312 esac
14313
14314 : see if prototypes for various getprotoxxx netdb.h functions are available
14315 echo " "
14316 set d_getprotoprotos getprotoent $i_netdb netdb.h
14317 eval $hasproto
14318
14319 : see if getprpwnam exists
14320 set getprpwnam d_getprpwnam
14321 eval $inlibc
14322
14323 : see if getpwent exists
14324 set getpwent d_getpwent
14325 eval $inlibc
14326
14327 : see if getpwent_r exists
14328 set getpwent_r d_getpwent_r
14329 eval $inlibc
14330 case "$d_getpwent_r" in
14331 "$define")
14332         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14333         case "$d_getpwent_r_proto:$usethreads" in
14334         ":define")      d_getpwent_r_proto=define
14335                 set d_getpwent_r_proto getpwent_r $hdrs
14336                 eval $hasproto ;;
14337         *)      ;;
14338         esac
14339         case "$d_getpwent_r_proto" in
14340         define)
14341         case "$getpwent_r_proto" in
14342         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14343         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14344         esac
14345         case "$getpwent_r_proto" in
14346         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14347         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14348         esac
14349         case "$getpwent_r_proto" in
14350         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14351         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14352         esac
14353         case "$getpwent_r_proto" in
14354         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14355         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14356         esac
14357         case "$getpwent_r_proto" in
14358         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14359         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14360         esac
14361         case "$getpwent_r_proto" in
14362         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14363         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14364         esac
14365         case "$getpwent_r_proto" in
14366         ''|0)   d_getpwent_r=undef
14367                 getpwent_r_proto=0
14368                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14369         * )     case "$getpwent_r_proto" in
14370                 REENTRANT_PROTO*) ;;
14371                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14372                 esac
14373                 echo "Prototype: $try" ;;
14374         esac
14375         ;;
14376         *)      case "$usethreads" in
14377                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14378                 esac
14379                 d_getpwent_r=undef
14380                 getpwent_r_proto=0
14381                 ;;
14382         esac
14383         ;;
14384 *)      getpwent_r_proto=0
14385         ;;
14386 esac
14387
14388 : see if getpwnam_r exists
14389 set getpwnam_r d_getpwnam_r
14390 eval $inlibc
14391 case "$d_getpwnam_r" in
14392 "$define")
14393         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14394         case "$d_getpwnam_r_proto:$usethreads" in
14395         ":define")      d_getpwnam_r_proto=define
14396                 set d_getpwnam_r_proto getpwnam_r $hdrs
14397                 eval $hasproto ;;
14398         *)      ;;
14399         esac
14400         case "$d_getpwnam_r_proto" in
14401         define)
14402         case "$getpwnam_r_proto" in
14403         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14404         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14405         esac
14406         case "$getpwnam_r_proto" in
14407         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14408         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14409         esac
14410         case "$getpwnam_r_proto" in
14411         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14412         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14413         esac
14414         case "$getpwnam_r_proto" in
14415         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14416         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14417         esac
14418         case "$getpwnam_r_proto" in
14419         ''|0)   d_getpwnam_r=undef
14420                 getpwnam_r_proto=0
14421                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14422         * )     case "$getpwnam_r_proto" in
14423                 REENTRANT_PROTO*) ;;
14424                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14425                 esac
14426                 echo "Prototype: $try" ;;
14427         esac
14428         ;;
14429         *)      case "$usethreads" in
14430                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14431                 esac
14432                 d_getpwnam_r=undef
14433                 getpwnam_r_proto=0
14434                 ;;
14435         esac
14436         ;;
14437 *)      getpwnam_r_proto=0
14438         ;;
14439 esac
14440
14441 : see if getpwuid_r exists
14442 set getpwuid_r d_getpwuid_r
14443 eval $inlibc
14444 case "$d_getpwuid_r" in
14445 "$define")
14446         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14447         case "$d_getpwuid_r_proto:$usethreads" in
14448         ":define")      d_getpwuid_r_proto=define
14449                 set d_getpwuid_r_proto getpwuid_r $hdrs
14450                 eval $hasproto ;;
14451         *)      ;;
14452         esac
14453         case "$d_getpwuid_r_proto" in
14454         define)
14455         case "$getpwuid_r_proto" in
14456         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14457         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14458         esac
14459         case "$getpwuid_r_proto" in
14460         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14461         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14462         esac
14463         case "$getpwuid_r_proto" in
14464         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14465         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14466         esac
14467         case "$getpwuid_r_proto" in
14468         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14469         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14470         esac
14471         case "$getpwuid_r_proto" in
14472         ''|0)   d_getpwuid_r=undef
14473                 getpwuid_r_proto=0
14474                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14475         * )     case "$getpwuid_r_proto" in
14476                 REENTRANT_PROTO*) ;;
14477                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14478                 esac
14479                 echo "Prototype: $try" ;;
14480         esac
14481         ;;
14482         *)      case "$usethreads" in
14483                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14484                 esac
14485                 d_getpwuid_r=undef
14486                 getpwuid_r_proto=0
14487                 ;;
14488         esac
14489         ;;
14490 *)      getpwuid_r_proto=0
14491         ;;
14492 esac
14493
14494 : Optional checks for getsbyname and getsbyport
14495
14496 : see if getservbyname exists
14497 set getservbyname d_getsbyname
14498 eval $inlibc
14499
14500 : see if getservbyport exists
14501 set getservbyport d_getsbyport
14502 eval $inlibc
14503
14504 : see if getservent exists
14505 set getservent d_getsent
14506 eval $inlibc
14507
14508 : see if getservbyname_r exists
14509 set getservbyname_r d_getservbyname_r
14510 eval $inlibc
14511 case "$d_getservbyname_r" in
14512 "$define")
14513         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14514         case "$d_getservbyname_r_proto:$usethreads" in
14515         ":define")      d_getservbyname_r_proto=define
14516                 set d_getservbyname_r_proto getservbyname_r $hdrs
14517                 eval $hasproto ;;
14518         *)      ;;
14519         esac
14520         case "$d_getservbyname_r_proto" in
14521         define)
14522         case "$getservbyname_r_proto" in
14523         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14524         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14525         esac
14526         case "$getservbyname_r_proto" in
14527         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14528         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14529         esac
14530         case "$getservbyname_r_proto" in
14531         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14532         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14533         esac
14534         case "$getservbyname_r_proto" in
14535         ''|0)   d_getservbyname_r=undef
14536                 getservbyname_r_proto=0
14537                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14538         * )     case "$getservbyname_r_proto" in
14539                 REENTRANT_PROTO*) ;;
14540                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14541                 esac
14542                 echo "Prototype: $try" ;;
14543         esac
14544         ;;
14545         *)      case "$usethreads" in
14546                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14547                 esac
14548                 d_getservbyname_r=undef
14549                 getservbyname_r_proto=0
14550                 ;;
14551         esac
14552         ;;
14553 *)      getservbyname_r_proto=0
14554         ;;
14555 esac
14556
14557 : see if getservbyport_r exists
14558 set getservbyport_r d_getservbyport_r
14559 eval $inlibc
14560 case "$d_getservbyport_r" in
14561 "$define")
14562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14563         case "$d_getservbyport_r_proto:$usethreads" in
14564         ":define")      d_getservbyport_r_proto=define
14565                 set d_getservbyport_r_proto getservbyport_r $hdrs
14566                 eval $hasproto ;;
14567         *)      ;;
14568         esac
14569         case "$d_getservbyport_r_proto" in
14570         define)
14571         case "$getservbyport_r_proto" in
14572         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14573         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14574         esac
14575         case "$getservbyport_r_proto" in
14576         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14577         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14578         esac
14579         case "$getservbyport_r_proto" in
14580         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14581         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14582         esac
14583         case "$getservbyport_r_proto" in
14584         ''|0)   d_getservbyport_r=undef
14585                 getservbyport_r_proto=0
14586                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14587         * )     case "$getservbyport_r_proto" in
14588                 REENTRANT_PROTO*) ;;
14589                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14590                 esac
14591                 echo "Prototype: $try" ;;
14592         esac
14593         ;;
14594         *)      case "$usethreads" in
14595                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14596                 esac
14597                 d_getservbyport_r=undef
14598                 getservbyport_r_proto=0
14599                 ;;
14600         esac
14601         ;;
14602 *)      getservbyport_r_proto=0
14603         ;;
14604 esac
14605
14606 : see if getservent_r exists
14607 set getservent_r d_getservent_r
14608 eval $inlibc
14609 case "$d_getservent_r" in
14610 "$define")
14611         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14612         case "$d_getservent_r_proto:$usethreads" in
14613         ":define")      d_getservent_r_proto=define
14614                 set d_getservent_r_proto getservent_r $hdrs
14615                 eval $hasproto ;;
14616         *)      ;;
14617         esac
14618         case "$d_getservent_r_proto" in
14619         define)
14620         case "$getservent_r_proto" in
14621         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14622         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14623         esac
14624         case "$getservent_r_proto" in
14625         ''|0) try='int getservent_r(struct servent*, char*, int);'
14626         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14627         esac
14628         case "$getservent_r_proto" in
14629         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14630         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14631         esac
14632         case "$getservent_r_proto" in
14633         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14634         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14635         esac
14636         case "$getservent_r_proto" in
14637         ''|0)   d_getservent_r=undef
14638                 getservent_r_proto=0
14639                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14640         * )     case "$getservent_r_proto" in
14641                 REENTRANT_PROTO*) ;;
14642                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14643                 esac
14644                 echo "Prototype: $try" ;;
14645         esac
14646         ;;
14647         *)      case "$usethreads" in
14648                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14649                 esac
14650                 d_getservent_r=undef
14651                 getservent_r_proto=0
14652                 ;;
14653         esac
14654         ;;
14655 *)      getservent_r_proto=0
14656         ;;
14657 esac
14658
14659 : see if prototypes for various getservxxx netdb.h functions are available
14660 echo " "
14661 set d_getservprotos getservent $i_netdb netdb.h
14662 eval $hasproto
14663
14664 : see if getspnam exists
14665 set getspnam d_getspnam
14666 eval $inlibc
14667
14668 : see if this is a shadow.h system
14669 set shadow.h i_shadow
14670 eval $inhdr
14671
14672 : see if getspnam_r exists
14673 set getspnam_r d_getspnam_r
14674 eval $inlibc
14675 case "$d_getspnam_r" in
14676 "$define")
14677         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14678         case "$d_getspnam_r_proto:$usethreads" in
14679         ":define")      d_getspnam_r_proto=define
14680                 set d_getspnam_r_proto getspnam_r $hdrs
14681                 eval $hasproto ;;
14682         *)      ;;
14683         esac
14684         case "$d_getspnam_r_proto" in
14685         define)
14686         case "$getspnam_r_proto" in
14687         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14688         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14689         esac
14690         case "$getspnam_r_proto" in
14691         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14692         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14693         esac
14694         case "$getspnam_r_proto" in
14695         ''|0)   d_getspnam_r=undef
14696                 getspnam_r_proto=0
14697                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14698         * )     case "$getspnam_r_proto" in
14699                 REENTRANT_PROTO*) ;;
14700                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14701                 esac
14702                 echo "Prototype: $try" ;;
14703         esac
14704         ;;
14705         *)      case "$usethreads" in
14706                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14707                 esac
14708                 d_getspnam_r=undef
14709                 getspnam_r_proto=0
14710                 ;;
14711         esac
14712         ;;
14713 *)      getspnam_r_proto=0
14714         ;;
14715 esac
14716
14717 : see if gettimeofday or ftime exists
14718 set gettimeofday d_gettimeod
14719 eval $inlibc
14720 case "$d_gettimeod" in
14721 "$undef")
14722         set ftime d_ftime 
14723         eval $inlibc
14724         ;;
14725 *)
14726         val="$undef"; set d_ftime; eval $setvar
14727         ;;
14728 esac
14729 case "$d_gettimeod$d_ftime" in
14730 "$undef$undef")
14731         echo " "
14732         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14733         ;;
14734 esac
14735
14736 : see if gmtime_r exists
14737 set gmtime_r d_gmtime_r
14738 eval $inlibc
14739 case "$d_gmtime_r" in
14740 "$define")
14741         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14742         case "$d_gmtime_r_proto:$usethreads" in
14743         ":define")      d_gmtime_r_proto=define
14744                 set d_gmtime_r_proto gmtime_r $hdrs
14745                 eval $hasproto ;;
14746         *)      ;;
14747         esac
14748         case "$d_gmtime_r_proto" in
14749         define)
14750         case "$gmtime_r_proto" in
14751         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14752         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14753         esac
14754         case "$gmtime_r_proto" in
14755         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14756         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14757         esac
14758         case "$gmtime_r_proto" in
14759         ''|0)   d_gmtime_r=undef
14760                 gmtime_r_proto=0
14761                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14762         * )     case "$gmtime_r_proto" in
14763                 REENTRANT_PROTO*) ;;
14764                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14765                 esac
14766                 echo "Prototype: $try" ;;
14767         esac
14768         ;;
14769         *)      case "$usethreads" in
14770                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14771                 esac
14772                 d_gmtime_r=undef
14773                 gmtime_r_proto=0
14774                 ;;
14775         esac
14776         ;;
14777 *)      gmtime_r_proto=0
14778         ;;
14779 esac
14780
14781 : see if hasmntopt exists
14782 set hasmntopt d_hasmntopt
14783 eval $inlibc
14784
14785 : see if this is a netinet/in.h or sys/in.h system
14786 set netinet/in.h i_niin sys/in.h i_sysin
14787 eval $inhdr
14788
14789 : see if arpa/inet.h has to be included
14790 set arpa/inet.h i_arpainet
14791 eval $inhdr
14792
14793 : see if htonl --and friends-- exists
14794 val=''
14795 set htonl val
14796 eval $inlibc
14797
14798 : Maybe they are macros.
14799 case "$val" in
14800 $undef)
14801         $cat >htonl.c <<EOM
14802 #include <stdio.h>
14803 #include <sys/types.h>
14804 #$i_niin I_NETINET_IN
14805 #$i_sysin I_SYS_IN
14806 #$i_arpainet I_ARPA_INET
14807 #ifdef I_NETINET_IN
14808 #include <netinet/in.h>
14809 #endif
14810 #ifdef I_SYS_IN
14811 #include <sys/in.h>
14812 #endif
14813 #ifdef I_ARPA_INET
14814 #include <arpa/inet.h>
14815 #endif
14816 #ifdef htonl
14817 printf("Defined as a macro.");
14818 #endif
14819 EOM
14820         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14821         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14822                 val="$define"
14823                 echo "But it seems to be defined as a macro." >&4
14824         fi
14825         $rm -f htonl.?
14826         ;;
14827 esac
14828 set d_htonl
14829 eval $setvar
14830
14831 : see if ilogbl exists
14832 set ilogbl d_ilogbl
14833 eval $inlibc
14834
14835 : index or strchr
14836 echo " "
14837 if set index val -f; eval $csym; $val; then
14838         if set strchr val -f d_strchr; eval $csym; $val; then
14839                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14840                         val="$define"
14841                         vali="$undef"
14842                         echo "strchr() found." >&4
14843                 else
14844                         val="$undef"
14845                         vali="$define"
14846                         echo "index() found." >&4
14847                 fi
14848         else
14849                 val="$undef"
14850                 vali="$define"
14851                 echo "index() found." >&4
14852         fi
14853 else
14854         if set strchr val -f d_strchr; eval $csym; $val; then
14855                 val="$define"
14856                 vali="$undef"
14857                 echo "strchr() found." >&4
14858         else
14859                 echo "No index() or strchr() found!" >&4
14860                 val="$undef"
14861                 vali="$undef"
14862         fi
14863 fi
14864 set d_strchr; eval $setvar
14865 val="$vali"
14866 set d_index; eval $setvar
14867
14868 : check whether inet_aton exists
14869 set inet_aton d_inetaton
14870 eval $inlibc
14871
14872 : Look for isascii
14873 echo " "
14874 $cat >isascii.c <<EOCP
14875 #include <stdio.h>
14876 #include <ctype.h>
14877 #$i_stdlib I_STDLIB
14878 #ifdef I_STDLIB
14879 #include <stdlib.h>
14880 #endif
14881 int main() {
14882         int c = 'A';
14883         if (isascii(c))
14884                 exit(0);
14885         else
14886                 exit(1);
14887 }
14888 EOCP
14889 set isascii
14890 if eval $compile; then
14891         echo "isascii() found." >&4
14892         val="$define"
14893 else
14894         echo "isascii() NOT found." >&4
14895         val="$undef"
14896 fi
14897 set d_isascii
14898 eval $setvar
14899 $rm -f isascii*
14900
14901 : see if isfinite exists
14902 set isfinite d_isfinite
14903 eval $inlibc
14904
14905 : see if isinf exists
14906 set isinf d_isinf
14907 eval $inlibc
14908
14909 : see if isnan exists
14910 set isnan d_isnan
14911 eval $inlibc
14912
14913 : see if isnanl exists
14914 set isnanl d_isnanl
14915 eval $inlibc
14916
14917 : see if killpg exists
14918 set killpg d_killpg
14919 eval $inlibc
14920
14921 : see if lchown exists
14922 echo " "
14923 $cat > try.c <<'EOCP'
14924 /* System header to define __stub macros and hopefully few prototypes,
14925     which can conflict with char lchown(); below.  */
14926 #include <assert.h>
14927 /* Override any gcc2 internal prototype to avoid an error.  */
14928 /* We use char because int might match the return type of a gcc2
14929    builtin and then its argument prototype would still apply.  */
14930 char lchown();
14931 int main() {
14932     /*  The GNU C library defines this for functions which it implements
14933         to always fail with ENOSYS.  Some functions are actually named
14934         something starting with __ and the normal name is an alias.  */
14935 #if defined (__stub_lchown) || defined (__stub___lchown)
14936 choke me
14937 #else
14938 lchown();
14939 #endif
14940 ; return 0; }
14941 EOCP
14942 set try
14943 if eval $compile; then
14944     $echo "lchown() found." >&4
14945     val="$define"
14946 else
14947     $echo "lchown() NOT found." >&4
14948     val="$undef"
14949 fi
14950 set d_lchown
14951 eval $setvar
14952
14953 : See if number of significant digits in a double precision number is known
14954 echo " "
14955 $cat >ldbl_dig.c <<EOM
14956 #$i_limits I_LIMITS
14957 #$i_float I_FLOAT
14958 #ifdef I_LIMITS
14959 #include <limits.h>
14960 #endif
14961 #ifdef I_FLOAT
14962 #include <float.h>
14963 #endif
14964 #ifdef LDBL_DIG
14965 printf("Contains LDBL_DIG");
14966 #endif
14967 EOM
14968 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14969 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14970         echo "LDBL_DIG found." >&4
14971         val="$define"
14972 else
14973         echo "LDBL_DIG NOT found." >&4
14974         val="$undef"
14975 fi
14976 $rm -f ldbl_dig.?
14977 set d_ldbl_dig
14978 eval $setvar
14979
14980 : see if this is a math.h system
14981 set math.h i_math
14982 eval $inhdr
14983
14984 : check to see if math.h defines _LIB_VERSION
14985 d_libm_lib_version="$undef"
14986 case $i_math in
14987     $define)
14988         echo " "
14989         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14990         $cat >try.c <<EOCP
14991 #include <unistd.h>
14992 #include <math.h>
14993 int main (int argc, char *argv[])
14994 {
14995     printf ("%d\n", _LIB_VERSION);
14996     return (0);
14997     } /* main */
14998 EOCP
14999         set try
15000         if eval $compile; then
15001             foo=`$run ./try`
15002             echo "Yes, it does ($foo)" >&4
15003             d_libm_lib_version="$define"
15004         else
15005             echo "No, it does not (probably harmless)" >&4
15006             fi
15007         $rm_try
15008         ;;
15009
15010     esac
15011
15012 : see if link exists
15013 set link d_link
15014 eval $inlibc
15015
15016 : see if localtime_r exists
15017 set localtime_r d_localtime_r
15018 eval $inlibc
15019 case "$d_localtime_r" in
15020 "$define")
15021         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15022         case "$d_localtime_r_proto:$usethreads" in
15023         ":define")      d_localtime_r_proto=define
15024                 set d_localtime_r_proto localtime_r $hdrs
15025                 eval $hasproto ;;
15026         *)      ;;
15027         esac
15028         case "$d_localtime_r_proto" in
15029         define)
15030         case "$localtime_r_proto" in
15031         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15032         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15033         esac
15034         case "$localtime_r_proto" in
15035         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15036         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15037         esac
15038         case "$localtime_r_proto" in
15039         ''|0)   d_localtime_r=undef
15040                 localtime_r_proto=0
15041                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15042         * )     case "$localtime_r_proto" in
15043                 REENTRANT_PROTO*) ;;
15044                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15045                 esac
15046                 echo "Prototype: $try" ;;
15047         esac
15048         ;;
15049         *)      case "$usethreads" in
15050                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15051                 esac
15052                 d_localtime_r=undef
15053                 localtime_r_proto=0
15054                 ;;
15055         esac
15056         ;;
15057 *)      localtime_r_proto=0
15058         ;;
15059 esac
15060
15061 : see if localtime_r calls tzset
15062 case "$localtime_r_proto" in
15063 REENTRANT_PROTO*)
15064         $cat >try.c <<EOCP
15065 /*  Does our libc's localtime_r call tzset ?
15066  *  return 0 if so, 1 otherwise.
15067  */
15068 #$i_systypes    I_SYS_TYPES
15069 #$i_unistd      I_UNISTD
15070 #$i_time        I_TIME
15071 #$i_stdlib      I_STDLIB
15072 #$i_string      I_STRING
15073 #$i_malloc      I_MALLOC
15074 #ifdef I_SYS_TYPES
15075 #  include <sys/types.h>
15076 #endif
15077 #ifdef I_UNISTD
15078 #  include <unistd.h>
15079 #endif
15080 #ifdef I_TIME
15081 #  include <time.h>
15082 #endif
15083 #ifdef I_STDLIB
15084 #include <stdlib.h>
15085 #endif
15086 #ifdef I_STRING
15087 #  include <string.h>
15088 #else
15089 #  include <strings.h>
15090 #endif
15091 #ifdef I_MALLOC
15092 #  include <malloc.h>
15093 #endif
15094 int main()
15095 {
15096     time_t t = time(0L);
15097     char w_tz[]="TZ" "=GMT+5",
15098          e_tz[]="TZ" "=GMT-5",
15099         *tz_e = (char*)malloc(16),
15100         *tz_w = (char*)malloc(16);
15101     struct tm tm_e, tm_w;
15102     memset(&tm_e,'\0',sizeof(struct tm));
15103     memset(&tm_w,'\0',sizeof(struct tm));
15104     strcpy(tz_e,e_tz);
15105     strcpy(tz_w,w_tz);
15106
15107     putenv(tz_e);
15108     localtime_r(&t, &tm_e);
15109
15110     putenv(tz_w);
15111     localtime_r(&t, &tm_w);
15112
15113     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15114         return 1;
15115     return 0;
15116 }
15117 EOCP
15118         set try
15119         if eval $compile; then
15120             if $run ./try; then
15121                 d_localtime_r_needs_tzset=undef;
15122             else
15123                 d_localtime_r_needs_tzset=define;
15124             fi;
15125         else
15126             d_localtime_r_needs_tzset=undef;
15127         fi;
15128      ;;
15129   *)
15130      d_localtime_r_needs_tzset=undef;
15131      ;;
15132 esac
15133 $rm_try
15134
15135 : see if localeconv exists
15136 set localeconv d_locconv
15137 eval $inlibc
15138
15139 : see if lockf exists
15140 set lockf d_lockf
15141 eval $inlibc
15142
15143 : see if prototype for lseek is available
15144 echo " "
15145 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15146 eval $hasproto
15147
15148 : see if lstat exists
15149 set lstat d_lstat
15150 eval $inlibc
15151
15152 : see if madvise exists
15153 set madvise d_madvise
15154 eval $inlibc
15155
15156 : see if malloc_size exists
15157 set malloc_size d_malloc_size
15158 eval $inlibc
15159
15160 : see if malloc_size_good exists
15161 set malloc_good_size d_malloc_good_size
15162 eval $inlibc
15163
15164 : see if mblen exists
15165 set mblen d_mblen
15166 eval $inlibc
15167
15168 : see if mbstowcs exists
15169 set mbstowcs d_mbstowcs
15170 eval $inlibc
15171
15172 : see if mbtowc exists
15173 set mbtowc d_mbtowc
15174 eval $inlibc
15175
15176 : see if memchr exists
15177 set memchr d_memchr
15178 eval $inlibc
15179
15180 : see if memcmp exists
15181 set memcmp d_memcmp
15182 eval $inlibc
15183
15184 : see if memcpy exists
15185 set memcpy d_memcpy
15186 eval $inlibc
15187
15188 : see if memmove exists
15189 set memmove d_memmove
15190 eval $inlibc
15191
15192 : see if memset exists
15193 set memset d_memset
15194 eval $inlibc
15195
15196 : see if mkdir exists
15197 set mkdir d_mkdir
15198 eval $inlibc
15199
15200 : see if mkdtemp exists
15201 set mkdtemp d_mkdtemp
15202 eval $inlibc
15203
15204 : see if mkfifo exists
15205 set mkfifo d_mkfifo
15206 eval $inlibc
15207
15208 : see if mkstemp exists
15209 set mkstemp d_mkstemp
15210 eval $inlibc
15211
15212 : see if mkstemps exists
15213 set mkstemps d_mkstemps
15214 eval $inlibc
15215
15216 : see if mktime exists
15217 set mktime d_mktime
15218 eval $inlibc
15219
15220 : see if this is a sys/mman.h system
15221 set sys/mman.h i_sysmman
15222 eval $inhdr
15223
15224 : see if mmap exists
15225 set mmap d_mmap
15226 eval $inlibc
15227 : see what shmat returns
15228 : default to something harmless
15229 mmaptype='void *'
15230 case "$i_sysmman$d_mmap" in
15231 "$define$define")
15232         $cat >mmap.c <<'END'
15233 #include <sys/mman.h>
15234 void *mmap();
15235 END
15236         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15237                 mmaptype='void *'
15238         else
15239                 mmaptype='caddr_t'
15240         fi
15241         echo "and it returns ($mmaptype)." >&4
15242         ;;
15243 esac
15244
15245
15246
15247 : see if sqrtl exists
15248 set sqrtl d_sqrtl
15249 eval $inlibc
15250
15251 : see if scalbnl exists
15252 set scalbnl d_scalbnl
15253 eval $inlibc
15254
15255 : see if modfl exists
15256 set modfl d_modfl
15257 eval $inlibc
15258
15259 : see if prototype for modfl is available
15260 echo " "
15261 set d_modflproto modfl $i_math math.h
15262 eval $hasproto
15263
15264 d_modfl_pow32_bug="$undef"
15265
15266 case "$d_longdbl$d_modfl" in
15267 $define$define)
15268         $cat <<EOM
15269 Checking to see whether your modfl() is okay for large values...
15270 EOM
15271 $cat >try.c <<EOCP
15272 #include <math.h>
15273 #include <stdio.h>
15274 EOCP
15275 if $test "X$d_modflproto" != "X$define"; then
15276         $cat >>try.c <<EOCP
15277 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15278 long double modfl (long double, long double *);
15279 EOCP
15280 fi
15281 $cat >>try.c <<EOCP
15282 int main() {
15283     long double nv = 4294967303.15;
15284     long double v, w;
15285     v = modfl(nv, &w);
15286 #ifdef __GLIBC__
15287     printf("glibc");
15288 #endif
15289     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15290     return 0;
15291 }
15292 EOCP
15293         case "$osname:$gccversion" in
15294         aix:)   saveccflags="$ccflags"
15295                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15296         esac
15297         set try
15298         if eval $compile; then
15299                 foo=`$run ./try`
15300                 case "$foo" in
15301                 *" 4294967303.150000 1.150000 4294967302.000000")
15302                         echo >&4 "Your modfl() is broken for large values."
15303                         d_modfl_pow32_bug="$define"
15304                         case "$foo" in
15305                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15306                         ;;
15307                         esac
15308                         ;;
15309                 *" 4294967303.150000 0.150000 4294967303.000000")
15310                         echo >&4 "Your modfl() seems okay for large values."
15311                         ;;
15312                 *)      echo >&4 "I don't understand your modfl() at all."
15313                         d_modfl="$undef"
15314                         ;;
15315                 esac
15316                 $rm_try
15317         else
15318                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15319                 d_modfl="$undef"
15320         fi
15321         case "$osname:$gccversion" in
15322         aix:)   ccflags="$saveccflags" ;; # restore
15323         esac
15324         ;;
15325 esac
15326
15327 if $test "$uselongdouble" = "$define"; then
15328     message=""
15329     if $test "$d_sqrtl" != "$define"; then
15330         message="$message sqrtl"
15331     fi
15332     if $test "$d_modfl" != "$define"; then
15333         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15334             echo "You have both aintl and copysignl, so I can emulate modfl."
15335         else
15336             message="$message modfl"
15337         fi
15338     fi
15339     if $test "$d_frexpl" != "$define"; then
15340         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15341             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15342         else
15343             message="$message frexpl"
15344         fi
15345     fi
15346
15347     if $test "$message" != ""; then
15348         $cat <<EOM >&4
15349
15350 *** You requested the use of long doubles but you do not seem to have
15351 *** the following mathematical functions needed for long double support:
15352 ***    $message
15353 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15354 *** Cannot continue, aborting.
15355
15356 EOM
15357
15358         exit 1
15359     fi
15360 fi
15361
15362 : see if mprotect exists
15363 set mprotect d_mprotect
15364 eval $inlibc
15365
15366 : see if msgctl exists
15367 set msgctl d_msgctl
15368 eval $inlibc
15369
15370 : see if msgget exists
15371 set msgget d_msgget
15372 eval $inlibc
15373
15374 : see if msgsnd exists
15375 set msgsnd d_msgsnd
15376 eval $inlibc
15377
15378 : see if msgrcv exists
15379 set msgrcv d_msgrcv
15380 eval $inlibc
15381
15382 : see how much of the 'msg*(2)' library is present.
15383 h_msg=true
15384 echo " "
15385 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15386 *"$undef"*) h_msg=false;;
15387 esac
15388 case "$osname" in
15389 freebsd)
15390     case "`ipcs 2>&1`" in
15391     "SVID messages"*"not configured"*)
15392         echo "Your $osname does not have the msg*(2) configured." >&4
15393         h_msg=false
15394         val="$undef"
15395         set msgctl d_msgctl
15396         eval $setvar
15397         set msgget d_msgget
15398         eval $setvar
15399         set msgsnd d_msgsnd
15400         eval $setvar
15401         set msgrcv d_msgrcv
15402         eval $setvar
15403         ;;
15404     esac
15405     ;;
15406 esac
15407 : we could also check for sys/ipc.h ...
15408 if $h_msg && $test `./findhdr sys/msg.h`; then
15409         echo "You have the full msg*(2) library." >&4
15410         val="$define"
15411 else
15412         echo "You don't have the full msg*(2) library." >&4
15413         val="$undef"
15414 fi
15415 set d_msg
15416 eval $setvar
15417
15418 : Check for msghdr_s
15419 echo " "
15420 echo "Checking to see if your system supports struct msghdr..." >&4
15421 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15422 eval $hasstruct
15423 case "$d_msghdr_s" in
15424 "$define")      echo "Yes, it does."   ;;
15425 *)              echo "No, it doesn't." ;;
15426 esac
15427
15428
15429 : see if msync exists
15430 set msync d_msync
15431 eval $inlibc
15432
15433 : see if munmap exists
15434 set munmap d_munmap
15435 eval $inlibc
15436
15437 : see if nice exists
15438 set nice d_nice
15439 eval $inlibc
15440
15441 : see if this is a langinfo.h system
15442 set langinfo.h i_langinfo
15443 eval $inhdr
15444
15445 : see if nl_langinfo exists
15446 set nl_langinfo d_nl_langinfo
15447 eval $inlibc
15448
15449 : check for volatile keyword
15450 echo " "
15451 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15452 $cat >try.c <<'EOCP'
15453 int main()
15454 {
15455         typedef struct _goo_struct goo_struct;
15456         goo_struct * volatile goo = ((goo_struct *)0);
15457         struct _goo_struct {
15458                 long long_int;
15459                 int reg_int;
15460                 char char_var;
15461         };
15462         typedef unsigned short foo_t;
15463         char *volatile foo;
15464         volatile int bar;
15465         volatile foo_t blech;
15466         foo = foo;
15467 }
15468 EOCP
15469 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15470         val="$define"
15471         echo "Yup, it does."
15472 else
15473         val="$undef"
15474         echo "Nope, it doesn't."
15475 fi
15476 set d_volatile
15477 eval $setvar
15478 $rm_try
15479
15480 : Check basic sizes
15481 echo " "
15482 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15483
15484 case "$use64bitint:$d_quad:$quadtype" in
15485 define:define:?*)
15486         ivtype="$quadtype"
15487         uvtype="$uquadtype"
15488         ivsize=8
15489         uvsize=8
15490         ;;
15491 *)      ivtype="long"
15492         uvtype="unsigned long"
15493         ivsize=$longsize
15494         uvsize=$longsize
15495         ;;
15496 esac
15497
15498 case "$uselongdouble:$d_longdbl" in
15499 define:define)
15500         nvtype="long double"
15501         nvsize=$longdblsize
15502         ;;
15503 *)      nvtype=double
15504         nvsize=$doublesize
15505         ;;
15506 esac
15507
15508 $echo "(IV will be "$ivtype", $ivsize bytes)"
15509 $echo "(UV will be "$uvtype", $uvsize bytes)"
15510 $echo "(NV will be "$nvtype", $nvsize bytes)"
15511
15512 $cat >try.c <<EOCP
15513 #$i_inttypes I_INTTYPES
15514 #ifdef I_INTTYPES
15515 #include <inttypes.h>
15516 #endif
15517 #include <stdio.h>
15518 int main() {
15519 #ifdef INT8
15520    int8_t i =  INT8_MAX;
15521   uint8_t u = UINT8_MAX;
15522   printf("int8_t\n");
15523 #endif
15524 #ifdef INT16
15525    int16_t i =  INT16_MAX;
15526   uint16_t i = UINT16_MAX;
15527   printf("int16_t\n");
15528 #endif
15529 #ifdef INT32
15530    int32_t i =  INT32_MAX;
15531   uint32_t u = UINT32_MAX;
15532   printf("int32_t\n");
15533 #endif
15534 }
15535 EOCP
15536
15537 i8type="signed char"
15538 u8type="unsigned char"
15539 i8size=1
15540 u8size=1
15541
15542 case "$i16type" in
15543 '')     case "$shortsize" in
15544         2)      i16type=short
15545                 u16type="unsigned short"
15546                 i16size=$shortsize
15547                 u16size=$shortsize
15548                 ;;
15549         esac
15550         ;;
15551 esac
15552 case "$i16type" in
15553 '')     set try -DINT16
15554         if eval $compile; then
15555                 case "`$run ./try`" in
15556                 int16_t)
15557                         i16type=int16_t
15558                         u16type=uint16_t
15559                         i16size=2
15560                         u16size=2
15561                         ;;
15562                 esac
15563         fi
15564         ;;
15565 esac
15566 case "$i16type" in
15567 '')     if $test $shortsize -ge 2; then
15568                 i16type=short
15569                 u16type="unsigned short"
15570                 i16size=$shortsize
15571                 u16size=$shortsize
15572         fi
15573         ;;
15574 esac
15575
15576 case "$i32type" in
15577 '')     case "$longsize" in
15578         4)      i32type=long
15579                 u32type="unsigned long"
15580                 i32size=$longsize
15581                 u32size=$longsize
15582                 ;;
15583         *)      case "$intsize" in
15584                 4)      i32type=int
15585                         u32type="unsigned int"
15586                         i32size=$intsize
15587                         u32size=$intsize
15588                         ;;
15589                 esac
15590                 ;;
15591         esac
15592         ;;
15593 esac
15594 case "$i32type" in
15595 '')     set try -DINT32
15596         if eval $compile; then
15597                 case "`$run ./try`" in
15598                 int32_t)
15599                         i32type=int32_t
15600                         u32type=uint32_t
15601                         i32size=4
15602                         u32size=4
15603                         ;;
15604                 esac
15605         fi
15606         ;;
15607 esac
15608 case "$i32type" in
15609 '')     if $test $intsize -ge 4; then
15610                 i32type=int
15611                 u32type="unsigned int"
15612                 i32size=$intsize
15613                 u32size=$intsize
15614         fi
15615         ;;
15616 esac
15617
15618 case "$i64type" in
15619 '')     case "$d_quad:$quadtype" in
15620         define:?*)
15621                 i64type="$quadtype"
15622                 u64type="$uquadtype"
15623                 i64size=8
15624                 u64size=8
15625                 ;;
15626         esac
15627         ;;
15628 esac
15629
15630 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15631 : volatile so that the compiler has to store it out to memory.
15632 if test X"$d_volatile" = X"$define"; then
15633         volatile=volatile
15634 fi
15635 $cat <<EOP >try.c
15636 #include <stdio.h>
15637 #$i_stdlib I_STDLIB
15638 #ifdef I_STDLIB
15639 #include <stdlib.h>
15640 #endif
15641 #include <sys/types.h>
15642 #include <signal.h>
15643 #ifdef SIGFPE
15644 $volatile int bletched = 0;
15645 $signal_t blech(int s) { bletched = 1; }
15646 #endif
15647 int main() {
15648     $uvtype u = 0;
15649     $nvtype d;
15650     int     n = 8 * $uvsize;
15651     int     i;
15652 #ifdef SIGFPE
15653     signal(SIGFPE, blech);
15654 #endif
15655
15656     for (i = 0; i < n; i++) {
15657       u = u << 1 | ($uvtype)1;
15658       d = ($nvtype)u;
15659       if (($uvtype)d != u)
15660         break;
15661       if (d <= 0)
15662         break;
15663       d = ($nvtype)(u - 1);
15664       if (($uvtype)d != (u - 1))
15665         break;
15666 #ifdef SIGFPE
15667       if (bletched)
15668         break;
15669 #endif
15670     }
15671     printf("%d\n", ((i == n) ? -n : i));
15672     exit(0);
15673 }
15674 EOP
15675 set try
15676
15677 d_nv_preserves_uv="$undef"
15678 if eval $compile; then
15679         nv_preserves_uv_bits="`$run ./try`"
15680 fi
15681 case "$nv_preserves_uv_bits" in
15682 \-[1-9]*)
15683         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15684         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15685         d_nv_preserves_uv="$define"
15686         ;;
15687 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15688         d_nv_preserves_uv="$undef" ;;
15689 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15690         nv_preserves_uv_bits="0" ;;
15691 esac
15692 $rm_try
15693
15694 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15695 : volatile so that the compiler has to store it out to memory.
15696 if test X"$d_volatile" = X"$define"; then
15697         volatile=volatile
15698 fi
15699 $cat <<EOP >try.c
15700 #include <stdio.h>
15701
15702 typedef $nvtype NV;
15703
15704 int
15705 main() {
15706   NV value = 2;
15707   int count = 1;
15708
15709   while(count < 256) {
15710     $volatile NV up = value + 1.0;
15711     $volatile NV negated = -value;
15712     $volatile NV down = negated - 1.0;
15713     $volatile NV got_up = up - value;
15714     int up_good = got_up == 1.0;
15715     int got_down = down - negated;
15716     int down_good = got_down == -1.0;
15717
15718     if (down_good != up_good) {
15719       fprintf(stderr,
15720               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15721               up_good, (double) got_up, down_good, (double) got_down,
15722               count, (double) value);
15723       return 1;
15724     }
15725     if (!up_good) {
15726       while (1) {
15727         if (count > 8) {
15728           count -= 8;
15729           fputs("256.0", stdout);
15730         } else {
15731           count--;
15732           fputs("2.0", stdout);
15733         }
15734         if (!count) {
15735           puts("");
15736           return 0;
15737         }
15738         fputs("*", stdout);
15739       }
15740     }
15741     value *= 2;
15742     ++count;
15743   }
15744   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15745           count, (double) value);
15746   return 1;
15747 }
15748 EOP
15749 set try
15750
15751 nv_overflows_integers_at='0'
15752 if eval $compile; then
15753     xxx="`$run ./try`"
15754     case "$?" in
15755         0)
15756             case "$xxx" in
15757                 2*)  cat >&4 <<EOM
15758 The largest integer your NVs can preserve is equal to $xxx
15759 EOM
15760                     nv_overflows_integers_at="$xxx"
15761                     ;;
15762                 *)  cat >&4 <<EOM
15763 Cannot determine the largest integer value your NVs can hold, unexpected output
15764 '$xxx'
15765 EOM
15766                     ;;
15767             esac
15768             ;;
15769         *)  cat >&4 <<EOM
15770 Cannot determine the largest integer value your NVs can hold
15771 EOM
15772             ;;
15773     esac
15774 fi
15775 $rm_try
15776
15777 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15778 : volatile so that the compiler has to store it out to memory.
15779 if test X"$d_volatile" = X"$define"; then
15780         volatile=volatile
15781 fi
15782 $cat <<EOP >try.c
15783 #include <stdio.h>
15784 #$i_stdlib I_STDLIB
15785 #ifdef I_STDLIB
15786 #include <stdlib.h>
15787 #endif
15788 #$i_string I_STRING
15789 #ifdef I_STRING
15790 #  include <string.h>
15791 #else
15792 #  include <strings.h>
15793 #endif
15794 #include <sys/types.h>
15795 #include <signal.h>
15796 #ifdef SIGFPE
15797 $volatile int bletched = 0;
15798 $signal_t blech(int s) { bletched = 1; }
15799 #endif
15800
15801 int checkit($nvtype d, char *where) {
15802     unsigned char *p = (char *)&d;
15803     unsigned char *end = p + sizeof(d);
15804     int fail = 0;
15805
15806     while (p < end)
15807         fail += *p++;
15808
15809     if (!fail)
15810         return 0;
15811
15812     p = (char *)&d;
15813     printf("No - %s: 0x", where);
15814     while (p < end)
15815         printf ("%02X", *p++);
15816     printf("\n");
15817     return 1;
15818 }
15819
15820 int main(int argc, char **argv) {
15821     $nvtype d = 0.0;
15822     int fail = 0;
15823     fail += checkit(d, "0.0");
15824
15825     /* The compiler shouldn't be assuming that bletched is 0  */
15826     d = bletched;
15827
15828     fail += checkit(d, "bleched");
15829
15830 #ifdef SIGFPE
15831     signal(SIGFPE, blech);
15832 #endif
15833
15834     /* Paranoia - the compiler should have no way of knowing that ANSI says
15835        that argv[argc] will always be NULL.  Actually, if it did assume this it
15836        would be buggy, as this is C and main() can be called from elsewhere in
15837        the program.  */
15838     d = argv[argc] ? 1 : 0;
15839
15840     if (d) {
15841         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15842     }
15843
15844     fail += checkit(d, "ternary");
15845
15846     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15847
15848     if (d != 0.0) {
15849         printf("No - memset doesn't give 0.0\n");
15850         /* This might just blow up:  */
15851         printf("(gives %g)\n", d);
15852         return 1;
15853     }
15854
15855 #ifdef SIGFPE
15856     if (bletched) {
15857         printf("No - something bleched\n");
15858         return 1;
15859     }
15860 #endif
15861     if (fail) {
15862       printf("No - %d fail(s)\n", fail);
15863       return 1;
15864     }
15865     printf("Yes\n");
15866     return 0;
15867 }
15868 EOP
15869 set try
15870
15871 d_nv_zero_is_allbits_zero="$undef"
15872 if eval $compile; then
15873     xxx="`$run ./try`"
15874     case "$?" in
15875         0)
15876             case "$xxx" in
15877                 Yes)  cat >&4 <<EOM
15878 0.0 is represented as all bits zero in memory
15879 EOM
15880                     d_nv_zero_is_allbits_zero="$define"
15881                     ;;
15882                 *)  cat >&4 <<EOM
15883 0.0 is not represented as all bits zero in memory
15884 EOM
15885                     d_nv_zero_is_allbits_zero="$undef"
15886                     ;;
15887             esac
15888             ;;
15889         *)  cat >&4 <<EOM
15890 0.0 is not represented as all bits zero in memory
15891 EOM
15892             d_nv_zero_is_allbits_zero="$undef"
15893             ;;
15894     esac
15895 fi
15896 $rm_try
15897
15898 : check for off64_t
15899 echo " "
15900 echo "Checking to see if you have off64_t..." >&4
15901 $cat >try.c <<EOCP
15902 #include <sys/types.h>
15903 #include <unistd.h>
15904 int main() { off64_t x = 7; }
15905 EOCP
15906 set try
15907 if eval $compile; then
15908         val="$define"
15909         echo "You have off64_t."
15910 else
15911         val="$undef"
15912         echo "You do not have off64_t."
15913         case "$lseeksize" in
15914         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15915         esac
15916 fi
15917 $rm_try
15918 set d_off64_t
15919 eval $setvar
15920
15921 : how to create joinable pthreads
15922 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15923         echo " "
15924         echo "Checking what constant to use for creating joinable pthreads..." >&4
15925         $cat >try.c <<'EOCP'
15926 #include <pthread.h>
15927 int main() {
15928     int detachstate = JOINABLE;
15929 }
15930 EOCP
15931         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15932         if eval $compile; then
15933                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15934                 val="$undef" # Yes, undef.
15935                 set d_old_pthread_create_joinable
15936                 eval $setvar
15937                 val=""
15938                 set old_pthread_create_joinable
15939                 eval $setvar
15940         else
15941                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15942                 if eval $compile; then
15943                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15944                         val="$define"
15945                         set d_old_pthread_create_joinable
15946                         eval $setvar
15947                         val=PTHREAD_CREATE_UNDETACHED
15948                         set old_pthread_create_joinable
15949                         eval $setvar
15950                 else
15951                         set try -DJOINABLE=__UNDETACHED
15952                         if eval $compile; then
15953                                 echo "You seem to use __UNDETACHED." >&4
15954                                 val="$define"
15955                                 set d_old_pthread_create_joinable
15956                                 eval $setvar
15957                                 val=__UNDETACHED
15958                                 set old_pthread_create_joinable
15959                                 eval $setvar
15960                         else
15961                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15962                                 val="$define"
15963                                 set d_old_pthread_create_joinable
15964                                 eval $setvar
15965                                 val=0
15966                                 set old_pthread_create_joinable
15967                                 eval $setvar
15968                         fi
15969                 fi
15970         fi
15971         $rm_try
15972 else
15973     d_old_pthread_create_joinable="$undef"
15974     old_pthread_create_joinable=""
15975 fi
15976
15977 : see if pause exists
15978 set pause d_pause
15979 eval $inlibc
15980
15981 : see if poll exists
15982 set poll d_poll
15983 eval $inlibc
15984
15985 : see if readlink exists
15986 set readlink d_readlink
15987 eval $inlibc
15988
15989 : Check if exe is symlink to abs path of executing program
15990 echo " "
15991 procselfexe=''
15992 val="$undef"
15993 case "$d_readlink" in
15994 "$define")
15995         if $issymlink /proc/self/exe ; then
15996                 $ls -l /proc/self/exe > reflect
15997                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15998                         echo "You have Linux-like /proc/self/exe."
15999                         procselfexe='"/proc/self/exe"'
16000                         val="$define"
16001                 fi
16002         fi
16003         if $issymlink /proc/curproc/file ; then
16004                 $ls -l /proc/curproc/file > reflect
16005                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16006                         echo "You have BSD-like /proc/curproc/file."
16007                         procselfexe='"/proc/curproc/file"'
16008                         val="$define"
16009                 fi
16010         fi
16011         ;;
16012 esac
16013 $rm -f reflect
16014 set d_procselfexe
16015 eval $setvar
16016
16017 : backward compatibility for d_hvfork
16018 if test X$d_hvfork != X; then
16019         d_vfork="$d_hvfork"
16020         d_hvfork=''
16021 fi
16022 : see if there is a vfork
16023 val=''
16024 set vfork val
16025 eval $inlibc
16026
16027 d_pseudofork=$undef
16028
16029 : Ok, but do we want to use it. vfork is reportedly unreliable in
16030 : perl on Solaris 2.x, and probably elsewhere.
16031 case "$val" in
16032 $define)
16033         echo " "
16034         case "$usevfork" in
16035         false) dflt='n';;
16036         *) dflt='y';;
16037         esac
16038         cat <<'EOM'
16039
16040 Perl can only use a vfork() that doesn't suffer from strict
16041 restrictions on calling functions or modifying global data in
16042 the child.  For example, glibc-2.1 contains such a vfork()
16043 that is unsuitable.  If your system provides a proper fork()
16044 call, chances are that you do NOT want perl to use vfork().
16045
16046 EOM
16047         rp="Do you still want to use vfork()?"
16048         . ./myread
16049         case "$ans" in
16050         y|Y) ;;
16051         *)
16052                 echo "Ok, we won't use vfork()."
16053                 val="$undef"
16054                 ;;
16055         esac
16056         ;;
16057 esac
16058 set d_vfork
16059 eval $setvar
16060 case "$d_vfork" in
16061 $define) usevfork='true';;
16062 *) usevfork='false';;
16063 esac
16064
16065 : see whether the pthread_atfork exists
16066 $cat >try.c <<EOP
16067 #include <pthread.h>
16068 #include <stdio.h>
16069 int main() {
16070 #ifdef  PTHREAD_ATFORK
16071         pthread_atfork(NULL,NULL,NULL);
16072 #endif
16073 }
16074 EOP
16075
16076 : see if pthread_atfork exists
16077 set try -DPTHREAD_ATFORK
16078 if eval $compile; then
16079     val="$define"
16080 else
16081     val="$undef"
16082 fi
16083 case "$usethreads" in
16084 $define)
16085         case "$val" in
16086         $define) echo 'pthread_atfork found.' >&4        ;;
16087         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16088         esac
16089 esac
16090 set d_pthread_atfork
16091 eval $setvar
16092
16093 : see if pthread_attr_setscope exists
16094 set pthread_attr_setscope d_pthread_attr_setscope
16095 eval $inlibc
16096
16097 : see whether the various POSIXish _yields exist
16098 $cat >try.c <<EOP
16099 #include <pthread.h>
16100 #include <stdio.h>
16101 int main() {
16102 #ifdef SCHED_YIELD
16103         sched_yield();
16104 #else
16105 #ifdef PTHREAD_YIELD
16106         pthread_yield();
16107 #else
16108 #ifdef PTHREAD_YIELD_NULL
16109         pthread_yield(NULL);
16110 #endif
16111 #endif
16112 #endif
16113 }
16114 EOP
16115 : see if sched_yield exists
16116 set try -DSCHED_YIELD
16117 if eval $compile; then
16118     val="$define"
16119     sched_yield='sched_yield()'
16120 else
16121     val="$undef"
16122 fi
16123 case "$usethreads" in
16124 $define)
16125         case "$val" in
16126         $define) echo 'sched_yield() found.' >&4        ;;
16127         *)       echo 'sched_yield() NOT found.' >&4    ;;
16128         esac
16129 esac
16130 set d_sched_yield
16131 eval $setvar
16132
16133 : see if pthread_yield exists
16134 set try -DPTHREAD_YIELD
16135 if eval $compile; then
16136     val="$define"
16137     case "$sched_yield" in
16138     '') sched_yield='pthread_yield()' ;;
16139     esac
16140 else
16141     set try -DPTHREAD_YIELD_NULL
16142     if eval $compile; then
16143         val="$define"
16144         case "$sched_yield" in
16145         '') sched_yield='pthread_yield(NULL)' ;;
16146         esac
16147     else
16148         val="$undef"
16149     fi
16150 fi
16151 case "$usethreads" in
16152 $define)
16153         case "$val" in
16154         $define) echo 'pthread_yield() found.' >&4      ;;
16155         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16156         esac
16157         ;;
16158 esac
16159 set d_pthread_yield
16160 eval $setvar
16161 case "$sched_yield" in
16162 '') sched_yield=undef ;;
16163 esac
16164 $rm_try
16165
16166 : see if random_r exists
16167 set random_r d_random_r
16168 eval $inlibc
16169 case "$d_random_r" in
16170 "$define")
16171         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16172         case "$d_random_r_proto:$usethreads" in
16173         ":define")      d_random_r_proto=define
16174                 set d_random_r_proto random_r $hdrs
16175                 eval $hasproto ;;
16176         *)      ;;
16177         esac
16178         case "$d_random_r_proto" in
16179         define)
16180         case "$random_r_proto" in
16181         ''|0) try='int random_r(int*, struct random_data*);'
16182         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16183         esac
16184         case "$random_r_proto" in
16185         ''|0) try='int random_r(long*, struct random_data*);'
16186         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16187         esac
16188         case "$random_r_proto" in
16189         ''|0) try='int random_r(struct random_data*, int32_t*);'
16190         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16191         esac
16192         case "$random_r_proto" in
16193         ''|0)   d_random_r=undef
16194                 random_r_proto=0
16195                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16196         * )     case "$random_r_proto" in
16197                 REENTRANT_PROTO*) ;;
16198                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16199                 esac
16200                 echo "Prototype: $try" ;;
16201         esac
16202         ;;
16203         *)      case "$usethreads" in
16204                 define) echo "random_r has no prototype, not using it." >&4 ;;
16205                 esac
16206                 d_random_r=undef
16207                 random_r_proto=0
16208                 ;;
16209         esac
16210         ;;
16211 *)      random_r_proto=0
16212         ;;
16213 esac
16214
16215 : see if readdir and friends exist
16216 set readdir d_readdir
16217 eval $inlibc
16218 set seekdir d_seekdir
16219 eval $inlibc
16220 set telldir d_telldir
16221 eval $inlibc
16222 set rewinddir d_rewinddir
16223 eval $inlibc
16224
16225 : see if readdir64_r exists
16226 set readdir64_r d_readdir64_r
16227 eval $inlibc
16228 case "$d_readdir64_r" in
16229 "$define")
16230         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16231         case "$d_readdir64_r_proto:$usethreads" in
16232         ":define")      d_readdir64_r_proto=define
16233                 set d_readdir64_r_proto readdir64_r $hdrs
16234                 eval $hasproto ;;
16235         *)      ;;
16236         esac
16237         case "$d_readdir64_r_proto" in
16238         define)
16239         case "$readdir64_r_proto" in
16240         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16241         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16242         esac
16243         case "$readdir64_r_proto" in
16244         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16245         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16246         esac
16247         case "$readdir64_r_proto" in
16248         ''|0)   d_readdir64_r=undef
16249                 readdir64_r_proto=0
16250                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16251         * )     case "$readdir64_r_proto" in
16252                 REENTRANT_PROTO*) ;;
16253                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16254                 esac
16255                 echo "Prototype: $try" ;;
16256         esac
16257         ;;
16258         *)      case "$usethreads" in
16259                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16260                 esac
16261                 d_readdir64_r=undef
16262                 readdir64_r_proto=0
16263                 ;;
16264         esac
16265         ;;
16266 *)      readdir64_r_proto=0
16267         ;;
16268 esac
16269
16270 : see if readdir_r exists
16271 set readdir_r d_readdir_r
16272 eval $inlibc
16273 case "$d_readdir_r" in
16274 "$define")
16275         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16276         case "$d_readdir_r_proto:$usethreads" in
16277         ":define")      d_readdir_r_proto=define
16278                 set d_readdir_r_proto readdir_r $hdrs
16279                 eval $hasproto ;;
16280         *)      ;;
16281         esac
16282         case "$d_readdir_r_proto" in
16283         define)
16284         case "$readdir_r_proto" in
16285         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16286         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16287         esac
16288         case "$readdir_r_proto" in
16289         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16290         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16291         esac
16292         case "$readdir_r_proto" in
16293         ''|0)   d_readdir_r=undef
16294                 readdir_r_proto=0
16295                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16296         * )     case "$readdir_r_proto" in
16297                 REENTRANT_PROTO*) ;;
16298                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16299                 esac
16300                 echo "Prototype: $try" ;;
16301         esac
16302         ;;
16303         *)      case "$usethreads" in
16304                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16305                 esac
16306                 d_readdir_r=undef
16307                 readdir_r_proto=0
16308                 ;;
16309         esac
16310         ;;
16311 *)      readdir_r_proto=0
16312         ;;
16313 esac
16314
16315 : see if readv exists
16316 set readv d_readv
16317 eval $inlibc
16318
16319 : see if recvmsg exists
16320 set recvmsg d_recvmsg
16321 eval $inlibc
16322
16323 : see if rename exists
16324 set rename d_rename
16325 eval $inlibc
16326
16327 : see if rmdir exists
16328 set rmdir d_rmdir
16329 eval $inlibc
16330
16331 : see if memory.h is available.
16332 val=''
16333 set memory.h val
16334 eval $inhdr
16335
16336 : See if it conflicts with string.h
16337 case "$val" in
16338 $define)
16339         case "$strings" in
16340         '') ;;
16341         *)
16342                 $cppstdin $cppflags $cppminus < $strings > mem.h
16343                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16344                         echo " "
16345                         echo "We won't be including <memory.h>."
16346                         val="$undef"
16347                 fi
16348                 $rm -f mem.h
16349                 ;;
16350         esac
16351 esac
16352 set i_memory
16353 eval $setvar
16354
16355 : can bcopy handle overlapping blocks?
16356 echo " "
16357 val="$undef"
16358 case "$d_memmove" in
16359 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16360 *)      case "$d_bcopy" in
16361         "$define")
16362                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16363                 $cat >try.c <<EOCP
16364 #$i_memory I_MEMORY
16365 #$i_stdlib I_STDLIB
16366 #$i_string I_STRING
16367 #$i_unistd I_UNISTD
16368 EOCP
16369         $cat >>try.c <<'EOCP'
16370 #include <stdio.h>
16371 #ifdef I_MEMORY
16372 #  include <memory.h>
16373 #endif
16374 #ifdef I_STDLIB
16375 #  include <stdlib.h>
16376 #endif
16377 #ifdef I_STRING
16378 #  include <string.h>
16379 #else
16380 #  include <strings.h>
16381 #endif
16382 #ifdef I_UNISTD
16383 #  include <unistd.h>  /* Needed for NetBSD */
16384 #endif
16385 int main()
16386 {
16387 char buf[128], abc[128];
16388 char *b;
16389 int len;
16390 int off;
16391 int align;
16392
16393 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16394    try to store the string in read-only memory. */
16395 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16396
16397 for (align = 7; align >= 0; align--) {
16398         for (len = 36; len; len--) {
16399                 b = buf+align;
16400                 bcopy(abc, b, len);
16401                 for (off = 1; off <= len; off++) {
16402                         bcopy(b, b+off, len);
16403                         bcopy(b+off, b, len);
16404                         if (bcmp(b, abc, len))
16405                                 exit(1);
16406                 }
16407         }
16408 }
16409 exit(0);
16410 }
16411 EOCP
16412                 set try
16413                 if eval $compile_ok; then
16414                         if $run ./try 2>/dev/null; then
16415                                 echo "Yes, it can."
16416                                 val="$define"
16417                         else
16418                                 echo "It can't, sorry."
16419                         fi
16420                 else
16421                         echo "(I can't compile the test program, so we'll assume not...)"
16422                 fi
16423                 ;;
16424         esac
16425         $rm_try
16426         ;;
16427 esac
16428 set d_safebcpy
16429 eval $setvar
16430
16431 : can memcpy handle overlapping blocks?
16432 echo " "
16433 val="$undef"
16434 case "$d_memmove" in
16435 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16436 *)      case "$d_memcpy" in
16437         "$define")
16438                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16439                 $cat >try.c <<EOCP
16440 #$i_memory I_MEMORY
16441 #$i_stdlib I_STDLIB
16442 #$i_string I_STRING
16443 #$i_unistd I_UNISTD
16444 EOCP
16445         $cat >>try.c <<'EOCP'
16446 #include <stdio.h>
16447 #ifdef I_MEMORY
16448 #  include <memory.h>
16449 #endif
16450 #ifdef I_STDLIB
16451 #  include <stdlib.h>
16452 #endif
16453 #ifdef I_STRING
16454 #  include <string.h>
16455 #else
16456 #  include <strings.h>
16457 #endif
16458 #ifdef I_UNISTD
16459 #  include <unistd.h>  /* Needed for NetBSD */
16460 #endif
16461 int main()
16462 {
16463 char buf[128], abc[128];
16464 char *b;
16465 int len;
16466 int off;
16467 int align;
16468
16469 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16470    try to store the string in read-only memory. */
16471 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16472
16473 for (align = 7; align >= 0; align--) {
16474         for (len = 36; len; len--) {
16475                 b = buf+align;
16476                 memcpy(b, abc, len);
16477                 for (off = 1; off <= len; off++) {
16478                         memcpy(b+off, b, len);
16479                         memcpy(b, b+off, len);
16480                         if (memcmp(b, abc, len))
16481                                 exit(1);
16482                 }
16483         }
16484 }
16485 exit(0);
16486 }
16487 EOCP
16488                 set try
16489                 if eval $compile_ok; then
16490                         if $run ./try 2>/dev/null; then
16491                                 echo "Yes, it can."
16492                                 val="$define"
16493                         else
16494                                 echo "It can't, sorry."
16495                         fi
16496                 else
16497                         echo "(I can't compile the test program, so we'll assume not...)"
16498                 fi
16499                 ;;
16500         esac
16501         $rm_try
16502         ;;
16503 esac
16504 set d_safemcpy
16505 eval $setvar
16506
16507 : can memcmp be trusted to compare relative magnitude?
16508 val="$undef"
16509 case "$d_memcmp" in
16510 "$define")
16511         echo " "
16512         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16513         $cat >try.c <<EOCP
16514 #$i_memory I_MEMORY
16515 #$i_stdlib I_STDLIB
16516 #$i_string I_STRING
16517 #$i_unistd I_UNISTD
16518 EOCP
16519         $cat >>try.c <<'EOCP'
16520 #include <stdio.h>
16521 #ifdef I_MEMORY
16522 #  include <memory.h>
16523 #endif
16524 #ifdef I_STDLIB
16525 #  include <stdlib.h>
16526 #endif
16527 #ifdef I_STRING
16528 #  include <string.h>
16529 #else
16530 #  include <strings.h>
16531 #endif
16532 #ifdef I_UNISTD
16533 #  include <unistd.h>  /* Needed for NetBSD */
16534 #endif
16535 int main()
16536 {
16537 char a = -1;
16538 char b = 0;
16539 if ((a < b) && memcmp(&a, &b, 1) < 0)
16540         exit(1);
16541 exit(0);
16542 }
16543 EOCP
16544         set try
16545         if eval $compile_ok; then
16546                 if $run ./try 2>/dev/null; then
16547                         echo "Yes, it can."
16548                         val="$define"
16549                 else
16550                         echo "No, it can't (it uses signed chars)."
16551                 fi
16552         else
16553                 echo "(I can't compile the test program, so we'll assume not...)"
16554         fi
16555         ;;
16556 esac
16557 $rm_try
16558 set d_sanemcmp
16559 eval $setvar
16560
16561 : see if prototype for sbrk is available
16562 echo " "
16563 set d_sbrkproto sbrk $i_unistd unistd.h
16564 eval $hasproto
16565
16566 : see if select exists
16567 set select d_select
16568 eval $inlibc
16569
16570 : see if semctl exists
16571 set semctl d_semctl
16572 eval $inlibc
16573
16574 : see if semget exists
16575 set semget d_semget
16576 eval $inlibc
16577
16578 : see if semop exists
16579 set semop d_semop
16580 eval $inlibc
16581
16582 : see how much of the 'sem*(2)' library is present.
16583 h_sem=true
16584 echo " "
16585 case "$d_semctl$d_semget$d_semop" in
16586 *"$undef"*) h_sem=false;;
16587 esac
16588 case "$osname" in
16589 freebsd)
16590     case "`ipcs 2>&1`" in
16591     "SVID messages"*"not configured"*)
16592         echo "Your $osname does not have the sem*(2) configured." >&4
16593         h_sem=false
16594         val="$undef"
16595         set semctl d_semctl
16596         eval $setvar
16597         set semget d_semget
16598         eval $setvar
16599         set semop d_semop
16600         eval $setvar
16601         ;;
16602     esac
16603     ;;
16604 esac
16605 : we could also check for sys/ipc.h ...
16606 if $h_sem && $test `./findhdr sys/sem.h`; then
16607         echo "You have the full sem*(2) library." >&4
16608         val="$define"
16609 else
16610         echo "You don't have the full sem*(2) library." >&4
16611         val="$undef"
16612 fi
16613 set d_sem
16614 eval $setvar
16615
16616 : see whether sys/sem.h defines union semun
16617 echo " "
16618 $cat > try.c <<'END'
16619 #include <sys/types.h>
16620 #include <sys/ipc.h>
16621 #include <sys/sem.h>
16622 int main () { union semun semun; semun.buf = 0; }
16623 END
16624 set try
16625 if eval $compile; then
16626     echo "You have union semun in <sys/sem.h>." >&4
16627     val="$define"
16628 else
16629     echo "You do not have union semun in <sys/sem.h>." >&4
16630     val="$undef"
16631 fi
16632 $rm_try
16633 set d_union_semun
16634 eval $setvar
16635
16636 : see how to do semctl IPC_STAT
16637 case "$d_sem" in
16638 $define)
16639     echo " "
16640     $cat > tryh.h <<END
16641 #ifndef S_IRUSR
16642 #   ifdef S_IREAD
16643 #       define S_IRUSR S_IREAD
16644 #       define S_IWUSR S_IWRITE
16645 #       define S_IXUSR S_IEXEC
16646 #   else
16647 #       define S_IRUSR 0400
16648 #       define S_IWUSR 0200
16649 #       define S_IXUSR 0100
16650 #   endif
16651 #   define S_IRGRP (S_IRUSR>>3)
16652 #   define S_IWGRP (S_IWUSR>>3)
16653 #   define S_IXGRP (S_IXUSR>>3)
16654 #   define S_IROTH (S_IRUSR>>6)
16655 #   define S_IWOTH (S_IWUSR>>6)
16656 #   define S_IXOTH (S_IXUSR>>6)
16657 #endif
16658 #ifndef S_IRWXU
16659 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16660 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16661 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16662 #endif
16663 END
16664     : see whether semctl IPC_STAT can use union semun
16665     case "$d_semctl_semun" in
16666     '')
16667       val="$undef"
16668       $cat > try.c <<END
16669 #include <sys/types.h>
16670 #include <sys/ipc.h>
16671 #include <sys/sem.h>
16672 #include <sys/stat.h>
16673 #include <stdio.h>
16674 #include <errno.h>
16675 #include "tryh.h"
16676 #ifndef errno
16677 extern int errno;
16678 #endif
16679 #$d_union_semun HAS_UNION_SEMUN
16680 int main() {
16681     union semun
16682 #ifndef HAS_UNION_SEMUN
16683     {
16684         int val;
16685         struct semid_ds *buf;
16686         unsigned short *array;
16687     }
16688 #endif
16689     arg;
16690     int sem, st;
16691
16692 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16693     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16694     if (sem > -1) {
16695         struct semid_ds argbuf;
16696         arg.buf = &argbuf;
16697 #       ifdef IPC_STAT
16698         st = semctl(sem, 0, IPC_STAT, arg);
16699         if (st == 0)
16700             printf("semun\n");
16701         else
16702 #       endif /* IPC_STAT */
16703             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16704 #       ifdef IPC_RMID
16705         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16706 #       endif /* IPC_RMID */
16707             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16708     } else
16709 #endif /* IPC_PRIVATE && ... */
16710         printf("semget failed: errno = %d\n", errno);
16711   return 0;
16712 }
16713 END
16714       set try
16715       if eval $compile; then
16716           xxx=`$run ./try`
16717           case "$xxx" in
16718           semun) val="$define" ;;
16719           esac
16720       fi
16721       $rm_try
16722       set d_semctl_semun
16723       eval $setvar
16724       ;;
16725     esac
16726     case "$d_semctl_semun" in
16727     $define)
16728         echo "You can use union semun for semctl IPC_STAT." >&4
16729         also='also'
16730         ;;
16731     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16732         also=''
16733         ;;
16734     esac
16735
16736     : see whether semctl IPC_STAT can use struct semid_ds pointer
16737     case "$d_semctl_semid_ds" in
16738     '')
16739       val="$undef"
16740       $cat > try.c <<'END'
16741 #include <sys/types.h>
16742 #include <sys/ipc.h>
16743 #include <sys/sem.h>
16744 #include <sys/stat.h>
16745 #include "tryh.h"
16746 #include <stdio.h>
16747 #include <errno.h>
16748 #ifndef errno
16749 extern int errno;
16750 #endif
16751 int main() {
16752     struct semid_ds arg;
16753     int sem, st;
16754
16755 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16756     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16757     if (sem > -1) {
16758 #       ifdef IPC_STAT
16759         st = semctl(sem, 0, IPC_STAT, &arg);
16760         if (st == 0)
16761             printf("semid_ds\n");
16762         else
16763 #       endif /* IPC_STAT */
16764             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16765 #       ifdef IPC_RMID
16766         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16767 #       endif /* IPC_RMID */
16768             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16769     } else
16770 #endif /* IPC_PRIVATE && ... */
16771         printf("semget failed: errno = %d\n", errno);
16772
16773     return 0;
16774 }
16775 END
16776       set try
16777       if eval $compile; then
16778           xxx=`$run ./try`
16779           case "$xxx" in
16780           semid_ds) val="$define" ;;
16781           esac
16782       fi
16783       $rm_try
16784       set d_semctl_semid_ds
16785       eval $setvar
16786       ;;
16787     esac
16788     case "$d_semctl_semid_ds" in
16789     $define)
16790         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16791         ;;
16792     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16793         ;;
16794     esac
16795     ;;
16796 *)  val="$undef"
16797
16798     # We do not have the full sem*(2) library, so assume we can not
16799     # use either.
16800
16801     set d_semctl_semun
16802     eval $setvar
16803
16804     set d_semctl_semid_ds
16805     eval $setvar
16806     ;;
16807 esac
16808 $rm_try tryh.h
16809
16810 : see if sendmsg exists
16811 set sendmsg d_sendmsg
16812 eval $inlibc
16813
16814 : see if setegid exists
16815 set setegid d_setegid
16816 eval $inlibc
16817
16818 : see if seteuid exists
16819 set seteuid d_seteuid
16820 eval $inlibc
16821
16822 : see if setgrent exists
16823 set setgrent d_setgrent
16824 eval $inlibc
16825
16826 : see if setgrent_r exists
16827 set setgrent_r d_setgrent_r
16828 eval $inlibc
16829 case "$d_setgrent_r" in
16830 "$define")
16831         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16832         case "$d_setgrent_r_proto:$usethreads" in
16833         ":define")      d_setgrent_r_proto=define
16834                 set d_setgrent_r_proto setgrent_r $hdrs
16835                 eval $hasproto ;;
16836         *)      ;;
16837         esac
16838         case "$d_setgrent_r_proto" in
16839         define)
16840         case "$setgrent_r_proto" in
16841         ''|0) try='int setgrent_r(FILE**);'
16842         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16843         esac
16844         case "$setgrent_r_proto" in
16845         ''|0) try='void setgrent_r(FILE**);'
16846         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16847         esac
16848         case "$setgrent_r_proto" in
16849         ''|0)   d_setgrent_r=undef
16850                 setgrent_r_proto=0
16851                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16852         * )     case "$setgrent_r_proto" in
16853                 REENTRANT_PROTO*) ;;
16854                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16855                 esac
16856                 echo "Prototype: $try" ;;
16857         esac
16858         ;;
16859         *)      case "$usethreads" in
16860                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16861                 esac
16862                 d_setgrent_r=undef
16863                 setgrent_r_proto=0
16864                 ;;
16865         esac
16866         ;;
16867 *)      setgrent_r_proto=0
16868         ;;
16869 esac
16870
16871 : see if sethostent exists
16872 set sethostent d_sethent
16873 eval $inlibc
16874
16875 : see if sethostent_r exists
16876 set sethostent_r d_sethostent_r
16877 eval $inlibc
16878 case "$d_sethostent_r" in
16879 "$define")
16880         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16881         case "$d_sethostent_r_proto:$usethreads" in
16882         ":define")      d_sethostent_r_proto=define
16883                 set d_sethostent_r_proto sethostent_r $hdrs
16884                 eval $hasproto ;;
16885         *)      ;;
16886         esac
16887         case "$d_sethostent_r_proto" in
16888         define)
16889         case "$sethostent_r_proto" in
16890         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16891         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16892         esac
16893         case "$sethostent_r_proto" in
16894         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16895         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16896         esac
16897         case "$sethostent_r_proto" in
16898         ''|0)   d_sethostent_r=undef
16899                 sethostent_r_proto=0
16900                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16901         * )     case "$sethostent_r_proto" in
16902                 REENTRANT_PROTO*) ;;
16903                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16904                 esac
16905                 echo "Prototype: $try" ;;
16906         esac
16907         ;;
16908         *)      case "$usethreads" in
16909                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16910                 esac
16911                 d_sethostent_r=undef
16912                 sethostent_r_proto=0
16913                 ;;
16914         esac
16915         ;;
16916 *)      sethostent_r_proto=0
16917         ;;
16918 esac
16919
16920 : see if setitimer exists
16921 set setitimer d_setitimer
16922 eval $inlibc
16923
16924 : see if setlinebuf exists
16925 set setlinebuf d_setlinebuf
16926 eval $inlibc
16927
16928 : see if setlocale exists
16929 set setlocale d_setlocale
16930 eval $inlibc
16931
16932 : see if locale.h is available
16933 set locale.h i_locale
16934 eval $inhdr
16935
16936 : see if setlocale_r exists
16937 set setlocale_r d_setlocale_r
16938 eval $inlibc
16939 case "$d_setlocale_r" in
16940 "$define")
16941         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16942         case "$d_setlocale_r_proto:$usethreads" in
16943         ":define")      d_setlocale_r_proto=define
16944                 set d_setlocale_r_proto setlocale_r $hdrs
16945                 eval $hasproto ;;
16946         *)      ;;
16947         esac
16948         case "$d_setlocale_r_proto" in
16949         define)
16950         case "$setlocale_r_proto" in
16951         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16952         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16953         esac
16954         case "$setlocale_r_proto" in
16955         ''|0)   d_setlocale_r=undef
16956                 setlocale_r_proto=0
16957                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16958         * )     case "$setlocale_r_proto" in
16959                 REENTRANT_PROTO*) ;;
16960                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16961                 esac
16962                 echo "Prototype: $try" ;;
16963         esac
16964         ;;
16965         *)      case "$usethreads" in
16966                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16967                 esac
16968                 d_setlocale_r=undef
16969                 setlocale_r_proto=0
16970                 ;;
16971         esac
16972         ;;
16973 *)      setlocale_r_proto=0
16974         ;;
16975 esac
16976
16977 : see if setnetent exists
16978 set setnetent d_setnent
16979 eval $inlibc
16980
16981 : see if setnetent_r exists
16982 set setnetent_r d_setnetent_r
16983 eval $inlibc
16984 case "$d_setnetent_r" in
16985 "$define")
16986         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16987         case "$d_setnetent_r_proto:$usethreads" in
16988         ":define")      d_setnetent_r_proto=define
16989                 set d_setnetent_r_proto setnetent_r $hdrs
16990                 eval $hasproto ;;
16991         *)      ;;
16992         esac
16993         case "$d_setnetent_r_proto" in
16994         define)
16995         case "$setnetent_r_proto" in
16996         ''|0) try='int setnetent_r(int, struct netent_data*);'
16997         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
16998         esac
16999         case "$setnetent_r_proto" in
17000         ''|0) try='void setnetent_r(int, struct netent_data*);'
17001         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17002         esac
17003         case "$setnetent_r_proto" in
17004         ''|0)   d_setnetent_r=undef
17005                 setnetent_r_proto=0
17006                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17007         * )     case "$setnetent_r_proto" in
17008                 REENTRANT_PROTO*) ;;
17009                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17010                 esac
17011                 echo "Prototype: $try" ;;
17012         esac
17013         ;;
17014         *)      case "$usethreads" in
17015                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17016                 esac
17017                 d_setnetent_r=undef
17018                 setnetent_r_proto=0
17019                 ;;
17020         esac
17021         ;;
17022 *)      setnetent_r_proto=0
17023         ;;
17024 esac
17025
17026 : see if setprotoent exists
17027 set setprotoent d_setpent
17028 eval $inlibc
17029
17030 : see if setpgid exists
17031 set setpgid d_setpgid
17032 eval $inlibc
17033
17034 : see if setpgrp2 exists
17035 set setpgrp2 d_setpgrp2
17036 eval $inlibc
17037
17038 : see if setpriority exists
17039 set setpriority d_setprior
17040 eval $inlibc
17041
17042 : see if setproctitle exists
17043 set setproctitle d_setproctitle
17044 eval $inlibc
17045
17046 : see if setprotoent_r exists
17047 set setprotoent_r d_setprotoent_r
17048 eval $inlibc
17049 case "$d_setprotoent_r" in
17050 "$define")
17051         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17052         case "$d_setprotoent_r_proto:$usethreads" in
17053         ":define")      d_setprotoent_r_proto=define
17054                 set d_setprotoent_r_proto setprotoent_r $hdrs
17055                 eval $hasproto ;;
17056         *)      ;;
17057         esac
17058         case "$d_setprotoent_r_proto" in
17059         define)
17060         case "$setprotoent_r_proto" in
17061         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17062         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17063         esac
17064         case "$setprotoent_r_proto" in
17065         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17066         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17067         esac
17068         case "$setprotoent_r_proto" in
17069         ''|0)   d_setprotoent_r=undef
17070                 setprotoent_r_proto=0
17071                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17072         * )     case "$setprotoent_r_proto" in
17073                 REENTRANT_PROTO*) ;;
17074                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17075                 esac
17076                 echo "Prototype: $try" ;;
17077         esac
17078         ;;
17079         *)      case "$usethreads" in
17080                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17081                 esac
17082                 d_setprotoent_r=undef
17083                 setprotoent_r_proto=0
17084                 ;;
17085         esac
17086         ;;
17087 *)      setprotoent_r_proto=0
17088         ;;
17089 esac
17090
17091 : see if setpwent exists
17092 set setpwent d_setpwent
17093 eval $inlibc
17094
17095 : see if setpwent_r exists
17096 set setpwent_r d_setpwent_r
17097 eval $inlibc
17098 case "$d_setpwent_r" in
17099 "$define")
17100         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17101         case "$d_setpwent_r_proto:$usethreads" in
17102         ":define")      d_setpwent_r_proto=define
17103                 set d_setpwent_r_proto setpwent_r $hdrs
17104                 eval $hasproto ;;
17105         *)      ;;
17106         esac
17107         case "$d_setpwent_r_proto" in
17108         define)
17109         case "$setpwent_r_proto" in
17110         ''|0) try='int setpwent_r(FILE**);'
17111         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17112         esac
17113         case "$setpwent_r_proto" in
17114         ''|0) try='void setpwent_r(FILE**);'
17115         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17116         esac
17117         case "$setpwent_r_proto" in
17118         ''|0)   d_setpwent_r=undef
17119                 setpwent_r_proto=0
17120                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17121         * )     case "$setpwent_r_proto" in
17122                 REENTRANT_PROTO*) ;;
17123                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17124                 esac
17125                 echo "Prototype: $try" ;;
17126         esac
17127         ;;
17128         *)      case "$usethreads" in
17129                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17130                 esac
17131                 d_setpwent_r=undef
17132                 setpwent_r_proto=0
17133                 ;;
17134         esac
17135         ;;
17136 *)      setpwent_r_proto=0
17137         ;;
17138 esac
17139
17140 : see if setregid exists
17141 set setregid d_setregid
17142 eval $inlibc
17143 set setresgid d_setresgid
17144 eval $inlibc
17145
17146 : see if setreuid exists
17147 set setreuid d_setreuid
17148 eval $inlibc
17149 set setresuid d_setresuid
17150 eval $inlibc
17151
17152 : see if setrgid exists
17153 set setrgid d_setrgid
17154 eval $inlibc
17155
17156 : see if setruid exists
17157 set setruid d_setruid
17158 eval $inlibc
17159
17160 : see if setservent exists
17161 set setservent d_setsent
17162 eval $inlibc
17163
17164 : see if setservent_r exists
17165 set setservent_r d_setservent_r
17166 eval $inlibc
17167 case "$d_setservent_r" in
17168 "$define")
17169         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17170         case "$d_setservent_r_proto:$usethreads" in
17171         ":define")      d_setservent_r_proto=define
17172                 set d_setservent_r_proto setservent_r $hdrs
17173                 eval $hasproto ;;
17174         *)      ;;
17175         esac
17176         case "$d_setservent_r_proto" in
17177         define)
17178         case "$setservent_r_proto" in
17179         ''|0) try='int setservent_r(int, struct servent_data*);'
17180         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17181         esac
17182         case "$setservent_r_proto" in
17183         ''|0) try='void setservent_r(int, struct servent_data*);'
17184         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17185         esac
17186         case "$setservent_r_proto" in
17187         ''|0)   d_setservent_r=undef
17188                 setservent_r_proto=0
17189                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17190         * )     case "$setservent_r_proto" in
17191                 REENTRANT_PROTO*) ;;
17192                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17193                 esac
17194                 echo "Prototype: $try" ;;
17195         esac
17196         ;;
17197         *)      case "$usethreads" in
17198                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17199                 esac
17200                 d_setservent_r=undef
17201                 setservent_r_proto=0
17202                 ;;
17203         esac
17204         ;;
17205 *)      setservent_r_proto=0
17206         ;;
17207 esac
17208
17209 : see if setsid exists
17210 set setsid d_setsid
17211 eval $inlibc
17212
17213 : see if setvbuf exists
17214 set setvbuf d_setvbuf
17215 eval $inlibc
17216
17217 : see if sfio.h is available
17218 set sfio.h i_sfio
17219 eval $inhdr
17220
17221 : see if sfio library is available
17222 case "$i_sfio" in
17223 $define)
17224         val=''
17225         set sfreserve val
17226         eval $inlibc
17227         ;;
17228 *)
17229         val="$undef"
17230         ;;
17231 esac
17232 : Ok, but do we want to use it.
17233 case "$val" in
17234 $define)
17235         case "$usesfio" in
17236         true|$define|[yY]*) dflt='y';;
17237         *) dflt='n';;
17238         esac
17239         echo "$package can use the sfio library, but it is experimental."
17240         case "$useperlio" in
17241         "$undef")
17242             echo "For sfio also the PerlIO abstraction layer is needed."
17243             echo "Earlier you said you wouldn't want that."
17244             ;;
17245         esac
17246         rp="You seem to have sfio available, do you want to try using it?"
17247         . ./myread
17248         case "$ans" in
17249         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17250                 useperlio="$define"
17251                 val="$define"
17252                 ;;
17253         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17254                 val="$undef"
17255                 ;;
17256         esac
17257         ;;
17258 *)      case "$usesfio" in
17259         true|$define|[yY]*)
17260                 echo "Sorry, cannot find sfio on this machine." >&4
17261                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17262                 val="$undef"
17263                 ;;
17264         esac
17265         ;;
17266 esac
17267 set d_sfio
17268 eval $setvar
17269 case "$d_sfio" in
17270 $define) usesfio='true';;
17271 *) usesfio='false';;
17272 esac
17273 case "$d_sfio" in
17274 $define) ;;
17275 *)      : Remove sfio from list of libraries to use
17276         case "$libs" in
17277         *-lsfio*)
17278                 echo "Removing unneeded -lsfio from library list" >&4
17279                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17280                 shift
17281                 libs="$*"
17282                 echo "libs = $libs" >&4
17283                 ;;
17284         esac
17285 ;;
17286 esac
17287
17288
17289 : see if shmctl exists
17290 set shmctl d_shmctl
17291 eval $inlibc
17292
17293 : see if shmget exists
17294 set shmget d_shmget
17295 eval $inlibc
17296
17297 : see if shmat exists
17298 set shmat d_shmat
17299 eval $inlibc
17300 : see what shmat returns
17301 case "$d_shmat" in
17302 "$define")
17303         $cat >shmat.c <<'END'
17304 #include <sys/shm.h>
17305 void *shmat();
17306 END
17307         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17308                 shmattype='void *'
17309         else
17310                 shmattype='char *'
17311         fi
17312         echo "and it returns ($shmattype)." >&4
17313         : see if a prototype for shmat is available
17314         xxx=`./findhdr sys/shm.h`
17315         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17316         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17317                 val="$define"
17318         else
17319                 val="$undef"
17320         fi
17321         $rm -f shmat.[co]
17322         ;;
17323 *)
17324         val="$undef"
17325         ;;
17326 esac
17327 set d_shmatprototype
17328 eval $setvar
17329
17330 : see if shmdt exists
17331 set shmdt d_shmdt
17332 eval $inlibc
17333
17334 : see how much of the 'shm*(2)' library is present.
17335 h_shm=true
17336 echo " "
17337 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17338 *"$undef"*) h_shm=false;;
17339 esac
17340 case "$osname" in
17341 freebsd)
17342     case "`ipcs 2>&1`" in
17343     "SVID shared memory"*"not configured"*)
17344         echo "Your $osname does not have the shm*(2) configured." >&4
17345         h_shm=false
17346         val="$undef"
17347         set shmctl d_shmctl
17348         evat $setvar
17349         set shmget d_shmget
17350         evat $setvar
17351         set shmat d_shmat
17352         evat $setvar
17353         set shmdt d_shmdt
17354         evat $setvar
17355         ;;
17356     esac
17357     ;;
17358 esac
17359 : we could also check for sys/ipc.h ...
17360 if $h_shm && $test `./findhdr sys/shm.h`; then
17361         echo "You have the full shm*(2) library." >&4
17362         val="$define"
17363 else
17364         echo "You don't have the full shm*(2) library." >&4
17365         val="$undef"
17366 fi
17367 set d_shm
17368 eval $setvar
17369
17370 : see if we have sigaction
17371 echo " "
17372 if set sigaction val -f d_sigaction; eval $csym; $val; then
17373         echo 'sigaction() found.' >&4
17374         $cat > try.c <<EOP
17375 #include <stdio.h>
17376 #include <sys/types.h>
17377 #include <signal.h>
17378 #$i_stdlib I_STDLIB
17379 #ifdef I_STDLIB
17380 #include <stdlib.h>
17381 #endif
17382 int main()
17383 {
17384     struct sigaction act, oact;
17385     act.sa_flags = 0;
17386     oact.sa_handler = 0;
17387     /* so that act and oact are used */
17388     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17389 }
17390 EOP
17391         set try
17392         if eval $compile_ok; then
17393                 val="$define"
17394         else
17395                 echo "But you don't seem to have a useable struct sigaction." >&4
17396                 val="$undef"
17397         fi
17398 else
17399         echo 'sigaction NOT found.' >&4
17400         val="$undef"
17401 fi
17402 set d_sigaction; eval $setvar
17403 $rm_try
17404
17405 : see if this is a sunmath.h system
17406 set sunmath.h i_sunmath
17407 eval $inhdr
17408
17409 : see if signbit exists
17410 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17411 $cat >try.c <<EOCP
17412 #$i_math I_MATH
17413 #$i_sunmath I_SUNMATH
17414 #ifdef I_MATH
17415 #  include <math.h>
17416 #endif
17417 #ifdef I_SUNMATH  /* Solaris special math library */
17418 #  include <sunmath.h>
17419 #endif
17420 #define NV $nvtype
17421 int main(int argc, char **argv)
17422 {
17423     NV x = 0.0;
17424     NV y = -0.0;
17425     if ((signbit(x) == 0) && (signbit(y) != 0))
17426         return 0;
17427     else
17428         return 1;
17429 }
17430 EOCP
17431 val="$undef"
17432 set try
17433 if eval $compile; then
17434     if $run ./try; then
17435         $echo "Yes." >&4
17436         val="$define"
17437     else
17438         $echo "Signbit seems to be available, but doesn't work as I expected."
17439         $echo "I won't use it." >&4
17440         val="$undef"
17441     fi
17442 else
17443     $echo "Nope." >&4
17444     dflt="$undef"
17445 fi
17446 set d_signbit
17447 eval $setvar
17448 $rm_try
17449
17450 : see if sigprocmask exists
17451 set sigprocmask d_sigprocmask
17452 eval $inlibc
17453
17454 : see if sigsetjmp exists
17455 echo " "
17456 case "$d_sigsetjmp" in
17457 '')
17458         $cat >try.c <<EOP
17459 #include <setjmp.h>
17460 #$i_stdlib I_STDLIB
17461 #ifdef I_STDLIB
17462 #include <stdlib.h>
17463 #endif
17464 sigjmp_buf env;
17465 int set = 1;
17466 int main()
17467 {
17468         if (sigsetjmp(env,1))
17469                 exit(set);
17470         set = 0;
17471         siglongjmp(env, 1);
17472         exit(1);
17473 }
17474 EOP
17475         set try
17476         if eval $compile; then
17477                 if $run ./try >/dev/null 2>&1; then
17478                         echo "POSIX sigsetjmp found." >&4
17479                         val="$define"
17480                 else
17481                         $cat >&4 <<EOM
17482 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17483 I'll ignore them.
17484 EOM
17485                         val="$undef"
17486                 fi
17487         else
17488                 echo "sigsetjmp not found." >&4
17489                 val="$undef"
17490         fi
17491         ;;
17492 *) val="$d_sigsetjmp"
17493         case "$d_sigsetjmp" in
17494         $define) echo "POSIX sigsetjmp found." >&4;;
17495         $undef) echo "sigsetjmp not found." >&4;;
17496         esac
17497         ;;
17498 esac
17499 set d_sigsetjmp
17500 eval $setvar
17501 $rm_try
17502
17503 : see if snprintf exists
17504 set snprintf d_snprintf
17505 eval $inlibc
17506
17507 : see if vsnprintf exists
17508 set vsnprintf d_vsnprintf
17509 eval $inlibc
17510
17511 case "$d_snprintf-$d_vsnprintf" in
17512 "$define-$define")
17513     $cat <<EOM
17514 Checking whether your snprintf() and vsnprintf() work okay...
17515 EOM
17516     $cat >try.c <<'EOCP'
17517 /* v?snprintf testing logic courtesy of Russ Allbery.
17518  * According to C99:
17519  * - if the buffer is too short it still must be \0-terminated
17520  * - if the buffer is too short the potentially required length
17521  *   must be returned and not -1
17522  * - if the buffer is NULL the potentially required length
17523  *   must be returned and not -1 or core dump
17524  */
17525 #include <stdio.h>
17526 #include <stdarg.h>
17527
17528 char buf[2];
17529
17530 int test (char *format, ...)
17531 {
17532     va_list args;
17533     int count;
17534
17535     va_start (args, format);
17536     count = vsnprintf (buf, sizeof buf, format, args);
17537     va_end (args);
17538     return count;
17539 }
17540
17541 int main ()
17542 {
17543     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17544              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17545 }
17546 EOCP
17547     set try
17548     if eval $compile; then
17549         `$run ./try`
17550         case "$?" in
17551         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17552         *) cat <<EOM >&4
17553 Your snprintf() and snprintf() don't seem to be working okay.
17554 EOM
17555            d_snprintf="$undef"
17556            d_vsnprintf="$undef"
17557            ;;
17558         esac
17559     else
17560         echo "(I can't seem to compile the test program--assuming they don't)"
17561         d_snprintf="$undef"
17562         d_vsnprintf="$undef"
17563     fi
17564     $rm_try
17565     ;;
17566 esac
17567
17568 : see if sockatmark exists
17569 set sockatmark d_sockatmark
17570 eval $inlibc
17571
17572 : see if prototype for sockatmark is available
17573 echo " "
17574 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17575 eval $hasproto
17576
17577 : see if socks5_init exists
17578 set socks5_init d_socks5_init
17579 eval $inlibc
17580
17581 : see if sprintf returns the length of the string in the buffer as per ANSI
17582 $echo "Checking whether sprintf returns the length of the string..." >&4
17583 $cat <<EOP >try.c
17584 #include <stdio.h>
17585 #$i_stdlib I_STDLIB
17586 #ifdef I_STDLIB
17587 #include <stdlib.h>
17588 #endif
17589 #$i_string I_STRING
17590 #ifdef I_STRING
17591 #  include <string.h>
17592 #else
17593 #  include <strings.h>
17594 #endif
17595 #$i_math I_MATH
17596 #ifdef I_MATH
17597 #include <math.h>
17598 #endif
17599
17600 char buffer[256];
17601
17602 int check (size_t expect, int test) {
17603   size_t got = strlen(buffer);
17604   if (expect == got)
17605     return 0;
17606
17607   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17608        test, buffer);
17609   exit (test);
17610 }
17611
17612 int main(int argc, char **argv) {
17613   int test = 0;
17614
17615   check(sprintf(buffer, ""), ++test);
17616   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17617   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17618
17619   return 0;
17620 }
17621 EOP
17622 set try
17623
17624 if eval $compile; then
17625     xxx="`$run ./try`"
17626     case "$?" in
17627         0) cat >&4 <<EOM
17628 sprintf returns the length of the string (as ANSI says it should)
17629 EOM
17630         d_sprintf_returns_strlen="$define"
17631         ;;
17632         *) cat >&4 <<EOM
17633 sprintf does not return the length of the string (how old is this system?)
17634 EOM
17635         d_sprintf_returns_strlen="$undef"
17636         ;;
17637     esac
17638 else
17639     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17640     d_sprintf_returns_strlen="$undef"
17641 fi
17642 $rm_try
17643
17644 : see if srand48_r exists
17645 set srand48_r d_srand48_r
17646 eval $inlibc
17647 case "$d_srand48_r" in
17648 "$define")
17649         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17650         case "$d_srand48_r_proto:$usethreads" in
17651         ":define")      d_srand48_r_proto=define
17652                 set d_srand48_r_proto srand48_r $hdrs
17653                 eval $hasproto ;;
17654         *)      ;;
17655         esac
17656         case "$d_srand48_r_proto" in
17657         define)
17658         case "$srand48_r_proto" in
17659         ''|0) try='int srand48_r(long, struct drand48_data*);'
17660         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17661         esac
17662         case "$srand48_r_proto" in
17663         ''|0)   d_srand48_r=undef
17664                 srand48_r_proto=0
17665                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17666         * )     case "$srand48_r_proto" in
17667                 REENTRANT_PROTO*) ;;
17668                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17669                 esac
17670                 echo "Prototype: $try" ;;
17671         esac
17672         ;;
17673         *)      case "$usethreads" in
17674                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17675                 esac
17676                 d_srand48_r=undef
17677                 srand48_r_proto=0
17678                 ;;
17679         esac
17680         ;;
17681 *)      srand48_r_proto=0
17682         ;;
17683 esac
17684
17685 : see if srandom_r exists
17686 set srandom_r d_srandom_r
17687 eval $inlibc
17688 case "$d_srandom_r" in
17689 "$define")
17690         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17691         case "$d_srandom_r_proto:$usethreads" in
17692         ":define")      d_srandom_r_proto=define
17693                 set d_srandom_r_proto srandom_r $hdrs
17694                 eval $hasproto ;;
17695         *)      ;;
17696         esac
17697         case "$d_srandom_r_proto" in
17698         define)
17699         case "$srandom_r_proto" in
17700         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17701         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17702         esac
17703         case "$srandom_r_proto" in
17704         ''|0)   d_srandom_r=undef
17705                 srandom_r_proto=0
17706                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17707         * )     case "$srandom_r_proto" in
17708                 REENTRANT_PROTO*) ;;
17709                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17710                 esac
17711                 echo "Prototype: $try" ;;
17712         esac
17713         ;;
17714         *)      case "$usethreads" in
17715                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17716                 esac
17717                 d_srandom_r=undef
17718                 srandom_r_proto=0
17719                 ;;
17720         esac
17721         ;;
17722 *)      srandom_r_proto=0
17723         ;;
17724 esac
17725
17726 : see if prototype for setresgid is available
17727 echo " "
17728 set d_sresgproto setresgid $i_unistd unistd.h
17729 eval $hasproto
17730
17731 : see if prototype for setresuid is available
17732 echo " "
17733 set d_sresuproto setresuid $i_unistd unistd.h
17734 eval $hasproto
17735
17736 : see if sys/stat.h is available
17737 set sys/stat.h i_sysstat
17738 eval $inhdr
17739
17740 : see if stat knows about block sizes
17741 echo " "
17742 echo "Checking to see if your struct stat has st_blocks field..." >&4
17743 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17744 eval $hasfield
17745
17746 : see if this is a sys/vfs.h system
17747 set sys/vfs.h i_sysvfs
17748 eval $inhdr
17749
17750 : see if this is a sys/statfs.h system
17751 set sys/statfs.h i_sysstatfs
17752 eval $inhdr
17753
17754 : Check for statfs_s
17755 echo " "
17756 echo "Checking to see if your system supports struct statfs..." >&4
17757 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
17758 eval $hasstruct
17759 case "$d_statfs_s" in
17760 "$define")      echo "Yes, it does."   ;;
17761 *)              echo "No, it doesn't." ;;
17762 esac
17763
17764
17765 : see if struct statfs knows about f_flags
17766 case "$d_statfs_s" in
17767 define)
17768         echo " "
17769         echo "Checking to see if your struct statfs has f_flags field..." >&4
17770         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
17771         eval $hasfield
17772         ;;
17773 *)      val="$undef"
17774         set d_statfs_f_flags
17775         eval $setvar
17776         ;;
17777 esac
17778 case "$d_statfs_f_flags" in
17779 "$define")      echo "Yes, it does."   ;;
17780 *)              echo "No, it doesn't." ;;
17781 esac
17782
17783 : Check stream access
17784 $cat >&4 <<EOM
17785 Checking how to access stdio streams by file descriptor number...
17786 EOM
17787 case "$stdio_stream_array" in
17788 '')     $cat >try.c <<EOCP
17789 #include <stdio.h>
17790 int main() {
17791   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17792     printf("yes\n");
17793 }
17794 EOCP
17795         for s in _iob __iob __sF
17796         do
17797                 set try -DSTDIO_STREAM_ARRAY=$s
17798                 if eval $compile; then
17799                         case "`$run ./try`" in
17800                         yes)    stdio_stream_array=$s; break ;;
17801                         esac
17802                 fi
17803         done
17804         $rm_try
17805 esac
17806 case "$stdio_stream_array" in
17807 '')     $cat >&4 <<EOM
17808 I can't figure out how to access stdio streams by file descriptor number.
17809 EOM
17810         d_stdio_stream_array="$undef"
17811         ;;
17812 *)      $cat >&4 <<EOM
17813 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17814 EOM
17815         d_stdio_stream_array="$define"
17816         ;;
17817 esac
17818
17819 : see if strcoll exists
17820 set strcoll d_strcoll
17821 eval $inlibc
17822
17823 : check for structure copying
17824 echo " "
17825 echo "Checking to see if your C compiler can copy structs..." >&4
17826 $cat >try.c <<'EOCP'
17827 int main()
17828 {
17829         struct blurfl {
17830                 int dyick;
17831         } foo, bar;
17832
17833         foo = bar;
17834 }
17835 EOCP
17836 if $cc -c try.c >/dev/null 2>&1 ; then
17837         val="$define"
17838         echo "Yup, it can."
17839 else
17840         val="$undef"
17841         echo "Nope, it can't."
17842 fi
17843 set d_strctcpy
17844 eval $setvar
17845 $rm_try
17846
17847 : see if strerror and/or sys_errlist[] exist
17848 echo " "
17849 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17850     if set strerror val -f d_strerror; eval $csym; $val; then
17851                 echo 'strerror() found.' >&4
17852                 d_strerror="$define"
17853                 d_strerrm='strerror(e)'
17854                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17855                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17856                         d_syserrlst="$define"
17857                 else
17858                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17859                         d_syserrlst="$undef"
17860                 fi
17861     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17862                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17863                 echo 'strerror() found in string header.' >&4
17864                 d_strerror="$define"
17865                 d_strerrm='strerror(e)'
17866                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17867                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17868                                 d_syserrlst="$define"
17869                 else
17870                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17871                         d_syserrlst="$undef"
17872                 fi
17873     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17874                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17875                 d_strerror="$undef"
17876                 d_syserrlst="$define"
17877                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17878     else
17879                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17880                 d_strerror="$undef"
17881                 d_syserrlst="$undef"
17882                 d_strerrm='"unknown"'
17883     fi
17884 fi
17885
17886 : see if strerror_r exists
17887 set strerror_r d_strerror_r
17888 eval $inlibc
17889 case "$d_strerror_r" in
17890 "$define")
17891         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17892         case "$d_strerror_r_proto:$usethreads" in
17893         ":define")      d_strerror_r_proto=define
17894                 set d_strerror_r_proto strerror_r $hdrs
17895                 eval $hasproto ;;
17896         *)      ;;
17897         esac
17898         case "$d_strerror_r_proto" in
17899         define)
17900         case "$strerror_r_proto" in
17901         ''|0) try='int strerror_r(int, char*, size_t);'
17902         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17903         esac
17904         case "$strerror_r_proto" in
17905         ''|0) try='int strerror_r(int, char*, int);'
17906         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17907         esac
17908         case "$strerror_r_proto" in
17909         ''|0) try='char* strerror_r(int, char*, size_t);'
17910         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17911         esac
17912         case "$strerror_r_proto" in
17913         ''|0)   d_strerror_r=undef
17914                 strerror_r_proto=0
17915                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17916         * )     case "$strerror_r_proto" in
17917                 REENTRANT_PROTO*) ;;
17918                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17919                 esac
17920                 echo "Prototype: $try" ;;
17921         esac
17922         ;;
17923         *)      case "$usethreads" in
17924                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17925                 esac
17926                 d_strerror_r=undef
17927                 strerror_r_proto=0
17928                 ;;
17929         esac
17930         ;;
17931 *)      strerror_r_proto=0
17932         ;;
17933 esac
17934
17935 : see if strftime exists
17936 set strftime d_strftime
17937 eval $inlibc
17938
17939 : see if strlcat exists
17940 set strlcat d_strlcat
17941 eval $inlibc
17942
17943 : see if strlcpy exists
17944 set strlcpy d_strlcpy
17945 eval $inlibc
17946
17947 : see if strtod exists
17948 set strtod d_strtod
17949 eval $inlibc
17950
17951 : see if strtol exists
17952 set strtol d_strtol
17953 eval $inlibc
17954
17955 : see if strtold exists
17956 set strtold d_strtold
17957 eval $inlibc
17958
17959 : see if strtoll exists
17960 set strtoll d_strtoll
17961 eval $inlibc
17962
17963 case "$d_longlong-$d_strtoll" in
17964 "$define-$define")
17965         $cat <<EOM
17966 Checking whether your strtoll() works okay...
17967 EOM
17968         $cat >try.c <<'EOCP'
17969 #include <errno.h>
17970 #ifdef __hpux
17971 #define strtoll __strtoll
17972 #endif
17973 #ifdef __EMX__
17974 #define strtoll _strtoll
17975 #endif
17976 #include <stdio.h>
17977 extern long long int strtoll(char *s, char **, int);
17978 static int bad = 0;
17979 int check(char *s, long long ell, int een) {
17980         long long gll;
17981         errno = 0;
17982         gll = strtoll(s, 0, 10);
17983         if (!((gll == ell) && (errno == een)))
17984                 bad++;
17985 }
17986 int main() {
17987         check(" 1",                                      1LL, 0);
17988         check(" 0",                                      0LL, 0);
17989         check("-1",                                     -1LL, 0);
17990         check("-9223372036854775808", -9223372036854775808LL, 0);
17991         check("-9223372036854775808", -9223372036854775808LL, 0);
17992         check(" 9223372036854775807",  9223372036854775807LL, 0);
17993         check("-9223372036854775808", -9223372036854775808LL, 0);
17994         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17995         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17996         if (!bad)
17997                 printf("ok\n");
17998 }
17999 EOCP
18000         set try
18001         if eval $compile; then
18002                 yyy=`$run ./try`
18003                 case "$yyy" in
18004                 ok) echo "Your strtoll() seems to be working okay." ;;
18005                 *) cat <<EOM >&4
18006 Your strtoll() doesn't seem to be working okay.
18007 EOM
18008                    d_strtoll="$undef"
18009                    ;;
18010                 esac
18011         else
18012                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18013                 d_strtoll="$undef"
18014         fi
18015         ;;
18016 esac
18017
18018 : see if strtoq exists
18019 set strtoq d_strtoq
18020 eval $inlibc
18021
18022 : see if strtoul exists
18023 set strtoul d_strtoul
18024 eval $inlibc
18025
18026 case "$d_strtoul" in
18027 "$define")
18028         $cat <<EOM
18029 Checking whether your strtoul() works okay...
18030 EOM
18031         $cat >try.c <<'EOCP'
18032 #include <errno.h>
18033 #include <stdio.h>
18034 extern unsigned long int strtoul(char *s, char **, int);
18035 static int bad = 0;
18036 void check(char *s, unsigned long eul, int een) {
18037         unsigned long gul;
18038         errno = 0;
18039         gul = strtoul(s, 0, 10);
18040         if (!((gul == eul) && (errno == een)))
18041                 bad++;
18042 }
18043 int main() {
18044         check(" 1", 1L, 0);
18045         check(" 0", 0L, 0);
18046 EOCP
18047         case "$longsize" in
18048         8)
18049             $cat >>try.c <<'EOCP'
18050         check("18446744073709551615", 18446744073709551615UL, 0);
18051         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18052 #if 0 /* strtoul() for /^-/ strings is undefined. */
18053         check("-1", 18446744073709551615UL, 0);
18054         check("-18446744073709551614", 2, 0);
18055         check("-18446744073709551615", 1, 0);
18056         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18057         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18058 #endif
18059 EOCP
18060                 ;;
18061         4)
18062                     $cat >>try.c <<'EOCP'
18063         check("4294967295", 4294967295UL, 0);
18064         check("4294967296", 4294967295UL, ERANGE);
18065 #if 0 /* strtoul() for /^-/ strings is undefined. */
18066         check("-1", 4294967295UL, 0);
18067         check("-4294967294", 2, 0);
18068         check("-4294967295", 1, 0);
18069         check("-4294967296", 4294967295UL, ERANGE);
18070         check("-4294967297", 4294967295UL, ERANGE);
18071 #endif
18072 EOCP
18073                 ;;
18074         *)
18075 : Should we write these tests to be more portable by sprintf-ing
18076 : ~0 and then manipulating that char string as input for strtol?
18077                 ;;
18078         esac
18079         $cat >>try.c <<'EOCP'
18080         if (!bad)
18081                 printf("ok\n");
18082         return 0;
18083 }
18084 EOCP
18085         set try
18086         if eval $compile; then
18087                 case "`$run ./try`" in
18088                 ok) echo "Your strtoul() seems to be working okay." ;;
18089                 *) cat <<EOM >&4
18090 Your strtoul() doesn't seem to be working okay.
18091 EOM
18092                    d_strtoul="$undef"
18093                    ;;
18094                 esac
18095         else
18096                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18097                 d_strtoul="$undef"
18098         fi
18099         ;;
18100 esac
18101
18102 : see if strtoull exists
18103 set strtoull d_strtoull
18104 eval $inlibc
18105
18106 case "$d_longlong-$d_strtoull" in
18107 "$define-$define")
18108         $cat <<EOM
18109 Checking whether your strtoull() works okay...
18110 EOM
18111         $cat >try.c <<'EOCP'
18112 #include <errno.h>
18113 #ifdef __hpux
18114 #define strtoull __strtoull
18115 #endif
18116 #include <stdio.h>
18117 extern unsigned long long int strtoull(char *s, char **, int);
18118 static int bad = 0;
18119 int check(char *s, long long eull, int een) {
18120         long long gull;
18121         errno = 0;
18122         gull = strtoull(s, 0, 10);
18123         if (!((gull == eull) && (errno == een)))
18124                 bad++;
18125 }
18126 int main() {
18127         check(" 1",                                        1LL, 0);
18128         check(" 0",                                        0LL, 0);
18129         check("18446744073709551615",  18446744073709551615ULL, 0);
18130         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18131 #if 0 /* strtoull() for /^-/ strings is undefined. */
18132         check("-1",                    18446744073709551615ULL, 0);
18133         check("-18446744073709551614",                     2LL, 0);
18134         check("-18446744073709551615",                     1LL, 0);
18135         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18136         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18137 #endif
18138         if (!bad)
18139                 printf("ok\n");
18140 }
18141 EOCP
18142         set try
18143         if eval $compile; then
18144                 case "`$run ./try`" in
18145                 ok) echo "Your strtoull() seems to be working okay." ;;
18146                 *) cat <<EOM >&4
18147 Your strtoull() doesn't seem to be working okay.
18148 EOM
18149                    d_strtoull="$undef"
18150                    ;;
18151                 esac
18152         else
18153                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18154                 d_strtoull="$undef"
18155         fi
18156         ;;
18157 esac
18158
18159 : see if strtouq exists
18160 set strtouq d_strtouq
18161 eval $inlibc
18162
18163 case "$d_strtouq" in
18164 "$define")
18165         $cat <<EOM
18166 Checking whether your strtouq() works okay...
18167 EOM
18168         $cat >try.c <<'EOCP'
18169 #include <errno.h>
18170 #include <stdio.h>
18171 extern unsigned long long int strtouq(char *s, char **, int);
18172 static int bad = 0;
18173 void check(char *s, unsigned long long eull, int een) {
18174         unsigned long long gull;
18175         errno = 0;
18176         gull = strtouq(s, 0, 10);
18177         if (!((gull == eull) && (errno == een)))
18178                 bad++;
18179 }
18180 int main() {
18181         check(" 1",                                        1LL, 0);
18182         check(" 0",                                        0LL, 0);
18183         check("18446744073709551615",  18446744073709551615ULL, 0);
18184         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18185 #if 0 /* strtouq() for /^-/ strings is undefined. */
18186         check("-1",                    18446744073709551615ULL, 0);
18187         check("-18446744073709551614",                     2LL, 0);
18188         check("-18446744073709551615",                     1LL, 0);
18189         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18190         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18191 #endif
18192         if (!bad)
18193                 printf("ok\n");
18194         return 0;
18195 }
18196 EOCP
18197         set try
18198         if eval $compile; then
18199                 case "`$run ./try`" in
18200                 ok) echo "Your strtouq() seems to be working okay." ;;
18201                 *) cat <<EOM >&4
18202 Your strtouq() doesn't seem to be working okay.
18203 EOM
18204                    d_strtouq="$undef"
18205                    ;;
18206                 esac
18207         else
18208                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18209                 d_strtouq="$undef"
18210         fi
18211         ;;
18212 esac
18213
18214 : see if strxfrm exists
18215 set strxfrm d_strxfrm
18216 eval $inlibc
18217
18218 : see if symlink exists
18219 set symlink d_symlink
18220 eval $inlibc
18221
18222 : see if syscall exists
18223 set syscall d_syscall
18224 eval $inlibc
18225
18226 : see if prototype for syscall is available
18227 echo " "
18228 set d_syscallproto syscall $i_unistd unistd.h
18229 eval $hasproto
18230
18231 : see if sysconf exists
18232 set sysconf d_sysconf
18233 eval $inlibc
18234
18235 : see if system exists
18236 set system d_system
18237 eval $inlibc
18238
18239 : see if tcgetpgrp exists
18240 set tcgetpgrp d_tcgetpgrp
18241 eval $inlibc
18242
18243 : see if tcsetpgrp exists
18244 set tcsetpgrp d_tcsetpgrp
18245 eval $inlibc
18246
18247 : see if prototype for telldir is available
18248 echo " "
18249 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18250 eval $hasproto
18251
18252 : see if time exists
18253 echo " "
18254 if test "X$d_time" = X -o X"$timetype" = X; then
18255     if set time val -f d_time; eval $csym; $val; then
18256                 echo 'time() found.' >&4
18257                 val="$define"
18258                 rp="What is the type returned by time() on this system?"
18259                 set time_t timetype long stdio.h sys/types.h
18260                 eval $typedef_ask
18261     else
18262                 echo 'time() not found, hope that will do.' >&4
18263                 val="$undef"
18264                 timetype='int';
18265     fi
18266     set d_time
18267     eval $setvar
18268 fi
18269
18270 : see if timegm exists
18271 set timegm d_timegm
18272 eval $inlibc
18273
18274 : see if this is a sys/times.h system
18275 set sys/times.h i_systimes
18276 eval $inhdr
18277
18278 : see if times exists
18279 echo " "
18280 if set times val -f d_times; eval $csym; $val; then
18281         echo 'times() found.' >&4
18282         d_times="$define"
18283         inc=''
18284         case "$i_systimes" in
18285         "$define") inc='sys/times.h';;
18286         esac
18287         rp="What is the type returned by times() on this system?"
18288         set clock_t clocktype long stdio.h sys/types.h $inc
18289         eval $typedef_ask
18290 else
18291         echo 'times() NOT found, hope that will do.' >&4
18292         d_times="$undef"
18293         clocktype='int'
18294 fi
18295
18296 : see if tmpnam_r exists
18297 set tmpnam_r d_tmpnam_r
18298 eval $inlibc
18299 case "$d_tmpnam_r" in
18300 "$define")
18301         hdrs="$i_systypes sys/types.h define stdio.h "
18302         case "$d_tmpnam_r_proto:$usethreads" in
18303         ":define")      d_tmpnam_r_proto=define
18304                 set d_tmpnam_r_proto tmpnam_r $hdrs
18305                 eval $hasproto ;;
18306         *)      ;;
18307         esac
18308         case "$d_tmpnam_r_proto" in
18309         define)
18310         case "$tmpnam_r_proto" in
18311         ''|0) try='char* tmpnam_r(char*);'
18312         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18313         esac
18314         case "$tmpnam_r_proto" in
18315         ''|0)   d_tmpnam_r=undef
18316                 tmpnam_r_proto=0
18317                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18318         * )     case "$tmpnam_r_proto" in
18319                 REENTRANT_PROTO*) ;;
18320                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18321                 esac
18322                 echo "Prototype: $try" ;;
18323         esac
18324         ;;
18325         *)      case "$usethreads" in
18326                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18327                 esac
18328                 d_tmpnam_r=undef
18329                 tmpnam_r_proto=0
18330                 ;;
18331         esac
18332         ;;
18333 *)      tmpnam_r_proto=0
18334         ;;
18335 esac
18336
18337 : see if truncate exists
18338 set truncate d_truncate
18339 eval $inlibc
18340
18341 : see if ttyname_r exists
18342 set ttyname_r d_ttyname_r
18343 eval $inlibc
18344 case "$d_ttyname_r" in
18345 "$define")
18346         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18347         case "$d_ttyname_r_proto:$usethreads" in
18348         ":define")      d_ttyname_r_proto=define
18349                 set d_ttyname_r_proto ttyname_r $hdrs
18350                 eval $hasproto ;;
18351         *)      ;;
18352         esac
18353         case "$d_ttyname_r_proto" in
18354         define)
18355         case "$ttyname_r_proto" in
18356         ''|0) try='int ttyname_r(int, char*, size_t);'
18357         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18358         esac
18359         case "$ttyname_r_proto" in
18360         ''|0) try='int ttyname_r(int, char*, int);'
18361         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18362         esac
18363         case "$ttyname_r_proto" in
18364         ''|0) try='char* ttyname_r(int, char*, int);'
18365         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18366         esac
18367         case "$ttyname_r_proto" in
18368         ''|0)   d_ttyname_r=undef
18369                 ttyname_r_proto=0
18370                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18371         * )     case "$ttyname_r_proto" in
18372                 REENTRANT_PROTO*) ;;
18373                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18374                 esac
18375                 echo "Prototype: $try" ;;
18376         esac
18377         ;;
18378         *)      case "$usethreads" in
18379                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18380                 esac
18381                 d_ttyname_r=undef
18382                 ttyname_r_proto=0
18383                 ;;
18384         esac
18385         ;;
18386 *)      ttyname_r_proto=0
18387         ;;
18388 esac
18389
18390 : see if tzname[] exists
18391 echo " "
18392 if set tzname val -a d_tzname; eval $csym; $val; then
18393         val="$define"
18394         echo 'tzname[] found.' >&4
18395 else
18396         val="$undef"
18397         echo 'tzname[] NOT found.' >&4
18398 fi
18399 set d_tzname
18400 eval $setvar
18401
18402 : Check if is a multiplatform env
18403 case "$osname" in
18404 next|rhapsody|darwin) multiarch="$define" ;;
18405 esac
18406 case "$multiarch" in
18407 ''|[nN]*) multiarch="$undef" ;;
18408 esac
18409
18410 : check for ordering of bytes in a UV
18411 echo " "
18412 case "$usecrosscompile$multiarch" in
18413 *$define*)
18414         $cat <<EOM
18415 You seem to be either cross-compiling or doing a multiarchitecture build,
18416 skipping the byteorder check.
18417
18418 EOM
18419         byteorder='ffff'
18420         ;;
18421 *)
18422         case "$byteorder" in
18423         '')
18424                 $cat <<'EOM'
18425 In the following, larger digits indicate more significance.  A big-endian
18426 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18427 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18428 machines may have weird orders like 3412.  A Cray will report 87654321,
18429 an Alpha will report 12345678. If the test program works the default is
18430 probably right.
18431 I'm now running the test program...
18432 EOM
18433                 $cat >try.c <<EOCP
18434 #include <stdio.h>
18435 #$i_stdlib I_STDLIB
18436 #ifdef I_STDLIB
18437 #include <stdlib.h>
18438 #endif
18439 #include <sys/types.h>
18440 typedef $uvtype UV;
18441 int main()
18442 {
18443         int i;
18444         union {
18445                 UV l;
18446                 char c[$uvsize];
18447         } u;
18448
18449         if ($uvsize > 4)
18450                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18451         else
18452                 u.l = (UV)0x04030201;
18453         for (i = 0; i < $uvsize; i++)
18454                 printf("%c", u.c[i]+'0');
18455         printf("\n");
18456         exit(0);
18457 }
18458 EOCP
18459                 xxx_prompt=y
18460                 set try
18461                 if eval $compile && $run ./try > /dev/null; then
18462                         dflt=`$run ./try`
18463                         case "$dflt" in
18464                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18465                                 echo "(The test program ran ok.)"
18466                                 echo "byteorder=$dflt"
18467                                 xxx_prompt=n
18468                         ;;
18469                         ????|????????) echo "(The test program ran ok.)" ;;
18470                         *) echo "(The test program didn't run right for some reason.)" ;;
18471                         esac
18472                 else
18473                         dflt='4321'
18474                         cat <<'EOM'
18475 (I can't seem to compile the test program.  Guessing big-endian...)
18476 EOM
18477                 fi
18478                 case "$xxx_prompt" in
18479                 y)
18480                         rp="What is the order of bytes in $uvtype?"
18481                         . ./myread
18482                         byteorder="$ans"
18483                         ;;
18484                 *)      byteorder=$dflt
18485                         ;;
18486                 esac
18487                 ;;
18488         esac
18489         $rm_try
18490         ;;
18491 esac
18492
18493 : Checking 32bit aligndness
18494 $cat <<EOM
18495
18496 Checking to see whether you can access character data unalignedly...
18497 EOM
18498 case "$d_u32align" in
18499 '')   $cat >try.c <<EOCP
18500 #include <stdio.h>
18501 #$i_stdlib I_STDLIB
18502 #ifdef I_STDLIB
18503 #include <stdlib.h>
18504 #endif
18505 #define U32 $u32type
18506 #define BYTEORDER 0x$byteorder
18507 #define U8 $u8type
18508 #include <signal.h>
18509 #ifdef SIGBUS
18510 $signal_t bletch(int s) { exit(4); }
18511 #endif
18512 int main() {
18513 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18514     U8 buf[8];
18515     U32 *up;
18516     int i;
18517
18518     if (sizeof(U32) != 4) {
18519         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18520         exit(1);
18521     }
18522
18523     fflush(stdout);
18524
18525 #ifdef SIGBUS
18526     signal(SIGBUS, bletch);
18527 #endif
18528
18529     buf[0] = 0;
18530     buf[1] = 0;
18531     buf[2] = 0;
18532     buf[3] = 1;
18533     buf[4] = 0;
18534     buf[5] = 0;
18535     buf[6] = 0;
18536     buf[7] = 1;
18537
18538     for (i = 0; i < 4; i++) {
18539         up = (U32*)(buf + i);
18540         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18541                (*up == 1 << (8*(3-i)))  /* little-endian */
18542               )
18543            )
18544         {
18545             printf("read failed (%x)\n", *up);
18546             exit(2);
18547         }
18548     }
18549
18550     /* write test */
18551     for (i = 0; i < 4; i++) {
18552         up = (U32*)(buf + i);
18553         *up = 0xBeef;
18554         if (*up != 0xBeef) {
18555             printf("write failed (%x)\n", *up);
18556             exit(3);
18557         }
18558     }
18559
18560     exit(0);
18561 #else
18562     printf("1\n");
18563     exit(1);
18564 #endif
18565     return 0;
18566 }
18567 EOCP
18568 set try
18569 if eval $compile_ok; then
18570         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18571         $run ./try 2>&1 >/dev/null
18572         case "$?" in
18573         0)      cat >&4 <<EOM
18574 You can access character data pretty unalignedly.
18575 EOM
18576                 d_u32align="$undef"
18577                 ;;
18578         *)      cat >&4 <<EOM
18579 It seems that you must access character data in an aligned manner.
18580 EOM
18581                 d_u32align="$define"
18582                 ;;
18583         esac
18584 else
18585         rp='Can you access character data at unaligned addresses?'
18586         dflt='n'
18587         . ./myread
18588         case "$ans" in
18589         [yY]*)  d_u32align="$undef"  ;;
18590         *)      d_u32align="$define" ;;
18591         esac
18592 fi
18593 $rm_try
18594 ;;
18595 esac
18596
18597 : see if ualarm exists
18598 set ualarm d_ualarm
18599 eval $inlibc
18600
18601 : see if umask exists
18602 set umask d_umask
18603 eval $inlibc
18604
18605 : see if unordered exists
18606 set unordered d_unordered
18607 eval $inlibc
18608
18609 : see if unsetenv exists
18610 set unsetenv d_unsetenv
18611 eval $inlibc
18612
18613 : see if usleep exists
18614 set usleep d_usleep
18615 eval $inlibc
18616
18617 : see if prototype for usleep is available
18618 echo " "
18619 set d_usleepproto usleep $i_unistd unistd.h
18620 eval $hasproto
18621
18622 : see if ustat exists
18623 set ustat d_ustat
18624 eval $inlibc
18625
18626 : see if closedir exists
18627 set closedir d_closedir
18628 eval $inlibc
18629
18630 case "$d_closedir" in
18631 "$define")
18632         echo " "
18633         echo "Checking whether closedir() returns a status..." >&4
18634         cat > try.c <<EOM
18635 #$i_dirent I_DIRENT             /**/
18636 #$i_sysdir I_SYS_DIR            /**/
18637 #$i_sysndir I_SYS_NDIR          /**/
18638 #$i_systypes I_SYS_TYPES        /**/
18639
18640 #if defined(I_SYS_TYPES)
18641 #include <sys/types.h>
18642 #endif
18643 #if defined(I_DIRENT)
18644 #include <dirent.h>
18645 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18646 #include <sys/dir.h>
18647 #endif
18648 #else
18649 #ifdef I_SYS_NDIR
18650 #include <sys/ndir.h>
18651 #else
18652 #ifdef I_SYS_DIR
18653 #ifdef hp9000s500
18654 #include <ndir.h>       /* may be wrong in the future */
18655 #else
18656 #include <sys/dir.h>
18657 #endif
18658 #endif
18659 #endif
18660 #endif
18661 int main() { return closedir(opendir(".")); }
18662 EOM
18663         set try
18664         if eval $compile_ok; then
18665                 if $run ./try > /dev/null 2>&1 ; then
18666                         echo "Yes, it does."
18667                         val="$undef"
18668                 else
18669                         echo "No, it doesn't."
18670                         val="$define"
18671                 fi
18672         else
18673                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18674                 val="$define"
18675         fi
18676         ;;
18677 *)
18678         val="$undef";
18679         ;;
18680 esac
18681 set d_void_closedir
18682 eval $setvar
18683 $rm_try
18684
18685 : see if there is a wait4
18686 set wait4 d_wait4
18687 eval $inlibc
18688
18689 : see if waitpid exists
18690 set waitpid d_waitpid
18691 eval $inlibc
18692
18693 : see if wcstombs exists
18694 set wcstombs d_wcstombs
18695 eval $inlibc
18696
18697 : see if wctomb exists
18698 set wctomb d_wctomb
18699 eval $inlibc
18700
18701 : see if writev exists
18702 set writev d_writev
18703 eval $inlibc
18704
18705 : preserve RCS keywords in files with variable substitution, grrr
18706 Date='$Date'
18707 Id='$Id'
18708 Log='$Log'
18709 RCSfile='$RCSfile'
18710 Revision='$Revision'
18711
18712 : check for alignment requirements
18713 echo " "
18714 case "$usecrosscompile$multiarch" in
18715 *$define*)
18716         $cat <<EOM
18717 You seem to be either cross-compiling or doing a multiarchitecture build,
18718 skipping the memory alignment check.
18719
18720 EOM
18721         case "$alignbytes" in
18722         '') alignbytes=8 ;;
18723         esac
18724         ;;
18725 *)
18726         case "$alignbytes" in
18727         '') echo "Checking alignment constraints..." >&4
18728                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18729                         $cat >try.c <<'EOCP'
18730 typedef long double NV;
18731 EOCP
18732                 else
18733                         $cat >try.c <<'EOCP'
18734 typedef double NV;
18735 EOCP
18736                 fi
18737                 $cat >>try.c <<'EOCP'
18738 #include <stdio.h>
18739 struct foobar {
18740         char foo;
18741         NV bar;
18742 } try_algn;
18743 int main()
18744 {
18745     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18746     return(0);
18747 }
18748 EOCP
18749                 set try
18750                 if eval $compile_ok; then
18751                         dflt=`$run ./try`
18752                 else
18753                         dflt='8'
18754                         echo "(I can't seem to compile the test program...)"
18755                 fi
18756                 ;;
18757         *) dflt="$alignbytes"
18758                 ;;
18759         esac
18760         rp="Doubles must be aligned on a how-many-byte boundary?"
18761         . ./myread
18762         alignbytes="$ans"
18763         $rm_try
18764         ;;
18765 esac
18766
18767
18768 : set the base revision
18769 baserev=5.0
18770
18771 : how do we concatenate cpp tokens here?
18772 echo " "
18773 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18774 $cat >cpp_stuff.c <<'EOCP'
18775 #define RCAT(a,b)a/**/b
18776 #define ACAT(a,b)a ## b
18777 RCAT(Rei,ser)
18778 ACAT(Cir,cus)
18779 EOCP
18780 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18781 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18782         echo "Oh!  Smells like ANSI's been here." >&4
18783         echo "We can catify or stringify, separately or together!"
18784         cpp_stuff=42
18785 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18786         echo "Ah, yes!  The good old days!" >&4
18787         echo "However, in the good old days we don't know how to stringify and"
18788         echo "catify at the same time."
18789         cpp_stuff=1
18790 else
18791         $cat >&4 <<EOM
18792 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18793 You're going to have to edit the values of CAT[2-5] in config.h...
18794 EOM
18795         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18796 fi
18797 $rm -f cpp_stuff.*
18798
18799 : see if this is a db.h system
18800 set db.h i_db
18801 eval $inhdr
18802
18803 case "$i_db" in
18804 $define)
18805         : Check db version.
18806         echo " "
18807         echo "Checking Berkeley DB version ..." >&4
18808         $cat >try.c <<EOCP
18809 #$d_const HASCONST
18810 #ifndef HASCONST
18811 #define const
18812 #endif
18813 #include <sys/types.h>
18814 #include <stdio.h>
18815 #$i_stdlib I_STDLIB
18816 #ifdef I_STDLIB
18817 #include <stdlib.h>
18818 #endif
18819 #include <db.h>
18820 int main(int argc, char *argv[])
18821 {
18822 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18823     int Major, Minor, Patch ;
18824     unsigned long Version ;
18825     (void)db_version(&Major, &Minor, &Patch) ;
18826     if (argc == 2) {
18827         printf("%d %d %d %d %d %d\n",
18828                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18829                Major, Minor, Patch);
18830         exit(0);
18831     }
18832     printf("You have Berkeley DB Version 2 or greater.\n");
18833
18834     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18835                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18836     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18837                 Major, Minor, Patch) ;
18838
18839     /* check that db.h & libdb are compatible */
18840     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18841         printf("db.h and libdb are incompatible.\n") ;
18842         exit(3);
18843     }
18844
18845     printf("db.h and libdb are compatible.\n") ;
18846
18847     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18848                 + DB_VERSION_PATCH ;
18849
18850     /* needs to be >= 2.3.4 */
18851     if (Version < 2003004) {
18852     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18853         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18854         exit(2);
18855     }
18856
18857     exit(0);
18858 #else
18859 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18860     if (argc == 2) {
18861         printf("1 0 0\n");
18862         exit(0);
18863     }
18864     printf("You have Berkeley DB Version 1.\n");
18865     exit(0);    /* DB version < 2: the coast is clear. */
18866 #else
18867     exit(1);    /* <db.h> not Berkeley DB? */
18868 #endif
18869 #endif
18870 }
18871 EOCP
18872         set try
18873         if eval $compile_ok && $run ./try; then
18874                 echo 'Looks OK.' >&4
18875                 set `$run ./try 1`
18876                 db_version_major=$1
18877                 db_version_minor=$2
18878                 db_version_patch=$3
18879         else
18880                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18881                 i_db=$undef
18882                 case " $libs " in
18883                 *"-ldb "*)
18884                         : Remove db from list of libraries to use
18885                         echo "Removing unusable -ldb from library list" >&4
18886                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18887                         shift
18888                         libs="$*"
18889                         echo "libs = $libs" >&4
18890                         ;;
18891                 esac
18892         fi
18893         $rm_try
18894         ;;
18895 esac
18896
18897 case "$i_db" in
18898 define)
18899         : Check the return type needed for hash
18900         echo " "
18901         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18902         $cat >try.c <<EOCP
18903 #$d_const HASCONST
18904 #ifndef HASCONST
18905 #define const
18906 #endif
18907 #include <sys/types.h>
18908 #include <db.h>
18909
18910 #ifndef DB_VERSION_MAJOR
18911 u_int32_t hash_cb (ptr, size)
18912 const void *ptr;
18913 size_t size;
18914 {
18915 }
18916 HASHINFO info;
18917 int main()
18918 {
18919         info.hash = hash_cb;
18920 }
18921 #endif
18922 EOCP
18923         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18924                 if $contains warning try.out >>/dev/null 2>&1 ; then
18925                         db_hashtype='int'
18926                 else
18927                         db_hashtype='u_int32_t'
18928                 fi
18929         else
18930                 : XXX Maybe we should just give up here.
18931                 db_hashtype=u_int32_t
18932                 $cat try.out >&4
18933                 echo "Help:  I can't seem to compile the db test program." >&4
18934                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18935         fi
18936         $rm_try
18937         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18938         ;;
18939 *)      db_hashtype=u_int32_t
18940         ;;
18941 esac
18942 case "$i_db" in
18943 define)
18944         : Check the return type needed for prefix
18945         echo " "
18946         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18947         cat >try.c <<EOCP
18948 #$d_const HASCONST
18949 #ifndef HASCONST
18950 #define const
18951 #endif
18952 #include <sys/types.h>
18953 #include <db.h>
18954
18955 #ifndef DB_VERSION_MAJOR
18956 size_t prefix_cb (key1, key2)
18957 const DBT *key1;
18958 const DBT *key2;
18959 {
18960 }
18961 BTREEINFO info;
18962 int main()
18963 {
18964         info.prefix = prefix_cb;
18965 }
18966 #endif
18967 EOCP
18968         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18969                 if $contains warning try.out >>/dev/null 2>&1 ; then
18970                         db_prefixtype='int'
18971                 else
18972                         db_prefixtype='size_t'
18973                 fi
18974         else
18975                 db_prefixtype='size_t'
18976                 : XXX Maybe we should just give up here.
18977                 $cat try.out >&4
18978                 echo "Help:  I can't seem to compile the db test program." >&4
18979                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18980         fi
18981         $rm_try
18982         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18983         ;;
18984 *)      db_prefixtype='size_t'
18985         ;;
18986 esac
18987
18988 : How can we generate normalized random numbers ?
18989 echo " "
18990 echo "Looking for a random number function..." >&4
18991 case "$randfunc" in
18992 '')
18993         if set drand48 val -f; eval $csym; $val; then
18994                 dflt="drand48"
18995                 echo "Good, found drand48()." >&4
18996         elif set random val -f; eval $csym; $val; then
18997                 dflt="random"
18998                 echo "OK, found random()." >&4
18999         else
19000                 dflt="rand"
19001                 echo "Yick, looks like I have to use rand()." >&4
19002         fi
19003         echo " "
19004         ;;
19005 *)
19006         dflt="$randfunc"
19007         ;;
19008 esac
19009 cont=true
19010
19011 case "$ccflags" in
19012 *-Dmy_rand=*|*-Dmy_srand=*)
19013         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19014         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19015         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19016         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19017         ;;
19018 esac
19019
19020 while $test "$cont"; do
19021         rp="Use which function to generate random numbers?"
19022         . ./myread
19023         if $test "$ans" = "$dflt"; then
19024                 : null
19025         else
19026                 randbits=''
19027         fi
19028         randfunc="$ans"
19029         if set $ans val -f; eval $csym; $val; then
19030                 cont=''
19031         else
19032                 dflt=y
19033                 rp="I cannot find function $ans. Use that name anyway?"
19034                 . ./myread
19035                 dflt=rand
19036                 case "$ans" in
19037                         [yY]*) cont='';;
19038                 esac
19039         fi
19040         case "$cont" in
19041         '')
19042                 case "$randfunc" in
19043                 drand48)
19044                         drand01="drand48()"
19045                         seedfunc="srand48"
19046                         randbits=48
19047                         randseedtype=long
19048                         ;;
19049                 rand|random)
19050                         case "$randbits" in
19051                         '')
19052 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19053                                 $cat >try.c <<EOCP
19054 #$i_unistd I_UNISTD
19055 #$i_stdlib I_STDLIB
19056 #include <stdio.h>
19057 #ifdef I_UNISTD
19058 #  include <unistd.h>
19059 #endif
19060 #ifdef I_STDLIB
19061 #  include <stdlib.h>
19062 #endif
19063 int main()
19064 {
19065         register int i;
19066         register unsigned long tmp;
19067         register unsigned long max = 0L;
19068
19069         for (i = 1000; i; i--) {
19070                 tmp = (unsigned long) $randfunc();
19071                 if (tmp > max) max = tmp;
19072         }
19073         for (i = 0; max; i++)
19074                 max /= 2;
19075         printf("%d\n",i);
19076 }
19077 EOCP
19078                                 set try
19079                                 if eval $compile_ok; then
19080                                         dflt=`try`
19081                                 else
19082                                         dflt='?'
19083                                         echo "(I can't seem to compile the test program...)"
19084                                 fi
19085                                 ;;
19086                         *)
19087                                 dflt="$randbits"
19088                                 ;;
19089                         esac
19090                         rp="How many bits does your $randfunc() function produce?"
19091                         . ./myread
19092                         randbits="$ans"
19093                         $rm_try
19094                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19095                         seedfunc="s$randfunc"
19096                         randseedtype=unsigned
19097                         ;;
19098                 *)
19099                         dflt="31"
19100                         rp="How many bits does your $randfunc() function produce?"
19101                         . ./myread
19102                         randbits="$ans"
19103                         seedfunc="s$randfunc"
19104                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19105                         if set $seedfunc val -f; eval $csym; $val; then
19106                                 echo "(Using $seedfunc() to seed random generator)"
19107                         else
19108                                 echo "(Warning: no $seedfunc() to seed random generator)"
19109                                 seedfunc=rand
19110                         fi
19111                         randseedtype=unsigned
19112                         ;;
19113                 esac
19114                 ;;
19115         esac
19116 done
19117
19118 : Determine if this is an EBCDIC system
19119 echo " "
19120 echo "Determining whether or not we are on an EBCDIC system..." >&4
19121 $cat >try.c <<'EOM'
19122 int main()
19123 {
19124   if ('M'==0xd4) return 0;
19125   return 1;
19126 }
19127 EOM
19128
19129 val=$undef
19130 set try
19131 if eval $compile_ok; then
19132         if $run ./try; then
19133                 echo "You seem to speak EBCDIC." >&4
19134                 val="$define"
19135         else
19136                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19137         fi
19138 else
19139         echo "I'm unable to compile the test program." >&4
19140         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19141 fi
19142 $rm_try
19143 set ebcdic
19144 eval $setvar
19145
19146 : Check how to flush
19147 echo " "
19148 $cat >&4 <<EOM
19149 Checking how to flush all pending stdio output...
19150 EOM
19151 # I only know how to find the first 32 possibly open files on SunOS.
19152 # See also hints/sunos_4_1.sh and util.c  --AD
19153 case "$osname" in
19154 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19155 esac
19156 $cat >>try.c <<EOCP
19157 #include <stdio.h>
19158 #$i_stdlib I_STDLIB
19159 #ifdef I_STDLIB
19160 #include <stdlib.h>
19161 #endif
19162 #$i_unistd I_UNISTD
19163 #ifdef I_UNISTD
19164 # include <unistd.h>
19165 #endif
19166 #$d_sysconf HAS_SYSCONF
19167 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19168 #ifdef HAS_STDIO_STREAM_ARRAY
19169 # define STDIO_STREAM_ARRAY $stdio_stream_array
19170 #endif
19171 int main() {
19172   FILE* p;
19173   unlink("try.out");
19174   p = fopen("try.out", "w");
19175 #ifdef TRY_FPUTC
19176   fputc('x', p);
19177 #else
19178 # ifdef TRY_FPRINTF
19179   fprintf(p, "x");
19180 # endif
19181 #endif
19182 #ifdef TRY_FFLUSH_NULL
19183   fflush(NULL);
19184 #endif
19185 #ifdef TRY_FFLUSH_ALL
19186   {
19187     long open_max = -1;
19188 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19189     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19190 # else
19191 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19192     open_max = sysconf(_SC_OPEN_MAX);
19193 #  else
19194 #   ifdef FOPEN_MAX
19195     open_max = FOPEN_MAX;
19196 #   else
19197 #    ifdef OPEN_MAX
19198     open_max = OPEN_MAX;
19199 #    else
19200 #     ifdef _NFILE
19201     open_max = _NFILE;
19202 #     endif
19203 #    endif
19204 #   endif
19205 #  endif
19206 # endif
19207 # ifdef HAS_STDIO_STREAM_ARRAY
19208     if (open_max > 0) {
19209       long i;
19210       for (i = 0; i < open_max; i++)
19211             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19212                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19213                 STDIO_STREAM_ARRAY[i]._flag)
19214                 fflush(&STDIO_STREAM_ARRAY[i]);
19215     }
19216   }
19217 # endif
19218 #endif
19219   _exit(42);
19220 }
19221 EOCP
19222 : first we have to find out how _not_ to flush
19223 $to try.c
19224 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19225     output=''
19226     set try -DTRY_FPUTC
19227     if eval $compile; then
19228             $run ./try 2>/dev/null
19229             code="$?"
19230             $from try.out
19231             if $test ! -s try.out -a "X$code" = X42; then
19232                 output=-DTRY_FPUTC
19233             fi
19234     fi
19235     case "$output" in
19236     '')
19237             set try -DTRY_FPRINTF
19238             if eval $compile; then
19239                     $run ./try 2>/dev/null
19240                     code="$?"
19241                     $from try.out
19242                     if $test ! -s try.out -a "X$code" = X42; then
19243                         output=-DTRY_FPRINTF
19244                     fi
19245             fi
19246         ;;
19247     esac
19248 fi
19249 : check for fflush NULL behaviour
19250 case "$fflushNULL" in
19251 '')     set try -DTRY_FFLUSH_NULL $output
19252         if eval $compile; then
19253                 $run ./try 2>/dev/null
19254                 code="$?"
19255                 $from try.out
19256                 if $test -s try.out -a "X$code" = X42; then
19257                         fflushNULL="`$cat try.out`"
19258                 else
19259                         if $test "X$code" != X42; then
19260                                 $cat >&4 <<EOM
19261 (If this test failed, don't worry, we'll try another method shortly.)
19262 EOM
19263                         fi
19264                 fi
19265         fi
19266         $rm -f core try.core core.try.*
19267         case "$fflushNULL" in
19268         x)      $cat >&4 <<EOM
19269 Your fflush(NULL) works okay for output streams.
19270 Let's see if it clobbers input pipes...
19271 EOM
19272 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19273 # bug that improperly flushes the input end of pipes.  So we avoid the
19274 # autoflush on fork/system/exec support for now. :-(
19275 $cat >tryp.c <<EOCP
19276 #include <stdio.h>
19277 int
19278 main(int argc, char **argv)
19279 {
19280     char buf[1024];
19281     int i;
19282     char *bp = buf;
19283     while (1) {
19284         while ((i = getc(stdin)) != -1
19285                && (*bp++ = i) != '\n'
19286                && bp < &buf[1024])
19287         /* DO NOTHING */ ;
19288         *bp = '\0';
19289         fprintf(stdout, "%s", buf);
19290         fflush(NULL);
19291         if (i == -1)
19292             return 0;
19293         bp = buf;
19294     }
19295 }
19296 EOCP
19297                 fflushNULL="$define"
19298                 set tryp
19299                 if eval $compile; then
19300                     $rm -f tryp.out
19301                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19302                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19303                        $cat >&4 <<EOM
19304 fflush(NULL) seems to behave okay with input streams.
19305 EOM
19306                         fflushNULL="$define"
19307                     else
19308                         $cat >&4 <<EOM
19309 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19310 EOM
19311                         fflushNULL="$undef"
19312                     fi
19313                 fi
19314                 $rm -f core tryp.c tryp.core core.tryp.*
19315                 ;;
19316         '')     $cat >&4 <<EOM
19317 Your fflush(NULL) isn't working (contrary to ANSI C).
19318 EOM
19319                 fflushNULL="$undef"
19320                 ;;
19321         *)      $cat >&4 <<EOM
19322 Cannot figure out whether your fflush(NULL) works or not.
19323 I'm assuming it doesn't (contrary to ANSI C).
19324 EOM
19325                 fflushNULL="$undef"
19326                 ;;
19327         esac
19328         ;;
19329 $define|true|[yY]*)
19330         fflushNULL="$define"
19331         ;;
19332 *)
19333         fflushNULL="$undef"
19334         ;;
19335 esac
19336 : check explicit looping only if NULL did not work, and if the pipe
19337 : bug does not show up on an explicit flush too
19338 case "$fflushNULL" in
19339 "$undef")
19340         $cat >tryp.c <<EOCP
19341 #include <stdio.h>
19342 int
19343 main(int argc, char **argv)
19344 {
19345     char buf[1024];
19346     int i;
19347     char *bp = buf;
19348     while (1) {
19349         while ((i = getc(stdin)) != -1
19350                && (*bp++ = i) != '\n'
19351                && bp < &buf[1024])
19352         /* DO NOTHING */ ;
19353         *bp = '\0';
19354         fprintf(stdout, "%s", buf);
19355         fflush(stdin);
19356         if (i == -1)
19357             return 0;
19358         bp = buf;
19359     }
19360 }
19361 EOCP
19362         set tryp
19363         if eval $compile; then
19364             $rm -f tryp.out
19365             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19366             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19367                $cat >&4 <<EOM
19368 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19369 EOM
19370                 : now check for fflushall behaviour
19371                 case "$fflushall" in
19372                 '')     set try -DTRY_FFLUSH_ALL $output
19373                         if eval $compile; then
19374                                 $cat >&4 <<EOM
19375 (Now testing the other method--but note that this also may fail.)
19376 EOM
19377                                 $run ./try 2>/dev/null
19378                                 code=$?
19379                                 $from try.out
19380                                 if $test -s try.out -a "X$code" = X42; then
19381                                         fflushall="`$cat try.out`"
19382                                 fi
19383                         fi
19384                         $rm_try
19385                         case "$fflushall" in
19386                         x)      $cat >&4 <<EOM
19387 Whew. Flushing explicitly all the stdio streams works.
19388 EOM
19389                                 fflushall="$define"
19390                                 ;;
19391                         '')     $cat >&4 <<EOM
19392 Sigh. Flushing explicitly all the stdio streams doesn't work.
19393 EOM
19394                                 fflushall="$undef"
19395                                 ;;
19396                         *)      $cat >&4 <<EOM
19397 Cannot figure out whether flushing stdio streams explicitly works or not.
19398 I'm assuming it doesn't.
19399 EOM
19400                                 fflushall="$undef"
19401                                 ;;
19402                         esac
19403                         ;;
19404                 "$define"|true|[yY]*)
19405                         fflushall="$define"
19406                         ;;
19407                 *)
19408                         fflushall="$undef"
19409                         ;;
19410                 esac
19411             else
19412                 $cat >&4 <<EOM
19413 All is futile.  Even fflush(stdin) clobbers input pipes!
19414 EOM
19415                 fflushall="$undef"
19416             fi
19417         else
19418             fflushall="$undef"
19419         fi
19420         $rm -f core tryp.c tryp.core core.tryp.*
19421         ;;
19422 *)      fflushall="$undef"
19423         ;;
19424 esac
19425
19426 case "$fflushNULL$fflushall" in
19427 undefundef)
19428         $cat <<EOM
19429 OK, I give up.  I cannot figure out how to flush pending stdio output.
19430 We won't be flushing handles at all before fork/exec/popen.
19431 EOM
19432         ;;
19433 esac
19434 $rm_try tryp
19435
19436 : Store the full pathname to the ar program for use in the C program
19437 : Respect a hint or command line value for full_ar.
19438 case "$full_ar" in
19439 '') full_ar=$ar ;;
19440 esac
19441
19442 : Store the full pathname to the sed program for use in the C program
19443 full_sed=$sed
19444
19445 : see what type gids are declared as in the kernel
19446 echo " "
19447 echo "Looking for the type for group ids returned by getgid()."
19448 set gid_t gidtype xxx stdio.h sys/types.h
19449 eval $typedef
19450 case "$gidtype" in
19451 xxx)
19452         xxx=`./findhdr sys/user.h`
19453         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19454         case $1 in
19455         unsigned) dflt="$1 $2" ;;
19456         *) dflt="$1" ;;
19457         esac
19458         ;;
19459 *) dflt="$gidtype";;
19460 esac
19461 case "$gidtype" in
19462 gid_t) echo "gid_t found." ;;
19463 *)      rp="What is the type for group ids returned by getgid()?"
19464         . ./myread
19465         gidtype="$ans"
19466         ;;
19467 esac
19468
19469 : Check the size of GID
19470 echo " "
19471 case "$gidtype" in
19472 *_t) zzz="$gidtype"     ;;
19473 *)   zzz="gid"          ;;
19474 esac
19475 echo "Checking the size of $zzz..." >&4
19476 cat > try.c <<EOCP
19477 #include <sys/types.h>
19478 #include <stdio.h>
19479 #$i_stdlib I_STDLIB
19480 #ifdef I_STDLIB
19481 #include <stdlib.h>
19482 #endif
19483 int main() {
19484     printf("%d\n", (int)sizeof($gidtype));
19485     exit(0);
19486 }
19487 EOCP
19488 set try
19489 if eval $compile_ok; then
19490         yyy=`$run ./try`
19491         case "$yyy" in
19492         '')     gidsize=4
19493                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19494                 ;;
19495         *)      gidsize=$yyy
19496                 echo "Your $zzz is $gidsize bytes long."
19497                 ;;
19498         esac
19499 else
19500         gidsize=4
19501         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19502 fi
19503
19504
19505 : Check if GID is signed
19506 echo " "
19507 case "$gidtype" in
19508 *_t) zzz="$gidtype"     ;;
19509 *)   zzz="gid"          ;;
19510 esac
19511 echo "Checking the sign of $zzz..." >&4
19512 cat > try.c <<EOCP
19513 #include <sys/types.h>
19514 #include <stdio.h>
19515 int main() {
19516         $gidtype foo = -1;
19517         if (foo < 0)
19518                 printf("-1\n");
19519         else
19520                 printf("1\n");
19521 }
19522 EOCP
19523 set try
19524 if eval $compile; then
19525         yyy=`$run ./try`
19526         case "$yyy" in
19527         '')     gidsign=1
19528                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19529                 ;;
19530         *)      gidsign=$yyy
19531                 case "$gidsign" in
19532                  1) echo "Your $zzz is unsigned." ;;
19533                 -1) echo "Your $zzz is signed."   ;;
19534                 esac
19535                 ;;
19536         esac
19537 else
19538         gidsign=1
19539         echo "(I can't compile the test program--guessing unsigned.)" >&4
19540 fi
19541
19542
19543 : Check 64bit sizes
19544 echo " "
19545
19546 if $test X"$quadtype" != X; then
19547
19548 echo "Checking how to print 64-bit integers..." >&4
19549
19550 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19551         $cat >try.c <<'EOCP'
19552 #include <sys/types.h>
19553 #include <stdio.h>
19554 int main() {
19555   int q = 12345678901;
19556   printf("%ld\n", q);
19557 }
19558 EOCP
19559         set try
19560         if eval $compile; then
19561                 yyy=`$run ./try`
19562                 case "$yyy" in
19563                 12345678901)
19564                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19565                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19566                         echo "We will use %d."
19567                         ;;
19568                 esac
19569         fi
19570 fi
19571
19572 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19573         $cat >try.c <<'EOCP'
19574 #include <sys/types.h>
19575 #include <stdio.h>
19576 int main() {
19577   long q = 12345678901;
19578   printf("%ld\n", q);
19579 }
19580 EOCP
19581         set try
19582         if eval $compile; then
19583                 yyy=`$run ./try`
19584                 case "$yyy" in
19585                 12345678901)
19586                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19587                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19588                         echo "We will use %ld."
19589                         ;;
19590                 esac
19591         fi
19592 fi
19593
19594 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19595         $cat >try.c <<'EOCP'
19596 #include <sys/types.h>
19597 #include <inttypes.h>
19598 #include <stdio.h>
19599 int main() {
19600   int64_t q = 12345678901;
19601   printf("%" PRId64 "\n", q);
19602 }
19603 EOCP
19604         set try
19605         if eval $compile; then
19606                 yyy=`$run ./try`
19607                 case "$yyy" in
19608                 12345678901)
19609                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19610                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19611                         echo "We will use the C9X style."
19612                         ;;
19613                 esac
19614         fi
19615 fi
19616
19617 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19618         $cat >try.c <<EOCP
19619 #include <sys/types.h>
19620 #include <stdio.h>
19621 int main() {
19622   $quadtype q = 12345678901;
19623   printf("%Ld\n", q);
19624 }
19625 EOCP
19626         set try
19627         if eval $compile; then
19628                 yyy=`$run ./try`
19629                 case "$yyy" in
19630                 12345678901)
19631                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19632                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19633                         echo "We will use %Ld."
19634                         ;;
19635                 esac
19636         fi
19637 fi
19638
19639 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19640         $cat >try.c <<'EOCP'
19641 #include <sys/types.h>
19642 #include <stdio.h>
19643 int main() {
19644   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19645   printf("%lld\n", q);
19646 }
19647 EOCP
19648         set try
19649         if eval $compile; then
19650                 yyy=`$run ./try`
19651                 case "$yyy" in
19652                 12345678901)
19653                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19654                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19655                         echo "We will use the %lld style."
19656                         ;;
19657                 esac
19658         fi
19659 fi
19660
19661 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19662         $cat >try.c <<EOCP
19663 #include <sys/types.h>
19664 #include <stdio.h>
19665 int main() {
19666   $quadtype q = 12345678901;
19667   printf("%qd\n", q);
19668 }
19669 EOCP
19670         set try
19671         if eval $compile; then
19672                 yyy=`$run ./try`
19673                 case "$yyy" in
19674                 12345678901)
19675                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19676                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19677                         echo "We will use %qd."
19678                         ;;
19679                 esac
19680         fi
19681 fi
19682
19683 if $test X"$sPRId64" = X; then
19684         echo "Cannot figure out how to print 64-bit integers." >&4
19685 fi
19686 $rm_try
19687
19688 fi
19689
19690 case "$sPRId64" in
19691 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19692         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19693         ;;
19694 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19695         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19696         ;;
19697 esac
19698
19699 : Check format strings for internal types
19700 echo " "
19701 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19702
19703 if $test X"$ivsize" = X8; then
19704         ivdformat="$sPRId64"
19705         uvuformat="$sPRIu64"
19706         uvoformat="$sPRIo64"
19707         uvxformat="$sPRIx64"
19708         uvXUformat="$sPRIXU64"
19709 else
19710         if $test X"$ivsize" = X"$longsize"; then
19711                 ivdformat='"ld"'
19712                 uvuformat='"lu"'
19713                 uvoformat='"lo"'
19714                 uvxformat='"lx"'
19715                 uvXUformat='"lX"'
19716         else
19717                 if $test X"$ivsize" = X"$intsize"; then
19718                         ivdformat='"d"'
19719                         uvuformat='"u"'
19720                         uvoformat='"o"'
19721                         uvxformat='"x"'
19722                         uvXUformat='"X"'
19723                 else
19724                         : far out
19725                         if $test X"$ivsize" = X"$shortsize"; then
19726                                 ivdformat='"hd"'
19727                                 uvuformat='"hu"'
19728                                 uvoformat='"ho"'
19729                                 uvxformat='"hx"'
19730                                 uvXUformat='"hX"'
19731                         fi
19732                 fi
19733         fi
19734 fi
19735
19736 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19737         nveformat="$sPRIeldbl"
19738         nvfformat="$sPRIfldbl"
19739         nvgformat="$sPRIgldbl"
19740         nvEUformat="$sPRIEUldbl"
19741         nvFUformat="$sPRIFUldbl"
19742         nvGUformat="$sPRIGUldbl"
19743 else
19744         nveformat='"e"'
19745         nvfformat='"f"'
19746         nvgformat='"g"'
19747         nvEUformat='"E"'
19748         nvFUformat='"F"'
19749         nvGUformat='"G"'
19750 fi
19751
19752 case "$ivdformat" in
19753 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19754     exit 1
19755     ;;
19756 esac
19757
19758 : Check format string for GID
19759
19760 echo " "
19761 $echo "Checking the format string to be used for gids..." >&4
19762
19763 case "$gidsign" in
19764 -1)     if $test X"$gidsize" = X"$ivsize"; then
19765                 gidformat="$ivdformat"
19766         else
19767                 if $test X"$gidsize" = X"$longsize"; then
19768                         gidformat='"ld"'
19769                 else
19770                         if $test X"$gidsize" = X"$intsize"; then
19771                                 gidformat='"d"'
19772                         else
19773                                 if $test X"$gidsize" = X"$shortsize"; then
19774                                         gidformat='"hd"'
19775                                 fi
19776                         fi
19777                 fi
19778         fi
19779         ;;
19780 *)      if $test X"$gidsize" = X"$uvsize"; then
19781                 gidformat="$uvuformat"
19782         else
19783                 if $test X"$gidsize" = X"$longsize"; then
19784                         gidformat='"lu"'
19785                 else
19786                         if $test X"$gidsize" = X"$intsize"; then
19787                                 gidformat='"u"'
19788                         else
19789                                 if $test X"$gidsize" = X"$shortsize"; then
19790                                         gidformat='"hu"'
19791                                 fi
19792                         fi
19793                 fi
19794         fi
19795         ;;
19796 esac
19797
19798 : see if getgroups exists
19799 set getgroups d_getgrps
19800 eval $inlibc
19801
19802 : see if setgroups exists
19803 set setgroups d_setgrps
19804 eval $inlibc
19805
19806 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19807 echo " "
19808 case "$d_getgrps$d_setgrps" in
19809 *define*)
19810         case "$groupstype" in
19811         '') dflt="$gidtype" ;;
19812         *)  dflt="$groupstype" ;;
19813         esac
19814         $cat <<EOM
19815 What type of pointer is the second argument to getgroups() and setgroups()?
19816 Usually this is the same as group ids, $gidtype, but not always.
19817
19818 EOM
19819         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19820         . ./myread
19821         groupstype="$ans"
19822         ;;
19823 *)  groupstype="$gidtype";;
19824 esac
19825
19826 : MAD = Misc Attribute Definition
19827
19828 if $test $patchlevel -lt 9; then
19829 : MAD is not available in 5.8.x or earlier.
19830     ans=n;
19831 else
19832     case "$mad" in
19833     $define|true|[yY]*) dflt='y' ;;
19834     *)                  dflt='n' ;;
19835     esac
19836     cat <<EOM
19837
19838 Would you like to build with Misc Attribute Decoration? This is development
19839 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19840 overhead on the interpreter.
19841
19842 If this doesn't make any sense to you, just accept the default '$dflt'.
19843 EOM
19844     rp='Build Perl with MAD?'
19845     . ./myread
19846 fi
19847 case "$ans" in
19848 y|Y)    val="$define"
19849         madlyh='madly.h madly.act madly.tab'
19850         madlysrc='madly.c'
19851         madlyobj="madly$_o" ;;
19852 *)      val="$undef"
19853         madlyh=''
19854         madlysrc=''
19855         madlyobj='' ;;
19856 esac
19857 set mad
19858 eval $setvar
19859
19860 : check whether make sets MAKE
19861 echo " "
19862 echo "Checking if your $make program sets \$(MAKE)..." >&4
19863 case "$make_set_make" in
19864 '')
19865         $sed 's/^X //' > testmake.mak << 'EOF'
19866 Xall:
19867 X       @echo 'maketemp="$(MAKE)"'
19868 EOF
19869         case "`$make -f testmake.mak 2>/dev/null`" in
19870         *maketemp=*) make_set_make='#' ;;
19871         *)      make_set_make="MAKE=$make" ;;
19872         esac
19873         $rm -f testmake.mak
19874         ;;
19875 esac
19876 case "$make_set_make" in
19877 '#') echo "Yup, it does.";;
19878 *) echo "Nope, it doesn't.";;
19879 esac
19880
19881 : see what type is used for mode_t
19882 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19883 set mode_t modetype int stdio.h sys/types.h
19884 eval $typedef_ask
19885
19886 : see if we need va_copy
19887 echo " "
19888 case "$i_stdarg" in
19889 "$define")
19890         $cat >try.c <<EOCP
19891 #include <stdarg.h>
19892 #include <stdio.h>
19893 #$i_stdlib I_STDLIB
19894 #ifdef I_STDLIB
19895 #include <stdlib.h>
19896 #endif
19897 #include <signal.h>
19898
19899 int
19900 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19901 {
19902   return vfprintf(f, fmt, *valp);
19903 }
19904
19905 int
19906 myvfprintf(FILE *f, const  char *fmt, va_list val)
19907 {
19908   return ivfprintf(f, fmt, &val);
19909 }
19910
19911 int
19912 myprintf(char *fmt, ...)
19913 {
19914   va_list val;
19915   va_start(val, fmt);
19916   return myvfprintf(stdout, fmt, val);
19917 }
19918
19919 int
19920 main(int ac, char **av)
19921 {
19922   signal(SIGSEGV, exit);
19923
19924   myprintf("%s%cs all right, then\n", "that", '\'');
19925   exit(0);
19926 }
19927 EOCP
19928         set try
19929         if eval $compile && $run ./try 2>&1 >/dev/null; then
19930                 case "`$run ./try`" in
19931                 "that's all right, then")
19932                         okay=yes
19933                         ;;
19934                 esac
19935         fi
19936         case "$okay" in
19937         yes)    echo "It seems that you don't need va_copy()." >&4
19938                 need_va_copy="$undef"
19939                 ;;
19940         *)      echo "It seems that va_copy() or similar will be needed." >&4
19941                 need_va_copy="$define"
19942                 ;;
19943         esac
19944         $rm_try
19945         ;;
19946 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19947         ;;
19948 esac
19949
19950 : see what type is used for size_t
19951 rp="What is the type used for the length parameter for string functions?"
19952 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19953 eval $typedef_ask
19954
19955 : check for type of arguments to gethostbyaddr. 
19956 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19957         case "$d_gethbyaddr" in
19958         $define)
19959                 $cat <<EOM
19960
19961 Checking to see what type of arguments are accepted by gethostbyaddr().
19962 EOM
19963                 hdrs="$define sys/types.h
19964                         $d_socket sys/socket.h 
19965                         $i_niin netinet/in.h 
19966                         $i_netdb netdb.h
19967                         $i_unistd unistd.h"
19968                 : The first arg can 'char *' or 'void *'
19969                 : The second arg is some of integral type
19970                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19971                         for yyy in size_t long int; do
19972                                 case "$netdb_host_type" in
19973                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
19974                                         if ./protochk "$try" $hdrs; then
19975                                                 echo "Your system accepts $xxx for the first arg."
19976                                                 echo "...and $yyy for the second arg."
19977                                                 netdb_host_type="$xxx"
19978                                                 netdb_hlen_type="$yyy"
19979                                         fi
19980                                         ;;
19981                                 esac
19982                         done
19983                 done
19984                 : In case none of those worked, prompt the user.
19985                 case "$netdb_host_type" in
19986                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19987                         dflt='char *'
19988                         . ./myread
19989                         netdb_host_type=$ans
19990                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19991                         dflt="$sizetype"
19992                         . ./myread
19993                         netdb_hlen_type=$ans
19994                         ;;
19995                 esac
19996                 ;;
19997         *)      : no gethostbyaddr, so pick harmless defaults
19998                 netdb_host_type='char *'
19999                 netdb_hlen_type="$sizetype"
20000                 ;;
20001         esac
20002         # Remove the "const" if needed. -- but then we'll have a 
20003         # prototype clash!
20004         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20005 fi
20006
20007 : check for type of argument to gethostbyname. 
20008 if test "X$netdb_name_type" = X ; then
20009         case "$d_gethbyname" in
20010         $define)
20011                 $cat <<EOM
20012
20013 Checking to see what type of argument is accepted by gethostbyname().
20014 EOM
20015                 hdrs="$define sys/types.h
20016                         $d_socket sys/socket.h 
20017                         $i_niin netinet/in.h 
20018                         $i_netdb netdb.h
20019                         $i_unistd unistd.h"
20020                 for xxx in "const char *" "char *"; do
20021                         case "$netdb_name_type" in
20022                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20023                                 if ./protochk "$try" $hdrs; then
20024                                         echo "Your system accepts $xxx."
20025                                         netdb_name_type="$xxx"
20026                                 fi
20027                                 ;;
20028                         esac
20029                 done
20030                 : In case none of those worked, prompt the user.
20031                 case "$netdb_name_type" in
20032                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20033                         dflt='char *'
20034                         . ./myread
20035                         netdb_name_type=$ans
20036                         ;;
20037                 esac
20038                 ;;
20039         *)      : no gethostbyname, so pick harmless default
20040                 netdb_name_type='char *'
20041                 ;;
20042         esac
20043 fi
20044
20045 : check for type of 1st argument to getnetbyaddr. 
20046 if test "X$netdb_net_type" = X ; then
20047         case "$d_getnbyaddr" in
20048         $define)
20049                 $cat <<EOM
20050
20051 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20052 EOM
20053                 hdrs="$define sys/types.h
20054                         $d_socket sys/socket.h 
20055                         $i_niin netinet/in.h 
20056                         $i_netdb netdb.h
20057                         $i_unistd unistd.h"
20058                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20059                         case "$netdb_net_type" in
20060                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20061                                 if ./protochk "$try" $hdrs; then
20062                                         echo "Your system accepts $xxx."
20063                                         netdb_net_type="$xxx"
20064                                 fi
20065                                 ;;
20066                         esac
20067                 done
20068                 : In case none of those worked, prompt the user.
20069                 case "$netdb_net_type" in
20070                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20071                         dflt='long'
20072                         . ./myread
20073                         netdb_net_type=$ans
20074                         ;;
20075                 esac
20076                 ;;
20077         *)      : no getnetbyaddr, so pick harmless default
20078                 netdb_net_type='long'
20079                 ;;
20080         esac
20081 fi
20082 : locate the preferred pager for this system
20083 fn=f/
20084 case "$pager" in
20085 '')
20086         dflt=''
20087         case "$pg" in
20088         /*) dflt=$pg;;
20089         [a-zA-Z]:/*) dflt=$pg;;
20090         esac
20091         case "$more" in
20092         /*) dflt=$more;;
20093         [a-zA-Z]:/*) dflt=$more;;
20094         esac
20095         case "$less" in
20096         /*) dflt=$less;;
20097         [a-zA-Z]:/*) dflt=$less;;
20098         esac
20099         case "$dflt" in
20100         '') dflt=/usr/ucb/more;;
20101         esac
20102         ;;
20103 *)      dflt="$pager"
20104         fn="f/($pager)"
20105         ;;
20106 esac
20107 echo " "
20108 rp='What pager is used on your system?'
20109 . ./getfile
20110 pager="$ans"
20111
20112 : see what type pids are declared as in the kernel
20113 rp="What is the type of process ids on this system?"
20114 set pid_t pidtype int stdio.h sys/types.h
20115 eval $typedef_ask
20116
20117 : see if ar generates random libraries by itself
20118 echo " "
20119 echo "Checking how to generate random libraries on your machine..." >&4
20120 echo 'int bar1() { return bar2(); }' > bar1.c
20121 echo 'int bar2() { return 2; }' > bar2.c
20122 $cat > foo.c <<EOP
20123 #$i_stdlib I_STDLIB
20124 #ifdef I_STDLIB
20125 #include <stdlib.h>
20126 #endif
20127 int main() { printf("%d\n", bar1()); exit(0); }
20128 EOP
20129 $cc $ccflags -c bar1.c >/dev/null 2>&1
20130 $cc $ccflags -c bar2.c >/dev/null 2>&1
20131 $cc $ccflags -c foo.c >/dev/null 2>&1
20132 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20133 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20134         $run ./foobar >/dev/null 2>&1; then
20135         echo "$ar appears to generate random libraries itself."
20136         orderlib=false
20137         if [ "X$ranlib" = "X" ]; then
20138             ranlib=":"
20139         fi
20140 elif $ar s bar$_a >/dev/null 2>&1 &&
20141         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20142         $run ./foobar >/dev/null 2>&1; then
20143                 echo "a table of contents needs to be added with '$ar s'."
20144                 orderlib=false
20145                 ranlib="$ar s"
20146 elif $ar ts bar$_a >/dev/null 2>&1 &&
20147         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20148         $run ./foobar >/dev/null 2>&1; then
20149                 echo "a table of contents needs to be added with '$ar ts'."
20150                 orderlib=false
20151                 ranlib="$ar ts"
20152 else
20153         case "$ranlib" in
20154         :) ranlib='';;
20155         '')
20156                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20157                 $test -f $ranlib || ranlib=''
20158                 ;;
20159         esac
20160         if $test -n "$ranlib"; then
20161                 echo "your system has '$ranlib'; we'll use that."
20162                 orderlib=false
20163         else
20164                 echo "your system doesn't seem to support random libraries"
20165                 echo "so we'll use lorder and tsort to order the libraries."
20166                 orderlib=true
20167                 ranlib=":"
20168         fi
20169 fi
20170 $rm -f foo* bar*
20171
20172 : see if this is a values.h system
20173 set values.h i_values
20174 eval $inhdr
20175
20176 : Check the max offset that gmtime and localtime accept
20177 echo "Checking max offsets that gmtime () accepts"
20178
20179 case $i_values in
20180     define) yyy="#include <values.h>" ;;
20181     *)      yyy="" ;;
20182     esac
20183
20184 case "$sGMTIME_min/$sGMTIME_max" in
20185     0/0|/)
20186         $cat >try.c <<EOCP
20187 #include <sys/types.h>
20188 #include <stdio.h>
20189 #include <time.h>
20190 $yyy
20191
20192 int i;
20193 struct tm *tmp;
20194 time_t pt;
20195
20196 void gm_check (time_t t, int min_year, int max_year)
20197 {
20198     tmp = gmtime (&t);
20199     if ( tmp == NULL ||
20200         /* Check tm_year overflow */
20201          tmp->tm_year < min_year || tmp->tm_year > max_year)
20202         tmp = NULL;
20203     else
20204         pt = t;
20205     } /* gm_check */
20206
20207 int check_max ()
20208 {
20209     tmp = NULL;
20210     pt  = 0;
20211 #ifdef MAXLONG
20212     gm_check (MAXLONG, 69, 0x7fffffff);
20213 #endif
20214     if (tmp == NULL || tmp->tm_year < 0) {
20215         for (i = 63; i >= 0; i--) {
20216             time_t x = pt | ((time_t)1 << i);
20217             if (x < 0 || x < pt) continue;
20218             gm_check (x, 69, 0x7fffffff);
20219             }
20220         }
20221     printf ("sGMTIME_max=%ld\n", pt);
20222     return (0);
20223     } /* check_max */
20224
20225 int check_min ()
20226 {
20227     tmp = NULL;
20228     pt  = 0;
20229 #ifdef MINLONG
20230     gm_check (MINLONG, -1900, 70);
20231 #endif
20232     if (tmp == NULL) {
20233         for (i = 36; i >= 0; i--) {
20234             time_t x = pt - ((time_t)1 << i);
20235             if (x > 0) continue;
20236             gm_check (x, -1900, 70);
20237             }
20238         }
20239     printf ("sGMTIME_min=%ld\n", pt);
20240     return (0);
20241     } /* check_min */
20242
20243 int main (int argc, char *argv[])
20244 {
20245     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20246     check_max ();
20247     check_min ();
20248     return (0);
20249     } /* main */
20250 EOCP
20251         set try
20252         if eval $compile; then
20253             eval `$run ./try`
20254         else
20255             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20256             fi
20257         $rm_try
20258         ;;
20259     esac
20260
20261 echo "Checking max offsets that localtime () accepts"
20262
20263 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20264     0/0|/)
20265         $cat >try.c <<EOCP
20266 #include <sys/types.h>
20267 #include <stdio.h>
20268 #include <time.h>
20269 $yyy
20270
20271 int i;
20272 struct tm *tmp;
20273 time_t pt;
20274
20275 void local_check (time_t t, int min_year, int max_year)
20276 {
20277     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20278         tmp = NULL;
20279     else
20280         tmp = localtime (&t);
20281     if ( tmp == NULL ||
20282         /* Check tm_year overflow */
20283          tmp->tm_year < min_year || tmp->tm_year > max_year)
20284         tmp = NULL;
20285     else
20286         pt = t;
20287     } /* local_check */
20288
20289 int check_max ()
20290 {
20291     tmp = NULL;
20292     pt  = 0;
20293 #ifdef MAXLONG
20294     local_check (MAXLONG, 69, 0x7fffffff);
20295 #endif
20296     if (tmp == NULL || tmp->tm_year < 0) {
20297         for (i = 63; i >= 0; i--) {
20298             time_t x = pt | ((time_t)1 << i);
20299             if (x < 0 || x < pt) continue;
20300             local_check (x, 69, 0x7fffffff);
20301             }
20302         }
20303     printf ("sLOCALTIME_max=%ld\n", pt);
20304     return (0);
20305    } /* check_max */
20306
20307 int check_min ()
20308 {
20309     tmp = NULL;
20310     pt  = 0;
20311 #ifdef MINLONG
20312     local_check (MINLONG, -1900, 70);
20313 #endif
20314     if (tmp == NULL) {
20315         for (i = 36; i >= 0; i--) {
20316             time_t x = pt - ((time_t)1 << i);
20317             if (x > 0) continue;
20318             local_check (x, -1900, 70);
20319             }
20320         }
20321     printf ("sLOCALTIME_min=%ld\n", pt);
20322     return (0);
20323     } /* check_min */
20324
20325 int main (int argc, char *argv[])
20326 {
20327     check_max ();
20328     check_min ();
20329     return (0);
20330     } /* main */
20331 EOCP
20332         set try
20333         if eval $compile; then
20334             eval `$run ./try`
20335         else
20336             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20337             fi
20338         $rm_try
20339         ;;
20340     esac
20341
20342 : check for type of arguments to select.
20343 case "$selecttype" in
20344 '') case "$d_select" in
20345         $define)
20346                 echo " "
20347                 $cat <<EOM
20348 Checking to see what type of arguments are accepted by select().
20349 EOM
20350                 hdrs="$define sys/types.h
20351                         $i_systime sys/time.h
20352                         $i_sysselct sys/select.h
20353                         $d_socket sys/socket.h"
20354                 : The first arg can be int, unsigned, or size_t
20355                 : The last arg may or may not be 'const'
20356                 val=''
20357                 : void pointer has been seen but using that
20358                 : breaks the selectminbits test
20359                 for xxx in 'fd_set *' 'int *'; do
20360                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20361                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20362                                         case "$val" in
20363                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20364                                                 if ./protochk "$try" $hdrs; then
20365                                                         echo "Your system accepts $xxx."
20366                                                         val="$xxx"
20367                                                 fi
20368                                                 ;;
20369                                         esac
20370                                 done
20371                         done
20372                 done
20373                 case "$val" in
20374                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20375                         case "$d_fd_set" in
20376                                 $define) dflt="fd_set *" ;;
20377                                 *)              dflt="int *" ;;
20378                         esac
20379                         . ./myread
20380                         val=$ans
20381                         ;;
20382                 esac
20383                 selecttype="$val"
20384                 ;;
20385         *)      : no select, so pick a harmless default
20386                 selecttype='int *'
20387                 ;;
20388         esac
20389         ;;
20390 esac
20391
20392 : check for the select 'width'
20393 case "$selectminbits" in
20394 '') safebits=`expr $ptrsize \* 8`
20395     case "$d_select" in
20396         $define)
20397                 $cat <<EOM
20398
20399 Checking to see on how many bits at a time your select() operates...
20400 EOM
20401                 $cat >try.c <<EOCP
20402 #include <sys/types.h>
20403 #$i_time I_TIME
20404 #$i_systime I_SYS_TIME
20405 #$i_systimek I_SYS_TIME_KERNEL
20406 #ifdef I_TIME
20407 #   include <time.h>
20408 #endif
20409 #ifdef I_SYS_TIME
20410 #   ifdef I_SYS_TIME_KERNEL
20411 #       define KERNEL
20412 #   endif
20413 #   include <sys/time.h>
20414 #   ifdef I_SYS_TIME_KERNEL
20415 #       undef KERNEL
20416 #   endif
20417 #endif
20418 #$i_sysselct I_SYS_SELECT
20419 #ifdef I_SYS_SELECT
20420 #include <sys/select.h>
20421 #endif
20422 #$d_socket HAS_SOCKET
20423 #ifdef HAS_SOCKET
20424 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20425 #endif
20426 #include <stdio.h>
20427 #$i_stdlib I_STDLIB
20428 #ifdef I_STDLIB
20429 #include <stdlib.h>
20430 #endif
20431 $selecttype b;
20432 #define S sizeof(*(b))
20433 #define MINBITS 64
20434 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20435 #define NBITS  (NBYTES * 8)
20436 int main() {
20437     char *s = (char *)malloc(NBYTES);
20438     struct timeval t;
20439     int i;
20440     FILE* fp;
20441     int fd;
20442
20443     if (!s)
20444         exit(1);
20445     fclose(stdin);
20446     fp = fopen("try.c", "r");
20447     if (fp == 0)
20448       exit(2);
20449     fd = fileno(fp);
20450     if (fd < 0)
20451       exit(3);
20452     b = ($selecttype)s;
20453     for (i = 0; i < NBITS; i++)
20454         FD_SET(i, b);
20455     t.tv_sec  = 0;
20456     t.tv_usec = 0;
20457     select(fd + 1, b, 0, 0, &t);
20458     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20459     free(s);
20460     printf("%d\n", i + 1);
20461     return 0;
20462 }
20463 EOCP
20464                 set try
20465                 if eval $compile_ok; then
20466                         selectminbits=`$run ./try`
20467                         case "$selectminbits" in
20468                         '')     cat >&4 <<EOM
20469 Cannot figure out on how many bits at a time your select() operates.
20470 I'll play safe and guess it is $safebits bits.
20471 EOM
20472                                 selectminbits=$safebits
20473                                 bits="$safebits bits"
20474                                 ;;
20475                         1)      bits="1 bit" ;;
20476                         *)      bits="$selectminbits bits" ;;
20477                         esac
20478                         echo "Your select() operates on $bits at a time." >&4
20479                 else
20480                         rp='What is the minimum number of bits your select() operates on?'
20481                         case "$byteorder" in
20482                         12345678)       dflt=64 ;;
20483                         1234)           dflt=32 ;;
20484                         *)              dflt=1  ;;
20485                         esac
20486                         . ./myread
20487                         val=$ans
20488                         selectminbits="$val"
20489                 fi
20490                 $rm_try
20491                 ;;
20492         *)      : no select, so pick a harmless default
20493                 selectminbits=$safebits
20494                 ;;
20495         esac
20496         ;;
20497 esac
20498
20499 : Trace out the files included by signal.h, then look for SIGxxx names.
20500 if [ "X$fieldn" = X ]; then
20501         : Just make some guesses.  We check them later.
20502         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20503 else
20504         xxx=`echo '#include <signal.h>' |
20505         $cppstdin $cppminus $cppflags 2>/dev/null |
20506         $grep '^[       ]*#.*include' |
20507         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20508                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20509 fi
20510 xxxfiles=''
20511 for xx in $xxx /dev/null ; do
20512         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20513 done
20514 case "$xxxfiles" in
20515 '')     xxxfiles=`./findhdr signal.h` ;;
20516 esac
20517 xxx=`awk '
20518 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20519         print substr($2, 4, 20)
20520 }
20521 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20522         print substr($3, 4, 20)
20523 }' $xxxfiles`
20524 : Append some common names just in case the awk scan failed.
20525 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20526 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20527 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20528 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20529 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20530
20531 : generate a few handy files for later
20532 $cat > signal.c <<EOCP
20533 #include <sys/types.h>
20534 #include <signal.h>
20535 #$i_stdlib I_STDLIB
20536 #ifdef I_STDLIB
20537 #include <stdlib.h>
20538 #endif
20539 #include <stdio.h>
20540 int main() {
20541
20542 /* Strange style to avoid deeply-nested #if/#else/#endif */
20543 #ifndef NSIG
20544 #  ifdef _NSIG
20545 #    define NSIG (_NSIG)
20546 #  endif
20547 #endif
20548
20549 #ifndef NSIG
20550 #  ifdef SIGMAX
20551 #    define NSIG (SIGMAX+1)
20552 #  endif
20553 #endif
20554
20555 #ifndef NSIG
20556 #  ifdef SIG_MAX
20557 #    define NSIG (SIG_MAX+1)
20558 #  endif
20559 #endif
20560
20561 #ifndef NSIG
20562 #  ifdef _SIG_MAX
20563 #    define NSIG (_SIG_MAX+1)
20564 #  endif
20565 #endif
20566
20567 #ifndef NSIG
20568 #  ifdef MAXSIG
20569 #    define NSIG (MAXSIG+1)
20570 #  endif
20571 #endif
20572
20573 #ifndef NSIG
20574 #  ifdef MAX_SIG
20575 #    define NSIG (MAX_SIG+1)
20576 #  endif
20577 #endif
20578
20579 #ifndef NSIG
20580 #  ifdef SIGARRAYSIZE
20581 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20582 #  endif
20583 #endif
20584
20585 #ifndef NSIG
20586 #  ifdef _sys_nsig
20587 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20588 #  endif
20589 #endif
20590
20591 /* Default to some arbitrary number that's big enough to get most
20592    of the common signals.
20593 */
20594 #ifndef NSIG
20595 #    define NSIG 50
20596 #endif
20597
20598 printf("NSIG %d\n", NSIG);
20599
20600 #ifndef JUST_NSIG
20601
20602 EOCP
20603
20604 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20605 {
20606         printf "#ifdef SIG"; printf $1; printf "\n"
20607         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20608         printf $1; printf ");\n"
20609         printf "#endif\n"
20610 }
20611 END {
20612         printf "#endif /* JUST_NSIG */\n";
20613         printf "exit(0);\n}\n";
20614 }
20615 ' >>signal.c
20616 $cat >signal.awk <<'EOP'
20617 BEGIN { ndups = 0 }
20618 $1 ~ /^NSIG$/ { nsig = $2 }
20619 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20620     if ($2 > maxsig) { maxsig = $2 }
20621     if (sig_name[$2]) {
20622         dup_name[ndups] = $1
20623         dup_num[ndups] = $2
20624         ndups++
20625     }
20626     else {
20627         sig_name[$2] = $1
20628         sig_num[$2] = $2
20629     }
20630 }
20631 END {
20632     if (nsig == 0) {
20633         nsig = maxsig + 1
20634     }
20635     printf("NSIG %d\n", nsig);
20636     for (n = 1; n < nsig; n++) {
20637         if (sig_name[n]) {
20638             printf("%s %d\n", sig_name[n], sig_num[n])
20639         }
20640         else {
20641             printf("NUM%d %d\n", n, n)
20642         }
20643     }
20644     for (n = 0; n < ndups; n++) {
20645         printf("%s %d\n", dup_name[n], dup_num[n])
20646     }
20647 }
20648 EOP
20649 $cat >signal_cmd <<EOS
20650 $startsh
20651 if $test -s signal.lst; then
20652     echo "Using your existing signal.lst file"
20653         exit 0
20654 fi
20655 xxx="$xxx"
20656 EOS
20657 $cat >>signal_cmd <<'EOS'
20658
20659 set signal
20660 if eval $compile_ok; then
20661         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20662                 $uniq | $awk -f signal.awk >signal.lst
20663 else
20664         echo "(I can't seem be able to compile the whole test program)" >&4
20665         echo "(I'll try it in little pieces.)" >&4
20666         set signal -DJUST_NSIG
20667         if eval $compile_ok; then
20668                 $run ./signal$_exe > signal.nsg
20669                 $cat signal.nsg
20670         else
20671                 echo "I can't seem to figure out how many signals you have." >&4
20672                 echo "Guessing 50." >&4
20673                 echo 'NSIG 50' > signal.nsg
20674         fi
20675         : Now look at all the signal names, one at a time.
20676         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20677                 $cat > signal.c <<EOCP
20678 #include <sys/types.h>
20679 #include <signal.h>
20680 #include <stdio.h>
20681 int main() {
20682 printf("$xx %d\n", SIG${xx});
20683 return 0;
20684 }
20685 EOCP
20686                 set signal
20687                 if eval $compile; then
20688                         echo "SIG${xx} found."
20689                         $run ./signal$_exe  >> signal.ls1
20690                 else
20691                         echo "SIG${xx} NOT found."
20692                 fi
20693         done
20694         if $test -s signal.ls1; then
20695                 $cat signal.nsg signal.ls1 |
20696                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20697         fi
20698
20699 fi
20700 if $test -s signal.lst; then
20701         :
20702 else
20703         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20704         echo 'kill -l' >signal
20705         set X `csh -f <signal`
20706         $rm -f signal
20707         shift
20708         case $# in
20709         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20710         esac
20711         echo $@ | $tr ' ' $trnl | \
20712             $awk '{ printf "%s %d\n", $1, ++s; }
20713                   END { printf "NSIG %d\n", ++s }' >signal.lst
20714 fi
20715 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20716 EOS
20717 chmod a+x signal_cmd
20718 $eunicefix signal_cmd
20719
20720 : generate list of signal names
20721 echo " "
20722 case "$sig_name_init" in
20723 '') doinit=yes ;;
20724 *)  case "$sig_num_init" in
20725     ''|*,*) doinit=yes ;;
20726     esac ;;
20727 esac
20728 case "$doinit" in
20729 yes)
20730         echo "Generating a list of signal names and numbers..." >&4
20731         . ./signal_cmd
20732         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20733         sig_name=`$awk 'BEGIN { printf "ZERO " }
20734                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20735         sig_num=`$awk  'BEGIN { printf "0 " }
20736                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20737         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20738                              !/^NSIG/   { printf "\"%s\", ", $1 }
20739                              END        { printf "0\n" }' signal.lst`
20740         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20741                              !/^NSIG/   { printf "%d, ", $2}
20742                              END        { printf "0\n"}' signal.lst`
20743         ;;
20744 esac
20745 echo "The following $sig_count signals are available:"
20746 echo " "
20747 echo $sig_name | $awk \
20748 'BEGIN { linelen = 0 }
20749 {
20750         for (i = 1; i <= NF; i++) {
20751                 name = "SIG" $i " "
20752                 linelen = linelen + length(name)
20753                 if (linelen > 70) {
20754                         printf "\n"
20755                         linelen = length(name)
20756                 }
20757                 printf "%s", name
20758         }
20759         printf "\n"
20760 }'
20761 sig_size=`echo $sig_name | awk '{print NF}'`
20762 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20763
20764 : Check size of size
20765 echo " "
20766 case "$sizetype" in
20767 *_t) zzz="$sizetype"    ;;
20768 *)   zzz="filesize"     ;;
20769 esac
20770 echo "Checking the size of $zzz..." >&4
20771 cat > try.c <<EOCP
20772 #include <sys/types.h>
20773 #include <stdio.h>
20774 #$i_stdlib I_STDLIB
20775 #ifdef I_STDLIB
20776 #include <stdlib.h>
20777 #endif
20778 int main() {
20779     printf("%d\n", (int)sizeof($sizetype));
20780     exit(0);
20781 }
20782 EOCP
20783 set try
20784 if eval $compile_ok; then
20785         yyy=`$run ./try`
20786         case "$yyy" in
20787         '')     sizesize=4
20788                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20789                 ;;
20790         *)      sizesize=$yyy
20791                 echo "Your $zzz size is $sizesize bytes."
20792                 ;;
20793         esac
20794 else
20795         sizesize=4
20796         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20797 fi
20798
20799
20800 : check for socklen_t
20801 echo " "
20802 echo "Checking to see if you have socklen_t..." >&4
20803 $cat >try.c <<EOCP
20804 #include <sys/types.h>
20805 #$d_socket HAS_SOCKET
20806 #ifdef HAS_SOCKET
20807 #include <sys/socket.h>
20808 #endif
20809 int main() { socklen_t x = 16; }
20810 EOCP
20811 set try
20812 if eval $compile; then
20813         val="$define"
20814         echo "You have socklen_t."
20815 else
20816         val="$undef"
20817         echo "You do not have socklen_t."
20818         case "$sizetype" in
20819         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20820         esac
20821 fi
20822 $rm_try
20823 set d_socklen_t
20824 eval $setvar
20825
20826 : see if this is a socks.h system
20827 set socks.h i_socks
20828 eval $inhdr
20829
20830 : check for type of the size argument to socket calls
20831 case "$d_socket" in
20832 "$define")
20833         $cat <<EOM
20834
20835 Checking to see what type is the last argument of accept().
20836 EOM
20837         yyy=''
20838         case "$d_socklen_t" in
20839         "$define") yyy="$yyy socklen_t"
20840         esac
20841         yyy="$yyy $sizetype int long unsigned"
20842         for xxx in $yyy; do
20843                 case "$socksizetype" in
20844                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20845                         case "$usesocks" in
20846                         "$define")
20847                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20848                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20849                                         socksizetype="$xxx"
20850                                 fi
20851                                 ;;
20852                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20853                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20854                                         socksizetype="$xxx"
20855                                 fi
20856                                 ;;
20857                         esac
20858                         ;;
20859                 esac
20860         done
20861 : In case none of those worked, prompt the user.
20862         case "$socksizetype" in
20863         '')     rp='What is the type for socket address structure sizes?'
20864                 dflt='int'
20865                 . ./myread
20866                 socksizetype=$ans
20867                 ;;
20868         esac
20869         ;;
20870 *)      : no sockets, so pick relatively harmless default
20871         socksizetype='int'
20872         ;;
20873 esac
20874
20875 : see what type is used for signed size_t
20876 set ssize_t ssizetype int stdio.h sys/types.h
20877 eval $typedef
20878 dflt="$ssizetype"
20879 $cat > try.c <<EOM
20880 #include <stdio.h>
20881 #$i_stdlib I_STDLIB
20882 #ifdef I_STDLIB
20883 #include <stdlib.h>
20884 #endif
20885 #include <sys/types.h>
20886 #define Size_t $sizetype
20887 #define SSize_t $dflt
20888 int main()
20889 {
20890         if (sizeof(Size_t) == sizeof(SSize_t))
20891                 printf("$dflt\n");
20892         else if (sizeof(Size_t) == sizeof(int))
20893                 printf("int\n");
20894         else
20895                 printf("long\n");
20896         exit(0);
20897 }
20898 EOM
20899 echo " "
20900 set try
20901 if eval $compile_ok && $run ./try > /dev/null; then
20902         ssizetype=`$run ./try`
20903         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20904 else
20905         $cat >&4 <<EOM
20906 Help! I can't compile and run the ssize_t test program: please enlighten me!
20907 (This is probably a misconfiguration in your system or libraries, and
20908 you really ought to fix it.  Still, I'll try anyway.)
20909
20910 I need a type that is the same size as $sizetype, but is guaranteed to
20911 be signed.  Common values are ssize_t, int and long.
20912
20913 EOM
20914         rp="What signed type is the same size as $sizetype?"
20915         . ./myread
20916         ssizetype="$ans"
20917 fi
20918 $rm_try
20919
20920 : see what type of char stdio uses.
20921 echo " "
20922 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20923 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20924         echo "Your stdio uses unsigned chars." >&4
20925         stdchar="unsigned char"
20926 else
20927         echo "Your stdio uses signed chars." >&4
20928         stdchar="char"
20929 fi
20930 $rm -f stdioh
20931
20932 : see what type uids are declared as in the kernel
20933 echo " "
20934 echo "Looking for the type for user ids returned by getuid()."
20935 set uid_t uidtype xxx stdio.h sys/types.h
20936 eval $typedef
20937 case "$uidtype" in
20938 xxx)
20939         xxx=`./findhdr sys/user.h`
20940         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20941         case $1 in
20942         unsigned) dflt="$1 $2" ;;
20943         *) dflt="$1" ;;
20944         esac
20945         ;;
20946 *) dflt="$uidtype";;
20947 esac
20948 case "$uidtype" in
20949 uid_t)  echo "uid_t found." ;;
20950 *)      rp="What is the type for user ids returned by getuid()?"
20951         . ./myread
20952         uidtype="$ans"
20953         ;;
20954 esac
20955
20956 : Check size of UID
20957 echo " "
20958 case "$uidtype" in
20959 *_t) zzz="$uidtype"     ;;
20960 *)   zzz="uid"          ;;
20961 esac
20962 echo "Checking the size of $zzz..." >&4
20963 cat > try.c <<EOCP
20964 #include <sys/types.h>
20965 #include <stdio.h>
20966 #$i_stdlib I_STDLIB
20967 #ifdef I_STDLIB
20968 #include <stdlib.h>
20969 #endif
20970 int main() {
20971     printf("%d\n", (int)sizeof($uidtype));
20972     exit(0);
20973 }
20974 EOCP
20975 set try
20976 if eval $compile_ok; then
20977         yyy=`$run ./try`
20978         case "$yyy" in
20979         '')     uidsize=4
20980                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20981                 ;;
20982         *)      uidsize=$yyy
20983                 echo "Your $zzz is $uidsize bytes long."
20984                 ;;
20985         esac
20986 else
20987         uidsize=4
20988         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20989 fi
20990
20991 : Check if UID is signed
20992 echo " "
20993 case "$uidtype" in
20994 *_t) zzz="$uidtype"     ;;
20995 *)   zzz="uid"          ;;
20996 esac
20997 echo "Checking the sign of $zzz..." >&4
20998 cat > try.c <<EOCP
20999 #include <sys/types.h>
21000 #include <stdio.h>
21001 int main() {
21002         $uidtype foo = -1;
21003         if (foo < 0)
21004                 printf("-1\n");
21005         else
21006                 printf("1\n");
21007 }
21008 EOCP
21009 set try
21010 if eval $compile; then
21011         yyy=`$run ./try`
21012         case "$yyy" in
21013         '')     uidsign=1
21014                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21015                 ;;
21016         *)      uidsign=$yyy
21017                 case "$uidsign" in
21018                  1) echo "Your $zzz is unsigned." ;;
21019                 -1) echo "Your $zzz is signed."   ;;
21020                 esac
21021                 ;;
21022         esac
21023 else
21024         uidsign=1
21025         echo "(I can't compile the test program--guessing unsigned.)" >&4
21026 fi
21027
21028
21029 : Check format string for UID
21030 echo " "
21031 $echo "Checking the format string to be used for uids..." >&4
21032
21033 case "$uidsign" in
21034 -1)     if $test X"$uidsize" = X"$ivsize"; then
21035                 uidformat="$ivdformat"
21036         else
21037                 if $test X"$uidsize" = X"$longsize"; then
21038                         uidformat='"ld"'
21039                 else
21040                         if $test X"$uidsize" = X"$intsize"; then
21041                                 uidformat='"d"'
21042                         else
21043                                 if $test X"$uidsize" = X"$shortsize"; then
21044                                         uidformat='"hd"'
21045                                 fi
21046                         fi
21047                 fi
21048         fi
21049         ;;
21050 *)      if $test X"$uidsize" = X"$uvsize"; then
21051                 uidformat="$uvuformat"
21052         else
21053                 if $test X"$uidsize" = X"$longsize"; then
21054                         uidformat='"lu"'
21055                 else
21056                         if $test X"$uidsize" = X"$intsize"; then
21057                                 uidformat='"u"'
21058                         else
21059                                 if $test X"$uidsize" = X"$shortsize"; then
21060                                         uidformat='"hu"'
21061                                 fi
21062                         fi
21063                 fi
21064         fi
21065         ;;
21066 esac
21067
21068 : Check if site customization support was requested
21069 case "$usesitecustomize" in
21070     $define|true|[Yy]*)
21071         usesitecustomize="$define"
21072         ;;
21073     *)
21074         usesitecustomize="$undef"
21075         ;;
21076     esac
21077
21078 : determine compiler compiler
21079 case "$yacc" in
21080 '')
21081         dflt=yacc;;
21082 *)
21083         dflt="$yacc";;
21084 esac
21085 echo " "
21086 comp='yacc'
21087 if $test -f "$byacc$_exe"; then
21088         dflt="$byacc"
21089         comp="byacc or $comp"
21090 fi
21091 if $test -f "$bison$_exe"; then
21092         comp="$comp or bison -y"
21093 fi
21094 rp="Which compiler compiler ($comp) shall I use?"
21095 . ./myread
21096 yacc="$ans"
21097 case "$yacc" in
21098 *bis*)
21099         case "$yacc" in
21100         *-y*) ;;
21101         *)
21102                 yacc="$yacc -y"
21103                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21104                 ;;
21105         esac
21106         ;;
21107 esac
21108
21109 : see if this is a assert.h system
21110 set assert.h i_assert
21111 eval $inhdr
21112
21113 : see if this is a fp.h system
21114 set fp.h i_fp
21115 eval $inhdr
21116
21117 : see if this is a fp_class.h system
21118 set fp_class.h i_fp_class
21119 eval $inhdr
21120
21121 : see if gdbm.h is available
21122 set gdbm.h t_gdbm
21123 eval $inhdr
21124 case "$t_gdbm" in
21125 $define)
21126         : see if gdbm_open exists
21127         set gdbm_open d_gdbm_open
21128         eval $inlibc
21129         case "$d_gdbm_open" in
21130         $undef)
21131                 t_gdbm="$undef"
21132                 echo "We won't be including <gdbm.h>"
21133                 ;;
21134         esac
21135         ;;
21136 esac
21137 val="$t_gdbm"
21138 set i_gdbm
21139 eval $setvar
21140
21141 : see if this is a ieeefp.h system
21142 case "$i_ieeefp" in
21143 '' ) set ieeefp.h i_ieeefp
21144      eval $inhdr
21145      ;;
21146 esac
21147
21148 : see if this is a libutil.h system
21149 set libutil.h i_libutil
21150 eval $inhdr
21151
21152 : see if mach cthreads are available
21153 if test "X$usethreads" = "X$define"; then
21154         set mach/cthreads.h i_machcthr
21155         eval $inhdr
21156 else
21157         i_machcthr="$undef"
21158 fi
21159
21160 : see if this is a mntent.h system
21161 set mntent.h i_mntent
21162 eval $inhdr
21163
21164 : see if net/errno.h is available
21165 val=''
21166 set net/errno.h val
21167 eval $inhdr
21168
21169 : Unfortunately, it causes problems on some systems.  Arrgh.
21170 case "$val" in
21171 $define)
21172         cat > try.c <<'EOM'
21173 #include <stdio.h>
21174 #include <errno.h>
21175 #include <net/errno.h>
21176 int func()
21177 {
21178         return ENOTSOCK;
21179 }
21180 EOM
21181         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21182                 echo "We'll be including <net/errno.h>." >&4
21183         else
21184                 echo "We won't be including <net/errno.h>." >&4
21185                 val="$undef"
21186         fi
21187         $rm_try
21188         ;;
21189 esac
21190 set i_neterrno
21191 eval $setvar
21192
21193 : see if netinet/tcp.h is available
21194 set netinet/tcp.h i_netinettcp
21195 eval $inhdr
21196
21197 : see if this is a poll.h system
21198 set poll.h i_poll
21199 eval $inhdr
21200
21201 : see if this is a prot.h system
21202 set prot.h i_prot
21203 eval $inhdr
21204
21205 : Preprocessor symbols
21206 echo " "
21207 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21208 $cat <<'EOSH' > Cppsym.know
21209 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21210 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21211 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21212 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21213 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21214 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21215 bull c cadmus clipper CMU COFF COMPILER_VERSION
21216 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21217 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21218 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21219 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21220 GLIBC GLIBC_MINOR
21221 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21222 H3050R H3050RX hbullx20 hcx host_mips
21223 hp200 hp300 hp700 HP700 hp800 hp9000
21224 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21225 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21226 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21227 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21228 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21229 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21230 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21231 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21232 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21233 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21234 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21235 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21236 MATH_HAS_NO_SIDE_EFFECTS
21237 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21238 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21239 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21240 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21241 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21242 NetBSD news1500 news1700 news1800 news1900 news3700
21243 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21244 ns32016 ns32332 ns32k nsc32000
21245 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21246 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21247 pc532 pdp11 PGC PIC plexus PORTAR posix
21248 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21249 POSIX_C_SOURCE POSIX_SOURCE POWER
21250 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21251 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21252 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21253 sony sony_news sonyrisc sparc sparclite spectrum
21254 stardent stdc STDC_EXT stratos sun sun3 sun386
21255 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21256 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21257 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21258 sysV68 sysV88 Tek4132 Tek4300 titan
21259 TM3200 TM5400 TM5600
21260 tower tower32 tower32_200 tower32_600 tower32_700
21261 tower32_800 tower32_850 tss
21262 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21263 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21264 unix UNIX95 UNIX99 unixpc unos
21265 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21266 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21267 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21268 USGr4 USGr4_2
21269 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21270 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21271 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21272 z8000
21273 EOSH
21274 # Maybe put other stuff here too.
21275 cat <<EOSH >>Cppsym.know
21276 $osname
21277 EOSH
21278 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21279 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21280 $cat Cppsym.know > Cppsym.c
21281 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21282 $rm -f Cppsym.a Cppsym.b Cppsym.c
21283 cat <<EOSH > Cppsym
21284 $startsh
21285 if $test \$# -gt 0; then
21286     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21287     if $test -s Cppsym.got; then
21288         $rm -f Cppsym.got
21289         exit 0
21290     fi
21291     $rm -f Cppsym.got
21292     exit 1
21293 else
21294     $tr " " "$trnl" | ./Cppsym.try
21295     exit 0
21296 fi
21297 EOSH
21298 chmod +x Cppsym
21299 $eunicefix Cppsym
21300 cat <<EOSH > Cppsym.try
21301 $startsh
21302 cat <<'EOCP' > try.c
21303 #include <stdio.h>
21304 #if cpp_stuff == 1
21305 #define STRINGIFY(a)    "a"
21306 #endif
21307 #if cpp_stuff == 42
21308 #define StGiFy(a)  #a
21309 #define STRINGIFY(a)    StGiFy(a)
21310 #endif
21311 #if $cpp_stuff != 1 && $cpp_stuff != 42
21312 #   include "Bletch: How does this C preprocessor stringify macros?"
21313 #endif
21314 int main() {
21315 EOCP
21316 $awk \\
21317 EOSH
21318 cat <<'EOSH' >> Cppsym.try
21319 'length($1) > 0 {
21320     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21321     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21322     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21323     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21324 }'       >> try.c
21325 echo 'return 0;}' >> try.c
21326 EOSH
21327 cat <<EOSH >> Cppsym.try
21328 ccflags="$ccflags"
21329 case "$osname-$gccversion" in
21330 irix-) ccflags="\$ccflags -woff 1178" ;;
21331 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21332 esac
21333 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21334 EOSH
21335 chmod +x Cppsym.try
21336 $eunicefix Cppsym.try
21337 ./Cppsym < Cppsym.know > Cppsym.true
21338 : Add in any linux cpp "predefined macros":
21339 case "$osname::$gccversion" in
21340   *linux*::*.*)
21341     tHdrH=_tmpHdr
21342     rm -f $tHdrH'.h' $tHdrH
21343     touch $tHdrH'.h'
21344     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21345        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21346        if [ -s $tHdrH'_cppsym.real' ]; then
21347           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21348        fi
21349     fi
21350     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21351   ;;
21352 esac
21353 : now check the C compiler for additional symbols
21354 postprocess_cc_v=''
21355 case "$osname" in
21356 aix) postprocess_cc_v="|$tr , ' '" ;;
21357 esac
21358 $cat >ccsym <<EOS
21359 $startsh
21360 $cat >tmp.c <<EOF
21361 extern int foo;
21362 EOF
21363 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21364 do
21365         case "\$i" in
21366         -D*) echo "\$i" | $sed 's/^-D//';;
21367         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21368         esac
21369 done
21370 $rm_try
21371 EOS
21372 postprocess_cc_v=''
21373 chmod +x ccsym
21374 $eunicefix ccsym
21375 ./ccsym > ccsym1.raw
21376 if $test -s ccsym1.raw; then
21377        $sort ccsym1.raw | $uniq >ccsym.raw
21378 else
21379        mv ccsym1.raw ccsym.raw
21380 fi
21381
21382 $awk '/\=/ { print $0; next }
21383         { print $0"=1" }' ccsym.raw >ccsym.list
21384 $comm -13 Cppsym.true ccsym.list >ccsym.own
21385 $comm -12 Cppsym.true ccsym.list >ccsym.com
21386 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21387 also=''
21388 if $test -z ccsym.raw; then
21389         echo "Your C compiler doesn't seem to define any symbols!" >&4
21390         echo " "
21391         echo "However, your C preprocessor defines the following symbols:"
21392         $cat Cppsym.true
21393         ccsymbols=''
21394         cppsymbols=`$cat Cppsym.true`
21395         cppsymbols=`echo $cppsymbols`
21396         cppccsymbols="$cppsymbols"
21397 else
21398         if $test -s ccsym.com; then
21399                 echo "Your C compiler and pre-processor define these symbols:"
21400                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21401                 also='also '
21402                 symbols='ones'
21403                 cppccsymbols=`$cat ccsym.com`
21404                 cppccsymbols=`echo $cppccsymbols`
21405                 $test "$silent" || sleep 1
21406         fi
21407         if $test -s ccsym.cpp; then
21408                 $test "$also" && echo " "
21409                 echo "Your C pre-processor ${also}defines the following symbols:"
21410                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21411                 also='further '
21412                 cppsymbols=`$cat ccsym.cpp`
21413                 cppsymbols=`echo $cppsymbols`
21414                 $test "$silent" || sleep 1
21415         fi
21416         if $test -s ccsym.own; then
21417                 $test "$also" && echo " "
21418                 echo "Your C compiler ${also}defines the following cpp symbols:"
21419                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21420                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21421                 ccsymbols=`$cat ccsym.own`
21422                 ccsymbols=`echo $ccsymbols`
21423                 $test "$silent" || sleep 1
21424         fi
21425 fi
21426
21427 : see if this is a termio system
21428 val="$undef"
21429 val2="$undef"
21430 val3="$undef"
21431 if $test `./findhdr termios.h`; then
21432         set tcsetattr i_termios
21433         eval $inlibc
21434         val3="$i_termios"
21435 fi
21436 echo " "
21437 case "$val3" in
21438 "$define") echo "You have POSIX termios.h... good!" >&4;;
21439 *) if ./Cppsym pyr; then
21440                 case "`/bin/universe`" in
21441                 ucb) if $test `./findhdr sgtty.h`; then
21442                                 val2="$define"
21443                                 echo "<sgtty.h> found." >&4
21444                         else
21445                                 echo "System is pyramid with BSD universe."
21446                                 ./warn "<sgtty.h> not found--you could have problems."
21447                         fi;;
21448                 *) if $test `./findhdr termio.h`; then
21449                                 val="$define"
21450                                 echo "<termio.h> found." >&4
21451                         else
21452                                 echo "System is pyramid with USG universe."
21453                                 ./warn "<termio.h> not found--you could have problems."
21454                         fi;;
21455                 esac
21456         elif ./usg; then
21457                 if $test `./findhdr termio.h`; then
21458                         echo "<termio.h> found." >&4
21459                         val="$define"
21460                 elif $test `./findhdr sgtty.h`; then
21461                         echo "<sgtty.h> found." >&4
21462                         val2="$define"
21463                 else
21464                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21465                 fi
21466         else
21467                 if $test `./findhdr sgtty.h`; then
21468                         echo "<sgtty.h> found." >&4
21469                         val2="$define"
21470                 elif $test `./findhdr termio.h`; then
21471                         echo "<termio.h> found." >&4
21472                         val="$define"
21473                 else
21474                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21475                 fi
21476         fi;;
21477 esac
21478 set i_termio; eval $setvar
21479 val=$val2; set i_sgtty; eval $setvar
21480 val=$val3; set i_termios; eval $setvar
21481
21482 : see if stddef is available
21483 set stddef.h i_stddef
21484 eval $inhdr
21485
21486 : see if sys/access.h is available
21487 set sys/access.h i_sysaccess
21488 eval $inhdr
21489
21490 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21491 set sys/filio.h i_sysfilio
21492 eval $inhdr
21493 echo " "
21494 if $test `./findhdr sys/ioctl.h`; then
21495         val="$define"
21496         echo '<sys/ioctl.h> found.' >&4
21497 else
21498         val="$undef"
21499         if $test $i_sysfilio = "$define"; then
21500             echo '<sys/ioctl.h> NOT found.' >&4
21501         else
21502                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21503                 $test $i_termio = "$define" && xxx="termio.h"
21504                 $test $i_termios = "$define" && xxx="termios.h"
21505 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21506         fi
21507 fi
21508 set i_sysioctl
21509 eval $setvar
21510
21511 : see if socket ioctl defs are in sys/sockio.h
21512 echo " "
21513 xxx=`./findhdr sys/sockio.h`
21514 if $test "$xxx"; then
21515         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21516                 val="$define"
21517                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21518         else
21519                 val="$undef"
21520                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21521         fi
21522 else
21523         val="$undef"
21524         $cat <<EOM
21525 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21526 EOM
21527 fi
21528 set i_syssockio
21529 eval $setvar
21530
21531 : see if this is a syslog.h system
21532 set syslog.h i_syslog
21533 eval $inhdr
21534
21535 : see if this is a sys/mode.h system
21536 set sys/mode.h i_sysmode
21537 eval $inhdr
21538
21539 : see if there is a sys/poll.h file
21540 set sys/poll.h i_syspoll
21541 eval $inhdr
21542
21543 : see if sys/resource.h has to be included
21544 set sys/resource.h i_sysresrc
21545 eval $inhdr
21546
21547 : see if sys/security.h is available
21548 set sys/security.h i_syssecrt
21549 eval $inhdr
21550
21551 : see if this is a sys/statvfs.h system
21552 set sys/statvfs.h i_sysstatvfs
21553 eval $inhdr
21554
21555 : see if this is a sys/un.h system
21556 set sys/un.h i_sysun
21557 eval $inhdr
21558
21559 : see if this is a sys/utsname.h system
21560 set sys/utsname.h i_sysutsname
21561 eval $inhdr
21562
21563 : see if this is a syswait system
21564 set sys/wait.h i_syswait
21565 eval $inhdr
21566
21567 : see if this is a ustat.h system
21568 set ustat.h i_ustat
21569 eval $inhdr
21570
21571 : see if this is an utime system
21572 set utime.h i_utime
21573 eval $inhdr
21574
21575 : see if this is a vfork system
21576 case "$d_vfork" in
21577 "$define")
21578         set vfork.h i_vfork
21579         eval $inhdr
21580         ;;
21581 *)
21582         i_vfork="$undef"
21583         ;;
21584 esac
21585
21586 : Check extensions
21587 echo " "
21588 echo "Looking for extensions..." >&4
21589 : If we are using the old config.sh, known_extensions may contain
21590 : old or inaccurate or duplicate values.
21591 known_extensions=''
21592 nonxs_extensions=''
21593 : We do not use find because it might not be available.
21594 : We do not just use MANIFEST because the user may have dropped
21595 : some additional extensions into the source tree and expect them
21596 : to be built.
21597
21598 : Function to recursively find available extensions, ignoring DynaLoader
21599 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21600 find_extensions='
21601     for xxx in *; do
21602         case "$xxx" in
21603             DynaLoader|dynaload) ;;
21604             *)
21605             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21606                 known_extensions="$known_extensions $1$xxx";
21607             elif $test -f $xxx/Makefile.PL; then
21608                 nonxs_extensions="$nonxs_extensions $1$xxx";
21609             else
21610                 if $test -d $xxx -a $# -lt 10; then
21611                     set $1$xxx/ $*;
21612                     cd "$xxx";
21613                     eval $find_extensions;
21614                     cd ..;
21615                     shift;
21616                 fi;
21617             fi
21618             ;;
21619         esac;
21620     done'
21621 tdir=`pwd`
21622 cd "$rsrc/ext"
21623 set X
21624 shift
21625 eval $find_extensions
21626 # Special case:  Add in modules that nest beyond the first level.
21627 # Currently threads/shared and Hash/Util/FieldHash, since they are
21628 # not picked up by the recursive find above (and adding in general
21629 # recursive finding breaks SDBM_File/sdbm).
21630 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21631 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21632 set X $known_extensions
21633 shift
21634 known_extensions="$*"
21635 set X $nonxs_extensions
21636 shift
21637 nonxs_extensions="$*"
21638 cd "$tdir"
21639
21640 : Now see which are supported on this system.
21641 avail_ext=''
21642 for xxx in $known_extensions ; do
21643         case "$xxx" in
21644         DB_File|db_file)
21645                 case "$i_db" in
21646                 $define) avail_ext="$avail_ext $xxx" ;;
21647                 esac
21648                 ;;
21649         GDBM_File|gdbm_fil)
21650                 case "$i_gdbm" in
21651                 $define) avail_ext="$avail_ext $xxx" ;;
21652                 esac
21653                 ;;
21654         I18N/Langinfo|i18n_lan)
21655                 case "$i_langinfo$d_nl_langinfo" in
21656                 $define$define) avail_ext="$avail_ext $xxx" ;;
21657                 esac
21658                 ;;
21659         IPC/SysV|ipc/sysv)
21660                 : XXX Do we need a useipcsysv variable here
21661                 case "${d_msg}${d_sem}${d_shm}" in
21662                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21663                 esac
21664                 ;;
21665         NDBM_File|ndbm_fil)
21666                 case "$i_ndbm" in
21667                 $define)
21668                     case "$osname-$use64bitint" in
21669                     hpux-define)
21670                         case "$libs" in
21671                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21672                         esac
21673                         ;;
21674                     *) avail_ext="$avail_ext $xxx" ;;
21675                     esac
21676                     ;;
21677                 esac
21678                 ;;
21679         ODBM_File|odbm_fil)
21680                 case "${i_dbm}${i_rpcsvcdbm}" in
21681                 *"${define}"*)
21682                     case "$d_cplusplus" in
21683                     define) ;; # delete as a function name will not work
21684                     *)  case "$osname-$use64bitint" in
21685                         hpux-define)
21686                             case "$libs" in
21687                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21688                             esac
21689                             ;;
21690                         *) avail_ext="$avail_ext $xxx" ;;
21691                         esac
21692                         ;;
21693                     esac
21694                     ;;
21695                 esac
21696                 ;;
21697         Opcode|opcode)
21698                 case "$useopcode" in
21699                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21700                 esac
21701                 ;;
21702         POSIX|posix)
21703                 case "$useposix" in
21704                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21705                 esac
21706                 ;;
21707         Socket|socket)
21708                 case "$d_socket" in
21709                 true|$define|y)
21710                     case "$osname" in
21711                     beos) ;; # not unless BONE
21712                     *) avail_ext="$avail_ext $xxx" ;;
21713                     esac
21714                     ;;
21715                 esac
21716                 ;;
21717         Sys/Syslog|sys/syslog)
21718                 : XXX syslog requires socket
21719                 case "$d_socket" in
21720                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21721                 esac
21722                 ;;
21723         Thread|thread)
21724                 case "$usethreads" in
21725                 true|$define|y)
21726                         case "$use5005threads" in
21727                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21728                         esac
21729                 esac
21730                 ;;
21731         threads|threads/shared)
21732                 # threads and threads::shared are special cases.
21733                 # To stop people from asking "Perl 5.8.0 was supposed
21734                 # to have this new fancy threads implementation but my
21735                 # perl doesn't have it" and from people trying to
21736                 # (re)install the threads module using CPAN.pm and
21737                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21738                 # the threads.pm and threads/shared.pm will always be
21739                 # there, croaking informatively ("you need to rebuild
21740                 # all of Perl with threads, sorry") when threads haven't
21741                 # been compiled in.
21742                 # --jhi
21743                 avail_ext="$avail_ext $xxx"
21744                 ;;
21745         Win32*)
21746                 case "$osname" in
21747                 cygwin) avail_ext="$avail_ext $xxx" ;;
21748                 esac
21749                 ;;
21750         XS/APItest|xs/apitest)
21751                 # This is just for testing.  Skip it unless we have dynamic loading.
21752
21753                 case "$usedl" in
21754                 $define) avail_ext="$avail_ext $xxx" ;;
21755                 esac
21756                 ;;
21757         XS/Typemap|xs/typemap)
21758                 # This is just for testing.  Skip it unless we have dynamic loading.
21759                 case "$usedl" in
21760                 $define) avail_ext="$avail_ext $xxx" ;;
21761                 esac
21762                 ;;
21763         *)      avail_ext="$avail_ext $xxx"
21764                 ;;
21765         esac
21766 done
21767
21768 set X $avail_ext
21769 shift
21770 avail_ext="$*"
21771
21772 case "$onlyextensions" in
21773 '') ;;
21774 *)  keepextensions=''
21775     echo "You have requested that only certains extensions be included..." >&4
21776     for i in $onlyextensions; do
21777         case " $avail_ext " in
21778         *" $i "*)
21779             echo "Keeping extension $i."
21780             keepextensions="$keepextensions $i"
21781             ;;
21782         *) echo "Ignoring extension $i." ;;
21783         esac
21784     done
21785     avail_ext="$keepextensions"
21786     ;;
21787 esac
21788
21789 case "$noextensions" in
21790 '') ;;
21791 *)  keepextensions=''
21792     echo "You have requested that certain extensions be ignored..." >&4
21793     for i in $avail_ext; do
21794         case " $noextensions " in
21795         *" $i "*) echo "Ignoring extension $i." ;;
21796         *) echo "Keeping extension $i.";
21797            keepextensions="$keepextensions $i"
21798            ;;
21799         esac
21800     done
21801     avail_ext="$keepextensions"
21802     ;;
21803 esac
21804
21805 : Now see which nonxs extensions are supported on this system.
21806 : For now assume all are.
21807 nonxs_ext=''
21808 for xxx in $nonxs_extensions ; do
21809         case "$xxx" in
21810         *)      nonxs_ext="$nonxs_ext $xxx"
21811                 ;;
21812         esac
21813 done
21814
21815 set X $nonxs_ext
21816 shift
21817 nonxs_ext="$*"
21818
21819 case $usedl in
21820 $define)
21821         $cat <<EOM
21822 A number of extensions are supplied with $package.  You may choose to
21823 compile these extensions for dynamic loading (the default), compile
21824 them into the $package executable (static loading), or not include
21825 them at all.  Answer "none" to include no extensions.
21826 Note that DynaLoader is always built and need not be mentioned here.
21827
21828 EOM
21829         case "$dynamic_ext" in
21830         '')
21831                 : Exclude those listed in static_ext
21832                 dflt=''
21833                 for xxx in $avail_ext; do
21834                         case " $static_ext " in
21835                         *" $xxx "*) ;;
21836                         *) dflt="$dflt $xxx" ;;
21837                         esac
21838                 done
21839                 set X $dflt
21840                 shift
21841                 dflt="$*"
21842                 ;;
21843         *)      dflt="$dynamic_ext"
21844                 # Perhaps we are reusing an old out-of-date config.sh.
21845                 case "$hint" in
21846                 previous)
21847                         if test X"$dynamic_ext" != X"$avail_ext"; then
21848                                 $cat <<EOM
21849 NOTICE:  Your previous config.sh list may be incorrect.
21850 The extensions now available to you are
21851         ${avail_ext}
21852 but the default list from your previous config.sh is
21853         ${dynamic_ext}
21854
21855 EOM
21856                         fi
21857                         ;;
21858                 esac
21859                 ;;
21860         esac
21861         case "$dflt" in
21862         '')     dflt=none;;
21863         esac
21864         rp="What extensions do you wish to load dynamically?"
21865         . ./myread
21866         case "$ans" in
21867         none) dynamic_ext=' ' ;;
21868         *) dynamic_ext="$ans" ;;
21869         esac
21870
21871         case "$static_ext" in
21872         '')
21873                 : Exclude those already listed in dynamic linking
21874                 dflt=''
21875                 for xxx in $avail_ext; do
21876                         case " $dynamic_ext " in
21877                         *" $xxx "*) ;;
21878                         *) dflt="$dflt $xxx" ;;
21879                         esac
21880                 done
21881                 set X $dflt
21882                 shift
21883                 dflt="$*"
21884                 ;;
21885         *)  dflt="$static_ext"
21886                 ;;
21887         esac
21888
21889         case "$dflt" in
21890         '')     dflt=none;;
21891         esac
21892         rp="What extensions do you wish to load statically?"
21893         . ./myread
21894         case "$ans" in
21895         none) static_ext=' ' ;;
21896         *) static_ext="$ans" ;;
21897         esac
21898         ;;
21899 *)
21900         $cat <<EOM
21901 A number of extensions are supplied with $package.  Answer "none"
21902 to include no extensions.
21903 Note that DynaLoader is always built and need not be mentioned here.
21904
21905 EOM
21906         case "$static_ext" in
21907         '') dflt="$avail_ext" ;;
21908         *)      dflt="$static_ext"
21909                 # Perhaps we are reusing an old out-of-date config.sh.
21910                 case "$hint" in
21911                 previous)
21912                         if test X"$static_ext" != X"$avail_ext"; then
21913                                 $cat <<EOM
21914 NOTICE:  Your previous config.sh list may be incorrect.
21915 The extensions now available to you are
21916         ${avail_ext}
21917 but the default list from your previous config.sh is
21918         ${static_ext}
21919
21920 EOM
21921                         fi
21922                         ;;
21923                 esac
21924                 ;;
21925         esac
21926         : Exclude those that are not xs extensions
21927         case "$dflt" in
21928         '')     dflt=none;;
21929         esac
21930         rp="What extensions do you wish to include?"
21931         . ./myread
21932         case "$ans" in
21933         none) static_ext=' ' ;;
21934         *) static_ext="$ans" ;;
21935         esac
21936         ;;
21937 esac
21938 #
21939 # Encode is a special case.  If we are building Encode as a static
21940 # extension, we need to explicitly list its subextensions as well.
21941 # For other nested extensions, this is handled automatically by
21942 # the appropriate Makefile.PL.
21943 case " $static_ext " in
21944         *" Encode "*) # Add the subextensions of Encode
21945         cd "$rsrc/ext"
21946         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21947                 static_ext="$static_ext Encode/$xxx"
21948         done
21949         cd "$tdir"
21950         ;;
21951 esac
21952
21953 set X $dynamic_ext $static_ext $nonxs_ext
21954 shift
21955 extensions="$*"
21956
21957 # Sanity check:  We require an extension suitable for use with
21958 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21959 # should show up as failures in the test suite, but it's helpful to
21960 # catch them now.) The 'extensions' list is normally sorted
21961 # alphabetically, so we need to accept either
21962 #    DB_File ... Fcntl ... IO  ....
21963 # or something like
21964 #    Fcntl ... NDBM_File ... IO  ....
21965 case " $extensions"  in
21966 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21967 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21968 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21969 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21970    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21971    ;;
21972 esac
21973
21974 : Remove libraries needed only for extensions
21975 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21976 : The exception is SunOS 4.x, which needs them.
21977 case "${osname}X${osvers}" in
21978 sunos*X4*)
21979     perllibs="$libs"
21980     ;;
21981 *) case "$usedl" in
21982     $define|true|[yY]*)
21983             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21984             shift
21985             perllibs="$*"
21986             ;;
21987     *)  perllibs="$libs"
21988             ;;
21989     esac
21990     ;;
21991 esac
21992
21993 : Remove build directory name from cppstdin so it can be used from
21994 : either the present location or the final installed location.
21995 echo " "
21996 : Get out of the UU directory to get correct path name.
21997 cd ..
21998 case "$cppstdin" in
21999 `pwd`/cppstdin)
22000         echo "Stripping down cppstdin path name"
22001         cppstdin=cppstdin
22002         ;;
22003 esac
22004 cd UU
22005
22006 : end of configuration questions
22007 echo " "
22008 echo "End of configuration questions."
22009 echo " "
22010
22011 : back to where it started
22012 if test -d ../UU; then
22013         cd ..
22014 fi
22015
22016 : configuration may be unconditionally patched via a 'config.arch' file
22017 if $test -f config.arch; then
22018         echo "I see a config.arch file, loading it." >&4
22019         . ./config.arch
22020 fi
22021
22022 : configuration may be patched via a 'config.over' file
22023 if $test -f config.over; then
22024         echo " "
22025         dflt=y
22026         rp='I see a config.over file.  Do you wish to load it?'
22027         . UU/myread
22028         case "$ans" in
22029         n*) echo "OK, I'll ignore it.";;
22030         *)      . ./config.over
22031                 echo "Configuration override changes have been loaded."
22032                 ;;
22033         esac
22034 fi
22035
22036 : in case they want portability, strip down executable paths
22037 case "$d_portable" in
22038 "$define")
22039         echo " "
22040         echo "Stripping down executable paths..." >&4
22041         for file in $loclist $trylist; do
22042                 eval temp=\$$file
22043                 eval $file=`basename $temp`
22044         done
22045         ;;
22046 esac
22047
22048 : create config.sh file
22049 echo " "
22050 echo "Creating config.sh..." >&4
22051 $spitshell <<EOT >config.sh
22052 $startsh
22053 #
22054 # This file was produced by running the Configure script. It holds all the
22055 # definitions figured out by Configure. Should you modify one of these values,
22056 # do not forget to propagate your changes by running "Configure -der". You may
22057 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22058 #
22059
22060 # Package name      : $package
22061 # Source directory  : $src
22062 # Configuration time: $cf_time
22063 # Configured by     : $cf_by
22064 # Target system     : $myuname
22065
22066 EOT
22067 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22068 $spitshell <<EOT >>config.sh
22069
22070 Author='$Author'
22071 Date='$Date'
22072 Header='$Header'
22073 Id='$Id'
22074 Locker='$Locker'
22075 Log='$Log'
22076 RCSfile='$RCSfile'
22077 Revision='$Revision'
22078 Source='$Source'
22079 State='$State'
22080 _a='$_a'
22081 _exe='$_exe'
22082 _o='$_o'
22083 afs='$afs'
22084 afsroot='$afsroot'
22085 alignbytes='$alignbytes'
22086 ansi2knr='$ansi2knr'
22087 aphostname='$aphostname'
22088 api_revision='$api_revision'
22089 api_subversion='$api_subversion'
22090 api_version='$api_version'
22091 api_versionstring='$api_versionstring'
22092 ar='$ar'
22093 archlib='$archlib'
22094 archlibexp='$archlibexp'
22095 archname64='$archname64'
22096 archname='$archname'
22097 archobjs='$archobjs'
22098 asctime_r_proto='$asctime_r_proto'
22099 awk='$awk'
22100 baserev='$baserev'
22101 bash='$bash'
22102 bin='$bin'
22103 binexp='$binexp'
22104 bison='$bison'
22105 byacc='$byacc'
22106 byteorder='$byteorder'
22107 c='$c'
22108 castflags='$castflags'
22109 cat='$cat'
22110 cc='$cc'
22111 cccdlflags='$cccdlflags'
22112 ccdlflags='$ccdlflags'
22113 ccflags='$ccflags'
22114 ccflags_uselargefiles='$ccflags_uselargefiles'
22115 ccname='$ccname'
22116 ccsymbols='$ccsymbols'
22117 ccversion='$ccversion'
22118 cf_by='$cf_by'
22119 cf_email='$cf_email'
22120 cf_time='$cf_time'
22121 chgrp='$chgrp'
22122 chmod='$chmod'
22123 chown='$chown'
22124 clocktype='$clocktype'
22125 comm='$comm'
22126 compress='$compress'
22127 contains='$contains'
22128 cp='$cp'
22129 cpio='$cpio'
22130 cpp='$cpp'
22131 cpp_stuff='$cpp_stuff'
22132 cppccsymbols='$cppccsymbols'
22133 cppflags='$cppflags'
22134 cpplast='$cpplast'
22135 cppminus='$cppminus'
22136 cpprun='$cpprun'
22137 cppstdin='$cppstdin'
22138 cppsymbols='$cppsymbols'
22139 crypt_r_proto='$crypt_r_proto'
22140 cryptlib='$cryptlib'
22141 csh='$csh'
22142 ctermid_r_proto='$ctermid_r_proto'
22143 ctime_r_proto='$ctime_r_proto'
22144 d_Gconvert='$d_Gconvert'
22145 d_PRIEUldbl='$d_PRIEUldbl'
22146 d_PRIFUldbl='$d_PRIFUldbl'
22147 d_PRIGUldbl='$d_PRIGUldbl'
22148 d_PRIXU64='$d_PRIXU64'
22149 d_PRId64='$d_PRId64'
22150 d_PRIeldbl='$d_PRIeldbl'
22151 d_PRIfldbl='$d_PRIfldbl'
22152 d_PRIgldbl='$d_PRIgldbl'
22153 d_PRIi64='$d_PRIi64'
22154 d_PRIo64='$d_PRIo64'
22155 d_PRIu64='$d_PRIu64'
22156 d_PRIx64='$d_PRIx64'
22157 d_SCNfldbl='$d_SCNfldbl'
22158 d__fwalk='$d__fwalk'
22159 d_access='$d_access'
22160 d_accessx='$d_accessx'
22161 d_aintl='$d_aintl'
22162 d_alarm='$d_alarm'
22163 d_archlib='$d_archlib'
22164 d_asctime64='$d_asctime64'
22165 d_asctime_r='$d_asctime_r'
22166 d_atolf='$d_atolf'
22167 d_atoll='$d_atoll'
22168 d_attribute_deprecated='$d_attribute_deprecated'
22169 d_attribute_format='$d_attribute_format'
22170 d_attribute_malloc='$d_attribute_malloc'
22171 d_attribute_nonnull='$d_attribute_nonnull'
22172 d_attribute_noreturn='$d_attribute_noreturn'
22173 d_attribute_pure='$d_attribute_pure'
22174 d_attribute_unused='$d_attribute_unused'
22175 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22176 d_bcmp='$d_bcmp'
22177 d_bcopy='$d_bcopy'
22178 d_bsd='$d_bsd'
22179 d_bsdgetpgrp='$d_bsdgetpgrp'
22180 d_bsdsetpgrp='$d_bsdsetpgrp'
22181 d_builtin_choose_expr='$d_builtin_choose_expr'
22182 d_builtin_expect='$d_builtin_expect'
22183 d_bzero='$d_bzero'
22184 d_c99_variadic_macros='$d_c99_variadic_macros'
22185 d_casti32='$d_casti32'
22186 d_castneg='$d_castneg'
22187 d_charvspr='$d_charvspr'
22188 d_chown='$d_chown'
22189 d_chroot='$d_chroot'
22190 d_chsize='$d_chsize'
22191 d_class='$d_class'
22192 d_clearenv='$d_clearenv'
22193 d_closedir='$d_closedir'
22194 d_cmsghdr_s='$d_cmsghdr_s'
22195 d_const='$d_const'
22196 d_copysignl='$d_copysignl'
22197 d_cplusplus='$d_cplusplus'
22198 d_crypt='$d_crypt'
22199 d_crypt_r='$d_crypt_r'
22200 d_csh='$d_csh'
22201 d_ctermid='$d_ctermid'
22202 d_ctermid_r='$d_ctermid_r'
22203 d_ctime64='$d_ctime64'
22204 d_ctime_r='$d_ctime_r'
22205 d_cuserid='$d_cuserid'
22206 d_dbl_dig='$d_dbl_dig'
22207 d_dbminitproto='$d_dbminitproto'
22208 d_difftime64='$d_difftime64'
22209 d_difftime='$d_difftime'
22210 d_dir_dd_fd='$d_dir_dd_fd'
22211 d_dirfd='$d_dirfd'
22212 d_dirnamlen='$d_dirnamlen'
22213 d_dlerror='$d_dlerror'
22214 d_dlopen='$d_dlopen'
22215 d_dlsymun='$d_dlsymun'
22216 d_dosuid='$d_dosuid'
22217 d_drand48_r='$d_drand48_r'
22218 d_drand48proto='$d_drand48proto'
22219 d_dup2='$d_dup2'
22220 d_eaccess='$d_eaccess'
22221 d_endgrent='$d_endgrent'
22222 d_endgrent_r='$d_endgrent_r'
22223 d_endhent='$d_endhent'
22224 d_endhostent_r='$d_endhostent_r'
22225 d_endnent='$d_endnent'
22226 d_endnetent_r='$d_endnetent_r'
22227 d_endpent='$d_endpent'
22228 d_endprotoent_r='$d_endprotoent_r'
22229 d_endpwent='$d_endpwent'
22230 d_endpwent_r='$d_endpwent_r'
22231 d_endsent='$d_endsent'
22232 d_endservent_r='$d_endservent_r'
22233 d_eofnblk='$d_eofnblk'
22234 d_eunice='$d_eunice'
22235 d_faststdio='$d_faststdio'
22236 d_fchdir='$d_fchdir'
22237 d_fchmod='$d_fchmod'
22238 d_fchown='$d_fchown'
22239 d_fcntl='$d_fcntl'
22240 d_fcntl_can_lock='$d_fcntl_can_lock'
22241 d_fd_macros='$d_fd_macros'
22242 d_fd_set='$d_fd_set'
22243 d_fds_bits='$d_fds_bits'
22244 d_fgetpos='$d_fgetpos'
22245 d_finite='$d_finite'
22246 d_finitel='$d_finitel'
22247 d_flexfnam='$d_flexfnam'
22248 d_flock='$d_flock'
22249 d_flockproto='$d_flockproto'
22250 d_fork='$d_fork'
22251 d_fp_class='$d_fp_class'
22252 d_fpathconf='$d_fpathconf'
22253 d_fpclass='$d_fpclass'
22254 d_fpclassify='$d_fpclassify'
22255 d_fpclassl='$d_fpclassl'
22256 d_fpos64_t='$d_fpos64_t'
22257 d_frexpl='$d_frexpl'
22258 d_fs_data_s='$d_fs_data_s'
22259 d_fseeko='$d_fseeko'
22260 d_fsetpos='$d_fsetpos'
22261 d_fstatfs='$d_fstatfs'
22262 d_fstatvfs='$d_fstatvfs'
22263 d_fsync='$d_fsync'
22264 d_ftello='$d_ftello'
22265 d_ftime='$d_ftime'
22266 d_futimes='$d_futimes'
22267 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22268 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22269 d_getcwd='$d_getcwd'
22270 d_getespwnam='$d_getespwnam'
22271 d_getfsstat='$d_getfsstat'
22272 d_getgrent='$d_getgrent'
22273 d_getgrent_r='$d_getgrent_r'
22274 d_getgrgid_r='$d_getgrgid_r'
22275 d_getgrnam_r='$d_getgrnam_r'
22276 d_getgrps='$d_getgrps'
22277 d_gethbyaddr='$d_gethbyaddr'
22278 d_gethbyname='$d_gethbyname'
22279 d_gethent='$d_gethent'
22280 d_gethname='$d_gethname'
22281 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22282 d_gethostbyname_r='$d_gethostbyname_r'
22283 d_gethostent_r='$d_gethostent_r'
22284 d_gethostprotos='$d_gethostprotos'
22285 d_getitimer='$d_getitimer'
22286 d_getlogin='$d_getlogin'
22287 d_getlogin_r='$d_getlogin_r'
22288 d_getmnt='$d_getmnt'
22289 d_getmntent='$d_getmntent'
22290 d_getnbyaddr='$d_getnbyaddr'
22291 d_getnbyname='$d_getnbyname'
22292 d_getnent='$d_getnent'
22293 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22294 d_getnetbyname_r='$d_getnetbyname_r'
22295 d_getnetent_r='$d_getnetent_r'
22296 d_getnetprotos='$d_getnetprotos'
22297 d_getpagsz='$d_getpagsz'
22298 d_getpbyname='$d_getpbyname'
22299 d_getpbynumber='$d_getpbynumber'
22300 d_getpent='$d_getpent'
22301 d_getpgid='$d_getpgid'
22302 d_getpgrp2='$d_getpgrp2'
22303 d_getpgrp='$d_getpgrp'
22304 d_getppid='$d_getppid'
22305 d_getprior='$d_getprior'
22306 d_getprotobyname_r='$d_getprotobyname_r'
22307 d_getprotobynumber_r='$d_getprotobynumber_r'
22308 d_getprotoent_r='$d_getprotoent_r'
22309 d_getprotoprotos='$d_getprotoprotos'
22310 d_getprpwnam='$d_getprpwnam'
22311 d_getpwent='$d_getpwent'
22312 d_getpwent_r='$d_getpwent_r'
22313 d_getpwnam_r='$d_getpwnam_r'
22314 d_getpwuid_r='$d_getpwuid_r'
22315 d_getsbyname='$d_getsbyname'
22316 d_getsbyport='$d_getsbyport'
22317 d_getsent='$d_getsent'
22318 d_getservbyname_r='$d_getservbyname_r'
22319 d_getservbyport_r='$d_getservbyport_r'
22320 d_getservent_r='$d_getservent_r'
22321 d_getservprotos='$d_getservprotos'
22322 d_getspnam='$d_getspnam'
22323 d_getspnam_r='$d_getspnam_r'
22324 d_gettimeod='$d_gettimeod'
22325 d_gmtime64='$d_gmtime64'
22326 d_gmtime_r='$d_gmtime_r'
22327 d_gnulibc='$d_gnulibc'
22328 d_grpasswd='$d_grpasswd'
22329 d_hasmntopt='$d_hasmntopt'
22330 d_htonl='$d_htonl'
22331 d_ilogbl='$d_ilogbl'
22332 d_inc_version_list='$d_inc_version_list'
22333 d_index='$d_index'
22334 d_inetaton='$d_inetaton'
22335 d_int64_t='$d_int64_t'
22336 d_isascii='$d_isascii'
22337 d_isfinite='$d_isfinite'
22338 d_isinf='$d_isinf'
22339 d_isnan='$d_isnan'
22340 d_isnanl='$d_isnanl'
22341 d_killpg='$d_killpg'
22342 d_lchown='$d_lchown'
22343 d_ldbl_dig='$d_ldbl_dig'
22344 d_libm_lib_version='$d_libm_lib_version'
22345 d_link='$d_link'
22346 d_localtime64='$d_localtime64'
22347 d_localtime_r='$d_localtime_r'
22348 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22349 d_locconv='$d_locconv'
22350 d_lockf='$d_lockf'
22351 d_longdbl='$d_longdbl'
22352 d_longlong='$d_longlong'
22353 d_lseekproto='$d_lseekproto'
22354 d_lstat='$d_lstat'
22355 d_madvise='$d_madvise'
22356 d_malloc_good_size='$d_malloc_good_size'
22357 d_malloc_size='$d_malloc_size'
22358 d_mblen='$d_mblen'
22359 d_mbstowcs='$d_mbstowcs'
22360 d_mbtowc='$d_mbtowc'
22361 d_memchr='$d_memchr'
22362 d_memcmp='$d_memcmp'
22363 d_memcpy='$d_memcpy'
22364 d_memmove='$d_memmove'
22365 d_memset='$d_memset'
22366 d_mkdir='$d_mkdir'
22367 d_mkdtemp='$d_mkdtemp'
22368 d_mkfifo='$d_mkfifo'
22369 d_mkstemp='$d_mkstemp'
22370 d_mkstemps='$d_mkstemps'
22371 d_mktime64='$d_mktime64'
22372 d_mktime='$d_mktime'
22373 d_mmap='$d_mmap'
22374 d_modfl='$d_modfl'
22375 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22376 d_modflproto='$d_modflproto'
22377 d_mprotect='$d_mprotect'
22378 d_msg='$d_msg'
22379 d_msg_ctrunc='$d_msg_ctrunc'
22380 d_msg_dontroute='$d_msg_dontroute'
22381 d_msg_oob='$d_msg_oob'
22382 d_msg_peek='$d_msg_peek'
22383 d_msg_proxy='$d_msg_proxy'
22384 d_msgctl='$d_msgctl'
22385 d_msgget='$d_msgget'
22386 d_msghdr_s='$d_msghdr_s'
22387 d_msgrcv='$d_msgrcv'
22388 d_msgsnd='$d_msgsnd'
22389 d_msync='$d_msync'
22390 d_munmap='$d_munmap'
22391 d_mymalloc='$d_mymalloc'
22392 d_ndbm='$d_ndbm'
22393 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22394 d_nice='$d_nice'
22395 d_nl_langinfo='$d_nl_langinfo'
22396 d_nv_preserves_uv='$d_nv_preserves_uv'
22397 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22398 d_off64_t='$d_off64_t'
22399 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22400 d_oldpthreads='$d_oldpthreads'
22401 d_oldsock='$d_oldsock'
22402 d_open3='$d_open3'
22403 d_pathconf='$d_pathconf'
22404 d_pause='$d_pause'
22405 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22406 d_phostname='$d_phostname'
22407 d_pipe='$d_pipe'
22408 d_poll='$d_poll'
22409 d_portable='$d_portable'
22410 d_printf_format_null='$d_printf_format_null'
22411 d_procselfexe='$d_procselfexe'
22412 d_pseudofork='$d_pseudofork'
22413 d_pthread_atfork='$d_pthread_atfork'
22414 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22415 d_pthread_yield='$d_pthread_yield'
22416 d_pwage='$d_pwage'
22417 d_pwchange='$d_pwchange'
22418 d_pwclass='$d_pwclass'
22419 d_pwcomment='$d_pwcomment'
22420 d_pwexpire='$d_pwexpire'
22421 d_pwgecos='$d_pwgecos'
22422 d_pwpasswd='$d_pwpasswd'
22423 d_pwquota='$d_pwquota'
22424 d_qgcvt='$d_qgcvt'
22425 d_quad='$d_quad'
22426 d_random_r='$d_random_r'
22427 d_readdir64_r='$d_readdir64_r'
22428 d_readdir='$d_readdir'
22429 d_readdir_r='$d_readdir_r'
22430 d_readlink='$d_readlink'
22431 d_readv='$d_readv'
22432 d_recvmsg='$d_recvmsg'
22433 d_rename='$d_rename'
22434 d_rewinddir='$d_rewinddir'
22435 d_rmdir='$d_rmdir'
22436 d_safebcpy='$d_safebcpy'
22437 d_safemcpy='$d_safemcpy'
22438 d_sanemcmp='$d_sanemcmp'
22439 d_sbrkproto='$d_sbrkproto'
22440 d_scalbnl='$d_scalbnl'
22441 d_sched_yield='$d_sched_yield'
22442 d_scm_rights='$d_scm_rights'
22443 d_seekdir='$d_seekdir'
22444 d_select='$d_select'
22445 d_sem='$d_sem'
22446 d_semctl='$d_semctl'
22447 d_semctl_semid_ds='$d_semctl_semid_ds'
22448 d_semctl_semun='$d_semctl_semun'
22449 d_semget='$d_semget'
22450 d_semop='$d_semop'
22451 d_sendmsg='$d_sendmsg'
22452 d_setegid='$d_setegid'
22453 d_seteuid='$d_seteuid'
22454 d_setgrent='$d_setgrent'
22455 d_setgrent_r='$d_setgrent_r'
22456 d_setgrps='$d_setgrps'
22457 d_sethent='$d_sethent'
22458 d_sethostent_r='$d_sethostent_r'
22459 d_setitimer='$d_setitimer'
22460 d_setlinebuf='$d_setlinebuf'
22461 d_setlocale='$d_setlocale'
22462 d_setlocale_r='$d_setlocale_r'
22463 d_setnent='$d_setnent'
22464 d_setnetent_r='$d_setnetent_r'
22465 d_setpent='$d_setpent'
22466 d_setpgid='$d_setpgid'
22467 d_setpgrp2='$d_setpgrp2'
22468 d_setpgrp='$d_setpgrp'
22469 d_setprior='$d_setprior'
22470 d_setproctitle='$d_setproctitle'
22471 d_setprotoent_r='$d_setprotoent_r'
22472 d_setpwent='$d_setpwent'
22473 d_setpwent_r='$d_setpwent_r'
22474 d_setregid='$d_setregid'
22475 d_setresgid='$d_setresgid'
22476 d_setresuid='$d_setresuid'
22477 d_setreuid='$d_setreuid'
22478 d_setrgid='$d_setrgid'
22479 d_setruid='$d_setruid'
22480 d_setsent='$d_setsent'
22481 d_setservent_r='$d_setservent_r'
22482 d_setsid='$d_setsid'
22483 d_setvbuf='$d_setvbuf'
22484 d_sfio='$d_sfio'
22485 d_shm='$d_shm'
22486 d_shmat='$d_shmat'
22487 d_shmatprototype='$d_shmatprototype'
22488 d_shmctl='$d_shmctl'
22489 d_shmdt='$d_shmdt'
22490 d_shmget='$d_shmget'
22491 d_sigaction='$d_sigaction'
22492 d_signbit='$d_signbit'
22493 d_sigprocmask='$d_sigprocmask'
22494 d_sigsetjmp='$d_sigsetjmp'
22495 d_sitearch='$d_sitearch'
22496 d_snprintf='$d_snprintf'
22497 d_sockatmark='$d_sockatmark'
22498 d_sockatmarkproto='$d_sockatmarkproto'
22499 d_socket='$d_socket'
22500 d_socklen_t='$d_socklen_t'
22501 d_sockpair='$d_sockpair'
22502 d_socks5_init='$d_socks5_init'
22503 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22504 d_sqrtl='$d_sqrtl'
22505 d_srand48_r='$d_srand48_r'
22506 d_srandom_r='$d_srandom_r'
22507 d_sresgproto='$d_sresgproto'
22508 d_sresuproto='$d_sresuproto'
22509 d_statblks='$d_statblks'
22510 d_statfs_f_flags='$d_statfs_f_flags'
22511 d_statfs_s='$d_statfs_s'
22512 d_statvfs='$d_statvfs'
22513 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22514 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22515 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22516 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22517 d_stdio_stream_array='$d_stdio_stream_array'
22518 d_stdiobase='$d_stdiobase'
22519 d_stdstdio='$d_stdstdio'
22520 d_strchr='$d_strchr'
22521 d_strcoll='$d_strcoll'
22522 d_strctcpy='$d_strctcpy'
22523 d_strerrm='$d_strerrm'
22524 d_strerror='$d_strerror'
22525 d_strerror_r='$d_strerror_r'
22526 d_strftime='$d_strftime'
22527 d_strlcat='$d_strlcat'
22528 d_strlcpy='$d_strlcpy'
22529 d_strtod='$d_strtod'
22530 d_strtol='$d_strtol'
22531 d_strtold='$d_strtold'
22532 d_strtoll='$d_strtoll'
22533 d_strtoq='$d_strtoq'
22534 d_strtoul='$d_strtoul'
22535 d_strtoull='$d_strtoull'
22536 d_strtouq='$d_strtouq'
22537 d_strxfrm='$d_strxfrm'
22538 d_suidsafe='$d_suidsafe'
22539 d_symlink='$d_symlink'
22540 d_syscall='$d_syscall'
22541 d_syscallproto='$d_syscallproto'
22542 d_sysconf='$d_sysconf'
22543 d_sysernlst='$d_sysernlst'
22544 d_syserrlst='$d_syserrlst'
22545 d_system='$d_system'
22546 d_tcgetpgrp='$d_tcgetpgrp'
22547 d_tcsetpgrp='$d_tcsetpgrp'
22548 d_telldir='$d_telldir'
22549 d_telldirproto='$d_telldirproto'
22550 d_time='$d_time'
22551 d_timegm='$d_timegm'
22552 d_times='$d_times'
22553 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22554 d_tm_tm_zone='$d_tm_tm_zone'
22555 d_tmpnam_r='$d_tmpnam_r'
22556 d_truncate='$d_truncate'
22557 d_ttyname_r='$d_ttyname_r'
22558 d_tzname='$d_tzname'
22559 d_u32align='$d_u32align'
22560 d_ualarm='$d_ualarm'
22561 d_umask='$d_umask'
22562 d_uname='$d_uname'
22563 d_union_semun='$d_union_semun'
22564 d_unordered='$d_unordered'
22565 d_unsetenv='$d_unsetenv'
22566 d_usleep='$d_usleep'
22567 d_usleepproto='$d_usleepproto'
22568 d_ustat='$d_ustat'
22569 d_vendorarch='$d_vendorarch'
22570 d_vendorbin='$d_vendorbin'
22571 d_vendorlib='$d_vendorlib'
22572 d_vendorscript='$d_vendorscript'
22573 d_vfork='$d_vfork'
22574 d_void_closedir='$d_void_closedir'
22575 d_voidsig='$d_voidsig'
22576 d_voidtty='$d_voidtty'
22577 d_volatile='$d_volatile'
22578 d_vprintf='$d_vprintf'
22579 d_vsnprintf='$d_vsnprintf'
22580 d_wait4='$d_wait4'
22581 d_waitpid='$d_waitpid'
22582 d_wcstombs='$d_wcstombs'
22583 d_wctomb='$d_wctomb'
22584 d_writev='$d_writev'
22585 d_xenix='$d_xenix'
22586 date='$date'
22587 db_hashtype='$db_hashtype'
22588 db_prefixtype='$db_prefixtype'
22589 db_version_major='$db_version_major'
22590 db_version_minor='$db_version_minor'
22591 db_version_patch='$db_version_patch'
22592 defvoidused='$defvoidused'
22593 direntrytype='$direntrytype'
22594 dlext='$dlext'
22595 dlsrc='$dlsrc'
22596 doublesize='$doublesize'
22597 drand01='$drand01'
22598 drand48_r_proto='$drand48_r_proto'
22599 dtrace='$dtrace'
22600 dynamic_ext='$dynamic_ext'
22601 eagain='$eagain'
22602 ebcdic='$ebcdic'
22603 echo='$echo'
22604 egrep='$egrep'
22605 emacs='$emacs'
22606 endgrent_r_proto='$endgrent_r_proto'
22607 endhostent_r_proto='$endhostent_r_proto'
22608 endnetent_r_proto='$endnetent_r_proto'
22609 endprotoent_r_proto='$endprotoent_r_proto'
22610 endpwent_r_proto='$endpwent_r_proto'
22611 endservent_r_proto='$endservent_r_proto'
22612 eunicefix='$eunicefix'
22613 exe_ext='$exe_ext'
22614 expr='$expr'
22615 extensions='$extensions'
22616 extern_C='$extern_C'
22617 extras='$extras'
22618 fflushNULL='$fflushNULL'
22619 fflushall='$fflushall'
22620 find='$find'
22621 firstmakefile='$firstmakefile'
22622 flex='$flex'
22623 fpossize='$fpossize'
22624 fpostype='$fpostype'
22625 freetype='$freetype'
22626 from='$from'
22627 full_ar='$full_ar'
22628 full_csh='$full_csh'
22629 full_sed='$full_sed'
22630 gccansipedantic='$gccansipedantic'
22631 gccosandvers='$gccosandvers'
22632 gccversion='$gccversion'
22633 getgrent_r_proto='$getgrent_r_proto'
22634 getgrgid_r_proto='$getgrgid_r_proto'
22635 getgrnam_r_proto='$getgrnam_r_proto'
22636 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22637 gethostbyname_r_proto='$gethostbyname_r_proto'
22638 gethostent_r_proto='$gethostent_r_proto'
22639 getlogin_r_proto='$getlogin_r_proto'
22640 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22641 getnetbyname_r_proto='$getnetbyname_r_proto'
22642 getnetent_r_proto='$getnetent_r_proto'
22643 getprotobyname_r_proto='$getprotobyname_r_proto'
22644 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22645 getprotoent_r_proto='$getprotoent_r_proto'
22646 getpwent_r_proto='$getpwent_r_proto'
22647 getpwnam_r_proto='$getpwnam_r_proto'
22648 getpwuid_r_proto='$getpwuid_r_proto'
22649 getservbyname_r_proto='$getservbyname_r_proto'
22650 getservbyport_r_proto='$getservbyport_r_proto'
22651 getservent_r_proto='$getservent_r_proto'
22652 getspnam_r_proto='$getspnam_r_proto'
22653 gidformat='$gidformat'
22654 gidsign='$gidsign'
22655 gidsize='$gidsize'
22656 gidtype='$gidtype'
22657 glibpth='$glibpth'
22658 gmake='$gmake'
22659 gmtime_r_proto='$gmtime_r_proto'
22660 gnulibc_version='$gnulibc_version'
22661 grep='$grep'
22662 groupcat='$groupcat'
22663 groupstype='$groupstype'
22664 gzip='$gzip'
22665 h_fcntl='$h_fcntl'
22666 h_sysfile='$h_sysfile'
22667 hint='$hint'
22668 hostcat='$hostcat'
22669 html1dir='$html1dir'
22670 html1direxp='$html1direxp'
22671 html3dir='$html3dir'
22672 html3direxp='$html3direxp'
22673 i16size='$i16size'
22674 i16type='$i16type'
22675 i32size='$i32size'
22676 i32type='$i32type'
22677 i64size='$i64size'
22678 i64type='$i64type'
22679 i8size='$i8size'
22680 i8type='$i8type'
22681 i_arpainet='$i_arpainet'
22682 i_assert='$i_assert'
22683 i_bsdioctl='$i_bsdioctl'
22684 i_crypt='$i_crypt'
22685 i_db='$i_db'
22686 i_dbm='$i_dbm'
22687 i_dirent='$i_dirent'
22688 i_dld='$i_dld'
22689 i_dlfcn='$i_dlfcn'
22690 i_fcntl='$i_fcntl'
22691 i_float='$i_float'
22692 i_fp='$i_fp'
22693 i_fp_class='$i_fp_class'
22694 i_gdbm='$i_gdbm'
22695 i_gdbm_ndbm='$i_gdbm_ndbm'
22696 i_gdbmndbm='$i_gdbmndbm'
22697 i_grp='$i_grp'
22698 i_ieeefp='$i_ieeefp'
22699 i_inttypes='$i_inttypes'
22700 i_langinfo='$i_langinfo'
22701 i_libutil='$i_libutil'
22702 i_limits='$i_limits'
22703 i_locale='$i_locale'
22704 i_machcthr='$i_machcthr'
22705 i_malloc='$i_malloc'
22706 i_mallocmalloc='$i_mallocmalloc'
22707 i_math='$i_math'
22708 i_memory='$i_memory'
22709 i_mntent='$i_mntent'
22710 i_ndbm='$i_ndbm'
22711 i_netdb='$i_netdb'
22712 i_neterrno='$i_neterrno'
22713 i_netinettcp='$i_netinettcp'
22714 i_niin='$i_niin'
22715 i_poll='$i_poll'
22716 i_prot='$i_prot'
22717 i_pthread='$i_pthread'
22718 i_pwd='$i_pwd'
22719 i_rpcsvcdbm='$i_rpcsvcdbm'
22720 i_sfio='$i_sfio'
22721 i_sgtty='$i_sgtty'
22722 i_shadow='$i_shadow'
22723 i_socks='$i_socks'
22724 i_stdarg='$i_stdarg'
22725 i_stddef='$i_stddef'
22726 i_stdlib='$i_stdlib'
22727 i_string='$i_string'
22728 i_sunmath='$i_sunmath'
22729 i_sysaccess='$i_sysaccess'
22730 i_sysdir='$i_sysdir'
22731 i_sysfile='$i_sysfile'
22732 i_sysfilio='$i_sysfilio'
22733 i_sysin='$i_sysin'
22734 i_sysioctl='$i_sysioctl'
22735 i_syslog='$i_syslog'
22736 i_sysmman='$i_sysmman'
22737 i_sysmode='$i_sysmode'
22738 i_sysmount='$i_sysmount'
22739 i_sysndir='$i_sysndir'
22740 i_sysparam='$i_sysparam'
22741 i_syspoll='$i_syspoll'
22742 i_sysresrc='$i_sysresrc'
22743 i_syssecrt='$i_syssecrt'
22744 i_sysselct='$i_sysselct'
22745 i_syssockio='$i_syssockio'
22746 i_sysstat='$i_sysstat'
22747 i_sysstatfs='$i_sysstatfs'
22748 i_sysstatvfs='$i_sysstatvfs'
22749 i_systime='$i_systime'
22750 i_systimek='$i_systimek'
22751 i_systimes='$i_systimes'
22752 i_systypes='$i_systypes'
22753 i_sysuio='$i_sysuio'
22754 i_sysun='$i_sysun'
22755 i_sysutsname='$i_sysutsname'
22756 i_sysvfs='$i_sysvfs'
22757 i_syswait='$i_syswait'
22758 i_termio='$i_termio'
22759 i_termios='$i_termios'
22760 i_time='$i_time'
22761 i_unistd='$i_unistd'
22762 i_ustat='$i_ustat'
22763 i_utime='$i_utime'
22764 i_values='$i_values'
22765 i_varargs='$i_varargs'
22766 i_varhdr='$i_varhdr'
22767 i_vfork='$i_vfork'
22768 ignore_versioned_solibs='$ignore_versioned_solibs'
22769 inc_version_list='$inc_version_list'
22770 inc_version_list_init='$inc_version_list_init'
22771 incpath='$incpath'
22772 inews='$inews'
22773 initialinstalllocation='$initialinstalllocation'
22774 installarchlib='$installarchlib'
22775 installbin='$installbin'
22776 installhtml1dir='$installhtml1dir'
22777 installhtml3dir='$installhtml3dir'
22778 installman1dir='$installman1dir'
22779 installman3dir='$installman3dir'
22780 installprefix='$installprefix'
22781 installprefixexp='$installprefixexp'
22782 installprivlib='$installprivlib'
22783 installscript='$installscript'
22784 installsitearch='$installsitearch'
22785 installsitebin='$installsitebin'
22786 installsitehtml1dir='$installsitehtml1dir'
22787 installsitehtml3dir='$installsitehtml3dir'
22788 installsitelib='$installsitelib'
22789 installsiteman1dir='$installsiteman1dir'
22790 installsiteman3dir='$installsiteman3dir'
22791 installsitescript='$installsitescript'
22792 installstyle='$installstyle'
22793 installusrbinperl='$installusrbinperl'
22794 installvendorarch='$installvendorarch'
22795 installvendorbin='$installvendorbin'
22796 installvendorhtml1dir='$installvendorhtml1dir'
22797 installvendorhtml3dir='$installvendorhtml3dir'
22798 installvendorlib='$installvendorlib'
22799 installvendorman1dir='$installvendorman1dir'
22800 installvendorman3dir='$installvendorman3dir'
22801 installvendorscript='$installvendorscript'
22802 intsize='$intsize'
22803 issymlink='$issymlink'
22804 ivdformat='$ivdformat'
22805 ivsize='$ivsize'
22806 ivtype='$ivtype'
22807 known_extensions='$known_extensions'
22808 ksh='$ksh'
22809 ld='$ld'
22810 lddlflags='$lddlflags'
22811 ldflags='$ldflags'
22812 ldflags_uselargefiles='$ldflags_uselargefiles'
22813 ldlibpthname='$ldlibpthname'
22814 less='$less'
22815 lib_ext='$lib_ext'
22816 libc='$libc'
22817 libperl='$libperl'
22818 libpth='$libpth'
22819 libs='$libs'
22820 libsdirs='$libsdirs'
22821 libsfiles='$libsfiles'
22822 libsfound='$libsfound'
22823 libspath='$libspath'
22824 libswanted='$libswanted'
22825 libswanted_uselargefiles='$libswanted_uselargefiles'
22826 line='$line'
22827 lint='$lint'
22828 lkflags='$lkflags'
22829 ln='$ln'
22830 lns='$lns'
22831 localtime_r_proto='$localtime_r_proto'
22832 locincpth='$locincpth'
22833 loclibpth='$loclibpth'
22834 longdblsize='$longdblsize'
22835 longlongsize='$longlongsize'
22836 longsize='$longsize'
22837 lp='$lp'
22838 lpr='$lpr'
22839 ls='$ls'
22840 lseeksize='$lseeksize'
22841 lseektype='$lseektype'
22842 mad='$mad'
22843 madlyh='$madlyh'
22844 madlyobj='$madlyobj'
22845 madlysrc='$madlysrc'
22846 mail='$mail'
22847 mailx='$mailx'
22848 make='$make'
22849 make_set_make='$make_set_make'
22850 mallocobj='$mallocobj'
22851 mallocsrc='$mallocsrc'
22852 malloctype='$malloctype'
22853 man1dir='$man1dir'
22854 man1direxp='$man1direxp'
22855 man1ext='$man1ext'
22856 man3dir='$man3dir'
22857 man3direxp='$man3direxp'
22858 man3ext='$man3ext'
22859 mips_type='$mips_type'
22860 mistrustnm='$mistrustnm'
22861 mkdir='$mkdir'
22862 mmaptype='$mmaptype'
22863 modetype='$modetype'
22864 more='$more'
22865 multiarch='$multiarch'
22866 mv='$mv'
22867 myarchname='$myarchname'
22868 mydomain='$mydomain'
22869 myhostname='$myhostname'
22870 myuname='$myuname'
22871 n='$n'
22872 need_va_copy='$need_va_copy'
22873 netdb_hlen_type='$netdb_hlen_type'
22874 netdb_host_type='$netdb_host_type'
22875 netdb_name_type='$netdb_name_type'
22876 netdb_net_type='$netdb_net_type'
22877 nm='$nm'
22878 nm_opt='$nm_opt'
22879 nm_so_opt='$nm_so_opt'
22880 nonxs_ext='$nonxs_ext'
22881 nroff='$nroff'
22882 nvEUformat='$nvEUformat'
22883 nvFUformat='$nvFUformat'
22884 nvGUformat='$nvGUformat'
22885 nv_overflows_integers_at='$nv_overflows_integers_at'
22886 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22887 nveformat='$nveformat'
22888 nvfformat='$nvfformat'
22889 nvgformat='$nvgformat'
22890 nvsize='$nvsize'
22891 nvtype='$nvtype'
22892 o_nonblock='$o_nonblock'
22893 obj_ext='$obj_ext'
22894 old_pthread_create_joinable='$old_pthread_create_joinable'
22895 optimize='$optimize'
22896 orderlib='$orderlib'
22897 osname='$osname'
22898 osvers='$osvers'
22899 otherlibdirs='$otherlibdirs'
22900 package='$package'
22901 pager='$pager'
22902 passcat='$passcat'
22903 patchlevel='$patchlevel'
22904 path_sep='$path_sep'
22905 perl5='$perl5'
22906 perl='$perl'
22907 perl_patchlevel='$perl_patchlevel'
22908 perladmin='$perladmin'
22909 perllibs='$perllibs'
22910 perlpath='$perlpath'
22911 pg='$pg'
22912 phostname='$phostname'
22913 pidtype='$pidtype'
22914 plibpth='$plibpth'
22915 pmake='$pmake'
22916 pr='$pr'
22917 prefix='$prefix'
22918 prefixexp='$prefixexp'
22919 privlib='$privlib'
22920 privlibexp='$privlibexp'
22921 procselfexe='$procselfexe'
22922 prototype='$prototype'
22923 ptrsize='$ptrsize'
22924 quadkind='$quadkind'
22925 quadtype='$quadtype'
22926 randbits='$randbits'
22927 randfunc='$randfunc'
22928 random_r_proto='$random_r_proto'
22929 randseedtype='$randseedtype'
22930 ranlib='$ranlib'
22931 rd_nodata='$rd_nodata'
22932 readdir64_r_proto='$readdir64_r_proto'
22933 readdir_r_proto='$readdir_r_proto'
22934 revision='$revision'
22935 rm='$rm'
22936 rm_try='$rm_try'
22937 rmail='$rmail'
22938 run='$run'
22939 runnm='$runnm'
22940 sGMTIME_max='$sGMTIME_max'
22941 sGMTIME_min='$sGMTIME_min'
22942 sLOCALTIME_max='$sLOCALTIME_max'
22943 sLOCALTIME_min='$sLOCALTIME_min'
22944 sPRIEUldbl='$sPRIEUldbl'
22945 sPRIFUldbl='$sPRIFUldbl'
22946 sPRIGUldbl='$sPRIGUldbl'
22947 sPRIXU64='$sPRIXU64'
22948 sPRId64='$sPRId64'
22949 sPRIeldbl='$sPRIeldbl'
22950 sPRIfldbl='$sPRIfldbl'
22951 sPRIgldbl='$sPRIgldbl'
22952 sPRIi64='$sPRIi64'
22953 sPRIo64='$sPRIo64'
22954 sPRIu64='$sPRIu64'
22955 sPRIx64='$sPRIx64'
22956 sSCNfldbl='$sSCNfldbl'
22957 sched_yield='$sched_yield'
22958 scriptdir='$scriptdir'
22959 scriptdirexp='$scriptdirexp'
22960 sed='$sed'
22961 seedfunc='$seedfunc'
22962 selectminbits='$selectminbits'
22963 selecttype='$selecttype'
22964 sendmail='$sendmail'
22965 setgrent_r_proto='$setgrent_r_proto'
22966 sethostent_r_proto='$sethostent_r_proto'
22967 setlocale_r_proto='$setlocale_r_proto'
22968 setnetent_r_proto='$setnetent_r_proto'
22969 setprotoent_r_proto='$setprotoent_r_proto'
22970 setpwent_r_proto='$setpwent_r_proto'
22971 setservent_r_proto='$setservent_r_proto'
22972 sh='$sh'
22973 shar='$shar'
22974 sharpbang='$sharpbang'
22975 shmattype='$shmattype'
22976 shortsize='$shortsize'
22977 shrpenv='$shrpenv'
22978 shsharp='$shsharp'
22979 sig_count='$sig_count'
22980 sig_name='$sig_name'
22981 sig_name_init='$sig_name_init'
22982 sig_num='$sig_num'
22983 sig_num_init='$sig_num_init'
22984 sig_size='$sig_size'
22985 signal_t='$signal_t'
22986 sitearch='$sitearch'
22987 sitearchexp='$sitearchexp'
22988 sitebin='$sitebin'
22989 sitebinexp='$sitebinexp'
22990 sitehtml1dir='$sitehtml1dir'
22991 sitehtml1direxp='$sitehtml1direxp'
22992 sitehtml3dir='$sitehtml3dir'
22993 sitehtml3direxp='$sitehtml3direxp'
22994 sitelib='$sitelib'
22995 sitelib_stem='$sitelib_stem'
22996 sitelibexp='$sitelibexp'
22997 siteman1dir='$siteman1dir'
22998 siteman1direxp='$siteman1direxp'
22999 siteman3dir='$siteman3dir'
23000 siteman3direxp='$siteman3direxp'
23001 siteprefix='$siteprefix'
23002 siteprefixexp='$siteprefixexp'
23003 sitescript='$sitescript'
23004 sitescriptexp='$sitescriptexp'
23005 sizesize='$sizesize'
23006 sizetype='$sizetype'
23007 sleep='$sleep'
23008 smail='$smail'
23009 so='$so'
23010 sockethdr='$sockethdr'
23011 socketlib='$socketlib'
23012 socksizetype='$socksizetype'
23013 sort='$sort'
23014 spackage='$spackage'
23015 spitshell='$spitshell'
23016 srand48_r_proto='$srand48_r_proto'
23017 srandom_r_proto='$srandom_r_proto'
23018 src='$src'
23019 ssizetype='$ssizetype'
23020 startperl='$startperl'
23021 startsh='$startsh'
23022 static_ext='$static_ext'
23023 stdchar='$stdchar'
23024 stdio_base='$stdio_base'
23025 stdio_bufsiz='$stdio_bufsiz'
23026 stdio_cnt='$stdio_cnt'
23027 stdio_filbuf='$stdio_filbuf'
23028 stdio_ptr='$stdio_ptr'
23029 stdio_stream_array='$stdio_stream_array'
23030 strerror_r_proto='$strerror_r_proto'
23031 strings='$strings'
23032 submit='$submit'
23033 subversion='$subversion'
23034 sysman='$sysman'
23035 tail='$tail'
23036 tar='$tar'
23037 targetarch='$targetarch'
23038 tbl='$tbl'
23039 tee='$tee'
23040 test='$test'
23041 timeincl='$timeincl'
23042 timetype='$timetype'
23043 tmpnam_r_proto='$tmpnam_r_proto'
23044 to='$to'
23045 touch='$touch'
23046 tr='$tr'
23047 trnl='$trnl'
23048 troff='$troff'
23049 ttyname_r_proto='$ttyname_r_proto'
23050 u16size='$u16size'
23051 u16type='$u16type'
23052 u32size='$u32size'
23053 u32type='$u32type'
23054 u64size='$u64size'
23055 u64type='$u64type'
23056 u8size='$u8size'
23057 u8type='$u8type'
23058 uidformat='$uidformat'
23059 uidsign='$uidsign'
23060 uidsize='$uidsize'
23061 uidtype='$uidtype'
23062 uname='$uname'
23063 uniq='$uniq'
23064 uquadtype='$uquadtype'
23065 use5005threads='$use5005threads'
23066 use64bitall='$use64bitall'
23067 use64bitint='$use64bitint'
23068 usecrosscompile='$usecrosscompile'
23069 usedevel='$usedevel'
23070 usedl='$usedl'
23071 usedtrace='$usedtrace'
23072 usefaststdio='$usefaststdio'
23073 useithreads='$useithreads'
23074 uselargefiles='$uselargefiles'
23075 uselongdouble='$uselongdouble'
23076 usemallocwrap='$usemallocwrap'
23077 usemorebits='$usemorebits'
23078 usemultiplicity='$usemultiplicity'
23079 usemymalloc='$usemymalloc'
23080 usenm='$usenm'
23081 useopcode='$useopcode'
23082 useperlio='$useperlio'
23083 useposix='$useposix'
23084 usereentrant='$usereentrant'
23085 userelocatableinc='$userelocatableinc'
23086 usesfio='$usesfio'
23087 useshrplib='$useshrplib'
23088 usesitecustomize='$usesitecustomize'
23089 usesocks='$usesocks'
23090 usethreads='$usethreads'
23091 usevendorprefix='$usevendorprefix'
23092 usevfork='$usevfork'
23093 usrinc='$usrinc'
23094 uuname='$uuname'
23095 uvXUformat='$uvXUformat'
23096 uvoformat='$uvoformat'
23097 uvsize='$uvsize'
23098 uvtype='$uvtype'
23099 uvuformat='$uvuformat'
23100 uvxformat='$uvxformat'
23101 vendorarch='$vendorarch'
23102 vendorarchexp='$vendorarchexp'
23103 vendorbin='$vendorbin'
23104 vendorbinexp='$vendorbinexp'
23105 vendorhtml1dir='$vendorhtml1dir'
23106 vendorhtml1direxp='$vendorhtml1direxp'
23107 vendorhtml3dir='$vendorhtml3dir'
23108 vendorhtml3direxp='$vendorhtml3direxp'
23109 vendorlib='$vendorlib'
23110 vendorlib_stem='$vendorlib_stem'
23111 vendorlibexp='$vendorlibexp'
23112 vendorman1dir='$vendorman1dir'
23113 vendorman1direxp='$vendorman1direxp'
23114 vendorman3dir='$vendorman3dir'
23115 vendorman3direxp='$vendorman3direxp'
23116 vendorprefix='$vendorprefix'
23117 vendorprefixexp='$vendorprefixexp'
23118 vendorscript='$vendorscript'
23119 vendorscriptexp='$vendorscriptexp'
23120 version='$version'
23121 version_patchlevel_string='$version_patchlevel_string'
23122 versiononly='$versiononly'
23123 vi='$vi'
23124 voidflags='$voidflags'
23125 xlibpth='$xlibpth'
23126 yacc='$yacc'
23127 yaccflags='$yaccflags'
23128 zcat='$zcat'
23129 zip='$zip'
23130 EOT
23131
23132 : Add in command line options if available
23133 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23134
23135 : add special variables
23136 $test -f $src/patchlevel.h && \
23137 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23138 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
23139 echo "PERL_CONFIG_SH=true" >>config.sh
23140
23141 : propagate old symbols
23142 if $test -f UU/config.sh; then
23143         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23144         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23145                 config.sh config.sh UU/oldconfig.sh |\
23146                 $sort | $uniq -u >UU/oldsyms
23147         set X `cat UU/oldsyms`
23148         shift
23149         case $# in
23150         0) ;;
23151         *)
23152                 cat <<EOM
23153 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23154 EOM
23155                 echo ": Variables propagated from previous config.sh file." >>config.sh
23156                 for sym in `cat UU/oldsyms`; do
23157                         echo "    Propagating $hint variable "'$'"$sym..."
23158                         eval 'tmp="$'"${sym}"'"'
23159                         echo "$tmp" | \
23160                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23161                 done
23162                 ;;
23163         esac
23164 fi
23165
23166 : Finish up by extracting the .SH files
23167 case "$alldone" in
23168 exit)
23169         $rm -rf UU
23170         echo "Extraction done."
23171         exit 0
23172         ;;
23173 cont)
23174         ;;
23175 '')
23176         dflt=''
23177         nostick=true
23178         $cat <<EOM
23179
23180 If you'd like to make any changes to the config.sh file before I begin
23181 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23182
23183 EOM
23184         rp="Press return or use a shell escape to edit config.sh:"
23185         . UU/myread
23186         nostick=''
23187         case "$ans" in
23188         '') ;;
23189         *) : in case they cannot read
23190                 sh 1>&4 -c "$ans";;
23191         esac
23192         ;;
23193 esac
23194
23195 : if this fails, just run all the .SH files by hand
23196 . ./config.sh
23197
23198 echo " "
23199 exec 1>&4
23200 pwd=`pwd`
23201 . ./UU/extract
23202 cd "$pwd"
23203
23204 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23205         dflt=y
23206         case "$silent" in
23207         true) ;;
23208         *)
23209                 $cat <<EOM
23210
23211 Now you need to generate make dependencies by running "$make depend".
23212 You might prefer to run it in background: "$make depend > makedepend.out &"
23213 It can take a while, so you might not want to run it right now.
23214
23215 EOM
23216                 ;;
23217         esac
23218         rp="Run $make depend now?"
23219         . UU/myread
23220         case "$ans" in
23221         y*)
23222                 $make depend && echo "Now you must run '$make'."
23223                 ;;
23224         *)
23225                 echo "You must run '$make depend' then '$make'."
23226                 ;;
23227         esac
23228 elif test -f [Mm]akefile; then
23229         echo " "
23230         echo "Now you must run a $make."
23231 else
23232         echo "Configure done."
23233 fi
23234
23235 if $test -f Policy.sh; then
23236     $cat <<EOM
23237
23238 If you compile $package on a different machine or from a different object
23239 directory, copy the Policy.sh file from this object directory to the
23240 new one before you run Configure -- this will help you with most of
23241 the policy defaults.
23242
23243 EOM
23244 fi
23245 if $test -f config.msg; then
23246     echo "Hmm.  I also noted the following information while running:"
23247     echo " "
23248     $cat config.msg >&4
23249     $rm -f config.msg
23250 fi
23251 $rm -f kit*isdone ark*isdone
23252 $rm -rf UU
23253
23254 : End of Configure
23255