checkcfgvar.pl should also check Porting/config.sh "just in case".
[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 Tue Jan 22 17:46:32 CET 2008 [metaconfig 3.0 PL70]
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 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 rm_try=''
320 afs=''
321 afsroot=''
322 alignbytes=''
323 ansi2knr=''
324 archlib=''
325 archlibexp=''
326 d_archlib=''
327 installarchlib=''
328 archname=''
329 myarchname=''
330 d_atolf=''
331 d_atoll=''
332 baserev=''
333 bin=''
334 binexp=''
335 initialinstalllocation=''
336 installbin=''
337 userelocatableinc=''
338 byteorder=''
339 cc=''
340 ccflags=''
341 cppflags=''
342 ldflags=''
343 lkflags=''
344 locincpth=''
345 optimize=''
346 cf_email=''
347 cf_by=''
348 cf_time=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 clocktype=''
781 d_times=''
782 d_tmpnam_r=''
783 tmpnam_r_proto=''
784 d_truncate=''
785 d_ttyname_r=''
786 ttyname_r_proto=''
787 d_tzname=''
788 d_u32align=''
789 d_ualarm=''
790 d_umask=''
791 d_semctl_semid_ds=''
792 d_semctl_semun=''
793 d_union_semun=''
794 d_unordered=''
795 d_unsetenv=''
796 d_usleep=''
797 d_usleepproto=''
798 d_ustat=''
799 d_pseudofork=''
800 d_vfork=''
801 usevfork=''
802 d_voidsig=''
803 signal_t=''
804 d_volatile=''
805 d_charvspr=''
806 d_vprintf=''
807 d_wait4=''
808 d_waitpid=''
809 d_wcstombs=''
810 d_wctomb=''
811 d_writev=''
812 dlext=''
813 cccdlflags=''
814 ccdlflags=''
815 dlsrc=''
816 ld=''
817 lddlflags=''
818 usedl=''
819 doublesize=''
820 ebcdic=''
821 fflushNULL=''
822 fflushall=''
823 fpossize=''
824 fpostype=''
825 gccansipedantic=''
826 gccosandvers=''
827 gccversion=''
828 gidformat=''
829 gidsign=''
830 gidsize=''
831 gidtype=''
832 groupstype=''
833 h_fcntl=''
834 h_sysfile=''
835 html1dir=''
836 html1direxp=''
837 installhtml1dir=''
838 html3dir=''
839 html3direxp=''
840 installhtml3dir=''
841 i_arpainet=''
842 i_assert=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_sysresrc=''
916 i_syssecrt=''
917 i_sysselct=''
918 i_sysstat=''
919 i_sysstatfs=''
920 i_sysstatvfs=''
921 i_systimes=''
922 i_systypes=''
923 i_sysuio=''
924 i_sysun=''
925 i_sysutsname=''
926 i_sysvfs=''
927 i_syswait=''
928 i_sgtty=''
929 i_termio=''
930 i_termios=''
931 d_tm_tm_gmtoff=''
932 d_tm_tm_zone=''
933 i_systime=''
934 i_systimek=''
935 i_time=''
936 timeincl=''
937 i_unistd=''
938 i_ustat=''
939 i_utime=''
940 i_values=''
941 i_stdarg=''
942 i_varargs=''
943 i_varhdr=''
944 i_vfork=''
945 d_inc_version_list=''
946 inc_version_list=''
947 inc_version_list_init=''
948 installprefix=''
949 installprefixexp=''
950 installstyle=''
951 installusrbinperl=''
952 intsize=''
953 longsize=''
954 shortsize=''
955 issymlink=''
956 libc=''
957 ldlibpthname=''
958 libperl=''
959 shrpenv=''
960 useshrplib=''
961 glibpth=''
962 libpth=''
963 loclibpth=''
964 plibpth=''
965 xlibpth=''
966 ignore_versioned_solibs=''
967 libs=''
968 libsdirs=''
969 libsfiles=''
970 libsfound=''
971 libspath=''
972 lns=''
973 d_PRIEUldbl=''
974 d_PRIFUldbl=''
975 d_PRIGUldbl=''
976 d_PRIeldbl=''
977 d_PRIfldbl=''
978 d_PRIgldbl=''
979 d_SCNfldbl=''
980 sPRIEUldbl=''
981 sPRIFUldbl=''
982 sPRIGUldbl=''
983 sPRIeldbl=''
984 sPRIfldbl=''
985 sPRIgldbl=''
986 sSCNfldbl=''
987 lseeksize=''
988 lseektype=''
989 mad=''
990 madlyh=''
991 madlyobj=''
992 madlysrc=''
993 make_set_make=''
994 d_mymalloc=''
995 freetype=''
996 mallocobj=''
997 mallocsrc=''
998 malloctype=''
999 usemallocwrap=''
1000 usemymalloc=''
1001 installman1dir=''
1002 man1dir=''
1003 man1direxp=''
1004 man1ext=''
1005 installman3dir=''
1006 man3dir=''
1007 man3direxp=''
1008 man3ext=''
1009 modetype=''
1010 multiarch=''
1011 mydomain=''
1012 myhostname=''
1013 phostname=''
1014 c=''
1015 n=''
1016 d_eofnblk=''
1017 eagain=''
1018 o_nonblock=''
1019 rd_nodata=''
1020 need_va_copy=''
1021 netdb_hlen_type=''
1022 netdb_host_type=''
1023 netdb_name_type=''
1024 netdb_net_type=''
1025 groupcat=''
1026 hostcat=''
1027 passcat=''
1028 orderlib=''
1029 ranlib=''
1030 d_perl_otherlibdirs=''
1031 otherlibdirs=''
1032 package=''
1033 spackage=''
1034 pager=''
1035 api_revision=''
1036 api_subversion=''
1037 api_version=''
1038 api_versionstring=''
1039 patchlevel=''
1040 perl_patchlevel=''
1041 revision=''
1042 subversion=''
1043 version=''
1044 version_patchlevel_string=''
1045 perl5=''
1046 perladmin=''
1047 perlpath=''
1048 d_nv_preserves_uv=''
1049 d_nv_zero_is_allbits_zero=''
1050 i16size=''
1051 i16type=''
1052 i32size=''
1053 i32type=''
1054 i64size=''
1055 i64type=''
1056 i8size=''
1057 i8type=''
1058 ivsize=''
1059 ivtype=''
1060 nv_preserves_uv_bits=''
1061 nvsize=''
1062 nvtype=''
1063 u16size=''
1064 u16type=''
1065 u32size=''
1066 u32type=''
1067 u64size=''
1068 u64type=''
1069 u8size=''
1070 u8type=''
1071 uvsize=''
1072 uvtype=''
1073 ivdformat=''
1074 nvEUformat=''
1075 nvFUformat=''
1076 nvGUformat=''
1077 nveformat=''
1078 nvfformat=''
1079 nvgformat=''
1080 uvXUformat=''
1081 uvoformat=''
1082 uvuformat=''
1083 uvxformat=''
1084 pidtype=''
1085 prefix=''
1086 prefixexp=''
1087 installprivlib=''
1088 privlib=''
1089 privlibexp=''
1090 prototype=''
1091 ptrsize=''
1092 d_PRIXU64=''
1093 d_PRId64=''
1094 d_PRIi64=''
1095 d_PRIo64=''
1096 d_PRIu64=''
1097 d_PRIx64=''
1098 sPRIXU64=''
1099 sPRId64=''
1100 sPRIi64=''
1101 sPRIo64=''
1102 sPRIu64=''
1103 sPRIx64=''
1104 d_quad=''
1105 quadkind=''
1106 quadtype=''
1107 uquadtype=''
1108 drand01=''
1109 randbits=''
1110 randfunc=''
1111 randseedtype=''
1112 seedfunc=''
1113 installscript=''
1114 scriptdir=''
1115 scriptdirexp=''
1116 selectminbits=''
1117 selecttype=''
1118 sh=''
1119 sig_count=''
1120 sig_name=''
1121 sig_name_init=''
1122 sig_num=''
1123 sig_num_init=''
1124 sig_size=''
1125 d_sitearch=''
1126 installsitearch=''
1127 sitearch=''
1128 sitearchexp=''
1129 installsitebin=''
1130 sitebin=''
1131 sitebinexp=''
1132 installsitehtml1dir=''
1133 sitehtml1dir=''
1134 sitehtml1direxp=''
1135 installsitehtml3dir=''
1136 sitehtml3dir=''
1137 sitehtml3direxp=''
1138 installsitelib=''
1139 sitelib=''
1140 sitelib_stem=''
1141 sitelibexp=''
1142 installsiteman1dir=''
1143 siteman1dir=''
1144 siteman1direxp=''
1145 installsiteman3dir=''
1146 siteman3dir=''
1147 siteman3direxp=''
1148 siteprefix=''
1149 siteprefixexp=''
1150 installsitescript=''
1151 sitescript=''
1152 sitescriptexp=''
1153 sizesize=''
1154 sizetype=''
1155 so=''
1156 socksizetype=''
1157 sharpbang=''
1158 shsharp=''
1159 spitshell=''
1160 src=''
1161 ssizetype=''
1162 startperl=''
1163 startsh=''
1164 stdchar=''
1165 d_stdio_stream_array=''
1166 stdio_stream_array=''
1167 sysman=''
1168 trnl=''
1169 uidformat=''
1170 uidsign=''
1171 uidsize=''
1172 uidtype=''
1173 archname64=''
1174 use64bitall=''
1175 use64bitint=''
1176 dtrace=''
1177 usedtrace=''
1178 usefaststdio=''
1179 ccflags_uselargefiles=''
1180 ldflags_uselargefiles=''
1181 libswanted_uselargefiles=''
1182 uselargefiles=''
1183 uselongdouble=''
1184 usemorebits=''
1185 usemultiplicity=''
1186 nm_opt=''
1187 nm_so_opt=''
1188 runnm=''
1189 usenm=''
1190 useperlio=''
1191 usesocks=''
1192 d_oldpthreads=''
1193 use5005threads=''
1194 useithreads=''
1195 usereentrant=''
1196 usethreads=''
1197 incpath=''
1198 mips_type=''
1199 usrinc=''
1200 d_vendorarch=''
1201 installvendorarch=''
1202 vendorarch=''
1203 vendorarchexp=''
1204 d_vendorbin=''
1205 installvendorbin=''
1206 vendorbin=''
1207 vendorbinexp=''
1208 installvendorhtml1dir=''
1209 vendorhtml1dir=''
1210 vendorhtml1direxp=''
1211 installvendorhtml3dir=''
1212 vendorhtml3dir=''
1213 vendorhtml3direxp=''
1214 d_vendorlib=''
1215 installvendorlib=''
1216 vendorlib=''
1217 vendorlib_stem=''
1218 vendorlibexp=''
1219 installvendorman1dir=''
1220 vendorman1dir=''
1221 vendorman1direxp=''
1222 installvendorman3dir=''
1223 vendorman3dir=''
1224 vendorman3direxp=''
1225 usevendorprefix=''
1226 vendorprefix=''
1227 vendorprefixexp=''
1228 d_vendorscript=''
1229 installvendorscript=''
1230 vendorscript=''
1231 vendorscriptexp=''
1232 versiononly=''
1233 defvoidused=''
1234 voidflags=''
1235 yacc=''
1236 yaccflags=''
1237 CONFIG=''
1238
1239 : Detect odd OSs
1240 define='define'
1241 undef='undef'
1242 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1243 rmlist=''
1244
1245 : We must find out about Eunice early
1246 eunicefix=':'
1247 if test -f /etc/unixtovms; then
1248         eunicefix=/etc/unixtovms
1249 fi
1250 if test -f /etc/unixtovms.exe; then
1251         eunicefix=/etc/unixtovms.exe
1252 fi
1253
1254 : Set executable suffix now -- needed before hints available
1255 if test -f "/libs/version.library"; then
1256 : Amiga OS
1257     _exe=""
1258 elif test -f "/system/gnu_library/bin/ar.pm"; then
1259 : Stratus VOS
1260     _exe=".pm"
1261 elif test -n "$DJGPP"; then
1262 : DOS DJGPP
1263     _exe=".exe"
1264 elif test -d c:/. -o -n "$is_os2" ; then
1265 : OS/2 or cygwin
1266     _exe=".exe"
1267 fi
1268
1269 i_whoami=''
1270 : Trailing extension.  Override this in a hint file, if needed.
1271 : Extra object files, if any, needed on this platform.
1272 archobjs=''
1273 archname=''
1274 groupstype=''
1275 libnames=''
1276 : change the next line if compiling for Xenix/286 on Xenix/386
1277 xlibpth='/usr/lib/386 /lib/386'
1278 : Possible local library directories to search.
1279 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1280 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1281
1282 : general looking path for locating libraries
1283 glibpth="/lib /usr/lib $xlibpth"
1284 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1285 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1286 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1287 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1288
1289 : Private path used by Configure to find libraries.  Its value
1290 : is prepended to libpth. This variable takes care of special
1291 : machines, like the mips.  Usually, it should be empty.
1292 plibpth=''
1293
1294 : default library list
1295 libswanted=''
1296 : some systems want to use only the non-versioned libso:s
1297 ignore_versioned_solibs=''
1298 : set usethreads on the Configure command line to enable threads.
1299 usereentrant='undef'
1300 : full support for void wanted by default
1301 defvoidused=15
1302
1303 : Possible local include directories to search.
1304 : Set locincpth to "" in a hint file to defeat local include searches.
1305 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307 :
1308 : no include file wanted by default
1309 inclwanted=''
1310
1311 : Enable -DEBUGGING and -DDEBUGGING from the command line
1312 EBUGGING=''
1313 DEBUGGING=old
1314
1315 ccname=''
1316 ccversion=''
1317 perllibs=''
1318 : set useposix=false in your hint file to disable the POSIX extension.
1319 useposix=true
1320 : set useopcode=false in your hint file to disable the Opcode extension.
1321 useopcode=true
1322 archname64=''
1323 ccflags_uselargefiles=''
1324 ldflags_uselargefiles=''
1325 libswanted_uselargefiles=''
1326 : set usemultiplicity on the Configure command line to enable multiplicity.
1327 : set usesocks on the Configure command line to enable socks.
1328 : List of libraries we want.
1329 : If anyone needs extra -lxxx, put those in a hint file.
1330 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1332 : We probably want to search /usr/shlib before most other libraries.
1333 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1334 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335 glibpth="/usr/shlib $glibpth"
1336 : Do not use vfork unless overridden by a hint file.
1337 usevfork=false
1338
1339 : Find the basic shell for Bourne shell scripts
1340 case "$sh" in
1341 '')
1342         case "$SYSTYPE" in
1343         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344         *) xxx='/bin/sh';;
1345         esac
1346         if test -f "$xxx"; then
1347                 sh="$xxx"
1348         else
1349                 : Build up a list and do a single loop so we can 'break' out.
1350                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351                 for xxx in sh bash ksh pdksh ash; do
1352                         for p in $pth; do
1353                                 try="$try ${p}/${xxx}"
1354                         done
1355                 done
1356                 for xxx in $try; do
1357                         if test -f "$xxx"; then
1358                                 sh="$xxx";
1359                                 break
1360                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test -f "$xxx.exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         fi
1367                 done
1368         fi
1369         ;;
1370 esac
1371
1372 case "$sh" in
1373 '')     cat >&2 <<EOM
1374 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1375
1376 Usually it's in /bin/sh.  How did you even get this far?
1377 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1378 we'll try to straighten this all out.
1379 EOM
1380         exit 1
1381         ;;
1382 esac
1383
1384 : see if sh knows # comments
1385 if `$sh -c '#' >/dev/null 2>&1`; then
1386         shsharp=true
1387         spitshell=cat
1388         xcat=/bin/cat
1389         test -f $xcat$_exe || xcat=/usr/bin/cat
1390         if test ! -f $xcat$_exe; then
1391                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1392                         if test -f $p/cat$_exe; then
1393                                 xcat=$p/cat
1394                                 break
1395                         fi
1396                 done
1397                 if test ! -f $xcat$_exe; then
1398                         echo "Can't find cat anywhere!"
1399                         exit 1
1400                 fi
1401         fi
1402         echo "#!$xcat" >sharp
1403         $eunicefix sharp
1404         chmod +x sharp
1405         ./sharp > today
1406         if test -s today; then
1407                 sharpbang='#!'
1408         else
1409                 echo "#! $xcat" > sharp
1410                 $eunicefix sharp
1411                 chmod +x sharp
1412                 ./sharp > today
1413                 if test -s today; then
1414                         sharpbang='#! '
1415                 else
1416                         sharpbang=': use '
1417                 fi
1418         fi
1419 else
1420         echo " "
1421         echo "Your $sh doesn't grok # comments--I will strip them later on."
1422         shsharp=false
1423         cd ..
1424         echo "exec grep -v '^[  ]*#'" >spitshell
1425         chmod +x spitshell
1426         $eunicefix spitshell
1427         spitshell=`pwd`/spitshell
1428         cd UU
1429         echo "I presume that if # doesn't work, #! won't work either!"
1430         sharpbang=': use '
1431 fi
1432 rm -f sharp today
1433
1434 : figure out how to guarantee sh startup
1435 case "$startsh" in
1436 '') startsh=${sharpbang}${sh} ;;
1437 *)
1438 esac
1439 cat >sharp <<EOSS
1440 $startsh
1441 set abc
1442 test "$?abc" != 1
1443 EOSS
1444
1445 chmod +x sharp
1446 $eunicefix sharp
1447 if ./sharp; then
1448         : echo "Yup, it does."
1449 else
1450         echo "Hmm... '$startsh' does not guarantee sh startup..."
1451         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1452 fi
1453 rm -f sharp
1454
1455 : Save command line options in file UU/cmdline.opt for later use in
1456 : generating config.sh.
1457 cat > cmdline.opt <<EOSH
1458 : Configure command line arguments.
1459 config_arg0='$0'
1460 config_args='$*'
1461 config_argc=$#
1462 EOSH
1463 argn=1
1464 args_exp=''
1465 args_sep=''
1466 for arg in "$@"; do
1467         cat >>cmdline.opt <<EOSH
1468 config_arg$argn='$arg'
1469 EOSH
1470         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1471 $arg
1472 EOC
1473         arg_exp=`cat cmdl.opt`
1474         args_exp="$args_exp$args_sep'$arg_exp'"
1475         argn=`expr $argn + 1`
1476         args_sep=' '
1477 done
1478 rm -f cmdl.opt
1479
1480 : produce awk script to parse command line options
1481 cat >options.awk <<'EOF'
1482 BEGIN {
1483         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1484
1485         len = length(optstr);
1486         for (i = 1; i <= len; i++) {
1487                 c = substr(optstr, i, 1);
1488                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1489                 if (a == ":") {
1490                         arg[c] = 1;
1491                         i++;
1492                 }
1493                 opt[c] = 1;
1494         }
1495 }
1496 {
1497         expect = 0;
1498         str = $0;
1499         if (substr(str, 1, 1) != "-") {
1500                 printf("'%s'\n", str);
1501                 next;
1502         }
1503         len = length($0);
1504         for (i = 2; i <= len; i++) {
1505                 c = substr(str, i, 1);
1506                 if (!opt[c]) {
1507                         printf("-%s\n", substr(str, i));
1508                         next;
1509                 }
1510                 printf("-%s\n", c);
1511                 if (arg[c]) {
1512                         if (i < len)
1513                                 printf("'%s'\n", substr(str, i + 1));
1514                         else
1515                                 expect = 1;
1516                         next;
1517                 }
1518         }
1519 }
1520 END {
1521         if (expect)
1522                 print "?";
1523 }
1524 EOF
1525
1526 : process the command line options
1527 set X `for arg in "$@"; do echo "X$arg"; done |
1528         sed -e s/X// | awk -f options.awk`
1529 eval "set $*"
1530 shift
1531 rm -f options.awk
1532
1533 : set up default values
1534 fastread=''
1535 reuseval=false
1536 config_sh=''
1537 alldone=''
1538 error=''
1539 silent=''
1540 extractsh=''
1541 override=''
1542 knowitall=''
1543 rm -f optdef.sh posthint.sh
1544 cat >optdef.sh <<EOS
1545 $startsh
1546 EOS
1547
1548
1549 : option parsing
1550 while test $# -gt 0; do
1551         case "$1" in
1552         -d) shift; fastread=yes;;
1553         -e) shift; alldone=cont;;
1554         -f)
1555                 shift
1556                 cd ..
1557                 if test -r "$1"; then
1558                         config_sh="$1"
1559                 else
1560                         echo "$me: cannot read config file $1." >&2
1561                         error=true
1562                 fi
1563                 cd UU
1564                 shift;;
1565         --help|\
1566         -h) shift; error=true;;
1567         -r) shift; reuseval=true;;
1568         -s) shift; silent=true; realsilent=true;;
1569         -E) shift; alldone=exit;;
1570         -K) shift; knowitall=true;;
1571         -O) shift; override=true;;
1572         -S) shift; silent=true; extractsh=true;;
1573         -D)
1574                 shift
1575                 case "$1" in
1576                 *=)
1577                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1578                         echo "$me: ignoring -D $1" >&2
1579                         ;;
1580                 *=*) echo "$1" | \
1581                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1582                 *) echo "$1='define'" >> optdef.sh;;
1583                 esac
1584                 shift
1585                 ;;
1586         -U)
1587                 shift
1588                 case "$1" in
1589                 *=) echo "$1" >> optdef.sh;;
1590                 *=*)
1591                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1592                         echo "$me: ignoring -U $1" >&2
1593                         ;;
1594                 *) echo "$1='undef'" >> optdef.sh;;
1595                 esac
1596                 shift
1597                 ;;
1598         -A)
1599             shift
1600             xxx=''
1601             yyy="$1"
1602             zzz=''
1603             uuu=undef
1604             case "$yyy" in
1605             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1606                  case "$zzz" in
1607                  *:*) zzz='' ;;
1608                  *)   xxx=append
1609                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1610                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1611                  esac
1612                  ;;
1613             esac
1614             case "$xxx" in
1615             '')  case "$yyy" in
1616                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1617                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1618                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1619                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1620                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1622                  esac
1623                  ;;
1624             esac
1625             case "$xxx" in
1626             append)
1627                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1628             clear)
1629                 echo "$yyy=''"                  >> posthint.sh ;;
1630             define)
1631                 case "$zzz" in
1632                 '') zzz=define ;;
1633                 esac
1634                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1635             eval)
1636                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1637             prepend)
1638                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1639             undef)
1640                 case "$zzz" in
1641                 '') zzz="$uuu" ;;
1642                 esac
1643                 echo "$yyy=$zzz"                >> posthint.sh ;;
1644             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1645             esac
1646             shift
1647             ;;
1648         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1649             exit 0;;
1650         --) break;;
1651         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1652         *) break;;
1653         esac
1654 done
1655
1656 case "$error" in
1657 true)
1658         cat >&2 <<EOM
1659 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1660                  [-U symbol] [-U symbol=] [-A command:symbol...]
1661   -d : use defaults for all answers.
1662   -e : go on without questioning past the production of config.sh.
1663   -f : specify an alternate default configuration file.
1664   -h : print this help message and exit (with an error status).
1665   -r : reuse C symbols value if possible (skips costly nm extraction).
1666   -s : silent mode, only echoes questions and essential information.
1667   -D : define symbol to have some value:
1668          -D symbol         symbol gets the value 'define'
1669          -D symbol=value   symbol gets the value 'value'
1670        common used examples (see INSTALL for more info):
1671          -Duse64bitint            use 64bit integers
1672          -Duse64bitall            use 64bit integers and pointers
1673          -Dusethreads             use thread support
1674          -Dinc_version_list=none  do not include older perl trees in @INC
1675          -DEBUGGING=none          DEBUGGING options
1676          -Dcc=gcc                 choose your compiler
1677          -Dprefix=/opt/perl5      choose your destination
1678   -E : stop at the end of questions, after having produced config.sh.
1679   -K : do not use unless you know what you are doing.
1680   -O : let -D and -U override definitions from loaded configuration file.
1681   -S : perform variable substitutions on all .SH files (can mix with -f)
1682   -U : undefine symbol:
1683          -U symbol    symbol gets the value 'undef'
1684          -U symbol=   symbol gets completely empty
1685        e.g.:  -Uversiononly
1686   -A : manipulate symbol after the platform specific hints have been applied:
1687          -A append:symbol=value   append value to symbol
1688          -A symbol=value          like append:, but with a separating space
1689          -A define:symbol=value   define symbol to have value
1690          -A clear:symbol          define symbol to be ''
1691          -A define:symbol         define symbol to be 'define'
1692          -A eval:symbol=value     define symbol to be eval of value
1693          -A prepend:symbol=value  prepend value to symbol
1694          -A undef:symbol          define symbol to be 'undef'
1695          -A undef:symbol=         define symbol to be ''
1696        e.g.:  -A prepend:libswanted='cl pthread '
1697               -A ccflags=-DSOME_MACRO
1698   -V : print version number and exit (with a zero status).
1699 EOM
1700         exit 1
1701         ;;
1702 esac
1703
1704 : Sanity checks
1705 case "$fastread$alldone" in
1706 yescont|yesexit) ;;
1707 *)
1708         case "$extractsh" in
1709         true) ;;
1710         *)
1711                 if test ! -t 0; then
1712                         echo "Say 'sh Configure', not 'sh <Configure'"
1713                         exit 1
1714                 fi
1715                 ;;
1716         esac
1717         ;;
1718 esac
1719
1720 exec 4>&1
1721 case "$silent" in
1722 true) exec 1>/dev/null;;
1723 esac
1724
1725 : run the defines and the undefines, if any, but leave the file out there...
1726 touch optdef.sh
1727 . ./optdef.sh
1728 : create the posthint manipulation script and leave the file out there...
1729 touch posthint.sh
1730
1731 : set package name
1732 package='perl5'
1733 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1734 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1735 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1736 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1737 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1738 esac
1739
1740 : Some greps do not return status, grrr.
1741 echo "grimblepritz" >grimble
1742 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1743         contains=contains
1744 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1745         contains=grep
1746 else
1747         contains=contains
1748 fi
1749 rm -f grimble
1750 : the following should work in any shell
1751 case "$contains" in
1752 contains*)
1753         echo " "
1754         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1755         cat >contains <<'EOSS'
1756 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1757 EOSS
1758 chmod +x contains
1759 esac
1760
1761 : Find the path to the source tree
1762 case "$src" in
1763 '') case "$0" in
1764     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1765          case "$src" in
1766          /*)    ;;
1767          .)     ;;
1768          *)     src=`cd ../$src && pwd` ;;
1769          esac
1770          ;;
1771     *)   src='.';;
1772     esac;;
1773 esac
1774 case "$src" in
1775 '')     src=/
1776         rsrc=/
1777         ;;
1778 /*)     rsrc="$src";;
1779 *)      rsrc="../$src";;
1780 esac
1781 if test -f $rsrc/Configure && \
1782         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1783 then
1784    : found it, so we are ok.
1785 else
1786         rsrc=''
1787         for src in . .. ../.. ../../.. ../../../..; do
1788                 if test -f ../$src/Configure && \
1789                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1790                 then
1791                         rsrc=../$src
1792                         break
1793                 fi
1794         done
1795 fi
1796 case "$rsrc" in
1797 '')
1798         cat <<EOM >&4
1799
1800 Sorry, I can't seem to locate the source dir for $package.  Please start
1801 Configure with an explicit path -- i.e. /some/path/Configure.
1802
1803 EOM
1804         exit 1
1805         ;;
1806 ../.)   rsrc='..';;
1807 *)
1808         echo " "
1809         echo "Sources for $package found in \"$src\"." >&4
1810         ;;
1811 esac
1812
1813 : script used to extract .SH files with variable substitutions
1814 cat >extract <<'EOS'
1815 PERL_CONFIG_SH=true
1816 echo "Doing variable substitutions on .SH files..."
1817 if test -f MANIFEST; then
1818         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1819 else
1820         echo "(Looking for .SH files under the source directory.)"
1821         set x `(cd "$src"; find . -name "*.SH" -print)`
1822 fi
1823 shift
1824 case $# in
1825 0) set x `(cd "$src"; echo *.SH)`; shift;;
1826 esac
1827 if test ! -f "$src/$1"; then
1828         shift
1829 fi
1830 mkdir_p='
1831 name=$1;
1832 create="";
1833 while test $name; do
1834         if test ! -d "$name"; then
1835                 create="$name $create";
1836                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1837                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1838         else
1839                 name="";
1840         fi;
1841 done;
1842 for file in $create; do
1843         mkdir $file;
1844 done
1845 '
1846 for file in $*; do
1847         case "$src" in
1848         ".")
1849                 case "$file" in
1850                 */*)
1851                         dir=`expr X$file : 'X\(.*\)/'`
1852                         file=`expr X$file : 'X.*/\(.*\)'`
1853                         (cd "$dir" && . ./$file)
1854                         ;;
1855                 *)
1856                         . ./$file
1857                         ;;
1858                 esac
1859                 ;;
1860         *)
1861                 case "$file" in
1862                 */*)
1863                         dir=`expr X$file : 'X\(.*\)/'`
1864                         file=`expr X$file : 'X.*/\(.*\)'`
1865                         (set x $dir; shift; eval $mkdir_p)
1866                         sh <"$src/$dir/$file"
1867                         ;;
1868                 *)
1869                         sh <"$src/$file"
1870                         ;;
1871                 esac
1872                 ;;
1873         esac
1874 done
1875 if test -f "$src/config_h.SH"; then
1876         if test ! -f config.h; then
1877         : oops, they left it out of MANIFEST, probably, so do it anyway.
1878         . "$src/config_h.SH"
1879         fi
1880 fi
1881 EOS
1882
1883 : extract files and exit if asked to do so
1884 case "$extractsh" in
1885 true)
1886         case "$realsilent" in
1887         true) ;;
1888         *) exec 1>&4;;
1889         esac
1890         case "$config_sh" in
1891         '') config_sh='config.sh';;
1892         esac
1893         echo " "
1894         echo "Fetching answers from $config_sh..."
1895         cd ..
1896         . $config_sh
1897         test "$override" && . ./optdef.sh
1898         echo " "
1899         . UU/extract
1900         rm -rf UU
1901         echo "Extraction done."
1902         exit 0
1903         ;;
1904 esac
1905
1906 : Eunice requires " " instead of "", can you believe it
1907 echo " "
1908 : Here we go...
1909 echo "Beginning of configuration questions for $package."
1910
1911 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1912
1913 : first determine how to suppress newline on echo command
1914 echo " "
1915 echo "Checking echo to see how to suppress newlines..."
1916 (echo "hi there\c" ; echo " ") >.echotmp
1917 if $contains c .echotmp >/dev/null 2>&1 ; then
1918         echo "...using -n."
1919         n='-n'
1920         c=''
1921 else
1922         cat <<'EOM'
1923 ...using \c
1924 EOM
1925         n=''
1926         c='\c'
1927 fi
1928 echo $n "The star should be here-->$c"
1929 echo '*'
1930 rm -f .echotmp
1931
1932 : Now test for existence of everything in MANIFEST
1933 echo " "
1934 if test -f "$rsrc/MANIFEST"; then
1935         echo "First let's make sure your kit is complete.  Checking..." >&4
1936         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" |\
1937                 (split -l 50 2>/dev/null || split -50)
1938         rm -f missing
1939         tmppwd=`pwd`
1940         for filelist in x??; do
1941                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1942                         >/dev/null 2>>"$tmppwd/missing")
1943         done
1944         if test -s missing; then
1945                 cat missing >&4
1946                 cat >&4 <<'EOM'
1947
1948 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1949
1950 You have the option of continuing the configuration process, despite the
1951 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1952 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1953 and contact the author (perlbug@perl.org).
1954
1955 EOM
1956                 echo $n "Continue? [n] $c" >&4
1957                 read ans
1958                 case "$ans" in
1959                 y*)
1960                         echo "Continuing..." >&4
1961                         rm -f missing
1962                         ;;
1963                 *)
1964                         echo "ABORTING..." >&4
1965                         kill $$
1966                         ;;
1967                 esac
1968         else
1969                 echo "Looks good..."
1970         fi
1971 else
1972         echo "There is no MANIFEST file.  I hope your kit is complete !"
1973 fi
1974 rm -f missing x??
1975
1976 : Find the appropriate value for a newline for tr
1977 echo " "
1978 if test -n "$DJGPP"; then
1979        trnl='\012'
1980 fi
1981 if test X"$trnl" = X; then
1982         case "`echo foo|tr '\n' x 2>/dev/null`" in
1983         foox) trnl='\n' ;;
1984         esac
1985 fi
1986 if test X"$trnl" = X; then
1987         case "`echo foo|tr '\012' x 2>/dev/null`" in
1988         foox) trnl='\012' ;;
1989         esac
1990 fi
1991 if test X"$trnl" = X; then
1992        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1993        fooxy) trnl='\n\r' ;;
1994        esac
1995 fi
1996 if test X"$trnl" = X; then
1997         cat <<EOM >&2
1998
1999 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2000
2001 EOM
2002         exit 1
2003 fi
2004
2005 : compute the number of columns on the terminal for proper question formatting
2006 case "$COLUMNS" in
2007 '') COLUMNS='80';;
2008 esac
2009
2010 : set up the echo used in my read
2011 myecho="case \"\$xxxm\" in
2012 '') echo $n \"\$rp $c\" >&4;;
2013 *) case \"\$rp\" in
2014         '') echo $n \"[\$xxxm] $c\";;
2015         *)
2016                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2017                         echo \"\$rp\" >&4
2018                         echo $n \"[\$xxxm] $c\" >&4
2019                 else
2020                         echo $n \"\$rp [\$xxxm] $c\" >&4
2021                 fi
2022                 ;;
2023         esac;;
2024 esac"
2025
2026 : now set up to do reads with possible shell escape and default assignment
2027 cat <<EOSC >myread
2028 $startsh
2029 xxxm=\$dflt
2030 $myecho
2031 ans='!'
2032 case "\$fastread" in
2033 yes) case "\$dflt" in
2034         '') ;;
2035         *) ans='';
2036                 case "\$silent-\$rp" in
2037                 true-) ;;
2038                 *) echo " " >&4;;
2039                 esac;;
2040         esac;;
2041 *) case "\$silent" in
2042         true) case "\$rp" in
2043                 '') ans='';;
2044                 esac;;
2045         esac;;
2046 esac
2047 while expr "X\$ans" : "X!" >/dev/null; do
2048         read answ
2049         set x \$xxxm
2050         shift
2051         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2052         case  "\$answ" in
2053         "!")
2054                 sh 1>&4
2055                 echo " "
2056                 $myecho
2057                 ;;
2058         !*)
2059                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2060                 shift
2061                 sh 1>&4 -c "\$*"
2062                 echo " "
2063                 $myecho
2064                 ;;
2065         "\$ans")
2066                 case "\$ans" in
2067                 \\&*)
2068                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2069                         shift
2070                         case "\$1" in
2071                         -d)
2072                                 fastread=yes
2073                                 echo "(OK, I'll run with -d after this question.)" >&4
2074                                 ;;
2075                         -*)
2076                                 echo "*** Sorry, \$1 not supported yet." >&4
2077                                 ;;
2078                         esac
2079                         $myecho
2080                         ans=!
2081                         ;;
2082                 esac;;
2083         *)
2084                 case "\$aok" in
2085                 y)
2086                         echo "*** Substitution done -- please confirm."
2087                         xxxm="\$ans"
2088                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2089                         xxxm="\$ans"
2090                         ans=!
2091                         ;;
2092                 *)
2093                         echo "*** Error -- try again."
2094                         ans=!
2095                         ;;
2096                 esac
2097                 $myecho
2098                 ;;
2099         esac
2100         case "\$ans\$xxxm\$nostick" in
2101         '')
2102                 ans=!
2103                 $myecho
2104                 ;;
2105         esac
2106 done
2107 case "\$ans" in
2108 '') ans="\$xxxm";;
2109 esac
2110 EOSC
2111
2112 : create .config dir to save info across Configure sessions
2113 test -d ../.config || mkdir ../.config
2114 cat >../.config/README <<EOF
2115 This directory created by Configure to save information that should
2116 persist across sessions for $package.
2117
2118 You may safely delete it if you wish.
2119 EOF
2120
2121 : See if we are using a devel version and want that
2122 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2123 case "$usedevel" in
2124 $define|true|[yY]*) ;;
2125 *) case "$xversion" in
2126    *[13579])
2127         cat >&4 <<EOH
2128 *** WHOA THERE!!! ***
2129
2130     This is an UNSTABLE DEVELOPMENT release.
2131     The version of this $package distribution is $xversion, that is, odd,
2132     (as opposed to even) and that signifies a development release.
2133     If you want a maintenance release, you want an even-numbered version.
2134
2135     Do ***NOT*** install this into production use.
2136     Data corruption and crashes are possible.
2137
2138     It is most seriously suggested that you do not continue any further
2139     unless you want to help in developing and debugging Perl.
2140
2141     If you *still* want to build perl, you can answer 'y' now,
2142     or pass -Dusedevel to Configure.
2143
2144 EOH
2145         rp='Do you really want to continue?'
2146         dflt='n'
2147         . ./myread
2148         case "$ans" in
2149         [yY]) echo >&4 "Okay, continuing."
2150               usedevel="$define" ;;
2151         *) echo >&4 "Okay, bye."
2152            exit 1
2153            ;;
2154         esac
2155         ;;
2156     esac
2157     ;;
2158 esac
2159 case "$usedevel" in
2160 $define|true|[yY]*)
2161         case "$versiononly" in
2162         '') versiononly="$define" ;;
2163         esac
2164         case "$installusrbinperl" in
2165         '') installusrbinperl="$undef" ;;
2166         esac
2167         ;;
2168 esac
2169
2170 : general instructions
2171 needman=true
2172 firsttime=true
2173 user=`(logname) 2>/dev/null`
2174 case "$user" in
2175 '') user=`whoami 2>&1`;;
2176 esac
2177 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2178         firsttime=false
2179         echo " "
2180         rp='Would you like to see the instructions?'
2181         dflt=n
2182         . ./myread
2183         case "$ans" in
2184         [yY]*) ;;
2185         *) needman=false;;
2186         esac
2187 fi
2188 if $needman; then
2189         cat <<EOH
2190
2191 This installation shell script will examine your system and ask you questions
2192 to determine how the perl5 package should be installed. If you get
2193 stuck on a question, you may use a ! shell escape to start a subshell or
2194 execute a command.  Many of the questions will have default answers in square
2195 brackets; typing carriage return will give you the default.
2196
2197 On some of the questions which ask for file or directory names you are allowed
2198 to use the ~name construct to specify the login directory belonging to "name",
2199 even if you don't have a shell which knows about that.  Questions where this is
2200 allowed will be marked "(~name ok)".
2201
2202 EOH
2203         rp=''
2204         dflt='Type carriage return to continue'
2205         . ./myread
2206         cat <<'EOH'
2207
2208 The prompter used in this script allows you to use shell variables and
2209 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2210 in the default answer, as if the default line was a set of arguments given to a
2211 script shell.  This means you may also use $* to repeat the whole default line,
2212 so you do not have to re-type everything to add something to the default.
2213
2214 Everytime there is a substitution, you will have to confirm.  If there is an
2215 error (e.g. an unmatched backtick), the default answer will remain unchanged
2216 and you will be prompted again.
2217
2218 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2219 the questions and use the computed defaults (or the previous answers if there
2220 was already a config.sh file). Type 'Configure -h' for a list of options.
2221 You may also start interactively and then answer '& -d' at any prompt to turn
2222 on the non-interactive behaviour for the remainder of the execution.
2223
2224 EOH
2225         . ./myread
2226         cat <<EOH
2227
2228 Much effort has been expended to ensure that this shell script will run on any
2229 Unix system.  If despite that it blows up on yours, your best bet is to edit
2230 Configure and run it again.  If you can't run Configure for some reason,
2231 you'll have to generate a config.sh file by hand.  Whatever problems you
2232 have, let me (perlbug@perl.org) know how I blew it.
2233
2234 This installation script affects things in two ways:
2235
2236 1) it may do direct variable substitutions on some of the files included
2237    in this kit.
2238 2) it builds a config.h file for inclusion in C programs.  You may edit
2239    any of these files as the need arises after running this script.
2240
2241 If you make a mistake on a question, there is no easy way to back up to it
2242 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2243 files.  Configure will offer to let you do this before it runs the SH files.
2244
2245 EOH
2246         dflt='Type carriage return to continue'
2247         . ./myread
2248         case "$firsttime" in
2249         true) echo $user >>../.config/instruct;;
2250         esac
2251 fi
2252
2253 : find out where common programs are
2254 echo " "
2255 echo "Locating common programs..." >&4
2256 cat <<EOSC >loc
2257 $startsh
2258 case \$# in
2259 0) exit 1;;
2260 esac
2261 thing=\$1
2262 shift
2263 dflt=\$1
2264 shift
2265 for dir in \$*; do
2266         case "\$thing" in
2267         .)
2268         if test -d \$dir/\$thing; then
2269                 echo \$dir
2270                 exit 0
2271         fi
2272         ;;
2273         *)
2274         for thisthing in \$dir/\$thing; do
2275                 : just loop through to pick last item
2276         done
2277         if test -f \$thisthing; then
2278                 echo \$thisthing
2279                 exit 0
2280         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2281                 echo \$thisthing
2282                 exit 0
2283         elif test -f \$dir/\$thing.exe; then
2284                 if test -n "$DJGPP"; then
2285                         echo \$dir/\$thing.exe
2286                 elif test "$eunicefix" != ":"; then
2287                         : on Eunice apparently
2288                         echo \$dir/\$thing
2289                 fi
2290                 exit 0
2291         fi
2292         ;;
2293         esac
2294 done
2295 echo \$dflt
2296 exit 1
2297 EOSC
2298 chmod +x loc
2299 $eunicefix loc
2300 loclist="
2301 awk
2302 cat
2303 chmod
2304 comm
2305 cp
2306 echo
2307 expr
2308 grep
2309 ls
2310 mkdir
2311 rm
2312 sed
2313 sort
2314 touch
2315 tr
2316 uniq
2317 "
2318 trylist="
2319 ar
2320 bison
2321 byacc
2322 cpp
2323 csh
2324 date
2325 egrep
2326 gmake
2327 gzip
2328 less
2329 ln
2330 make
2331 more
2332 nm
2333 nroff
2334 pg
2335 test
2336 uname
2337 zip
2338 "
2339 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2340 pth="$pth /lib /usr/lib"
2341 for file in $loclist; do
2342         eval xxx=\$$file
2343         case "$xxx" in
2344         /*|?:[\\/]*)
2345                 if test -f "$xxx"; then
2346                         : ok
2347                 else
2348                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2349                         xxx=`./loc $file $file $pth`
2350                 fi
2351                 ;;
2352         '') xxx=`./loc $file $file $pth`;;
2353         *) xxx=`./loc $xxx $xxx $pth`;;
2354         esac
2355         eval $file=$xxx$_exe
2356         eval _$file=$xxx
2357         case "$xxx" in
2358         /*)
2359                 echo $file is in $xxx.
2360                 ;;
2361         ?:[\\/]*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         *)
2365                 echo "I don't know where '$file' is, and my life depends on it." >&4
2366                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2367                 exit 1
2368                 ;;
2369         esac
2370 done
2371 echo " "
2372 echo "Don't worry if any of the following aren't found..."
2373 say=offhand
2374 for file in $trylist; do
2375         eval xxx=\$$file
2376         case "$xxx" in
2377         /*|?:[\\/]*)
2378                 if test -f "$xxx"; then
2379                         : ok
2380                 else
2381                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2382                         xxx=`./loc $file $file $pth`
2383                 fi
2384                 ;;
2385         '') xxx=`./loc $file $file $pth`;;
2386         *) xxx=`./loc $xxx $xxx $pth`;;
2387         esac
2388         eval $file=$xxx$_exe
2389         eval _$file=$xxx
2390         case "$xxx" in
2391         /*)
2392                 echo $file is in $xxx.
2393                 ;;
2394         ?:[\\/]*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         *)
2398                 echo "I don't see $file out there, $say."
2399                 say=either
2400                 ;;
2401         esac
2402 done
2403 case "$egrep" in
2404 egrep)
2405         echo "Substituting grep for egrep."
2406         egrep=$grep
2407         _egrep=$grep
2408         ;;
2409 esac
2410 case "$ln" in
2411 ln)
2412         echo "Substituting cp for ln."
2413         ln=$cp
2414         _ln=$cp
2415         ;;
2416 esac
2417 case "$make" in
2418 make)
2419         case "$gmake" in
2420         gmake)
2421         echo "I can't find make or gmake, and my life depends on it." >&4
2422         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2423         exit 1
2424         ;;
2425         esac
2426         ;;
2427 esac
2428 case "$gmake" in
2429 gmake)  ;;
2430 *)      # We can't have osname yet.
2431         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2432                 # Assume that gmake, if found, is definitely GNU make
2433                 # and prefer it over the system make.
2434                 echo "Substituting gmake for make."
2435                 make=$gmake
2436                 _make=$gmake
2437         fi
2438         ;;
2439 esac
2440 case "$test" in
2441 test)
2442         echo "Hopefully test is built into your sh."
2443         ;;
2444 *)
2445         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2446                 echo "Using the test built into your sh."
2447                 test=test
2448                 _test=test
2449         fi
2450         ;;
2451 esac
2452 case "$echo" in
2453 echo)
2454         echo "Hopefully echo is built into your sh."
2455         ;;
2456 '') ;;
2457 *)
2458         echo " "
2459 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2460         $echo $n "hi there$c" >foo1
2461         echo $n "hi there$c" >foo2
2462         if cmp foo1 foo2 >/dev/null 2>&1; then
2463                 echo "They are compatible.  In fact, they may be identical."
2464         else
2465                 case "$n" in
2466                 '-n') n='' c='\c';;
2467                 *) n='-n' c='';;
2468                 esac
2469                 cat <<FOO
2470 They are not compatible!  You are probably running ksh on a non-USG system.
2471 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2472 have echo built in and we may have to run some Bourne shell scripts.  That
2473 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2474
2475 FOO
2476                 $echo $n "The star should be here-->$c"
2477                 $echo "*"
2478         fi
2479         $rm -f foo1 foo2
2480         ;;
2481 esac
2482
2483 # This question was auctioned at YAPC::Europe-2007 in Vienna
2484 # I never promised you could answer it. I only auctioned the question.
2485 cat <<FOO
2486 The following message is sponsored by
2487
2488   Dresden.pm<--The stars should be here.
2489
2490 Dear Perl user, system administrator or package
2491 maintainer, the Perl community sends greetings to
2492 you. Do you (emblematical) greet back [Y/n]? n
2493
2494 FOO
2495
2496 : Check what type of C compiler we use
2497 cat <<EOS >trygcc
2498 $startsh
2499 EOS
2500 cat <<'EOSC' >>trygcc
2501 case "$cc" in
2502 '') ;;
2503 *)  $rm -f try try.*
2504     $cat >try.c <<EOM
2505 int main(int argc, char *argv[]) {
2506   return 0;
2507 }
2508 EOM
2509     if $cc -o try $ccflags $ldflags try.c; then
2510        :
2511     else
2512         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2513         despair=yes
2514         trygcc=yes
2515         case "$cc" in
2516         *gcc*) trygcc=no ;;
2517         esac
2518         # Skip this test because it gives a false match on output like:
2519         #    ./trygcc: line 23: cc: command not found
2520         # case "`$cc -v -c try.c 2>&1`" in
2521         # *gcc*) trygcc=no ;;
2522         # esac
2523         if $test X"$trygcc" = Xyes; then
2524             if gcc -o try -c try.c; then
2525                 echo " "
2526                 echo "You seem to have a working gcc, though." >&4
2527                 # Switching compilers may undo the work of hints files.
2528                 # The most common problem is -D_REENTRANT for threads.
2529                 # This heuristic catches that case, but gets false positives
2530                 # if -Dusethreads was not actually specified.  Better to
2531                 # bail out here with a useful message than fail 
2532                 # mysteriously later. Should we perhaps just try to
2533                 # re-invoke Configure -Dcc=gcc config_args ?
2534                 if $test -f usethreads.cbu; then
2535                         $cat >&4 <<EOM 
2536
2537 *** However, any setting of the C compiler flags (e.g. for thread support)
2538 *** will be lost.  It may be necessary for you to restart Configure and
2539 *** add -Dcc=gcc to your Configure command line.
2540
2541 EOM
2542                         rp="Would you like to go ahead and try gcc anyway?"
2543                         dflt=n
2544                 else
2545                         rp="Would you like to use it?"
2546                         dflt=y
2547                 fi
2548                 if $test -f myread; then
2549                     . ./myread
2550                 else
2551                     if $test -f UU/myread; then
2552                         . ./UU/myread
2553                     else
2554                         echo "Cannot find myread, sorry.  Aborting." >&2
2555                         exit 1
2556                     fi
2557                 fi  
2558                 case "$ans" in
2559                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2560                 esac
2561             fi
2562         fi
2563     fi
2564     $rm -f try try.*
2565     ;;
2566 esac
2567 EOSC
2568
2569 cat <<EOS >checkcc
2570 $startsh
2571 EOS
2572 cat <<'EOSC' >>checkcc
2573 case "$cc" in        
2574 '') ;;
2575 *)  $rm -f try try.*              
2576     $cat >try.c <<EOM
2577 int main(int argc, char *argv[]) {
2578   return 0;
2579 }
2580 EOM
2581     if $cc -o try $ccflags $ldflags try.c; then
2582        :
2583     else
2584         if $test X"$despair" = Xyes; then
2585            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2586         fi
2587         $cat >&4 <<EOM         
2588 You need to find a working C compiler.
2589 Either (purchase and) install the C compiler supplied by your OS vendor,
2590 or for a free C compiler try http://gcc.gnu.org/
2591 I cannot continue any further, aborting.
2592 EOM
2593         exit 1
2594     fi
2595     $rm -f try try.*
2596     ;;
2597 esac
2598 EOSC
2599
2600 : determine whether symbolic links are supported
2601 echo " "
2602 $touch blurfl
2603 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2604         echo "Symbolic links are supported." >&4
2605         lns="$ln -s"
2606 else
2607         echo "Symbolic links are NOT supported." >&4
2608         lns="$ln"
2609 fi
2610 $rm -f blurfl sym
2611
2612 : determine whether symbolic links are supported
2613 echo " "
2614 case "$lns" in
2615 *"ln"*" -s")
2616         echo "Checking how to test for symbolic links..." >&4
2617         $lns blurfl sym
2618         if $test "X$issymlink" = X; then
2619                 case "$newsh" in
2620                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2621                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2622                 esac
2623                 if test $? = 0; then
2624                         issymlink="test -h"
2625                 else
2626                         echo "Your builtin 'test -h' may be broken." >&4
2627                         case "$test" in
2628                         /*)     ;;
2629                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2630                                 for p in $pth
2631                                 do
2632                                         if test -f "$p/$test"; then
2633                                                 test="$p/$test"
2634                                                 break
2635                                         fi
2636                                 done
2637                                 ;;
2638                         esac
2639                         case "$test" in
2640                         /*)
2641                                 echo "Trying external '$test -h'." >&4
2642                                 issymlink="$test -h"
2643                                 if $test ! -h sym >/dev/null 2>&1; then
2644                                         echo "External '$test -h' is broken, too." >&4
2645                                         issymlink=''
2646                                 fi
2647                                 ;;
2648                         *)      issymlink='' ;;
2649                         esac
2650                 fi              
2651         fi
2652         if $test "X$issymlink" = X; then
2653                 if $test -L sym 2>/dev/null; then
2654                         issymlink="$test -L"
2655                         echo "The builtin '$test -L' worked." >&4
2656                 fi
2657         fi
2658         if $test "X$issymlink" != X; then
2659                 echo "You can test for symbolic links with '$issymlink'." >&4
2660         else
2661                 echo "I do not know how you can test for symbolic links." >&4
2662         fi
2663         $rm -f blurfl sym
2664         ;;
2665 *)      echo "No symbolic links, so not testing for their testing..." >&4
2666         ;;
2667 esac
2668 echo " "
2669
2670 : Make symlinks util
2671 case "$mksymlinks" in
2672 $define|true|[yY]*)
2673         case "$src" in
2674         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2675                 exit 1
2676                 ;;
2677         *)      case "$lns:$issymlink" in
2678                 *"ln"*" -s:"*"test -"?)
2679                         echo "Creating the symbolic links..." >&4
2680                         echo "(First creating the subdirectories...)" >&4
2681                         cd ..
2682                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2683                                 read directory
2684                                 test -z "$directory" && break
2685                                 mkdir -p $directory
2686                         done
2687                         # Sanity check 1.
2688                         if test ! -d t/base; then
2689                                 echo "Failed to create the subdirectories.  Aborting." >&4
2690                                 exit 1
2691                         fi
2692                         echo "(Then creating the symlinks...)" >&4
2693                         awk '{print $1}' $src/MANIFEST | while true; do
2694                                 read filename
2695                                 test -z "$filename" && break
2696                                 if test -f $filename; then
2697                                         if $issymlink $filename; then
2698                                                 rm -f $filename
2699                                         fi
2700                                 fi
2701                                 if test -f $filename; then
2702                                         echo "$filename already exists, not symlinking."
2703                                 else
2704                                         ln -s $src/$filename $filename
2705                                 fi
2706                         done
2707                         # Sanity check 2.
2708                         if test ! -f t/base/lex.t; then
2709                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2710                                 exit 1
2711                         fi
2712                         cd UU
2713                         ;;
2714                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2715                         ;;
2716                 esac
2717                 ;;
2718         esac
2719         ;;
2720 esac
2721
2722 : Check for Cross-Compilation
2723 case "$usecrosscompile" in
2724 $define|true|[yY]*)
2725         $echo "Cross-compiling..."
2726         croak=''
2727         case "$cc" in
2728         *-*-gcc) # A cross-compiling gcc, probably.
2729             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2730             ar=$targetarch-ar
2731             # leave out ld, choosing it is more complex
2732             nm=$targetarch-nm
2733             ranlib=$targetarch-ranlib
2734             $echo 'extern int foo;' > try.c
2735             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2736             shift
2737             if $test $# -gt 0; then
2738                 incpth="$incpth $*"
2739                 incpth="`$echo $incpth|$sed 's/^ //'`"
2740                 echo "Guessing incpth '$incpth'." >&4
2741                 for i in $*; do
2742                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2743                     if $test -d $j; then
2744                         libpth="$libpth $j"
2745                     fi
2746                 done   
2747                 libpth="`$echo $libpth|$sed 's/^ //'`"
2748                 echo "Guessing libpth '$libpth'." >&4
2749             fi
2750             $rm -f try.c
2751             ;;
2752         esac
2753         case "$targetarch" in
2754         '') echo "Targetarch not defined." >&4; croak=y ;;
2755         *)  echo "Using targetarch $targetarch." >&4 ;;
2756         esac
2757         case "$incpth" in
2758         '') echo "Incpth not defined." >&4; croak=y ;;
2759         *)  echo "Using incpth '$incpth'." >&4 ;;
2760         esac
2761         case "$libpth" in
2762         '') echo "Libpth not defined." >&4; croak=y ;;
2763         *)  echo "Using libpth '$libpth'." >&4 ;;
2764         esac
2765         case "$usrinc" in
2766         '') for i in $incpth; do
2767                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2768                     usrinc=$i
2769                     echo "Guessing usrinc $usrinc." >&4
2770                     break
2771                 fi
2772             done
2773             case "$usrinc" in
2774             '') echo "Usrinc not defined." >&4; croak=y ;;
2775             esac
2776             ;;
2777         *)  echo "Using usrinc $usrinc." >&4 ;;
2778         esac
2779         case "$targethost" in
2780         '') echo "Targethost not defined." >&4; croak=y ;;
2781         *)  echo "Using targethost $targethost." >&4
2782         esac
2783         locincpth=' '
2784         loclibpth=' '
2785         case "$croak" in
2786         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2787         esac
2788         case "$src" in
2789         /*) run=$src/Cross/run
2790             targetmkdir=$src/Cross/mkdir
2791             to=$src/Cross/to
2792             from=$src/Cross/from
2793             ;;
2794         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2795             run=$pwd/Cross/run
2796             targetmkdir=$pwd/Cross/mkdir
2797             to=$pwd/Cross/to
2798             from=$pwd/Cross/from
2799             ;;
2800         esac
2801         case "$targetrun" in
2802         '') targetrun=ssh ;;
2803         esac
2804         case "$targetto" in
2805         '') targetto=scp ;;
2806         esac
2807         case "$targetfrom" in
2808         '') targetfrom=scp ;;
2809         esac
2810         run=$run-$targetrun
2811         to=$to-$targetto
2812         from=$from-$targetfrom
2813         case "$targetdir" in
2814         '')  targetdir=/tmp
2815              echo "Guessing targetdir $targetdir." >&4
2816              ;;
2817         esac
2818         case "$targetuser" in
2819         '')  targetuser=root
2820              echo "Guessing targetuser $targetuser." >&4
2821              ;;
2822         esac
2823         case "$targetfrom" in
2824         scp)    q=-q ;;
2825         *)      q='' ;;
2826         esac
2827         case "$targetrun" in
2828         ssh|rsh)
2829             cat >$run <<EOF
2830 #!/bin/sh
2831 case "\$1" in
2832 -cwd)
2833   shift
2834   cwd=\$1
2835   shift
2836   ;;
2837 esac
2838 case "\$cwd" in
2839 '') cwd=$targetdir ;;
2840 esac
2841 exe=\$1
2842 shift
2843 if $test ! -f \$exe.xok; then
2844   $to \$exe
2845   $touch \$exe.xok
2846 fi
2847 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2848 EOF
2849             ;;
2850         *)  echo "Unknown targetrun '$targetrun'" >&4
2851             exit 1
2852             ;;
2853         esac
2854         case "$targetmkdir" in
2855         */Cross/mkdir)
2856             cat >$targetmkdir <<EOF
2857 #!/bin/sh
2858 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2859 EOF
2860             $chmod a+rx $targetmkdir
2861             ;;
2862         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2863             exit 1
2864             ;;
2865         esac
2866         case "$targetto" in
2867         scp|rcp)
2868             cat >$to <<EOF
2869 #!/bin/sh
2870 for f in \$@
2871 do
2872   case "\$f" in
2873   /*)
2874     $targetmkdir \`dirname \$f\`
2875     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2876     ;;
2877   *)
2878     $targetmkdir $targetdir/\`dirname \$f\`
2879     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2880     ;;
2881   esac
2882 done
2883 exit 0
2884 EOF
2885             ;;
2886         cp) cat >$to <<EOF
2887 #!/bin/sh
2888 for f in \$@
2889 do
2890   case "\$f" in
2891   /*)
2892     $mkdir -p $targetdir/\`dirname \$f\`
2893     $cp \$f $targetdir/\$f || exit 1
2894     ;;
2895   *)
2896     $targetmkdir $targetdir/\`dirname \$f\`
2897     $cp \$f $targetdir/\$f || exit 1
2898     ;;
2899   esac
2900 done
2901 exit 0
2902 EOF
2903             ;;
2904         *)  echo "Unknown targetto '$targetto'" >&4
2905             exit 1
2906             ;;
2907         esac
2908         case "$targetfrom" in
2909         scp|rcp)
2910           cat >$from <<EOF
2911 #!/bin/sh
2912 for f in \$@
2913 do
2914   $rm -f \$f
2915   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2916 done
2917 exit 0
2918 EOF
2919             ;;
2920         cp) cat >$from <<EOF
2921 #!/bin/sh
2922 for f in \$@
2923 do
2924   $rm -f \$f
2925   cp $targetdir/\$f . || exit 1
2926 done
2927 exit 0
2928 EOF
2929             ;;
2930         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2931             exit 1
2932             ;;
2933         esac
2934         if $test ! -f $run; then
2935             echo "Target 'run' script '$run' not found." >&4
2936         else
2937             $chmod a+rx $run
2938         fi
2939         if $test ! -f $to; then
2940             echo "Target 'to' script '$to' not found." >&4
2941         else
2942             $chmod a+rx $to
2943         fi
2944         if $test ! -f $from; then
2945             echo "Target 'from' script '$from' not found." >&4
2946         else
2947             $chmod a+rx $from
2948         fi
2949         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2950             exit 1
2951         fi
2952         cat >&4 <<EOF
2953 Using '$run' for remote execution,
2954 and '$from' and '$to'
2955 for remote file transfer.
2956 EOF
2957         ;;
2958 *)      run=''
2959         to=:
2960         from=:
2961         usecrosscompile='undef'
2962         targetarch=''
2963         ;;
2964 esac
2965
2966 : see whether [:lower:] and [:upper:] are supported character classes
2967 echo " "
2968 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2969 ABYZ)
2970         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2971         up='[:upper:]'
2972         low='[:lower:]'
2973         ;;
2974 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2975         # (0xd9 and 0xe2), therefore that is a nice testing point.
2976         if test "X$up" = X -o "X$low" = X; then
2977             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2978             rs) up='[A-Z]'
2979                 low='[a-z]'
2980                 ;;
2981             esac
2982         fi
2983         if test "X$up" = X -o "X$low" = X; then
2984             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2985             rs) up='A-Z'
2986                 low='a-z'
2987                 ;;
2988             esac
2989         fi
2990         if test "X$up" = X -o "X$low" = X; then
2991             case "`echo RS | od -x 2>/dev/null`" in
2992             *D9E2*|*d9e2*)
2993                 echo "Hey, this might be EBCDIC." >&4
2994                 if test "X$up" = X -o "X$low" = X; then
2995                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2996                     rs) up='[A-IJ-RS-Z]'
2997                         low='[a-ij-rs-z]'
2998                         ;;
2999                     esac
3000                 fi
3001                 if test "X$up" = X -o "X$low" = X; then
3002                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3003                     rs) up='A-IJ-RS-Z'
3004                         low='a-ij-rs-z'
3005                         ;;
3006                     esac
3007                 fi
3008                 ;;
3009             esac
3010         fi
3011 esac
3012 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3013 rs)
3014     echo "Using $up and $low to convert case." >&4
3015     ;;
3016 *)
3017     echo "I don't know how to translate letters from upper to lower case." >&4
3018     echo "Your tr is not acting any way I know of." >&4
3019     exit 1
3020     ;;
3021 esac
3022 : set up the translation script tr, must be called with ./tr of course
3023 cat >tr <<EOSC
3024 $startsh
3025 case "\$1\$2" in
3026 '[A-Z][a-z]') exec $tr '$up' '$low';;
3027 '[a-z][A-Z]') exec $tr '$low' '$up';;
3028 esac
3029 exec $tr "\$@"
3030 EOSC
3031 chmod +x tr
3032 $eunicefix tr
3033
3034 : Try to determine whether config.sh was made on this system
3035 case "$config_sh" in
3036 '')
3037 myuname=`$uname -a 2>/dev/null`
3038 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3039 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3040 # because the A-Z/a-z are not consecutive.
3041 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3042         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3043 newmyuname="$myuname"
3044 dflt=n
3045 case "$knowitall" in
3046 '')
3047         if test -f ../config.sh; then
3048                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3049                         eval "`grep myuname= ../config.sh`"
3050                 fi
3051                 if test "X$myuname" = "X$newmyuname"; then
3052                         dflt=y
3053                 fi
3054         fi
3055         ;;
3056 *) dflt=y;;
3057 esac
3058
3059 : Get old answers from old config file if Configure was run on the
3060 : same system, otherwise use the hints.
3061 hint=default
3062 cd ..
3063 if test -f config.sh; then
3064         echo " "
3065         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3066         . UU/myread
3067         case "$ans" in
3068         n*|N*) echo "OK, I'll ignore it."
3069                 mv config.sh config.sh.old
3070                 myuname="$newmyuname"
3071                 ;;
3072         *)  echo "Fetching default answers from your old config.sh file..." >&4
3073                 tmp_n="$n"
3074                 tmp_c="$c"
3075                 tmp_sh="$sh"
3076                 . ./config.sh
3077                 cp config.sh UU
3078                 n="$tmp_n"
3079                 c="$tmp_c"
3080                 : Older versions did not always set $sh.  Catch re-use of such
3081                 : an old config.sh.
3082                 case "$sh" in
3083                 '') sh="$tmp_sh" ;;
3084                 esac
3085                 hint=previous
3086                 ;;
3087         esac
3088 fi
3089 . ./UU/checkcc
3090 if test ! -f config.sh; then
3091         $cat <<EOM
3092
3093 First time through, eh?  I have some defaults handy for some systems
3094 that need some extra help getting the Configure answers right:
3095
3096 EOM
3097         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3098         dflt=''
3099         : Half the following guesses are probably wrong... If you have better
3100         : tests or hints, please send them to perlbug@perl.org
3101         : The metaconfig authors would also appreciate a copy...
3102         $test -f /irix && osname=irix
3103         $test -f /xenix && osname=sco_xenix
3104         $test -f /dynix && osname=dynix
3105         $test -f /dnix && osname=dnix
3106         $test -f /lynx.os && osname=lynxos
3107         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3108         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3109         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3110         $test -f /bin/mips && /bin/mips && osname=mips
3111         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3112                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3113         $test -d /usr/apollo/bin && osname=apollo
3114         $test -f /etc/saf/_sactab && osname=svr4
3115         $test -d /usr/include/minix && osname=minix
3116         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3117         if $test -d /MachTen -o -d /MachTen_Folder; then
3118                 osname=machten
3119                 if $test -x /sbin/version; then
3120                         osvers=`/sbin/version | $awk '{print $2}' |
3121                         $sed -e 's/[A-Za-z]$//'`
3122                 elif $test -x /usr/etc/version; then
3123                         osvers=`/usr/etc/version | $awk '{print $2}' |
3124                         $sed -e 's/[A-Za-z]$//'`
3125                 else
3126                         osvers="$2.$3"
3127                 fi
3128         fi
3129
3130         $test -f /sys/posix.dll &&
3131                 $test -f /usr/bin/what &&
3132                 set X `/usr/bin/what /sys/posix.dll` &&
3133                 $test "$3" = UWIN &&
3134                 osname=uwin &&
3135                 osvers="$5"
3136
3137         if $test -f $uname; then
3138                 set X $myuname
3139                 shift
3140
3141                 case "$5" in
3142                 fps*) osname=fps ;;
3143                 mips*)
3144                         case "$4" in
3145                         umips) osname=umips ;;
3146                         *) osname=mips ;;
3147                         esac;;
3148                 [23]100) osname=mips ;;
3149                 next*) osname=next ;;
3150                 i386*)
3151                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3152                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3153                                 osname='sco'
3154                                 osvers=$tmp
3155                         elif $test -f /etc/kconfig; then
3156                                 osname=isc
3157                                 if test "$lns" = "$ln -s"; then
3158                                         osvers=4
3159                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3160                                         osvers=3
3161                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3162                                         osvers=2
3163                                 fi
3164                         fi
3165                         tmp=''
3166                         ;;
3167                 pc*)
3168                         if test -n "$DJGPP"; then
3169                                 osname=dos
3170                                 osvers=djgpp
3171                         fi
3172                         ;;
3173                 esac
3174
3175                 case "$1" in
3176                 aix) osname=aix
3177                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3178                         case "$tmp" in
3179                         # oslevel can fail with:
3180                         # oslevel: Unable to acquire lock.
3181                         *not\ found) osvers="$4"."$3" ;;
3182                         '<3240'|'<>3240') osvers=3.2.0 ;;
3183                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3184                         '=3250'|'>3250') osvers=3.2.5 ;;
3185                         *) osvers=$tmp;;
3186                         esac
3187                         ;;
3188                 bsd386) osname=bsd386
3189                         osvers=`$uname -r`
3190                         ;;
3191                 cygwin*) osname=cygwin
3192                         osvers="$3"
3193                         ;;
3194                 *dc.osx) osname=dcosx
3195                         osvers="$3"
3196                         ;;
3197                 dnix) osname=dnix
3198                         osvers="$3"
3199                         ;;
3200                 domainos) osname=apollo
3201                         osvers="$3"
3202                         ;;
3203                 dgux)   osname=dgux
3204                         osvers="$3"
3205                         ;;
3206                 dragonfly) osname=dragonfly
3207                         osvers="$3"
3208                         ;;
3209                 dynixptx*) osname=dynixptx
3210                         osvers=`echo "$4"|sed 's/^v//'`
3211                         ;;
3212                 freebsd) osname=freebsd
3213                         osvers="$3" ;;
3214                 genix)  osname=genix ;;
3215                 gnu)    osname=gnu
3216                         osvers="$3" ;;
3217                 hp*)    osname=hpux
3218                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3219                         ;;
3220                 irix*)  osname=irix
3221                         case "$3" in
3222                         4*) osvers=4 ;;
3223                         5*) osvers=5 ;;
3224                         *)      osvers="$3" ;;
3225                         esac
3226                         ;;
3227                 linux)  osname=linux
3228                         case "$3" in
3229                         *)      osvers="$3" ;;
3230                         esac
3231                         ;;
3232                 MiNT)   osname=mint
3233                         ;;
3234                 netbsd*) osname=netbsd
3235                         osvers="$3"
3236                         ;;
3237                 news-os) osvers="$3"
3238                         case "$3" in
3239                         4*) osname=newsos4 ;;
3240                         *) osname=newsos ;;
3241                         esac
3242                         ;;
3243                 next*) osname=next ;;
3244                 nonstop-ux) osname=nonstopux ;;
3245                 openbsd) osname=openbsd
3246                         osvers="$3"
3247                         ;;
3248                 os2)    osname=os2
3249                         osvers="$4"
3250                         ;;
3251                 POSIX-BC | posix-bc ) osname=posix-bc
3252                         osvers="$3"
3253                         ;;
3254                 powerux | power_ux | powermax_os | powermaxos | \
3255                 powerunix | power_unix) osname=powerux
3256                         osvers="$3"
3257                         ;;
3258                 qnx) osname=qnx
3259                         osvers="$4"
3260                         ;;
3261                 solaris) osname=solaris
3262                         case "$3" in
3263                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3264                         *)      osvers="$3" ;;
3265                         esac
3266                         ;;
3267                 sunos) osname=sunos
3268                         case "$3" in
3269                         5*) osname=solaris
3270                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3271                         *)      osvers="$3" ;;
3272                         esac
3273                         ;;
3274                 titanos) osname=titanos
3275                         case "$3" in
3276                         1*) osvers=1 ;;
3277                         2*) osvers=2 ;;
3278                         3*) osvers=3 ;;
3279                         4*) osvers=4 ;;
3280                         *)      osvers="$3" ;;
3281                         esac
3282                         ;;
3283                 ultrix) osname=ultrix
3284                         osvers="$3"
3285                         ;;
3286                 osf1|mls+)      case "$5" in
3287                                 alpha)
3288                                         osname=dec_osf
3289                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3290                                         case "$osvers" in
3291                                         [1-9].[0-9]*) ;;
3292                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3293                                         esac
3294                                         ;;
3295                         hp*)    osname=hp_osf1  ;;
3296                         mips)   osname=mips_osf1 ;;
3297                         esac
3298                         ;;
3299                 # UnixWare 7.1.2 is known as Open UNIX 8
3300                 openunix|unixware) osname=svr5
3301                         osvers="$4"
3302                         ;;
3303                 uts)    osname=uts
3304                         osvers="$3"
3305                         ;;
3306                 vos) osvers="$3"
3307                         ;;
3308                 $2) case "$osname" in
3309                         *isc*) ;;
3310                         *freebsd*) ;;
3311                         svr*)
3312                                 : svr4.x or possibly later
3313                                 case "svr$3" in
3314                                 ${osname}*)
3315                                         osname=svr$3
3316                                         osvers=$4
3317                                         ;;
3318                                 esac
3319                                 case "$osname" in
3320                                 svr4.0)
3321                                         : Check for ESIX
3322                                         if test -f /stand/boot ; then
3323                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3324                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3325                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3326                                                         if test -n "$isesix"; then
3327                                                                 osname=esix4
3328                                                         fi
3329                                                 fi
3330                                         fi
3331                                         ;;
3332                                 esac
3333                                 ;;
3334                         *)      if test -f /etc/systemid; then
3335                                         osname=sco
3336                                         set `echo $3 | $sed 's/\./ /g'` $4
3337                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3338                                                 osvers=$1.$2.$3
3339                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3340                                                 osvers=$1.$2
3341                                         elif $test -f $src/hints/sco_$1.sh; then
3342                                                 osvers=$1
3343                                         fi
3344                                 else
3345                                         case "$osname" in
3346                                         '') : Still unknown.  Probably a generic Sys V.
3347                                                 osname="sysv"
3348                                                 osvers="$3"
3349                                                 ;;
3350                                         esac
3351                                 fi
3352                                 ;;
3353                         esac
3354                         ;;
3355                 *)      case "$osname" in
3356                         '') : Still unknown.  Probably a generic BSD.
3357                                 osname="$1"
3358                                 osvers="$3"
3359                                 ;;
3360                         esac
3361                         ;;
3362                 esac
3363         else
3364                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3365                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3366                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3367                                 osname=news_os
3368                         fi
3369                         $rm -f UU/kernel.what
3370                 elif test -d c:/. -o -n "$is_os2" ; then
3371                         set X $myuname
3372                         osname=os2
3373                         osvers="$5"
3374                 fi
3375         fi
3376
3377         case "$targetarch" in
3378         '') ;;
3379         *)  hostarch=$osname
3380             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3381             osvers=''
3382             ;;
3383         esac
3384
3385         : Now look for a hint file osname_osvers, unless one has been
3386         : specified already.
3387         case "$hintfile" in
3388         ''|' ')
3389                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3390                 : Also try without trailing minor version numbers.
3391                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3392                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3393                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3394                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3395                 case "$file" in
3396                 '') dflt=none ;;
3397                 *)  case "$osvers" in
3398                         '') dflt=$file
3399                                 ;;
3400                         *)  if $test -f $src/hints/$file.sh ; then
3401                                         dflt=$file
3402                                 elif $test -f $src/hints/$xfile.sh ; then
3403                                         dflt=$xfile
3404                                 elif $test -f $src/hints/$xxfile.sh ; then
3405                                         dflt=$xxfile
3406                                 elif $test -f $src/hints/$xxxfile.sh ; then
3407                                         dflt=$xxxfile
3408                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3409                                         dflt=$xxxxfile
3410                                 elif $test -f "$src/hints/${osname}.sh" ; then
3411                                         dflt="${osname}"
3412                                 else
3413                                         dflt=none
3414                                 fi
3415                                 ;;
3416                         esac
3417                         ;;
3418                 esac
3419                 if $test -f Policy.sh ; then
3420                         case "$dflt" in
3421                         *Policy*) ;;
3422                         none) dflt="Policy" ;;
3423                         *) dflt="Policy $dflt" ;;
3424                         esac
3425                 fi
3426                 ;;
3427         *)
3428                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3429                 ;;
3430         esac
3431
3432         if $test -f Policy.sh ; then
3433                 $cat <<EOM
3434
3435 There's also a Policy hint file available, which should make the
3436 site-specific (policy) questions easier to answer.
3437 EOM
3438
3439         fi
3440
3441         $cat <<EOM
3442
3443 You may give one or more space-separated answers, or "none" if appropriate.
3444 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3445 previous run of Configure, you may specify it as well as or instead of
3446 OS-specific hints.  If hints are provided for your OS, you should use them:
3447 although Perl can probably be built without hints on many platforms, using
3448 hints often improve performance and may enable features that Configure can't
3449 set up on its own. If there are no hints that match your OS, specify "none";
3450 DO NOT give a wrong version or a wrong OS.
3451
3452 EOM
3453
3454         rp="Which of these apply, if any?"
3455         . UU/myread
3456         tans=$ans
3457         for file in $tans; do
3458                 if $test X$file = XPolicy -a -f Policy.sh; then
3459                         . Policy.sh
3460                         $cat Policy.sh >> UU/config.sh
3461                 elif $test -f $src/hints/$file.sh; then
3462                         . $src/hints/$file.sh
3463                         $cat $src/hints/$file.sh >> UU/config.sh
3464                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3465                         : nothing
3466                 else
3467                         : Give one chance to correct a possible typo.
3468                         echo "$file.sh does not exist"
3469                         dflt=$file
3470                         rp="hint to use instead?"
3471                         . UU/myread
3472                         for file in $ans; do
3473                                 if $test -f "$src/hints/$file.sh"; then
3474                                         . $src/hints/$file.sh
3475                                         $cat $src/hints/$file.sh >> UU/config.sh
3476                                 elif $test X$ans = X -o X$ans = Xnone ; then
3477                                         : nothing
3478                                 else
3479                                         echo "$file.sh does not exist -- ignored."
3480                                 fi
3481                         done
3482                 fi
3483         done
3484
3485         hint=recommended
3486         : Remember our hint file for later.
3487         if $test -f "$src/hints/$file.sh" ; then
3488                 hintfile="$file"
3489         else
3490                 hintfile=''
3491         fi
3492 fi
3493 cd UU
3494 ;;
3495 *)
3496         echo " "
3497         echo "Fetching default answers from $config_sh..." >&4
3498         tmp_n="$n"
3499         tmp_c="$c"
3500         cd ..
3501         cp $config_sh config.sh 2>/dev/null
3502         chmod +w config.sh
3503         . ./config.sh
3504         cd UU
3505         cp ../config.sh .
3506         n="$tmp_n"
3507         c="$tmp_c"
3508         hint=previous
3509         ;;
3510 esac
3511 test "$override" && . ./optdef.sh
3512
3513 : Restore computed paths
3514 for file in $loclist $trylist; do
3515         eval $file="\$_$file"
3516 done
3517
3518 cat << EOM
3519
3520 Configure uses the operating system name and version to set some defaults.
3521 The default value is probably right if the name rings a bell. Otherwise,
3522 since spelling matters for me, either accept the default or answer "none"
3523 to leave it blank.
3524
3525 EOM
3526 case "$osname" in
3527         ''|' ')
3528                 case "$hintfile" in
3529                 ''|' '|none) dflt=none ;;
3530                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3531                 esac
3532                 ;;
3533         *) dflt="$osname" ;;
3534 esac
3535 rp="Operating system name?"
3536 . ./myread
3537 case "$ans" in
3538 none)  osname='' ;;
3539 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3540 esac
3541 echo " "
3542 case "$osvers" in
3543         ''|' ')
3544                 case "$hintfile" in
3545                 ''|' '|none) dflt=none ;;
3546                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3547                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3548                         case "$dflt" in
3549                         ''|' ') dflt=none ;;
3550                         esac
3551                         ;;
3552                 esac
3553                 ;;
3554         *) dflt="$osvers" ;;
3555 esac
3556 rp="Operating system version?"
3557 . ./myread
3558 case "$ans" in
3559 none)  osvers='' ;;
3560 *) osvers="$ans" ;;
3561 esac
3562
3563
3564 . ./posthint.sh
3565
3566 : who configured the system
3567 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3568 case "$cf_by" in
3569 "")
3570         cf_by=`(logname) 2>/dev/null`
3571         case "$cf_by" in
3572         "")
3573                 cf_by=`(whoami) 2>/dev/null`
3574                 case "$cf_by" in
3575                 "") cf_by=unknown ;;
3576                 esac ;;
3577         esac ;;
3578 esac
3579
3580 : decide how portable to be.  Allow command line overrides.
3581 case "$d_portable" in
3582 "$undef") ;;
3583 *)      d_portable="$define" ;;
3584 esac
3585
3586 : set up shell script to do ~ expansion
3587 cat >filexp <<EOSS
3588 $startsh
3589 : expand filename
3590 case "\$1" in
3591  ~/*|~)
3592         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3593         ;;
3594  ~*)
3595         if $test -f /bin/csh; then
3596                 /bin/csh -f -c "glob \$1"
3597                 failed=\$?
3598                 echo ""
3599                 exit \$failed
3600         else
3601                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3602                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3603                 if $test ! -d "\$dir"; then
3604                         me=\`basename \$0\`
3605                         echo "\$me: can't locate home directory for: \$name" >&2
3606                         exit 1
3607                 fi
3608                 case "\$1" in
3609                 */*)
3610                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3611                         ;;
3612                 *)
3613                         echo \$dir
3614                         ;;
3615                 esac
3616         fi
3617         ;;
3618 *)
3619         echo \$1
3620         ;;
3621 esac
3622 EOSS
3623 chmod +x filexp
3624 $eunicefix filexp
3625
3626 : now set up to get a file name
3627 cat <<EOS >getfile
3628 $startsh
3629 EOS
3630 cat <<'EOSC' >>getfile
3631 tilde=''
3632 fullpath=''
3633 already=''
3634 skip=''
3635 none_ok=''
3636 exp_file=''
3637 nopath_ok=''
3638 orig_rp="$rp"
3639 orig_dflt="$dflt"
3640 case "$gfpth" in
3641 '') gfpth='.' ;;
3642 esac
3643
3644 case "$fn" in
3645 *\(*)
3646         : getfile will accept an answer from the comma-separated list
3647         : enclosed in parentheses even if it does not meet other criteria.
3648         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3649         fn=`echo $fn | sed 's/(.*)//'`
3650         ;;
3651 esac
3652
3653 case "$fn" in
3654 *:*)
3655         loc_file=`expr $fn : '.*:\(.*\)'`
3656         fn=`expr $fn : '\(.*\):.*'`
3657         ;;
3658 esac
3659
3660 case "$fn" in
3661 *~*) tilde=true;;
3662 esac
3663 case "$fn" in
3664 */*) fullpath=true;;
3665 esac
3666 case "$fn" in
3667 *+*) skip=true;;
3668 esac
3669 case "$fn" in
3670 *n*) none_ok=true;;
3671 esac
3672 case "$fn" in
3673 *e*) exp_file=true;;
3674 esac
3675 case "$fn" in
3676 *p*) nopath_ok=true;;
3677 esac
3678
3679 case "$fn" in
3680 *f*) type='File';;
3681 *d*) type='Directory';;
3682 *l*) type='Locate';;
3683 esac
3684
3685 what="$type"
3686 case "$what" in
3687 Locate) what='File';;
3688 esac
3689
3690 case "$exp_file" in
3691 '')
3692         case "$d_portable" in
3693         "$define") ;;
3694         *) exp_file=true;;
3695         esac
3696         ;;
3697 esac
3698
3699 cd ..
3700 while test "$type"; do
3701         redo=''
3702         rp="$orig_rp"
3703         dflt="$orig_dflt"
3704         case "$tilde" in
3705         true) rp="$rp (~name ok)";;
3706         esac
3707         . UU/myread
3708         if test -f UU/getfile.ok && \
3709                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3710         then
3711                 value="$ans"
3712                 ansexp="$ans"
3713                 break
3714         fi
3715         case "$ans" in
3716         none)
3717                 value=''
3718                 ansexp=''
3719                 case "$none_ok" in
3720                 true) type='';;
3721                 esac
3722                 ;;
3723         *)
3724                 case "$tilde" in
3725                 '') value="$ans"
3726                         ansexp="$ans";;
3727                 *)
3728                         value=`UU/filexp $ans`
3729                         case $? in
3730                         0)
3731                                 if test "$ans" != "$value"; then
3732                                         echo "(That expands to $value on this system.)"
3733                                 fi
3734                                 ;;
3735                         *) value="$ans";;
3736                         esac
3737                         ansexp="$value"
3738                         case "$exp_file" in
3739                         '') value="$ans";;
3740                         esac
3741                         ;;
3742                 esac
3743                 case "$fullpath" in
3744                 true)
3745                         case "$ansexp" in
3746                         /*) value="$ansexp" ;;
3747                         [a-zA-Z]:/*) value="$ansexp" ;;
3748                         *)
3749                                 redo=true
3750                                 case "$already" in
3751                                 true)
3752                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3753                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3754                                         ;;
3755                                 *)
3756                                 echo "Please give a full path name, starting with slash." >&4
3757                                         case "$tilde" in
3758                                         true)
3759                                 echo "Note that using ~name is ok provided it expands well." >&4
3760                                                 already=true
3761                                                 ;;
3762                                         esac
3763                                 esac
3764                                 ;;
3765                         esac
3766                         ;;
3767                 esac
3768                 case "$redo" in
3769                 '')
3770                         case "$type" in
3771                         File)
3772                                 for fp in $gfpth; do
3773                                         if test "X$fp" = X.; then
3774                                             pf="$ansexp"
3775                                         else    
3776                                             pf="$fp/$ansexp"
3777                                         fi
3778                                         if test -f "$pf"; then
3779                                                 type=''
3780                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3781                                         then
3782                                                 echo "($value is not a plain file, but that's ok.)"
3783                                                 type=''
3784                                         fi
3785                                         if test X"$type" = X; then
3786                                             value="$pf"
3787                                             break
3788                                         fi
3789                                 done
3790                                 ;;
3791                         Directory)
3792                                 for fp in $gfpth; do
3793                                         if test "X$fp" = X.; then
3794                                             dir="$ans"
3795                                             direxp="$ansexp"
3796                                         else    
3797                                             dir="$fp/$ansexp"
3798                                             direxp="$fp/$ansexp"
3799                                         fi
3800                                         if test -d "$direxp"; then
3801                                                 type=''
3802                                                 value="$dir"
3803                                                 break
3804                                         fi
3805                                 done
3806                                 ;;
3807                         Locate)
3808                                 if test -d "$ansexp"; then
3809                                         echo "(Looking for $loc_file in directory $value.)"
3810                                         value="$value/$loc_file"
3811                                         ansexp="$ansexp/$loc_file"
3812                                 fi
3813                                 if test -f "$ansexp"; then
3814                                         type=''
3815                                 fi
3816                                 case "$nopath_ok" in
3817                                 true)   case "$value" in
3818                                         */*) ;;
3819                                         *)      echo "Assuming $value will be in people's path."
3820                                                 type=''
3821                                                 ;;
3822                                         esac
3823                                         ;;
3824                                 esac
3825                                 ;;
3826                         esac
3827
3828                         case "$skip" in
3829                         true) type='';
3830                         esac
3831
3832                         case "$type" in
3833                         '') ;;
3834                         *)
3835                                 if test "$fastread" = yes; then
3836                                         dflt=y
3837                                 else
3838                                         dflt=n
3839                                 fi
3840                                 rp="$what $value doesn't exist.  Use that name anyway?"
3841                                 . UU/myread
3842                                 dflt=''
3843                                 case "$ans" in
3844                                 y*) type='';;
3845                                 *) echo " ";;
3846                                 esac
3847                                 ;;
3848                         esac
3849                         ;;
3850                 esac
3851                 ;;
3852         esac
3853 done
3854 cd UU
3855 ans="$value"
3856 rp="$orig_rp"
3857 dflt="$orig_dflt"
3858 rm -f getfile.ok
3859 test "X$gfpthkeep" != Xy && gfpth=""
3860 EOSC
3861
3862 : determine root of directory hierarchy where package will be installed.
3863 case "$prefix" in
3864 '')
3865         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3866         ;;
3867 *?/)
3868         dflt=`echo "$prefix" | sed 's/.$//'`
3869         ;;
3870 *)
3871         dflt="$prefix"
3872         ;;
3873 esac
3874 $cat <<EOM
3875
3876 By default, $package will be installed in $dflt/bin, manual pages
3877 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3878 installation directories. Typically this is something like /usr/local.
3879 If you wish to have binaries under /usr/bin but other parts of the
3880 installation under /usr/local, that's ok: you will be prompted
3881 separately for each of the installation directories, the prefix being
3882 only used to set the defaults.
3883
3884 EOM
3885 fn=d~
3886 rp='Installation prefix to use?'
3887 . ./getfile
3888 oldprefix=''
3889 case "$prefix" in
3890 '') ;;
3891 *)
3892         case "$ans" in
3893         "$prefix") ;;
3894         *) oldprefix="$prefix";;
3895         esac
3896         ;;
3897 esac
3898 prefix="$ans"
3899 prefixexp="$ansexp"
3900
3901 : allow them to override the AFS root
3902 case "$afsroot" in
3903 '')     afsroot=/afs ;;
3904 *)      afsroot=$afsroot ;;
3905 esac
3906
3907 : is AFS running?
3908 echo " "
3909 case "$afs" in
3910 $define|true)   afs=true ;;
3911 $undef|false)   afs=false ;;
3912 *)      if $test -d $afsroot; then
3913                 afs=true
3914         else
3915                 afs=false
3916         fi
3917         ;;
3918 esac
3919 if $afs; then
3920         echo "AFS may be running... I'll be extra cautious then..." >&4
3921 else
3922         echo "AFS does not seem to be running..." >&4
3923 fi
3924
3925 : determine installation prefix for where package is to be installed.
3926 if $afs; then 
3927 $cat <<EOM
3928
3929 Since you are running AFS, I need to distinguish the directory in which
3930 files will reside from the directory in which they are installed (and from
3931 which they are presumably copied to the former directory by occult means).
3932
3933 EOM
3934         case "$installprefix" in
3935         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3936         *) dflt="$installprefix";;
3937         esac
3938 else
3939 $cat <<EOM
3940
3941 In some special cases, particularly when building $package for distribution,
3942 it is convenient to distinguish the directory in which files should be
3943 installed from the directory ($prefix) in which they will
3944 eventually reside.  For most users, these two directories are the same.
3945
3946 EOM
3947         case "$installprefix" in
3948         '') dflt=$prefix ;;
3949         *) dflt=$installprefix;;
3950         esac
3951 fi
3952 fn=d~
3953 rp='What installation prefix should I use for installing files?'
3954 . ./getfile
3955 installprefix="$ans"
3956 installprefixexp="$ansexp"
3957
3958 : Perform the prefixexp/installprefixexp correction if necessary
3959 cat <<EOS >installprefix
3960 $startsh
3961 EOS
3962 cat <<'EOSC' >>installprefix
3963 : Change installation prefix, if necessary.
3964 if $test X"$prefix" != X"$installprefix"; then
3965     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3966 else
3967     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3968 fi
3969 EOSC
3970 chmod +x installprefix
3971 $eunicefix installprefix
3972
3973 : Set variables such as privlib and privlibexp from the output of ./getfile
3974 : performing the prefixexp/installprefixexp correction if necessary.
3975 cat <<EOS >setprefixvar
3976 $startsh
3977 EOS
3978 cat <<'EOSC' >>setprefixvar
3979 eval "${prefixvar}=\"\$ans\""
3980 eval "${prefixvar}exp=\"\$ansexp\""
3981 . ./installprefix
3982 EOSC
3983 chmod +x setprefixvar
3984 $eunicefix setprefixvar
3985
3986 : set up the script used to warn in case of inconsistency
3987 cat <<EOS >whoa
3988 $startsh
3989 EOS
3990 cat <<'EOSC' >>whoa
3991 dflt=y
3992 case "$hint" in
3993     recommended)
3994         case "$hintfile" in
3995         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3996                 ;;
3997         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3998                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3999                 ;;
4000         esac
4001         ;;
4002     *)  echo " "
4003         echo "*** WHOA THERE!!! ***" >&4
4004         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4005         ;;
4006 esac
4007 rp="    Keep the $hint value?"
4008 . ./myread
4009 case "$ans" in
4010 y) td=$was; tu=$was;;
4011 esac
4012 EOSC
4013
4014 : function used to set $1 to $val
4015 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4016 case "$val$was" in
4017 $define$undef) . ./whoa; eval "$var=\$td";;
4018 $undef$define) . ./whoa; eval "$var=\$tu";;
4019 *) eval "$var=$val";;
4020 esac'
4021
4022 : Check is we will use socks
4023 case "$usesocks" in
4024 $define|true|[yY]*)     dflt='y';;
4025 *) dflt='n';;
4026 esac
4027 cat <<EOM
4028
4029 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4030 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4031 to use the PerlIO abstraction layer, this will be implicitly selected.
4032
4033 If this doesn't make any sense to you, just accept the default '$dflt'.
4034 EOM
4035 rp='Build Perl for SOCKS?'
4036 . ./myread
4037 case "$ans" in
4038 y|Y)    val="$define" ;;
4039 *)      val="$undef" ;;
4040 esac
4041 set usesocks
4042 eval $setvar
4043
4044 case "$usesocks" in
4045 $define|true|[yY]*) useperlio="$define";;
4046 esac
4047
4048 : Check if we want perlio
4049 case "$useperlio" in
4050 $define|true|[yY]*|'')  dflt='y';;
4051 *) dflt='n';;
4052 esac
4053 cat <<EOM
4054
4055 Previous version of $package used the standard IO mechanisms as
4056 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4057 alternate IO mechanisms via the PerlIO abstraction layer, but the
4058 stdio mechanism is still available if needed.  The abstraction layer
4059 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4060 Using PerlIO with sfio may cause problems with some extension modules.
4061
4062 If this doesn't make any sense to you, just accept the default '$dflt'.
4063 EOM
4064 rp='Use the PerlIO abstraction layer?'
4065 . ./myread
4066 case "$ans" in
4067 y|Y)
4068         val="$define"
4069         ;;
4070 *)
4071         echo "Ok, doing things the stdio way."
4072         val="$undef"
4073         ;;
4074 esac
4075 set useperlio
4076 eval $setvar
4077
4078 case "$usesocks" in
4079 $define|true|[yY]*)
4080         case "$useperlio" in
4081         $define|true|[yY]*) ;;
4082         *)      cat >&4 <<EOM
4083
4084 You are using the SOCKS proxy protocol library which means that you
4085 should also use the PerlIO layer.  You may be headed for trouble.
4086
4087 EOM
4088                 ;;
4089         esac
4090         ;;
4091 esac
4092
4093 : get the patchlevel
4094 echo " "
4095 echo "Getting the current patchlevel..." >&4
4096 if $test -r $rsrc/patchlevel.h;then
4097         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4098         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4099         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4100         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4101         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4102         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4103         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4104 else
4105         revision=0
4106         patchlevel=0
4107         subversion=0
4108         api_revision=0
4109         api_version=0
4110         api_subversion=0
4111         perl_patchlevel=0
4112         $echo "(You do not have patchlevel.h.  Eek.)"
4113 fi
4114 if $test -r $rsrc/.patch ; then
4115         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4116                 perl_patchlevel=`cat $rsrc/.patch`
4117         fi
4118 fi
4119 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4120 version_patchlevel_string="version $patchlevel subversion $subversion"
4121 case "$perl_patchlevel" in
4122 0|'') ;;
4123 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4124 esac
4125
4126 $echo "(You have $package $version_patchlevel_string.)"
4127
4128 case "$osname" in
4129 dos|vms)
4130         : XXX Should be a Configure test for double-dots in filenames.
4131         version=`echo $revision $patchlevel $subversion | \
4132                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4133         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4134                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4135         ;;
4136 *)
4137         version=`echo $revision $patchlevel $subversion | \
4138                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4139         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4140                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4141         ;;
4142 esac
4143 : Special case the 5.005_xx maintenance series, which used 5.005
4144 : without any subversion label as a subdirectory in $sitelib
4145 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4146         api_versionstring='5.005'
4147 fi
4148
4149 : Do we want threads support and if so, what type
4150 case "$usethreads" in
4151 $define|true|[yY]*)     dflt='y';;
4152 *)     # Catch case where user specified ithreads or 5005threads but
4153        # forgot -Dusethreads (A.D. 4/2002)
4154        case "$useithreads$use5005threads" in
4155        *$define*)
4156                 case "$useperlio" in
4157                 "$define")      dflt='y' ;;
4158                 *)              dflt='n' ;;
4159                 esac
4160                 ;;
4161        *)       dflt='n';;
4162        esac
4163        ;;
4164 esac
4165 cat <<EOM
4166
4167 Perl can be built to take advantage of threads on some systems.
4168 To do so, Configure can be run with -Dusethreads.
4169
4170 Note that Perl built with threading support runs slightly slower
4171 and uses more memory than plain Perl. The current implementation
4172 is believed to be stable, but it is fairly new, and so should be
4173 treated with caution.
4174
4175 If this doesn't make any sense to you, just accept the default '$dflt'.
4176 EOM
4177 rp='Build a threading Perl?'
4178 . ./myread
4179 case "$ans" in
4180 y|Y)    val="$define" ;;
4181 *)      val="$undef" ;;
4182 esac
4183 set usethreads
4184 eval $setvar
4185
4186 if $test $patchlevel -lt 9; then
4187     case "$usethreads" in
4188     $define)
4189         $cat <<EOM
4190
4191 Since release 5.6, Perl has had two different threading implementations,
4192 the newer interpreter-based version (ithreads) with one interpreter per
4193 thread, and the older 5.005 version (5005threads).
4194 The 5005threads version is effectively unmaintained and will probably be
4195 removed in Perl 5.10, so there should be no need to build a Perl using it
4196 unless needed for backwards compatibility with some existing 5.005threads
4197 code.
4198
4199 EOM
4200         : Default to ithreads unless overridden on command line or with
4201         : old config.sh
4202         dflt='y'
4203         case "$use5005threads" in
4204                 $define|true|[yY]*) dflt='n';;
4205         esac
4206         case "$useithreads" in
4207                 $undef|false|[nN]*) dflt='n';;
4208         esac
4209         rp='Use the newer interpreter-based ithreads?'
4210         . ./myread
4211         case "$ans" in
4212         y|Y)    val="$define" ;;
4213         *)      val="$undef" ;;
4214         esac
4215         set useithreads
4216         eval $setvar
4217         : Now set use5005threads to the opposite value.
4218         case "$useithreads" in
4219         $define) val="$undef" ;;
4220         *) val="$define" ;;
4221         esac
4222         set use5005threads
4223         eval $setvar
4224         ;;
4225     *)
4226         useithreads="$undef"
4227         use5005threads="$undef"
4228         ;;
4229     esac
4230
4231     case "$useithreads$use5005threads" in
4232     "$define$define")
4233         $cat >&4 <<EOM
4234
4235 You cannot have both the ithreads and the 5.005 threads enabled
4236 at the same time.  Disabling the 5.005 threads since they are
4237 much less stable than the ithreads.
4238
4239 EOM
4240         use5005threads="$undef"
4241         ;;
4242     esac
4243
4244 else
4245 : perl-5.9.x and later
4246
4247     if test X"$usethreads" = "X$define"; then
4248         case "$use5005threads" in
4249             $define|true|[yY]*)
4250                 $cat >&4 <<EOM
4251
4252 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4253
4254 EOM
4255             ;;
4256         esac
4257     fi
4258
4259     use5005threads="$undef"
4260     useithreads="$usethreads"
4261 fi
4262
4263 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4264         cat >&4 <<EOF
4265 ***
4266 *** To build with ithreads you must also use the PerlIO layer.
4267 *** Cannot continue, aborting.
4268 ***
4269 EOF
4270         exit 1
4271 fi
4272
4273 case "$d_oldpthreads" in
4274 '')     : Configure tests would be welcome here.  For now, assume undef.
4275         val="$undef" ;;
4276 *)      val="$d_oldpthreads" ;;
4277 esac
4278 set d_oldpthreads
4279 eval $setvar
4280
4281
4282 : Look for a hint-file generated 'call-back-unit'.  If the
4283 : user has specified that a threading perl is to be built,
4284 : we may need to set or change some other defaults.
4285 if $test -f usethreads.cbu; then
4286     echo "Your platform has some specific hints regarding threaded builds, using them..."
4287     . ./usethreads.cbu
4288 else
4289     case "$usethreads" in
4290         "$define"|true|[yY]*)
4291                 $cat <<EOM
4292 (Your platform does not have any specific hints for threaded builds.
4293  Assuming POSIX threads, then.)
4294 EOM
4295         ;;
4296     esac
4297 fi
4298
4299 : Check if multiplicity is required
4300 cat <<EOM
4301
4302 Perl can be built so that multiple Perl interpreters can coexist
4303 within the same Perl executable.
4304 EOM
4305
4306 case "$useithreads" in
4307 $define)
4308         cat <<EOM
4309 This multiple interpreter support is required for interpreter-based threads.
4310 EOM
4311         val="$define"
4312         ;;
4313 *)      case "$usemultiplicity" in
4314         $define|true|[yY]*)     dflt='y';;
4315         *) dflt='n';;
4316         esac
4317         echo " "
4318         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4319         rp='Build Perl for multiplicity?'
4320         . ./myread
4321         case "$ans" in
4322         y|Y)    val="$define" ;;
4323         *)      val="$undef" ;;
4324         esac
4325         ;;
4326 esac
4327 set usemultiplicity
4328 eval $setvar
4329
4330 : Check if morebits is requested
4331 case "$usemorebits" in
4332 "$define"|true|[yY]*)
4333         use64bitint="$define"
4334         uselongdouble="$define"
4335         usemorebits="$define"
4336         ;;
4337 *)      usemorebits="$undef"
4338         ;;
4339 esac
4340
4341 : Determine the C compiler to be used
4342 echo " "
4343 case "$cc" in
4344 '') dflt=cc;;
4345 *) dflt="$cc";;
4346 esac
4347 rp="Use which C compiler?"
4348 . ./myread
4349 cc="$ans"
4350
4351 : See whether they have no cc but they do have gcc
4352 . ./trygcc
4353 if $test -f cc.cbu; then
4354     . ./cc.cbu
4355 fi
4356 . ./checkcc
4357
4358 : make some quick guesses about what we are up against
4359 echo " "
4360 $echo $n "Hmm...  $c"
4361 echo exit 1 >bsd
4362 echo exit 1 >usg
4363 echo exit 1 >v7
4364 echo exit 1 >osf1
4365 echo exit 1 >eunice
4366 echo exit 1 >xenix
4367 echo exit 1 >venix
4368 echo exit 1 >os2
4369 d_bsd="$undef"
4370 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4371 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4372 then
4373         echo "Looks kind of like an OSF/1 system, but we'll see..."
4374         echo exit 0 >osf1
4375 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4376         xxx=`./loc addbib blurfl $pth`
4377         if $test -f $xxx; then
4378         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4379                 echo exit 0 >bsd
4380                 echo exit 0 >usg
4381         else
4382                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4383                         echo "Looks kind of like an extended USG system, but we'll see..."
4384                 else
4385                         echo "Looks kind of like a USG system, but we'll see..."
4386                 fi
4387                 echo exit 0 >usg
4388         fi
4389 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4390         echo "Looks kind of like a BSD system, but we'll see..."
4391         d_bsd="$define"
4392         echo exit 0 >bsd
4393 else
4394         echo "Looks kind of like a Version 7 system, but we'll see..."
4395         echo exit 0 >v7
4396 fi
4397 case "$eunicefix" in
4398 *unixtovms*)
4399         $cat <<'EOI'
4400 There is, however, a strange, musty smell in the air that reminds me of
4401 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4402 EOI
4403         echo exit 0 >eunice
4404         d_eunice="$define"
4405 : it so happens the Eunice I know will not run shell scripts in Unix format
4406         ;;
4407 *)
4408         echo " "
4409         echo "Congratulations.  You aren't running Eunice."
4410         d_eunice="$undef"
4411         ;;
4412 esac
4413 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4414 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4415 : semicolon as a patch separator
4416 case "$p_" in
4417 :) ;;
4418 *)
4419         $cat <<'EOI'
4420 I have the feeling something is not exactly right, however...don't tell me...
4421 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4422 (Or you may be running DOS with DJGPP.)
4423 EOI
4424         echo exit 0 >os2
4425         ;;
4426 esac
4427 if test -f /xenix; then
4428         echo "Actually, this looks more like a XENIX system..."
4429         echo exit 0 >xenix
4430         d_xenix="$define"
4431 else
4432         echo " "
4433         echo "It's not Xenix..."
4434         d_xenix="$undef"
4435 fi
4436 chmod +x xenix
4437 $eunicefix xenix
4438 if test -f /venix; then
4439         echo "Actually, this looks more like a VENIX system..."
4440         echo exit 0 >venix
4441 else
4442         echo " "
4443         if ./xenix; then
4444                 : null
4445         else
4446                 echo "Nor is it Venix..."
4447         fi
4448 fi
4449 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4450 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4451 $rm -f foo
4452
4453 : Check if we are using GNU gcc and what its version is
4454 echo " "
4455 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4456 $cat >try.c <<EOM
4457 #include <stdio.h>
4458 int main() {
4459 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4460 #ifdef __VERSION__
4461         printf("%s\n", __VERSION__);
4462 #else
4463         printf("%s\n", "1");
4464 #endif
4465 #endif
4466         return(0);
4467 }
4468 EOM
4469 if $cc -o try $ccflags $ldflags try.c; then
4470         gccversion=`$run ./try`
4471         case "$gccversion" in
4472         '') echo "You are not using GNU cc." ;;
4473         *)  echo "You are using GNU cc $gccversion."
4474             ccname=gcc
4475             ;;
4476         esac
4477 else
4478         echo " "
4479         echo "*** WHOA THERE!!! ***" >&4
4480         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4481         case "$knowitall" in
4482         '')
4483         echo "    You'd better start hunting for one and let me know about it." >&4
4484                 exit 1
4485                 ;;
4486         esac
4487 fi
4488 $rm -f try try.*
4489 case "$gccversion" in
4490 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4491 esac
4492 case "$gccversion" in
4493 '') gccosandvers='' ;;
4494 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4495    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4496    gccshortvers=''
4497    case "$gccosandvers" in
4498    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4499    $osname$osvers) ;; # looking good
4500    $osname*) cat <<EOM >&4
4501
4502 *** WHOA THERE!!! ***
4503
4504     Your gcc has not been compiled for the exact release of
4505     your operating system ($gccosandvers versus $osname$osvers).
4506
4507     In general it is a good idea to keep gcc synchronized with
4508     the operating system because otherwise serious problems
4509     may ensue when trying to compile software, like Perl.
4510
4511     I'm trying to be optimistic here, though, and will continue.
4512     If later during the configuration and build icky compilation
4513     problems appear (headerfile conflicts being the most common
4514     manifestation), I suggest reinstalling the gcc to match
4515     your operating system release.
4516
4517 EOM
4518       ;;
4519    *) gccosandvers='' ;; # failed to parse, better be silent
4520    esac
4521    ;;
4522 esac
4523 case "$ccname" in
4524 '') ccname="$cc" ;;
4525 esac
4526
4527 # gcc 3.* complain about adding -Idirectories that they already know about,
4528 # so we will take those off from locincpth.
4529 case "$gccversion" in
4530 3*)
4531     echo "main(){}">try.c
4532     for incdir in $locincpth; do
4533        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4534              grep '^c[cp]p*[01]: warning: changing search order '`
4535        if test "X$warn" != X; then
4536            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4537        fi
4538     done
4539     $rm -f try try.*
4540 esac
4541
4542 : What should the include directory be ?
4543 echo " "
4544 $echo $n "Hmm...  $c"
4545 dflt='/usr/include'
4546 incpath=''
4547 mips_type=''
4548 if $test -f /bin/mips && /bin/mips; then
4549         echo "Looks like a MIPS system..."
4550         $cat >usr.c <<'EOCP'
4551 #ifdef SYSTYPE_BSD43
4552 /bsd43
4553 #endif
4554 EOCP
4555         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4556                 dflt='/bsd43/usr/include'
4557                 incpath='/bsd43'
4558                 mips_type='BSD 4.3'
4559         else
4560                 mips_type='System V'
4561         fi
4562         $rm -f usr.c usr.out
4563         echo "and you're compiling with the $mips_type compiler and libraries."
4564         xxx_prompt=y
4565         echo "exit 0" >mips
4566 else
4567         echo "Doesn't look like a MIPS system."
4568         xxx_prompt=n
4569         echo "exit 1" >mips
4570 fi
4571 chmod +x mips
4572 $eunicefix mips
4573 case "$usrinc" in
4574 '') ;;
4575 *) dflt="$usrinc";;
4576 esac
4577 case "$xxx_prompt" in
4578 y)      fn=d/
4579         echo " "
4580         rp='Where are the include files you want to use?'
4581         . ./getfile
4582         usrinc="$ans"
4583         ;;
4584 *)      usrinc="$dflt"
4585         ;;
4586 esac
4587
4588 : see how we invoke the C preprocessor
4589 echo " "
4590 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4591 cat <<'EOT' >testcpp.c
4592 #define ABC abc
4593 #define XYZ xyz
4594 ABC.XYZ
4595 EOT
4596 cd ..
4597 if test ! -f cppstdin; then
4598         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4599                 # AIX cc -E doesn't show the absolute headerfile
4600                 # locations but we'll cheat by using the -M flag.
4601                 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
4602         else
4603                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4604         fi
4605 else
4606         echo "Keeping your $hint cppstdin wrapper."
4607 fi
4608 chmod 755 cppstdin
4609 wrapper=`pwd`/cppstdin
4610 ok='false'
4611 cd UU
4612
4613 if $test "X$cppstdin" != "X" && \
4614         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4615         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4616 then
4617         echo "You used to use $cppstdin $cppminus so we'll use that again."
4618         case "$cpprun" in
4619         '') echo "But let's see if we can live without a wrapper..." ;;
4620         *)
4621                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4622                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4623                 then
4624                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4625                         ok='true'
4626                 else
4627                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4628                 fi
4629                 ;;
4630         esac
4631 else
4632         case "$cppstdin" in
4633         '') ;;
4634         *)
4635                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4636                 ;;
4637         esac
4638 fi
4639
4640 if $ok; then
4641         : nothing
4642 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4643         $cc -E <testcpp.c >testcpp.out 2>&1; \
4644         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4645         echo "Yup, it does."
4646         x_cpp="$cc -E"
4647         x_minus='';
4648 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4649         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4650         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4651         echo "Yup, it does."
4652         x_cpp="$cc -E"
4653         x_minus='-';
4654 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4655         $cc -P <testcpp.c >testcpp.out 2>&1; \
4656         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4657         echo "Yipee, that works!"
4658         x_cpp="$cc -P"
4659         x_minus='';
4660 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4661         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4662         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4663         echo "At long last!"
4664         x_cpp="$cc -P"
4665         x_minus='-';
4666 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4667         $cpp <testcpp.c >testcpp.out 2>&1; \
4668         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4669         echo "It works!"
4670         x_cpp="$cpp"
4671         x_minus='';
4672 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4673         $cpp - <testcpp.c >testcpp.out 2>&1; \
4674         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4675         echo "Hooray, it works!  I was beginning to wonder."
4676         x_cpp="$cpp"
4677         x_minus='-';
4678 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4679         $wrapper <testcpp.c >testcpp.out 2>&1; \
4680         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4681         x_cpp="$wrapper"
4682         x_minus=''
4683         echo "Eureka!"
4684 else
4685         dflt=''
4686         rp="No dice.  I can't find a C preprocessor.  Name one:"
4687         . ./myread
4688         x_cpp="$ans"
4689         x_minus=''
4690         $x_cpp <testcpp.c >testcpp.out 2>&1
4691         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4692                 echo "OK, that will do." >&4
4693         else
4694 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4695                 exit 1
4696         fi
4697 fi
4698
4699 case "$ok" in
4700 false)
4701         cppstdin="$x_cpp"
4702         cppminus="$x_minus"
4703         cpprun="$x_cpp"
4704         cpplast="$x_minus"
4705         set X $x_cpp
4706         shift
4707         case "$1" in
4708         "$cpp")
4709                 echo "Perhaps can we force $cc -E using a wrapper..."
4710                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4711                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4712                 then
4713                         echo "Yup, we can."
4714                         cppstdin="$wrapper"
4715                         cppminus='';
4716                 else
4717                         echo "Nope, we'll have to live without it..."
4718                 fi
4719                 ;;
4720         esac
4721         case "$cpprun" in
4722         "$wrapper")
4723                 cpprun=''
4724                 cpplast=''
4725                 ;;
4726         esac
4727         ;;
4728 esac
4729
4730 case "$cppstdin" in
4731 "$wrapper"|'cppstdin') ;;
4732 *) $rm -f $wrapper;;
4733 esac
4734 $rm -f testcpp.c testcpp.out
4735
4736 : Set private lib path
4737 case "$plibpth" in
4738 '') if ./mips; then
4739                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4740         fi;;
4741 esac
4742 case "$libpth" in
4743 ' ') dlist='';;
4744 '') dlist="$loclibpth $plibpth $glibpth";;
4745 *) dlist="$libpth";;
4746 esac
4747
4748 : Now check and see which directories actually exist, avoiding duplicates
4749 libpth=''
4750 for xxx in $dlist
4751 do
4752     if $test -d $xxx; then
4753                 case " $libpth " in
4754                 *" $xxx "*) ;;
4755                 *) libpth="$libpth $xxx";;
4756                 esac
4757     fi
4758 done
4759 $cat <<'EOM'
4760
4761 Some systems have incompatible or broken versions of libraries.  Among
4762 the directories listed in the question below, please remove any you
4763 know not to be holding relevant libraries, and add any that are needed.
4764 Say "none" for none.
4765
4766 EOM
4767 case "$libpth" in
4768 '') dflt='none';;
4769 *)
4770         set X $libpth
4771         shift
4772         dflt=${1+"$@"}
4773         ;;
4774 esac
4775 rp="Directories to use for library searches?"
4776 . ./myread
4777 case "$ans" in
4778 none) libpth=' ';;
4779 *) libpth="$ans";;
4780 esac
4781
4782 : compute shared library extension
4783 case "$so" in
4784 '')
4785         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4786                 dflt='sl'
4787         else
4788                 dflt='so'
4789         fi
4790         ;;
4791 *) dflt="$so";;
4792 esac
4793 $cat <<EOM
4794
4795 On some systems, shared libraries may be available.  Answer 'none' if
4796 you want to suppress searching of shared libraries for the remainder
4797 of this configuration.
4798
4799 EOM
4800 rp='What is the file extension used for shared libraries?'
4801 . ./myread
4802 so="$ans"
4803
4804 : Define several unixisms.
4805 : Hints files or command line option can be used to override them.
4806 : The convoluted testing is in case hints files set either the old
4807 : or the new name.
4808 case "$_exe" in
4809 '')     case "$exe_ext" in
4810         '')     ;;
4811         *)      _exe="$exe_ext" ;;
4812         esac
4813         ;;
4814 esac
4815 case "$_a" in
4816 '')     case "$lib_ext" in
4817     '') _a='.a';;
4818         *)      _a="$lib_ext" ;;
4819         esac
4820         ;;
4821 esac
4822 case "$_o" in
4823 '') case "$obj_ext" in
4824         '')     _o='.o';;
4825         *)      _o="$obj_ext";;
4826         esac
4827         ;;
4828 esac
4829 case "$p_" in
4830 '') case "$path_sep" in
4831         '')     p_=':';;
4832         *)      p_="$path_sep";;
4833         esac
4834         ;;
4835 esac
4836 exe_ext=$_exe
4837 lib_ext=$_a
4838 obj_ext=$_o
4839 path_sep=$p_
4840
4841 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4842
4843 : Which makefile gets called first.  This is used by make depend.
4844 case "$firstmakefile" in
4845 '') firstmakefile='makefile';;
4846 esac
4847
4848 : Check for uselongdouble support
4849 case "$ccflags" in
4850 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4851 esac
4852
4853 case "$uselongdouble" in
4854 $define|true|[yY]*)     dflt='y';;
4855 *) dflt='n';;
4856 esac
4857 cat <<EOM
4858
4859 Perl can be built to take advantage of long doubles which
4860 (if available) may give more accuracy and range for floating point numbers.
4861
4862 If this doesn't make any sense to you, just accept the default '$dflt'.
4863 EOM
4864 rp='Try to use long doubles if available?'
4865 . ./myread
4866 case "$ans" in
4867 y|Y)    val="$define"   ;;
4868 *)      val="$undef"    ;;
4869 esac
4870 set uselongdouble
4871 eval $setvar
4872
4873 case "$uselongdouble" in
4874 true|[yY]*) uselongdouble="$define" ;;
4875 esac
4876
4877 : Look for a hint-file generated 'call-back-unit'.  If the
4878 : user has specified that long doubles should be used,
4879 : we may need to set or change some other defaults.
4880 if $test -f uselongdouble.cbu; then
4881     echo "Your platform has some specific hints regarding long doubles, using them..."
4882     . ./uselongdouble.cbu
4883 else
4884     case "$uselongdouble" in
4885         $define)
4886                 $cat <<EOM
4887 (Your platform does not have any specific hints for long doubles.)
4888 EOM
4889         ;;
4890     esac
4891 fi
4892
4893 : Looking for optional libraries
4894 echo " "
4895 echo "Checking for optional libraries..." >&4
4896 case "$libs" in
4897 ' '|'') dflt='';;
4898 *) dflt="$libs";;
4899 esac
4900 case "$libswanted" in
4901 '') libswanted='c_s';;
4902 esac
4903 case "$usesocks" in
4904 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4905 esac
4906 libsfound=''
4907 libsfiles=''
4908 libsdirs=''
4909 libspath=''
4910 for thisdir in $libpth $xlibpth; do
4911   test -d $thisdir && libspath="$libspath $thisdir"
4912 done
4913 for thislib in $libswanted; do
4914         for thisdir in $libspath; do
4915             xxx=''
4916             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4917                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4918                 $test -f "$xxx" && eval $libscheck
4919                 $test -f "$xxx" && libstyle=shared
4920             fi
4921             if test ! -f "$xxx"; then
4922                 xxx=$thisdir/lib$thislib.$so
4923                 $test -f "$xxx" && eval $libscheck
4924                 $test -f "$xxx" && libstyle=shared
4925             fi
4926             if test ! -f "$xxx"; then
4927                 xxx=$thisdir/lib$thislib$_a
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=static
4930             fi
4931             if test ! -f "$xxx"; then
4932                 xxx=$thisdir/$thislib$_a
4933                 $test -f "$xxx" && eval $libscheck
4934                 $test -f "$xxx" && libstyle=static
4935             fi
4936             if test ! -f "$xxx"; then
4937                 xxx=$thisdir/lib${thislib}_s$_a
4938                 $test -f "$xxx" && eval $libscheck
4939                 $test -f "$xxx" && libstyle=static
4940                 $test -f "$xxx" && thislib=${thislib}_s
4941             fi
4942             if test ! -f "$xxx"; then
4943                 xxx=$thisdir/Slib$thislib$_a
4944                 $test -f "$xxx" && eval $libscheck
4945                 $test -f "$xxx" && libstyle=static
4946             fi
4947             if $test -f "$xxx"; then
4948                 case "$libstyle" in
4949                 shared) echo "Found -l$thislib (shared)." ;;
4950                 static) echo "Found -l$thislib." ;;
4951                 *)      echo "Found -l$thislib ($libstyle)." ;;
4952                 esac
4953                 case " $dflt " in
4954                 *"-l$thislib "*);;
4955                 *) dflt="$dflt -l$thislib"
4956                    libsfound="$libsfound $xxx"
4957                    yyy=`basename $xxx`
4958                    libsfiles="$libsfiles $yyy"
4959                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4960                    case " $libsdirs " in
4961                    *" $yyy "*) ;;
4962                    *) libsdirs="$libsdirs $yyy" ;;
4963                    esac
4964                    ;;
4965                 esac
4966                 break
4967             fi
4968         done
4969         if $test ! -f "$xxx"; then
4970             echo "No -l$thislib."
4971         fi
4972 done
4973 set X $dflt
4974 shift
4975 dflt="$*"
4976 case "$libs" in
4977 '') dflt="$dflt";;
4978 *) dflt="$libs";;
4979 esac
4980 case "$dflt" in
4981 ' '|'') dflt='none';;
4982 esac
4983
4984 $cat <<EOM
4985
4986 In order to compile $package on your machine, a number of libraries
4987 are usually needed.  Include any other special libraries here as well.
4988 Say "none" for none.  The default list is almost always right.
4989 EOM
4990
4991 echo " "
4992 rp="What libraries to use?"
4993 . ./myread
4994 case "$ans" in
4995 none) libs=' ';;
4996 *) libs="$ans";;
4997 esac
4998
4999 : determine optimization, if desired, or use for debug flag also
5000 case "$optimize" in
5001 ' '|$undef) dflt='none';;
5002 '') dflt='-O';;
5003 *) dflt="$optimize";;
5004 esac
5005 $cat <<EOH
5006
5007 By default, $package compiles with the -O flag to use the optimizer.
5008 Alternately, you might want to use the symbolic debugger, which uses
5009 the -g flag (on traditional Unix systems).  Either flag can be
5010 specified here.  To use neither flag, specify the word "none".
5011
5012 EOH
5013 rp="What optimizer/debugger flag should be used?"
5014 . ./myread
5015 optimize="$ans"
5016 case "$optimize" in
5017 'none') optimize=" ";;
5018 esac
5019
5020 : Check what DEBUGGING is required from the command line
5021 : -DEBUGGING      or -DDEBUGGING or
5022 : -DEBUGGING=both                       = -g + -DDEBUGGING
5023 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5024 : -DEBUGGING=none or -UDEBUGGING        =
5025 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5026 case "$EBUGGING" in
5027 '')     ;;
5028 *)      DEBUGGING=$EBUGGING ;;
5029 esac
5030
5031 case "$DEBUGGING" in
5032 -g|both|$define)
5033     case "$optimize" in
5034         *-g*) ;;
5035         *)    optimize="$optimize -g" ;;
5036     esac ;;
5037 none|$undef)
5038     case "$optimize" in
5039         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5040                 shift
5041                 optimize="$*"
5042                 ;;
5043     esac ;;
5044 esac
5045
5046 dflt=''
5047 case "$DEBUGGING" in
5048 both|$define) dflt='-DDEBUGGING'
5049 esac
5050
5051 : argument order is deliberate, as the flag will start with - which set could
5052 : think is an option
5053 checkccflag='check=$1; flag=$2; callback=$3;
5054 echo " ";
5055 echo "Checking if your compiler accepts $flag" 2>&1;
5056 echo "int main(void) { return 0; }" > gcctest.c;
5057 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5058     echo "Yes, it does." 2>&1;
5059     if $test -s gcctest.out ; then
5060         echo "But your platform does not like it:";
5061         cat gcctest.out;
5062     else
5063         case "$ccflags" in
5064         *$check*)
5065             echo "Leaving current flags $ccflags alone." 2>&1
5066             ;;
5067         *) dflt="$dflt $flag";
5068             eval $callback
5069             ;;
5070         esac
5071     fi
5072 else
5073     echo "Nope, it does not, but that is ok." 2>&1;
5074 fi
5075 '
5076
5077 : We will not override a previous value, but we might want to
5078 : augment a hint file
5079 case "$hint" in
5080 default|recommended)
5081         case "$gccversion" in
5082         1*) dflt="$dflt -fpcc-struct-return" ;;
5083         esac
5084         case "$optimize:$DEBUGGING" in
5085         *-g*:old) dflt="$dflt -DDEBUGGING";;
5086         esac
5087         case "$gccversion" in
5088         2*) if $test -d /etc/conf/kconfig.d &&
5089                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5090                 then
5091                         # Interactive Systems (ISC) POSIX mode.
5092                         dflt="$dflt -posix"
5093                 fi
5094                 ;;
5095         esac
5096         case "$gccversion" in
5097         1*) ;;
5098         2.[0-8]*) ;;
5099         ?*)     set strict-aliasing -fno-strict-aliasing
5100                 eval $checkccflag
5101                 ;;
5102         esac
5103         # For gcc, adding -pipe speeds up compilations for some, but apparently
5104         # some assemblers can't read from stdin.  (It also slows down compilations
5105         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5106         case "$gccversion" in
5107         ?*)     set pipe -pipe
5108                 eval $checkccflag
5109                 ;;
5110         esac
5111
5112         # on x86_64 (at least) we require an extra library (libssp) in the
5113         # link command line. This library is not named, so I infer that it is
5114         # an implementation detail that may change. Hence the safest approach
5115         # is to add the flag to the flags passed to the compiler at link time,
5116         # as that way the compiler can do the right implementation dependant
5117         # thing. (NWC)
5118         case "$gccversion" in
5119         ?*)     set stack-protector -fstack-protector 'ldflags="$ldflags -fstack-protector"'
5120                 eval $checkccflag
5121                 ;;
5122         esac
5123         ;;
5124 esac
5125
5126 case "$mips_type" in
5127 *BSD*|'') inclwanted="$locincpth $usrinc";;
5128 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5129 esac
5130 for thisincl in $inclwanted; do
5131         if $test -d $thisincl; then
5132                 if $test x$thisincl != x$usrinc; then
5133                         case "$dflt" in
5134                         *" -I$thisincl "*);;
5135                         *) dflt="$dflt -I$thisincl ";;
5136                         esac
5137                 fi
5138         fi
5139 done
5140
5141 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5142         xxx=true;
5143 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5144         xxx=true;
5145 else
5146         xxx=false;
5147 fi;
5148 if $xxx; then
5149         case "$dflt" in
5150         *$2*);;
5151         *) dflt="$dflt -D$2";;
5152         esac;
5153 fi'
5154
5155 set signal.h LANGUAGE_C; eval $inctest
5156
5157 case "$usesocks" in
5158 $define)
5159         ccflags="$ccflags -DSOCKS"
5160         ;;
5161 esac
5162
5163 case "$hint" in
5164 default|recommended) dflt="$ccflags $dflt" ;;
5165 *) dflt="$ccflags";;
5166 esac
5167
5168 case "$dflt" in
5169 ''|' ') dflt=none;;
5170 esac
5171
5172 $cat <<EOH
5173
5174 Your C compiler may want other flags.  For this question you should include
5175 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5176 but you should NOT include libraries or ld flags like -lwhatever.  If you
5177 want $package to honor its debug switch, you should include -DDEBUGGING here.
5178 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5179
5180 To use no flags, specify the word "none".
5181
5182 EOH
5183 set X $dflt
5184 shift
5185 dflt=${1+"$@"}
5186 rp="Any additional cc flags?"
5187 . ./myread
5188 case "$ans" in
5189 none) ccflags='';;
5190 *) ccflags="$ans";;
5191 esac
5192
5193 : the following weeds options from ccflags that are of no interest to cpp
5194 case "$cppflags" in
5195 '') cppflags="$ccflags" ;;
5196 *)  cppflags="$cppflags $ccflags" ;;
5197 esac
5198 case "$gccversion" in
5199 1*) cppflags="$cppflags -D__GNUC__"
5200 esac
5201 case "$mips_type" in
5202 '');;
5203 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5204 esac
5205 case "$cppflags" in
5206 '');;
5207 *)
5208         echo " "
5209         echo "Let me guess what the preprocessor flags are..." >&4
5210         set X $cppflags
5211         shift
5212         cppflags=''
5213         $cat >cpp.c <<'EOM'
5214 #define BLURFL foo
5215
5216 BLURFL xx LFRULB
5217 EOM
5218         previous=''
5219         for flag in $*
5220         do
5221                 case "$flag" in
5222                 -*) ftry="$flag";;
5223                 *) ftry="$previous $flag";;
5224                 esac
5225                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5226                         >cpp1.out 2>/dev/null && \
5227                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5228                         >cpp2.out 2>/dev/null && \
5229                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5230                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5231                 then
5232                         cppflags="$cppflags $ftry"
5233                         previous=''
5234                 else
5235                         previous="$flag"
5236                 fi
5237         done
5238         set X $cppflags
5239         shift
5240         cppflags=${1+"$@"}
5241         case "$cppflags" in
5242         *-*)  echo "They appear to be: $cppflags";;
5243         esac
5244         $rm -f cpp.c cpp?.out
5245         ;;
5246 esac
5247
5248 : flags used in final linking phase
5249 case "$ldflags" in
5250 '') if ./venix; then
5251                 dflt='-i -z'
5252         else
5253                 dflt=''
5254         fi
5255         case "$ccflags" in
5256         *-posix*) dflt="$dflt -posix" ;;
5257         esac
5258         ;;
5259 *) dflt="$ldflags";;
5260 esac
5261
5262 : Try to guess additional flags to pick up local libraries.
5263 for thislibdir in $libpth; do
5264         case " $loclibpth " in
5265         *" $thislibdir "*)
5266                 case "$dflt " in
5267                 *"-L$thislibdir "*) ;;
5268                 *)  dflt="$dflt -L$thislibdir" ;;
5269                 esac
5270                 ;;
5271         esac
5272 done
5273
5274 case "$dflt" in
5275 '') dflt='none' ;;
5276 esac
5277
5278 $cat <<EOH
5279
5280 Your C linker may need flags.  For this question you should
5281 include -L/whatever and any other flags used by the C linker, but you
5282 should NOT include libraries like -lwhatever.
5283
5284 Make sure you include the appropriate -L/path flags if your C linker
5285 does not normally search all of the directories you specified above,
5286 namely
5287         $libpth
5288 To use no flags, specify the word "none".
5289
5290 EOH
5291
5292 rp="Any additional ld flags (NOT including libraries)?"
5293 . ./myread
5294 case "$ans" in
5295 none) ldflags='';;
5296 *) ldflags="$ans";;
5297 esac
5298 rmlist="$rmlist pdp11"
5299
5300 : coherency check
5301 echo " "
5302 echo "Checking your choice of C compiler and flags for coherency..." >&4
5303 $cat > try.c <<'EOF'
5304 #include <stdio.h>
5305 int main() { printf("Ok\n"); return(0); }
5306 EOF
5307 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5308 shift
5309 $cat >try.msg <<'EOM'
5310 I've tried to compile and run the following simple program:
5311
5312 EOM
5313 $cat try.c >> try.msg
5314
5315 $cat >> try.msg <<EOM
5316
5317 I used the command:
5318
5319         $*
5320         $run ./try
5321
5322 and I got the following output:
5323
5324 EOM
5325 dflt=y
5326 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5327         if $sh -c "$run ./try " >>try.msg 2>&1; then
5328                 xxx=`$run ./try`
5329                 case "$xxx" in
5330                 "Ok") dflt=n ;;
5331                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5332                         case " $libs " in
5333                         *" -lsfio "*)
5334                                 cat >> try.msg <<'EOQS'
5335 If $libs contains -lsfio, and sfio is mis-configured, then it
5336 sometimes (apparently) runs and exits with a 0 status, but with no
5337 output!  It may have to do with sfio's use of _exit vs. exit.
5338
5339 EOQS
5340                                 rp="You have a big problem.  Shall I abort Configure"
5341                                 dflt=y
5342                                 ;;
5343                         esac
5344                         ;;
5345                 esac
5346         else
5347                 echo "The program compiled OK, but exited with status $?." >>try.msg
5348                 rp="You have a problem.  Shall I abort Configure"
5349                 dflt=y
5350         fi
5351 else
5352         echo "I can't compile the test program." >>try.msg
5353         rp="You have a BIG problem.  Shall I abort Configure"
5354         dflt=y
5355 fi
5356 case "$dflt" in
5357 y)
5358         $cat try.msg >&4
5359         case "$knowitall" in
5360         '')
5361                 echo "(The supplied flags or libraries might be incorrect.)"
5362                 ;;
5363         *) dflt=n;;
5364         esac
5365         echo " "
5366         . ./myread
5367         case "$ans" in
5368         n*|N*) ;;
5369         *)      echo "Ok.  Stopping Configure." >&4
5370                 exit 1
5371                 ;;
5372         esac
5373         ;;
5374 n) echo "OK, that should do.";;
5375 esac
5376 $rm_try gcctest gcctest.out
5377
5378 : define a shorthand compile call
5379 compile='
5380 mc_file=$1;
5381 shift;
5382 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5383 : define a shorthand compile call for compilations that should be ok.
5384 compile_ok='
5385 mc_file=$1;
5386 shift;
5387 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5388
5389 : determine filename position in cpp output
5390 echo " "
5391 echo "Computing filename position in cpp output for #include directives..." >&4
5392 case "$osname" in
5393 vos) testaccess=-e ;;
5394 *)   testaccess=-r ;;
5395 esac
5396 echo '#include <stdio.h>' > foo.c
5397 $cat >fieldn <<EOF
5398 $startsh
5399 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5400 $grep '^[       ]*#.*stdio\.h' | \
5401 while read cline; do
5402         pos=1
5403         set \$cline
5404         while $test \$# -gt 0; do
5405                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5406                         echo "\$pos"
5407                         exit 0
5408                 fi
5409                 shift
5410                 pos=\`expr \$pos + 1\`
5411         done
5412 done
5413 EOF
5414 chmod +x fieldn
5415 fieldn=`./fieldn`
5416 $rm -f foo.c fieldn
5417 case $fieldn in
5418 '') pos='???';;
5419 1) pos=first;;
5420 2) pos=second;;
5421 3) pos=third;;
5422 *) pos="${fieldn}th";;
5423 esac
5424 echo "Your cpp writes the filename in the $pos field of the line."
5425
5426 case "$osname" in
5427 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5428 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5429 *)   cppfilter='' ;;
5430 esac
5431 : locate header file
5432 $cat >findhdr <<EOF
5433 $startsh
5434 wanted=\$1
5435 name=''
5436 for usrincdir in $usrinc
5437 do
5438         if test -f \$usrincdir/\$wanted; then
5439                 echo "\$usrincdir/\$wanted"
5440                 exit 0
5441         fi
5442 done
5443 awkprg='{ print \$$fieldn }'
5444 echo "#include <\$wanted>" > foo\$\$.c
5445 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5446 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5447 while read cline; do
5448         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5449         case "\$name" in
5450         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5451         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5452         *) exit 2;;
5453         esac;
5454 done;
5455 #
5456 # status = 0: grep returned 0 lines, case statement not executed
5457 # status = 1: headerfile found
5458 # status = 2: while loop executed, no headerfile found
5459 #
5460 status=\$?
5461 $rm -f foo\$\$.c;
5462 if test \$status -eq 1; then
5463         exit 0;
5464 fi
5465 exit 1
5466 EOF
5467 chmod +x findhdr
5468
5469 : define an alternate in-header-list? function
5470 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5471 cont=true; xxf="echo \"<\$1> found.\" >&4";
5472 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5473 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5474 esac;
5475 case $# in 4) instead=instead;; *) instead="at last";; esac;
5476 while $test "$cont"; do
5477         xxx=`./findhdr $1`
5478         var=$2; eval "was=\$$2";
5479         if $test "$xxx" && $test -r "$xxx";
5480         then eval $xxf;
5481         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5482                 cont="";
5483         else eval $xxnf;
5484         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5485         set $yyy; shift; shift; yyy=$@;
5486         case $# in 0) cont="";;
5487         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5488                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5489         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5490                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5491         esac;
5492 done;
5493 while $test "$yyy";
5494 do set $yyy; var=$2; eval "was=\$$2";
5495         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5496         set $yyy; shift; shift; yyy=$@;
5497 done'
5498
5499 : see if stdlib is available
5500 set stdlib.h i_stdlib
5501 eval $inhdr
5502
5503 : check for lengths of integral types
5504 echo " "
5505 case "$intsize" in
5506 '')
5507         echo "Checking to see how big your integers are..." >&4
5508         $cat >try.c <<EOCP
5509 #include <stdio.h>
5510 #$i_stdlib I_STDLIB
5511 #ifdef I_STDLIB
5512 #include <stdlib.h>
5513 #endif
5514 int main()
5515 {
5516         printf("intsize=%d;\n", (int)sizeof(int));
5517         printf("longsize=%d;\n", (int)sizeof(long));
5518         printf("shortsize=%d;\n", (int)sizeof(short));
5519         exit(0);
5520 }
5521 EOCP
5522         set try
5523         if eval $compile_ok && $run ./try > /dev/null; then
5524                 eval `$run ./try`
5525                 echo "Your integers are $intsize bytes long."
5526                 echo "Your long integers are $longsize bytes long."
5527                 echo "Your short integers are $shortsize bytes long."
5528         else
5529                 $cat >&4 <<EOM
5530 !
5531 Help! I can't compile and run the intsize test program: please enlighten me!
5532 (This is probably a misconfiguration in your system or libraries, and
5533 you really ought to fix it.  Still, I'll try anyway.)
5534 !
5535 EOM
5536                 dflt=4
5537                 rp="What is the size of an integer (in bytes)?"
5538                 . ./myread
5539                 intsize="$ans"
5540                 dflt=$intsize
5541                 rp="What is the size of a long integer (in bytes)?"
5542                 . ./myread
5543                 longsize="$ans"
5544                 dflt=2
5545                 rp="What is the size of a short integer (in bytes)?"
5546                 . ./myread
5547                 shortsize="$ans"
5548         fi
5549         ;;
5550 esac
5551 $rm_try
5552
5553 : check for long long
5554 echo " "
5555 echo "Checking to see if you have long long..." >&4
5556 echo 'int main() { long long x = 7; return 0; }' > try.c
5557 set try
5558 if eval $compile; then
5559         val="$define"
5560         echo "You have long long."
5561 else
5562         val="$undef"
5563         echo "You do not have long long."
5564 fi
5565 $rm_try
5566 set d_longlong
5567 eval $setvar
5568
5569 : check for length of long long
5570 case "${d_longlong}${longlongsize}" in
5571 $define)
5572         echo " "
5573         echo "Checking to see how big your long longs are..." >&4
5574         $cat >try.c <<'EOCP'
5575 #include <stdio.h>
5576 int main()
5577 {
5578     printf("%d\n", (int)sizeof(long long));
5579     return(0);
5580 }
5581 EOCP
5582         set try
5583         if eval $compile_ok; then
5584                 longlongsize=`$run ./try`
5585                 echo "Your long longs are $longlongsize bytes long."
5586         else
5587                 dflt='8'
5588                 echo " "
5589                 echo "(I can't seem to compile the test program.  Guessing...)"
5590                 rp="What is the size of a long long (in bytes)?"
5591                 . ./myread
5592                 longlongsize="$ans"
5593         fi
5594         if $test "X$longsize" = "X$longlongsize"; then
5595                 echo "(That isn't any different from an ordinary long.)"
5596         fi
5597         ;;
5598 esac
5599 $rm_try
5600
5601 : see if inttypes.h is available
5602 : we want a real compile instead of Inhdr because some systems
5603 : have an inttypes.h which includes non-existent headers
5604 echo " "
5605 $cat >try.c <<EOCP
5606 #include <inttypes.h>
5607 int main() {
5608         static int32_t foo32 = 0x12345678;
5609 }
5610 EOCP
5611 set try
5612 if eval $compile; then
5613         echo "<inttypes.h> found." >&4
5614         val="$define"
5615 else
5616         echo "<inttypes.h> NOT found." >&4
5617         val="$undef"
5618 fi
5619 $rm_try
5620 set i_inttypes
5621 eval $setvar
5622
5623 : check for int64_t
5624 echo " "
5625 echo "Checking to see if you have int64_t..." >&4
5626 $cat >try.c <<EOCP
5627 #include <sys/types.h>
5628 #$i_inttypes I_INTTYPES
5629 #ifdef I_INTTYPES
5630 #include <inttypes.h>
5631 #endif
5632 int main() { int64_t x = 7; }
5633 EOCP
5634 set try
5635 if eval $compile; then
5636         val="$define"
5637         echo "You have int64_t."
5638 else
5639         val="$undef"
5640         echo "You do not have int64_t."
5641 fi
5642 $rm_try
5643 set d_int64_t
5644 eval $setvar
5645
5646 : Check if 64bit ints have a quad type
5647 echo " "
5648 echo "Checking which 64-bit integer type we could use..." >&4
5649
5650 case "$intsize" in
5651 8) val=int
5652    set quadtype
5653    eval $setvar
5654    val='"unsigned int"'
5655    set uquadtype
5656    eval $setvar
5657    quadkind=1
5658    ;;
5659 *) case "$longsize" in
5660    8) val=long
5661       set quadtype
5662       eval $setvar
5663       val='"unsigned long"'
5664       set uquadtype
5665       eval $setvar
5666       quadkind=2
5667       ;;
5668    *) case "$d_longlong:$longlongsize" in
5669       define:8)
5670         val='"long long"'
5671         set quadtype
5672         eval $setvar
5673         val='"unsigned long long"'
5674         set uquadtype
5675         eval $setvar
5676         quadkind=3
5677         ;;
5678       *) case "$d_int64_t" in
5679          define)
5680            val=int64_t
5681            set quadtype
5682            eval $setvar
5683            val=uint64_t
5684            set uquadtype
5685            eval $setvar
5686            quadkind=4
5687            ;;
5688          esac
5689          ;;
5690       esac
5691       ;;
5692    esac
5693    ;;
5694 esac
5695
5696 case "$quadtype" in
5697 '')     echo "Alas, no 64-bit integer types in sight." >&4
5698         d_quad="$undef"
5699         ;;
5700 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5701         d_quad="$define"
5702         ;;
5703 esac
5704
5705 : Do we want 64bit support
5706 case "$uselonglong" in
5707 "$define"|true|[yY]*)
5708         cat <<EOM >&4
5709
5710 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5711 EOM
5712         use64bitint="$define"
5713         ;;
5714 esac
5715 case "$use64bits" in
5716 "$define"|true|[yY]*)
5717         cat <<EOM >&4
5718
5719 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5720 EOM
5721         use64bitint="$define"
5722         ;;
5723 esac
5724 case "$use64bitints" in
5725 "$define"|true|[yY]*)
5726         cat <<EOM >&4
5727
5728 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5729 EOM
5730         use64bitint="$define"
5731         ;;
5732 esac
5733 case "$use64bitsint" in
5734 "$define"|true|[yY]*)
5735         cat <<EOM >&4
5736
5737 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5738 EOM
5739         use64bitint="$define"
5740         ;;
5741 esac
5742 case "$uselonglongs" in
5743 "$define"|true|[yY]*)
5744         cat <<EOM >&4
5745
5746 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5747 EOM
5748         use64bitint="$define"
5749         ;;
5750 esac
5751 case "$use64bitsall" in
5752 "$define"|true|[yY]*)
5753         cat <<EOM >&4
5754
5755 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5756 EOM
5757         use64bitall="$define"
5758         ;;
5759 esac
5760
5761 case "$ccflags" in
5762 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5763 esac
5764 case "$use64bitall" in
5765 "$define"|true|[yY]*) use64bitint="$define" ;;
5766 esac
5767
5768 case "$longsize" in
5769 8) cat <<EOM
5770
5771 You have natively 64-bit long integers.
5772 EOM
5773    val="$define"
5774    ;;
5775 *) case "$use64bitint" in
5776    "$define"|true|[yY]*) dflt='y';;
5777    *) dflt='n';;
5778    esac
5779    case "$d_quad" in
5780    "$define") ;;
5781    *) dflt='n' ;;
5782    esac
5783    cat <<EOM
5784
5785 Perl can be built to take advantage of 64-bit integer types
5786 on some systems.  To do so, Configure can be run with -Duse64bitint.
5787 Choosing this option will most probably introduce binary incompatibilities.
5788
5789 If this doesn't make any sense to you, just accept the default '$dflt'.
5790 (The default has been chosen based on your configuration.)
5791 EOM
5792    rp='Try to use 64-bit integers, if available?'
5793    . ./myread
5794    case "$ans" in
5795    [yY]*) val="$define" ;;
5796    *)     val="$undef"  ;;
5797    esac
5798    ;;
5799 esac
5800 set use64bitint
5801 eval $setvar
5802
5803 case "$use64bitall" in
5804 "$define"|true|[yY]*) dflt='y' ;;
5805 *) case "$longsize" in
5806    8) dflt='y' ;;
5807    *) dflt='n' ;;
5808    esac
5809    ;;
5810 esac
5811 cat <<EOM
5812
5813 You may also choose to try maximal 64-bitness.  It means using as much
5814 64-bitness as possible on the platform.  This in turn means even more
5815 binary incompatibilities.  On the other hand, your platform may not
5816 have any more 64-bitness available than what you already have chosen.
5817
5818 If this doesn't make any sense to you, just accept the default '$dflt'.
5819 (The default has been chosen based on your configuration.)
5820 EOM
5821 rp='Try to use maximal 64-bit support, if available?'
5822 . ./myread
5823 case "$ans" in
5824 [yY]*) val="$define" ;;
5825 *)     val="$undef"  ;;
5826 esac
5827 set use64bitall
5828 eval $setvar
5829 case "$use64bitall" in
5830 "$define")
5831         case "$use64bitint" in
5832         "$undef")
5833                 cat <<EOM
5834
5835 Since you have chosen a maximally 64-bit build, I'm also turning on
5836 the use of 64-bit integers.
5837 EOM
5838                 use64bitint="$define" ;;
5839         esac
5840         ;;
5841 esac
5842
5843 : Look for a hint-file generated 'call-back-unit'.  If the
5844 : user has specified that a 64-bit perl is to be built,
5845 : we may need to set or change some other defaults.
5846 if $test -f use64bitint.cbu; then
5847         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5848         . ./use64bitint.cbu
5849 fi
5850 case "$use64bitint" in
5851 "$define"|true|[yY]*)
5852         case "$longsize" in
5853         4) case "$archname64" in
5854            '') archname64=64int ;;
5855            esac
5856            ;;
5857         esac
5858         ;;
5859 esac
5860
5861 : Look for a hint-file generated 'call-back-unit'.  If the
5862 : user has specified that a maximally 64-bit perl is to be built,
5863 : we may need to set or change some other defaults.
5864 if $test -f use64bitall.cbu; then
5865         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5866         . ./use64bitall.cbu
5867 fi
5868 case "$use64bitall" in
5869 "$define"|true|[yY]*)
5870         case "$longsize" in
5871         4) case "$archname64" in
5872            ''|64int) archname64=64all ;;
5873            esac
5874            ;;
5875         esac
5876         ;;
5877 esac
5878
5879 case "$d_quad:$use64bitint" in
5880 $undef:$define)
5881         cat >&4 <<EOF
5882
5883 *** You have chosen to use 64-bit integers,
5884 *** but none can be found.
5885 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5886 *** Cannot continue, aborting.
5887
5888 EOF
5889         exit 1
5890         ;;
5891 esac
5892
5893 : check for length of double
5894 echo " "
5895 case "$doublesize" in
5896 '')
5897         echo "Checking to see how big your double precision numbers are..." >&4
5898         $cat >try.c <<EOCP
5899 #include <stdio.h>
5900 #$i_stdlib I_STDLIB
5901 #ifdef I_STDLIB
5902 #include <stdlib.h>
5903 #endif
5904 int main()
5905 {
5906     printf("%d\n", (int)sizeof(double));
5907     exit(0);
5908 }
5909 EOCP
5910         set try
5911         if eval $compile_ok; then
5912                 doublesize=`$run ./try`
5913                 echo "Your double is $doublesize bytes long."
5914         else
5915                 dflt='8'
5916                 echo "(I can't seem to compile the test program.  Guessing...)"
5917                 rp="What is the size of a double precision number (in bytes)?"
5918                 . ./myread
5919                 doublesize="$ans"
5920         fi
5921         ;;
5922 esac
5923 $rm_try
5924
5925 : check for long doubles
5926 echo " "
5927 echo "Checking to see if you have long double..." >&4
5928 echo 'int main() { long double x = 7.0; }' > try.c
5929 set try
5930 if eval $compile; then
5931         val="$define"
5932         echo "You have long double."
5933 else
5934         val="$undef"
5935         echo "You do not have long double."
5936 fi
5937 $rm_try
5938 set d_longdbl
5939 eval $setvar
5940
5941 : check for length of long double
5942 case "${d_longdbl}${longdblsize}" in
5943 $define)
5944         echo " "
5945         echo "Checking to see how big your long doubles are..." >&4
5946         $cat >try.c <<'EOCP'
5947 #include <stdio.h>
5948 int main()
5949 {
5950         printf("%d\n", sizeof(long double));
5951 }
5952 EOCP
5953         set try
5954         set try
5955         if eval $compile; then
5956                 longdblsize=`$run ./try`
5957                 echo "Your long doubles are $longdblsize bytes long."
5958         else
5959                 dflt='8'
5960                 echo " "
5961                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5962                 rp="What is the size of a long double (in bytes)?"
5963                 . ./myread
5964                 longdblsize="$ans"
5965         fi
5966         if $test "X$doublesize" = "X$longdblsize"; then
5967                 echo "That isn't any different from an ordinary double."
5968                 echo "I'll keep your setting anyway, but you may see some"
5969                 echo "harmless compilation warnings."
5970         fi
5971         ;;
5972 esac
5973 $rm_try
5974
5975 : determine the architecture name
5976 echo " "
5977 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5978         tarch=`arch`"-$osname"
5979 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5980         if uname -m > tmparch 2>&1 ; then
5981                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5982                         -e 's/$/'"-$osname/" tmparch`
5983         else
5984                 tarch="$osname"
5985         fi
5986         $rm -f tmparch
5987 else
5988         tarch="$osname"
5989 fi
5990 case "$myarchname" in
5991 ''|"$tarch") ;;
5992 *)
5993         echo "(Your architecture name used to be $myarchname.)"
5994         archname=''
5995         ;;
5996 esac
5997 case "$targetarch" in
5998 '') ;;
5999 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6000 esac
6001 myarchname="$tarch"
6002 case "$archname" in
6003 '') dflt="$tarch";;
6004 *) dflt="$archname";;
6005 esac
6006 rp='What is your architecture name'
6007 . ./myread
6008 archname="$ans"
6009 case "$usethreads" in
6010 $define)
6011         echo "Threads selected." >&4
6012         case "$archname" in
6013         *-thread*) echo "...and architecture name already has -thread." >&4
6014                 ;;
6015         *)      archname="$archname-thread"
6016                 echo "...setting architecture name to $archname." >&4
6017                 ;;
6018         esac
6019         ;;
6020 esac
6021 case "$usemultiplicity" in
6022 $define)
6023         echo "Multiplicity selected." >&4
6024         case "$archname" in
6025         *-multi*) echo "...and architecture name already has -multi." >&4
6026                 ;;
6027         *)      archname="$archname-multi"
6028                 echo "...setting architecture name to $archname." >&4
6029                 ;;
6030         esac
6031         ;;
6032 esac
6033 case "$use64bitint$use64bitall" in
6034 *"$define"*)
6035         case "$archname64" in
6036         '')
6037                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6038                 ;;
6039         *)
6040                 case "$use64bitint" in
6041                 "$define") echo "64 bit integers selected." >&4 ;;
6042                 esac
6043                 case "$use64bitall" in
6044                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6045                 esac
6046                 case "$archname" in
6047                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6048                         ;;
6049                 *)      archname="$archname-$archname64"
6050                         echo "...setting architecture name to $archname." >&4
6051                         ;;
6052                 esac
6053                 ;;
6054         esac
6055 esac
6056 case "$uselongdouble" in
6057 $define)
6058         echo "Long doubles selected." >&4
6059         case "$longdblsize" in
6060         $doublesize)
6061                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6062                 ;;
6063         *)
6064                 case "$archname" in
6065                 *-ld*) echo "...and architecture name already has -ld." >&4
6066                         ;;
6067                 *)      archname="$archname-ld"
6068                         echo "...setting architecture name to $archname." >&4
6069                         ;;
6070                 esac
6071                 ;;
6072         esac
6073         ;;
6074 esac
6075 case "$useperlio" in
6076 $define)
6077         echo "Perlio selected." >&4
6078         ;;
6079 *)
6080         echo "Perlio not selected, using stdio." >&4
6081         case "$archname" in
6082         *-stdio*) echo "...and architecture name already has -stdio." >&4
6083                 ;;
6084         *)      archname="$archname-stdio"
6085                 echo "...setting architecture name to $archname." >&4
6086                 ;;
6087         esac
6088         ;;
6089 esac
6090 if $test -f archname.cbu; then
6091         echo "Your platform has some specific hints for architecture name, using them..."
6092         . ./archname.cbu
6093 fi
6094
6095 : set the prefixit variable, to compute a suitable default value
6096 prefixit='case "$3" in
6097 ""|none)
6098         case "$oldprefix" in
6099         "") eval "$1=\"\$$2\"";;
6100         *)
6101                 case "$3" in
6102                 "") eval "$1=";;
6103                 none)
6104                         eval "tp=\"\$$2\"";
6105                         case "$tp" in
6106                         ""|" ") eval "$1=\"\$$2\"";;
6107                         *) eval "$1=";;
6108                         esac;;
6109                 esac;;
6110         esac;;
6111 *)
6112         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6113         case "$tp" in
6114         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6115         /*-$oldprefix/*|\~*-$oldprefix/*)
6116                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6117         *) eval "$1=\"\$$2\"";;
6118         esac;;
6119 esac'
6120
6121 : determine installation style
6122 : For now, try to deduce it from prefix unless it is already set.
6123 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6124 case "$installstyle" in
6125 '')     case "$prefix" in
6126                 *perl*) dflt='lib';;
6127                 *) dflt='lib/perl5' ;;
6128         esac
6129         ;;
6130 *)      dflt="$installstyle" ;;
6131 esac
6132 : Probably not worth prompting for this since we prompt for all
6133 : the directories individually, and the prompt would be too long and
6134 : confusing anyway.
6135 installstyle=$dflt
6136
6137 : determine where public executables go
6138 echo " "
6139 set dflt bin bin
6140 eval $prefixit
6141 fn=d~
6142 rp='Pathname where the public executables will reside?'
6143 . ./getfile
6144 if $test "X$ansexp" != "X$binexp"; then
6145         installbin=''
6146 fi
6147 prefixvar=bin
6148 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6149 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6150 :     this via initialinstalllocation
6151 . ./setprefixvar
6152
6153 case "$userelocatableinc" in
6154 $define|true|[yY]*)     dflt='y' ;;
6155 *)                      dflt='n' ;;
6156 esac
6157 cat <<EOM
6158
6159 Would you like to build Perl so that the installation is relocatable, so that
6160 library paths in @INC are determined relative to the path of the perl binary?
6161 This is not advised for system Perl installs, or if you need to run setid
6162 scripts or scripts under taint mode.
6163
6164 If this doesn't make any sense to you, just accept the default '$dflt'.
6165 EOM
6166 rp='Use relocatable @INC?'
6167 . ./myread
6168 case "$ans" in
6169 y|Y)    val="$define" ;;
6170 *)      val="$undef"  ;;
6171 esac
6172 set userelocatableinc
6173 eval $setvar
6174
6175 initialinstalllocation="$binexp"
6176 : Default prefix is now "up one level from where the binaries are"
6177 case "$userelocatableinc" in
6178 $define|true|[yY]*)
6179     bin=".../"
6180     binexp=".../"
6181     prefix=".../.."
6182     prefixexp=".../.."
6183     installprefixexp=".../.."
6184     ;;
6185 esac
6186
6187 : determine where private library files go
6188 : Usual default is /usr/local/lib/perl5/$version.
6189 : Also allow things like /opt/perl/lib/$version, since
6190 : /opt/perl/lib/perl5... would be redundant.
6191 : The default "style" setting is made in installstyle.U
6192 case "$installstyle" in
6193 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6194 *)       set dflt privlib lib/$version ;;
6195 esac
6196 eval $prefixit
6197 $cat <<EOM
6198
6199 There are some auxiliary files for $package that need to be put into a
6200 private library directory that is accessible by everyone.
6201
6202 EOM
6203 fn=$binexp
6204 fn=d~+
6205 rp='Pathname where the private library files will reside?'
6206 . ./getfile
6207 prefixvar=privlib
6208 . ./setprefixvar
6209
6210 : set the prefixup variable, to restore leading tilda escape
6211 prefixup='case "$prefixexp" in
6212 "$prefix") ;;
6213 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6214 esac'
6215
6216 : determine where public architecture dependent libraries go
6217 set archlib archlib
6218 eval $prefixit
6219 : privlib default is /usr/local/lib/$package/$version
6220 : archlib default is /usr/local/lib/$package/$version/$archname
6221 : privlib may have an optional trailing /share.
6222 tdflt=`echo $privlib | $sed 's,/share$,,'`
6223 tdflt=$tdflt/$archname
6224 case "$archlib" in
6225 '')     dflt=$tdflt
6226         ;;
6227 *)      dflt="$archlib"
6228     ;;
6229 esac
6230 $cat <<EOM
6231
6232 $spackage contains architecture-dependent library files.  If you are
6233 sharing libraries in a heterogeneous environment, you might store
6234 these files in a separate location.  Otherwise, you can just include
6235 them with the rest of the public library files.
6236
6237 EOM
6238 fn=$binexp
6239 fn=d+~
6240 rp='Where do you want to put the public architecture-dependent libraries?'
6241 . ./getfile
6242 prefixvar=archlib
6243 . ./setprefixvar
6244 if $test X"$archlib" = X"$privlib"; then
6245         d_archlib="$undef"
6246 else
6247         d_archlib="$define"
6248 fi
6249
6250 : see if setuid scripts can be secure
6251 $cat <<EOM
6252
6253 Some kernels have a bug that prevents setuid #! scripts from being
6254 secure.  Some sites have disabled setuid #! scripts because of this.
6255
6256 First let's decide if your kernel supports secure setuid #! scripts.
6257 (If setuid #! scripts would be secure but have been disabled anyway,
6258 don't say that they are secure if asked.)
6259
6260 EOM
6261
6262 val="$undef"
6263 if $test -d /dev/fd; then
6264         echo "#!$ls" >reflect
6265         chmod +x,u+s reflect
6266         ./reflect >flect 2>&1
6267         if $contains "/dev/fd" flect >/dev/null; then
6268                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6269                 val="$define"
6270         else
6271                 $cat <<EOM
6272 If you are not sure if they are secure, I can check but I'll need a
6273 username and password different from the one you are using right now.
6274 If you don't have such a username or don't want me to test, simply
6275 enter 'none'.
6276
6277 EOM
6278                 rp='Other username to test security of setuid scripts with?'
6279                 dflt='none'
6280                 . ./myread
6281                 case "$ans" in
6282                 n|none)
6283                         case "$d_suidsafe" in
6284                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6285                                 dflt=n;;
6286                         "$undef")
6287                                 echo "Well, the $hint value is *not* secure." >&4
6288                                 dflt=n;;
6289                         *)      echo "Well, the $hint value *is* secure." >&4
6290                                 dflt=y;;
6291                         esac
6292                         ;;
6293                 *)
6294                         $rm -f reflect flect
6295                         echo "#!$ls" >reflect
6296                         chmod +x,u+s reflect
6297                         echo >flect
6298                         chmod a+w flect
6299                         echo '"su" will (probably) prompt you for '"$ans's password."
6300                         su $ans -c './reflect >flect'
6301                         if $contains "/dev/fd" flect >/dev/null; then
6302                                 echo "Okay, it looks like setuid scripts are secure." >&4
6303                                 dflt=y
6304                         else
6305                                 echo "I don't think setuid scripts are secure." >&4
6306                                 dflt=n
6307                         fi
6308                         ;;
6309                 esac
6310                 rp='Does your kernel have *secure* setuid scripts?'
6311                 . ./myread
6312                 case "$ans" in
6313                 [yY]*)  val="$define";;
6314                 *)      val="$undef";;
6315                 esac
6316         fi
6317 else
6318         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6319         echo "(That's for file descriptors, not floppy disks.)"
6320         val="$undef"
6321 fi
6322 set d_suidsafe
6323 eval $setvar
6324
6325 $rm -f reflect flect
6326
6327 : now see if they want to do setuid emulation
6328 echo " "
6329 val="$undef"
6330 case "$d_suidsafe" in
6331 "$define")
6332         val="$undef"
6333         echo "No need to emulate SUID scripts since they are secure here." >&4
6334         ;;
6335 *)
6336         $cat <<EOM
6337 Some systems have disabled setuid scripts, especially systems where
6338 setuid scripts cannot be secure.  On systems where setuid scripts have
6339 been disabled, the setuid/setgid bits on scripts are currently
6340 useless.  It is possible for $package to detect those bits and emulate
6341 setuid/setgid in a secure fashion.  This emulation will only work if
6342 setuid scripts have been disabled in your kernel.
6343
6344 EOM
6345         case "$d_dosuid" in
6346         "$define") dflt=y ;;
6347         *) dflt=n ;;
6348         esac
6349         rp="Do you want to do setuid/setgid emulation?"
6350         . ./myread
6351         case "$ans" in
6352         [yY]*)  val="$define";;
6353         *)      val="$undef";;
6354         esac
6355         ;;
6356 esac
6357 set d_dosuid
6358 eval $setvar
6359
6360 : Find perl5.005 or later.
6361 echo "Looking for a previously installed perl5.005 or later... "
6362 case "$perl5" in
6363 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6364                 : Check if this perl is recent and can load a simple module
6365                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6366                         perl5=$tdir/perl
6367                         break;
6368                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6369                         perl5=$tdir/perl5
6370                         break;
6371                 fi
6372         done
6373         ;;
6374 *)      perl5="$perl5"
6375         ;;
6376 esac
6377 case "$perl5" in
6378 '')     echo "None found.  That's ok.";;
6379 *)      echo "Using $perl5." ;;
6380 esac
6381
6382 : Set the siteprefix variables
6383 $cat <<EOM
6384
6385 After $package is installed, you may wish to install various
6386 add-on modules and utilities.  Typically, these add-ons will
6387 be installed under $prefix with the rest
6388 of this package.  However, you may wish to install such add-ons
6389 elsewhere under a different prefix.
6390
6391 If you do not wish to put everything under a single prefix, that's
6392 ok.  You will be prompted for the individual locations; this siteprefix
6393 is only used to suggest the defaults.
6394
6395 The default should be fine for most people.
6396
6397 EOM
6398 fn=d~+
6399 rp='Installation prefix to use for add-on modules and utilities?'
6400 : XXX Here might be another good place for an installstyle setting.
6401 case "$siteprefix" in
6402 '') dflt=$prefix ;;
6403 *)  dflt=$siteprefix ;;
6404 esac
6405 . ./getfile
6406 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6407 oldsiteprefix=''
6408 case "$siteprefix" in
6409 '') ;;
6410 *)      case "$ans" in
6411         "$prefix") ;;
6412         *) oldsiteprefix="$prefix";;
6413         esac
6414         ;;
6415 esac
6416 siteprefix="$ans"
6417 siteprefixexp="$ansexp"
6418
6419 : determine where site specific libraries go.
6420 : Usual default is /usr/local/lib/perl5/site_perl/$version
6421 : The default "style" setting is made in installstyle.U
6422 : XXX No longer works with Prefixit stuff.
6423 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6424 case "$sitelib" in
6425 '') case "$installstyle" in
6426         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6427         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6428         esac
6429         ;;
6430 *)      dflt="$sitelib"
6431         ;;
6432 esac
6433 $cat <<EOM
6434
6435 The installation process will create a directory for
6436 site-specific extensions and modules.  Most users find it convenient
6437 to place all site-specific files in this directory rather than in the
6438 main distribution directory.
6439
6440 EOM
6441 fn=d~+
6442 rp='Pathname for the site-specific library files?'
6443 . ./getfile
6444 prefixvar=sitelib
6445 . ./setprefixvar
6446 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6447
6448 : Determine list of previous versions to include in @INC
6449 $cat > getverlist <<EOPL
6450 #!$perl5 -w
6451 use File::Basename;
6452 \$api_versionstring = "$api_versionstring";
6453 \$version = "$version";
6454 \$stem = "$sitelib_stem";
6455 \$archname = "$archname";
6456 EOPL
6457         $cat >> getverlist <<'EOPL'
6458 # The list found is store twice for each entry: the original name, and
6459 # the binary broken down version as pack "sss", so sorting is easy and
6460 # unambiguous. This will work for all versions that have a maximum of
6461 # three digit groups, separate by '.'s or '_'s. Names are extended with
6462 # ".0.0" to ensure at least three elements for the pack.
6463 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6464
6465 # Can't have leading @ because metaconfig interprets it as a command!
6466 ;@inc_version_list=();
6467 # XXX Redo to do opendir/readdir?
6468 if (-d $stem) {
6469     chdir($stem);
6470     ;@candidates = map {
6471         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6472 }
6473 else {
6474     ;@candidates = ();
6475 }
6476
6477 ($pversion, $aversion, $vsn5005) = map {
6478     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6479 foreach $d (@candidates) {
6480     if ($d->[1] lt $pversion) {
6481         if ($d->[1] ge $aversion) {
6482             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6483         }
6484         elsif ($d->[1] ge $vsn5005) {
6485             unshift(@inc_version_list, grep { -d } $d->[0]);
6486         }
6487     }
6488     else {
6489         # Skip newer version.  I.e. don't look in
6490         # 5.7.0 if we're installing 5.6.1.
6491     }
6492 }
6493
6494 if (@inc_version_list) {
6495     print join(' ', @inc_version_list);
6496 }
6497 else {
6498     # Blank space to preserve value for next Configure run.
6499     print " ";
6500 }
6501 EOPL
6502 chmod +x getverlist
6503 case "$inc_version_list" in
6504 '')     if test -x "$perl5$exe_ext"; then
6505                 dflt=`$perl5 getverlist`
6506         else
6507                 dflt='none'
6508         fi
6509         ;;
6510 $undef) dflt='none' ;;
6511 *)  eval dflt=\"$inc_version_list\" ;;
6512 esac
6513 case "$dflt" in
6514 ''|' ') dflt=none ;;
6515 esac
6516 case "$dflt" in
6517 5.005) dflt=none ;;
6518 esac
6519 $cat <<EOM
6520
6521 In order to ease the process of upgrading, this version of perl
6522 can be configured to use modules built and installed with earlier
6523 versions of perl that were installed under $prefix.  Specify here
6524 the list of earlier versions that this version of perl should check.
6525 If Configure detected no earlier versions of perl installed under
6526 $prefix, then the list will be empty.  Answer 'none' to tell perl
6527 to not search earlier versions.
6528
6529 The default should almost always be sensible, so if you're not sure,
6530 just accept the default.
6531 EOM
6532
6533 rp='List of earlier versions to include in @INC?'
6534 . ./myread
6535 case "$ans" in
6536 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6537 *) inc_version_list="$ans" ;;
6538 esac
6539 case "$inc_version_list" in
6540 ''|' ')
6541         inc_version_list_init='0'
6542         d_inc_version_list="$undef"
6543         ;;
6544 *)      inc_version_list_init=`echo $inc_version_list |
6545                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6546         d_inc_version_list="$define"
6547         ;;
6548 esac
6549 $rm -f getverlist
6550
6551 : see if this is a malloc.h system
6552 : we want a real compile instead of Inhdr because some systems have a
6553 : malloc.h that just gives a compile error saying to use stdlib.h instead
6554 echo " "
6555 $cat >try.c <<EOCP
6556 #include <stdlib.h>
6557 #include <malloc.h>
6558 int main () { return 0; }
6559 EOCP
6560 set try
6561 if eval $compile; then
6562     echo "<malloc.h> found." >&4
6563     val="$define"
6564 else
6565     echo "<malloc.h> NOT found." >&4
6566     val="$undef"
6567 fi
6568 $rm_try
6569 set i_malloc
6570 eval $setvar
6571
6572 : check for void type
6573 echo " "
6574 echo "Checking to see how well your C compiler groks the void type..." >&4
6575 case "$voidflags" in
6576 '')
6577         $cat >try.c <<EOCP
6578 #$i_stdlib I_STDLIB
6579 #ifdef I_STDLIB
6580 #include <stdlib.h>
6581 #endif
6582 #if TRY & 1
6583 void sub() {
6584 #else
6585 sub() {
6586 #endif
6587         extern void moo();      /* function returning void */
6588         void (*goo)();          /* ptr to func returning void */
6589 #if TRY & 8
6590         void *hue;              /* generic ptr */
6591 #endif
6592 #if TRY & 2
6593         void (*foo[10])();
6594 #endif
6595
6596 #if TRY & 4
6597         if(goo == moo) {
6598                 exit(0);
6599         }
6600 #endif
6601         exit(0);
6602 }
6603 int main() { sub(); }
6604 EOCP
6605         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6606                 voidflags=$defvoidused
6607         echo "Good.  It appears to support void to the level $package wants.">&4
6608                 if $contains warning .out >/dev/null 2>&1; then
6609                         echo "However, you might get some warnings that look like this:"
6610                         $cat .out
6611                 fi
6612         else
6613 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6614                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6615                         echo "It supports 1..."
6616                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6617                                 echo "It also supports 2..."
6618                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6619                                         voidflags=7
6620                                         echo "And it supports 4 but not 8 definitely."
6621                                 else
6622                                         echo "It doesn't support 4..."
6623                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6624                                                 voidflags=11
6625                                                 echo "But it supports 8."
6626                                         else
6627                                                 voidflags=3
6628                                                 echo "Neither does it support 8."
6629                                         fi
6630                                 fi
6631                         else
6632                                 echo "It does not support 2..."
6633                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6634                                         voidflags=13
6635                                         echo "But it supports 4 and 8."
6636                                 else
6637                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6638                                                 voidflags=5
6639                                                 echo "And it supports 4 but has not heard about 8."
6640                                         else
6641                                                 echo "However it supports 8 but not 4."
6642                                         fi
6643                                 fi
6644                         fi
6645                 else
6646                         echo "There is no support at all for void."
6647                         voidflags=0
6648                 fi
6649         fi
6650 esac
6651 case "$voidflags" in
6652 "$defvoidused") ;;
6653 *)      $cat >&4 <<'EOM'
6654   Support flag bits are:
6655     1: basic void declarations.
6656     2: arrays of pointers to functions returning void.
6657     4: operations between pointers to and addresses of void functions.
6658     8: generic void pointers.
6659 EOM
6660         dflt="$voidflags";
6661         rp="Your void support flags add up to what?"
6662         . ./myread
6663         voidflags="$ans"
6664         ;;
6665 esac
6666 $rm_try
6667
6668 : check for length of pointer
6669 echo " "
6670 case "$ptrsize" in
6671 '')
6672         echo "Checking to see how big your pointers are..." >&4
6673         if test "$voidflags" -gt 7; then
6674                 echo '#define VOID_PTR char *' > try.c
6675         else
6676                 echo '#define VOID_PTR void *' > try.c
6677         fi
6678         $cat >>try.c <<EOCP
6679 #include <stdio.h>
6680 #$i_stdlib I_STDLIB
6681 #ifdef I_STDLIB
6682 #include <stdlib.h>
6683 #endif
6684 int main()
6685 {
6686     printf("%d\n", (int)sizeof(VOID_PTR));
6687     exit(0);
6688 }
6689 EOCP
6690         set try
6691         if eval $compile_ok; then
6692                 ptrsize=`$run ./try`
6693                 echo "Your pointers are $ptrsize bytes long."
6694         else
6695                 dflt='4'
6696                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6697                 rp="What is the size of a pointer (in bytes)?"
6698                 . ./myread
6699                 ptrsize="$ans"
6700         fi
6701         ;;
6702 esac
6703 $rm_try
6704 case "$use64bitall" in
6705 "$define"|true|[yY]*)
6706         case "$ptrsize" in
6707         4)      cat <<EOM >&4
6708
6709 *** You have chosen a maximally 64-bit build,
6710 *** but your pointers are only 4 bytes wide.
6711 *** Please rerun Configure without -Duse64bitall.
6712 EOM
6713                 case "$d_quad" in
6714                 define)
6715                         cat <<EOM >&4
6716 *** Since you have quads, you could possibly try with -Duse64bitint.
6717 EOM
6718                         ;;
6719                 esac
6720                 cat <<EOM >&4
6721 *** Cannot continue, aborting.
6722
6723 EOM
6724
6725                 exit 1
6726                 ;;
6727         esac
6728         ;;
6729 esac
6730
6731
6732 : determine whether to use malloc wrapping
6733 echo " "
6734 case "$usemallocwrap" in
6735 [yY]*|true|$define)     dflt='y' ;;
6736 [nN]*|false|$undef)     dflt='n' ;;
6737 *)      case "$usedevel" in
6738         [yY]*|true|$define)     dflt='y' ;;
6739         *) dflt='n' ;;
6740         esac
6741         ;;
6742 esac
6743 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6744 . ./myread
6745 usemallocwrap="$ans"
6746 case "$ans" in
6747 y*|true)
6748         usemallocwrap="$define" ;;
6749 *)
6750         usemallocwrap="$undef" ;;
6751 esac
6752
6753 : determine which malloc to compile in
6754 echo " "
6755 case "$usemymalloc" in
6756 [yY]*|true|$define)     dflt='y' ;;
6757 [nN]*|false|$undef)     dflt='n' ;;
6758 *)      case "$ptrsize" in
6759         4) dflt='y' ;;
6760         *) dflt='n' ;;
6761         esac
6762         ;;
6763 esac
6764 rp="Do you wish to attempt to use the malloc that comes with $package?"
6765 . ./myread
6766 usemymalloc="$ans"
6767 case "$ans" in
6768 y*|true)
6769         usemymalloc='y'
6770         mallocsrc='malloc.c'
6771         mallocobj="malloc$_o"
6772         d_mymalloc="$define"
6773         case "$libs" in
6774         *-lmalloc*)
6775                 : Remove malloc from list of libraries to use
6776                 echo "Removing unneeded -lmalloc from library list" >&4
6777                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6778                 shift
6779                 libs="$*"
6780                 echo "libs = $libs" >&4
6781                 ;;
6782         esac
6783         ;;
6784 *)
6785         usemymalloc='n'
6786         mallocsrc=''
6787         mallocobj=''
6788         d_mymalloc="$undef"
6789         ;;
6790 esac
6791
6792 : compute the return types of malloc and free
6793 echo " "
6794 $cat >malloc.c <<END
6795 #$i_malloc I_MALLOC
6796 #$i_stdlib I_STDLIB
6797 #include <stdio.h>
6798 #include <sys/types.h>
6799 #ifdef I_MALLOC
6800 #include <malloc.h>
6801 #endif
6802 #ifdef I_STDLIB
6803 #include <stdlib.h>
6804 #endif
6805 #ifdef TRY_MALLOC
6806 void *malloc();
6807 #endif
6808 #ifdef TRY_FREE
6809 void free();
6810 #endif
6811 END
6812 case "$malloctype" in
6813 '')
6814         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6815                 malloctype='void *'
6816         else
6817                 malloctype='char *'
6818         fi
6819         ;;
6820 esac
6821 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6822
6823 case "$freetype" in
6824 '')
6825         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6826                 freetype='void'
6827         else
6828                 freetype='int'
6829         fi
6830         ;;
6831 esac
6832 echo "Your system uses $freetype free(), it would seem." >&4
6833 $rm -f malloc.[co]
6834 : determine where site specific architecture-dependent libraries go.
6835 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6836 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6837 : sitelib may have an optional trailing /share.
6838 case "$sitearch" in
6839 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6840         dflt="$dflt/$archname"
6841         ;;
6842 *)      dflt="$sitearch"
6843         ;;
6844 esac
6845 set sitearch sitearch none
6846 eval $prefixit
6847 $cat <<EOM
6848
6849 The installation process will also create a directory for
6850 architecture-dependent site-specific extensions and modules.
6851
6852 EOM
6853 fn=d~+
6854 rp='Pathname for the site-specific architecture-dependent library files?'
6855 . ./getfile
6856 prefixvar=sitearch
6857 . ./setprefixvar
6858 if $test X"$sitearch" = X"$sitelib"; then
6859         d_sitearch="$undef"
6860 else
6861         d_sitearch="$define"
6862 fi
6863
6864 : Set the vendorprefix variables
6865 $cat <<EOM
6866
6867 The installation process will also create a directory for
6868 vendor-supplied add-ons.  Vendors who supply perl with their system
6869 may find it convenient to place all vendor-supplied files in this
6870 directory rather than in the main distribution directory.  This will
6871 ease upgrades between binary-compatible maintenance versions of perl.
6872
6873 Of course you may also use these directories in whatever way you see
6874 fit.  For example, you might use them to access modules shared over a
6875 company-wide network.
6876
6877 The default answer should be fine for most people.
6878 This causes further questions about vendor add-ons to be skipped
6879 and no vendor-specific directories will be configured for perl.
6880
6881 EOM
6882 rp='Do you want to configure vendor-specific add-on directories?'
6883 case "$usevendorprefix" in
6884 define|true|[yY]*) dflt=y ;;
6885 *)      : User may have set vendorprefix directly on Configure command line.
6886         case "$vendorprefix" in
6887         ''|' ') dflt=n ;;
6888         *)      dflt=y ;;
6889         esac
6890         ;;
6891 esac
6892 . ./myread
6893 case "$ans" in
6894 [yY]*)  fn=d~+
6895         rp='Installation prefix to use for vendor-supplied add-ons?'
6896         case "$vendorprefix" in
6897         '') dflt='' ;;
6898         *)  dflt=$vendorprefix ;;
6899         esac
6900         . ./getfile
6901         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6902         oldvendorprefix=''
6903         case "$vendorprefix" in
6904         '') ;;
6905         *)      case "$ans" in
6906                 "$prefix") ;;
6907                 *) oldvendorprefix="$prefix";;
6908                 esac
6909                 ;;
6910         esac
6911         usevendorprefix="$define"
6912         vendorprefix="$ans"
6913         vendorprefixexp="$ansexp"
6914         ;;
6915 *)      usevendorprefix="$undef"
6916         vendorprefix=''
6917         vendorprefixexp=''
6918         ;;
6919 esac
6920
6921 : Set the vendorlib variables
6922 case "$vendorprefix" in
6923 '')     d_vendorlib="$undef"
6924         vendorlib=''
6925         vendorlibexp=''
6926         ;;
6927 *)      d_vendorlib="$define"
6928         : determine where vendor-supplied modules go.
6929         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6930         case "$vendorlib" in
6931         '')
6932                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6933                 case "$installstyle" in
6934                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6935                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6936                 esac
6937                 ;;
6938         *)      dflt="$vendorlib"
6939                 ;;
6940         esac
6941         fn=d~+
6942         rp='Pathname for the vendor-supplied library files?'
6943         . ./getfile
6944         vendorlib="$ans"
6945         vendorlibexp="$ansexp"
6946         ;;
6947 esac
6948 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6949 prefixvar=vendorlib
6950 . ./installprefix
6951
6952 : Set the vendorarch variables
6953 case "$vendorprefix" in
6954 '')     d_vendorarch="$undef"
6955         vendorarch=''
6956         vendorarchexp=''
6957         ;;
6958 *)      d_vendorarch="$define"
6959         : determine where vendor-supplied architecture-dependent libraries go.
6960         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6961         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6962         : vendorlib may have an optional trailing /share.
6963         case "$vendorarch" in
6964         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6965                 dflt="$dflt/$archname"
6966                 ;;
6967         *)      dflt="$vendorarch" ;;
6968         esac
6969         fn=d~+
6970         rp='Pathname for vendor-supplied architecture-dependent files?'
6971         . ./getfile
6972         vendorarch="$ans"
6973         vendorarchexp="$ansexp"
6974         ;;
6975 esac
6976 prefixvar=vendorarch
6977 . ./installprefix
6978
6979 : Final catch-all directories to search
6980 $cat <<EOM
6981
6982 Lastly, you can have perl look in other directories for extensions and
6983 modules in addition to those already specified.
6984 These directories will be searched after 
6985         $sitearch 
6986         $sitelib 
6987 EOM
6988 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6989 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6990 echo ' '
6991 case "$otherlibdirs" in
6992 ''|' ') dflt='none' ;;
6993 *)      dflt="$otherlibdirs" ;;
6994 esac
6995 $cat <<EOM
6996 Enter a colon-separated set of extra paths to include in perl's @INC
6997 search path, or enter 'none' for no extra paths.
6998
6999 EOM
7000
7001 rp='Colon-separated list of additional directories for perl to search?'
7002 . ./myread
7003 case "$ans" in
7004 ' '|''|none)    otherlibdirs=' ' ;;     
7005 *)      otherlibdirs="$ans" ;;
7006 esac
7007 case "$otherlibdirs" in
7008 ' ') val=$undef ;;
7009 *)      val=$define ;;
7010 esac
7011 set d_perl_otherlibdirs
7012 eval $setvar
7013
7014 : Cruising for prototypes
7015 echo " "
7016 echo "Checking out function prototypes..." >&4
7017 $cat >prototype.c <<EOCP
7018 #$i_stdlib I_STDLIB
7019 #ifdef I_STDLIB
7020 #include <stdlib.h>
7021 #endif
7022 int main(int argc, char *argv[]) {
7023         exit(0);}
7024 EOCP
7025 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7026         echo "Your C compiler appears to support function prototypes."
7027         val="$define"
7028 else
7029         echo "Your C compiler doesn't seem to understand function prototypes."
7030         val="$undef"
7031 fi
7032 set prototype
7033 eval $setvar
7034 $rm -f prototype*
7035
7036 : Check if ansi2knr is required
7037 case "$prototype" in
7038 "$define") ;;
7039 *)      ansi2knr='ansi2knr'
7040         echo " "
7041         cat <<EOM >&4
7042
7043 $me:  FATAL ERROR:
7044 This version of $package can only be compiled by a compiler that 
7045 understands function prototypes.  Unfortunately, your C compiler 
7046         $cc $ccflags
7047 doesn't seem to understand them.  Sorry about that.
7048
7049 If GNU cc is available for your system, perhaps you could try that instead.  
7050
7051 Eventually, we hope to support building Perl with pre-ANSI compilers.
7052 If you would like to help in that effort, please contact <perlbug@perl.org>.
7053
7054 Aborting Configure now.
7055 EOM
7056         exit 2
7057         ;;
7058 esac
7059
7060 : DTrace support
7061 dflt_dtrace='/usr/sbin/dtrace'
7062 cat <<EOM
7063
7064 Perl can be built to support DTrace on platforms that support it.
7065 DTrace is a diagnosis and performance analysis tool from Sun.
7066
7067 If this doesn't make any sense to you, just accept the default '$dflt'.
7068 EOM
7069
7070 while $test 1 ; do
7071         case "$usedtrace" in
7072         $define|true|[yY]*)
7073                 dflt='y'
7074                 ;;
7075         ?*)
7076                 dflt='y'
7077                 dflt_dtrace=$usedtrace
7078                 ;;
7079         *)
7080                 dflt='n'
7081                 ;;
7082         esac
7083
7084         rp='Support DTrace if available?'
7085         . ./myread
7086         case "$ans" in
7087         y|Y)    val="$define" ;;
7088         *)      val="$undef" ;;
7089         esac
7090         set usedtrace
7091         eval $setvar
7092
7093         test "X$usedtrace" != "X$define" && break
7094
7095         echo " "
7096         rp='Where is the dtrace executable?'
7097         dflt=$dflt_dtrace
7098         . ./getfile
7099         val="$ans"
7100         set dtrace
7101         eval $setvar
7102
7103         if $test -f $dtrace
7104         then
7105                 if $dtrace -h -s ../perldtrace.d \
7106                         -o perldtrace.tmp >/dev/null 2>&1 \
7107                         && rm -f perldtrace.tmp
7108                 then
7109                         echo " "
7110                         echo "Good: your $dtrace knows about the -h flag."
7111                 else
7112                         cat >&2 <<EOM
7113
7114 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7115 ***
7116 *** Your installed dtrace doesn't support the -h switch to compile a D
7117 *** program into a C header. Can't continue.
7118
7119 EOM
7120                         exit 1
7121                 fi
7122                 break;
7123         fi
7124
7125         case "$fastread" in
7126         yes)
7127                 cat >&2 <<EOM
7128
7129 *** $me:  Fatal Error:  $dtrace not found.
7130 *** Can't continue.
7131
7132 EOM
7133                 exit 1
7134                 ;;
7135         *)
7136                 echo "*** $dtrace was not found."
7137                 echo " "
7138                 ;;
7139         esac
7140 done
7141
7142 : See if we want extra modules installed
7143 echo " "
7144 case "$extras" in
7145 '') dflt='n';;
7146 *) dflt='y';;
7147 esac
7148 cat <<EOM
7149 Perl can be built with extra modules or bundles of modules which
7150 will be fetched from the CPAN and installed alongside Perl.
7151
7152 Notice that you will need access to the CPAN; either via the Internet,
7153 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7154 be asked later to configure the CPAN.pm module which will in turn do
7155 the installation of the rest of the extra modules or bundles.)
7156
7157 Notice also that if the modules require any external software such as
7158 libraries and headers (the libz library and the zlib.h header for the
7159 Compress::Zlib module, for example) you MUST have any such software
7160 already installed, this configuration process will NOT install such
7161 things for you.
7162
7163 If this doesn't make any sense to you, just accept the default '$dflt'.
7164 EOM
7165 rp='Install any extra modules (y or n)?'
7166 . ./myread
7167 case "$ans" in
7168 y|Y)
7169         cat <<EOM
7170
7171 Please list any extra modules or bundles to be installed from CPAN,
7172 with spaces between the names.  The names can be in any format the
7173 'install' command of CPAN.pm will understand.  (Answer 'none',
7174 without the quotes, to install no extra modules or bundles.)
7175 EOM
7176         rp='Extras?'
7177         dflt="$extras"
7178         . ./myread
7179         extras="$ans"
7180 esac
7181 case "$extras" in
7182 ''|'none')
7183         val=''
7184         $rm -f ../extras.lst
7185         ;;
7186 *)      echo "(Saving the list of extras for later...)"
7187         echo "$extras" > ../extras.lst
7188         val="'$extras'"
7189         ;;
7190 esac
7191 set extras
7192 eval $setvar
7193 echo " "
7194
7195 : determine where html pages for programs go
7196 set html1dir html1dir none
7197 eval $prefixit
7198 $cat <<EOM
7199
7200 If you wish to install html files for programs in $spackage, indicate
7201 the appropriate directory here.  To skip installing html files,
7202 answer "none".
7203 EOM
7204 case "$html1dir" in
7205 ''|none|$undef|' ') dflt=none ;;
7206 *) dflt=$html1dir ;;
7207 esac
7208 fn=dn+~
7209 rp="Directory for the main $spackage html pages?"
7210 . ./getfile
7211 prefixvar=html1dir
7212 . ./setprefixvar
7213 : Use ' ' for none so value is preserved next time through Configure
7214 $test X"$html1dir" = "X" && html1dir=' '
7215
7216 : determine where html pages for libraries and modules go
7217 set html3dir html3dir none
7218 eval $prefixit
7219 $cat <<EOM
7220
7221 If you wish to install html files for modules associated with $spackage,
7222 indicate the appropriate directory here.  To skip installing html files,
7223 answer "none".
7224 EOM
7225 : There is no obvious default.  If they have specified html1dir, then
7226 : try to key off that, possibly changing .../html1 into .../html3.
7227 case "$html3dir" in
7228 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7229 *) dflt=$html3dir ;;
7230 esac
7231 fn=dn+~
7232 rp="Directory for the $spackage module html pages?"
7233 . ./getfile
7234 prefixvar=html3dir
7235 . ./setprefixvar
7236 : Use ' ' for none so value is preserved next time through Configure
7237 $test X"$html3dir" = "X" && html3dir=' '
7238
7239 : determine whether to install perl also as /usr/bin/perl
7240
7241 echo " "
7242 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7243         $cat <<EOM
7244 Many scripts expect perl to be installed as /usr/bin/perl.
7245
7246 If you want to, I can install the perl you are about to compile
7247 as /usr/bin/perl (in addition to $bin/perl).
7248 EOM
7249         if test -f /usr/bin/perl; then
7250             $cat <<EOM
7251
7252 However, please note that because you already have a /usr/bin/perl,
7253 overwriting that with a new Perl would very probably cause problems.
7254 Therefore I'm assuming you don't want to do that (unless you insist).
7255
7256 EOM
7257             case "$installusrbinperl" in
7258             "$define"|[yY]*)    dflt='y';;
7259             *)                  dflt='n';;
7260             esac
7261         else
7262             $cat <<EOM
7263
7264 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7265
7266 EOM
7267             case "$installusrbinperl" in
7268             "$undef"|[nN]*)     dflt='n';;
7269             *)                  dflt='y';;
7270             esac
7271         fi
7272         rp="Do you want to install perl as /usr/bin/perl?"
7273         . ./myread
7274         case "$ans" in
7275         [yY]*)  val="$define";;
7276         *)      val="$undef" ;;
7277         esac
7278 else
7279         val="$undef"
7280 fi
7281 set installusrbinperl
7282 eval $setvar
7283
7284 : Check if we are using the GNU C library
7285 echo " "
7286 echo "Checking for GNU C Library..." >&4
7287 cat >try.c <<'EOCP'
7288 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7289    alone are insufficient to distinguish different versions, such as
7290    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7291    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7292 */
7293 #include <stdio.h>
7294 int main(void)
7295 {
7296 #ifdef __GLIBC__
7297 #   ifdef __GLIBC_MINOR__
7298 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7299 #           include <gnu/libc-version.h>
7300             printf("%s\n",  gnu_get_libc_version());
7301 #       else
7302             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7303 #       endif
7304 #   else
7305         printf("%d\n",  __GLIBC__);
7306 #   endif
7307     return 0;
7308 #else
7309     return 1;
7310 #endif
7311 }
7312 EOCP
7313 set try
7314 if eval $compile_ok && $run ./try > glibc.ver; then
7315         val="$define"
7316         gnulibc_version=`$cat glibc.ver`
7317         echo "You are using the GNU C Library version $gnulibc_version"
7318 else
7319         val="$undef"
7320         gnulibc_version=''
7321         echo "You are not using the GNU C Library"
7322 fi
7323 $rm_try glibc.ver
7324 set d_gnulibc
7325 eval $setvar
7326
7327 : see if nm is to be used to determine whether a symbol is defined or not
7328 case "$usenm" in
7329 '')
7330         dflt=''
7331         case "$d_gnulibc" in
7332         "$define")
7333                 echo " "
7334                 echo "nm probably won't work on the GNU C Library." >&4
7335                 dflt=n
7336                 ;;
7337         esac
7338         case "$dflt" in
7339         '') 
7340                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7341                         echo " "
7342                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7343                         echo "'nm' won't be sufficient on this sytem." >&4
7344                         dflt=n
7345                 fi
7346                 ;;
7347         esac
7348         case "$dflt" in
7349         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7350                 if $test $dflt -gt 20; then
7351                         dflt=y
7352                 else
7353                         dflt=n
7354                 fi
7355                 ;;
7356         esac
7357         ;;
7358 *)
7359         case "$usenm" in
7360         true|$define) dflt=y;;
7361         *) dflt=n;;
7362         esac
7363         ;;
7364 esac
7365 $cat <<EOM
7366
7367 I can use $nm to extract the symbols from your C libraries. This
7368 is a time consuming task which may generate huge output on the disk (up
7369 to 3 megabytes) but that should make the symbols extraction faster. The
7370 alternative is to skip the 'nm' extraction part and to compile a small
7371 test program instead to determine whether each symbol is present. If
7372 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7373 this may be the best solution.
7374
7375 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7376
7377 EOM
7378 rp="Shall I use $nm to extract C symbols from the libraries?"
7379 . ./myread
7380 case "$ans" in
7381 [Nn]*) usenm=false;;
7382 *) usenm=true;;
7383 esac
7384
7385 runnm=$usenm
7386 case "$reuseval" in
7387 true) runnm=false;;
7388 esac
7389
7390 : nm options which may be necessary
7391 case "$nm_opt" in
7392 '') if $test -f /mach_boot; then
7393                 nm_opt=''       # Mach
7394         elif $test -d /usr/ccs/lib; then
7395                 nm_opt='-p'     # Solaris (and SunOS?)
7396         elif $test -f /dgux; then
7397                 nm_opt='-p'     # DG-UX
7398         elif $test -f /lib64/rld; then
7399                 nm_opt='-p'     # 64-bit Irix
7400         else
7401                 nm_opt=''
7402         fi;;
7403 esac
7404
7405 : nm options which may be necessary for shared libraries but illegal
7406 : for archive libraries.  Thank you, Linux.
7407 case "$nm_so_opt" in
7408 '')     case "$myuname" in
7409         *linux*|gnu*)
7410                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7411                         nm_so_opt='--dynamic'
7412                 fi
7413                 ;;
7414         esac
7415         ;;
7416 esac
7417
7418 : get list of predefined functions in a handy place
7419 case "$runnm" in
7420 true)
7421 echo " "
7422 case "$libc" in
7423 '') libc=unknown
7424         case "$libs" in
7425         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7426         esac
7427         ;;
7428 esac
7429 case "$libs" in
7430 '') ;;
7431 *)  for thislib in $libs; do
7432         case "$thislib" in
7433         -lc|-lc_s)
7434                 : Handle C library specially below.
7435                 ;;
7436         -l*)
7437                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7438                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7439                         :
7440                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7441                         :
7442                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7443                         :
7444                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7445                         :
7446                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7447                         :
7448                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7449                         :
7450                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7451                         :
7452                 else
7453                         try=''
7454                 fi
7455                 libnames="$libnames $try"
7456                 ;;
7457         *) libnames="$libnames $thislib" ;;
7458         esac
7459         done
7460         ;;
7461 esac
7462 xxx=normal
7463 case "$libc" in
7464 unknown)
7465         set /lib/libc.$so
7466         for xxx in $libpth; do
7467                 $test -r $1 || set $xxx/libc.$so
7468                 : The messy sed command sorts on library version numbers.
7469                 $test -r $1 || \
7470                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7471                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7472                                 h
7473                                 s/[0-9][0-9]*/0000&/g
7474                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7475                                 G
7476                                 s/\n/ /' | \
7477                          $sort | $sed -e 's/^.* //'`
7478                 eval set \$$#
7479         done
7480         $test -r $1 || set /usr/ccs/lib/libc.$so
7481         $test -r $1 || set /lib/libsys_s$_a
7482         ;;
7483 *)
7484         set blurfl
7485         ;;
7486 esac
7487 if $test -r "$1"; then
7488         echo "Your (shared) C library seems to be in $1."
7489         libc="$1"
7490 elif $test -r /lib/libc && $test -r /lib/clib; then
7491         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7492         xxx=apollo
7493         libc='/lib/clib /lib/libc'
7494         if $test -r /lib/syslib; then
7495                 echo "(Your math library is in /lib/syslib.)"
7496                 libc="$libc /lib/syslib"
7497         fi
7498 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7499         echo "Your C library seems to be in $libc, as you said before."
7500 elif $test -r $incpath/usr/lib/libc$_a; then
7501         libc=$incpath/usr/lib/libc$_a;
7502         echo "Your C library seems to be in $libc.  That's fine."
7503 elif $test -r /lib/libc$_a; then
7504         libc=/lib/libc$_a;
7505         echo "Your C library seems to be in $libc.  You're normal."
7506 else
7507         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7508                 :
7509         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7510                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7511         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7512                 :
7513         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7514                 :
7515         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7516                 :
7517         else
7518                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7519         fi
7520         if $test -r "$tans"; then
7521                 echo "Your C library seems to be in $tans, of all places."
7522                 libc=$tans
7523         else
7524                 libc='blurfl'
7525         fi
7526 fi
7527 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7528         dflt="$libc"
7529         cat <<EOM
7530
7531 If the guess above is wrong (which it might be if you're using a strange
7532 compiler, or your machine supports multiple models), you can override it here.
7533
7534 EOM
7535 else
7536         dflt=''
7537         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7538         cat >&4 <<EOM
7539 I can't seem to find your C library.  I've looked in the following places:
7540
7541 EOM
7542         $sed 's/^/      /' libpath
7543         cat <<EOM
7544
7545 None of these seems to contain your C library. I need to get its name...
7546
7547 EOM
7548 fi
7549 fn=f
7550 rp='Where is your C library?'
7551 . ./getfile
7552 libc="$ans"
7553
7554 echo " "
7555 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7556 set X `cat libnames`
7557 shift
7558 xxx=files
7559 case $# in 1) xxx=file; esac
7560 echo "Extracting names from the following $xxx for later perusal:" >&4
7561 echo " "
7562 $sed 's/^/      /' libnames >&4
7563 echo " "
7564 $echo $n "This may take a while...$c" >&4
7565
7566 for file in $*; do
7567         case $file in
7568         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7569         *) $nm $nm_opt $file 2>/dev/null;;
7570         esac
7571 done >libc.tmp
7572
7573 $echo $n ".$c"
7574 $grep fprintf libc.tmp > libc.ptf
7575 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7576 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7577 xxx='[ADTSIW]'
7578 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7579         eval $xscan;\
7580         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7581                 eval $xrun
7582 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7583         eval $xscan;\
7584         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7585                 eval $xrun
7586 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7587         eval $xscan;\
7588         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7589                 eval $xrun
7590 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7591         eval $xscan;\
7592         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7593                 eval $xrun
7594 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7595         eval $xscan;\
7596         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7597                 eval $xrun
7598 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7599         eval $xscan;\
7600         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7601                 eval $xrun
7602 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7603                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7604         eval $xscan;\
7605         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7606                 eval $xrun
7607 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7608         eval $xscan;\
7609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7610                 eval $xrun
7611 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7612         eval $xscan;\
7613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614                 eval $xrun
7615 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 else
7636         $nm -p $* 2>/dev/null >libc.tmp
7637         $grep fprintf libc.tmp > libc.ptf
7638         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7639                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7640         then
7641                 nm_opt='-p'
7642                 eval $xrun
7643         else
7644                 echo " "
7645                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7646                 com=''
7647                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7648                         for thisname in $libnames $libc; do
7649                                 $ar t $thisname >>libc.tmp
7650                         done
7651                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7652                         echo "Ok." >&4
7653                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7654                         # Repeat libc to extract forwarders to DLL entries too
7655                         for thisname in $libnames $libc; do
7656                                 $ar tv $thisname >>libc.tmp
7657                                 # Revision 50 of EMX has bug in $ar.
7658                                 # it will not extract forwarders to DLL entries
7659                                 # Use emximp which will extract exactly them.
7660                                 emximp -o tmp.imp $thisname \
7661                                     2>/dev/null && \
7662                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7663                                     < tmp.imp >>libc.tmp
7664                                 $rm tmp.imp
7665                         done
7666                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7667                         echo "Ok." >&4
7668                 else
7669                         echo "$ar didn't seem to work right." >&4
7670                         echo "Maybe this is a Cray...trying bld instead..." >&4
7671                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7672                         then
7673                                 for thisname in $libnames; do
7674                                         bld t $libnames | \
7675                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7676                                         $ar t $thisname >>libc.tmp
7677                                 done
7678                                 echo "Ok." >&4
7679                         else
7680                                 echo "That didn't work either.  Giving up." >&4
7681                                 exit 1
7682                         fi
7683                 fi
7684         fi
7685 fi
7686 nm_extract="$com"
7687 case "$PASE" in
7688 define)
7689     echo " "
7690     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7691     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7692     ;;
7693 *)  if $test -f /lib/syscalls.exp; then
7694         echo " "
7695         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7696         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7697     fi
7698     ;;
7699 esac
7700 ;;
7701 esac
7702 $rm -f libnames libpath
7703
7704 : see if dld is available
7705 set dld.h i_dld
7706 eval $inhdr
7707
7708 : Check if we are using C++
7709 echo " "
7710 echo "Checking for C++..." >&4
7711 $cat >try.c <<'EOCP'
7712 #include <stdio.h>
7713 int main(void)
7714 {
7715 #ifdef __cplusplus
7716     return 0;
7717 #else
7718     return 1;
7719 #endif
7720 }
7721 EOCP
7722 set try
7723 if eval $compile_ok && $run ./try; then
7724         val="$define"
7725         echo "You are using a C++ compiler."
7726 else
7727         val="$undef"
7728         echo "You are not using a C++ compiler."
7729 fi
7730 $rm_try cplusplus$$
7731 set d_cplusplus
7732 eval $setvar
7733
7734 : is a C symbol defined?
7735 csym='tlook=$1;
7736 case "$3" in
7737 -v) tf=libc.tmp; tdc="";;
7738 -a) tf=libc.tmp; tdc="[]";;
7739 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7740 esac;
7741 tx=yes;
7742 case "$reuseval-$4" in
7743 true-) ;;
7744 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7745 esac;
7746 case "$tx" in
7747 yes)
7748         tval=false;
7749         case "$d_cplusplus" in
7750                 $define) extern_C=\"C\";;
7751         esac;
7752         if $test "$runnm" = true; then
7753                 if $contains $tlook $tf >/dev/null 2>&1; then
7754                         tval=true;
7755                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7756                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7757                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7758                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7759                         $rm_try;
7760                 fi;
7761         else
7762                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7763                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7764                 $rm_try;
7765         fi;
7766         ;;
7767 *)
7768         case "$tval" in
7769         $define) tval=true;;
7770         *) tval=false;;
7771         esac;
7772         ;;
7773 esac;
7774 eval "$2=$tval"'
7775
7776 : define an is-in-libc? function
7777 inlibc='echo " "; td=$define; tu=$undef;
7778 sym=$1; var=$2; eval "was=\$$2";
7779 tx=yes;
7780 case "$reuseval$was" in
7781 true) ;;
7782 true*) tx=no;;
7783 esac;
7784 case "$tx" in
7785 yes)
7786         set $sym tres -f;
7787         eval $csym;
7788         case "$tres" in
7789         true)
7790                 echo "$sym() found." >&4;
7791                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7792         *)
7793                 echo "$sym() NOT found." >&4;
7794                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7795         esac;;
7796 *)
7797         case "$was" in
7798         $define) echo "$sym() found." >&4;;
7799         *) echo "$sym() NOT found." >&4;;
7800         esac;;
7801 esac'
7802
7803 : see if dlopen exists
7804 xxx_runnm="$runnm"
7805 xxx_ccflags="$ccflags"
7806 runnm=false
7807 : with g++ one needs -shared to get is-in-libc to work for dlopen
7808 case "$gccversion" in
7809 '')     ;;
7810 *)      case "$d_cplusplus" in
7811         "$define") ccflags="$ccflags -shared" ;;
7812         esac
7813         ;;
7814 esac
7815 set dlopen d_dlopen
7816 eval $inlibc
7817 runnm="$xxx_runnm"
7818 ccflags="$xxx_ccflags"
7819
7820 : see if this is a unistd.h system
7821 set unistd.h i_unistd
7822 eval $inhdr
7823
7824 : determine which dynamic loading, if any, to compile in
7825 echo " "
7826 dldir="ext/DynaLoader"
7827 case "$usedl" in
7828 $define|y|true)
7829         dflt='y'
7830         usedl="$define"
7831         ;;
7832 $undef|n|false)
7833         dflt='n'
7834         usedl="$undef"
7835         ;;
7836 *)
7837         dflt='n'
7838         case "$d_dlopen" in
7839             $define) dflt='y' ;;
7840         esac
7841         case "$i_dld" in
7842             $define) dflt='y' ;;
7843         esac
7844         : Does a dl_xxx.xs file exist for this operating system
7845         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7846         ;;
7847 esac
7848 rp="Do you wish to use dynamic loading?"
7849 . ./myread
7850 usedl="$ans"
7851 case "$ans" in
7852 y*) usedl="$define"
7853         case "$dlsrc" in
7854         '')
7855                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7856                         dflt="$dldir/dl_${osname}.xs"
7857                 elif $test "$d_dlopen" = "$define" ; then
7858                         dflt="$dldir/dl_dlopen.xs"
7859                 elif $test "$i_dld" = "$define" ; then
7860                         dflt="$dldir/dl_dld.xs"
7861                 else
7862                         dflt=''
7863                 fi
7864                 ;;
7865         *)      dflt="$dldir/$dlsrc"
7866                 ;;
7867         esac
7868     echo "The following dynamic loading files are available:"
7869         : Can not go over to $dldir because getfile has path hard-coded in.
7870         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7871         rp="Source file to use for dynamic loading"
7872         fn="fne"
7873         gfpth="$src"
7874         . ./getfile
7875         usedl="$define"
7876         : emulate basename
7877         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7878
7879         $cat << EOM
7880
7881 Some systems may require passing special flags to $cc -c to
7882 compile modules that will be used to create a shared library.
7883 To use no flags, say "none".
7884
7885 EOM
7886     case "$cccdlflags" in
7887     '') case "$gccversion" in
7888                 '') case "$osname" in
7889                         hpux)   dflt='+z' ;;
7890                         next)   dflt='none' ;;
7891                         irix*)  dflt='-KPIC' ;;
7892                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7893                         sunos)  dflt='-pic' ;;
7894                         *)      dflt='none' ;;
7895                     esac
7896                         ;;
7897                 *)  case "$osname" in
7898                         darwin) dflt='none' ;;
7899                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7900                         *)      dflt='-fpic' ;;
7901                     esac ;;
7902             esac ;;
7903         ' ') dflt='none' ;;
7904     *)  dflt="$cccdlflags" ;;
7905     esac
7906     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7907     . ./myread
7908     case "$ans" in
7909     none) cccdlflags=' ' ;;
7910     *) cccdlflags="$ans" ;;
7911     esac
7912
7913     cat << EOM
7914
7915 Some systems use ld to create libraries that can be dynamically loaded,
7916 while other systems (such as those using ELF) use $cc.
7917
7918 EOM
7919         case "$ld" in
7920         '')     $cat >try.c <<EOM
7921 /* Test for whether ELF binaries are produced */
7922 #include <fcntl.h>
7923 #$i_stdlib I_STDLIB
7924 #ifdef I_STDLIB
7925 #include <stdlib.h>
7926 #endif
7927 #$i_unistd I_UNISTD
7928 #ifdef I_UNISTD
7929 #include <unistd.h>
7930 #endif
7931 int main() {
7932         char b[4];
7933         int i = open("a.out",O_RDONLY);
7934         if(i == -1)
7935                 exit(1); /* fail */
7936         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7937                 exit(0); /* succeed (yes, it's ELF) */
7938         else
7939                 exit(1); /* fail */
7940 }
7941 EOM
7942                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7943                         cat <<EOM
7944 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7945 EOM
7946                         dflt="$cc"
7947                 else
7948                         echo "I'll use ld to build dynamic libraries."
7949                         dflt='ld'
7950                 fi
7951                 $rm_try
7952                 ;;
7953         *)      dflt="$ld"
7954                 ;;
7955         esac
7956
7957     rp="What command should be used to create dynamic libraries?"
7958     . ./myread
7959         ld="$ans"
7960
7961     cat << EOM
7962
7963 Some systems may require passing special flags to $ld to create a
7964 library that can be dynamically loaded.  If your ld flags include
7965 -L/other/path options to locate libraries outside your loader's normal
7966 search path, you may need to specify those -L options here as well.  To
7967 use no flags, say "none".
7968
7969 EOM
7970     case "$lddlflags" in
7971     '') case "$osname" in
7972                         beos) dflt='-nostart' ;;
7973                         hpux) dflt='-b';
7974                               case "$gccversion" in
7975                               '') dflt="$dflt +vnocompatwarnings" ;;
7976                               esac
7977                               ;;
7978                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7979                         next)  dflt='none' ;;
7980                         solaris) dflt='-G' ;;
7981                         sunos) dflt='-assert nodefinitions' ;;
7982                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7983                 *)     dflt='none' ;;
7984                         esac
7985                         ;;
7986     *) dflt="$lddlflags" ;;
7987     esac
7988
7989         : Try to guess additional flags to pick up local libraries.
7990         : Be careful not to append to a plain 'none'
7991         case "$dflt" in
7992         none) dflt='' ;;
7993         esac
7994         for thisflag in $ldflags; do
7995                 case "$thisflag" in
7996                 -L*|-R*|-Wl,-R*)
7997                         case " $dflt " in
7998                         *" $thisflag "*) ;;
7999                         *) dflt="$dflt $thisflag" ;;
8000                         esac
8001                         ;;
8002                 esac
8003         done
8004
8005         case "$dflt" in
8006         ''|' ') dflt='none' ;;
8007         esac
8008
8009     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8010     . ./myread
8011     case "$ans" in
8012     none) lddlflags=' ' ;;
8013     *) lddlflags="$ans" ;;
8014     esac
8015
8016         cat <<EOM
8017
8018 Some systems may require passing special flags to $cc to indicate that
8019 the resulting executable will use dynamic linking.  To use no flags,
8020 say "none".
8021
8022 EOM
8023     case "$ccdlflags" in
8024     '') case "$osname" in
8025             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8026             next|sunos) dflt='none' ;;
8027             *)          dflt='none' ;;
8028             esac ;;
8029     ' ')  dflt='none' ;;
8030     *)  dflt="$ccdlflags" ;;
8031     esac
8032     rp="Any special flags to pass to $cc to use dynamic linking?"
8033     . ./myread
8034     case "$ans" in
8035     none) ccdlflags=' ' ;;
8036     *) ccdlflags="$ans" ;;
8037     esac
8038     ;;
8039 *)  usedl="$undef"
8040         ld='ld'
8041     dlsrc='dl_none.xs'
8042     lddlflags=''
8043     ccdlflags=''
8044     ;;
8045 esac
8046
8047 : Do we want a shared libperl?
8048 also=''
8049 case "$usedl" in
8050 $undef)
8051         # No dynamic loading being used, so don't bother even to prompt.
8052         useshrplib='false'
8053         ;;
8054 *)      case "$useshrplib" in
8055         '')     case "$osname" in
8056                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
8057                         dflt=y
8058                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8059                         ;;
8060                 next*)
8061                         case "$osvers" in
8062                         4*)     dflt=y
8063                                 also='Building a shared libperl is needed for MAB support.'
8064                                 ;;
8065                         *)      dflt=n
8066                                 ;;
8067                         esac
8068                         ;;
8069                 *)      dflt=n
8070                         ;;
8071                 esac
8072                 ;;
8073         $define|true|[Yy]*)
8074                 dflt=y
8075                 ;;
8076         *)      dflt=n
8077                 ;;
8078         esac
8079         $cat << EOM
8080
8081 The perl executable is normally obtained by linking perlmain.c with
8082 libperl${_a}, any static extensions (usually just DynaLoader), and
8083 any other libraries needed on this system (such as -lm, etc.).  Since
8084 your system supports dynamic loading, it is probably possible to build
8085 a shared libperl.$so.  If you will have more than one executable linked
8086 to libperl.$so, this will significantly reduce the size of each
8087 executable, but it may have a noticeable effect on performance.  The
8088 default is probably sensible for your system.
8089 $also
8090
8091 EOM
8092         rp="Build a shared libperl.$so (y/n)"
8093         . ./myread
8094         case "$ans" in
8095         true|$define|[Yy]*)
8096                 useshrplib='true'  ;;
8097         *)      useshrplib='false' ;;
8098         esac
8099         ;;
8100 esac
8101
8102 case "$useshrplib" in
8103 true)
8104         case "$libperl" in
8105         '')
8106                 # Figure out a good name for libperl.so.  Since it gets stored in
8107                 # a version-specific architecture-dependent library, the version
8108                 # number isn't really that important, except for making cc/ld happy.
8109                 #
8110                 # A name such as libperl.so.3.1
8111                 majmin="libperl.$so.$patchlevel.$subversion"
8112                 # A name such as libperl.so.301
8113                 majonly=`echo $patchlevel $subversion |
8114                         $awk '{printf "%d%02d", $1, $2}'`
8115                 majonly=libperl.$so.$majonly
8116                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8117                 # rely on figuring it out from the naming of libc.
8118                 case "${osname}${osvers}" in
8119                 next4*)
8120                         dflt=libperl.5.$so
8121                         # XXX How handle the --version stuff for MAB?
8122                         ;;
8123                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8124                         dflt=libperl.$so
8125                         ;;
8126                 cygwin*) # ld links against an importlib
8127                         dflt=libperl$lib_ext
8128                         ;;
8129                 *)      # Try to guess based on whether libc has major.minor.
8130                         case "$libc" in
8131                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8132                         *libc.$so.[0-9]*) dflt=$majonly ;;
8133                         *)      dflt=libperl.$so ;;
8134                         esac
8135                         ;;
8136                 esac
8137                 ;;
8138         *)      dflt=$libperl
8139                 ;;
8140         esac
8141         cat << EOM
8142
8143 I need to select a good name for the shared libperl.  If your system uses
8144 library names with major and minor numbers, then you might want something
8145 like $majmin.  Alternatively, if your system uses a single version
8146 number for shared libraries, then you might want to use $majonly.
8147 Or, your system might be quite happy with a simple libperl.$so.
8148
8149 Since the shared libperl will get installed into a version-specific
8150 architecture-dependent directory, the version number of the shared perl
8151 library probably isn't important, so the default should be o.k.
8152
8153 EOM
8154         rp='What name do you want to give to the shared libperl?'
8155         . ./myread
8156         libperl=$ans
8157         echo "Ok, I'll use $libperl"
8158         ;;
8159 *)
8160         libperl="libperl${_a}"
8161         ;;
8162 esac
8163
8164 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8165 case "$shrpdir" in
8166 '') ;;
8167 *)      $cat >&4 <<EOM
8168 WARNING:  Use of the shrpdir variable for the installation location of
8169 the shared $libperl is not supported.  It was never documented and
8170 will not work in this version.  Let me (perlbug@perl.org)
8171 know of any problems this may cause.
8172
8173 EOM
8174         case "$shrpdir" in
8175         "$archlibexp/CORE")
8176                 $cat >&4 <<EOM
8177 But your current setting of $shrpdir is
8178 the default anyway, so it's harmless.
8179 EOM
8180                 ;;
8181         *)
8182                 $cat >&4 <<EOM
8183 Further, your current attempted setting of $shrpdir
8184 conflicts with the value of $archlibexp/CORE
8185 that installperl will use.
8186 EOM
8187                 ;;
8188         esac
8189         ;;
8190 esac
8191
8192 # How will the perl executable find the installed shared $libperl?
8193 # Add $xxx to ccdlflags.
8194 # If we can't figure out a command-line option, use $shrpenv to
8195 # set env LD_RUN_PATH.  The main perl makefile uses this.
8196 shrpdir=$archlibexp/CORE
8197 xxx=''
8198 tmp_shrpenv=''
8199 if "$useshrplib"; then
8200     case "$osname" in
8201         aix)
8202                 # We'll set it in Makefile.SH...
8203                 ;;
8204         solaris)
8205                 xxx="-R $shrpdir"
8206                 ;;
8207         freebsd|netbsd|openbsd|interix|dragonfly)
8208                 xxx="-Wl,-R$shrpdir"
8209                 ;;
8210         bsdos|linux|irix*|dec_osf|gnu*)
8211                 xxx="-Wl,-rpath,$shrpdir"
8212                 ;;
8213         next)
8214                 # next doesn't like the default...
8215                 ;;
8216         beos)
8217                 # beos doesn't like the default, either.
8218                 ;;
8219         hpux*)
8220                 # hpux doesn't like the default, either.
8221                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8222                 ;;
8223         *)
8224                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8225                 ;;
8226         esac
8227         case "$xxx" in
8228         '') ;;
8229         *)
8230                 # Only add $xxx if it isn't already in ccdlflags.
8231                 case " $ccdlflags " in
8232                 *" $xxx "*)     ;;
8233                 *)      ccdlflags="$ccdlflags $xxx"
8234                         cat <<EOM >&4
8235
8236 Adding $xxx to the flags
8237 passed to $ld so that the perl executable will find the
8238 installed shared $libperl.
8239
8240 EOM
8241                         ;;
8242                 esac
8243                 ;;
8244         esac
8245 fi
8246 # Fix ccdlflags in AIX for building external extensions.
8247 # (For building Perl itself bare -bE:perl.exp is needed,
8248 #  Makefile.SH takes care of this.)
8249 case "$osname" in
8250 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8251 esac
8252 # Respect a hint or command-line value.
8253 case "$shrpenv" in
8254 '') shrpenv="$tmp_shrpenv" ;;
8255 esac
8256 case "$ldlibpthname" in
8257 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8258 none)   ldlibpthname='' ;;
8259 esac
8260
8261 : determine where manual pages are on this system
8262 echo " "
8263 case "$sysman" in
8264 '') 
8265         syspath='/usr/share/man/man1 /usr/man/man1'
8266         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8267         syspath="$syspath /usr/man/u_man/man1"
8268         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8269         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8270         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8271         sysman=`./loc . /usr/man/man1 $syspath`
8272         ;;
8273 esac
8274 if $test -d "$sysman"; then
8275         echo "System manual is in $sysman." >&4
8276 else
8277         echo "Could not find manual pages in source form." >&4
8278 fi
8279
8280 : determine where manual pages go
8281 set man1dir man1dir none
8282 eval $prefixit
8283 $cat <<EOM
8284
8285 $spackage has manual pages available in source form.
8286 EOM
8287 case "$nroff" in
8288 nroff)
8289         echo "However, you don't have nroff, so they're probably useless to you."
8290         case "$man1dir" in
8291         '') man1dir="none";;
8292         esac;;
8293 esac
8294 echo "If you don't want the manual sources installed, answer 'none'."
8295 case "$man1dir" in
8296 ' ') dflt=none
8297         ;;
8298 '')
8299         lookpath="$prefixexp/share/man/man1"
8300         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8301         lookpath="$lookpath $prefixexp/man/p_man/man1"
8302         lookpath="$lookpath $prefixexp/man/u_man/man1"
8303         lookpath="$lookpath $prefixexp/man/man.1"
8304         case "$sysman" in
8305         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8306         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8307         esac
8308         set dflt
8309         eval $prefixup
8310         ;;
8311 *)  dflt="$man1dir"
8312         ;;
8313 esac
8314 echo " "
8315 fn=dn+~
8316 rp="Where do the main $spackage manual pages (source) go?"
8317 . ./getfile
8318 if $test "X$man1direxp" != "X$ansexp"; then
8319         installman1dir=''
8320 fi
8321 prefixvar=man1dir
8322 . ./setprefixvar
8323
8324 case "$man1dir" in
8325 '')     man1dir=' '
8326         installman1dir='';;
8327 esac
8328
8329 : What suffix to use on installed man pages
8330
8331 case "$man1dir" in
8332 ' ')
8333         man1ext='0'
8334         ;;
8335 *)
8336         rp="What suffix should be used for the main $spackage man pages?"
8337         case "$man1ext" in
8338         '')     case "$man1dir" in
8339                 *1)  dflt=1 ;;
8340                 *1p) dflt=1p ;;
8341                 *1pm) dflt=1pm ;;
8342                 *l) dflt=l;;
8343                 *n) dflt=n;;
8344                 *o) dflt=o;;
8345                 *p) dflt=p;;
8346                 *C) dflt=C;;
8347                 *L) dflt=L;;
8348                 *L1) dflt=L1;;
8349                 *) dflt=1;;
8350                 esac
8351                 ;;
8352         *)      dflt="$man1ext";;
8353         esac
8354         . ./myread
8355         man1ext="$ans"
8356         ;;
8357 esac
8358
8359 : see if we can have long filenames
8360 echo " "
8361 first=123456789abcdef
8362 $rm -f $first
8363 if (echo hi >$first) 2>/dev/null; then
8364         if $test -f 123456789abcde; then
8365                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8366                 val="$undef"
8367         else
8368                 echo 'You can have filenames longer than 14 characters.'>&4
8369                 val="$define"
8370         fi
8371 else
8372         $cat <<'EOM'
8373 You can't have filenames longer than 14 chars.
8374 You can't even think about them!
8375 EOM
8376         val="$undef"
8377 fi
8378 set d_flexfnam
8379 eval $setvar
8380 $rm -rf 123456789abcde*
8381
8382 : determine where library module manual pages go
8383 set man3dir man3dir none
8384 eval $prefixit
8385 $cat <<EOM
8386
8387 $spackage has manual pages for many of the library modules.
8388 EOM
8389
8390 case "$nroff" in
8391 nroff)
8392         $cat <<'EOM'
8393 However, you don't have nroff, so they're probably useless to you.
8394 EOM
8395         case "$man3dir" in
8396         '') man3dir="none";;
8397         esac;;
8398 esac
8399
8400 case "$d_flexfnam" in
8401 undef)
8402         $cat <<'EOM'
8403 However, your system can't handle the long file names like File::Basename.3.
8404 EOM
8405         case "$man3dir" in
8406         '') man3dir="none";;
8407         esac;;
8408 esac
8409
8410 echo "If you don't want the manual sources installed, answer 'none'."
8411 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8412 case "$man3dir" in
8413 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8414         if $test -d "$privlib/man/man3"; then
8415                 cat <<EOM >&4
8416
8417 WARNING:  Previous versions of perl installed man3 pages into
8418 $privlib/man/man3.  This version will suggest a
8419 new default of $dflt.
8420 EOM
8421                 tdflt=$dflt
8422                 dflt='n'
8423                 rp='Do you wish to preserve the old behavior?(y/n)'
8424                 . ./myread
8425                 case "$ans" in
8426                 y*) dflt="$privlib/man/man3" ;;
8427                 *)  dflt=$tdflt ;;
8428                 esac
8429     fi
8430         ;;
8431 *)      dflt="$man3dir" ;;
8432 esac
8433 case "$dflt" in
8434 ' ') dflt=none ;;
8435 esac
8436 echo " "
8437 fn=dn+~
8438 rp="Where do the $package library man pages (source) go?"
8439 . ./getfile
8440 prefixvar=man3dir
8441 . ./setprefixvar
8442
8443 case "$man3dir" in
8444 '')     man3dir=' '
8445         installman3dir='';;
8446 esac
8447
8448 : What suffix to use on installed man pages
8449 case "$man3dir" in
8450 ' ')
8451         man3ext='0'
8452         ;;
8453 *)
8454         rp="What suffix should be used for the $package library man pages?"
8455         case "$man3ext" in
8456         '')     case "$man3dir" in
8457                 *3)  dflt=3 ;;
8458                 *3p) dflt=3p ;;
8459                 *3pm) dflt=3pm ;;
8460                 *l) dflt=l;;
8461                 *n) dflt=n;;
8462                 *o) dflt=o;;
8463                 *p) dflt=p;;
8464                 *C) dflt=C;;
8465                 *L) dflt=L;;
8466                 *L3) dflt=L3;;
8467                 *) dflt=3;;
8468                 esac
8469                 ;;
8470         *)      dflt="$man3ext";;
8471         esac
8472         . ./myread
8473         man3ext="$ans"
8474         ;;
8475 esac
8476
8477 : see if we have to deal with yellow pages, now NIS.
8478 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8479         if $test -f /usr/etc/nibindd; then
8480                 echo " "
8481                 echo "I'm fairly confident you're on a NeXT."
8482                 echo " "
8483                 rp='Do you get the hosts file via NetInfo?'
8484                 dflt=y
8485                 case "$hostcat" in
8486                 nidump*) ;;
8487                 '') ;;
8488                 *) dflt=n;;
8489                 esac
8490                 . ./myread
8491                 case "$ans" in
8492                 y*) hostcat='nidump hosts .';;
8493                 *)      case "$hostcat" in
8494                         nidump*) hostcat='';;
8495                         esac
8496                         ;;
8497                 esac
8498         fi
8499         case "$hostcat" in
8500         nidump*) ;;
8501         *)
8502                 case "$hostcat" in
8503                 *ypcat*) dflt=y;;
8504                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8505                                 dflt=y
8506                         else
8507                                 dflt=n
8508                         fi;;
8509                 *) dflt=n;;
8510                 esac
8511                 echo " "
8512                 rp='Are you getting the hosts file via yellow pages?'
8513                 . ./myread
8514                 case "$ans" in
8515                 y*) hostcat='ypcat hosts';;
8516                 *) hostcat='cat /etc/hosts';;
8517                 esac
8518                 ;;
8519         esac
8520 fi
8521 case "$hostcat" in
8522 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8523 esac
8524 case "$groupcat" in
8525 '') test -f /etc/group && groupcat='cat /etc/group';;
8526 esac
8527 case "$passcat" in
8528 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8529 esac
8530
8531 : now get the host name
8532 echo " "
8533 echo "Figuring out host name..." >&4
8534 case "$myhostname" in
8535 '') cont=true
8536         echo 'Maybe "hostname" will work...'
8537         if tans=`sh -c hostname 2>&1` ; then
8538                 myhostname=$tans
8539                 phostname=hostname
8540                 cont=''
8541         fi
8542         ;;
8543 *) cont='';;
8544 esac
8545 if $test "$cont"; then
8546         if ./xenix; then
8547                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8548                 if tans=`cat /etc/systemid 2>&1` ; then
8549                         myhostname=$tans
8550                         phostname='cat /etc/systemid'
8551                         echo "Whadyaknow.  Xenix always was a bit strange..."
8552                         cont=''
8553                 fi
8554         elif $test -r /etc/systemid; then
8555                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8556         fi
8557 fi
8558 if $test "$cont"; then
8559         echo 'No, maybe "uuname -l" will work...'
8560         if tans=`sh -c 'uuname -l' 2>&1` ; then
8561                 myhostname=$tans
8562                 phostname='uuname -l'
8563         else
8564                 echo 'Strange.  Maybe "uname -n" will work...'
8565                 if tans=`sh -c 'uname -n' 2>&1` ; then
8566                         myhostname=$tans
8567                         phostname='uname -n'
8568                 else
8569                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8570                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8571                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8572                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8573                         else
8574                                 case "$myhostname" in
8575                                 '') echo "Does this machine have an identity crisis or something?"
8576                                         phostname='';;
8577                                 *)
8578                                         echo "Well, you said $myhostname before..."
8579                                         phostname='echo $myhostname';;
8580                                 esac
8581                         fi
8582                 fi
8583         fi
8584 fi
8585 case "$myhostname" in
8586 '') myhostname=noname ;;
8587 esac
8588 : you do not want to know about this
8589 set $myhostname
8590 myhostname=$1
8591
8592 : verify guess
8593 if $test "$myhostname" ; then
8594         dflt=y
8595         rp='Your host name appears to be "'$myhostname'".'" Right?"
8596         . ./myread
8597         case "$ans" in
8598         y*) ;;
8599         *) myhostname='';;
8600         esac
8601 fi
8602
8603 : bad guess or no guess
8604 while $test "X$myhostname" = X ; do
8605         dflt=''
8606         rp="Please type the (one word) name of your host:"
8607         . ./myread
8608         myhostname="$ans"
8609 done
8610
8611 : translate upper to lower if necessary
8612 case "$myhostname" in
8613 *[A-Z]*)
8614         echo "(Normalizing case in your host name)"
8615         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8616         ;;
8617 esac
8618
8619 case "$myhostname" in
8620 *.*)
8621         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8622         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8623         echo "(Trimming domain name from host name--host name is now $myhostname)"
8624         ;;
8625 *) case "$mydomain" in
8626         '')
8627                 {
8628                         test "X$hostcat" = "Xypcat hosts" &&
8629                         ypmatch "$myhostname" hosts 2>/dev/null |\
8630                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8631                         $test -s hosts
8632                 } || {
8633                         test "X$hostcat" != "X" &&
8634                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8635                                         /[       ]$myhostname[  . ]/p" > hosts
8636                 }
8637                 tmp_re="[       . ]"
8638                 if $test -f hosts; then
8639                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8640                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8641                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8642                                 hosts | $sort | $uniq | \
8643                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8644                         case `$echo X$dflt` in
8645                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8646                                 dflt=.
8647                                 ;;
8648                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8649                                 ;;
8650                         esac
8651                 else
8652                         echo "(I cannot locate a hosts database anywhere)"
8653                         dflt=.
8654                 fi
8655                 case "$dflt" in
8656                 .)
8657                         tans=`./loc resolv.conf X /etc /usr/etc`
8658                         if $test -f "$tans"; then
8659                                 echo "(Attempting domain name extraction from $tans)"
8660                                 dflt=.`$sed -n -e 's/   / /g' \
8661                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8662                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8663                                 case "$dflt" in
8664                                 .) dflt=.`$sed -n -e 's/        / /g' \
8665                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8666                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8667                                         ;;
8668                                 esac
8669                         fi
8670                         ;;
8671                 esac
8672                 case "$dflt" in
8673                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8674                         dflt=.`sh -c domainname 2>/dev/null`
8675                         case "$dflt" in
8676                         '') dflt='.';;
8677                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8678                         esac
8679                         ;;
8680                 esac
8681                 case "$dflt$osname" in
8682                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8683                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8684                         ;;
8685                 esac
8686                 case "$dflt" in
8687                 .) echo "(Lost all hope -- silly guess then)"
8688                         dflt='.nonet'
8689                         ;;
8690                 esac
8691                 $rm -f hosts
8692                 ;;
8693         *) dflt="$mydomain";;
8694         esac;;
8695 esac
8696 echo " "
8697 rp="What is your domain name?"
8698 . ./myread
8699 tans="$ans"
8700 case "$ans" in
8701 '') ;;
8702 .*) ;;
8703 *) tans=".$tans";;
8704 esac
8705 mydomain="$tans"
8706
8707 : translate upper to lower if necessary
8708 case "$mydomain" in
8709 *[A-Z]*)
8710         echo "(Normalizing case in your domain name)"
8711         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8712         ;;
8713 esac
8714
8715 : a little sanity check here
8716 case "$phostname" in
8717 '') ;;
8718 *)
8719         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8720         $myhostname$mydomain|$myhostname) ;;
8721         *)
8722                 case "$phostname" in
8723                 sed*)
8724                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8725                         ;;
8726                 *)
8727                         echo "(That doesn't agree with your $phostname command, by the way.)"
8728                         ;;
8729                 esac
8730         ;;
8731         esac
8732         ;;
8733 esac
8734
8735 : determine the e-mail address of the user who is running us
8736 $cat <<EOM
8737
8738 I need to get your e-mail address in Internet format if possible, i.e.
8739 something like user@host.domain. Please answer accurately since I have
8740 no easy means to double check it. The default value provided below
8741 is most probably close to reality but may not be valid from outside
8742 your organization...
8743
8744 EOM
8745 cont=x
8746 while test "$cont"; do
8747         case "$cf_email" in
8748         '') dflt="$cf_by@$myhostname$mydomain";;
8749         *) dflt="$cf_email";;
8750         esac
8751         rp='What is your e-mail address?'
8752         . ./myread
8753         cf_email="$ans"
8754         case "$cf_email" in
8755         *@*.*) cont='' ;;
8756         *)
8757                 rp='Address does not look like an Internet one.  Use it anyway?'
8758                 case "$fastread" in
8759                 yes) dflt=y ;;
8760                 *) dflt=n ;;
8761                 esac
8762                 . ./myread
8763                 case "$ans" in
8764                 y*) cont='' ;;
8765                 *) echo " " ;;
8766                 esac
8767                 ;;
8768         esac
8769 done
8770
8771 : Ask e-mail of administrator
8772 $cat <<EOM
8773
8774 If you or somebody else will be maintaining perl at your site, please
8775 fill in the correct e-mail address here so that they may be contacted
8776 if necessary. Currently, the "perlbug" program included with perl
8777 will send mail to this address in addition to perlbug@perl.org. You may
8778 enter "none" for no administrator.
8779
8780 EOM
8781 case "$perladmin" in
8782 '') dflt="$cf_email";;
8783 *) dflt="$perladmin";;
8784 esac
8785 rp='Perl administrator e-mail address'
8786 . ./myread
8787 perladmin="$ans"
8788
8789 : determine whether to only install version-specific parts.
8790 echo " "
8791 $cat <<EOM
8792 Do you want to install only the version-specific parts of the perl
8793 distribution?  Usually you do *not* want to do this.
8794 EOM
8795 case "$versiononly" in
8796 "$define"|[Yy]*|true) dflt='y' ;;
8797 *) dflt='n';
8798 esac
8799 rp="Do you want to install only the version-specific parts of perl?"
8800 . ./myread
8801 case "$ans" in
8802 [yY]*)  val="$define";;
8803 *)      val="$undef" ;;
8804 esac
8805 set versiononly
8806 eval $setvar
8807
8808 case "$versiononly" in
8809 "$define") inc_version_list=''
8810            inc_version_list_init=0
8811            ;;
8812 esac
8813
8814 : figure out how to guarantee perl startup
8815 : XXX Note that this currently takes advantage of the bug that binexp ignores
8816 :     the Configure -Dinstallprefix setting, which in turn means that under
8817 :     relocatable @INC, initialinstalllocation is what binexp started as.
8818 case "$startperl" in
8819 '')
8820         case "$sharpbang" in
8821         *!)
8822                 $cat <<EOH
8823
8824 I can use the #! construct to start perl on your system. This will
8825 make startup of perl scripts faster, but may cause problems if you
8826 want to share those scripts and perl is not in a standard place
8827 ($initialinstalllocation/perl) on all your platforms. The alternative
8828 is to force a shell by starting the script with a single ':' character.
8829
8830 EOH
8831                 case "$versiononly" in
8832                 "$define")      dflt="$initialinstalllocation/perl$version";;
8833                 *)              dflt="$initialinstalllocation/perl";;
8834                 esac
8835                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8836                 . ./myread
8837                 case "$ans" in
8838                 none)   startperl=": # use perl";;
8839                 *)      startperl="#!$ans"
8840                         if $test 30 -lt `echo "$ans" | wc -c`; then
8841                                 $cat >&4 <<EOM
8842
8843 WARNING:  Some systems limit the #! command to 32 characters.
8844 If you experience difficulty running Perl scripts with #!, try
8845 installing Perl in a directory with a shorter pathname.
8846
8847 EOM
8848                         fi ;;
8849                 esac
8850                 ;;
8851         *) startperl=": # use perl"
8852                 ;;
8853         esac
8854         ;;
8855 esac
8856 echo "I'll use $startperl to start perl scripts."
8857
8858 : figure best path for perl in scripts
8859 case "$perlpath" in
8860 '')
8861         case "$versiononly" in
8862         "$define")      perlpath="$initialinstalllocation/perl$version";;
8863         *)              perlpath="$initialinstalllocation/perl";;
8864         esac
8865         case "$startperl" in
8866         *!*) ;;
8867         *)
8868                 $cat <<EOH
8869
8870 I will use the "eval 'exec'" idiom to start Perl on your system.
8871 I can use the full path of your Perl binary for this purpose, but
8872 doing so may cause problems if you want to share those scripts and
8873 Perl is not always in a standard place ($initialinstalllocation/perl).
8874
8875 EOH
8876                 dflt="$initialinstalllocation/perl"
8877                 rp="What path shall I use in \"eval 'exec'\"?"
8878                 . ./myread
8879                 perlpath="$ans"
8880                 ;;
8881         esac
8882         ;;
8883 esac
8884 case "$startperl" in
8885 *!*)    ;;
8886 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8887 esac
8888
8889 : determine where public executable scripts go
8890 set scriptdir scriptdir
8891 eval $prefixit
8892 case "$scriptdir" in
8893 '')
8894         dflt="$bin"
8895         : guess some guesses
8896         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8897         $test -d /usr/share/bin     && dflt=/usr/share/bin
8898         $test -d /usr/local/script  && dflt=/usr/local/script
8899         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8900         $test -d $prefixexp/script  && dflt=$prefixexp/script
8901         set dflt
8902         eval $prefixup
8903         ;;
8904 *)  dflt="$scriptdir"
8905         ;;
8906 esac
8907 $cat <<EOM
8908
8909 Some installations have a separate directory just for executable scripts so
8910 that they can mount it across multiple architectures but keep the scripts in
8911 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8912 Or you might just lump your scripts in with all your other executables.
8913
8914 EOM
8915 fn=d~
8916 rp='Where do you keep publicly executable scripts?'
8917 . ./getfile
8918 if $test "X$ansexp" != "X$scriptdirexp"; then
8919         installscript=''
8920 fi
8921 installscriptdir=''
8922 prefixvar=scriptdir
8923 . ./setprefixvar
8924 : A little fix up for an irregularly named variable.
8925 installscript="$installscriptdir"
8926
8927 : determine where add-on public executables go
8928 case "$sitebin" in
8929 '')     dflt=$siteprefix/bin ;;
8930 *)      dflt=$sitebin ;;
8931 esac
8932 fn=d~
8933 rp='Pathname where the add-on public executables should be installed?'
8934 . ./getfile
8935 prefixvar=sitebin
8936 . ./setprefixvar
8937
8938 : determine where add-on html pages go
8939 : There is no standard location, so try to copy the previously-selected
8940 : directory structure for the core html pages.
8941 case "$sitehtml1dir" in
8942 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8943 *)     dflt=$sitehtml1dir ;;
8944 esac
8945 case "$dflt" in
8946 ''|' ') dflt=none ;;
8947 esac
8948 fn=dn+~
8949 rp='Pathname where the site-specific html pages should be installed?'
8950 . ./getfile
8951 prefixvar=sitehtml1dir
8952 . ./setprefixvar
8953
8954 : determine where add-on library html pages go
8955 : There is no standard location, so try to copy the previously-selected
8956 : directory structure for the core html pages.
8957 case "$sitehtml3dir" in
8958 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8959 *)     dflt=$sitehtml3dir ;;
8960 esac
8961 case "$dflt" in
8962 ''|' ') dflt=none ;;
8963 esac
8964 fn=dn+~
8965 rp='Pathname where the site-specific library html pages should be installed?'
8966 . ./getfile
8967 prefixvar=sitehtml3dir
8968 . ./setprefixvar
8969
8970 : determine where add-on manual pages go
8971 case "$siteman1dir" in
8972 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8973 *)      dflt=$siteman1dir ;;
8974 esac
8975 case "$dflt" in
8976 ''|' ') dflt=none ;;
8977 esac
8978 fn=dn+~
8979 rp='Pathname where the site-specific manual pages should be installed?'
8980 . ./getfile
8981 prefixvar=siteman1dir
8982 . ./setprefixvar
8983
8984 : determine where add-on library man pages go
8985 case "$siteman3dir" in
8986 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8987 *)      dflt=$siteman3dir ;;
8988 esac
8989 case "$dflt" in
8990 ''|' ') dflt=none ;;
8991 esac
8992 fn=dn+~
8993 rp='Pathname where the site-specific library manual pages should be installed?'
8994 . ./getfile
8995 prefixvar=siteman3dir
8996 . ./setprefixvar
8997
8998 : determine where add-on public executable scripts go
8999 case "$sitescript" in
9000 '')     dflt=$siteprefix/script
9001         $test -d $dflt || dflt=$sitebin ;;
9002 *)  dflt="$sitescript" ;;
9003 esac
9004 fn=d~+
9005 rp='Pathname where add-on public executable scripts should be installed?'
9006 . ./getfile
9007 prefixvar=sitescript
9008 . ./setprefixvar
9009
9010 : Check if faststdio is requested and available
9011 case "$usefaststdio" in
9012 $define|true|[yY]*|'')
9013         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9014         case "$xversion" in
9015         [68])   dflt='y' ;;
9016         *)      dflt='n' ;;
9017         esac
9018         ;;
9019 *) dflt='n';;
9020 esac
9021 cat <<EOM
9022
9023 Perl can be built to use 'fast stdio', which means using the stdio
9024 library but also directly manipulating the stdio buffers to enable
9025 faster I/O.  Using stdio is better for backward compatibility (especially
9026 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9027 interface has been preferred instead of stdio.
9028
9029 If this doesn't make any sense to you, just accept the default '$dflt'.
9030 EOM
9031 rp='Use the "fast stdio" if available?'
9032 . ./myread
9033 case "$ans" in
9034 y|Y)    val="$define" ;;
9035 *)      val="$undef" ;;
9036 esac
9037 set usefaststdio
9038 eval $setvar
9039
9040
9041 : define an is-a-typedef? function
9042 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9043 case "$inclist" in
9044 "") inclist="sys/types.h";;
9045 esac;
9046 eval "varval=\$$var";
9047 case "$varval" in
9048 "")
9049         $rm -f temp.c;
9050         for inc in $inclist; do
9051                 echo "#include <$inc>" >>temp.c;
9052         done;
9053         echo "#ifdef $type" >> temp.c;
9054         echo "printf(\"We have $type\");" >> temp.c;
9055         echo "#endif" >> temp.c;
9056         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9057         if $contains $type temp.E >/dev/null 2>&1; then
9058                 eval "$var=\$type";
9059         else
9060                 eval "$var=\$def";
9061         fi;
9062         $rm -f temp.?;;
9063 *) eval "$var=\$varval";;
9064 esac'
9065
9066 : define an is-a-typedef? function that prompts if the type is not available.
9067 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9068 case "$inclist" in
9069 "") inclist="sys/types.h";;
9070 esac;
9071 eval "varval=\$$var";
9072 case "$varval" in
9073 "")
9074         $rm -f temp.c;
9075         for inc in $inclist; do
9076                 echo "#include <$inc>" >>temp.c;
9077         done;
9078         echo "#ifdef $type" >> temp.c;
9079         echo "printf(\"We have $type\");" >> temp.c;
9080         echo "#endif" >> temp.c;
9081         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9082         echo " " ;
9083         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9084         if $contains $type temp.E >/dev/null 2>&1; then
9085                 echo "$type found." >&4;
9086                 eval "$var=\$type";
9087         else
9088                 echo "$type NOT found." >&4;
9089                 dflt="$def";
9090                 . ./myread ;
9091                 eval "$var=\$ans";
9092         fi;
9093         $rm -f temp.?;;
9094 *) eval "$var=\$varval";;
9095 esac'
9096
9097 : see what type lseek is declared as in the kernel
9098 rp="What is the type used for lseek's offset on this system?"
9099 set off_t lseektype long stdio.h sys/types.h
9100 eval $typedef_ask
9101
9102 echo " "
9103 echo "Checking to see how big your file offsets are..." >&4
9104 $cat >try.c <<EOCP
9105 #include <sys/types.h>
9106 #include <stdio.h>
9107 int main()
9108 {
9109     printf("%d\n", (int)sizeof($lseektype));
9110     return(0);
9111 }
9112 EOCP
9113 set try
9114 if eval $compile_ok; then
9115         lseeksize=`$run ./try`
9116         echo "Your file offsets are $lseeksize bytes long."
9117 else
9118         dflt=$longsize
9119         echo " "
9120         echo "(I can't seem to compile the test program.  Guessing...)"
9121         rp="What is the size of your file offsets (in bytes)?"
9122         . ./myread
9123         lseeksize="$ans"
9124 fi
9125 $rm_try
9126
9127 : see what type file positions are declared as in the library
9128 rp="What is the type for file position used by fsetpos()?"
9129 set fpos_t fpostype long stdio.h sys/types.h
9130 eval $typedef_ask
9131
9132 : Check size for Fpos_t
9133 echo " "
9134 case "$fpostype" in
9135 *_t) zzz="$fpostype"    ;;
9136 *)   zzz="fpos_t"       ;;
9137 esac
9138 echo "Checking the size of $zzz..." >&4
9139 cat > try.c <<EOCP
9140 #include <sys/types.h>
9141 #include <stdio.h>
9142 #$i_stdlib I_STDLIB
9143 #ifdef I_STDLIB
9144 #include <stdlib.h>
9145 #endif
9146 int main() {
9147     printf("%d\n", (int)sizeof($fpostype));
9148     exit(0);
9149 }
9150 EOCP
9151 set try
9152 if eval $compile_ok; then
9153         yyy=`$run ./try`
9154         case "$yyy" in
9155         '')     fpossize=4
9156                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9157                 ;;
9158         *)      fpossize=$yyy
9159                 echo "Your $zzz is $fpossize bytes long."
9160                 ;;
9161         esac
9162 else
9163         dflt="$longsize"
9164         echo " " >&4
9165         echo "(I can't compile the test program.  Guessing...)" >&4
9166         rp="What is the size of your file positions (in bytes)?"
9167         . ./myread
9168         fpossize="$ans"
9169 fi
9170
9171 : Check for large file support
9172 # Backward compatibility (uselfs is deprecated).
9173 case "$uselfs" in
9174 "$define"|true|[yY]*)
9175         cat <<EOM >&4
9176
9177 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9178 EOM
9179         uselargefiles="$define"
9180         ;;
9181 esac
9182
9183 case "$lseeksize:$fpossize" in
9184 8:8) cat <<EOM
9185
9186 You can have files larger than 2 gigabytes.
9187 EOM
9188    val="$define" ;;
9189 *)    case "$uselargefiles" in
9190    "$undef"|false|[nN]*) dflt='n' ;;
9191    *)   dflt='y' ;;
9192    esac
9193    cat <<EOM
9194
9195 Perl can be built to understand large files (files larger than 2 gigabytes)
9196 on some systems.  To do so, Configure can be run with -Duselargefiles.
9197
9198 If this doesn't make any sense to you, just accept the default '$dflt'.
9199 EOM
9200    rp='Try to understand large files, if available?'
9201    . ./myread
9202    case "$ans" in
9203    y|Y)         val="$define" ;;
9204    *)           val="$undef"  ;;
9205    esac
9206    ;;
9207 esac
9208 set uselargefiles
9209 eval $setvar
9210 : Look for a hint-file generated 'call-back-unit'.  If the
9211 : user has specified that a large files perl is to be built,
9212 : we may need to set or change some other defaults.
9213 if $test -f uselargefiles.cbu; then
9214         echo "Your platform has some specific hints regarding large file builds, using them..."
9215         . ./uselargefiles.cbu
9216 fi
9217 case "$uselargefiles" in
9218 "$define")
9219         if $test -f uselargefiles.cbu; then
9220                 echo " "
9221                 echo "Rechecking to see how big your file offsets are..." >&4
9222                 $cat >try.c <<EOCP
9223 #include <sys/types.h>
9224 #include <stdio.h>
9225 int main()
9226 {
9227     printf("%d\n", (int)sizeof($lseektype));
9228     return(0);
9229 }
9230 EOCP
9231                 set try
9232                 if eval $compile_ok; then
9233                         lseeksize=`$run ./try`
9234                         $echo "Your file offsets are now $lseeksize bytes long."
9235                 else
9236                         dflt="$lseeksize"
9237                         echo " "
9238                         echo "(I can't seem to compile the test program.  Guessing...)"
9239                         rp="What is the size of your file offsets (in bytes)?"
9240                         . ./myread
9241                         lseeksize="$ans"
9242                 fi
9243                 case "$fpostype" in
9244                 *_t) zzz="$fpostype"    ;;
9245                 *)   zzz="fpos_t"       ;;
9246                 esac
9247                 $echo $n "Rechecking the size of $zzz...$c" >&4
9248                 $cat > try.c <<EOCP
9249 #include <sys/types.h>
9250 #include <stdio.h>
9251 #$i_stdlib I_STDLIB
9252 #ifdef I_STDLIB
9253 #include <stdlib.h>
9254 #endif
9255 int main() {
9256     printf("%d\n", (int)sizeof($fpostype));
9257     return(0);
9258 }
9259 EOCP
9260                 set try
9261                 if eval $compile_ok; then
9262                         yyy=`$run ./try`
9263                         dflt="$lseeksize"
9264                         case "$yyy" in
9265                         '')     echo " "
9266                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9267                                 ;;
9268                         *)      fpossize=$yyy
9269                                 echo " $fpossize bytes." >&4
9270                                 ;;
9271                         esac
9272                 else
9273                         dflt="$fpossize"
9274                         echo " "
9275                         echo "(I can't compile the test program.  Guessing...)" >&4
9276                         rp="What is the size of your file positions (in bytes)?"
9277                         . ./myread
9278                         fpossize="$ans"
9279                 fi
9280                 $rm_try
9281         fi
9282         ;;
9283 esac
9284
9285 : Set the vendorbin variables
9286 case "$vendorprefix" in
9287 '')     d_vendorbin="$undef"
9288         vendorbin=''
9289         vendorbinexp=''
9290         ;;
9291 *)      d_vendorbin="$define"
9292         : determine where vendor-supplied executables go.
9293         case "$vendorbin" in
9294         '') dflt=$vendorprefix/bin ;;
9295         *)      dflt="$vendorbin" ;;
9296         esac
9297         fn=d~+
9298         rp='Pathname for the vendor-supplied executables directory?'
9299         . ./getfile
9300         vendorbin="$ans"
9301         vendorbinexp="$ansexp"
9302         ;;
9303 esac
9304 prefixvar=vendorbin
9305 . ./installprefix
9306
9307 : Set the vendorhtml1dir variables
9308 case "$vendorprefix" in
9309 '')     vendorhtml1dir=''
9310         vendorhtml1direxp=''
9311         ;;
9312 *)      : determine where vendor-supplied html pages go.
9313         : There is no standard location, so try to copy the previously-selected
9314         : directory structure for the core html pages.
9315         : XXX Better default suggestions would be welcome.
9316         case "$vendorhtml1dir" in
9317         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9318         *)      dflt=$vendorhtml1dir ;;
9319         esac
9320         case "$dflt" in
9321         ''|' ') dflt=none ;;
9322         esac
9323         fn=dn+~
9324         rp='Pathname for the vendor-supplied html pages?'
9325         . ./getfile
9326         vendorhtml1dir="$ans"
9327         vendorhtml1direxp="$ansexp"
9328         ;;
9329 esac
9330 : Use ' ' for none so value is preserved next time through Configure
9331 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9332 prefixvar=vendorhtml1dir
9333 . ./installprefix
9334
9335 : Set the vendorhtml3dir variables
9336 case "$vendorprefix" in
9337 '')     vendorhtml3dir=''
9338         vendorhtml3direxp=''
9339         ;;
9340 *)      : determine where vendor-supplied module html pages go.
9341         : There is no standard location, so try to copy the previously-selected
9342         : directory structure for the core html pages.
9343         : XXX Better default suggestions would be welcome.
9344         case "$vendorhtml3dir" in
9345         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9346         *)      dflt=$vendorhtml3dir ;;
9347         esac
9348         case "$dflt" in
9349         ''|' ') dflt=none ;;
9350         esac
9351         fn=dn+~
9352         rp='Pathname for the vendor-supplied html pages?'
9353         . ./getfile
9354         vendorhtml3dir="$ans"
9355         vendorhtml3direxp="$ansexp"
9356         ;;
9357 esac
9358 : Use ' ' for none so value is preserved next time through Configure
9359 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9360 prefixvar=vendorhtml3dir
9361 . ./installprefix
9362
9363 : Set the vendorman1dir variables
9364 case "$vendorprefix" in
9365 '')     vendorman1dir=''
9366         vendorman1direxp=''
9367         ;;
9368 *)      : determine where vendor-supplied manual pages go.
9369         case "$vendorman1dir" in
9370         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9371         *)      dflt=$vendorman1dir ;;
9372         esac
9373         case "$dflt" in
9374         ''|' ') dflt=none ;;
9375         esac
9376         fn=nd~+
9377         rp='Pathname for the vendor-supplied manual section 1 pages?'
9378         . ./getfile
9379         vendorman1dir="$ans"
9380         vendorman1direxp="$ansexp"
9381         ;;
9382 esac
9383 : Use ' ' for none so value is preserved next time through Configure
9384 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9385 prefixvar=vendorman1dir
9386 . ./installprefix
9387
9388 : Set the vendorman3dir variables
9389 case "$vendorprefix" in
9390 '')     vendorman3dir=''
9391         vendorman3direxp=''
9392         ;;
9393 *)      : determine where vendor-supplied module manual pages go.
9394         case "$vendorman3dir" in
9395         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9396         *)      dflt=$vendorman3dir ;;
9397         esac
9398         case "$dflt" in
9399         ''|' ') dflt=none ;;
9400         esac
9401         fn=nd~+
9402         rp='Pathname for the vendor-supplied manual section 3 pages?'
9403         . ./getfile
9404         vendorman3dir="$ans"
9405         vendorman3direxp="$ansexp"
9406         ;;
9407 esac
9408 : Use ' ' for none so value is preserved next time through Configure
9409 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9410 prefixvar=vendorman3dir
9411 . ./installprefix
9412
9413 : Set the vendorscript variables
9414 case "$vendorprefix" in
9415 '')     d_vendorscript="$undef"
9416         vendorscript=''
9417         vendorscriptexp=''
9418         ;;
9419 *)      d_vendorscript="$define"
9420         : determine where vendor-supplied scripts go.
9421         case "$vendorscript" in
9422         '')     dflt=$vendorprefix/script
9423                 $test -d $dflt || dflt=$vendorbin ;;
9424         *)  dflt="$vendorscript" ;;
9425         esac
9426         $cat <<EOM
9427
9428 The installation process will create a directory for
9429 vendor-supplied scripts.
9430
9431 EOM
9432         fn=d~+
9433         rp='Pathname for the vendor-supplied scripts directory?'
9434         . ./getfile
9435         vendorscript="$ans"
9436         vendorscriptexp="$ansexp"
9437         ;;
9438 esac
9439 prefixvar=vendorscript
9440 . ./installprefix
9441
9442 : see if qgcvt exists
9443 set qgcvt d_qgcvt
9444 eval $inlibc
9445
9446 : Check print/scan long double stuff
9447 echo " "
9448
9449 if $test X"$d_longdbl" = X"$define"; then
9450
9451 echo "Checking how to print long doubles..." >&4
9452
9453 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9454         $cat >try.c <<'EOCP'
9455 #include <sys/types.h>
9456 #include <stdio.h>
9457 int main() {
9458   double d = 123.456;
9459   printf("%.3f\n", d);
9460 }
9461 EOCP
9462         set try
9463         if eval $compile; then
9464                 yyy=`$run ./try`
9465                 case "$yyy" in
9466                 123.456)
9467                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9468                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9469                         echo "We will use %f."
9470                         ;;
9471                 esac
9472         fi
9473 fi
9474
9475 if $test X"$sPRIfldbl" = X; then
9476         $cat >try.c <<'EOCP'
9477 #include <sys/types.h>
9478 #include <stdio.h>
9479 int main() {
9480   long double d = 123.456;
9481   printf("%.3Lf\n", d);
9482 }
9483 EOCP
9484         set try
9485         if eval $compile; then
9486                 yyy=`$run ./try`
9487                 case "$yyy" in
9488                 123.456)
9489                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9490                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9491                         echo "We will use %Lf."
9492                         ;;
9493                 esac
9494         fi
9495 fi
9496
9497 if $test X"$sPRIfldbl" = X; then
9498         $cat >try.c <<'EOCP'
9499 #include <sys/types.h>
9500 #include <stdio.h>
9501 int main() {
9502   long double d = 123.456;
9503   printf("%.3llf\n", d);
9504 }
9505 EOCP
9506         set try
9507         if eval $compile; then
9508                 yyy=`$run ./try`
9509                 case "$yyy" in
9510                 123.456)
9511                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9512                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9513                         echo "We will use %llf."
9514                         ;;
9515                 esac
9516         fi
9517 fi
9518
9519 if $test X"$sPRIfldbl" = X; then
9520         $cat >try.c <<'EOCP'
9521 #include <sys/types.h>
9522 #include <stdio.h>
9523 int main() {
9524   long double d = 123.456;
9525   printf("%.3lf\n", d);
9526 }
9527 EOCP
9528         set try
9529         if eval $compile; then
9530                 yyy=`$run ./try`
9531                 case "$yyy" in
9532                 123.456)
9533                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9534                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9535                         echo "We will use %lf."
9536                         ;;
9537                 esac
9538         fi
9539 fi
9540
9541 if $test X"$sPRIfldbl" = X; then
9542         echo "Cannot figure out how to print long doubles." >&4
9543 else
9544         sSCNfldbl=$sPRIfldbl    # expect consistency
9545 fi
9546
9547 $rm_try
9548
9549 fi # d_longdbl
9550
9551 case "$sPRIfldbl" in
9552 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9553         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9554         d_SCNfldbl="$undef";
9555         ;;
9556 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9557         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9558         d_SCNfldbl="$define";
9559         ;;
9560 esac
9561
9562 : Check how to convert floats to strings.
9563
9564 if test "X$d_Gconvert" = X; then
9565
9566 echo " "
9567 echo "Checking for an efficient way to convert floats to strings."
9568 echo " " > try.c
9569 case "$uselongdouble" in
9570 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9571 esac
9572 case "$d_longdbl" in
9573 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9574 esac
9575 case "$d_PRIgldbl" in
9576 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9577 esac
9578 $cat >>try.c <<EOP
9579 #ifdef TRY_gconvert
9580 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9581 char *myname = "gconvert";
9582 #endif
9583 #ifdef TRY_gcvt
9584 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9585 char *myname = "gcvt";
9586 #endif
9587 #ifdef TRY_qgcvt
9588 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9589 char *myname = "qgcvt";
9590 #define DOUBLETYPE long double
9591 #endif
9592 #ifdef TRY_sprintf
9593 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9594 #ifdef HAS_PRIgldbl
9595 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9596 #else
9597 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9598 #endif
9599 #else
9600 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9601 #endif
9602 char *myname = "sprintf";
9603 #endif
9604
9605 #ifndef DOUBLETYPE
9606 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9607 #define DOUBLETYPE long double
9608 #else
9609 #define DOUBLETYPE double
9610 #endif
9611 #endif
9612
9613 #include <stdio.h>
9614
9615 #define I_STDLIB $i_stdlib
9616 #ifdef I_STDLIB
9617 #include <stdlib.h>
9618 #endif
9619
9620 int
9621 checkit(expect, got)
9622 char *expect;
9623 char *got;
9624 {
9625     if (strcmp(expect, got)) {
9626                 printf("%s oddity:  Expected %s, got %s\n",
9627                         myname, expect, got);
9628                 exit(1);
9629         }
9630 }
9631
9632 int main()
9633 {
9634         char buf[64];
9635         buf[63] = '\0';
9636
9637         /* This must be 1st test on (which?) platform */
9638         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9639         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9640         checkit("0.1", buf);
9641
9642         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9643         checkit("0.01", buf);
9644
9645         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9646         checkit("0.001", buf);
9647
9648         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9649         checkit("0.0001", buf);
9650
9651         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9652         if (strlen(buf) > 5)
9653             checkit("9e-005", buf); /* for Microsoft ?? */
9654         else
9655             checkit("9e-05", buf);
9656
9657         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9658         checkit("1", buf);
9659
9660         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9661         checkit("1.1", buf);
9662
9663         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9664         checkit("1.01", buf);
9665
9666         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9667         checkit("1.001", buf);
9668
9669         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9670         checkit("1.0001", buf);
9671
9672         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9673         checkit("1.00001", buf);
9674
9675         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9676         checkit("1.000001", buf);
9677
9678         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9679         checkit("0", buf);
9680
9681         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9682         checkit("-1", buf);
9683
9684         /* Some Linux gcvt's give 1.e+5 here. */
9685         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9686         checkit("100000", buf);
9687
9688         /* Some Linux gcvt's give -1.e+5 here. */
9689         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9690         checkit("-100000", buf);
9691
9692         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9693         checkit("123.456", buf);
9694
9695         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9696         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9697         /* 34 should be enough to scare even long double
9698          * places into using the e notation. */
9699         if (strlen(buf) > 5)
9700             checkit("1e+034", buf); /* for Microsoft */
9701         else
9702             checkit("1e+34", buf);
9703
9704         /* For Perl, if you add additional tests here, also add them to
9705          * t/base/num.t for benefit of platforms not using Configure or
9706          * overriding d_Gconvert */
9707
9708         exit(0);
9709 }
9710 EOP
9711 : first add preferred functions to our list
9712 xxx_list=""
9713 for xxx_convert in $gconvert_preference; do
9714     case $xxx_convert in
9715     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9716     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9717     esac
9718 done
9719 : then add any others
9720 for xxx_convert in gconvert gcvt sprintf; do
9721     case "$xxx_list" in
9722     *$xxx_convert*) ;;
9723     *) xxx_list="$xxx_list $xxx_convert" ;;
9724     esac
9725 done
9726
9727 case "$d_longdbl$uselongdouble" in
9728 "$define$define")
9729     : again, add prefered functions to our list first
9730     xxx_ld_list=""
9731     for xxx_convert in $gconvert_ld_preference; do
9732         case $xxx_convert in
9733         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9734         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9735         esac
9736     done
9737     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9738     for xxx_convert in qgcvt sprintf $xxx_list; do
9739         case "$xxx_ld_list" in
9740         $xxx_convert*|*" $xxx_convert"*) ;;
9741         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9742         esac
9743     done
9744     : if sprintf cannot do long doubles, move it to the end
9745     if test "$d_PRIgldbl" != "$define"; then
9746         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9747     fi
9748     : if no qgcvt, remove it
9749     if test "$d_qgcvt" != "$define"; then
9750         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9751     fi
9752     : use the ld_list
9753     xxx_list="$xxx_ld_list"
9754     ;;
9755 esac
9756
9757 for xxx_convert in $xxx_list; do
9758         echo "Trying $xxx_convert..."
9759         $rm -f try try$_o core
9760         set try -DTRY_$xxx_convert
9761         if eval $compile; then
9762                 echo "$xxx_convert() found." >&4
9763                 if $run ./try; then
9764                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9765                         break;
9766                 else
9767                         echo "...But $xxx_convert didn't work as I expected."
9768                         xxx_convert=''
9769                 fi
9770         else
9771                 echo "$xxx_convert NOT found." >&4
9772         fi
9773 done
9774
9775 if test X$xxx_convert = X; then
9776     echo "*** WHOA THERE!!! ***" >&4
9777     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9778     xxx_convert=sprintf
9779 fi
9780
9781 case "$xxx_convert" in
9782 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9783 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9784 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9785 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9786    "$define$define$define")
9787       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9788    "$define$define$undef")
9789       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9790    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9791    esac
9792    ;;
9793 esac
9794
9795 fi
9796 $rm_try
9797
9798 : see if _fwalk exists
9799 set fwalk d__fwalk
9800 eval $inlibc
9801
9802 : Initialize h_fcntl
9803 h_fcntl=false
9804
9805 : Initialize h_sysfile
9806 h_sysfile=false
9807
9808 : access call always available on UNIX
9809 set access d_access
9810 eval $inlibc
9811
9812 : locate the flags for 'access()'
9813 case "$d_access" in
9814 "$define")
9815         echo " "
9816         $cat >access.c <<EOCP
9817 #include <sys/types.h>
9818 #ifdef I_FCNTL
9819 #include <fcntl.h>
9820 #endif
9821 #ifdef I_SYS_FILE
9822 #include <sys/file.h>
9823 #endif
9824 #ifdef I_UNISTD
9825 #include <unistd.h>
9826 #endif
9827 #$i_stdlib I_STDLIB
9828 #ifdef I_STDLIB
9829 #include <stdlib.h>
9830 #endif
9831 int main() {
9832         exit(R_OK);
9833 }
9834 EOCP
9835         : check sys/file.h first, no particular reason here
9836         if $test `./findhdr sys/file.h` && \
9837                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9838                 h_sysfile=true;
9839                 echo "<sys/file.h> defines the *_OK access constants." >&4
9840         elif $test `./findhdr fcntl.h` && \
9841                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9842                 h_fcntl=true;
9843                 echo "<fcntl.h> defines the *_OK access constants." >&4
9844         elif $test `./findhdr unistd.h` && \
9845                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9846                 echo "<unistd.h> defines the *_OK access constants." >&4
9847         else
9848                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9849         fi
9850         ;;
9851 esac
9852 $rm -f access*
9853
9854 : see if accessx exists
9855 set accessx d_accessx
9856 eval $inlibc
9857
9858 : see if aintl exists
9859 set aintl d_aintl
9860 eval $inlibc
9861
9862 : see if alarm exists
9863 set alarm d_alarm
9864 eval $inlibc
9865
9866 : see if POSIX threads are available
9867 set pthread.h i_pthread
9868 eval $inhdr
9869
9870 : define a fucntion to check prototypes
9871 $cat > protochk <<EOSH
9872 $startsh
9873 cc="$cc"
9874 optimize="$optimize"
9875 ccflags="$ccflags"
9876 prototype="$prototype"
9877 define="$define"
9878 rm_try="$rm_try"
9879 usethreads=$usethreads
9880 i_pthread=$i_pthread
9881 pthread_h_first=$pthread_h_first
9882 EOSH
9883
9884 $cat >> protochk <<'EOSH'
9885
9886 $rm_try
9887 foo="$1"
9888 shift
9889 while test $# -ge 2; do
9890         case "$1" in
9891                 $define) echo "#include <$2>" >> try.c ;;
9892                 literal) echo "$2" >> try.c ;;
9893         esac
9894     # Extra magic for the benefit of systems that need pthread.h
9895     # to be included early to correctly detect threadsafe functions.
9896     # Such functions must guarantee themselves, though, that the usethreads
9897     # and i_pthread have been defined, before calling protochk.
9898     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9899         echo "#include <pthread.h>" >> try.c
9900         pthread_h_done=yes
9901     fi
9902     shift 2
9903 done
9904 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9905 cat >> try.c <<'EOCP'
9906 #ifdef CAN_PROTOTYPE
9907 #define _(args) args
9908 #else
9909 #define _(args) ()
9910 #endif
9911 EOCP
9912 echo "$foo" >> try.c
9913 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9914 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9915 status=$?
9916 $rm_try
9917 exit $status
9918 EOSH
9919 chmod +x protochk
9920 $eunicefix protochk
9921
9922 : Define hasproto macro for Configure internal use
9923 hasproto='varname=$1; func=$2; shift; shift;
9924 while $test $# -ge 2; do
9925         case "$1" in
9926         $define) echo "#include <$2>";;
9927         esac ;
9928     shift 2;
9929 done > try.c;
9930 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9931 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9932         echo "$func() prototype found.";
9933         val="$define";
9934 else
9935         echo "$func() prototype NOT found.";
9936         val="$undef";
9937 fi;
9938 set $varname;
9939 eval $setvar;
9940 $rm_try tryout.c'
9941
9942 : see if sys/types.h has to be included
9943 set sys/types.h i_systypes
9944 eval $inhdr
9945
9946 : see if sys/select.h has to be included
9947 set sys/select.h i_sysselct
9948 eval $inhdr
9949
9950 : Define hasfield macro for Configure internal use
9951 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9952 while $test $# -ge 2; do
9953         case "$1" in
9954         $define) echo "#include <$2>";;
9955         esac ;
9956     shift 2;
9957 done > try.c;
9958 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9959 set try;
9960 if eval $compile; then
9961         val="$define";
9962 else
9963         val="$undef";
9964 fi;
9965 set $varname;
9966 eval $setvar;
9967 $rm_try'
9968
9969 : see if we should include time.h, sys/time.h, or both
9970 echo " "
9971 if test "X$timeincl" = X; then
9972         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9973         $echo $n "I'm now running the test program...$c"
9974         $cat >try.c <<EOCP
9975 #include <sys/types.h>
9976 #ifdef I_TIME
9977 #include <time.h>
9978 #endif
9979 #ifdef I_SYSTIME
9980 #ifdef SYSTIMEKERNEL
9981 #define KERNEL
9982 #endif
9983 #include <sys/time.h>
9984 #endif
9985 #ifdef I_SYSSELECT
9986 #include <sys/select.h>
9987 #endif
9988 #$i_stdlib I_STDLIB
9989 #ifdef I_STDLIB
9990 #include <stdlib.h>
9991 #endif
9992 int main()
9993 {
9994         struct tm foo;
9995 #ifdef S_TIMEVAL
9996         struct timeval bar;
9997 #endif
9998 #ifdef S_TIMEZONE
9999         struct timezone tzp;
10000 #endif
10001         if (foo.tm_sec == foo.tm_sec)
10002                 exit(0);
10003 #ifdef S_TIMEVAL
10004         if (bar.tv_sec == bar.tv_sec)
10005                 exit(0);
10006 #endif
10007         exit(1);
10008 }
10009 EOCP
10010         flags=''
10011         for s_timezone in '-DS_TIMEZONE' ''; do
10012         sysselect=''
10013         for s_timeval in '-DS_TIMEVAL' ''; do
10014         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10015         for i_time in '' '-DI_TIME'; do
10016         for i_systime in '-DI_SYSTIME' ''; do
10017                 case "$flags" in
10018                 '') $echo $n ".$c"
10019                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10020                         if eval $compile; then
10021                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10022                                 shift
10023                                 flags="$*"
10024                                 echo " "
10025                                 $echo $n "Succeeded with $flags$c"
10026                         fi
10027                         ;;
10028                 esac
10029         done
10030         done
10031         done
10032         done
10033         done
10034         timeincl=''
10035         echo " "
10036         case "$flags" in
10037         *SYSTIMEKERNEL*) i_systimek="$define"
10038                 timeincl=`./findhdr sys/time.h`
10039                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10040         *) i_systimek="$undef";;
10041         esac
10042         case "$flags" in
10043         *I_TIME*) i_time="$define"
10044                 timeincl=`./findhdr time.h`" $timeincl"
10045                 echo "We'll include <time.h>." >&4;;
10046         *) i_time="$undef";;
10047         esac
10048         case "$flags" in
10049         *I_SYSTIME*) i_systime="$define"
10050                 timeincl=`./findhdr sys/time.h`" $timeincl"
10051                 echo "We'll include <sys/time.h>." >&4;;
10052         *) i_systime="$undef";;
10053         esac
10054         $rm_try
10055 fi
10056 : see if struct tm knows about tm_zone
10057 case "$i_systime$i_time" in
10058 *$define*)
10059         echo " "
10060         echo "Checking to see if your struct tm has tm_zone field..." >&4
10061         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10062         eval $hasfield
10063         ;;
10064 *)      val="$undef"
10065         set d_tm_tm_zone
10066         eval $setvar
10067         ;;
10068 esac
10069 case "$d_tm_tm_zone" in
10070 "$define")      echo "Yes, it does."   ;;
10071 *)              echo "No, it doesn't." ;;
10072 esac
10073 : see if struct tm knows about tm_gmtoff
10074 case "$i_systime$i_time" in
10075 *$define*)
10076         echo " "
10077         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10078         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10079         eval $hasfield
10080         ;;
10081 *)      val="$undef"
10082         set d_tm_tm_gmtoff
10083         eval $setvar
10084         ;;
10085 esac
10086 case "$d_tm_tm_gmtoff" in
10087 "$define")      echo "Yes, it does."   ;;
10088 *)              echo "No, it doesn't." ;;
10089 esac
10090
10091 : see if asctime_r exists
10092 set asctime_r d_asctime_r
10093 eval $inlibc
10094 case "$d_asctime_r" in
10095 "$define")
10096         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10097         case "$d_asctime_r_proto:$usethreads" in
10098         ":define")      d_asctime_r_proto=define
10099                 set d_asctime_r_proto asctime_r $hdrs
10100                 eval $hasproto ;;
10101         *)      ;;
10102         esac
10103         case "$d_asctime_r_proto" in
10104         define)
10105         case "$asctime_r_proto" in
10106         ''|0) try='char* asctime_r(const struct tm*, char*);'
10107         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
10108         esac
10109         case "$asctime_r_proto" in
10110         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10111         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
10112         esac
10113         case "$asctime_r_proto" in
10114         ''|0) try='int asctime_r(const struct tm*, char*);'
10115         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
10116         esac
10117         case "$asctime_r_proto" in
10118         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10119         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
10120         esac
10121         case "$asctime_r_proto" in
10122         ''|0)   d_asctime_r=undef
10123                 asctime_r_proto=0
10124                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10125         * )     case "$asctime_r_proto" in
10126                 REENTRANT_PROTO*) ;;
10127                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10128                 esac
10129                 echo "Prototype: $try" ;;
10130         esac
10131         ;;
10132         *)      case "$usethreads" in
10133                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10134                 esac
10135                 d_asctime_r=undef
10136                 asctime_r_proto=0
10137                 ;;
10138         esac
10139         ;;
10140 *)      asctime_r_proto=0
10141         ;;
10142 esac
10143
10144 : see if atolf exists
10145 set atolf d_atolf
10146 eval $inlibc
10147
10148 : see if atoll exists
10149 set atoll d_atoll
10150 eval $inlibc
10151
10152 : Look for GCC-style attribute format
10153 case "$d_attribute_format" in
10154 '')
10155 echo " "
10156 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10157 $cat >attrib.c <<'EOCP'
10158 #include <stdio.h>
10159 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10160 EOCP
10161 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10162         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10163                 echo "Your C compiler doesn't support __attribute__((format))."
10164                 val="$undef"
10165         else
10166                 echo "Your C compiler supports __attribute__((format))."
10167                 val="$define"
10168         fi
10169 else
10170         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10171         val="$undef"
10172 fi
10173 ;;
10174 *) val="$d_attribute_format" ;;
10175 esac
10176 set d_attribute_format
10177 eval $setvar
10178 $rm -f attrib*
10179
10180 : Look for GCC-style attribute format with null format allowed
10181 case "$d_printf_format_null" in
10182 '') case "$d_attribute_format" in
10183     $define)
10184         echo " "
10185         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10186 $cat >attrib.c <<EOCP
10187 #include <stdio.h>
10188 #$i_stdlib I_STDLIB
10189 #ifdef I_STDLIB
10190 #include <stdlib.h>
10191 #endif
10192 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10193 int null_printf (char* pat,...) { return (int)pat; }
10194 int main () { exit(null_printf(NULL)); }
10195 EOCP
10196         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10197             : run the executable in case it produces a run-time warning
10198             if $run ./attrib >>attrib.out 2>&1; then
10199                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10200                     echo "Your C compiler doesn't allow __printf__ format to be null."
10201                     val="$undef"
10202                 else
10203                     echo "Your C compiler allows __printf__ format to be null."
10204                     val="$define"
10205                 fi
10206             else
10207             echo "Your C compiler executable failed with __printf__ format null."
10208             val="$undef"
10209         fi
10210     else
10211         echo "Your C compiler fails with __printf__ format null."
10212         val="$undef"
10213     fi
10214     ;;
10215     *)  val="$undef" ;;
10216     esac
10217 ;;
10218 *)  val="$d_printf_format_null" ;;
10219 esac
10220 set d_printf_format_null
10221 eval $setvar
10222 $rm -f attrib*
10223
10224 : Look for GCC-style attribute malloc
10225 case "$d_attribute_malloc" in
10226 '')
10227 echo " "
10228 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10229 $cat >attrib.c <<'EOCP'
10230 #include <stdio.h>
10231 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10232 EOCP
10233 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10234         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10235                 echo "Your C compiler doesn't support __attribute__((malloc))."
10236                 val="$undef"
10237         else
10238                 echo "Your C compiler supports __attribute__((malloc))."
10239                 val="$define"
10240         fi
10241 else
10242         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10243         val="$undef"
10244 fi
10245 ;;
10246 *) val="$d_attribute_malloc" ;;
10247 esac
10248 set d_attribute_malloc
10249 eval $setvar
10250 $rm -f attrib*
10251
10252 : Look for GCC-style attribute nonnull
10253 case "$d_attribute_nonnull" in
10254 '')
10255 echo " "
10256 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10257 $cat >attrib.c <<'EOCP'
10258 #include <stdio.h>
10259 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10260 EOCP
10261 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10262         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10263                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10264                 val="$undef"
10265         else
10266                 echo "Your C compiler supports __attribute__((nonnull))."
10267                 val="$define"
10268         fi
10269 else
10270         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10271         val="$undef"
10272 fi
10273 ;;
10274 *) val="$d_attribute_nonnull" ;;
10275 esac
10276 set d_attribute_nonnull
10277 eval $setvar
10278 $rm -f attrib*
10279
10280 : Look for GCC-style attribute noreturn
10281 case "$d_attribute_noreturn" in
10282 '')
10283 echo " "
10284 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10285 $cat >attrib.c <<'EOCP'
10286 #include <stdio.h>
10287 void fall_over_dead( void ) __attribute__((noreturn));
10288 EOCP
10289 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10290         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10291                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10292                 val="$undef"
10293         else
10294                 echo "Your C compiler supports __attribute__((noreturn))."
10295                 val="$define"
10296         fi
10297 else
10298         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10299         val="$undef"
10300 fi
10301 ;;
10302 *) val="$d_attribute_noreturn" ;;
10303 esac
10304 set d_attribute_noreturn
10305 eval $setvar
10306 $rm -f attrib*
10307
10308 : Look for GCC-style attribute pure
10309 case "$d_attribute_pure" in
10310 '')
10311 echo " "
10312 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10313 $cat >attrib.c <<'EOCP'
10314 #include <stdio.h>
10315 int square( int n ) __attribute__((pure));
10316 EOCP
10317 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10318         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10319                 echo "Your C compiler doesn't support __attribute__((pure))."
10320                 val="$undef"
10321         else
10322                 echo "Your C compiler supports __attribute__((pure))."
10323                 val="$define"
10324         fi
10325 else
10326         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10327         val="$undef"
10328 fi
10329 ;;
10330 *) val="$d_attribute_pure" ;;
10331 esac
10332 set d_attribute_pure
10333 eval $setvar
10334 $rm -f attrib*
10335
10336 : Look for GCC-style attribute unused
10337 case "$d_attribute_unused" in
10338 '')
10339 echo " "
10340 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10341 $cat >attrib.c <<'EOCP'
10342 #include <stdio.h>
10343 int do_something( int dummy __attribute__((unused)), int n );
10344 EOCP
10345 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10346         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10347                 echo "Your C compiler doesn't support __attribute__((unused))."
10348                 val="$undef"
10349         else
10350                 echo "Your C compiler supports __attribute__((unused))."
10351                 val="$define"
10352         fi
10353 else
10354         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10355         val="$undef"
10356 fi
10357 ;;
10358 *) val="$d_attribute_unused" ;;
10359 esac
10360 set d_attribute_unused
10361 eval $setvar
10362 $rm -f attrib*
10363
10364 : Look for GCC-style attribute warn_unused_result
10365 case "$d_attribute_warn_unused_result" in
10366 '')
10367 echo " "
10368 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10369 $cat >attrib.c <<'EOCP'
10370 #include <stdio.h>
10371 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
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__((warn_unused_result))."
10376                 val="$undef"
10377         else
10378                 echo "Your C compiler supports __attribute__((warn_unused_result))."
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_warn_unused_result" ;;
10387 esac
10388 set d_attribute_warn_unused_result
10389 eval $setvar
10390 $rm -f attrib*
10391
10392 : see if bcmp exists
10393 set bcmp d_bcmp
10394 eval $inlibc
10395
10396 : see if bcopy exists
10397 set bcopy d_bcopy
10398 eval $inlibc
10399
10400 : see if getpgrp exists
10401 set getpgrp d_getpgrp
10402 eval $inlibc
10403
10404 case "$d_getpgrp" in
10405 "$define")
10406         echo " "
10407         echo "Checking to see which flavor of getpgrp is in use..."
10408         $cat >try.c <<EOP
10409 #$i_unistd I_UNISTD
10410 #include <sys/types.h>
10411 #ifdef I_UNISTD
10412 #  include <unistd.h>
10413 #endif
10414 #$i_stdlib I_STDLIB
10415 #ifdef I_STDLIB
10416 #include <stdlib.h>
10417 #endif
10418 int main()
10419 {
10420         if (getuid() == 0) {
10421                 printf("(I see you are running Configure as super-user...)\n");
10422                 setuid(1);
10423         }
10424 #ifdef TRY_BSD_PGRP
10425         if (getpgrp(1) == 0)
10426                 exit(0);
10427 #else
10428         if (getpgrp() > 0)
10429                 exit(0);
10430 #endif
10431         exit(1);
10432 }
10433 EOP
10434         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10435                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10436                 val="$define"
10437         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10438                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10439                 val="$undef"
10440         else
10441                 echo "I can't seem to compile and run the test program."
10442                 if ./usg; then
10443                         xxx="a USG one, i.e. you use getpgrp()."
10444                 else
10445                         # SVR4 systems can appear rather BSD-ish.
10446                         case "$i_unistd" in
10447                         $undef)
10448                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10449                                 val="$define"
10450                                 ;;
10451                         $define)
10452                                 xxx="probably a USG one, i.e. you use getpgrp()."
10453                                 val="$undef"
10454                                 ;;
10455                         esac
10456                 fi
10457                 echo "Assuming your getpgrp is $xxx" >&4
10458         fi
10459         ;;
10460 *) val="$undef";;
10461 esac
10462 set d_bsdgetpgrp
10463 eval $setvar
10464 $rm_try
10465
10466 : see if setpgrp exists
10467 set setpgrp d_setpgrp
10468 eval $inlibc
10469
10470 case "$d_setpgrp" in
10471 "$define")
10472         echo " "
10473         echo "Checking to see which flavor of setpgrp is in use..."
10474         $cat >try.c <<EOP
10475 #$i_unistd I_UNISTD
10476 #include <sys/types.h>
10477 #ifdef I_UNISTD
10478 #  include <unistd.h>
10479 #endif
10480 #$i_stdlib I_STDLIB
10481 #ifdef I_STDLIB
10482 #include <stdlib.h>
10483 #endif
10484 int main()
10485 {
10486         if (getuid() == 0) {
10487                 printf("(I see you are running Configure as super-user...)\n");
10488                 setuid(1);
10489         }
10490 #ifdef TRY_BSD_PGRP
10491         if (-1 == setpgrp(1, 1))
10492                 exit(0);
10493 #else
10494         if (setpgrp() != -1)
10495                 exit(0);
10496 #endif
10497         exit(1);
10498 }
10499 EOP
10500         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10501                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10502                 val="$define"
10503         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10504                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10505                 val="$undef"
10506         else
10507                 echo "(I can't seem to compile and run the test program.)"
10508                 if ./usg; then
10509                         xxx="a USG one, i.e. you use setpgrp()."
10510                 else
10511                         # SVR4 systems can appear rather BSD-ish.
10512                         case "$i_unistd" in
10513                         $undef)
10514                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10515                                 val="$define"
10516                                 ;;
10517                         $define)
10518                                 xxx="probably a USG one, i.e. you use setpgrp()."
10519                                 val="$undef"
10520                                 ;;
10521                         esac
10522                 fi
10523                 echo "Assuming your setpgrp is $xxx" >&4
10524         fi
10525         ;;
10526 *) val="$undef";;
10527 esac
10528 set d_bsdsetpgrp
10529 eval $setvar
10530 $rm_try
10531
10532 : Look for GCC-style __builtin_choose_expr
10533 case "$d_builtin_choose_expr" in
10534 '')
10535     echo " "
10536     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10537     $cat >try.c <<'EOCP'
10538 #include <assert.h>
10539 #include <stdlib.h>
10540 #include <stdio.h>
10541
10542 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10543
10544 int main(void) {
10545     assert( SYRINX(1) == 2112 );
10546     assert( SYRINX(1) != 5150 );
10547     assert( SYRINX(0) == 5150 );
10548     assert( SYRINX(0) != 2112 );
10549     puts( "All good!" );
10550     exit(0);
10551 }
10552
10553 EOCP
10554     set try
10555     if eval $compile; then
10556         echo "Your C compiler supports __builtin_choose_expr."
10557         val="$define"
10558     else
10559         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10560         val="$undef"
10561     fi
10562 ;;
10563 *) val="$d_builtin_choose_expr" ;;
10564 esac
10565
10566 set d_builtin_choose_expr
10567 eval $setvar
10568 $rm_try
10569
10570 : Look for GCC-style __builtin_expect
10571 case "$d_builtin_expect" in
10572 '')
10573     echo " "
10574     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10575     $cat >builtin.c <<'EOCP'
10576 int main(void) {
10577     int n = 50;
10578     if ( __builtin_expect(n, 0) ) n = 1;
10579 }
10580 EOCP
10581     set try
10582     if eval $compile; then
10583         echo "Your C compiler supports __builtin_choose_expr."
10584         val="$define"
10585     else
10586         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10587         val="$undef"
10588     fi
10589     ;;
10590 *) val="$d_builtin_expect" ;;
10591 esac
10592
10593 set d_builtin_expect
10594 eval $setvar
10595 $rm_try
10596
10597 : see if bzero exists
10598 set bzero d_bzero
10599 eval $inlibc
10600
10601 : see if stdarg is available
10602 echo " "
10603 if $test `./findhdr stdarg.h`; then
10604         echo "<stdarg.h> found." >&4
10605         valstd="$define"
10606 else
10607         echo "<stdarg.h> NOT found." >&4
10608         valstd="$undef"
10609 fi
10610
10611 : see if varags is available
10612 echo " "
10613 if $test `./findhdr varargs.h`; then
10614         echo "<varargs.h> found." >&4
10615 else
10616         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10617 fi
10618
10619 : set up the varargs testing programs
10620 $cat > varargs.c <<EOP
10621 #ifdef I_STDARG
10622 #include <stdarg.h>
10623 #endif
10624 #ifdef I_VARARGS
10625 #include <varargs.h>
10626 #endif
10627
10628 #ifdef I_STDARG
10629 int f(char *p, ...)
10630 #else
10631 int f(va_alist)
10632 va_dcl
10633 #endif
10634 {
10635         va_list ap;
10636 #ifndef I_STDARG
10637         char *p;
10638 #endif
10639 #ifdef I_STDARG
10640         va_start(ap,p);
10641 #else
10642         va_start(ap);
10643         p = va_arg(ap, char *);
10644 #endif
10645         va_end(ap);
10646         return 0;
10647 }
10648 EOP
10649 $cat > varargs <<EOP
10650 $startsh
10651 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10652         echo "true"
10653 else
10654         echo "false"
10655 fi
10656 $rm -f varargs$_o
10657 EOP
10658 chmod +x varargs
10659
10660 : now check which varargs header should be included
10661 echo " "
10662 i_varhdr=''
10663 case "$valstd" in
10664 "$define")
10665         if `./varargs I_STDARG`; then
10666                 val='stdarg.h'
10667         elif `./varargs I_VARARGS`; then
10668                 val='varargs.h'
10669         fi
10670         ;;
10671 *)
10672         if `./varargs I_VARARGS`; then
10673                 val='varargs.h'
10674         fi
10675         ;;
10676 esac
10677 case "$val" in
10678 '')
10679 echo "I could not find the definition for va_dcl... You have problems..." >&4
10680         val="$undef"; set i_stdarg; eval $setvar
10681         val="$undef"; set i_varargs; eval $setvar
10682         ;;
10683 *)
10684         set i_varhdr
10685         eval $setvar
10686         case "$i_varhdr" in
10687         stdarg.h)
10688                 val="$define"; set i_stdarg; eval $setvar
10689                 val="$undef"; set i_varargs; eval $setvar
10690                 ;;
10691         varargs.h)
10692                 val="$undef"; set i_stdarg; eval $setvar
10693                 val="$define"; set i_varargs; eval $setvar
10694                 ;;
10695         esac
10696         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10697 esac
10698 $rm -f varargs*
10699
10700 : see if the Compiler supports C99 variadic macros
10701 case "$i_stdarg$i_stdlib" in
10702     "$define$define")
10703     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10704     $cat >try.c <<EOCP
10705 #include <stdio.h>
10706 #include <stdarg.h>
10707
10708 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10709
10710 int main() {
10711   char buf[20];
10712   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10713   puts(buf);
10714   return 0;
10715 }
10716 EOCP
10717     set try
10718     if eval $compile && $run ./try 2>&1 >/dev/null; then
10719         case "`$run ./try`" in
10720             "123 456 789")
10721             echo "You have C99 variadic macros." >&4
10722             d_c99_variadic_macros="$define"
10723             ;;
10724             *)
10725             echo "You don't have functional C99 variadic macros." >&4
10726             d_c99_variadic_macros="$undef"
10727             ;;
10728         esac
10729     else
10730         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10731         d_c99_variadic_macros="$undef"
10732     fi
10733     $rm_try
10734     ;;
10735     *)
10736     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10737     d_c99_variadic_macros="$undef"
10738     ;;
10739 esac
10740
10741 : see if signal is declared as pointer to function returning int or void
10742 echo " "
10743 xxx=`./findhdr signal.h`
10744 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10745 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10746         echo "You have int (*signal())() instead of void." >&4
10747         val="$undef"
10748 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10749         echo "You have void (*signal())()." >&4
10750         val="$define"
10751 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10752         echo "You have int (*signal())() instead of void." >&4
10753         val="$undef"
10754 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10755         echo "You have void (*signal())()." >&4
10756         val="$define"
10757 else
10758         case "$d_voidsig" in
10759         '')
10760         echo "I can't determine whether signal handler returns void or int..." >&4
10761                 dflt=void
10762                 rp="What type does your signal handler return?"
10763                 . ./myread
10764                 case "$ans" in
10765                 v*) val="$define";;
10766                 *) val="$undef";;
10767                 esac;;
10768         "$define")
10769                 echo "As you already told me, signal handler returns void." >&4
10770                 val="$define"
10771                 ;;
10772         *)      echo "As you already told me, signal handler returns int." >&4
10773                 val="$undef"
10774                 ;;
10775         esac
10776 fi
10777 set d_voidsig
10778 eval $setvar
10779 case "$d_voidsig" in
10780 "$define") signal_t="void";;
10781 *) signal_t="int";;
10782 esac
10783 $rm -f $$.tmp
10784
10785 : check for ability to cast large floats to 32-bit ints.
10786 echo " "
10787 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10788 if $test "$intsize" -ge 4; then
10789         xxx=int
10790 else
10791         xxx=long
10792 fi
10793 $cat >try.c <<EOCP
10794 #include <stdio.h>
10795 #$i_stdlib I_STDLIB
10796 #ifdef I_STDLIB
10797 #include <stdlib.h>
10798 #endif
10799 #include <sys/types.h>
10800 #include <signal.h>
10801 $signal_t blech(int s) { exit(3); }
10802 int main()
10803 {
10804         $xxx i32;
10805         double f, g;
10806         int result = 0;
10807         char str[16];
10808         signal(SIGFPE, blech);
10809
10810         /* Don't let compiler optimize the test away.  Store the number
10811            in a writable string for gcc to pass to sscanf under HP/UX.
10812         */
10813         sprintf(str, "2147483647");
10814         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10815         g = 10 * f;
10816         i32  = ($xxx) g;
10817
10818         /* x86 processors will probably give 0x8000 0000, which is a
10819            sign change.  We don't want that.  We want to mimic SPARC
10820            behavior here, which is to preserve the sign and give
10821            back 0x7fff ffff.
10822         */
10823         if (i32 != ($xxx) f)
10824                 result |= 1;
10825         exit(result);
10826 }
10827 EOCP
10828 set try
10829 if eval $compile_ok; then
10830         $run ./try
10831         yyy=$?
10832 else
10833         echo "(I can't seem to compile the test program--assuming it can't)"
10834         yyy=1
10835 fi
10836 case "$yyy" in
10837 0)      val="$define"
10838         echo "Yup, it can."
10839         ;;
10840 *)      val="$undef"
10841         echo "Nope, it can't."
10842         ;;
10843 esac
10844 set d_casti32
10845 eval $setvar
10846 $rm_try
10847
10848 : check for ability to cast negative floats to unsigned
10849 echo " "
10850 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10851 $cat >try.c <<EOCP
10852 #include <stdio.h>
10853 #$i_stdlib I_STDLIB
10854 #ifdef I_STDLIB
10855 #include <stdlib.h>
10856 #endif
10857 #include <sys/types.h>
10858 #include <signal.h>
10859 $signal_t blech(int s) { exit(7); }
10860 $signal_t blech_in_list(int s) { exit(4); }
10861 unsigned long dummy_long(unsigned long p) { return p; }
10862 unsigned int dummy_int(unsigned int p) { return p; }
10863 unsigned short dummy_short(unsigned short p) { return p; }
10864 int main()
10865 {
10866         double f;
10867         unsigned long along;
10868         unsigned int aint;
10869         unsigned short ashort;
10870         int result = 0;
10871         char str[16];
10872
10873         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10874            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10875            optimized the whole file away
10876         */
10877         /* Store the number in a writable string for gcc to pass to
10878            sscanf under HP/UX.
10879         */
10880         sprintf(str, "-123");
10881         sscanf(str, "%lf", &f);  /* f = -123.; */
10882
10883         signal(SIGFPE, blech);
10884         along = (unsigned long)f;
10885         aint = (unsigned int)f;
10886         ashort = (unsigned short)f;
10887         if (along != (unsigned long)-123)
10888                 result |= 1;
10889         if (aint != (unsigned int)-123)
10890                 result |= 1;
10891         if (ashort != (unsigned short)-123)
10892                 result |= 1;
10893         sprintf(str, "1073741824.");
10894         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10895         f = f + f;
10896         along = 0;
10897         along = (unsigned long)f;
10898         if (along != 0x80000000)
10899                 result |= 2;
10900         f -= 1.;
10901         along = 0;
10902         along = (unsigned long)f;
10903         if (along != 0x7fffffff)
10904                 result |= 1;
10905         f += 2.;
10906         along = 0;
10907         along = (unsigned long)f;
10908         if (along != 0x80000001)
10909                 result |= 2;
10910         if (result)
10911                 exit(result);
10912         signal(SIGFPE, blech_in_list);
10913         sprintf(str, "123.");
10914         sscanf(str, "%lf", &f);  /* f = 123.; */
10915         along = dummy_long((unsigned long)f);
10916         aint = dummy_int((unsigned int)f);
10917         ashort = dummy_short((unsigned short)f);
10918         if (along != (unsigned long)123)
10919                 result |= 4;
10920         if (aint != (unsigned int)123)
10921                 result |= 4;
10922         if (ashort != (unsigned short)123)
10923                 result |= 4;
10924         exit(result);
10925
10926 }
10927 EOCP
10928 set try
10929 if eval $compile_ok; then
10930         $run ./try
10931         castflags=$?
10932 else
10933         echo "(I can't seem to compile the test program--assuming it can't)"
10934         castflags=7
10935 fi
10936 case "$castflags" in
10937 0)      val="$define"
10938         echo "Yup, it can."
10939         ;;
10940 *)      val="$undef"
10941         echo "Nope, it can't."
10942         ;;
10943 esac
10944 set d_castneg
10945 eval $setvar
10946 $rm_try
10947
10948 : see if vprintf exists
10949 echo " "
10950 if set vprintf val -f d_vprintf; eval $csym; $val; then
10951         echo 'vprintf() found.' >&4
10952         val="$define"
10953         $cat >try.c <<EOF
10954 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10955 #$i_varargs I_VARARGS
10956
10957 #$i_stdlib I_STDLIB
10958 #$i_unistd I_UNISTD
10959
10960 #ifdef I_STDARG
10961 #  include <stdarg.h>
10962 #else /* I_VARARGS */
10963 #  include <varargs.h>
10964 #endif
10965
10966 #ifdef I_UNISTD
10967 #  include <unistd.h>
10968 #endif
10969
10970 #ifdef I_STDLIB
10971 #  include <stdlib.h>
10972 #endif
10973
10974 #include <stdio.h> /* vsprintf prototype */
10975
10976 #ifdef I_STDARG
10977 void xxx(int n, ...)
10978 {
10979     va_list args;
10980     char buf[10];
10981     va_start(args, n);
10982     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10983 }
10984 int main() { xxx(1, "foo"); }
10985
10986 #else /* I_VARARGS */
10987
10988 xxx(va_alist)
10989 va_dcl
10990 {
10991     va_list args;
10992     char buf[10];
10993     va_start(args);
10994     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10995 }
10996 int main() { xxx("foo"); }
10997
10998 #endif
10999
11000 EOF
11001         set try
11002         if eval $compile_ok; then
11003                 if $run ./try; then
11004                         echo "Your vsprintf() returns (int)." >&4
11005                         val2="$undef"
11006                 else
11007                         echo "Your vsprintf() returns (char*)." >&4
11008                         val2="$define"
11009                 fi
11010         else
11011                 echo 'I am unable to compile the vsprintf() test program.' >&4
11012                 # We shouldn't get here.  If we do, assume the standard signature,
11013                 # not the old BSD one.
11014                 echo 'Guessing that vsprintf() returns (int).' >&4
11015                 val2="$undef"
11016         fi
11017 else
11018         echo 'vprintf() NOT found.' >&4
11019         val="$undef"
11020         val2="$undef"
11021 fi
11022 $rm_try
11023 set d_vprintf
11024 eval $setvar
11025 val=$val2
11026 set d_charvspr
11027 eval $setvar
11028
11029 : see if chown exists
11030 set chown d_chown
11031 eval $inlibc
11032
11033 : see if chroot exists
11034 set chroot d_chroot
11035 eval $inlibc
11036
11037 : see if chsize exists
11038 set chsize d_chsize
11039 eval $inlibc
11040
11041 : see if class exists
11042 set class d_class
11043 eval $inlibc
11044
11045 : see if clearenv exists
11046 set clearenv d_clearenv
11047 eval $inlibc
11048
11049 : Define hasstruct macro for Configure internal use
11050 hasstruct='varname=$1; struct=$2; shift; shift;
11051 while $test $# -ge 2; do
11052         case "$1" in
11053         $define) echo "#include <$2>";;
11054         esac ;
11055     shift 2;
11056 done > try.c;
11057 echo "int main () { struct $struct foo; }" >> try.c;
11058 set try;
11059 if eval $compile; then
11060         val="$define";
11061 else
11062         val="$undef";
11063 fi;
11064 set $varname;
11065 eval $setvar;
11066 $rm_try'
11067
11068 : see whether socket exists
11069 socketlib=''
11070 sockethdr=''
11071 echo " "
11072 $echo $n "Hmm... $c" >&4
11073 if set socket val -f d_socket; eval $csym; $val; then
11074         echo "Looks like you have Berkeley networking support." >&4
11075         d_socket="$define"
11076         if set setsockopt val -f; eval $csym; $val; then
11077                 d_oldsock="$undef"
11078         else
11079                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11080                 d_oldsock="$define"
11081         fi
11082 else
11083         if $contains socklib libc.list >/dev/null 2>&1; then
11084                 echo "Looks like you have Berkeley networking support." >&4
11085                 d_socket="$define"
11086                 : we will have to assume that it supports the 4.2 BSD interface
11087                 d_oldsock="$undef"
11088         else
11089                 echo "You don't have Berkeley networking in libc$_a..." >&4
11090                 if test "X$d_socket" = "X$define"; then
11091                    echo "...but you seem to believe that you have sockets." >&4
11092                 else
11093                         for net in net socket
11094                         do
11095                                 if test -f /usr/lib/lib$net$_a; then
11096                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11097                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11098                                         if $contains socket libc.list >/dev/null 2>&1; then
11099                                                 d_socket="$define"
11100                                                 socketlib="-l$net"
11101                                                 case "$net" in
11102                                                 net)
11103                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11104                                                         sockethdr="-I/usr/netinclude"
11105                                                         ;;
11106                                                 esac
11107                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11108                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11109                                                         d_oldsock="$undef"
11110                                                 else
11111                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11112                                                         d_oldsock="$define"
11113                                                 fi
11114                                                 break
11115                                         fi
11116                                 fi
11117                         done
11118                         if test "X$d_socket" != "X$define"; then
11119                            echo "or anywhere else I see." >&4
11120                            d_socket="$undef"
11121                            d_oldsock="$undef"
11122                         fi
11123                 fi
11124         fi
11125 fi
11126
11127 : see if socketpair exists
11128 set socketpair d_sockpair
11129 eval $inlibc
11130
11131
11132 echo " "
11133 echo "Checking the availability of certain socket constants..." >&4
11134 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11135         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11136         $cat >try.c <<EOF
11137 #include <sys/types.h>
11138 #include <sys/socket.h>
11139 int main() {
11140     int i = $ENUM;
11141 }
11142 EOF
11143         val="$undef"
11144         set try; if eval $compile; then
11145                 val="$define"
11146         fi
11147         set d_${enum}; eval $setvar
11148         $rm_try
11149 done
11150
11151 : see if this is a sys/uio.h system
11152 set sys/uio.h i_sysuio
11153 eval $inhdr
11154
11155 : Check for cmsghdr support
11156 echo " "
11157 echo "Checking to see if your system supports struct cmsghdr..." >&4
11158 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11159 eval $hasstruct
11160 case "$d_cmsghdr_s" in
11161 "$define")      echo "Yes, it does."   ;;
11162 *)              echo "No, it doesn't." ;;
11163 esac
11164
11165
11166 : check for const keyword
11167 echo " "
11168 echo 'Checking to see if your C compiler knows about "const"...' >&4
11169 $cat >const.c <<'EOCP'
11170 typedef struct spug { int drokk; } spug;
11171 int main()
11172 {
11173         const char *foo;
11174         const spug y = { 0 };
11175 }
11176 EOCP
11177 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11178         val="$define"
11179         echo "Yup, it does."
11180 else
11181         val="$undef"
11182         echo "Nope, it doesn't."
11183 fi
11184 set d_const
11185 eval $setvar
11186
11187 : see if copysignl exists
11188 set copysignl d_copysignl
11189 eval $inlibc
11190
11191 : see if crypt exists
11192 echo " "
11193 set crypt d_crypt
11194 eval $inlibc
11195 case "$d_crypt" in
11196 $define) cryptlib='' ;;
11197 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11198                 echo 'crypt() found.' >&4
11199                 val="$define"
11200                 cryptlib=''
11201         else
11202                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11203                 if $test -z "$cryptlib"; then
11204                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11205                 else
11206                         cryptlib=-lcrypt
11207                 fi
11208                 if $test -z "$cryptlib"; then
11209                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11210                 else
11211                         cryptlib=-lcrypt
11212                 fi
11213                 if $test -z "$cryptlib"; then
11214                         cryptlib=`./loc libcrypt$_a "" $libpth`
11215                 else
11216                         cryptlib=-lcrypt
11217                 fi
11218                 if $test -z "$cryptlib"; then
11219                         echo 'crypt() NOT found.' >&4
11220                         val="$undef"
11221                 else
11222                         val="$define"
11223                 fi
11224         fi
11225         set d_crypt
11226         eval $setvar
11227         ;;
11228 esac
11229
11230 : see if this is a crypt.h system
11231 set crypt.h i_crypt
11232 eval $inhdr
11233
11234 : see if crypt_r exists
11235 set crypt_r d_crypt_r
11236 eval $inlibc
11237 case "$d_crypt_r" in
11238 "$define")
11239         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11240         case "$d_crypt_r_proto:$usethreads" in
11241         ":define")      d_crypt_r_proto=define
11242                 set d_crypt_r_proto crypt_r $hdrs
11243                 eval $hasproto ;;
11244         *)      ;;
11245         esac
11246         case "$d_crypt_r_proto" in
11247         define)
11248         case "$crypt_r_proto" in
11249         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11250         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11251         esac
11252         case "$crypt_r_proto" in
11253         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11254         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11255         esac
11256         case "$crypt_r_proto" in
11257         ''|0)   d_crypt_r=undef
11258                 crypt_r_proto=0
11259                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11260         * )     case "$crypt_r_proto" in
11261                 REENTRANT_PROTO*) ;;
11262                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11263                 esac
11264                 echo "Prototype: $try" ;;
11265         esac
11266         ;;
11267         *)      case "$usethreads" in
11268                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11269                 esac
11270                 d_crypt_r=undef
11271                 crypt_r_proto=0
11272                 ;;
11273         esac
11274         ;;
11275 *)      crypt_r_proto=0
11276         ;;
11277 esac
11278
11279 : get csh whereabouts
11280 case "$csh" in
11281 'csh') val="$undef" ;;
11282 *) val="$define" ;;
11283 esac
11284 set d_csh
11285 eval $setvar
11286 : Respect a hint or command line value for full_csh.
11287 case "$full_csh" in
11288 '') full_csh=$csh ;;
11289 esac
11290
11291 : see if ctermid exists
11292 set ctermid d_ctermid
11293 eval $inlibc
11294
11295 : see if ctermid_r exists
11296 set ctermid_r d_ctermid_r
11297 eval $inlibc
11298 case "$d_ctermid_r" in
11299 "$define")
11300         hdrs="$i_systypes sys/types.h define stdio.h "
11301         case "$d_ctermid_r_proto:$usethreads" in
11302         ":define")      d_ctermid_r_proto=define
11303                 set d_ctermid_r_proto ctermid_r $hdrs
11304                 eval $hasproto ;;
11305         *)      ;;
11306         esac
11307         case "$d_ctermid_r_proto" in
11308         define)
11309         case "$ctermid_r_proto" in
11310         ''|0) try='char* ctermid_r(char*);'
11311         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11312         esac
11313         case "$ctermid_r_proto" in
11314         ''|0)   d_ctermid_r=undef
11315                 ctermid_r_proto=0
11316                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11317         * )     case "$ctermid_r_proto" in
11318                 REENTRANT_PROTO*) ;;
11319                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11320                 esac
11321                 echo "Prototype: $try" ;;
11322         esac
11323         ;;
11324         *)      case "$usethreads" in
11325                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11326                 esac
11327                 d_ctermid_r=undef
11328                 ctermid_r_proto=0
11329                 ;;
11330         esac
11331         ;;
11332 *)      ctermid_r_proto=0
11333         ;;
11334 esac
11335
11336 : see if ctime_r exists
11337 set ctime_r d_ctime_r
11338 eval $inlibc
11339 case "$d_ctime_r" in
11340 "$define")
11341         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11342         case "$d_ctime_r_proto:$usethreads" in
11343         ":define")      d_ctime_r_proto=define
11344                 set d_ctime_r_proto ctime_r $hdrs
11345                 eval $hasproto ;;
11346         *)      ;;
11347         esac
11348         case "$d_ctime_r_proto" in
11349         define)
11350         case "$ctime_r_proto" in
11351         ''|0) try='char* ctime_r(const time_t*, char*);'
11352         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11353         esac
11354         case "$ctime_r_proto" in
11355         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11356         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11357         esac
11358         case "$ctime_r_proto" in
11359         ''|0) try='int ctime_r(const time_t*, char*);'
11360         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11361         esac
11362         case "$ctime_r_proto" in
11363         ''|0) try='int ctime_r(const time_t*, char*, int);'
11364         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11365         esac
11366         case "$ctime_r_proto" in
11367         ''|0)   d_ctime_r=undef
11368                 ctime_r_proto=0
11369                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11370         * )     case "$ctime_r_proto" in
11371                 REENTRANT_PROTO*) ;;
11372                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11373                 esac
11374                 echo "Prototype: $try" ;;
11375         esac
11376         ;;
11377         *)      case "$usethreads" in
11378                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11379                 esac
11380                 d_ctime_r=undef
11381                 ctime_r_proto=0
11382                 ;;
11383         esac
11384         ;;
11385 *)      ctime_r_proto=0
11386         ;;
11387 esac
11388
11389 : see if cuserid exists
11390 set cuserid d_cuserid
11391 eval $inlibc
11392
11393 : see if this is a limits.h system
11394 set limits.h i_limits
11395 eval $inhdr
11396
11397 : see if this is a float.h system
11398 set float.h i_float
11399 eval $inhdr
11400
11401 : See if number of significant digits in a double precision number is known
11402 echo " "
11403 $cat >dbl_dig.c <<EOM
11404 #$i_limits I_LIMITS
11405 #$i_float I_FLOAT
11406 #ifdef I_LIMITS
11407 #include <limits.h>
11408 #endif
11409 #ifdef I_FLOAT
11410 #include <float.h>
11411 #endif
11412 #ifdef DBL_DIG
11413 printf("Contains DBL_DIG");
11414 #endif
11415 EOM
11416 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11417 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11418         echo "DBL_DIG found." >&4
11419         val="$define"
11420 else
11421         echo "DBL_DIG NOT found." >&4
11422         val="$undef"
11423 fi
11424 $rm -f dbl_dig.?
11425 set d_dbl_dig
11426 eval $setvar
11427
11428 : see if dbm.h is available
11429 : see if dbmclose exists
11430 set dbmclose d_dbmclose
11431 eval $inlibc
11432
11433 case "$d_dbmclose" in
11434 $define)
11435         set dbm.h i_dbm
11436         eval $inhdr
11437         case "$i_dbm" in
11438         $define)
11439                 val="$undef"
11440                 set i_rpcsvcdbm
11441                 eval $setvar
11442                 ;;
11443         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11444                 eval $inhdr
11445                 ;;
11446         esac
11447         ;;
11448 *)      echo "We won't be including <dbm.h>"
11449         val="$undef"
11450         set i_dbm
11451         eval $setvar
11452         val="$undef"
11453         set i_rpcsvcdbm
11454         eval $setvar
11455         ;;
11456 esac
11457
11458 : see if prototype for dbminit is available
11459 echo " "
11460 set d_dbminitproto dbminit $i_dbm dbm.h
11461 eval $hasproto
11462
11463 : see if difftime exists
11464 set difftime d_difftime
11465 eval $inlibc
11466
11467 : see if this is a dirent system
11468 echo " "
11469 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11470         val="$define"
11471         echo "<dirent.h> found." >&4
11472 else
11473         val="$undef"
11474         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11475                 echo "<sys/dir.h> found." >&4
11476                 echo " "
11477         else
11478                 xinc=`./findhdr sys/ndir.h`
11479         fi
11480         echo "<dirent.h> NOT found." >&4
11481 fi
11482 set i_dirent
11483 eval $setvar
11484
11485 : Look for type of directory structure.
11486 echo " "
11487 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11488
11489 case "$direntrytype" in
11490 ''|' ')
11491         case "$i_dirent" in
11492         $define) guess1='struct dirent' ;;
11493         *) guess1='struct direct'  ;;
11494         esac
11495         ;;
11496 *)      guess1="$direntrytype"
11497         ;;
11498 esac
11499
11500 case "$guess1" in
11501 'struct dirent') guess2='struct direct' ;;
11502 *) guess2='struct dirent' ;;
11503 esac
11504
11505 if $contains "$guess1" try.c >/dev/null 2>&1; then
11506         direntrytype="$guess1"
11507         echo "Your directory entries are $direntrytype." >&4
11508 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11509         direntrytype="$guess2"
11510         echo "Your directory entries seem to be $direntrytype." >&4
11511 else
11512         echo "I don't recognize your system's directory entries." >&4
11513         rp="What type is used for directory entries on this system?"
11514         dflt="$guess1"
11515         . ./myread
11516         direntrytype="$ans"
11517 fi
11518 $rm_try
11519
11520 : see if the directory entry stores field length
11521 echo " "
11522 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11523 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11524         echo "Good, your directory entry keeps length information in d_namlen." >&4
11525         val="$define"
11526 else
11527         echo "Your directory entry does not know about the d_namlen field." >&4
11528         val="$undef"
11529 fi
11530 set d_dirnamlen
11531 eval $setvar
11532 $rm_try
11533
11534 : Look for DIR.dd_fd
11535 case "$i_dirent" in
11536 "$define")
11537     echo "Checking to see if DIR has a dd_fd member variable" >&4
11538     $cat >try.c <<EOCP
11539 #$i_stdlib I_STDLIB
11540 #ifdef I_STDLIB
11541 #include <stdlib.h>
11542 #endif
11543 #include <dirent.h>
11544
11545 int main() {
11546     DIR dir;
11547     dir.dd_fd = 1;
11548     return 0;
11549 }
11550 EOCP
11551     val=$undef
11552     set try
11553     if eval $compile; then
11554         echo "Yes, it does."
11555         val="$define"
11556     else
11557         echo "No, it does not."
11558         val="$undef"
11559     fi
11560     ;;
11561 *)
11562     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11563     val="$undef"
11564     ;;
11565 esac
11566 set d_dir_dd_fd
11567 eval $setvar
11568 $rm_try
11569
11570 : see if this is an sysdir system
11571 set sys/dir.h i_sysdir
11572 eval $inhdr
11573
11574 : see if this is an sysndir system
11575 set sys/ndir.h i_sysndir
11576 eval $inhdr
11577
11578 : Look for dirfd
11579 echo " "
11580 $cat >dirfd.c <<EOM
11581 #include <stdio.h>
11582 #$i_stdlib I_STDLIB
11583 #ifdef I_STDLIB
11584 #include <stdlib.h>
11585 #endif
11586 #$i_dirent I_DIRENT             /**/
11587 #$i_sysdir I_SYS_DIR            /**/
11588 #$i_sysndir I_SYS_NDIR          /**/
11589 #$i_systypes I_SYS_TYPES        /**/
11590 #if defined(I_SYS_TYPES)
11591 #include <sys/types.h>
11592 #endif
11593 #if defined(I_DIRENT)
11594 #include <dirent.h>
11595 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11596 #include <sys/dir.h>
11597 #endif
11598 #else
11599 #ifdef I_SYS_NDIR
11600 #include <sys/ndir.h>
11601 #else
11602 #ifdef I_SYS_DIR
11603 #ifdef hp9000s500
11604 #include <ndir.h>       /* may be wrong in the future */
11605 #else
11606 #include <sys/dir.h>
11607 #endif
11608 #endif
11609 #endif
11610 #endif 
11611 int main() {
11612         DIR *dirp = opendir(".");
11613         if (dirfd(dirp) >= 0)
11614                 exit(0);
11615         else
11616                 exit(1);
11617 }
11618 EOM
11619 val=$undef
11620 set dirfd
11621 if eval $compile; then
11622         val="$define"
11623 fi
11624 case "$val" in
11625 $define)        echo "dirfd() found." >&4       ;;
11626 *)              echo "dirfd() NOT found." >&4   ;;
11627 esac
11628 set d_dirfd
11629 eval $setvar
11630 $rm -f dirfd*
11631
11632 : see if dlerror exists
11633 xxx_runnm="$runnm"
11634 runnm=false
11635 set dlerror d_dlerror
11636 eval $inlibc
11637 runnm="$xxx_runnm"
11638
11639 : see if dlfcn is available
11640 set dlfcn.h i_dlfcn
11641 eval $inhdr
11642
11643 : Check what extension to use for shared libs
11644 case "$usedl" in
11645 $define|y|true)
11646         $cat << EOM
11647
11648 On a few systems, the dynamically loaded modules that perl generates and uses
11649 will need a different extension than shared libs. The default will probably
11650 be appropriate.
11651
11652 EOM
11653         case "$dlext" in
11654         '')     dflt="$so" ;;
11655         *)      dflt="$dlext" ;;
11656         esac
11657         rp='What is the extension of dynamically loaded modules'
11658         . ./myread
11659         dlext="$ans"
11660         ;;
11661 *)
11662         dlext="none"
11663         ;;
11664 esac
11665
11666 : Check if dlsym need a leading underscore
11667 echo " "
11668 val="$undef"
11669
11670 case "$dlsrc" in
11671 dl_dlopen.xs)
11672         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11673         $cat >dyna.c <<'EOM'
11674 fred () { }
11675 EOM
11676
11677 $cat >fred.c<<EOM
11678
11679 #include <stdio.h>
11680 #$i_stdlib I_STDLIB
11681 #ifdef I_STDLIB
11682 #include <stdlib.h>
11683 #endif
11684 #$i_dlfcn I_DLFCN
11685 #ifdef I_DLFCN
11686 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11687 #else
11688 #include <sys/types.h>
11689 #include <nlist.h>
11690 #include <link.h>
11691 #endif
11692
11693 extern int fred() ;
11694
11695 int main()
11696 {
11697     void * handle ;
11698     void * symbol ;
11699 #ifndef RTLD_LAZY
11700     int mode = 1 ;
11701 #else
11702     int mode = RTLD_LAZY ;
11703 #endif
11704     handle = dlopen("./dyna.$dlext", mode) ;
11705     if (handle == NULL) {
11706         printf ("1\n") ;
11707         fflush (stdout) ;
11708         exit(0);
11709     }
11710     symbol = dlsym(handle, "fred") ;
11711     if (symbol == NULL) {
11712         /* try putting a leading underscore */
11713         symbol = dlsym(handle, "_fred") ;
11714         if (symbol == NULL) {
11715             printf ("2\n") ;
11716             fflush (stdout) ;
11717             exit(0);
11718         }
11719         printf ("3\n") ;
11720     }
11721     else
11722         printf ("4\n") ;
11723     fflush (stdout) ;
11724     exit(0);
11725 }
11726 EOM
11727         : Call the object file tmp-dyna.o in case dlext=o.
11728         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11729                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11730                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11731                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11732                 xxx=`$run ./fred`
11733                 case $xxx in
11734                 1)      echo "Test program failed using dlopen." >&4
11735                         echo "Perhaps you should not use dynamic loading." >&4;;
11736                 2)      echo "Test program failed using dlsym." >&4
11737                         echo "Perhaps you should not use dynamic loading." >&4;;
11738                 3)      echo "dlsym needs a leading underscore" >&4
11739                         val="$define" ;;
11740                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11741                 esac
11742         else
11743                 echo "I can't compile and run the test program." >&4
11744                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11745         fi
11746         ;;
11747 esac
11748
11749 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11750
11751 set d_dlsymun
11752 eval $setvar
11753
11754 : see if drand48_r exists
11755 set drand48_r d_drand48_r
11756 eval $inlibc
11757 case "$d_drand48_r" in
11758 "$define")
11759         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11760         case "$d_drand48_r_proto:$usethreads" in
11761         ":define")      d_drand48_r_proto=define
11762                 set d_drand48_r_proto drand48_r $hdrs
11763                 eval $hasproto ;;
11764         *)      ;;
11765         esac
11766         case "$d_drand48_r_proto" in
11767         define)
11768         case "$drand48_r_proto" in
11769         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11770         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11771         esac
11772         case "$drand48_r_proto" in
11773         ''|0)   d_drand48_r=undef
11774                 drand48_r_proto=0
11775                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11776         * )     case "$drand48_r_proto" in
11777                 REENTRANT_PROTO*) ;;
11778                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11779                 esac
11780                 echo "Prototype: $try" ;;
11781         esac
11782         ;;
11783         *)      case "$usethreads" in
11784                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11785                 esac
11786                 d_drand48_r=undef
11787                 drand48_r_proto=0
11788                 ;;
11789         esac
11790         ;;
11791 *)      drand48_r_proto=0
11792         ;;
11793 esac
11794
11795 : see if prototype for drand48 is available
11796 echo " "
11797 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11798 eval $hasproto
11799
11800 : see if dup2 exists
11801 set dup2 d_dup2
11802 eval $inlibc
11803
11804 : see if eaccess exists
11805 set eaccess d_eaccess
11806 eval $inlibc
11807
11808 : see if endgrent exists
11809 set endgrent d_endgrent
11810 eval $inlibc
11811
11812 : see if this is an grp system
11813 set grp.h i_grp
11814 eval $inhdr
11815
11816 case "$i_grp" in
11817 $define)
11818         xxx=`./findhdr grp.h`
11819         $cppstdin $cppflags $cppminus < $xxx >$$.h
11820
11821         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11822                 val="$define"
11823         else
11824                 val="$undef"
11825         fi
11826         set d_grpasswd
11827         eval $setvar
11828
11829         $rm -f $$.h
11830         ;;
11831 *)
11832         val="$undef";
11833         set d_grpasswd; eval $setvar
11834         ;;
11835 esac
11836
11837 : see if endgrent_r exists
11838 set endgrent_r d_endgrent_r
11839 eval $inlibc
11840 case "$d_endgrent_r" in
11841 "$define")
11842         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11843         case "$d_endgrent_r_proto:$usethreads" in
11844         ":define")      d_endgrent_r_proto=define
11845                 set d_endgrent_r_proto endgrent_r $hdrs
11846                 eval $hasproto ;;
11847         *)      ;;
11848         esac
11849         case "$d_endgrent_r_proto" in
11850         define)
11851         case "$endgrent_r_proto" in
11852         ''|0) try='int endgrent_r(FILE**);'
11853         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11854         esac
11855         case "$endgrent_r_proto" in
11856         ''|0) try='void endgrent_r(FILE**);'
11857         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11858         esac
11859         case "$endgrent_r_proto" in
11860         ''|0)   d_endgrent_r=undef
11861                 endgrent_r_proto=0
11862                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11863         * )     case "$endgrent_r_proto" in
11864                 REENTRANT_PROTO*) ;;
11865                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11866                 esac
11867                 echo "Prototype: $try" ;;
11868         esac
11869         ;;
11870         *)      case "$usethreads" in
11871                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11872                 esac
11873                 d_endgrent_r=undef
11874                 endgrent_r_proto=0
11875                 ;;
11876         esac
11877         ;;
11878 *)      endgrent_r_proto=0
11879         ;;
11880 esac
11881
11882 : see if endhostent exists
11883 set endhostent d_endhent
11884 eval $inlibc
11885
11886 : see if this is a netdb.h system
11887 set netdb.h i_netdb
11888 eval $inhdr
11889
11890 : see if endhostent_r exists
11891 set endhostent_r d_endhostent_r
11892 eval $inlibc
11893 case "$d_endhostent_r" in
11894 "$define")
11895         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11896         case "$d_endhostent_r_proto:$usethreads" in
11897         ":define")      d_endhostent_r_proto=define
11898                 set d_endhostent_r_proto endhostent_r $hdrs
11899                 eval $hasproto ;;
11900         *)      ;;
11901         esac
11902         case "$d_endhostent_r_proto" in
11903         define)
11904         case "$endhostent_r_proto" in
11905         ''|0) try='int endhostent_r(struct hostent_data*);'
11906         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11907         esac
11908         case "$endhostent_r_proto" in
11909         ''|0) try='void endhostent_r(struct hostent_data*);'
11910         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11911         esac
11912         case "$endhostent_r_proto" in
11913         ''|0)   d_endhostent_r=undef
11914                 endhostent_r_proto=0
11915                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11916         * )     case "$endhostent_r_proto" in
11917                 REENTRANT_PROTO*) ;;
11918                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11919                 esac
11920                 echo "Prototype: $try" ;;
11921         esac
11922         ;;
11923         *)      case "$usethreads" in
11924                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11925                 esac
11926                 d_endhostent_r=undef
11927                 endhostent_r_proto=0
11928                 ;;
11929         esac
11930         ;;
11931 *)      endhostent_r_proto=0
11932         ;;
11933 esac
11934
11935 : see if endnetent exists
11936 set endnetent d_endnent
11937 eval $inlibc
11938
11939 : see if endnetent_r exists
11940 set endnetent_r d_endnetent_r
11941 eval $inlibc
11942 case "$d_endnetent_r" in
11943 "$define")
11944         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11945         case "$d_endnetent_r_proto:$usethreads" in
11946         ":define")      d_endnetent_r_proto=define
11947                 set d_endnetent_r_proto endnetent_r $hdrs
11948                 eval $hasproto ;;
11949         *)      ;;
11950         esac
11951         case "$d_endnetent_r_proto" in
11952         define)
11953         case "$endnetent_r_proto" in
11954         ''|0) try='int endnetent_r(struct netent_data*);'
11955         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11956         esac
11957         case "$endnetent_r_proto" in
11958         ''|0) try='void endnetent_r(struct netent_data*);'
11959         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11960         esac
11961         case "$endnetent_r_proto" in
11962         ''|0)   d_endnetent_r=undef
11963                 endnetent_r_proto=0
11964                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11965         * )     case "$endnetent_r_proto" in
11966                 REENTRANT_PROTO*) ;;
11967                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11968                 esac
11969                 echo "Prototype: $try" ;;
11970         esac
11971         ;;
11972         *)      case "$usethreads" in
11973                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11974                 esac
11975                 d_endnetent_r=undef
11976                 endnetent_r_proto=0
11977                 ;;
11978         esac
11979         ;;
11980 *)      endnetent_r_proto=0
11981         ;;
11982 esac
11983
11984 : see if endprotoent exists
11985 set endprotoent d_endpent
11986 eval $inlibc
11987
11988 : see if endprotoent_r exists
11989 set endprotoent_r d_endprotoent_r
11990 eval $inlibc
11991 case "$d_endprotoent_r" in
11992 "$define")
11993         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11994         case "$d_endprotoent_r_proto:$usethreads" in
11995         ":define")      d_endprotoent_r_proto=define
11996                 set d_endprotoent_r_proto endprotoent_r $hdrs
11997                 eval $hasproto ;;
11998         *)      ;;
11999         esac
12000         case "$d_endprotoent_r_proto" in
12001         define)
12002         case "$endprotoent_r_proto" in
12003         ''|0) try='int endprotoent_r(struct protoent_data*);'
12004         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
12005         esac
12006         case "$endprotoent_r_proto" in
12007         ''|0) try='void endprotoent_r(struct protoent_data*);'
12008         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
12009         esac
12010         case "$endprotoent_r_proto" in
12011         ''|0)   d_endprotoent_r=undef
12012                 endprotoent_r_proto=0
12013                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12014         * )     case "$endprotoent_r_proto" in
12015                 REENTRANT_PROTO*) ;;
12016                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12017                 esac
12018                 echo "Prototype: $try" ;;
12019         esac
12020         ;;
12021         *)      case "$usethreads" in
12022                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12023                 esac
12024                 d_endprotoent_r=undef
12025                 endprotoent_r_proto=0
12026                 ;;
12027         esac
12028         ;;
12029 *)      endprotoent_r_proto=0
12030         ;;
12031 esac
12032
12033 : see if endpwent exists
12034 set endpwent d_endpwent
12035 eval $inlibc
12036
12037 : see if this is a pwd.h system
12038 set pwd.h i_pwd
12039 eval $inhdr
12040
12041 case "$i_pwd" in
12042 $define)
12043         xxx=`./findhdr pwd.h`
12044         $cppstdin $cppflags $cppminus < $xxx >$$.h
12045
12046         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12047                 val="$define"
12048         else
12049                 val="$undef"
12050         fi
12051         set d_pwquota
12052         eval $setvar
12053
12054         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12055                 val="$define"
12056         else
12057                 val="$undef"
12058         fi
12059         set d_pwage
12060         eval $setvar
12061
12062         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12063                 val="$define"
12064         else
12065                 val="$undef"
12066         fi
12067         set d_pwchange
12068         eval $setvar
12069
12070         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12071                 val="$define"
12072         else
12073                 val="$undef"
12074         fi
12075         set d_pwclass
12076         eval $setvar
12077
12078         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12079                 val="$define"
12080         else
12081                 val="$undef"
12082         fi
12083         set d_pwexpire
12084         eval $setvar
12085
12086         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12087                 val="$define"
12088         else
12089                 val="$undef"
12090         fi
12091         set d_pwcomment
12092         eval $setvar
12093
12094         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12095                 val="$define"
12096         else
12097                 val="$undef"
12098         fi
12099         set d_pwgecos
12100         eval $setvar
12101
12102         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12103                 val="$define"
12104         else
12105                 val="$undef"
12106         fi
12107         set d_pwpasswd
12108         eval $setvar
12109
12110         $rm -f $$.h
12111         ;;
12112 *)
12113         val="$undef"; 
12114         set d_pwquota; eval $setvar
12115         set d_pwage; eval $setvar
12116         set d_pwchange; eval $setvar
12117         set d_pwclass; eval $setvar
12118         set d_pwexpire; eval $setvar
12119         set d_pwcomment; eval $setvar
12120         set d_pwgecos; eval $setvar
12121         set d_pwpasswd; eval $setvar
12122         ;;
12123 esac
12124
12125 : see if endpwent_r exists
12126 set endpwent_r d_endpwent_r
12127 eval $inlibc
12128 case "$d_endpwent_r" in
12129 "$define")
12130         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12131         case "$d_endpwent_r_proto:$usethreads" in
12132         ":define")      d_endpwent_r_proto=define
12133                 set d_endpwent_r_proto endpwent_r $hdrs
12134                 eval $hasproto ;;
12135         *)      ;;
12136         esac
12137         case "$d_endpwent_r_proto" in
12138         define)
12139         case "$endpwent_r_proto" in
12140         ''|0) try='int endpwent_r(FILE**);'
12141         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12142         esac
12143         case "$endpwent_r_proto" in
12144         ''|0) try='void endpwent_r(FILE**);'
12145         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12146         esac
12147         case "$endpwent_r_proto" in
12148         ''|0)   d_endpwent_r=undef
12149                 endpwent_r_proto=0
12150                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12151         * )     case "$endpwent_r_proto" in
12152                 REENTRANT_PROTO*) ;;
12153                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12154                 esac
12155                 echo "Prototype: $try" ;;
12156         esac
12157         ;;
12158         *)      case "$usethreads" in
12159                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12160                 esac
12161                 d_endpwent_r=undef
12162                 endpwent_r_proto=0
12163                 ;;
12164         esac
12165         ;;
12166 *)      endpwent_r_proto=0
12167         ;;
12168 esac
12169
12170 : see if endservent exists
12171 set endservent d_endsent
12172 eval $inlibc
12173
12174 : see if endservent_r exists
12175 set endservent_r d_endservent_r
12176 eval $inlibc
12177 case "$d_endservent_r" in
12178 "$define")
12179         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12180         case "$d_endservent_r_proto:$usethreads" in
12181         ":define")      d_endservent_r_proto=define
12182                 set d_endservent_r_proto endservent_r $hdrs
12183                 eval $hasproto ;;
12184         *)      ;;
12185         esac
12186         case "$d_endservent_r_proto" in
12187         define)
12188         case "$endservent_r_proto" in
12189         ''|0) try='int endservent_r(struct servent_data*);'
12190         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12191         esac
12192         case "$endservent_r_proto" in
12193         ''|0) try='void endservent_r(struct servent_data*);'
12194         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12195         esac
12196         case "$endservent_r_proto" in
12197         ''|0)   d_endservent_r=undef
12198                 endservent_r_proto=0
12199                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12200         * )     case "$endservent_r_proto" in
12201                 REENTRANT_PROTO*) ;;
12202                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12203                 esac
12204                 echo "Prototype: $try" ;;
12205         esac
12206         ;;
12207         *)      case "$usethreads" in
12208                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12209                 esac
12210                 d_endservent_r=undef
12211                 endservent_r_proto=0
12212                 ;;
12213         esac
12214         ;;
12215 *)      endservent_r_proto=0
12216         ;;
12217 esac
12218
12219 : Locate the flags for 'open()'
12220 echo " "
12221 $cat >try.c <<EOCP
12222 #include <sys/types.h>
12223 #ifdef I_FCNTL
12224 #include <fcntl.h>
12225 #endif
12226 #ifdef I_SYS_FILE
12227 #include <sys/file.h>
12228 #endif
12229 #$i_stdlib I_STDLIB
12230 #ifdef I_STDLIB
12231 #include <stdlib.h>
12232 #endif
12233 int main() {
12234         if(O_RDONLY);
12235 #ifdef O_TRUNC
12236         exit(0);
12237 #else
12238         exit(1);
12239 #endif
12240 }
12241 EOCP
12242 : check sys/file.h first to get FREAD on Sun
12243 if $test `./findhdr sys/file.h` && \
12244                 set try -DI_SYS_FILE && eval $compile; then
12245         h_sysfile=true;
12246         echo "<sys/file.h> defines the O_* constants..." >&4
12247         if $run ./try; then
12248                 echo "and you have the 3 argument form of open()." >&4
12249                 val="$define"
12250         else
12251                 echo "but not the 3 argument form of open().  Oh, well." >&4
12252                 val="$undef"
12253         fi
12254 elif $test `./findhdr fcntl.h` && \
12255                 set try -DI_FCNTL && eval $compile; then
12256         h_fcntl=true;
12257         echo "<fcntl.h> defines the O_* constants..." >&4
12258         if $run ./try; then
12259                 echo "and you have the 3 argument form of open()." >&4
12260                 val="$define"
12261         else
12262                 echo "but not the 3 argument form of open().  Oh, well." >&4
12263                 val="$undef"
12264         fi
12265 else
12266         val="$undef"
12267         echo "I can't find the O_* constant definitions!  You got problems." >&4
12268 fi
12269 set d_open3
12270 eval $setvar
12271 $rm_try
12272
12273 : see which of string.h or strings.h is needed
12274 echo " "
12275 strings=`./findhdr string.h`
12276 if $test "$strings" && $test -r "$strings"; then
12277         echo "Using <string.h> instead of <strings.h>." >&4
12278         val="$define"
12279 else
12280         val="$undef"
12281         strings=`./findhdr strings.h`
12282         if $test "$strings" && $test -r "$strings"; then
12283                 echo "Using <strings.h> instead of <string.h>." >&4
12284         else
12285                 echo "No string header found -- You'll surely have problems." >&4
12286         fi
12287 fi
12288 set i_string
12289 eval $setvar
12290 case "$i_string" in
12291 "$undef") strings=`./findhdr strings.h`;;
12292 *)        strings=`./findhdr string.h`;;
12293 esac
12294
12295 : see if this is a sys/file.h system
12296 val=''
12297 set sys/file.h val
12298 eval $inhdr
12299
12300 : do we need to include sys/file.h ?
12301 case "$val" in
12302 "$define")
12303         echo " "
12304         if $h_sysfile; then
12305                 val="$define"
12306                 echo "We'll be including <sys/file.h>." >&4
12307         else
12308                 val="$undef"
12309                 echo "We won't be including <sys/file.h>." >&4
12310         fi
12311         ;;
12312 *)
12313         h_sysfile=false
12314         ;;
12315 esac
12316 set i_sysfile
12317 eval $setvar
12318
12319 : see if fcntl.h is there
12320 val=''
12321 set fcntl.h val
12322 eval $inhdr
12323
12324 : see if we can include fcntl.h
12325 case "$val" in
12326 "$define")
12327         echo " "
12328         if $h_fcntl; then
12329                 val="$define"
12330                 echo "We'll be including <fcntl.h>." >&4
12331         else
12332                 val="$undef"
12333                 if $h_sysfile; then
12334         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12335                 else
12336                         echo "We won't be including <fcntl.h>." >&4
12337                 fi
12338         fi
12339         ;;
12340 *)
12341         h_fcntl=false
12342         val="$undef"
12343         ;;
12344 esac
12345 set i_fcntl
12346 eval $setvar
12347
12348 : see if fork exists
12349 set fork d_fork
12350 eval $inlibc
12351
12352 : see if pipe exists
12353 set pipe d_pipe
12354 eval $inlibc
12355
12356 : check for non-blocking I/O stuff
12357 case "$h_sysfile" in
12358 true) echo "#include <sys/file.h>" > head.c;;
12359 *)
12360        case "$h_fcntl" in
12361        true) echo "#include <fcntl.h>" > head.c;;
12362        *) echo "#include <sys/fcntl.h>" > head.c;;
12363        esac
12364        ;;
12365 esac
12366 echo " "
12367 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12368 case "$o_nonblock" in
12369 '')
12370         $cat head.c > try.c
12371         $cat >>try.c <<EOCP
12372 #include <stdio.h>
12373 #$i_stdlib I_STDLIB
12374 #ifdef I_STDLIB
12375 #include <stdlib.h>
12376 #endif
12377 #$i_fcntl I_FCNTL
12378 #ifdef I_FCNTL
12379 #include <fcntl.h>
12380 #endif
12381 int main() {
12382 #ifdef O_NONBLOCK
12383         printf("O_NONBLOCK\n");
12384         exit(0);
12385 #endif
12386 #ifdef O_NDELAY
12387         printf("O_NDELAY\n");
12388         exit(0);
12389 #endif
12390 #ifdef FNDELAY
12391         printf("FNDELAY\n");
12392         exit(0);
12393 #endif
12394         exit(0);
12395 }
12396 EOCP
12397         set try
12398         if eval $compile_ok; then
12399                 o_nonblock=`$run ./try`
12400                 case "$o_nonblock" in
12401                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12402                 *) echo "Seems like we can use $o_nonblock.";;
12403                 esac
12404         else
12405                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12406         fi
12407         ;;
12408 *) echo "Using $hint value $o_nonblock.";;
12409 esac
12410 $rm_try
12411
12412 echo " "
12413 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12414 case "$eagain" in
12415 '')
12416         case "$d_fork:$d_pipe" in
12417         define:define)
12418         $cat head.c > try.c
12419         $cat >>try.c <<EOCP
12420 #include <errno.h>
12421 #include <sys/types.h>
12422 #include <signal.h>
12423 #include <stdio.h>
12424 #$i_stdlib I_STDLIB
12425 #ifdef I_STDLIB
12426 #include <stdlib.h>
12427 #endif
12428 #$i_fcntl I_FCNTL
12429 #ifdef I_FCNTL
12430 #include <fcntl.h>
12431 #endif
12432 #define MY_O_NONBLOCK $o_nonblock
12433 #ifndef errno  /* XXX need better Configure test */
12434 extern int errno;
12435 #endif
12436 #$i_unistd I_UNISTD
12437 #ifdef I_UNISTD
12438 #include <unistd.h>
12439 #endif
12440 #$i_string I_STRING
12441 #ifdef I_STRING
12442 #include <string.h>
12443 #else
12444 #include <strings.h>
12445 #endif
12446 $signal_t blech(int x) { exit(3); }
12447 EOCP
12448         $cat >> try.c <<'EOCP'
12449 int main()
12450 {
12451         int pd[2];
12452         int pu[2];
12453         char buf[1];
12454         char string[100];
12455
12456         pipe(pd);       /* Down: child -> parent */
12457         pipe(pu);       /* Up: parent -> child */
12458         if (0 != fork()) {
12459                 int ret;
12460                 close(pd[1]);   /* Parent reads from pd[0] */
12461                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12462 #ifdef F_SETFL
12463                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12464                         exit(1);
12465 #else
12466                 exit(4);
12467 #endif
12468                 signal(SIGALRM, blech);
12469                 alarm(5);
12470                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12471                         exit(2);
12472                 sprintf(string, "%d\n", ret);
12473                 write(2, string, strlen(string));
12474                 alarm(0);
12475 #ifdef EAGAIN
12476                 if (errno == EAGAIN) {
12477                         printf("EAGAIN\n");
12478                         goto ok;
12479                 }
12480 #endif
12481 #ifdef EWOULDBLOCK
12482                 if (errno == EWOULDBLOCK)
12483                         printf("EWOULDBLOCK\n");
12484 #endif
12485         ok:
12486                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12487                 sleep(2);                               /* Give it time to close our pipe */
12488                 alarm(5);
12489                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12490                 alarm(0);
12491                 sprintf(string, "%d\n", ret);
12492                 write(4, string, strlen(string));
12493                 exit(0);
12494         }
12495
12496         close(pd[0]);                   /* We write to pd[1] */
12497         close(pu[1]);                   /* We read from pu[0] */
12498         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12499         close(pd[1]);                   /* Pipe pd is now fully closed! */
12500         exit(0);                                /* Bye bye, thank you for playing! */
12501 }
12502 EOCP
12503         set try
12504         if eval $compile_ok; then
12505                 echo "$startsh" >mtry
12506                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12507                 chmod +x mtry
12508                 ./mtry >/dev/null 2>&1
12509                 case $? in
12510                 0) eagain=`$cat try.out`;;
12511                 1) echo "Could not perform non-blocking setting!";;
12512                 2) echo "I did a successful read() for something that was not there!";;
12513                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12514                 4) echo "Could not find F_SETFL!";;
12515                 *) echo "Something terribly wrong happened during testing.";;
12516                 esac
12517                 rd_nodata=`$cat try.ret`
12518                 echo "A read() system call with no data present returns $rd_nodata."
12519                 case "$rd_nodata" in
12520                 0|-1) ;;
12521                 *)
12522                         echo "(That's peculiar, fixing that to be -1.)"
12523                         rd_nodata=-1
12524                         ;;
12525                 esac
12526                 case "$eagain" in
12527                 '')
12528                         echo "Forcing errno EAGAIN on read() with no data available."
12529                         eagain=EAGAIN
12530                         ;;
12531                 *)
12532                         echo "Your read() sets errno to $eagain when no data is available."
12533                         ;;
12534                 esac
12535                 status=`$cat try.err`
12536                 case "$status" in
12537                 0) echo "And it correctly returns 0 to signal EOF.";;
12538                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12539                 *) echo "However, your read() returns '$status' on EOF??";;
12540                 esac
12541                 val="$define"
12542                 if test "$status" = "$rd_nodata"; then
12543                         echo "WARNING: you can't distinguish between EOF and no data!"
12544                         val="$undef"
12545                 fi
12546         else
12547                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12548                 eagain=EAGAIN
12549         fi
12550         ;;
12551         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12552                 eagain=EAGAIN
12553                 val="$define"
12554                 ;;
12555         esac
12556         set d_eofnblk
12557         eval $setvar
12558         ;;
12559 *)
12560         echo "Using $hint value $eagain."
12561         echo "Your read() returns $rd_nodata when no data is present."
12562         case "$d_eofnblk" in
12563         "$define") echo "And you can see EOF because read() returns 0.";;
12564         "$undef") echo "But you can't see EOF status from read() returned value.";;
12565         *)
12566                 echo "(Assuming you can't see EOF status from read anyway.)"
12567                 d_eofnblk=$undef
12568                 ;;
12569         esac
12570         ;;
12571 esac
12572 $rm_try head.c mtry
12573
12574 : see if _ptr and _cnt from stdio act std
12575 echo " "
12576
12577 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12578         echo "(Looks like you have stdio.h from BSD.)"
12579         case "$stdio_ptr" in
12580         '') stdio_ptr='((fp)->_p)'
12581                 ptr_lval=$define
12582                 ;;
12583         *)      ptr_lval=$d_stdio_ptr_lval;;
12584         esac
12585         case "$stdio_cnt" in
12586         '') stdio_cnt='((fp)->_r)'
12587                 cnt_lval=$define
12588                 ;;
12589         *)      cnt_lval=$d_stdio_cnt_lval;;
12590         esac
12591         case "$stdio_base" in
12592         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12593         esac
12594         case "$stdio_bufsiz" in
12595         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12596         esac
12597 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12598         echo "(Looks like you have stdio.h from Linux.)"
12599         case "$stdio_ptr" in
12600         '') stdio_ptr='((fp)->_IO_read_ptr)'
12601                 ptr_lval=$define
12602                 ;;
12603         *)      ptr_lval=$d_stdio_ptr_lval;;
12604         esac
12605         case "$stdio_cnt" in
12606         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12607                 cnt_lval=$undef
12608                 ;;
12609         *)      cnt_lval=$d_stdio_cnt_lval;;
12610         esac
12611         case "$stdio_base" in
12612         '') stdio_base='((fp)->_IO_read_base)';;
12613         esac
12614         case "$stdio_bufsiz" in
12615         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12616         esac
12617 else
12618         case "$stdio_ptr" in
12619         '') stdio_ptr='((fp)->_ptr)'
12620                 ptr_lval=$define
12621                 ;;
12622         *)      ptr_lval=$d_stdio_ptr_lval;;
12623         esac
12624         case "$stdio_cnt" in
12625         '') stdio_cnt='((fp)->_cnt)'
12626                 cnt_lval=$define
12627                 ;;
12628         *)      cnt_lval=$d_stdio_cnt_lval;;
12629         esac
12630         case "$stdio_base" in
12631         '') stdio_base='((fp)->_base)';;
12632         esac
12633         case "$stdio_bufsiz" in
12634         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12635         esac
12636 fi
12637
12638 : test whether _ptr and _cnt really work
12639 echo "Checking how std your stdio is..." >&4
12640 $cat >try.c <<EOP
12641 #include <stdio.h>
12642 #$i_stdlib I_STDLIB
12643 #ifdef I_STDLIB
12644 #include <stdlib.h>
12645 #endif
12646 #define FILE_ptr(fp)    $stdio_ptr
12647 #define FILE_cnt(fp)    $stdio_cnt
12648 int main() {
12649         FILE *fp = fopen("try.c", "r");
12650         char c = getc(fp);
12651         if (
12652                 18 <= FILE_cnt(fp) &&
12653                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12654         )
12655                 exit(0);
12656         exit(1);
12657 }
12658 EOP
12659 val="$undef"
12660 set try
12661 if eval $compile && $to try.c; then
12662         if $run ./try; then
12663                 echo "Your stdio acts pretty std."
12664                 val="$define"
12665         else
12666                 echo "Your stdio isn't very std."
12667         fi
12668 else
12669         echo "Your stdio doesn't appear very std."
12670 fi
12671 $rm_try
12672
12673 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12674 # direct buffer manipulation no longer works.  The Configure tests
12675 # should be changed to correctly detect this, but until then,
12676 # the following check should at least let perl compile and run.
12677 # (This quick fix should be updated before 5.8.1.)
12678 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12679 # A. Dougherty, June 3, 2002.
12680 case "$d_gnulibc" in
12681 $define)
12682         case "$gnulibc_version" in
12683         2.[01]*)  ;;
12684         2.2) ;;
12685         2.2.[0-9]) ;;
12686         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12687                 val="$undef"
12688                 ;;
12689         esac
12690         ;;
12691 esac
12692 set d_stdstdio
12693 eval $setvar
12694
12695 : Can _ptr be used as an lvalue?
12696 case "$d_stdstdio$ptr_lval" in
12697 $define$define) val=$define ;;
12698 *) val=$undef ;;
12699 esac
12700 set d_stdio_ptr_lval
12701 eval $setvar
12702
12703 : Can _cnt be used as an lvalue?
12704 case "$d_stdstdio$cnt_lval" in
12705 $define$define) val=$define ;;
12706 *) val=$undef ;;
12707 esac
12708 set d_stdio_cnt_lval
12709 eval $setvar
12710
12711
12712 : test whether setting _ptr sets _cnt as a side effect
12713 d_stdio_ptr_lval_sets_cnt="$undef"
12714 d_stdio_ptr_lval_nochange_cnt="$undef"
12715 case "$d_stdio_ptr_lval$d_stdstdio" in
12716 $define$define)
12717         echo "Checking to see what happens if we set the stdio ptr..." >&4
12718 $cat >try.c <<EOP
12719 #include <stdio.h>
12720 /* Can we scream? */
12721 /* Eat dust sed :-) */
12722 /* In the buffer space, no one can hear you scream. */
12723 #$i_stdlib I_STDLIB
12724 #ifdef I_STDLIB
12725 #include <stdlib.h>
12726 #endif
12727 #define FILE_ptr(fp)    $stdio_ptr
12728 #define FILE_cnt(fp)    $stdio_cnt
12729 #include <sys/types.h>
12730 int main() {
12731         FILE *fp = fopen("try.c", "r");
12732         int c;
12733         char *ptr;
12734         size_t cnt;
12735         if (!fp) {
12736             puts("Fail even to read");
12737             exit(1);
12738         }
12739         c = getc(fp); /* Read away the first # */
12740         if (c == EOF) {
12741             puts("Fail even to read");
12742             exit(1);
12743         }
12744         if (!(
12745                 18 <= FILE_cnt(fp) &&
12746                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12747         )) {
12748                 puts("Fail even to read");
12749                 exit (1);
12750         }
12751         ptr = (char*) FILE_ptr(fp);
12752         cnt = (size_t)FILE_cnt(fp);
12753
12754         FILE_ptr(fp) += 42;
12755
12756         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12757                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12758                 exit (1);
12759         }
12760         if (FILE_cnt(fp) <= 20) {
12761                 printf ("Fail (<20 chars to test)");
12762                 exit (1);
12763         }
12764         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12765                 puts("Fail compare");
12766                 exit (1);
12767         }
12768         if (cnt == FILE_cnt(fp)) {
12769                 puts("Pass_unchanged");
12770                 exit (0);
12771         }
12772         if (FILE_cnt(fp) == (cnt - 42)) {
12773                 puts("Pass_changed");
12774                 exit (0);
12775         }
12776         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12777         return 1;
12778
12779 }
12780 EOP
12781         set try
12782         if eval $compile && $to try.c; then
12783                 case `$run ./try` in
12784                 Pass_changed)
12785                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12786                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12787                 Pass_unchanged)
12788                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12789                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12790                 Fail*)
12791                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12792                 *)
12793                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12794         esac
12795         else
12796                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12797         fi
12798         $rm_try
12799         ;;
12800 esac
12801
12802 : see if _base is also standard
12803 val="$undef"
12804 case "$d_stdstdio" in
12805 $define)
12806         $cat >try.c <<EOP
12807 #include <stdio.h>
12808 #$i_stdlib I_STDLIB
12809 #ifdef I_STDLIB
12810 #include <stdlib.h>
12811 #endif
12812 #define FILE_base(fp)   $stdio_base
12813 #define FILE_bufsiz(fp) $stdio_bufsiz
12814 int main() {
12815         FILE *fp = fopen("try.c", "r");
12816         char c = getc(fp);
12817         if (
12818                 19 <= FILE_bufsiz(fp) &&
12819                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12820         )
12821                 exit(0);
12822         exit(1);
12823 }
12824 EOP
12825         set try
12826         if eval $compile && $to try.c; then
12827                 if $run ./try; then
12828                         echo "And its _base field acts std."
12829                         val="$define"
12830                 else
12831                         echo "But its _base field isn't std."
12832                 fi
12833         else
12834                 echo "However, it seems to be lacking the _base field."
12835         fi
12836         $rm_try
12837         ;;
12838 esac
12839 set d_stdiobase
12840 eval $setvar
12841
12842 : see if fast_stdio exists
12843 val="$undef"
12844 case "$d_stdstdio:$d_stdio_ptr_lval" in
12845 "$define:$define")
12846         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12847         *$define*)
12848                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12849                 val="$define"
12850                 ;;
12851         esac
12852         ;;
12853 esac
12854 set d_faststdio
12855 eval $setvar
12856
12857
12858
12859 : see if fchdir exists
12860 set fchdir d_fchdir
12861 eval $inlibc
12862
12863 : see if fchmod exists
12864 set fchmod d_fchmod
12865 eval $inlibc
12866
12867 : see if fchown exists
12868 set fchown d_fchown
12869 eval $inlibc
12870
12871 : see if this is an fcntl system
12872 set fcntl d_fcntl
12873 eval $inlibc
12874
12875 : See if fcntl-based locking works.
12876 echo " "
12877 $cat >try.c <<EOCP
12878 #$i_stdlib I_STDLIB
12879 #ifdef I_STDLIB
12880 #include <stdlib.h>
12881 #endif
12882 #include <unistd.h>
12883 #include <fcntl.h>
12884 #include <signal.h>
12885 $signal_t blech(int x) { exit(3); }
12886 int main() {
12887 #if defined(F_SETLK) && defined(F_SETLKW)
12888      struct flock flock;
12889      int retval, fd;
12890      fd = open("try.c", O_RDONLY);
12891      flock.l_type = F_RDLCK;
12892      flock.l_whence = SEEK_SET;
12893      flock.l_start = flock.l_len = 0;
12894      signal(SIGALRM, blech);
12895      alarm(10);
12896      retval = fcntl(fd, F_SETLK, &flock);
12897      close(fd);
12898      (retval < 0 ? exit(2) : exit(0));
12899 #else
12900      exit(2);
12901 #endif
12902 }
12903 EOCP
12904 echo "Checking if fcntl-based file locking works... "
12905 case "$d_fcntl" in
12906 "$define")
12907         set try
12908         if eval $compile_ok; then
12909                 if $run ./try; then
12910                         echo "Yes, it seems to work."
12911                         val="$define"
12912                 else
12913                         echo "Nope, it didn't work."
12914                         val="$undef"
12915                         case "$?" in
12916                         3) $cat >&4 <<EOM
12917 ***
12918 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12919 *** This is (almost) impossible.
12920 *** If your NFS lock daemons are not feeling well, something like
12921 *** this may happen, please investigate.  Cannot continue, aborting.
12922 ***
12923 EOM
12924                                 exit 1
12925                                 ;;
12926                         esac
12927                 fi
12928         else
12929                 echo "I'm unable to compile the test program, so I'll assume not."
12930                 val="$undef"
12931         fi
12932         ;;
12933 *) val="$undef";
12934         echo "Nope, since you don't even have fcntl()."
12935         ;;
12936 esac
12937 set d_fcntl_can_lock
12938 eval $setvar
12939 $rm_try
12940
12941 : check for fd_set items
12942 $cat <<EOM
12943
12944 Checking to see how well your C compiler handles fd_set and friends ...
12945 EOM
12946 $cat >try.c <<EOCP
12947 #$i_stdlib I_STDLIB
12948 #ifdef I_STDLIB
12949 #include <stdlib.h>
12950 #endif
12951 #$i_systime I_SYS_TIME
12952 #$i_sysselct I_SYS_SELECT
12953 #$d_socket HAS_SOCKET
12954 #include <sys/types.h>
12955 #ifdef HAS_SOCKET
12956 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12957 #endif
12958 #ifdef I_SYS_TIME
12959 #include <sys/time.h>
12960 #endif
12961 #ifdef I_SYS_SELECT
12962 #include <sys/select.h>
12963 #endif
12964 int main() {
12965         fd_set fds;
12966
12967 #ifdef TRYBITS
12968         if(fds.fds_bits);
12969 #endif
12970
12971 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12972         exit(0);
12973 #else
12974         exit(1);
12975 #endif
12976 }
12977 EOCP
12978 set try -DTRYBITS
12979 if eval $compile; then
12980         d_fds_bits="$define"
12981         d_fd_set="$define"
12982         echo "Well, your system knows about the normal fd_set typedef..." >&4
12983         if $run ./try; then
12984                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12985                 d_fd_macros="$define"
12986         else
12987                 $cat >&4 <<'EOM'
12988 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12989 EOM
12990                 d_fd_macros="$undef"
12991         fi
12992 else
12993         $cat <<'EOM'
12994 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12995 EOM
12996         set try
12997         if eval $compile; then
12998                 d_fds_bits="$undef"
12999                 d_fd_set="$define"
13000                 echo "Well, your system has some sort of fd_set available..." >&4
13001                 if $run ./try; then
13002                         echo "and you have the normal fd_set macros." >&4
13003                         d_fd_macros="$define"
13004                 else
13005                         $cat <<'EOM'
13006 but not the normal fd_set macros!  Gross!  More work for me...
13007 EOM
13008                         d_fd_macros="$undef"
13009                 fi
13010         else
13011         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13012                 d_fd_set="$undef"
13013                 d_fds_bits="$undef"
13014                 d_fd_macros="$undef"
13015         fi
13016 fi
13017 $rm_try
13018
13019 : see if fgetpos exists
13020 set fgetpos d_fgetpos
13021 eval $inlibc
13022
13023 : see if finite exists
13024 set finite d_finite
13025 eval $inlibc
13026
13027 : see if finitel exists
13028 set finitel d_finitel
13029 eval $inlibc
13030
13031 : see if flock exists
13032 set flock d_flock
13033 eval $inlibc
13034
13035 : see if prototype for flock is available
13036 echo " "
13037 set d_flockproto flock $i_sysfile sys/file.h
13038 eval $hasproto
13039
13040 : see if fp_class exists
13041 set fp_class d_fp_class
13042 eval $inlibc
13043
13044 : see if pathconf exists
13045 set pathconf d_pathconf
13046 eval $inlibc
13047
13048 : see if fpathconf exists
13049 set fpathconf d_fpathconf
13050 eval $inlibc
13051
13052 : see if fpclass exists
13053 set fpclass d_fpclass
13054 eval $inlibc
13055
13056 : see if fpclassify exists
13057 set fpclassify d_fpclassify
13058 eval $inlibc
13059
13060 : see if fpclassl exists
13061 set fpclassl d_fpclassl
13062 eval $inlibc
13063
13064 : check for fpos64_t
13065 echo " "
13066 echo "Checking to see if you have fpos64_t..." >&4
13067 $cat >try.c <<EOCP
13068 #include <stdio.h>
13069 int main() { fpos64_t x = 7; }
13070 EOCP
13071 set try
13072 if eval $compile; then
13073         val="$define"
13074         echo "You have fpos64_t."
13075 else
13076         val="$undef"
13077         echo "You do not have fpos64_t."
13078         case "$fpossize" in
13079         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13080         esac
13081 fi
13082 $rm_try
13083 set d_fpos64_t
13084 eval $setvar
13085
13086 : see if frexpl exists
13087 set frexpl d_frexpl
13088 eval $inlibc
13089
13090 : see if this is a sys/param system
13091 set sys/param.h i_sysparam
13092 eval $inhdr
13093
13094 : see if this is a sys/mount.h system
13095 set sys/mount.h i_sysmount
13096 eval $inhdr
13097
13098 : Check for fs_data_s
13099 echo " "
13100 echo "Checking to see if your system supports struct fs_data..." >&4
13101 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13102 eval $hasstruct
13103 case "$d_fs_data_s" in
13104 "$define")      echo "Yes, it does."   ;;
13105 *)              echo "No, it doesn't." ;;
13106 esac
13107
13108 : see if fseeko exists
13109 set fseeko d_fseeko
13110 eval $inlibc
13111 case "$longsize" in
13112 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13113 esac
13114
13115 : see if fsetpos exists
13116 set fsetpos d_fsetpos
13117 eval $inlibc
13118
13119 : see if fstatfs exists
13120 set fstatfs d_fstatfs
13121 eval $inlibc
13122
13123 : see if statvfs exists
13124 set statvfs d_statvfs
13125 eval $inlibc
13126
13127 : see if fstatvfs exists
13128 set fstatvfs d_fstatvfs
13129 eval $inlibc
13130
13131
13132 : see if fsync exists
13133 set fsync d_fsync
13134 eval $inlibc
13135
13136 : see if ftello exists
13137 set ftello d_ftello
13138 eval $inlibc
13139 case "$longsize" in
13140 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13141 esac
13142
13143 : check for a working futimes
13144 d_futimes="$undef"
13145 echo " "
13146 echo "Checking if you have a working futimes()" >&4
13147 $cat >try.c <<EOCP
13148 #include <stdio.h>
13149 #include <sys/time.h>
13150 #include <errno.h>
13151 #include <fcntl.h>
13152
13153 int main ()
13154 {
13155     int fd, rv;
13156     fd = open ("try.c", O_RDWR);
13157     if (-1 == fd) exit (1);
13158     rv = futimes (fd, NULL);
13159     exit (rv == -1 ? errno : 0);
13160 }
13161 EOCP
13162 set try
13163 if eval $compile; then
13164     `$run ./try`
13165     rc=$?
13166     case "$rc" in
13167         0)  echo "Yes, you have" >&4
13168             d_futimes="$define"
13169             ;;
13170         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13171             ;;
13172     esac
13173 else
13174     echo "No, it does not (probably harmless)" >&4
13175 fi
13176 $rm_try
13177
13178 : see if getcwd exists
13179 set getcwd d_getcwd
13180 eval $inlibc
13181
13182 : see if getespwnam exists
13183 set getespwnam d_getespwnam
13184 eval $inlibc
13185
13186 : see if getfsstat exists
13187 set getfsstat d_getfsstat
13188 eval $inlibc
13189
13190 : see if getgrent exists
13191 set getgrent d_getgrent
13192 eval $inlibc
13193
13194 : see if getgrent_r exists
13195 set getgrent_r d_getgrent_r
13196 eval $inlibc
13197 case "$d_getgrent_r" in
13198 "$define")
13199         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13200         case "$d_getgrent_r_proto:$usethreads" in
13201         ":define")      d_getgrent_r_proto=define
13202                 set d_getgrent_r_proto getgrent_r $hdrs
13203                 eval $hasproto ;;
13204         *)      ;;
13205         esac
13206         case "$d_getgrent_r_proto" in
13207         define)
13208         case "$getgrent_r_proto" in
13209         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13210         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13211         esac
13212         case "$getgrent_r_proto" in
13213         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13214         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13215         esac
13216         case "$getgrent_r_proto" in
13217         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13218         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13219         esac
13220         case "$getgrent_r_proto" in
13221         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13222         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13223         esac
13224         case "$getgrent_r_proto" in
13225         ''|0) try='int getgrent_r(struct group*, char*, int);'
13226         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13227         esac
13228         case "$getgrent_r_proto" in
13229         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13230         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13231         esac
13232         case "$getgrent_r_proto" in
13233         ''|0)   d_getgrent_r=undef
13234                 getgrent_r_proto=0
13235                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13236         * )     case "$getgrent_r_proto" in
13237                 REENTRANT_PROTO*) ;;
13238                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13239                 esac
13240                 echo "Prototype: $try" ;;
13241         esac
13242         ;;
13243         *)      case "$usethreads" in
13244                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13245                 esac
13246                 d_getgrent_r=undef
13247                 getgrent_r_proto=0
13248                 ;;
13249         esac
13250         ;;
13251 *)      getgrent_r_proto=0
13252         ;;
13253 esac
13254
13255 : see if getgrgid_r exists
13256 set getgrgid_r d_getgrgid_r
13257 eval $inlibc
13258 case "$d_getgrgid_r" in
13259 "$define")
13260         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13261         case "$d_getgrgid_r_proto:$usethreads" in
13262         ":define")      d_getgrgid_r_proto=define
13263                 set d_getgrgid_r_proto getgrgid_r $hdrs
13264                 eval $hasproto ;;
13265         *)      ;;
13266         esac
13267         case "$d_getgrgid_r_proto" in
13268         define)
13269         case "$getgrgid_r_proto" in
13270         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13271         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13272         esac
13273         case "$getgrgid_r_proto" in
13274         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13275         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13276         esac
13277         case "$getgrgid_r_proto" in
13278         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13279         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13280         esac
13281         case "$getgrgid_r_proto" in
13282         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13283         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13284         esac
13285         case "$getgrgid_r_proto" in
13286         ''|0)   d_getgrgid_r=undef
13287                 getgrgid_r_proto=0
13288                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13289         * )     case "$getgrgid_r_proto" in
13290                 REENTRANT_PROTO*) ;;
13291                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13292                 esac
13293                 echo "Prototype: $try" ;;
13294         esac
13295         ;;
13296         *)      case "$usethreads" in
13297                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13298                 esac
13299                 d_getgrgid_r=undef
13300                 getgrgid_r_proto=0
13301                 ;;
13302         esac
13303         ;;
13304 *)      getgrgid_r_proto=0
13305         ;;
13306 esac
13307
13308 : see if getgrnam_r exists
13309 set getgrnam_r d_getgrnam_r
13310 eval $inlibc
13311 case "$d_getgrnam_r" in
13312 "$define")
13313         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13314         case "$d_getgrnam_r_proto:$usethreads" in
13315         ":define")      d_getgrnam_r_proto=define
13316                 set d_getgrnam_r_proto getgrnam_r $hdrs
13317                 eval $hasproto ;;
13318         *)      ;;
13319         esac
13320         case "$d_getgrnam_r_proto" in
13321         define)
13322         case "$getgrnam_r_proto" in
13323         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13324         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13325         esac
13326         case "$getgrnam_r_proto" in
13327         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13328         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13329         esac
13330         case "$getgrnam_r_proto" in
13331         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13332         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13333         esac
13334         case "$getgrnam_r_proto" in
13335         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13336         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13337         esac
13338         case "$getgrnam_r_proto" in
13339         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13340         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13341         esac
13342         case "$getgrnam_r_proto" in
13343         ''|0)   d_getgrnam_r=undef
13344                 getgrnam_r_proto=0
13345                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13346         * )     case "$getgrnam_r_proto" in
13347                 REENTRANT_PROTO*) ;;
13348                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13349                 esac
13350                 echo "Prototype: $try" ;;
13351         esac
13352         ;;
13353         *)      case "$usethreads" in
13354                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13355                 esac
13356                 d_getgrnam_r=undef
13357                 getgrnam_r_proto=0
13358                 ;;
13359         esac
13360         ;;
13361 *)      getgrnam_r_proto=0
13362         ;;
13363 esac
13364
13365 : see if gethostbyaddr exists
13366 set gethostbyaddr d_gethbyaddr
13367 eval $inlibc
13368
13369 : see if gethostbyname exists
13370 set gethostbyname d_gethbyname
13371 eval $inlibc
13372
13373 : see if gethostent exists
13374 set gethostent d_gethent
13375 eval $inlibc
13376
13377 : see how we will look up host name
13378 echo " "
13379 call=''
13380 if set gethostname val -f d_gethname; eval $csym; $val; then
13381         echo 'gethostname() found.' >&4
13382         d_gethname="$define"
13383         call=gethostname
13384 fi
13385 if set uname val -f d_uname; eval $csym; $val; then
13386         if ./xenix; then
13387                 $cat <<'EOM'
13388 uname() was found, but you're running xenix, and older versions of xenix
13389 have a broken uname(). If you don't really know whether your xenix is old
13390 enough to have a broken system call, use the default answer.
13391
13392 EOM
13393                 dflt=y
13394                 case "$d_uname" in
13395                 "$define") dflt=n;;
13396                 esac
13397                 rp='Is your uname() broken?'
13398                 . ./myread
13399                 case "$ans" in
13400                 n*) d_uname="$define"; call=uname;;
13401                 esac
13402         else
13403                 echo 'uname() found.' >&4
13404                 d_uname="$define"
13405                 case "$call" in
13406                 '') call=uname ;;
13407                 esac
13408         fi
13409 fi
13410 case "$d_gethname" in
13411 '') d_gethname="$undef";;
13412 esac
13413 case "$d_uname" in
13414 '') d_uname="$undef";;
13415 esac
13416 case "$d_uname$d_gethname" in
13417 *define*)
13418         dflt=n
13419         cat <<EOM
13420
13421 Every now and then someone has a $call() that lies about the hostname
13422 but can't be fixed for political or economic reasons.  If you wish, I can
13423 pretend $call() isn't there and maybe compute hostname at run-time
13424 thanks to the '$phostname' command.
13425
13426 EOM
13427         rp="Shall I ignore $call() from now on?"
13428         . ./myread
13429         case "$ans" in
13430         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13431         esac;;
13432 esac
13433 case "$phostname" in
13434 '') aphostname='';;
13435 *) case "$aphostname" in
13436         /*) ;;
13437         *) set X $phostname
13438                 shift
13439                 file=$1
13440                 shift
13441                 file=`./loc $file $file $pth`
13442                 aphostname=`echo $file $*`
13443                 ;;
13444         esac
13445         ;;
13446 esac
13447 case "$d_uname$d_gethname" in
13448 *define*) ;;
13449 *)
13450         case "$phostname" in
13451         '')
13452                 echo "There will be no way for $package to get your hostname." >&4;;
13453         *)
13454         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13455                 ;;
13456         esac;;
13457 esac
13458 case "$d_phostname" in
13459 '') d_phostname="$undef";;
13460 esac
13461
13462 : see if gethostbyaddr_r exists
13463 set gethostbyaddr_r d_gethostbyaddr_r
13464 eval $inlibc
13465 case "$d_gethostbyaddr_r" in
13466 "$define")
13467         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13468         case "$d_gethostbyaddr_r_proto:$usethreads" in
13469         ":define")      d_gethostbyaddr_r_proto=define
13470                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13471                 eval $hasproto ;;
13472         *)      ;;
13473         esac
13474         case "$d_gethostbyaddr_r_proto" in
13475         define)
13476         case "$gethostbyaddr_r_proto" in
13477         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13478         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13479         esac
13480         case "$gethostbyaddr_r_proto" in
13481         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13482         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13483         esac
13484         case "$gethostbyaddr_r_proto" in
13485         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13486         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13487         esac
13488         case "$gethostbyaddr_r_proto" in
13489         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13490         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13491         esac
13492         case "$gethostbyaddr_r_proto" in
13493         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13494         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13495         esac
13496         case "$gethostbyaddr_r_proto" in
13497         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13498         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13499         esac
13500         case "$gethostbyaddr_r_proto" in
13501         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13502         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13503         esac
13504         case "$gethostbyaddr_r_proto" in
13505         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13506         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13507         esac
13508         case "$gethostbyaddr_r_proto" in
13509         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13510         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13511         esac
13512         case "$gethostbyaddr_r_proto" in
13513         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13514         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13515         esac
13516         case "$gethostbyaddr_r_proto" in
13517         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13518         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13519         esac
13520         case "$gethostbyaddr_r_proto" in
13521         ''|0)   d_gethostbyaddr_r=undef
13522                 gethostbyaddr_r_proto=0
13523                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13524         * )     case "$gethostbyaddr_r_proto" in
13525                 REENTRANT_PROTO*) ;;
13526                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13527                 esac
13528                 echo "Prototype: $try" ;;
13529         esac
13530         ;;
13531         *)      case "$usethreads" in
13532                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13533                 esac
13534                 d_gethostbyaddr_r=undef
13535                 gethostbyaddr_r_proto=0
13536                 ;;
13537         esac
13538         ;;
13539 *)      gethostbyaddr_r_proto=0
13540         ;;
13541 esac
13542
13543 : see if gethostbyname_r exists
13544 set gethostbyname_r d_gethostbyname_r
13545 eval $inlibc
13546 case "$d_gethostbyname_r" in
13547 "$define")
13548         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13549         case "$d_gethostbyname_r_proto:$usethreads" in
13550         ":define")      d_gethostbyname_r_proto=define
13551                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13552                 eval $hasproto ;;
13553         *)      ;;
13554         esac
13555         case "$d_gethostbyname_r_proto" in
13556         define)
13557         case "$gethostbyname_r_proto" in
13558         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13559         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13560         esac
13561         case "$gethostbyname_r_proto" in
13562         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13563         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13564         esac
13565         case "$gethostbyname_r_proto" in
13566         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13567         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13568         esac
13569         case "$gethostbyname_r_proto" in
13570         ''|0)   d_gethostbyname_r=undef
13571                 gethostbyname_r_proto=0
13572                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13573         * )     case "$gethostbyname_r_proto" in
13574                 REENTRANT_PROTO*) ;;
13575                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13576                 esac
13577                 echo "Prototype: $try" ;;
13578         esac
13579         ;;
13580         *)      case "$usethreads" in
13581                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13582                 esac
13583                 d_gethostbyname_r=undef
13584                 gethostbyname_r_proto=0
13585                 ;;
13586         esac
13587         ;;
13588 *)      gethostbyname_r_proto=0
13589         ;;
13590 esac
13591
13592 : see if gethostent_r exists
13593 set gethostent_r d_gethostent_r
13594 eval $inlibc
13595 case "$d_gethostent_r" in
13596 "$define")
13597         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13598         case "$d_gethostent_r_proto:$usethreads" in
13599         ":define")      d_gethostent_r_proto=define
13600                 set d_gethostent_r_proto gethostent_r $hdrs
13601                 eval $hasproto ;;
13602         *)      ;;
13603         esac
13604         case "$d_gethostent_r_proto" in
13605         define)
13606         case "$gethostent_r_proto" in
13607         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13608         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13609         esac
13610         case "$gethostent_r_proto" in
13611         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13612         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13613         esac
13614         case "$gethostent_r_proto" in
13615         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13616         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13617         esac
13618         case "$gethostent_r_proto" in
13619         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13620         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13621         esac
13622         case "$gethostent_r_proto" in
13623         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13624         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13625         esac
13626         case "$gethostent_r_proto" in
13627         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13628         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13629         esac
13630         case "$gethostent_r_proto" in
13631         ''|0)   d_gethostent_r=undef
13632                 gethostent_r_proto=0
13633                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13634         * )     case "$gethostent_r_proto" in
13635                 REENTRANT_PROTO*) ;;
13636                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13637                 esac
13638                 echo "Prototype: $try" ;;
13639         esac
13640         ;;
13641         *)      case "$usethreads" in
13642                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13643                 esac
13644                 d_gethostent_r=undef
13645                 gethostent_r_proto=0
13646                 ;;
13647         esac
13648         ;;
13649 *)      gethostent_r_proto=0
13650         ;;
13651 esac
13652
13653 : see if prototypes for various gethostxxx netdb.h functions are available
13654 echo " "
13655 set d_gethostprotos gethostent $i_netdb netdb.h
13656 eval $hasproto
13657
13658 : see if getitimer exists
13659 set getitimer d_getitimer
13660 eval $inlibc
13661
13662 : see if getlogin exists
13663 set getlogin d_getlogin
13664 eval $inlibc
13665
13666 : see if getlogin_r exists
13667 set getlogin_r d_getlogin_r
13668 eval $inlibc
13669 case "$d_getlogin_r" in
13670 "$define")
13671         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13672         case "$d_getlogin_r_proto:$usethreads" in
13673         ":define")      d_getlogin_r_proto=define
13674                 set d_getlogin_r_proto getlogin_r $hdrs
13675                 eval $hasproto ;;
13676         *)      ;;
13677         esac
13678         case "$d_getlogin_r_proto" in
13679         define)
13680         case "$getlogin_r_proto" in
13681         ''|0) try='int getlogin_r(char*, size_t);'
13682         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13683         esac
13684         case "$getlogin_r_proto" in
13685         ''|0) try='int getlogin_r(char*, int);'
13686         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13687         esac
13688         case "$getlogin_r_proto" in
13689         ''|0) try='char* getlogin_r(char*, size_t);'
13690         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13691         esac
13692         case "$getlogin_r_proto" in
13693         ''|0) try='char* getlogin_r(char*, int);'
13694         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13695         esac
13696         case "$getlogin_r_proto" in
13697         ''|0)   d_getlogin_r=undef
13698                 getlogin_r_proto=0
13699                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13700         * )     case "$getlogin_r_proto" in
13701                 REENTRANT_PROTO*) ;;
13702                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13703                 esac
13704                 echo "Prototype: $try" ;;
13705         esac
13706         ;;
13707         *)      case "$usethreads" in
13708                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13709                 esac
13710                 d_getlogin_r=undef
13711                 getlogin_r_proto=0
13712                 ;;
13713         esac
13714         ;;
13715 *)      getlogin_r_proto=0
13716         ;;
13717 esac
13718
13719 : see if getmnt exists
13720 set getmnt d_getmnt
13721 eval $inlibc
13722
13723 : see if getmntent exists
13724 set getmntent d_getmntent
13725 eval $inlibc
13726
13727 : see if getnetbyaddr exists
13728 set getnetbyaddr d_getnbyaddr
13729 eval $inlibc
13730
13731 : see if getnetbyname exists
13732 set getnetbyname d_getnbyname
13733 eval $inlibc
13734
13735 : see if getnetent exists
13736 set getnetent d_getnent
13737 eval $inlibc
13738
13739 : see if getnetbyaddr_r exists
13740 set getnetbyaddr_r d_getnetbyaddr_r
13741 eval $inlibc
13742 case "$d_getnetbyaddr_r" in
13743 "$define")
13744         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13745         case "$d_getnetbyaddr_r_proto:$usethreads" in
13746         ":define")      d_getnetbyaddr_r_proto=define
13747                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13748                 eval $hasproto ;;
13749         *)      ;;
13750         esac
13751         case "$d_getnetbyaddr_r_proto" in
13752         define)
13753         case "$getnetbyaddr_r_proto" in
13754         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13755         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13756         esac
13757         case "$getnetbyaddr_r_proto" in
13758         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13759         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13760         esac
13761         case "$getnetbyaddr_r_proto" in
13762         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13763         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13764         esac
13765         case "$getnetbyaddr_r_proto" in
13766         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13767         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13768         esac
13769         case "$getnetbyaddr_r_proto" in
13770         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13771         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13772         esac
13773         case "$getnetbyaddr_r_proto" in
13774         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13775         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13776         esac
13777         case "$getnetbyaddr_r_proto" in
13778         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13779         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13780         esac
13781         case "$getnetbyaddr_r_proto" in
13782         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13783         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13784         esac
13785         case "$getnetbyaddr_r_proto" in
13786         ''|0)   d_getnetbyaddr_r=undef
13787                 getnetbyaddr_r_proto=0
13788                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13789         * )     case "$getnetbyaddr_r_proto" in
13790                 REENTRANT_PROTO*) ;;
13791                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13792                 esac
13793                 echo "Prototype: $try" ;;
13794         esac
13795         ;;
13796         *)      case "$usethreads" in
13797                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13798                 esac
13799                 d_getnetbyaddr_r=undef
13800                 getnetbyaddr_r_proto=0
13801                 ;;
13802         esac
13803         ;;
13804 *)      getnetbyaddr_r_proto=0
13805         ;;
13806 esac
13807
13808 : see if getnetbyname_r exists
13809 set getnetbyname_r d_getnetbyname_r
13810 eval $inlibc
13811 case "$d_getnetbyname_r" in
13812 "$define")
13813         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13814         case "$d_getnetbyname_r_proto:$usethreads" in
13815         ":define")      d_getnetbyname_r_proto=define
13816                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13817                 eval $hasproto ;;
13818         *)      ;;
13819         esac
13820         case "$d_getnetbyname_r_proto" in
13821         define)
13822         case "$getnetbyname_r_proto" in
13823         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13824         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13825         esac
13826         case "$getnetbyname_r_proto" in
13827         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13828         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13829         esac
13830         case "$getnetbyname_r_proto" in
13831         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13832         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13833         esac
13834         case "$getnetbyname_r_proto" in
13835         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13836         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13837         esac
13838         case "$getnetbyname_r_proto" in
13839         ''|0)   d_getnetbyname_r=undef
13840                 getnetbyname_r_proto=0
13841                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13842         * )     case "$getnetbyname_r_proto" in
13843                 REENTRANT_PROTO*) ;;
13844                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13845                 esac
13846                 echo "Prototype: $try" ;;
13847         esac
13848         ;;
13849         *)      case "$usethreads" in
13850                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13851                 esac
13852                 d_getnetbyname_r=undef
13853                 getnetbyname_r_proto=0
13854                 ;;
13855         esac
13856         ;;
13857 *)      getnetbyname_r_proto=0
13858         ;;
13859 esac
13860
13861 : see if getnetent_r exists
13862 set getnetent_r d_getnetent_r
13863 eval $inlibc
13864 case "$d_getnetent_r" in
13865 "$define")
13866         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13867         case "$d_getnetent_r_proto:$usethreads" in
13868         ":define")      d_getnetent_r_proto=define
13869                 set d_getnetent_r_proto getnetent_r $hdrs
13870                 eval $hasproto ;;
13871         *)      ;;
13872         esac
13873         case "$d_getnetent_r_proto" in
13874         define)
13875         case "$getnetent_r_proto" in
13876         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13877         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13878         esac
13879         case "$getnetent_r_proto" in
13880         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13881         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13882         esac
13883         case "$getnetent_r_proto" in
13884         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13885         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13886         esac
13887         case "$getnetent_r_proto" in
13888         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13889         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13890         esac
13891         case "$getnetent_r_proto" in
13892         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13893         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13894         esac
13895         case "$getnetent_r_proto" in
13896         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13897         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13898         esac
13899         case "$getnetent_r_proto" in
13900         ''|0)   d_getnetent_r=undef
13901                 getnetent_r_proto=0
13902                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13903         * )     case "$getnetent_r_proto" in
13904                 REENTRANT_PROTO*) ;;
13905                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13906                 esac
13907                 echo "Prototype: $try" ;;
13908         esac
13909         ;;
13910         *)      case "$usethreads" in
13911                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13912                 esac
13913                 d_getnetent_r=undef
13914                 getnetent_r_proto=0
13915                 ;;
13916         esac
13917         ;;
13918 *)      getnetent_r_proto=0
13919         ;;
13920 esac
13921
13922 : see if prototypes for various getnetxxx netdb.h functions are available
13923 echo " "
13924 set d_getnetprotos getnetent $i_netdb netdb.h
13925 eval $hasproto
13926
13927 : see if getpagesize exists
13928 set getpagesize d_getpagsz
13929 eval $inlibc
13930
13931 : Optional checks for getprotobyname and getprotobynumber
13932
13933 : see if getprotobyname exists
13934 set getprotobyname d_getpbyname
13935 eval $inlibc
13936
13937 : see if getprotobynumber exists
13938 set getprotobynumber d_getpbynumber
13939 eval $inlibc
13940
13941 : see if getprotoent exists
13942 set getprotoent d_getpent
13943 eval $inlibc
13944
13945 : see if getpgid exists
13946 set getpgid d_getpgid
13947 eval $inlibc
13948
13949 : see if getpgrp2 exists
13950 set getpgrp2 d_getpgrp2
13951 eval $inlibc
13952
13953 : see if getppid exists
13954 set getppid d_getppid
13955 eval $inlibc
13956
13957 : see if getpriority exists
13958 set getpriority d_getprior
13959 eval $inlibc
13960
13961 : see if getprotobyname_r exists
13962 set getprotobyname_r d_getprotobyname_r
13963 eval $inlibc
13964 case "$d_getprotobyname_r" in
13965 "$define")
13966         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13967         case "$d_getprotobyname_r_proto:$usethreads" in
13968         ":define")      d_getprotobyname_r_proto=define
13969                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13970                 eval $hasproto ;;
13971         *)      ;;
13972         esac
13973         case "$d_getprotobyname_r_proto" in
13974         define)
13975         case "$getprotobyname_r_proto" in
13976         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13977         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13978         esac
13979         case "$getprotobyname_r_proto" in
13980         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13981         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13982         esac
13983         case "$getprotobyname_r_proto" in
13984         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13985         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13986         esac
13987         case "$getprotobyname_r_proto" in
13988         ''|0)   d_getprotobyname_r=undef
13989                 getprotobyname_r_proto=0
13990                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13991         * )     case "$getprotobyname_r_proto" in
13992                 REENTRANT_PROTO*) ;;
13993                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13994                 esac
13995                 echo "Prototype: $try" ;;
13996         esac
13997         ;;
13998         *)      case "$usethreads" in
13999                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14000                 esac
14001                 d_getprotobyname_r=undef
14002                 getprotobyname_r_proto=0
14003                 ;;
14004         esac
14005         ;;
14006 *)      getprotobyname_r_proto=0
14007         ;;
14008 esac
14009
14010 : see if getprotobynumber_r exists
14011 set getprotobynumber_r d_getprotobynumber_r
14012 eval $inlibc
14013 case "$d_getprotobynumber_r" in
14014 "$define")
14015         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14016         case "$d_getprotobynumber_r_proto:$usethreads" in
14017         ":define")      d_getprotobynumber_r_proto=define
14018                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14019                 eval $hasproto ;;
14020         *)      ;;
14021         esac
14022         case "$d_getprotobynumber_r_proto" in
14023         define)
14024         case "$getprotobynumber_r_proto" in
14025         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14026         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14027         esac
14028         case "$getprotobynumber_r_proto" in
14029         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14030         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14031         esac
14032         case "$getprotobynumber_r_proto" in
14033         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14034         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14035         esac
14036         case "$getprotobynumber_r_proto" in
14037         ''|0)   d_getprotobynumber_r=undef
14038                 getprotobynumber_r_proto=0
14039                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14040         * )     case "$getprotobynumber_r_proto" in
14041                 REENTRANT_PROTO*) ;;
14042                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14043                 esac
14044                 echo "Prototype: $try" ;;
14045         esac
14046         ;;
14047         *)      case "$usethreads" in
14048                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14049                 esac
14050                 d_getprotobynumber_r=undef
14051                 getprotobynumber_r_proto=0
14052                 ;;
14053         esac
14054         ;;
14055 *)      getprotobynumber_r_proto=0
14056         ;;
14057 esac
14058
14059 : see if getprotoent_r exists
14060 set getprotoent_r d_getprotoent_r
14061 eval $inlibc
14062 case "$d_getprotoent_r" in
14063 "$define")
14064         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14065         case "$d_getprotoent_r_proto:$usethreads" in
14066         ":define")      d_getprotoent_r_proto=define
14067                 set d_getprotoent_r_proto getprotoent_r $hdrs
14068                 eval $hasproto ;;
14069         *)      ;;
14070         esac
14071         case "$d_getprotoent_r_proto" in
14072         define)
14073         case "$getprotoent_r_proto" in
14074         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14075         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14076         esac
14077         case "$getprotoent_r_proto" in
14078         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14079         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14080         esac
14081         case "$getprotoent_r_proto" in
14082         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14083         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14084         esac
14085         case "$getprotoent_r_proto" in
14086         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14087         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
14088         esac
14089         case "$getprotoent_r_proto" in
14090         ''|0)   d_getprotoent_r=undef
14091                 getprotoent_r_proto=0
14092                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14093         * )     case "$getprotoent_r_proto" in
14094                 REENTRANT_PROTO*) ;;
14095                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14096                 esac
14097                 echo "Prototype: $try" ;;
14098         esac
14099         ;;
14100         *)      case "$usethreads" in
14101                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14102                 esac
14103                 d_getprotoent_r=undef
14104                 getprotoent_r_proto=0
14105                 ;;
14106         esac
14107         ;;
14108 *)      getprotoent_r_proto=0
14109         ;;
14110 esac
14111
14112 : see if prototypes for various getprotoxxx netdb.h functions are available
14113 echo " "
14114 set d_getprotoprotos getprotoent $i_netdb netdb.h
14115 eval $hasproto
14116
14117 : see if getprpwnam exists
14118 set getprpwnam d_getprpwnam
14119 eval $inlibc
14120
14121 : see if getpwent exists
14122 set getpwent d_getpwent
14123 eval $inlibc
14124
14125 : see if getpwent_r exists
14126 set getpwent_r d_getpwent_r
14127 eval $inlibc
14128 case "$d_getpwent_r" in
14129 "$define")
14130         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14131         case "$d_getpwent_r_proto:$usethreads" in
14132         ":define")      d_getpwent_r_proto=define
14133                 set d_getpwent_r_proto getpwent_r $hdrs
14134                 eval $hasproto ;;
14135         *)      ;;
14136         esac
14137         case "$d_getpwent_r_proto" in
14138         define)
14139         case "$getpwent_r_proto" in
14140         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14141         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14142         esac
14143         case "$getpwent_r_proto" in
14144         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14145         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14146         esac
14147         case "$getpwent_r_proto" in
14148         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14149         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14150         esac
14151         case "$getpwent_r_proto" in
14152         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14153         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14154         esac
14155         case "$getpwent_r_proto" in
14156         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14157         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14158         esac
14159         case "$getpwent_r_proto" in
14160         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14161         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14162         esac
14163         case "$getpwent_r_proto" in
14164         ''|0)   d_getpwent_r=undef
14165                 getpwent_r_proto=0
14166                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14167         * )     case "$getpwent_r_proto" in
14168                 REENTRANT_PROTO*) ;;
14169                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14170                 esac
14171                 echo "Prototype: $try" ;;
14172         esac
14173         ;;
14174         *)      case "$usethreads" in
14175                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14176                 esac
14177                 d_getpwent_r=undef
14178                 getpwent_r_proto=0
14179                 ;;
14180         esac
14181         ;;
14182 *)      getpwent_r_proto=0
14183         ;;
14184 esac
14185
14186 : see if getpwnam_r exists
14187 set getpwnam_r d_getpwnam_r
14188 eval $inlibc
14189 case "$d_getpwnam_r" in
14190 "$define")
14191         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14192         case "$d_getpwnam_r_proto:$usethreads" in
14193         ":define")      d_getpwnam_r_proto=define
14194                 set d_getpwnam_r_proto getpwnam_r $hdrs
14195                 eval $hasproto ;;
14196         *)      ;;
14197         esac
14198         case "$d_getpwnam_r_proto" in
14199         define)
14200         case "$getpwnam_r_proto" in
14201         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14202         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14203         esac
14204         case "$getpwnam_r_proto" in
14205         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14206         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14207         esac
14208         case "$getpwnam_r_proto" in
14209         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14210         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14211         esac
14212         case "$getpwnam_r_proto" in
14213         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14214         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14215         esac
14216         case "$getpwnam_r_proto" in
14217         ''|0)   d_getpwnam_r=undef
14218                 getpwnam_r_proto=0
14219                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14220         * )     case "$getpwnam_r_proto" in
14221                 REENTRANT_PROTO*) ;;
14222                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14223                 esac
14224                 echo "Prototype: $try" ;;
14225         esac
14226         ;;
14227         *)      case "$usethreads" in
14228                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14229                 esac
14230                 d_getpwnam_r=undef
14231                 getpwnam_r_proto=0
14232                 ;;
14233         esac
14234         ;;
14235 *)      getpwnam_r_proto=0
14236         ;;
14237 esac
14238
14239 : see if getpwuid_r exists
14240 set getpwuid_r d_getpwuid_r
14241 eval $inlibc
14242 case "$d_getpwuid_r" in
14243 "$define")
14244         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14245         case "$d_getpwuid_r_proto:$usethreads" in
14246         ":define")      d_getpwuid_r_proto=define
14247                 set d_getpwuid_r_proto getpwuid_r $hdrs
14248                 eval $hasproto ;;
14249         *)      ;;
14250         esac
14251         case "$d_getpwuid_r_proto" in
14252         define)
14253         case "$getpwuid_r_proto" in
14254         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14255         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14256         esac
14257         case "$getpwuid_r_proto" in
14258         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14259         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14260         esac
14261         case "$getpwuid_r_proto" in
14262         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14263         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14264         esac
14265         case "$getpwuid_r_proto" in
14266         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14267         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14268         esac
14269         case "$getpwuid_r_proto" in
14270         ''|0)   d_getpwuid_r=undef
14271                 getpwuid_r_proto=0
14272                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14273         * )     case "$getpwuid_r_proto" in
14274                 REENTRANT_PROTO*) ;;
14275                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14276                 esac
14277                 echo "Prototype: $try" ;;
14278         esac
14279         ;;
14280         *)      case "$usethreads" in
14281                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14282                 esac
14283                 d_getpwuid_r=undef
14284                 getpwuid_r_proto=0
14285                 ;;
14286         esac
14287         ;;
14288 *)      getpwuid_r_proto=0
14289         ;;
14290 esac
14291
14292 : Optional checks for getsbyname and getsbyport
14293
14294 : see if getservbyname exists
14295 set getservbyname d_getsbyname
14296 eval $inlibc
14297
14298 : see if getservbyport exists
14299 set getservbyport d_getsbyport
14300 eval $inlibc
14301
14302 : see if getservent exists
14303 set getservent d_getsent
14304 eval $inlibc
14305
14306 : see if getservbyname_r exists
14307 set getservbyname_r d_getservbyname_r
14308 eval $inlibc
14309 case "$d_getservbyname_r" in
14310 "$define")
14311         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14312         case "$d_getservbyname_r_proto:$usethreads" in
14313         ":define")      d_getservbyname_r_proto=define
14314                 set d_getservbyname_r_proto getservbyname_r $hdrs
14315                 eval $hasproto ;;
14316         *)      ;;
14317         esac
14318         case "$d_getservbyname_r_proto" in
14319         define)
14320         case "$getservbyname_r_proto" in
14321         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14322         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14323         esac
14324         case "$getservbyname_r_proto" in
14325         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14326         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14327         esac
14328         case "$getservbyname_r_proto" in
14329         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14330         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14331         esac
14332         case "$getservbyname_r_proto" in
14333         ''|0)   d_getservbyname_r=undef
14334                 getservbyname_r_proto=0
14335                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14336         * )     case "$getservbyname_r_proto" in
14337                 REENTRANT_PROTO*) ;;
14338                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14339                 esac
14340                 echo "Prototype: $try" ;;
14341         esac
14342         ;;
14343         *)      case "$usethreads" in
14344                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14345                 esac
14346                 d_getservbyname_r=undef
14347                 getservbyname_r_proto=0
14348                 ;;
14349         esac
14350         ;;
14351 *)      getservbyname_r_proto=0
14352         ;;
14353 esac
14354
14355 : see if getservbyport_r exists
14356 set getservbyport_r d_getservbyport_r
14357 eval $inlibc
14358 case "$d_getservbyport_r" in
14359 "$define")
14360         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14361         case "$d_getservbyport_r_proto:$usethreads" in
14362         ":define")      d_getservbyport_r_proto=define
14363                 set d_getservbyport_r_proto getservbyport_r $hdrs
14364                 eval $hasproto ;;
14365         *)      ;;
14366         esac
14367         case "$d_getservbyport_r_proto" in
14368         define)
14369         case "$getservbyport_r_proto" in
14370         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14371         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14372         esac
14373         case "$getservbyport_r_proto" in
14374         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14375         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14376         esac
14377         case "$getservbyport_r_proto" in
14378         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14379         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14380         esac
14381         case "$getservbyport_r_proto" in
14382         ''|0)   d_getservbyport_r=undef
14383                 getservbyport_r_proto=0
14384                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14385         * )     case "$getservbyport_r_proto" in
14386                 REENTRANT_PROTO*) ;;
14387                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14388                 esac
14389                 echo "Prototype: $try" ;;
14390         esac
14391         ;;
14392         *)      case "$usethreads" in
14393                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14394                 esac
14395                 d_getservbyport_r=undef
14396                 getservbyport_r_proto=0
14397                 ;;
14398         esac
14399         ;;
14400 *)      getservbyport_r_proto=0
14401         ;;
14402 esac
14403
14404 : see if getservent_r exists
14405 set getservent_r d_getservent_r
14406 eval $inlibc
14407 case "$d_getservent_r" in
14408 "$define")
14409         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14410         case "$d_getservent_r_proto:$usethreads" in
14411         ":define")      d_getservent_r_proto=define
14412                 set d_getservent_r_proto getservent_r $hdrs
14413                 eval $hasproto ;;
14414         *)      ;;
14415         esac
14416         case "$d_getservent_r_proto" in
14417         define)
14418         case "$getservent_r_proto" in
14419         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14420         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14421         esac
14422         case "$getservent_r_proto" in
14423         ''|0) try='int getservent_r(struct servent*, char*, int);'
14424         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14425         esac
14426         case "$getservent_r_proto" in
14427         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14428         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14429         esac
14430         case "$getservent_r_proto" in
14431         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14432         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14433         esac
14434         case "$getservent_r_proto" in
14435         ''|0)   d_getservent_r=undef
14436                 getservent_r_proto=0
14437                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14438         * )     case "$getservent_r_proto" in
14439                 REENTRANT_PROTO*) ;;
14440                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14441                 esac
14442                 echo "Prototype: $try" ;;
14443         esac
14444         ;;
14445         *)      case "$usethreads" in
14446                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14447                 esac
14448                 d_getservent_r=undef
14449                 getservent_r_proto=0
14450                 ;;
14451         esac
14452         ;;
14453 *)      getservent_r_proto=0
14454         ;;
14455 esac
14456
14457 : see if prototypes for various getservxxx netdb.h functions are available
14458 echo " "
14459 set d_getservprotos getservent $i_netdb netdb.h
14460 eval $hasproto
14461
14462 : see if getspnam exists
14463 set getspnam d_getspnam
14464 eval $inlibc
14465
14466 : see if this is a shadow.h system
14467 set shadow.h i_shadow
14468 eval $inhdr
14469
14470 : see if getspnam_r exists
14471 set getspnam_r d_getspnam_r
14472 eval $inlibc
14473 case "$d_getspnam_r" in
14474 "$define")
14475         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14476         case "$d_getspnam_r_proto:$usethreads" in
14477         ":define")      d_getspnam_r_proto=define
14478                 set d_getspnam_r_proto getspnam_r $hdrs
14479                 eval $hasproto ;;
14480         *)      ;;
14481         esac
14482         case "$d_getspnam_r_proto" in
14483         define)
14484         case "$getspnam_r_proto" in
14485         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14486         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14487         esac
14488         case "$getspnam_r_proto" in
14489         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14490         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14491         esac
14492         case "$getspnam_r_proto" in
14493         ''|0)   d_getspnam_r=undef
14494                 getspnam_r_proto=0
14495                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14496         * )     case "$getspnam_r_proto" in
14497                 REENTRANT_PROTO*) ;;
14498                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14499                 esac
14500                 echo "Prototype: $try" ;;
14501         esac
14502         ;;
14503         *)      case "$usethreads" in
14504                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14505                 esac
14506                 d_getspnam_r=undef
14507                 getspnam_r_proto=0
14508                 ;;
14509         esac
14510         ;;
14511 *)      getspnam_r_proto=0
14512         ;;
14513 esac
14514
14515 : see if gettimeofday or ftime exists
14516 set gettimeofday d_gettimeod
14517 eval $inlibc
14518 case "$d_gettimeod" in
14519 "$undef")
14520         set ftime d_ftime 
14521         eval $inlibc
14522         ;;
14523 *)
14524         val="$undef"; set d_ftime; eval $setvar
14525         ;;
14526 esac
14527 case "$d_gettimeod$d_ftime" in
14528 "$undef$undef")
14529         echo " "
14530         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14531         ;;
14532 esac
14533
14534 : see if gmtime_r exists
14535 set gmtime_r d_gmtime_r
14536 eval $inlibc
14537 case "$d_gmtime_r" in
14538 "$define")
14539         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14540         case "$d_gmtime_r_proto:$usethreads" in
14541         ":define")      d_gmtime_r_proto=define
14542                 set d_gmtime_r_proto gmtime_r $hdrs
14543                 eval $hasproto ;;
14544         *)      ;;
14545         esac
14546         case "$d_gmtime_r_proto" in
14547         define)
14548         case "$gmtime_r_proto" in
14549         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14550         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14551         esac
14552         case "$gmtime_r_proto" in
14553         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14554         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14555         esac
14556         case "$gmtime_r_proto" in
14557         ''|0)   d_gmtime_r=undef
14558                 gmtime_r_proto=0
14559                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14560         * )     case "$gmtime_r_proto" in
14561                 REENTRANT_PROTO*) ;;
14562                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14563                 esac
14564                 echo "Prototype: $try" ;;
14565         esac
14566         ;;
14567         *)      case "$usethreads" in
14568                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14569                 esac
14570                 d_gmtime_r=undef
14571                 gmtime_r_proto=0
14572                 ;;
14573         esac
14574         ;;
14575 *)      gmtime_r_proto=0
14576         ;;
14577 esac
14578
14579 : see if hasmntopt exists
14580 set hasmntopt d_hasmntopt
14581 eval $inlibc
14582
14583 : see if this is a netinet/in.h or sys/in.h system
14584 set netinet/in.h i_niin sys/in.h i_sysin
14585 eval $inhdr
14586
14587 : see if arpa/inet.h has to be included
14588 set arpa/inet.h i_arpainet
14589 eval $inhdr
14590
14591 : see if htonl --and friends-- exists
14592 val=''
14593 set htonl val
14594 eval $inlibc
14595
14596 : Maybe they are macros.
14597 case "$val" in
14598 $undef)
14599         $cat >htonl.c <<EOM
14600 #include <stdio.h>
14601 #include <sys/types.h>
14602 #$i_niin I_NETINET_IN
14603 #$i_sysin I_SYS_IN
14604 #$i_arpainet I_ARPA_INET
14605 #ifdef I_NETINET_IN
14606 #include <netinet/in.h>
14607 #endif
14608 #ifdef I_SYS_IN
14609 #include <sys/in.h>
14610 #endif
14611 #ifdef I_ARPA_INET
14612 #include <arpa/inet.h>
14613 #endif
14614 #ifdef htonl
14615 printf("Defined as a macro.");
14616 #endif
14617 EOM
14618         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14619         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14620                 val="$define"
14621                 echo "But it seems to be defined as a macro." >&4
14622         fi
14623         $rm -f htonl.?
14624         ;;
14625 esac
14626 set d_htonl
14627 eval $setvar
14628
14629 : see if ilogbl exists
14630 set ilogbl d_ilogbl
14631 eval $inlibc
14632
14633 : index or strchr
14634 echo " "
14635 if set index val -f; eval $csym; $val; then
14636         if set strchr val -f d_strchr; eval $csym; $val; then
14637                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14638                         val="$define"
14639                         vali="$undef"
14640                         echo "strchr() found." >&4
14641                 else
14642                         val="$undef"
14643                         vali="$define"
14644                         echo "index() found." >&4
14645                 fi
14646         else
14647                 val="$undef"
14648                 vali="$define"
14649                 echo "index() found." >&4
14650         fi
14651 else
14652         if set strchr val -f d_strchr; eval $csym; $val; then
14653                 val="$define"
14654                 vali="$undef"
14655                 echo "strchr() found." >&4
14656         else
14657                 echo "No index() or strchr() found!" >&4
14658                 val="$undef"
14659                 vali="$undef"
14660         fi
14661 fi
14662 set d_strchr; eval $setvar
14663 val="$vali"
14664 set d_index; eval $setvar
14665
14666 : check whether inet_aton exists
14667 set inet_aton d_inetaton
14668 eval $inlibc
14669
14670 : Look for isascii
14671 echo " "
14672 $cat >isascii.c <<EOCP
14673 #include <stdio.h>
14674 #include <ctype.h>
14675 #$i_stdlib I_STDLIB
14676 #ifdef I_STDLIB
14677 #include <stdlib.h>
14678 #endif
14679 int main() {
14680         int c = 'A';
14681         if (isascii(c))
14682                 exit(0);
14683         else
14684                 exit(1);
14685 }
14686 EOCP
14687 set isascii
14688 if eval $compile; then
14689         echo "isascii() found." >&4
14690         val="$define"
14691 else
14692         echo "isascii() NOT found." >&4
14693         val="$undef"
14694 fi
14695 set d_isascii
14696 eval $setvar
14697 $rm -f isascii*
14698
14699 : see if isfinite exists
14700 set isfinite d_isfinite
14701 eval $inlibc
14702
14703 : see if isinf exists
14704 set isinf d_isinf
14705 eval $inlibc
14706
14707 : see if isnan exists
14708 set isnan d_isnan
14709 eval $inlibc
14710
14711 : see if isnanl exists
14712 set isnanl d_isnanl
14713 eval $inlibc
14714
14715 : see if killpg exists
14716 set killpg d_killpg
14717 eval $inlibc
14718
14719 : see if lchown exists
14720 echo " "
14721 $cat > try.c <<'EOCP'
14722 /* System header to define __stub macros and hopefully few prototypes,
14723     which can conflict with char lchown(); below.  */
14724 #include <assert.h>
14725 /* Override any gcc2 internal prototype to avoid an error.  */
14726 /* We use char because int might match the return type of a gcc2
14727    builtin and then its argument prototype would still apply.  */
14728 char lchown();
14729 int main() {
14730     /*  The GNU C library defines this for functions which it implements
14731         to always fail with ENOSYS.  Some functions are actually named
14732         something starting with __ and the normal name is an alias.  */
14733 #if defined (__stub_lchown) || defined (__stub___lchown)
14734 choke me
14735 #else
14736 lchown();
14737 #endif
14738 ; return 0; }
14739 EOCP
14740 set try
14741 if eval $compile; then
14742     $echo "lchown() found." >&4
14743     val="$define"
14744 else
14745     $echo "lchown() NOT found." >&4
14746     val="$undef"
14747 fi
14748 set d_lchown
14749 eval $setvar
14750
14751 : See if number of significant digits in a double precision number is known
14752 echo " "
14753 $cat >ldbl_dig.c <<EOM
14754 #$i_limits I_LIMITS
14755 #$i_float I_FLOAT
14756 #ifdef I_LIMITS
14757 #include <limits.h>
14758 #endif
14759 #ifdef I_FLOAT
14760 #include <float.h>
14761 #endif
14762 #ifdef LDBL_DIG
14763 printf("Contains LDBL_DIG");
14764 #endif
14765 EOM
14766 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14767 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14768         echo "LDBL_DIG found." >&4
14769         val="$define"
14770 else
14771         echo "LDBL_DIG NOT found." >&4
14772         val="$undef"
14773 fi
14774 $rm -f ldbl_dig.?
14775 set d_ldbl_dig
14776 eval $setvar
14777
14778 : see if this is a math.h system
14779 set math.h i_math
14780 eval $inhdr
14781
14782 : check to see if math.h defines _LIB_VERSION
14783 d_libm_lib_version="$undef"
14784 case $i_math in
14785     $define)
14786         echo " "
14787         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14788         $cat >try.c <<EOCP
14789 #include <unistd.h>
14790 #include <math.h>
14791 int main (int argc, char *argv[])
14792 {
14793     printf ("%d\n", _LIB_VERSION);
14794     return (0);
14795     } /* main */
14796 EOCP
14797         set try
14798         if eval $compile; then
14799             foo=`$run ./try`
14800             echo "Yes, it does ($foo)" >&4
14801             d_libm_lib_version="$define"
14802         else
14803             echo "No, it does not (probably harmless)" >&4
14804             fi
14805         $rm_try
14806         ;;
14807
14808     esac
14809
14810 : see if link exists
14811 set link d_link
14812 eval $inlibc
14813
14814 : see if localtime_r exists
14815 set localtime_r d_localtime_r
14816 eval $inlibc
14817 case "$d_localtime_r" in
14818 "$define")
14819         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14820         case "$d_localtime_r_proto:$usethreads" in
14821         ":define")      d_localtime_r_proto=define
14822                 set d_localtime_r_proto localtime_r $hdrs
14823                 eval $hasproto ;;
14824         *)      ;;
14825         esac
14826         case "$d_localtime_r_proto" in
14827         define)
14828         case "$localtime_r_proto" in
14829         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14830         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14831         esac
14832         case "$localtime_r_proto" in
14833         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14834         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14835         esac
14836         case "$localtime_r_proto" in
14837         ''|0)   d_localtime_r=undef
14838                 localtime_r_proto=0
14839                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14840         * )     case "$localtime_r_proto" in
14841                 REENTRANT_PROTO*) ;;
14842                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14843                 esac
14844                 echo "Prototype: $try" ;;
14845         esac
14846         ;;
14847         *)      case "$usethreads" in
14848                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14849                 esac
14850                 d_localtime_r=undef
14851                 localtime_r_proto=0
14852                 ;;
14853         esac
14854         ;;
14855 *)      localtime_r_proto=0
14856         ;;
14857 esac
14858
14859 : see if localtime_r calls tzset
14860 case "$localtime_r_proto" in
14861 REENTRANT_PROTO*)
14862         $cat >try.c <<EOCP
14863 /*  Does our libc's localtime_r call tzset ?
14864  *  return 0 if so, 1 otherwise.
14865  */
14866 #include <sys/types.h>
14867 #include <unistd.h>
14868 #include <time.h>
14869 #include <string.h>
14870 #include <malloc.h>
14871 int main()
14872 {
14873     time_t t = time(0L);
14874     char w_tz[]="TZ" "=GMT+5",
14875          e_tz[]="TZ" "=GMT-5",
14876         *tz_e = (char*)malloc(16),
14877         *tz_w = (char*)malloc(16);
14878     struct tm tm_e, tm_w;
14879     memset(&tm_e,'\0',sizeof(struct tm));
14880     memset(&tm_w,'\0',sizeof(struct tm));
14881     strcpy(tz_e,e_tz);
14882     strcpy(tz_w,w_tz);
14883
14884     putenv(tz_e);
14885     localtime_r(&t, &tm_e);
14886
14887     putenv(tz_w);
14888     localtime_r(&t, &tm_w);
14889
14890     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14891         return 1;
14892     return 0;
14893 }
14894 EOCP
14895         set try
14896         if eval $compile; then
14897             if $run ./try; then
14898                 d_localtime_r_needs_tzset=undef;
14899             else
14900                 d_localtime_r_needs_tzset=define;
14901             fi;
14902         else
14903             d_localtime_r_needs_tzset=undef;
14904         fi;
14905      ;;
14906   *)
14907      d_localtime_r_needs_tzset=undef;
14908      ;;
14909 esac
14910 $rm_try
14911
14912 : see if localeconv exists
14913 set localeconv d_locconv
14914 eval $inlibc
14915
14916 : see if lockf exists
14917 set lockf d_lockf
14918 eval $inlibc
14919
14920 : see if prototype for lseek is available
14921 echo " "
14922 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14923 eval $hasproto
14924
14925 : see if lstat exists
14926 set lstat d_lstat
14927 eval $inlibc
14928
14929 : see if madvise exists
14930 set madvise d_madvise
14931 eval $inlibc
14932
14933 : see if malloc_size exists
14934 set malloc_size d_malloc_size
14935 eval $inlibc
14936
14937 : see if malloc_size_good exists
14938 set malloc_good_size d_malloc_good_size
14939 eval $inlibc
14940
14941 : see if mblen exists
14942 set mblen d_mblen
14943 eval $inlibc
14944
14945 : see if mbstowcs exists
14946 set mbstowcs d_mbstowcs
14947 eval $inlibc
14948
14949 : see if mbtowc exists
14950 set mbtowc d_mbtowc
14951 eval $inlibc
14952
14953 : see if memchr exists
14954 set memchr d_memchr
14955 eval $inlibc
14956
14957 : see if memcmp exists
14958 set memcmp d_memcmp
14959 eval $inlibc
14960
14961 : see if memcpy exists
14962 set memcpy d_memcpy
14963 eval $inlibc
14964
14965 : see if memmove exists
14966 set memmove d_memmove
14967 eval $inlibc
14968
14969 : see if memset exists
14970 set memset d_memset
14971 eval $inlibc
14972
14973 : see if mkdir exists
14974 set mkdir d_mkdir
14975 eval $inlibc
14976
14977 : see if mkdtemp exists
14978 set mkdtemp d_mkdtemp
14979 eval $inlibc
14980
14981 : see if mkfifo exists
14982 set mkfifo d_mkfifo
14983 eval $inlibc
14984
14985 : see if mkstemp exists
14986 set mkstemp d_mkstemp
14987 eval $inlibc
14988
14989 : see if mkstemps exists
14990 set mkstemps d_mkstemps
14991 eval $inlibc
14992
14993 : see if mktime exists
14994 set mktime d_mktime
14995 eval $inlibc
14996
14997 : see if this is a sys/mman.h system
14998 set sys/mman.h i_sysmman
14999 eval $inhdr
15000
15001 : see if mmap exists
15002 set mmap d_mmap
15003 eval $inlibc
15004 : see what shmat returns
15005 : default to something harmless
15006 mmaptype='void *'
15007 case "$i_sysmman$d_mmap" in
15008 "$define$define")
15009         $cat >mmap.c <<'END'
15010 #include <sys/mman.h>
15011 void *mmap();
15012 END
15013         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15014                 mmaptype='void *'
15015         else
15016                 mmaptype='caddr_t'
15017         fi
15018         echo "and it returns ($mmaptype)." >&4
15019         ;;
15020 esac
15021
15022
15023
15024 : see if sqrtl exists
15025 set sqrtl d_sqrtl
15026 eval $inlibc
15027
15028 : see if scalbnl exists
15029 set scalbnl d_scalbnl
15030 eval $inlibc
15031
15032 : see if modfl exists
15033 set modfl d_modfl
15034 eval $inlibc
15035
15036 : see if prototype for modfl is available
15037 echo " "
15038 set d_modflproto modfl $i_math math.h
15039 eval $hasproto
15040
15041 d_modfl_pow32_bug="$undef"
15042
15043 case "$d_longdbl$d_modfl" in
15044 $define$define)
15045         $cat <<EOM
15046 Checking to see whether your modfl() is okay for large values...
15047 EOM
15048 $cat >try.c <<EOCP
15049 #include <math.h>
15050 #include <stdio.h>
15051 EOCP
15052 if $test "X$d_modflproto" != "X$define"; then
15053         $cat >>try.c <<EOCP
15054 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15055 long double modfl (long double, long double *);
15056 EOCP
15057 fi
15058 $cat >>try.c <<EOCP
15059 int main() {
15060     long double nv = 4294967303.15;
15061     long double v, w;
15062     v = modfl(nv, &w);
15063 #ifdef __GLIBC__
15064     printf("glibc");
15065 #endif
15066     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15067     return 0;
15068 }
15069 EOCP
15070         case "$osname:$gccversion" in
15071         aix:)   saveccflags="$ccflags"
15072                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15073         esac
15074         set try
15075         if eval $compile; then
15076                 foo=`$run ./try`
15077                 case "$foo" in
15078                 *" 4294967303.150000 1.150000 4294967302.000000")
15079                         echo >&4 "Your modfl() is broken for large values."
15080                         d_modfl_pow32_bug="$define"
15081                         case "$foo" in
15082                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15083                         ;;
15084                         esac
15085                         ;;
15086                 *" 4294967303.150000 0.150000 4294967303.000000")
15087                         echo >&4 "Your modfl() seems okay for large values."
15088                         ;;
15089                 *)      echo >&4 "I don't understand your modfl() at all."
15090                         d_modfl="$undef"
15091                         ;;
15092                 esac
15093                 $rm_try
15094         else
15095                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15096                 d_modfl="$undef"
15097         fi
15098         case "$osname:$gccversion" in
15099         aix:)   ccflags="$saveccflags" ;; # restore
15100         esac
15101         ;;
15102 esac
15103
15104 if $test "$uselongdouble" = "$define"; then
15105     message=""
15106     if $test "$d_sqrtl" != "$define"; then
15107         message="$message sqrtl"
15108     fi
15109     if $test "$d_modfl" != "$define"; then
15110         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15111             echo "You have both aintl and copysignl, so I can emulate modfl."
15112         else
15113             message="$message modfl"
15114         fi
15115     fi
15116     if $test "$d_frexpl" != "$define"; then
15117         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15118             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15119         else
15120             message="$message frexpl"
15121         fi
15122     fi
15123
15124     if $test "$message" != ""; then
15125         $cat <<EOM >&4
15126
15127 *** You requested the use of long doubles but you do not seem to have
15128 *** the following mathematical functions needed for long double support:
15129 ***    $message
15130 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15131 *** Cannot continue, aborting.
15132
15133 EOM
15134
15135         exit 1
15136     fi
15137 fi
15138
15139 : see if mprotect exists
15140 set mprotect d_mprotect
15141 eval $inlibc
15142
15143 : see if msgctl exists
15144 set msgctl d_msgctl
15145 eval $inlibc
15146
15147 : see if msgget exists
15148 set msgget d_msgget
15149 eval $inlibc
15150
15151 : see if msgsnd exists
15152 set msgsnd d_msgsnd
15153 eval $inlibc
15154
15155 : see if msgrcv exists
15156 set msgrcv d_msgrcv
15157 eval $inlibc
15158
15159 : see how much of the 'msg*(2)' library is present.
15160 h_msg=true
15161 echo " "
15162 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15163 *"$undef"*) h_msg=false;;
15164 esac
15165 case "$osname" in
15166 freebsd)
15167     case "`ipcs 2>&1`" in
15168     "SVID messages"*"not configured"*)
15169         echo "Your $osname does not have the msg*(2) configured." >&4
15170         h_msg=false
15171         val="$undef"
15172         set msgctl d_msgctl
15173         eval $setvar
15174         set msgget d_msgget
15175         eval $setvar
15176         set msgsnd d_msgsnd
15177         eval $setvar
15178         set msgrcv d_msgrcv
15179         eval $setvar
15180         ;;
15181     esac
15182     ;;
15183 esac
15184 : we could also check for sys/ipc.h ...
15185 if $h_msg && $test `./findhdr sys/msg.h`; then
15186         echo "You have the full msg*(2) library." >&4
15187         val="$define"
15188 else
15189         echo "You don't have the full msg*(2) library." >&4
15190         val="$undef"
15191 fi
15192 set d_msg
15193 eval $setvar
15194
15195 : Check for msghdr_s
15196 echo " "
15197 echo "Checking to see if your system supports struct msghdr..." >&4
15198 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15199 eval $hasstruct
15200 case "$d_msghdr_s" in
15201 "$define")      echo "Yes, it does."   ;;
15202 *)              echo "No, it doesn't." ;;
15203 esac
15204
15205
15206 : see if msync exists
15207 set msync d_msync
15208 eval $inlibc
15209
15210 : see if munmap exists
15211 set munmap d_munmap
15212 eval $inlibc
15213
15214 : see if nice exists
15215 set nice d_nice
15216 eval $inlibc
15217
15218 : see if this is a langinfo.h system
15219 set langinfo.h i_langinfo
15220 eval $inhdr
15221
15222 : see if nl_langinfo exists
15223 set nl_langinfo d_nl_langinfo
15224 eval $inlibc
15225
15226 : check for volatile keyword
15227 echo " "
15228 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15229 $cat >try.c <<'EOCP'
15230 int main()
15231 {
15232         typedef struct _goo_struct goo_struct;
15233         goo_struct * volatile goo = ((goo_struct *)0);
15234         struct _goo_struct {
15235                 long long_int;
15236                 int reg_int;
15237                 char char_var;
15238         };
15239         typedef unsigned short foo_t;
15240         char *volatile foo;
15241         volatile int bar;
15242         volatile foo_t blech;
15243         foo = foo;
15244 }
15245 EOCP
15246 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15247         val="$define"
15248         echo "Yup, it does."
15249 else
15250         val="$undef"
15251         echo "Nope, it doesn't."
15252 fi
15253 set d_volatile
15254 eval $setvar
15255 $rm_try
15256
15257 : Check basic sizes
15258 echo " "
15259 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15260
15261 case "$use64bitint:$d_quad:$quadtype" in
15262 define:define:?*)
15263         ivtype="$quadtype"
15264         uvtype="$uquadtype"
15265         ivsize=8
15266         uvsize=8
15267         ;;
15268 *)      ivtype="long"
15269         uvtype="unsigned long"
15270         ivsize=$longsize
15271         uvsize=$longsize
15272         ;;
15273 esac
15274
15275 case "$uselongdouble:$d_longdbl" in
15276 define:define)
15277         nvtype="long double"
15278         nvsize=$longdblsize
15279         ;;
15280 *)      nvtype=double
15281         nvsize=$doublesize
15282         ;;
15283 esac
15284
15285 $echo "(IV will be "$ivtype", $ivsize bytes)"
15286 $echo "(UV will be "$uvtype", $uvsize bytes)"
15287 $echo "(NV will be "$nvtype", $nvsize bytes)"
15288
15289 $cat >try.c <<EOCP
15290 #$i_inttypes I_INTTYPES
15291 #ifdef I_INTTYPES
15292 #include <inttypes.h>
15293 #endif
15294 #include <stdio.h>
15295 int main() {
15296 #ifdef INT8
15297    int8_t i =  INT8_MAX;
15298   uint8_t u = UINT8_MAX;
15299   printf("int8_t\n");
15300 #endif
15301 #ifdef INT16
15302    int16_t i =  INT16_MAX;
15303   uint16_t i = UINT16_MAX;
15304   printf("int16_t\n");
15305 #endif
15306 #ifdef INT32
15307    int32_t i =  INT32_MAX;
15308   uint32_t u = UINT32_MAX;
15309   printf("int32_t\n");
15310 #endif
15311 }
15312 EOCP
15313
15314 i8type="signed char"
15315 u8type="unsigned char"
15316 i8size=1
15317 u8size=1
15318
15319 case "$i16type" in
15320 '')     case "$shortsize" in
15321         2)      i16type=short
15322                 u16type="unsigned short"
15323                 i16size=$shortsize
15324                 u16size=$shortsize
15325                 ;;
15326         esac
15327         ;;
15328 esac
15329 case "$i16type" in
15330 '')     set try -DINT16
15331         if eval $compile; then
15332                 case "`$run ./try`" in
15333                 int16_t)
15334                         i16type=int16_t
15335                         u16type=uint16_t
15336                         i16size=2
15337                         u16size=2
15338                         ;;
15339                 esac
15340         fi
15341         ;;
15342 esac
15343 case "$i16type" in
15344 '')     if $test $shortsize -ge 2; then
15345                 i16type=short
15346                 u16type="unsigned short"
15347                 i16size=$shortsize
15348                 u16size=$shortsize
15349         fi
15350         ;;
15351 esac
15352
15353 case "$i32type" in
15354 '')     case "$longsize" in
15355         4)      i32type=long
15356                 u32type="unsigned long"
15357                 i32size=$longsize
15358                 u32size=$longsize
15359                 ;;
15360         *)      case "$intsize" in
15361                 4)      i32type=int
15362                         u32type="unsigned int"
15363                         i32size=$intsize
15364                         u32size=$intsize
15365                         ;;
15366                 esac
15367                 ;;
15368         esac
15369         ;;
15370 esac
15371 case "$i32type" in
15372 '')     set try -DINT32
15373         if eval $compile; then
15374                 case "`$run ./try`" in
15375                 int32_t)
15376                         i32type=int32_t
15377                         u32type=uint32_t
15378                         i32size=4
15379                         u32size=4
15380                         ;;
15381                 esac
15382         fi
15383         ;;
15384 esac
15385 case "$i32type" in
15386 '')     if $test $intsize -ge 4; then
15387                 i32type=int
15388                 u32type="unsigned int"
15389                 i32size=$intsize
15390                 u32size=$intsize
15391         fi
15392         ;;
15393 esac
15394
15395 case "$i64type" in
15396 '')     case "$d_quad:$quadtype" in
15397         define:?*)
15398                 i64type="$quadtype"
15399                 u64type="$uquadtype"
15400                 i64size=8
15401                 u64size=8
15402                 ;;
15403         esac
15404         ;;
15405 esac
15406
15407 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15408 : volatile so that the compiler has to store it out to memory.
15409 if test X"$d_volatile" = X"$define"; then
15410         volatile=volatile
15411 fi
15412 $cat <<EOP >try.c
15413 #include <stdio.h>
15414 #$i_stdlib I_STDLIB
15415 #ifdef I_STDLIB
15416 #include <stdlib.h>
15417 #endif
15418 #include <sys/types.h>
15419 #include <signal.h>
15420 #ifdef SIGFPE
15421 $volatile int bletched = 0;
15422 $signal_t blech(int s) { bletched = 1; }
15423 #endif
15424 int main() {
15425     $uvtype u = 0;
15426     $nvtype d;
15427     int     n = 8 * $uvsize;
15428     int     i;
15429 #ifdef SIGFPE
15430     signal(SIGFPE, blech);
15431 #endif
15432
15433     for (i = 0; i < n; i++) {
15434       u = u << 1 | ($uvtype)1;
15435       d = ($nvtype)u;
15436       if (($uvtype)d != u)
15437         break;
15438       if (d <= 0)
15439         break;
15440       d = ($nvtype)(u - 1);
15441       if (($uvtype)d != (u - 1))
15442         break;
15443 #ifdef SIGFPE
15444       if (bletched)
15445         break;
15446 #endif
15447     }
15448     printf("%d\n", ((i == n) ? -n : i));
15449     exit(0);
15450 }
15451 EOP
15452 set try
15453
15454 d_nv_preserves_uv="$undef"
15455 if eval $compile; then
15456         nv_preserves_uv_bits="`$run ./try`"
15457 fi
15458 case "$nv_preserves_uv_bits" in
15459 \-[1-9]*)
15460         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15461         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15462         d_nv_preserves_uv="$define"
15463         ;;
15464 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15465         d_nv_preserves_uv="$undef" ;;
15466 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15467         nv_preserves_uv_bits="0" ;;
15468 esac
15469 $rm_try
15470
15471 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15472 : volatile so that the compiler has to store it out to memory.
15473 if test X"$d_volatile" = X"$define"; then
15474         volatile=volatile
15475 fi
15476 $cat <<EOP >try.c
15477 #include <stdio.h>
15478 #$i_stdlib I_STDLIB
15479 #ifdef I_STDLIB
15480 #include <stdlib.h>
15481 #endif
15482 #$i_string I_STRING
15483 #ifdef I_STRING
15484 #  include <string.h>
15485 #else
15486 #  include <strings.h>
15487 #endif
15488 #include <sys/types.h>
15489 #include <signal.h>
15490 #ifdef SIGFPE
15491 $volatile int bletched = 0;
15492 $signal_t blech(int s) { bletched = 1; }
15493 #endif
15494
15495 int checkit($nvtype d, char *where) {
15496     unsigned char *p = (char *)&d;
15497     unsigned char *end = p + sizeof(d);
15498     int fail = 0;
15499
15500     while (p < end)
15501         fail += *p++;
15502
15503     if (!fail)
15504         return 0;
15505
15506     p = (char *)&d;
15507     printf("No - %s: 0x", where);
15508     while (p < end)
15509         printf ("%02X", *p++);
15510     printf("\n");
15511     return 1;
15512 }
15513
15514 int main(int argc, char **argv) {
15515     $nvtype d = 0.0;
15516     int fail = 0;
15517     fail += checkit(d, "0.0");
15518
15519     /* The compiler shouldn't be assuming that bletched is 0  */
15520     d = bletched;
15521
15522     fail += checkit(d, "bleched");
15523
15524 #ifdef SIGFPE
15525     signal(SIGFPE, blech);
15526 #endif
15527
15528     /* Paranoia - the compiler should have no way of knowing that ANSI says
15529        that argv[argc] will always be NULL.  Actually, if it did assume this it
15530        would be buggy, as this is C and main() can be called from elsewhere in
15531        the program.  */
15532     d = argv[argc] ? 1 : 0;
15533
15534     if (d) {
15535         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15536     }
15537
15538     fail += checkit(d, "ternary");
15539
15540     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15541
15542     if (d != 0.0) {
15543         printf("No - memset doesn't give 0.0\n");
15544         /* This might just blow up:  */
15545         printf("(gives %g)\n", d);
15546         return 1;
15547     }
15548
15549 #ifdef SIGFPE
15550     if (bletched) {
15551         printf("No - something bleched\n");
15552         return 1;
15553     }
15554 #endif
15555     if (fail) {
15556       printf("No - %d fail(s)\n", fail);
15557       return 1;
15558     }
15559     printf("Yes\n");
15560     return 0;
15561 }
15562 EOP
15563 set try
15564
15565 d_nv_zero_is_allbits_zero="$undef"
15566 if eval $compile; then
15567     xxx="`$run ./try`"
15568     case "$?" in
15569         0)
15570             case "$xxx" in
15571                 Yes)  cat >&4 <<EOM
15572 0.0 is represented as all bits zero in memory
15573 EOM
15574                     d_nv_zero_is_allbits_zero="$define"
15575                     ;;
15576                 *)  cat >&4 <<EOM
15577 0.0 is not represented as all bits zero in memory
15578 EOM
15579                     d_nv_zero_is_allbits_zero="$undef"
15580                     ;;
15581             esac
15582             ;;
15583         *)  cat >&4 <<EOM
15584 0.0 is not represented as all bits zero in memory
15585 EOM
15586             d_nv_zero_is_allbits_zero="$undef"
15587             ;;
15588     esac
15589 fi
15590 $rm_try
15591
15592 : check for off64_t
15593 echo " "
15594 echo "Checking to see if you have off64_t..." >&4
15595 $cat >try.c <<EOCP
15596 #include <sys/types.h>
15597 #include <unistd.h>
15598 int main() { off64_t x = 7; }
15599 EOCP
15600 set try
15601 if eval $compile; then
15602         val="$define"
15603         echo "You have off64_t."
15604 else
15605         val="$undef"
15606         echo "You do not have off64_t."
15607         case "$lseeksize" in
15608         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15609         esac
15610 fi
15611 $rm_try
15612 set d_off64_t
15613 eval $setvar
15614
15615 : how to create joinable pthreads
15616 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15617         echo " "
15618         echo "Checking what constant to use for creating joinable pthreads..." >&4
15619         $cat >try.c <<'EOCP'
15620 #include <pthread.h>
15621 int main() {
15622     int detachstate = JOINABLE;
15623 }
15624 EOCP
15625         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15626         if eval $compile; then
15627                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15628                 val="$undef" # Yes, undef.
15629                 set d_old_pthread_create_joinable
15630                 eval $setvar
15631                 val=""
15632                 set old_pthread_create_joinable
15633                 eval $setvar
15634         else
15635                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15636                 if eval $compile; then
15637                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15638                         val="$define"
15639                         set d_old_pthread_create_joinable
15640                         eval $setvar
15641                         val=PTHREAD_CREATE_UNDETACHED
15642                         set old_pthread_create_joinable
15643                         eval $setvar
15644                 else
15645                         set try -DJOINABLE=__UNDETACHED
15646                         if eval $compile; then
15647                                 echo "You seem to use __UNDETACHED." >&4
15648                                 val="$define"
15649                                 set d_old_pthread_create_joinable
15650                                 eval $setvar
15651                                 val=__UNDETACHED
15652                                 set old_pthread_create_joinable
15653                                 eval $setvar
15654                         else
15655                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15656                                 val="$define"
15657                                 set d_old_pthread_create_joinable
15658                                 eval $setvar
15659                                 val=0
15660                                 set old_pthread_create_joinable
15661                                 eval $setvar
15662                         fi
15663                 fi
15664         fi
15665         $rm_try
15666 else
15667     d_old_pthread_create_joinable="$undef"
15668     old_pthread_create_joinable=""
15669 fi
15670
15671 : see if pause exists
15672 set pause d_pause
15673 eval $inlibc
15674
15675 : see if poll exists
15676 set poll d_poll
15677 eval $inlibc
15678
15679 : see if readlink exists
15680 set readlink d_readlink
15681 eval $inlibc
15682
15683 : Check if exe is symlink to abs path of executing program
15684 echo " "
15685 procselfexe=''
15686 val="$undef"
15687 case "$d_readlink" in
15688 "$define")
15689         if $issymlink /proc/self/exe ; then
15690                 $ls -l /proc/self/exe > reflect
15691                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15692                         echo "You have Linux-like /proc/self/exe."
15693                         procselfexe='"/proc/self/exe"'
15694                         val="$define"
15695                 fi
15696         fi
15697         if $issymlink /proc/curproc/file ; then
15698                 $ls -l /proc/curproc/file > reflect
15699                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15700                         echo "You have BSD-like /proc/curproc/file."
15701                         procselfexe='"/proc/curproc/file"'
15702                         val="$define"
15703                 fi
15704         fi
15705         ;;
15706 esac
15707 $rm -f reflect
15708 set d_procselfexe
15709 eval $setvar
15710
15711 : backward compatibility for d_hvfork
15712 if test X$d_hvfork != X; then
15713         d_vfork="$d_hvfork"
15714         d_hvfork=''
15715 fi
15716 : see if there is a vfork
15717 val=''
15718 set vfork val
15719 eval $inlibc
15720
15721 d_pseudofork=$undef
15722
15723 : Ok, but do we want to use it. vfork is reportedly unreliable in
15724 : perl on Solaris 2.x, and probably elsewhere.
15725 case "$val" in
15726 $define)
15727         echo " "
15728         case "$usevfork" in
15729         false) dflt='n';;
15730         *) dflt='y';;
15731         esac
15732         cat <<'EOM'
15733
15734 Perl can only use a vfork() that doesn't suffer from strict
15735 restrictions on calling functions or modifying global data in
15736 the child.  For example, glibc-2.1 contains such a vfork()
15737 that is unsuitable.  If your system provides a proper fork()
15738 call, chances are that you do NOT want perl to use vfork().
15739
15740 EOM
15741         rp="Do you still want to use vfork()?"
15742         . ./myread
15743         case "$ans" in
15744         y|Y) ;;
15745         *)
15746                 echo "Ok, we won't use vfork()."
15747                 val="$undef"
15748                 ;;
15749         esac
15750         ;;
15751 esac
15752 set d_vfork
15753 eval $setvar
15754 case "$d_vfork" in
15755 $define) usevfork='true';;
15756 *) usevfork='false';;
15757 esac
15758
15759 : see whether the pthread_atfork exists
15760 $cat >try.c <<EOP
15761 #include <pthread.h>
15762 #include <stdio.h>
15763 int main() {
15764 #ifdef  PTHREAD_ATFORK
15765         pthread_atfork(NULL,NULL,NULL);
15766 #endif
15767 }
15768 EOP
15769
15770 : see if pthread_atfork exists
15771 set try -DPTHREAD_ATFORK
15772 if eval $compile; then
15773     val="$define"
15774 else
15775     val="$undef"
15776 fi
15777 case "$usethreads" in
15778 $define)
15779         case "$val" in
15780         $define) echo 'pthread_atfork found.' >&4        ;;
15781         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15782         esac
15783 esac
15784 set d_pthread_atfork
15785 eval $setvar
15786
15787 : see if pthread_attr_setscope exists
15788 set pthread_attr_setscope d_pthread_attr_setscope
15789 eval $inlibc
15790
15791 : see whether the various POSIXish _yields exist
15792 $cat >try.c <<EOP
15793 #include <pthread.h>
15794 #include <stdio.h>
15795 int main() {
15796 #ifdef SCHED_YIELD
15797         sched_yield();
15798 #else
15799 #ifdef PTHREAD_YIELD
15800         pthread_yield();
15801 #else
15802 #ifdef PTHREAD_YIELD_NULL
15803         pthread_yield(NULL);
15804 #endif
15805 #endif
15806 #endif
15807 }
15808 EOP
15809 : see if sched_yield exists
15810 set try -DSCHED_YIELD
15811 if eval $compile; then
15812     val="$define"
15813     sched_yield='sched_yield()'
15814 else
15815     val="$undef"
15816 fi
15817 case "$usethreads" in
15818 $define)
15819         case "$val" in
15820         $define) echo 'sched_yield() found.' >&4        ;;
15821         *)       echo 'sched_yield() NOT found.' >&4    ;;
15822         esac
15823 esac
15824 set d_sched_yield
15825 eval $setvar
15826
15827 : see if pthread_yield exists
15828 set try -DPTHREAD_YIELD
15829 if eval $compile; then
15830     val="$define"
15831     case "$sched_yield" in
15832     '') sched_yield='pthread_yield()' ;;
15833     esac
15834 else
15835     set try -DPTHREAD_YIELD_NULL
15836     if eval $compile; then
15837         val="$define"
15838         case "$sched_yield" in
15839         '') sched_yield='pthread_yield(NULL)' ;;
15840         esac
15841     else
15842         val="$undef"
15843     fi
15844 fi
15845 case "$usethreads" in
15846 $define)
15847         case "$val" in
15848         $define) echo 'pthread_yield() found.' >&4      ;;
15849         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15850         esac
15851         ;;
15852 esac
15853 set d_pthread_yield
15854 eval $setvar
15855 case "$sched_yield" in
15856 '') sched_yield=undef ;;
15857 esac
15858 $rm_try
15859
15860 : see if random_r exists
15861 set random_r d_random_r
15862 eval $inlibc
15863 case "$d_random_r" in
15864 "$define")
15865         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15866         case "$d_random_r_proto:$usethreads" in
15867         ":define")      d_random_r_proto=define
15868                 set d_random_r_proto random_r $hdrs
15869                 eval $hasproto ;;
15870         *)      ;;
15871         esac
15872         case "$d_random_r_proto" in
15873         define)
15874         case "$random_r_proto" in
15875         ''|0) try='int random_r(int*, struct random_data*);'
15876         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15877         esac
15878         case "$random_r_proto" in
15879         ''|0) try='int random_r(long*, struct random_data*);'
15880         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15881         esac
15882         case "$random_r_proto" in
15883         ''|0) try='int random_r(struct random_data*, int32_t*);'
15884         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15885         esac
15886         case "$random_r_proto" in
15887         ''|0)   d_random_r=undef
15888                 random_r_proto=0
15889                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15890         * )     case "$random_r_proto" in
15891                 REENTRANT_PROTO*) ;;
15892                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15893                 esac
15894                 echo "Prototype: $try" ;;
15895         esac
15896         ;;
15897         *)      case "$usethreads" in
15898                 define) echo "random_r has no prototype, not using it." >&4 ;;
15899                 esac
15900                 d_random_r=undef
15901                 random_r_proto=0
15902                 ;;
15903         esac
15904         ;;
15905 *)      random_r_proto=0
15906         ;;
15907 esac
15908
15909 : see if readdir and friends exist
15910 set readdir d_readdir
15911 eval $inlibc
15912 set seekdir d_seekdir
15913 eval $inlibc
15914 set telldir d_telldir
15915 eval $inlibc
15916 set rewinddir d_rewinddir
15917 eval $inlibc
15918
15919 : see if readdir64_r exists
15920 set readdir64_r d_readdir64_r
15921 eval $inlibc
15922 case "$d_readdir64_r" in
15923 "$define")
15924         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15925         case "$d_readdir64_r_proto:$usethreads" in
15926         ":define")      d_readdir64_r_proto=define
15927                 set d_readdir64_r_proto readdir64_r $hdrs
15928                 eval $hasproto ;;
15929         *)      ;;
15930         esac
15931         case "$d_readdir64_r_proto" in
15932         define)
15933         case "$readdir64_r_proto" in
15934         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15935         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15936         esac
15937         case "$readdir64_r_proto" in
15938         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15939         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15940         esac
15941         case "$readdir64_r_proto" in
15942         ''|0)   d_readdir64_r=undef
15943                 readdir64_r_proto=0
15944                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15945         * )     case "$readdir64_r_proto" in
15946                 REENTRANT_PROTO*) ;;
15947                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15948                 esac
15949                 echo "Prototype: $try" ;;
15950         esac
15951         ;;
15952         *)      case "$usethreads" in
15953                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15954                 esac
15955                 d_readdir64_r=undef
15956                 readdir64_r_proto=0
15957                 ;;
15958         esac
15959         ;;
15960 *)      readdir64_r_proto=0
15961         ;;
15962 esac
15963
15964 : see if readdir_r exists
15965 set readdir_r d_readdir_r
15966 eval $inlibc
15967 case "$d_readdir_r" in
15968 "$define")
15969         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15970         case "$d_readdir_r_proto:$usethreads" in
15971         ":define")      d_readdir_r_proto=define
15972                 set d_readdir_r_proto readdir_r $hdrs
15973                 eval $hasproto ;;
15974         *)      ;;
15975         esac
15976         case "$d_readdir_r_proto" in
15977         define)
15978         case "$readdir_r_proto" in
15979         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15980         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15981         esac
15982         case "$readdir_r_proto" in
15983         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15984         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15985         esac
15986         case "$readdir_r_proto" in
15987         ''|0)   d_readdir_r=undef
15988                 readdir_r_proto=0
15989                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15990         * )     case "$readdir_r_proto" in
15991                 REENTRANT_PROTO*) ;;
15992                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15993                 esac
15994                 echo "Prototype: $try" ;;
15995         esac
15996         ;;
15997         *)      case "$usethreads" in
15998                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15999                 esac
16000                 d_readdir_r=undef
16001                 readdir_r_proto=0
16002                 ;;
16003         esac
16004         ;;
16005 *)      readdir_r_proto=0
16006         ;;
16007 esac
16008
16009 : see if readv exists
16010 set readv d_readv
16011 eval $inlibc
16012
16013 : see if recvmsg exists
16014 set recvmsg d_recvmsg
16015 eval $inlibc
16016
16017 : see if rename exists
16018 set rename d_rename
16019 eval $inlibc
16020
16021 : see if rmdir exists
16022 set rmdir d_rmdir
16023 eval $inlibc
16024
16025 : see if memory.h is available.
16026 val=''
16027 set memory.h val
16028 eval $inhdr
16029
16030 : See if it conflicts with string.h
16031 case "$val" in
16032 $define)
16033         case "$strings" in
16034         '') ;;
16035         *)
16036                 $cppstdin $cppflags $cppminus < $strings > mem.h
16037                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16038                         echo " "
16039                         echo "We won't be including <memory.h>."
16040                         val="$undef"
16041                 fi
16042                 $rm -f mem.h
16043                 ;;
16044         esac
16045 esac
16046 set i_memory
16047 eval $setvar
16048
16049 : can bcopy handle overlapping blocks?
16050 echo " "
16051 val="$undef"
16052 case "$d_memmove" in
16053 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16054 *)      case "$d_bcopy" in
16055         "$define")
16056                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16057                 $cat >try.c <<EOCP
16058 #$i_memory I_MEMORY
16059 #$i_stdlib I_STDLIB
16060 #$i_string I_STRING
16061 #$i_unistd I_UNISTD
16062 EOCP
16063         $cat >>try.c <<'EOCP'
16064 #include <stdio.h>
16065 #ifdef I_MEMORY
16066 #  include <memory.h>
16067 #endif
16068 #ifdef I_STDLIB
16069 #  include <stdlib.h>
16070 #endif
16071 #ifdef I_STRING
16072 #  include <string.h>
16073 #else
16074 #  include <strings.h>
16075 #endif
16076 #ifdef I_UNISTD
16077 #  include <unistd.h>  /* Needed for NetBSD */
16078 #endif
16079 int main()
16080 {
16081 char buf[128], abc[128];
16082 char *b;
16083 int len;
16084 int off;
16085 int align;
16086
16087 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16088    try to store the string in read-only memory. */
16089 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16090
16091 for (align = 7; align >= 0; align--) {
16092         for (len = 36; len; len--) {
16093                 b = buf+align;
16094                 bcopy(abc, b, len);
16095                 for (off = 1; off <= len; off++) {
16096                         bcopy(b, b+off, len);
16097                         bcopy(b+off, b, len);
16098                         if (bcmp(b, abc, len))
16099                                 exit(1);
16100                 }
16101         }
16102 }
16103 exit(0);
16104 }
16105 EOCP
16106                 set try
16107                 if eval $compile_ok; then
16108                         if $run ./try 2>/dev/null; then
16109                                 echo "Yes, it can."
16110                                 val="$define"
16111                         else
16112                                 echo "It can't, sorry."
16113                         fi
16114                 else
16115                         echo "(I can't compile the test program, so we'll assume not...)"
16116                 fi
16117                 ;;
16118         esac
16119         $rm_try
16120         ;;
16121 esac
16122 set d_safebcpy
16123 eval $setvar
16124
16125 : can memcpy handle overlapping blocks?
16126 echo " "
16127 val="$undef"
16128 case "$d_memmove" in
16129 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16130 *)      case "$d_memcpy" in
16131         "$define")
16132                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16133                 $cat >try.c <<EOCP
16134 #$i_memory I_MEMORY
16135 #$i_stdlib I_STDLIB
16136 #$i_string I_STRING
16137 #$i_unistd I_UNISTD
16138 EOCP
16139         $cat >>try.c <<'EOCP'
16140 #include <stdio.h>
16141 #ifdef I_MEMORY
16142 #  include <memory.h>
16143 #endif
16144 #ifdef I_STDLIB
16145 #  include <stdlib.h>
16146 #endif
16147 #ifdef I_STRING
16148 #  include <string.h>
16149 #else
16150 #  include <strings.h>
16151 #endif
16152 #ifdef I_UNISTD
16153 #  include <unistd.h>  /* Needed for NetBSD */
16154 #endif
16155 int main()
16156 {
16157 char buf[128], abc[128];
16158 char *b;
16159 int len;
16160 int off;
16161 int align;
16162
16163 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16164    try to store the string in read-only memory. */
16165 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16166
16167 for (align = 7; align >= 0; align--) {
16168         for (len = 36; len; len--) {
16169                 b = buf+align;
16170                 memcpy(b, abc, len);
16171                 for (off = 1; off <= len; off++) {
16172                         memcpy(b+off, b, len);
16173                         memcpy(b, b+off, len);
16174                         if (memcmp(b, abc, len))
16175                                 exit(1);
16176                 }
16177         }
16178 }
16179 exit(0);
16180 }
16181 EOCP
16182                 set try
16183                 if eval $compile_ok; then
16184                         if $run ./try 2>/dev/null; then
16185                                 echo "Yes, it can."
16186                                 val="$define"
16187                         else
16188                                 echo "It can't, sorry."
16189                         fi
16190                 else
16191                         echo "(I can't compile the test program, so we'll assume not...)"
16192                 fi
16193                 ;;
16194         esac
16195         $rm_try
16196         ;;
16197 esac
16198 set d_safemcpy
16199 eval $setvar
16200
16201 : can memcmp be trusted to compare relative magnitude?
16202 val="$undef"
16203 case "$d_memcmp" in
16204 "$define")
16205         echo " "
16206         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16207         $cat >try.c <<EOCP
16208 #$i_memory I_MEMORY
16209 #$i_stdlib I_STDLIB
16210 #$i_string I_STRING
16211 #$i_unistd I_UNISTD
16212 EOCP
16213         $cat >>try.c <<'EOCP'
16214 #include <stdio.h>
16215 #ifdef I_MEMORY
16216 #  include <memory.h>
16217 #endif
16218 #ifdef I_STDLIB
16219 #  include <stdlib.h>
16220 #endif
16221 #ifdef I_STRING
16222 #  include <string.h>
16223 #else
16224 #  include <strings.h>
16225 #endif
16226 #ifdef I_UNISTD
16227 #  include <unistd.h>  /* Needed for NetBSD */
16228 #endif
16229 int main()
16230 {
16231 char a = -1;
16232 char b = 0;
16233 if ((a < b) && memcmp(&a, &b, 1) < 0)
16234         exit(1);
16235 exit(0);
16236 }
16237 EOCP
16238         set try
16239         if eval $compile_ok; then
16240                 if $run ./try 2>/dev/null; then
16241                         echo "Yes, it can."
16242                         val="$define"
16243                 else
16244                         echo "No, it can't (it uses signed chars)."
16245                 fi
16246         else
16247                 echo "(I can't compile the test program, so we'll assume not...)"
16248         fi
16249         ;;
16250 esac
16251 $rm_try
16252 set d_sanemcmp
16253 eval $setvar
16254
16255 : see if prototype for sbrk is available
16256 echo " "
16257 set d_sbrkproto sbrk $i_unistd unistd.h
16258 eval $hasproto
16259
16260 : see if select exists
16261 set select d_select
16262 eval $inlibc
16263
16264 : see if semctl exists
16265 set semctl d_semctl
16266 eval $inlibc
16267
16268 : see if semget exists
16269 set semget d_semget
16270 eval $inlibc
16271
16272 : see if semop exists
16273 set semop d_semop
16274 eval $inlibc
16275
16276 : see how much of the 'sem*(2)' library is present.
16277 h_sem=true
16278 echo " "
16279 case "$d_semctl$d_semget$d_semop" in
16280 *"$undef"*) h_sem=false;;
16281 esac
16282 case "$osname" in
16283 freebsd)
16284     case "`ipcs 2>&1`" in
16285     "SVID messages"*"not configured"*)
16286         echo "Your $osname does not have the sem*(2) configured." >&4
16287         h_sem=false
16288         val="$undef"
16289         set semctl d_semctl
16290         eval $setvar
16291         set semget d_semget
16292         eval $setvar
16293         set semop d_semop
16294         eval $setvar
16295         ;;
16296     esac
16297     ;;
16298 esac
16299 : we could also check for sys/ipc.h ...
16300 if $h_sem && $test `./findhdr sys/sem.h`; then
16301         echo "You have the full sem*(2) library." >&4
16302         val="$define"
16303 else
16304         echo "You don't have the full sem*(2) library." >&4
16305         val="$undef"
16306 fi
16307 set d_sem
16308 eval $setvar
16309
16310 : see whether sys/sem.h defines union semun
16311 echo " "
16312 $cat > try.c <<'END'
16313 #include <sys/types.h>
16314 #include <sys/ipc.h>
16315 #include <sys/sem.h>
16316 int main () { union semun semun; semun.buf = 0; }
16317 END
16318 set try
16319 if eval $compile; then
16320     echo "You have union semun in <sys/sem.h>." >&4
16321     val="$define"
16322 else
16323     echo "You do not have union semun in <sys/sem.h>." >&4
16324     val="$undef"
16325 fi
16326 $rm_try
16327 set d_union_semun
16328 eval $setvar
16329
16330 : see how to do semctl IPC_STAT
16331 case "$d_sem" in
16332 $define)
16333     echo " "
16334     $cat > tryh.h <<END
16335 #ifndef S_IRUSR
16336 #   ifdef S_IREAD
16337 #       define S_IRUSR S_IREAD
16338 #       define S_IWUSR S_IWRITE
16339 #       define S_IXUSR S_IEXEC
16340 #   else
16341 #       define S_IRUSR 0400
16342 #       define S_IWUSR 0200
16343 #       define S_IXUSR 0100
16344 #   endif
16345 #   define S_IRGRP (S_IRUSR>>3)
16346 #   define S_IWGRP (S_IWUSR>>3)
16347 #   define S_IXGRP (S_IXUSR>>3)
16348 #   define S_IROTH (S_IRUSR>>6)
16349 #   define S_IWOTH (S_IWUSR>>6)
16350 #   define S_IXOTH (S_IXUSR>>6)
16351 #endif
16352 #ifndef S_IRWXU
16353 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16354 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16355 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16356 #endif
16357 END
16358     : see whether semctl IPC_STAT can use union semun
16359     case "$d_semctl_semun" in
16360     '')
16361       val="$undef"
16362       $cat > try.c <<END
16363 #include <sys/types.h>
16364 #include <sys/ipc.h>
16365 #include <sys/sem.h>
16366 #include <sys/stat.h>
16367 #include <stdio.h>
16368 #include <errno.h>
16369 #include "tryh.h"
16370 #ifndef errno
16371 extern int errno;
16372 #endif
16373 #$d_union_semun HAS_UNION_SEMUN
16374 int main() {
16375     union semun
16376 #ifndef HAS_UNION_SEMUN
16377     {
16378         int val;
16379         struct semid_ds *buf;
16380         unsigned short *array;
16381     }
16382 #endif
16383     arg;
16384     int sem, st;
16385
16386 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16387     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16388     if (sem > -1) {
16389         struct semid_ds argbuf;
16390         arg.buf = &argbuf;
16391 #       ifdef IPC_STAT
16392         st = semctl(sem, 0, IPC_STAT, arg);
16393         if (st == 0)
16394             printf("semun\n");
16395         else
16396 #       endif /* IPC_STAT */
16397             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16398 #       ifdef IPC_RMID
16399         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16400 #       endif /* IPC_RMID */
16401             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16402     } else
16403 #endif /* IPC_PRIVATE && ... */
16404         printf("semget failed: errno = %d\n", errno);
16405   return 0;
16406 }
16407 END
16408       set try
16409       if eval $compile; then
16410           xxx=`$run ./try`
16411           case "$xxx" in
16412           semun) val="$define" ;;
16413           esac
16414       fi
16415       $rm_try
16416       set d_semctl_semun
16417       eval $setvar
16418       ;;
16419     esac
16420     case "$d_semctl_semun" in
16421     $define)
16422         echo "You can use union semun for semctl IPC_STAT." >&4
16423         also='also'
16424         ;;
16425     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16426         also=''
16427         ;;
16428     esac
16429
16430     : see whether semctl IPC_STAT can use struct semid_ds pointer
16431     case "$d_semctl_semid_ds" in
16432     '')
16433       val="$undef"
16434       $cat > try.c <<'END'
16435 #include <sys/types.h>
16436 #include <sys/ipc.h>
16437 #include <sys/sem.h>
16438 #include <sys/stat.h>
16439 #include "tryh.h"
16440 #include <stdio.h>
16441 #include <errno.h>
16442 #ifndef errno
16443 extern int errno;
16444 #endif
16445 int main() {
16446     struct semid_ds arg;
16447     int sem, st;
16448
16449 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16450     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16451     if (sem > -1) {
16452 #       ifdef IPC_STAT
16453         st = semctl(sem, 0, IPC_STAT, &arg);
16454         if (st == 0)
16455             printf("semid_ds\n");
16456         else
16457 #       endif /* IPC_STAT */
16458             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16459 #       ifdef IPC_RMID
16460         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16461 #       endif /* IPC_RMID */
16462             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16463     } else
16464 #endif /* IPC_PRIVATE && ... */
16465         printf("semget failed: errno = %d\n", errno);
16466
16467     return 0;
16468 }
16469 END
16470       set try
16471       if eval $compile; then
16472           xxx=`$run ./try`
16473           case "$xxx" in
16474           semid_ds) val="$define" ;;
16475           esac
16476       fi
16477       $rm_try
16478       set d_semctl_semid_ds
16479       eval $setvar
16480       ;;
16481     esac
16482     case "$d_semctl_semid_ds" in
16483     $define)
16484         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16485         ;;
16486     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16487         ;;
16488     esac
16489     ;;
16490 *)  val="$undef"
16491
16492     # We do not have the full sem*(2) library, so assume we can not
16493     # use either.
16494
16495     set d_semctl_semun
16496     eval $setvar
16497
16498     set d_semctl_semid_ds
16499     eval $setvar
16500     ;;
16501 esac
16502 $rm_try tryh.h
16503
16504 : see if sendmsg exists
16505 set sendmsg d_sendmsg
16506 eval $inlibc
16507
16508 : see if setegid exists
16509 set setegid d_setegid
16510 eval $inlibc
16511
16512 : see if seteuid exists
16513 set seteuid d_seteuid
16514 eval $inlibc
16515
16516 : see if setgrent exists
16517 set setgrent d_setgrent
16518 eval $inlibc
16519
16520 : see if setgrent_r exists
16521 set setgrent_r d_setgrent_r
16522 eval $inlibc
16523 case "$d_setgrent_r" in
16524 "$define")
16525         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16526         case "$d_setgrent_r_proto:$usethreads" in
16527         ":define")      d_setgrent_r_proto=define
16528                 set d_setgrent_r_proto setgrent_r $hdrs
16529                 eval $hasproto ;;
16530         *)      ;;
16531         esac
16532         case "$d_setgrent_r_proto" in
16533         define)
16534         case "$setgrent_r_proto" in
16535         ''|0) try='int setgrent_r(FILE**);'
16536         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16537         esac
16538         case "$setgrent_r_proto" in
16539         ''|0) try='void setgrent_r(FILE**);'
16540         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16541         esac
16542         case "$setgrent_r_proto" in
16543         ''|0)   d_setgrent_r=undef
16544                 setgrent_r_proto=0
16545                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16546         * )     case "$setgrent_r_proto" in
16547                 REENTRANT_PROTO*) ;;
16548                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16549                 esac
16550                 echo "Prototype: $try" ;;
16551         esac
16552         ;;
16553         *)      case "$usethreads" in
16554                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16555                 esac
16556                 d_setgrent_r=undef
16557                 setgrent_r_proto=0
16558                 ;;
16559         esac
16560         ;;
16561 *)      setgrent_r_proto=0
16562         ;;
16563 esac
16564
16565 : see if sethostent exists
16566 set sethostent d_sethent
16567 eval $inlibc
16568
16569 : see if sethostent_r exists
16570 set sethostent_r d_sethostent_r
16571 eval $inlibc
16572 case "$d_sethostent_r" in
16573 "$define")
16574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16575         case "$d_sethostent_r_proto:$usethreads" in
16576         ":define")      d_sethostent_r_proto=define
16577                 set d_sethostent_r_proto sethostent_r $hdrs
16578                 eval $hasproto ;;
16579         *)      ;;
16580         esac
16581         case "$d_sethostent_r_proto" in
16582         define)
16583         case "$sethostent_r_proto" in
16584         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16585         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16586         esac
16587         case "$sethostent_r_proto" in
16588         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16589         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16590         esac
16591         case "$sethostent_r_proto" in
16592         ''|0)   d_sethostent_r=undef
16593                 sethostent_r_proto=0
16594                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16595         * )     case "$sethostent_r_proto" in
16596                 REENTRANT_PROTO*) ;;
16597                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16598                 esac
16599                 echo "Prototype: $try" ;;
16600         esac
16601         ;;
16602         *)      case "$usethreads" in
16603                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16604                 esac
16605                 d_sethostent_r=undef
16606                 sethostent_r_proto=0
16607                 ;;
16608         esac
16609         ;;
16610 *)      sethostent_r_proto=0
16611         ;;
16612 esac
16613
16614 : see if setitimer exists
16615 set setitimer d_setitimer
16616 eval $inlibc
16617
16618 : see if setlinebuf exists
16619 set setlinebuf d_setlinebuf
16620 eval $inlibc
16621
16622 : see if setlocale exists
16623 set setlocale d_setlocale
16624 eval $inlibc
16625
16626 : see if locale.h is available
16627 set locale.h i_locale
16628 eval $inhdr
16629
16630 : see if setlocale_r exists
16631 set setlocale_r d_setlocale_r
16632 eval $inlibc
16633 case "$d_setlocale_r" in
16634 "$define")
16635         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16636         case "$d_setlocale_r_proto:$usethreads" in
16637         ":define")      d_setlocale_r_proto=define
16638                 set d_setlocale_r_proto setlocale_r $hdrs
16639                 eval $hasproto ;;
16640         *)      ;;
16641         esac
16642         case "$d_setlocale_r_proto" in
16643         define)
16644         case "$setlocale_r_proto" in
16645         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16646         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16647         esac
16648         case "$setlocale_r_proto" in
16649         ''|0)   d_setlocale_r=undef
16650                 setlocale_r_proto=0
16651                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16652         * )     case "$setlocale_r_proto" in
16653                 REENTRANT_PROTO*) ;;
16654                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16655                 esac
16656                 echo "Prototype: $try" ;;
16657         esac
16658         ;;
16659         *)      case "$usethreads" in
16660                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16661                 esac
16662                 d_setlocale_r=undef
16663                 setlocale_r_proto=0
16664                 ;;
16665         esac
16666         ;;
16667 *)      setlocale_r_proto=0
16668         ;;
16669 esac
16670
16671 : see if setnetent exists
16672 set setnetent d_setnent
16673 eval $inlibc
16674
16675 : see if setnetent_r exists
16676 set setnetent_r d_setnetent_r
16677 eval $inlibc
16678 case "$d_setnetent_r" in
16679 "$define")
16680         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16681         case "$d_setnetent_r_proto:$usethreads" in
16682         ":define")      d_setnetent_r_proto=define
16683                 set d_setnetent_r_proto setnetent_r $hdrs
16684                 eval $hasproto ;;
16685         *)      ;;
16686         esac
16687         case "$d_setnetent_r_proto" in
16688         define)
16689         case "$setnetent_r_proto" in
16690         ''|0) try='int setnetent_r(int, struct netent_data*);'
16691         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16692         esac
16693         case "$setnetent_r_proto" in
16694         ''|0) try='void setnetent_r(int, struct netent_data*);'
16695         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16696         esac
16697         case "$setnetent_r_proto" in
16698         ''|0)   d_setnetent_r=undef
16699                 setnetent_r_proto=0
16700                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16701         * )     case "$setnetent_r_proto" in
16702                 REENTRANT_PROTO*) ;;
16703                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16704                 esac
16705                 echo "Prototype: $try" ;;
16706         esac
16707         ;;
16708         *)      case "$usethreads" in
16709                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16710                 esac
16711                 d_setnetent_r=undef
16712                 setnetent_r_proto=0
16713                 ;;
16714         esac
16715         ;;
16716 *)      setnetent_r_proto=0
16717         ;;
16718 esac
16719
16720 : see if setprotoent exists
16721 set setprotoent d_setpent
16722 eval $inlibc
16723
16724 : see if setpgid exists
16725 set setpgid d_setpgid
16726 eval $inlibc
16727
16728 : see if setpgrp2 exists
16729 set setpgrp2 d_setpgrp2
16730 eval $inlibc
16731
16732 : see if setpriority exists
16733 set setpriority d_setprior
16734 eval $inlibc
16735
16736 : see if setproctitle exists
16737 set setproctitle d_setproctitle
16738 eval $inlibc
16739
16740 : see if setprotoent_r exists
16741 set setprotoent_r d_setprotoent_r
16742 eval $inlibc
16743 case "$d_setprotoent_r" in
16744 "$define")
16745         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16746         case "$d_setprotoent_r_proto:$usethreads" in
16747         ":define")      d_setprotoent_r_proto=define
16748                 set d_setprotoent_r_proto setprotoent_r $hdrs
16749                 eval $hasproto ;;
16750         *)      ;;
16751         esac
16752         case "$d_setprotoent_r_proto" in
16753         define)
16754         case "$setprotoent_r_proto" in
16755         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16756         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16757         esac
16758         case "$setprotoent_r_proto" in
16759         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16760         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16761         esac
16762         case "$setprotoent_r_proto" in
16763         ''|0)   d_setprotoent_r=undef
16764                 setprotoent_r_proto=0
16765                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16766         * )     case "$setprotoent_r_proto" in
16767                 REENTRANT_PROTO*) ;;
16768                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16769                 esac
16770                 echo "Prototype: $try" ;;
16771         esac
16772         ;;
16773         *)      case "$usethreads" in
16774                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16775                 esac
16776                 d_setprotoent_r=undef
16777                 setprotoent_r_proto=0
16778                 ;;
16779         esac
16780         ;;
16781 *)      setprotoent_r_proto=0
16782         ;;
16783 esac
16784
16785 : see if setpwent exists
16786 set setpwent d_setpwent
16787 eval $inlibc
16788
16789 : see if setpwent_r exists
16790 set setpwent_r d_setpwent_r
16791 eval $inlibc
16792 case "$d_setpwent_r" in
16793 "$define")
16794         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16795         case "$d_setpwent_r_proto:$usethreads" in
16796         ":define")      d_setpwent_r_proto=define
16797                 set d_setpwent_r_proto setpwent_r $hdrs
16798                 eval $hasproto ;;
16799         *)      ;;
16800         esac
16801         case "$d_setpwent_r_proto" in
16802         define)
16803         case "$setpwent_r_proto" in
16804         ''|0) try='int setpwent_r(FILE**);'
16805         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16806         esac
16807         case "$setpwent_r_proto" in
16808         ''|0) try='void setpwent_r(FILE**);'
16809         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16810         esac
16811         case "$setpwent_r_proto" in
16812         ''|0)   d_setpwent_r=undef
16813                 setpwent_r_proto=0
16814                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16815         * )     case "$setpwent_r_proto" in
16816                 REENTRANT_PROTO*) ;;
16817                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16818                 esac
16819                 echo "Prototype: $try" ;;
16820         esac
16821         ;;
16822         *)      case "$usethreads" in
16823                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16824                 esac
16825                 d_setpwent_r=undef
16826                 setpwent_r_proto=0
16827                 ;;
16828         esac
16829         ;;
16830 *)      setpwent_r_proto=0
16831         ;;
16832 esac
16833
16834 : see if setregid exists
16835 set setregid d_setregid
16836 eval $inlibc
16837 set setresgid d_setresgid
16838 eval $inlibc
16839
16840 : see if setreuid exists
16841 set setreuid d_setreuid
16842 eval $inlibc
16843 set setresuid d_setresuid
16844 eval $inlibc
16845
16846 : see if setrgid exists
16847 set setrgid d_setrgid
16848 eval $inlibc
16849
16850 : see if setruid exists
16851 set setruid d_setruid
16852 eval $inlibc
16853
16854 : see if setservent exists
16855 set setservent d_setsent
16856 eval $inlibc
16857
16858 : see if setservent_r exists
16859 set setservent_r d_setservent_r
16860 eval $inlibc
16861 case "$d_setservent_r" in
16862 "$define")
16863         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16864         case "$d_setservent_r_proto:$usethreads" in
16865         ":define")      d_setservent_r_proto=define
16866                 set d_setservent_r_proto setservent_r $hdrs
16867                 eval $hasproto ;;
16868         *)      ;;
16869         esac
16870         case "$d_setservent_r_proto" in
16871         define)
16872         case "$setservent_r_proto" in
16873         ''|0) try='int setservent_r(int, struct servent_data*);'
16874         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16875         esac
16876         case "$setservent_r_proto" in
16877         ''|0) try='void setservent_r(int, struct servent_data*);'
16878         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16879         esac
16880         case "$setservent_r_proto" in
16881         ''|0)   d_setservent_r=undef
16882                 setservent_r_proto=0
16883                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16884         * )     case "$setservent_r_proto" in
16885                 REENTRANT_PROTO*) ;;
16886                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16887                 esac
16888                 echo "Prototype: $try" ;;
16889         esac
16890         ;;
16891         *)      case "$usethreads" in
16892                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16893                 esac
16894                 d_setservent_r=undef
16895                 setservent_r_proto=0
16896                 ;;
16897         esac
16898         ;;
16899 *)      setservent_r_proto=0
16900         ;;
16901 esac
16902
16903 : see if setsid exists
16904 set setsid d_setsid
16905 eval $inlibc
16906
16907 : see if setvbuf exists
16908 set setvbuf d_setvbuf
16909 eval $inlibc
16910
16911 : see if sfio.h is available
16912 set sfio.h i_sfio
16913 eval $inhdr
16914
16915 : see if sfio library is available
16916 case "$i_sfio" in
16917 $define)
16918         val=''
16919         set sfreserve val
16920         eval $inlibc
16921         ;;
16922 *)
16923         val="$undef"
16924         ;;
16925 esac
16926 : Ok, but do we want to use it.
16927 case "$val" in
16928 $define)
16929         case "$usesfio" in
16930         true|$define|[yY]*) dflt='y';;
16931         *) dflt='n';;
16932         esac
16933         echo "$package can use the sfio library, but it is experimental."
16934         case "$useperlio" in
16935         "$undef")
16936             echo "For sfio also the PerlIO abstraction layer is needed."
16937             echo "Earlier you said you wouldn't want that."
16938             ;;
16939         esac
16940         rp="You seem to have sfio available, do you want to try using it?"
16941         . ./myread
16942         case "$ans" in
16943         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16944                 useperlio="$define"
16945                 val="$define"
16946                 ;;
16947         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16948                 val="$undef"
16949                 ;;
16950         esac
16951         ;;
16952 *)      case "$usesfio" in
16953         true|$define|[yY]*)
16954                 echo "Sorry, cannot find sfio on this machine." >&4
16955                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16956                 val="$undef"
16957                 ;;
16958         esac
16959         ;;
16960 esac
16961 set d_sfio
16962 eval $setvar
16963 case "$d_sfio" in
16964 $define) usesfio='true';;
16965 *) usesfio='false';;
16966 esac
16967 case "$d_sfio" in
16968 $define) ;;
16969 *)      : Remove sfio from list of libraries to use
16970         case "$libs" in
16971         *-lsfio*)
16972                 echo "Removing unneeded -lsfio from library list" >&4
16973                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16974                 shift
16975                 libs="$*"
16976                 echo "libs = $libs" >&4
16977                 ;;
16978         esac
16979 ;;
16980 esac
16981
16982
16983 : see if shmctl exists
16984 set shmctl d_shmctl
16985 eval $inlibc
16986
16987 : see if shmget exists
16988 set shmget d_shmget
16989 eval $inlibc
16990
16991 : see if shmat exists
16992 set shmat d_shmat
16993 eval $inlibc
16994 : see what shmat returns
16995 case "$d_shmat" in
16996 "$define")
16997         $cat >shmat.c <<'END'
16998 #include <sys/shm.h>
16999 void *shmat();
17000 END
17001         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17002                 shmattype='void *'
17003         else
17004                 shmattype='char *'
17005         fi
17006         echo "and it returns ($shmattype)." >&4
17007         : see if a prototype for shmat is available
17008         xxx=`./findhdr sys/shm.h`
17009         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17010         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17011                 val="$define"
17012         else
17013                 val="$undef"
17014         fi
17015         $rm -f shmat.[co]
17016         ;;
17017 *)
17018         val="$undef"
17019         ;;
17020 esac
17021 set d_shmatprototype
17022 eval $setvar
17023
17024 : see if shmdt exists
17025 set shmdt d_shmdt
17026 eval $inlibc
17027
17028 : see how much of the 'shm*(2)' library is present.
17029 h_shm=true
17030 echo " "
17031 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17032 *"$undef"*) h_shm=false;;
17033 esac
17034 case "$osname" in
17035 freebsd)
17036     case "`ipcs 2>&1`" in
17037     "SVID shared memory"*"not configured"*)
17038         echo "Your $osname does not have the shm*(2) configured." >&4
17039         h_shm=false
17040         val="$undef"
17041         set shmctl d_shmctl
17042         evat $setvar
17043         set shmget d_shmget
17044         evat $setvar
17045         set shmat d_shmat
17046         evat $setvar
17047         set shmdt d_shmdt
17048         evat $setvar
17049         ;;
17050     esac
17051     ;;
17052 esac
17053 : we could also check for sys/ipc.h ...
17054 if $h_shm && $test `./findhdr sys/shm.h`; then
17055         echo "You have the full shm*(2) library." >&4
17056         val="$define"
17057 else
17058         echo "You don't have the full shm*(2) library." >&4
17059         val="$undef"
17060 fi
17061 set d_shm
17062 eval $setvar
17063
17064 : see if we have sigaction
17065 echo " "
17066 if set sigaction val -f d_sigaction; eval $csym; $val; then
17067         echo 'sigaction() found.' >&4
17068         $cat > try.c <<EOP
17069 #include <stdio.h>
17070 #include <sys/types.h>
17071 #include <signal.h>
17072 #$i_stdlib I_STDLIB
17073 #ifdef I_STDLIB
17074 #include <stdlib.h>
17075 #endif
17076 int main()
17077 {
17078     struct sigaction act, oact;
17079     act.sa_flags = 0;
17080     oact.sa_handler = 0;
17081     /* so that act and oact are used */
17082     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17083 }
17084 EOP
17085         set try
17086         if eval $compile_ok; then
17087                 val="$define"
17088         else
17089                 echo "But you don't seem to have a useable struct sigaction." >&4
17090                 val="$undef"
17091         fi
17092 else
17093         echo 'sigaction NOT found.' >&4
17094         val="$undef"
17095 fi
17096 set d_sigaction; eval $setvar
17097 $rm_try
17098
17099 : see if this is a sunmath.h system
17100 set sunmath.h i_sunmath
17101 eval $inhdr
17102
17103 : see if signbit exists
17104 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17105 $cat >try.c <<EOCP
17106 #$i_math I_MATH
17107 #$i_sunmath I_SUNMATH
17108 #ifdef I_MATH
17109 #  include <math.h>
17110 #endif
17111 #ifdef I_SUNMATH  /* Solaris special math library */
17112 #  include <sunmath.h>
17113 #endif
17114 #define NV $nvtype
17115 int main(int argc, char **argv)
17116 {
17117     NV x = 0.0;
17118     NV y = -0.0;
17119     if ((signbit(x) == 0) && (signbit(y) != 0))
17120         return 0;
17121     else
17122         return 1;
17123 }
17124 EOCP
17125 val="$undef"
17126 set try
17127 if eval $compile; then
17128     if $run ./try; then
17129         $echo "Yes." >&4
17130         val="$define"
17131     else
17132         $echo "Signbit seems to be available, but doesn't work as I expected."
17133         $echo "I won't use it." >&4
17134         val="$undef"
17135     fi
17136 else
17137     $echo "Nope." >&4
17138     dflt="$undef"
17139 fi
17140 set d_signbit
17141 eval $setvar
17142 $rm_try
17143
17144 : see if sigprocmask exists
17145 set sigprocmask d_sigprocmask
17146 eval $inlibc
17147
17148 : see if sigsetjmp exists
17149 echo " "
17150 case "$d_sigsetjmp" in
17151 '')
17152         $cat >try.c <<EOP
17153 #include <setjmp.h>
17154 #$i_stdlib I_STDLIB
17155 #ifdef I_STDLIB
17156 #include <stdlib.h>
17157 #endif
17158 sigjmp_buf env;
17159 int set = 1;
17160 int main()
17161 {
17162         if (sigsetjmp(env,1))
17163                 exit(set);
17164         set = 0;
17165         siglongjmp(env, 1);
17166         exit(1);
17167 }
17168 EOP
17169         set try
17170         if eval $compile; then
17171                 if $run ./try >/dev/null 2>&1; then
17172                         echo "POSIX sigsetjmp found." >&4
17173                         val="$define"
17174                 else
17175                         $cat >&4 <<EOM
17176 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17177 I'll ignore them.
17178 EOM
17179                         val="$undef"
17180                 fi
17181         else
17182                 echo "sigsetjmp not found." >&4
17183                 val="$undef"
17184         fi
17185         ;;
17186 *) val="$d_sigsetjmp"
17187         case "$d_sigsetjmp" in
17188         $define) echo "POSIX sigsetjmp found." >&4;;
17189         $undef) echo "sigsetjmp not found." >&4;;
17190         esac
17191         ;;
17192 esac
17193 set d_sigsetjmp
17194 eval $setvar
17195 $rm_try
17196
17197 : see if snprintf exists
17198 set snprintf d_snprintf
17199 eval $inlibc
17200
17201 : see if vsnprintf exists
17202 set vsnprintf d_vsnprintf
17203 eval $inlibc
17204
17205 case "$d_snprintf-$d_vsnprintf" in
17206 "$define-$define")
17207     $cat <<EOM
17208 Checking whether your snprintf() and vsnprintf() work okay...
17209 EOM
17210     $cat >try.c <<'EOCP'
17211 /* v?snprintf testing logic courtesy of Russ Allbery.
17212  * According to C99:
17213  * - if the buffer is too short it still must be \0-terminated
17214  * - if the buffer is too short the potentially required length
17215  *   must be returned and not -1
17216  * - if the buffer is NULL the potentially required length
17217  *   must be returned and not -1 or core dump
17218  */
17219 #include <stdio.h>
17220 #include <stdarg.h>
17221
17222 char buf[2];
17223
17224 int test (char *format, ...)
17225 {
17226     va_list args;
17227     int count;
17228
17229     va_start (args, format);
17230     count = vsnprintf (buf, sizeof buf, format, args);
17231     va_end (args);
17232     return count;
17233 }
17234
17235 int main ()
17236 {
17237     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17238              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17239 }
17240 EOCP
17241     set try
17242     if eval $compile; then
17243         `$run ./try`
17244         case "$?" in
17245         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17246         *) cat <<EOM >&4
17247 Your snprintf() and snprintf() don't seem to be working okay.
17248 EOM
17249            d_snprintf="$undef"
17250            d_vsnprintf="$undef"
17251            ;;
17252         esac
17253     else
17254         echo "(I can't seem to compile the test program--assuming they don't)"
17255         d_snprintf="$undef"
17256         d_vsnprintf="$undef"
17257     fi
17258     $rm_try
17259     ;;
17260 esac
17261
17262 : see if sockatmark exists
17263 set sockatmark d_sockatmark
17264 eval $inlibc
17265
17266 : see if prototype for sockatmark is available
17267 echo " "
17268 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17269 eval $hasproto
17270
17271 : see if socks5_init exists
17272 set socks5_init d_socks5_init
17273 eval $inlibc
17274
17275 : see if sprintf returns the length of the string in the buffer as per ANSI
17276 $echo "Checking whether sprintf returns the length of the string..." >&4
17277 $cat <<EOP >try.c
17278 #include <stdio.h>
17279 #$i_stdlib I_STDLIB
17280 #ifdef I_STDLIB
17281 #include <stdlib.h>
17282 #endif
17283 #$i_string I_STRING
17284 #ifdef I_STRING
17285 #  include <string.h>
17286 #else
17287 #  include <strings.h>
17288 #endif
17289 #$i_math I_MATH
17290 #ifdef I_MATH
17291 #include <math.h>
17292 #endif
17293
17294 char buffer[256];
17295
17296 int check (size_t expect, int test) {
17297   size_t got = strlen(buffer);
17298   if (expect == got)
17299     return 0;
17300
17301   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17302        test, buffer);
17303   exit (test);
17304 }
17305
17306 int main(int argc, char **argv) {
17307   int test = 0;
17308
17309   check(sprintf(buffer, ""), ++test);
17310   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17311   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17312
17313   return 0;
17314 }
17315 EOP
17316 set try
17317
17318 d_sprintf_returns_strlen="$undef"
17319 if eval $compile; then
17320     xxx="`$run ./try`"
17321     case "$?" in
17322         0) cat >&4 <<EOM
17323 sprintf returns the length of the string (as ANSI says it should)
17324 EOM
17325         d_sprintf_returns_strlen="$define"
17326         ;;
17327         *) cat >&4 <<EOM
17328 sprintf does not return the length of the string (how old is this system?)
17329 EOM
17330         d_sprintf_returns_strlen="$undef"
17331         ;;
17332     esac
17333 fi
17334 $rm_try
17335
17336 : see if srand48_r exists
17337 set srand48_r d_srand48_r
17338 eval $inlibc
17339 case "$d_srand48_r" in
17340 "$define")
17341         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17342         case "$d_srand48_r_proto:$usethreads" in
17343         ":define")      d_srand48_r_proto=define
17344                 set d_srand48_r_proto srand48_r $hdrs
17345                 eval $hasproto ;;
17346         *)      ;;
17347         esac
17348         case "$d_srand48_r_proto" in
17349         define)
17350         case "$srand48_r_proto" in
17351         ''|0) try='int srand48_r(long, struct drand48_data*);'
17352         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17353         esac
17354         case "$srand48_r_proto" in
17355         ''|0)   d_srand48_r=undef
17356                 srand48_r_proto=0
17357                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17358         * )     case "$srand48_r_proto" in
17359                 REENTRANT_PROTO*) ;;
17360                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17361                 esac
17362                 echo "Prototype: $try" ;;
17363         esac
17364         ;;
17365         *)      case "$usethreads" in
17366                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17367                 esac
17368                 d_srand48_r=undef
17369                 srand48_r_proto=0
17370                 ;;
17371         esac
17372         ;;
17373 *)      srand48_r_proto=0
17374         ;;
17375 esac
17376
17377 : see if srandom_r exists
17378 set srandom_r d_srandom_r
17379 eval $inlibc
17380 case "$d_srandom_r" in
17381 "$define")
17382         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17383         case "$d_srandom_r_proto:$usethreads" in
17384         ":define")      d_srandom_r_proto=define
17385                 set d_srandom_r_proto srandom_r $hdrs
17386                 eval $hasproto ;;
17387         *)      ;;
17388         esac
17389         case "$d_srandom_r_proto" in
17390         define)
17391         case "$srandom_r_proto" in
17392         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17393         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17394         esac
17395         case "$srandom_r_proto" in
17396         ''|0)   d_srandom_r=undef
17397                 srandom_r_proto=0
17398                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17399         * )     case "$srandom_r_proto" in
17400                 REENTRANT_PROTO*) ;;
17401                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17402                 esac
17403                 echo "Prototype: $try" ;;
17404         esac
17405         ;;
17406         *)      case "$usethreads" in
17407                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17408                 esac
17409                 d_srandom_r=undef
17410                 srandom_r_proto=0
17411                 ;;
17412         esac
17413         ;;
17414 *)      srandom_r_proto=0
17415         ;;
17416 esac
17417
17418 : see if prototype for setresgid is available
17419 echo " "
17420 set d_sresgproto setresgid $i_unistd unistd.h
17421 eval $hasproto
17422
17423 : see if prototype for setresuid is available
17424 echo " "
17425 set d_sresuproto setresuid $i_unistd unistd.h
17426 eval $hasproto
17427
17428 : see if sys/stat.h is available
17429 set sys/stat.h i_sysstat
17430 eval $inhdr
17431
17432 : see if stat knows about block sizes
17433 echo " "
17434 echo "Checking to see if your struct stat has st_blocks field..." >&4
17435 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17436 eval $hasfield
17437
17438 : see if this is a sys/vfs.h system
17439 set sys/vfs.h i_sysvfs
17440 eval $inhdr
17441
17442 : see if this is a sys/statfs.h system
17443 set sys/statfs.h i_sysstatfs
17444 eval $inhdr
17445
17446 : Check for statfs_s
17447 echo " "
17448 echo "Checking to see if your system supports struct statfs..." >&4
17449 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
17450 eval $hasstruct
17451 case "$d_statfs_s" in
17452 "$define")      echo "Yes, it does."   ;;
17453 *)              echo "No, it doesn't." ;;
17454 esac
17455
17456
17457 : see if struct statfs knows about f_flags
17458 case "$d_statfs_s" in
17459 define)
17460         echo " "
17461         echo "Checking to see if your struct statfs has f_flags field..." >&4
17462         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
17463         eval $hasfield
17464         ;;
17465 *)      val="$undef"
17466         set d_statfs_f_flags
17467         eval $setvar
17468         ;;
17469 esac
17470 case "$d_statfs_f_flags" in
17471 "$define")      echo "Yes, it does."   ;;
17472 *)              echo "No, it doesn't." ;;
17473 esac
17474
17475 : Check stream access
17476 $cat >&4 <<EOM
17477 Checking how to access stdio streams by file descriptor number...
17478 EOM
17479 case "$stdio_stream_array" in
17480 '')     $cat >try.c <<EOCP
17481 #include <stdio.h>
17482 int main() {
17483   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17484     printf("yes\n");
17485 }
17486 EOCP
17487         for s in _iob __iob __sF
17488         do
17489                 set try -DSTDIO_STREAM_ARRAY=$s
17490                 if eval $compile; then
17491                         case "`$run ./try`" in
17492                         yes)    stdio_stream_array=$s; break ;;
17493                         esac
17494                 fi
17495         done
17496         $rm_try
17497 esac
17498 case "$stdio_stream_array" in
17499 '')     $cat >&4 <<EOM
17500 I can't figure out how to access stdio streams by file descriptor number.
17501 EOM
17502         d_stdio_stream_array="$undef"
17503         ;;
17504 *)      $cat >&4 <<EOM
17505 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17506 EOM
17507         d_stdio_stream_array="$define"
17508         ;;
17509 esac
17510
17511 : see if strcoll exists
17512 set strcoll d_strcoll
17513 eval $inlibc
17514
17515 : check for structure copying
17516 echo " "
17517 echo "Checking to see if your C compiler can copy structs..." >&4
17518 $cat >try.c <<'EOCP'
17519 int main()
17520 {
17521         struct blurfl {
17522                 int dyick;
17523         } foo, bar;
17524
17525         foo = bar;
17526 }
17527 EOCP
17528 if $cc -c try.c >/dev/null 2>&1 ; then
17529         val="$define"
17530         echo "Yup, it can."
17531 else
17532         val="$undef"
17533         echo "Nope, it can't."
17534 fi
17535 set d_strctcpy
17536 eval $setvar
17537 $rm_try
17538
17539 : see if strerror and/or sys_errlist[] exist
17540 echo " "
17541 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17542     if set strerror val -f d_strerror; eval $csym; $val; then
17543                 echo 'strerror() found.' >&4
17544                 d_strerror="$define"
17545                 d_strerrm='strerror(e)'
17546                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17547                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17548                         d_syserrlst="$define"
17549                 else
17550                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17551                         d_syserrlst="$undef"
17552                 fi
17553     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17554                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17555                 echo 'strerror() found in string header.' >&4
17556                 d_strerror="$define"
17557                 d_strerrm='strerror(e)'
17558                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17559                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17560                                 d_syserrlst="$define"
17561                 else
17562                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17563                         d_syserrlst="$undef"
17564                 fi
17565     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17566                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17567                 d_strerror="$undef"
17568                 d_syserrlst="$define"
17569                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17570     else
17571                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17572                 d_strerror="$undef"
17573                 d_syserrlst="$undef"
17574                 d_strerrm='"unknown"'
17575     fi
17576 fi
17577
17578 : see if strerror_r exists
17579 set strerror_r d_strerror_r
17580 eval $inlibc
17581 case "$d_strerror_r" in
17582 "$define")
17583         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17584         case "$d_strerror_r_proto:$usethreads" in
17585         ":define")      d_strerror_r_proto=define
17586                 set d_strerror_r_proto strerror_r $hdrs
17587                 eval $hasproto ;;
17588         *)      ;;
17589         esac
17590         case "$d_strerror_r_proto" in
17591         define)
17592         case "$strerror_r_proto" in
17593         ''|0) try='int strerror_r(int, char*, size_t);'
17594         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17595         esac
17596         case "$strerror_r_proto" in
17597         ''|0) try='int strerror_r(int, char*, int);'
17598         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17599         esac
17600         case "$strerror_r_proto" in
17601         ''|0) try='char* strerror_r(int, char*, size_t);'
17602         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17603         esac
17604         case "$strerror_r_proto" in
17605         ''|0)   d_strerror_r=undef
17606                 strerror_r_proto=0
17607                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17608         * )     case "$strerror_r_proto" in
17609                 REENTRANT_PROTO*) ;;
17610                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17611                 esac
17612                 echo "Prototype: $try" ;;
17613         esac
17614         ;;
17615         *)      case "$usethreads" in
17616                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17617                 esac
17618                 d_strerror_r=undef
17619                 strerror_r_proto=0
17620                 ;;
17621         esac
17622         ;;
17623 *)      strerror_r_proto=0
17624         ;;
17625 esac
17626
17627 : see if strftime exists
17628 set strftime d_strftime
17629 eval $inlibc
17630
17631 : see if strlcat exists
17632 set strlcat d_strlcat
17633 eval $inlibc
17634
17635 : see if strlcpy exists
17636 set strlcpy d_strlcpy
17637 eval $inlibc
17638
17639 : see if strtod exists
17640 set strtod d_strtod
17641 eval $inlibc
17642
17643 : see if strtol exists
17644 set strtol d_strtol
17645 eval $inlibc
17646
17647 : see if strtold exists
17648 set strtold d_strtold
17649 eval $inlibc
17650
17651 : see if strtoll exists
17652 set strtoll d_strtoll
17653 eval $inlibc
17654
17655 case "$d_longlong-$d_strtoll" in
17656 "$define-$define")
17657         $cat <<EOM
17658 Checking whether your strtoll() works okay...
17659 EOM
17660         $cat >try.c <<'EOCP'
17661 #include <errno.h>
17662 #ifdef __hpux
17663 #define strtoll __strtoll
17664 #endif
17665 #ifdef __EMX__
17666 #define strtoll _strtoll
17667 #endif
17668 #include <stdio.h>
17669 extern long long int strtoll(char *s, char **, int);
17670 static int bad = 0;
17671 int check(char *s, long long ell, int een) {
17672         long long gll;
17673         errno = 0;
17674         gll = strtoll(s, 0, 10);
17675         if (!((gll == ell) && (errno == een)))
17676                 bad++;
17677 }
17678 int main() {
17679         check(" 1",                                      1LL, 0);
17680         check(" 0",                                      0LL, 0);
17681         check("-1",                                     -1LL, 0);
17682         check("-9223372036854775808", -9223372036854775808LL, 0);
17683         check("-9223372036854775808", -9223372036854775808LL, 0);
17684         check(" 9223372036854775807",  9223372036854775807LL, 0);
17685         check("-9223372036854775808", -9223372036854775808LL, 0);
17686         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17687         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17688         if (!bad)
17689                 printf("ok\n");
17690 }
17691 EOCP
17692         set try
17693         if eval $compile; then
17694                 yyy=`$run ./try`
17695                 case "$yyy" in
17696                 ok) echo "Your strtoll() seems to be working okay." ;;
17697                 *) cat <<EOM >&4
17698 Your strtoll() doesn't seem to be working okay.
17699 EOM
17700                    d_strtoll="$undef"
17701                    ;;
17702                 esac
17703         else
17704                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17705                 d_strtoll="$undef"
17706         fi
17707         ;;
17708 esac
17709
17710 : see if strtoq exists
17711 set strtoq d_strtoq
17712 eval $inlibc
17713
17714 : see if strtoul exists
17715 set strtoul d_strtoul
17716 eval $inlibc
17717
17718 case "$d_strtoul" in
17719 "$define")
17720         $cat <<EOM
17721 Checking whether your strtoul() works okay...
17722 EOM
17723         $cat >try.c <<'EOCP'
17724 #include <errno.h>
17725 #include <stdio.h>
17726 extern unsigned long int strtoul(char *s, char **, int);
17727 static int bad = 0;
17728 void check(char *s, unsigned long eul, int een) {
17729         unsigned long gul;
17730         errno = 0;
17731         gul = strtoul(s, 0, 10);
17732         if (!((gul == eul) && (errno == een)))
17733                 bad++;
17734 }
17735 int main() {
17736         check(" 1", 1L, 0);
17737         check(" 0", 0L, 0);
17738 EOCP
17739         case "$longsize" in
17740         8)
17741             $cat >>try.c <<'EOCP'
17742         check("18446744073709551615", 18446744073709551615UL, 0);
17743         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17744 #if 0 /* strtoul() for /^-/ strings is undefined. */
17745         check("-1", 18446744073709551615UL, 0);
17746         check("-18446744073709551614", 2, 0);
17747         check("-18446744073709551615", 1, 0);
17748         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17749         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17750 #endif
17751 EOCP
17752                 ;;
17753         4)
17754                     $cat >>try.c <<'EOCP'
17755         check("4294967295", 4294967295UL, 0);
17756         check("4294967296", 4294967295UL, ERANGE);
17757 #if 0 /* strtoul() for /^-/ strings is undefined. */
17758         check("-1", 4294967295UL, 0);
17759         check("-4294967294", 2, 0);
17760         check("-4294967295", 1, 0);
17761         check("-4294967296", 4294967295UL, ERANGE);
17762         check("-4294967297", 4294967295UL, ERANGE);
17763 #endif
17764 EOCP
17765                 ;;
17766         *)
17767 : Should we write these tests to be more portable by sprintf-ing
17768 : ~0 and then manipulating that char string as input for strtol?
17769                 ;;
17770         esac
17771         $cat >>try.c <<'EOCP'
17772         if (!bad)
17773                 printf("ok\n");
17774         return 0;
17775 }
17776 EOCP
17777         set try
17778         if eval $compile; then
17779                 case "`$run ./try`" in
17780                 ok) echo "Your strtoul() seems to be working okay." ;;
17781                 *) cat <<EOM >&4
17782 Your strtoul() doesn't seem to be working okay.
17783 EOM
17784                    d_strtoul="$undef"
17785                    ;;
17786                 esac
17787         else
17788                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17789                 d_strtoul="$undef"
17790         fi
17791         ;;
17792 esac
17793
17794 : see if strtoull exists
17795 set strtoull d_strtoull
17796 eval $inlibc
17797
17798 case "$d_longlong-$d_strtoull" in
17799 "$define-$define")
17800         $cat <<EOM
17801 Checking whether your strtoull() works okay...
17802 EOM
17803         $cat >try.c <<'EOCP'
17804 #include <errno.h>
17805 #ifdef __hpux
17806 #define strtoull __strtoull
17807 #endif
17808 #include <stdio.h>
17809 extern unsigned long long int strtoull(char *s, char **, int);
17810 static int bad = 0;
17811 int check(char *s, long long eull, int een) {
17812         long long gull;
17813         errno = 0;
17814         gull = strtoull(s, 0, 10);
17815         if (!((gull == eull) && (errno == een)))
17816                 bad++;
17817 }
17818 int main() {
17819         check(" 1",                                        1LL, 0);
17820         check(" 0",                                        0LL, 0);
17821         check("18446744073709551615",  18446744073709551615ULL, 0);
17822         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17823 #if 0 /* strtoull() for /^-/ strings is undefined. */
17824         check("-1",                    18446744073709551615ULL, 0);
17825         check("-18446744073709551614",                     2LL, 0);
17826         check("-18446744073709551615",                     1LL, 0);
17827         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17828         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17829 #endif
17830         if (!bad)
17831                 printf("ok\n");
17832 }
17833 EOCP
17834         set try
17835         if eval $compile; then
17836                 case "`$run ./try`" in
17837                 ok) echo "Your strtoull() seems to be working okay." ;;
17838                 *) cat <<EOM >&4
17839 Your strtoull() doesn't seem to be working okay.
17840 EOM
17841                    d_strtoull="$undef"
17842                    ;;
17843                 esac
17844         else
17845                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17846                 d_strtoull="$undef"
17847         fi
17848         ;;
17849 esac
17850
17851 : see if strtouq exists
17852 set strtouq d_strtouq
17853 eval $inlibc
17854
17855 case "$d_strtouq" in
17856 "$define")
17857         $cat <<EOM
17858 Checking whether your strtouq() works okay...
17859 EOM
17860         $cat >try.c <<'EOCP'
17861 #include <errno.h>
17862 #include <stdio.h>
17863 extern unsigned long long int strtouq(char *s, char **, int);
17864 static int bad = 0;
17865 void check(char *s, unsigned long long eull, int een) {
17866         unsigned long long gull;
17867         errno = 0;
17868         gull = strtouq(s, 0, 10);
17869         if (!((gull == eull) && (errno == een)))
17870                 bad++;
17871 }
17872 int main() {
17873         check(" 1",                                        1LL, 0);
17874         check(" 0",                                        0LL, 0);
17875         check("18446744073709551615",  18446744073709551615ULL, 0);
17876         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17877 #if 0 /* strtouq() for /^-/ strings is undefined. */
17878         check("-1",                    18446744073709551615ULL, 0);
17879         check("-18446744073709551614",                     2LL, 0);
17880         check("-18446744073709551615",                     1LL, 0);
17881         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17882         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17883 #endif
17884         if (!bad)
17885                 printf("ok\n");
17886         return 0;
17887 }
17888 EOCP
17889         set try
17890         if eval $compile; then
17891                 case "`$run ./try`" in
17892                 ok) echo "Your strtouq() seems to be working okay." ;;
17893                 *) cat <<EOM >&4
17894 Your strtouq() doesn't seem to be working okay.
17895 EOM
17896                    d_strtouq="$undef"
17897                    ;;
17898                 esac
17899         else
17900                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17901                 d_strtouq="$undef"
17902         fi
17903         ;;
17904 esac
17905
17906 : see if strxfrm exists
17907 set strxfrm d_strxfrm
17908 eval $inlibc
17909
17910 : see if symlink exists
17911 set symlink d_symlink
17912 eval $inlibc
17913
17914 : see if syscall exists
17915 set syscall d_syscall
17916 eval $inlibc
17917
17918 : see if prototype for syscall is available
17919 echo " "
17920 set d_syscallproto syscall $i_unistd unistd.h
17921 eval $hasproto
17922
17923 : see if sysconf exists
17924 set sysconf d_sysconf
17925 eval $inlibc
17926
17927 : see if system exists
17928 set system d_system
17929 eval $inlibc
17930
17931 : see if tcgetpgrp exists
17932 set tcgetpgrp d_tcgetpgrp
17933 eval $inlibc
17934
17935 : see if tcsetpgrp exists
17936 set tcsetpgrp d_tcsetpgrp
17937 eval $inlibc
17938
17939 : see if prototype for telldir is available
17940 echo " "
17941 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17942 eval $hasproto
17943
17944 : see if time exists
17945 echo " "
17946 if test "X$d_time" = X -o X"$timetype" = X; then
17947     if set time val -f d_time; eval $csym; $val; then
17948                 echo 'time() found.' >&4
17949                 val="$define"
17950                 rp="What is the type returned by time() on this system?"
17951                 set time_t timetype long stdio.h sys/types.h
17952                 eval $typedef_ask
17953     else
17954                 echo 'time() not found, hope that will do.' >&4
17955                 val="$undef"
17956                 timetype='int';
17957     fi
17958     set d_time
17959     eval $setvar
17960 fi
17961
17962 : see if this is a sys/times.h system
17963 set sys/times.h i_systimes
17964 eval $inhdr
17965
17966 : see if times exists
17967 echo " "
17968 if set times val -f d_times; eval $csym; $val; then
17969         echo 'times() found.' >&4
17970         d_times="$define"
17971         inc=''
17972         case "$i_systimes" in
17973         "$define") inc='sys/times.h';;
17974         esac
17975         rp="What is the type returned by times() on this system?"
17976         set clock_t clocktype long stdio.h sys/types.h $inc
17977         eval $typedef_ask
17978 else
17979         echo 'times() NOT found, hope that will do.' >&4
17980         d_times="$undef"
17981         clocktype='int'
17982 fi
17983
17984 : see if tmpnam_r exists
17985 set tmpnam_r d_tmpnam_r
17986 eval $inlibc
17987 case "$d_tmpnam_r" in
17988 "$define")
17989         hdrs="$i_systypes sys/types.h define stdio.h "
17990         case "$d_tmpnam_r_proto:$usethreads" in
17991         ":define")      d_tmpnam_r_proto=define
17992                 set d_tmpnam_r_proto tmpnam_r $hdrs
17993                 eval $hasproto ;;
17994         *)      ;;
17995         esac
17996         case "$d_tmpnam_r_proto" in
17997         define)
17998         case "$tmpnam_r_proto" in
17999         ''|0) try='char* tmpnam_r(char*);'
18000         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
18001         esac
18002         case "$tmpnam_r_proto" in
18003         ''|0)   d_tmpnam_r=undef
18004                 tmpnam_r_proto=0
18005                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18006         * )     case "$tmpnam_r_proto" in
18007                 REENTRANT_PROTO*) ;;
18008                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18009                 esac
18010                 echo "Prototype: $try" ;;
18011         esac
18012         ;;
18013         *)      case "$usethreads" in
18014                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18015                 esac
18016                 d_tmpnam_r=undef
18017                 tmpnam_r_proto=0
18018                 ;;
18019         esac
18020         ;;
18021 *)      tmpnam_r_proto=0
18022         ;;
18023 esac
18024
18025 : see if truncate exists
18026 set truncate d_truncate
18027 eval $inlibc
18028
18029 : see if ttyname_r exists
18030 set ttyname_r d_ttyname_r
18031 eval $inlibc
18032 case "$d_ttyname_r" in
18033 "$define")
18034         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18035         case "$d_ttyname_r_proto:$usethreads" in
18036         ":define")      d_ttyname_r_proto=define
18037                 set d_ttyname_r_proto ttyname_r $hdrs
18038                 eval $hasproto ;;
18039         *)      ;;
18040         esac
18041         case "$d_ttyname_r_proto" in
18042         define)
18043         case "$ttyname_r_proto" in
18044         ''|0) try='int ttyname_r(int, char*, size_t);'
18045         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
18046         esac
18047         case "$ttyname_r_proto" in
18048         ''|0) try='int ttyname_r(int, char*, int);'
18049         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
18050         esac
18051         case "$ttyname_r_proto" in
18052         ''|0) try='char* ttyname_r(int, char*, int);'
18053         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
18054         esac
18055         case "$ttyname_r_proto" in
18056         ''|0)   d_ttyname_r=undef
18057                 ttyname_r_proto=0
18058                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18059         * )     case "$ttyname_r_proto" in
18060                 REENTRANT_PROTO*) ;;
18061                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18062                 esac
18063                 echo "Prototype: $try" ;;
18064         esac
18065         ;;
18066         *)      case "$usethreads" in
18067                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18068                 esac
18069                 d_ttyname_r=undef
18070                 ttyname_r_proto=0
18071                 ;;
18072         esac
18073         ;;
18074 *)      ttyname_r_proto=0
18075         ;;
18076 esac
18077
18078 : see if tzname[] exists
18079 echo " "
18080 if set tzname val -a d_tzname; eval $csym; $val; then
18081         val="$define"
18082         echo 'tzname[] found.' >&4
18083 else
18084         val="$undef"
18085         echo 'tzname[] NOT found.' >&4
18086 fi
18087 set d_tzname
18088 eval $setvar
18089
18090 : Check if is a multiplatform env
18091 case "$osname" in
18092 next|rhapsody|darwin) multiarch="$define" ;;
18093 esac
18094 case "$multiarch" in
18095 ''|[nN]*) multiarch="$undef" ;;
18096 esac
18097
18098 : check for ordering of bytes in a UV
18099 echo " "
18100 case "$usecrosscompile$multiarch" in
18101 *$define*)
18102         $cat <<EOM
18103 You seem to be either cross-compiling or doing a multiarchitecture build,
18104 skipping the byteorder check.
18105
18106 EOM
18107         byteorder='ffff'
18108         ;;
18109 *)
18110         case "$byteorder" in
18111         '')
18112                 $cat <<'EOM'
18113 In the following, larger digits indicate more significance.  A big-endian
18114 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18115 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18116 machines may have weird orders like 3412.  A Cray will report 87654321,
18117 an Alpha will report 12345678. If the test program works the default is
18118 probably right.
18119 I'm now running the test program...
18120 EOM
18121                 $cat >try.c <<EOCP
18122 #include <stdio.h>
18123 #$i_stdlib I_STDLIB
18124 #ifdef I_STDLIB
18125 #include <stdlib.h>
18126 #endif
18127 #include <sys/types.h>
18128 typedef $uvtype UV;
18129 int main()
18130 {
18131         int i;
18132         union {
18133                 UV l;
18134                 char c[$uvsize];
18135         } u;
18136
18137         if ($uvsize > 4)
18138                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18139         else
18140                 u.l = (UV)0x04030201;
18141         for (i = 0; i < $uvsize; i++)
18142                 printf("%c", u.c[i]+'0');
18143         printf("\n");
18144         exit(0);
18145 }
18146 EOCP
18147                 xxx_prompt=y
18148                 set try
18149                 if eval $compile && $run ./try > /dev/null; then
18150                         dflt=`$run ./try`
18151                         case "$dflt" in
18152                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18153                                 echo "(The test program ran ok.)"
18154                                 echo "byteorder=$dflt"
18155                                 xxx_prompt=n
18156                         ;;
18157                         ????|????????) echo "(The test program ran ok.)" ;;
18158                         *) echo "(The test program didn't run right for some reason.)" ;;
18159                         esac
18160                 else
18161                         dflt='4321'
18162                         cat <<'EOM'
18163 (I can't seem to compile the test program.  Guessing big-endian...)
18164 EOM
18165                 fi
18166                 case "$xxx_prompt" in
18167                 y)
18168                         rp="What is the order of bytes in $uvtype?"
18169                         . ./myread
18170                         byteorder="$ans"
18171                         ;;
18172                 *)      byteorder=$dflt
18173                         ;;
18174                 esac
18175                 ;;
18176         esac
18177         $rm_try
18178         ;;
18179 esac
18180
18181 : Checking 32bit aligndness
18182 $cat <<EOM
18183
18184 Checking to see whether you can access character data unalignedly...
18185 EOM
18186 case "$d_u32align" in
18187 '')   $cat >try.c <<EOCP
18188 #include <stdio.h>
18189 #$i_stdlib I_STDLIB
18190 #ifdef I_STDLIB
18191 #include <stdlib.h>
18192 #endif
18193 #define U32 $u32type
18194 #define BYTEORDER 0x$byteorder
18195 #define U8 $u8type
18196 #include <signal.h>
18197 #ifdef SIGBUS
18198 $signal_t bletch(int s) { exit(4); }
18199 #endif
18200 int main() {
18201 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18202     U8 buf[8];
18203     U32 *up;
18204     int i;
18205
18206     if (sizeof(U32) != 4) {
18207         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18208         exit(1);
18209     }
18210
18211     fflush(stdout);
18212
18213 #ifdef SIGBUS
18214     signal(SIGBUS, bletch);
18215 #endif
18216
18217     buf[0] = 0;
18218     buf[1] = 0;
18219     buf[2] = 0;
18220     buf[3] = 1;
18221     buf[4] = 0;
18222     buf[5] = 0;
18223     buf[6] = 0;
18224     buf[7] = 1;
18225
18226     for (i = 0; i < 4; i++) {
18227         up = (U32*)(buf + i);
18228         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18229                (*up == 1 << (8*(3-i)))  /* little-endian */
18230               )
18231            )
18232         {
18233             printf("read failed (%x)\n", *up);
18234             exit(2);
18235         }
18236     }
18237
18238     /* write test */
18239     for (i = 0; i < 4; i++) {
18240         up = (U32*)(buf + i);
18241         *up = 0xBeef;
18242         if (*up != 0xBeef) {
18243             printf("write failed (%x)\n", *up);
18244             exit(3);
18245         }
18246     }
18247
18248     exit(0);
18249 #else
18250     printf("1\n");
18251     exit(1);
18252 #endif
18253     return 0;
18254 }
18255 EOCP
18256 set try
18257 if eval $compile_ok; then
18258         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18259         $run ./try 2>&1 >/dev/null
18260         case "$?" in
18261         0)      cat >&4 <<EOM
18262 You can access character data pretty unalignedly.
18263 EOM
18264                 d_u32align="$undef"
18265                 ;;
18266         *)      cat >&4 <<EOM
18267 It seems that you must access character data in an aligned manner.
18268 EOM
18269                 d_u32align="$define"
18270                 ;;
18271         esac
18272 else
18273         rp='Can you access character data at unaligned addresses?'
18274         dflt='n'
18275         . ./myread
18276         case "$ans" in
18277         [yY]*)  d_u32align="$undef"  ;;
18278         *)      d_u32align="$define" ;;
18279         esac
18280 fi
18281 $rm_try
18282 ;;
18283 esac
18284
18285 : see if ualarm exists
18286 set ualarm d_ualarm
18287 eval $inlibc
18288
18289 : see if umask exists
18290 set umask d_umask
18291 eval $inlibc
18292
18293 : see if unordered exists
18294 set unordered d_unordered
18295 eval $inlibc
18296
18297 : see if unsetenv exists
18298 set unsetenv d_unsetenv
18299 eval $inlibc
18300
18301 : see if usleep exists
18302 set usleep d_usleep
18303 eval $inlibc
18304
18305 : see if prototype for usleep is available
18306 echo " "
18307 set d_usleepproto usleep $i_unistd unistd.h
18308 eval $hasproto
18309
18310 : see if ustat exists
18311 set ustat d_ustat
18312 eval $inlibc
18313
18314 : see if closedir exists
18315 set closedir d_closedir
18316 eval $inlibc
18317
18318 case "$d_closedir" in
18319 "$define")
18320         echo " "
18321         echo "Checking whether closedir() returns a status..." >&4
18322         cat > try.c <<EOM
18323 #$i_dirent I_DIRENT             /**/
18324 #$i_sysdir I_SYS_DIR            /**/
18325 #$i_sysndir I_SYS_NDIR          /**/
18326 #$i_systypes I_SYS_TYPES        /**/
18327
18328 #if defined(I_SYS_TYPES)
18329 #include <sys/types.h>
18330 #endif
18331 #if defined(I_DIRENT)
18332 #include <dirent.h>
18333 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18334 #include <sys/dir.h>
18335 #endif
18336 #else
18337 #ifdef I_SYS_NDIR
18338 #include <sys/ndir.h>
18339 #else
18340 #ifdef I_SYS_DIR
18341 #ifdef hp9000s500
18342 #include <ndir.h>       /* may be wrong in the future */
18343 #else
18344 #include <sys/dir.h>
18345 #endif
18346 #endif
18347 #endif
18348 #endif
18349 int main() { return closedir(opendir(".")); }
18350 EOM
18351         set try
18352         if eval $compile_ok; then
18353                 if $run ./try > /dev/null 2>&1 ; then
18354                         echo "Yes, it does."
18355                         val="$undef"
18356                 else
18357                         echo "No, it doesn't."
18358                         val="$define"
18359                 fi
18360         else
18361                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18362                 val="$define"
18363         fi
18364         ;;
18365 *)
18366         val="$undef";
18367         ;;
18368 esac
18369 set d_void_closedir
18370 eval $setvar
18371 $rm_try
18372
18373 : see if there is a wait4
18374 set wait4 d_wait4
18375 eval $inlibc
18376
18377 : see if waitpid exists
18378 set waitpid d_waitpid
18379 eval $inlibc
18380
18381 : see if wcstombs exists
18382 set wcstombs d_wcstombs
18383 eval $inlibc
18384
18385 : see if wctomb exists
18386 set wctomb d_wctomb
18387 eval $inlibc
18388
18389 : see if writev exists
18390 set writev d_writev
18391 eval $inlibc
18392
18393 : preserve RCS keywords in files with variable substitution, grrr
18394 Date='$Date'
18395 Id='$Id'
18396 Log='$Log'
18397 RCSfile='$RCSfile'
18398 Revision='$Revision'
18399
18400 : check for alignment requirements
18401 echo " "
18402 case "$usecrosscompile$multiarch" in
18403 *$define*)
18404         $cat <<EOM
18405 You seem to be either cross-compiling or doing a multiarchitecture build,
18406 skipping the memory alignment check.
18407
18408 EOM
18409         case "$alignbytes" in
18410         '') alignbytes=8 ;;
18411         esac
18412         ;;
18413 *)
18414         case "$alignbytes" in
18415         '') echo "Checking alignment constraints..." >&4
18416                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18417                         $cat >try.c <<'EOCP'
18418 typedef long double NV;
18419 EOCP
18420                 else
18421                         $cat >try.c <<'EOCP'
18422 typedef double NV;
18423 EOCP
18424                 fi
18425                 $cat >>try.c <<'EOCP'
18426 #include <stdio.h>
18427 struct foobar {
18428         char foo;
18429         NV bar;
18430 } try_algn;
18431 int main()
18432 {
18433     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18434     return(0);
18435 }
18436 EOCP
18437                 set try
18438                 if eval $compile_ok; then
18439                         dflt=`$run ./try`
18440                 else
18441                         dflt='8'
18442                         echo "(I can't seem to compile the test program...)"
18443                 fi
18444                 ;;
18445         *) dflt="$alignbytes"
18446                 ;;
18447         esac
18448         rp="Doubles must be aligned on a how-many-byte boundary?"
18449         . ./myread
18450         alignbytes="$ans"
18451         $rm_try
18452         ;;
18453 esac
18454
18455
18456 : set the base revision
18457 baserev=5.0
18458
18459 : how do we concatenate cpp tokens here?
18460 echo " "
18461 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18462 $cat >cpp_stuff.c <<'EOCP'
18463 #define RCAT(a,b)a/**/b
18464 #define ACAT(a,b)a ## b
18465 RCAT(Rei,ser)
18466 ACAT(Cir,cus)
18467 EOCP
18468 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18469 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18470         echo "Oh!  Smells like ANSI's been here." >&4
18471         echo "We can catify or stringify, separately or together!"
18472         cpp_stuff=42
18473 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18474         echo "Ah, yes!  The good old days!" >&4
18475         echo "However, in the good old days we don't know how to stringify and"
18476         echo "catify at the same time."
18477         cpp_stuff=1
18478 else
18479         $cat >&4 <<EOM
18480 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18481 You're going to have to edit the values of CAT[2-5] in config.h...
18482 EOM
18483         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18484 fi
18485 $rm -f cpp_stuff.*
18486
18487 : see if this is a db.h system
18488 set db.h i_db
18489 eval $inhdr
18490
18491 case "$i_db" in
18492 $define)
18493         : Check db version.
18494         echo " "
18495         echo "Checking Berkeley DB version ..." >&4
18496         $cat >try.c <<EOCP
18497 #$d_const HASCONST
18498 #ifndef HASCONST
18499 #define const
18500 #endif
18501 #include <sys/types.h>
18502 #include <stdio.h>
18503 #$i_stdlib I_STDLIB
18504 #ifdef I_STDLIB
18505 #include <stdlib.h>
18506 #endif
18507 #include <db.h>
18508 int main(int argc, char *argv[])
18509 {
18510 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18511     int Major, Minor, Patch ;
18512     unsigned long Version ;
18513     (void)db_version(&Major, &Minor, &Patch) ;
18514     if (argc == 2) {
18515         printf("%d %d %d %d %d %d\n",
18516                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18517                Major, Minor, Patch);
18518         exit(0);
18519     }
18520     printf("You have Berkeley DB Version 2 or greater.\n");
18521
18522     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18523                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18524     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18525                 Major, Minor, Patch) ;
18526
18527     /* check that db.h & libdb are compatible */
18528     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18529         printf("db.h and libdb are incompatible.\n") ;
18530         exit(3);
18531     }
18532
18533     printf("db.h and libdb are compatible.\n") ;
18534
18535     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18536                 + DB_VERSION_PATCH ;
18537
18538     /* needs to be >= 2.3.4 */
18539     if (Version < 2003004) {
18540     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18541         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18542         exit(2);
18543     }
18544
18545     exit(0);
18546 #else
18547 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18548     if (argc == 2) {
18549         printf("1 0 0\n");
18550         exit(0);
18551     }
18552     printf("You have Berkeley DB Version 1.\n");
18553     exit(0);    /* DB version < 2: the coast is clear. */
18554 #else
18555     exit(1);    /* <db.h> not Berkeley DB? */
18556 #endif
18557 #endif
18558 }
18559 EOCP
18560         set try
18561         if eval $compile_ok && $run ./try; then
18562                 echo 'Looks OK.' >&4
18563                 set `$run ./try 1`
18564                 db_version_major=$1
18565                 db_version_minor=$2
18566                 db_version_patch=$3
18567         else
18568                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18569                 i_db=$undef
18570                 case " $libs " in
18571                 *"-ldb "*)
18572                         : Remove db from list of libraries to use
18573                         echo "Removing unusable -ldb from library list" >&4
18574                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18575                         shift
18576                         libs="$*"
18577                         echo "libs = $libs" >&4
18578                         ;;
18579                 esac
18580         fi
18581         $rm_try
18582         ;;
18583 esac
18584
18585 case "$i_db" in
18586 define)
18587         : Check the return type needed for hash
18588         echo " "
18589         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18590         $cat >try.c <<EOCP
18591 #$d_const HASCONST
18592 #ifndef HASCONST
18593 #define const
18594 #endif
18595 #include <sys/types.h>
18596 #include <db.h>
18597
18598 #ifndef DB_VERSION_MAJOR
18599 u_int32_t hash_cb (ptr, size)
18600 const void *ptr;
18601 size_t size;
18602 {
18603 }
18604 HASHINFO info;
18605 int main()
18606 {
18607         info.hash = hash_cb;
18608 }
18609 #endif
18610 EOCP
18611         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18612                 if $contains warning try.out >>/dev/null 2>&1 ; then
18613                         db_hashtype='int'
18614                 else
18615                         db_hashtype='u_int32_t'
18616                 fi
18617         else
18618                 : XXX Maybe we should just give up here.
18619                 db_hashtype=u_int32_t
18620                 $cat try.out >&4
18621                 echo "Help:  I can't seem to compile the db test program." >&4
18622                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18623         fi
18624         $rm_try
18625         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18626         ;;
18627 *)      db_hashtype=u_int32_t
18628         ;;
18629 esac
18630 case "$i_db" in
18631 define)
18632         : Check the return type needed for prefix
18633         echo " "
18634         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18635         cat >try.c <<EOCP
18636 #$d_const HASCONST
18637 #ifndef HASCONST
18638 #define const
18639 #endif
18640 #include <sys/types.h>
18641 #include <db.h>
18642
18643 #ifndef DB_VERSION_MAJOR
18644 size_t prefix_cb (key1, key2)
18645 const DBT *key1;
18646 const DBT *key2;
18647 {
18648 }
18649 BTREEINFO info;
18650 int main()
18651 {
18652         info.prefix = prefix_cb;
18653 }
18654 #endif
18655 EOCP
18656         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18657                 if $contains warning try.out >>/dev/null 2>&1 ; then
18658                         db_prefixtype='int'
18659                 else
18660                         db_prefixtype='size_t'
18661                 fi
18662         else
18663                 db_prefixtype='size_t'
18664                 : XXX Maybe we should just give up here.
18665                 $cat try.out >&4
18666                 echo "Help:  I can't seem to compile the db test program." >&4
18667                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18668         fi
18669         $rm_try
18670         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18671         ;;
18672 *)      db_prefixtype='size_t'
18673         ;;
18674 esac
18675
18676 : How can we generate normalized random numbers ?
18677 echo " "
18678 echo "Looking for a random number function..." >&4
18679 case "$randfunc" in
18680 '')
18681         if set drand48 val -f; eval $csym; $val; then
18682                 dflt="drand48"
18683                 echo "Good, found drand48()." >&4
18684         elif set random val -f; eval $csym; $val; then
18685                 dflt="random"
18686                 echo "OK, found random()." >&4
18687         else
18688                 dflt="rand"
18689                 echo "Yick, looks like I have to use rand()." >&4
18690         fi
18691         echo " "
18692         ;;
18693 *)
18694         dflt="$randfunc"
18695         ;;
18696 esac
18697 cont=true
18698
18699 case "$ccflags" in
18700 *-Dmy_rand=*|*-Dmy_srand=*)
18701         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18702         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18703         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18704         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18705         ;;
18706 esac
18707
18708 while $test "$cont"; do
18709         rp="Use which function to generate random numbers?"
18710         . ./myread
18711         if $test "$ans" = "$dflt"; then
18712                 : null
18713         else
18714                 randbits=''
18715         fi
18716         randfunc="$ans"
18717         if set $ans val -f; eval $csym; $val; then
18718                 cont=''
18719         else
18720                 dflt=y
18721                 rp="I cannot find function $ans. Use that name anyway?"
18722                 . ./myread
18723                 dflt=rand
18724                 case "$ans" in
18725                         [yY]*) cont='';;
18726                 esac
18727         fi
18728         case "$cont" in
18729         '')
18730                 case "$randfunc" in
18731                 drand48)
18732                         drand01="drand48()"
18733                         seedfunc="srand48"
18734                         randbits=48
18735                         randseedtype=long
18736                         ;;
18737                 rand|random)
18738                         case "$randbits" in
18739                         '')
18740 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18741                                 $cat >try.c <<EOCP
18742 #$i_unistd I_UNISTD
18743 #$i_stdlib I_STDLIB
18744 #include <stdio.h>
18745 #ifdef I_UNISTD
18746 #  include <unistd.h>
18747 #endif
18748 #ifdef I_STDLIB
18749 #  include <stdlib.h>
18750 #endif
18751 int main()
18752 {
18753         register int i;
18754         register unsigned long tmp;
18755         register unsigned long max = 0L;
18756
18757         for (i = 1000; i; i--) {
18758                 tmp = (unsigned long) $randfunc();
18759                 if (tmp > max) max = tmp;
18760         }
18761         for (i = 0; max; i++)
18762                 max /= 2;
18763         printf("%d\n",i);
18764 }
18765 EOCP
18766                                 set try
18767                                 if eval $compile_ok; then
18768                                         dflt=`try`
18769                                 else
18770                                         dflt='?'
18771                                         echo "(I can't seem to compile the test program...)"
18772                                 fi
18773                                 ;;
18774                         *)
18775                                 dflt="$randbits"
18776                                 ;;
18777                         esac
18778                         rp="How many bits does your $randfunc() function produce?"
18779                         . ./myread
18780                         randbits="$ans"
18781                         $rm_try
18782                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18783                         seedfunc="s$randfunc"
18784                         randseedtype=unsigned
18785                         ;;
18786                 *)
18787                         dflt="31"
18788                         rp="How many bits does your $randfunc() function produce?"
18789                         . ./myread
18790                         randbits="$ans"
18791                         seedfunc="s$randfunc"
18792                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18793                         if set $seedfunc val -f; eval $csym; $val; then
18794                                 echo "(Using $seedfunc() to seed random generator)"
18795                         else
18796                                 echo "(Warning: no $seedfunc() to seed random generator)"
18797                                 seedfunc=rand
18798                         fi
18799                         randseedtype=unsigned
18800                         ;;
18801                 esac
18802                 ;;
18803         esac
18804 done
18805
18806 : Determine if this is an EBCDIC system
18807 echo " "
18808 echo "Determining whether or not we are on an EBCDIC system..." >&4
18809 $cat >try.c <<'EOM'
18810 int main()
18811 {
18812   if ('M'==0xd4) return 0;
18813   return 1;
18814 }
18815 EOM
18816
18817 val=$undef
18818 set try
18819 if eval $compile_ok; then
18820         if $run ./try; then
18821                 echo "You seem to speak EBCDIC." >&4
18822                 val="$define"
18823         else
18824                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18825         fi
18826 else
18827         echo "I'm unable to compile the test program." >&4
18828         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18829 fi
18830 $rm_try
18831 set ebcdic
18832 eval $setvar
18833
18834 : Check how to flush
18835 echo " "
18836 $cat >&4 <<EOM
18837 Checking how to flush all pending stdio output...
18838 EOM
18839 # I only know how to find the first 32 possibly open files on SunOS.
18840 # See also hints/sunos_4_1.sh and util.c  --AD
18841 case "$osname" in
18842 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18843 esac
18844 $cat >>try.c <<EOCP
18845 #include <stdio.h>
18846 #$i_stdlib I_STDLIB
18847 #ifdef I_STDLIB
18848 #include <stdlib.h>
18849 #endif
18850 #$i_unistd I_UNISTD
18851 #ifdef I_UNISTD
18852 # include <unistd.h>
18853 #endif
18854 #$d_sysconf HAS_SYSCONF
18855 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18856 #ifdef HAS_STDIO_STREAM_ARRAY
18857 # define STDIO_STREAM_ARRAY $stdio_stream_array
18858 #endif
18859 int main() {
18860   FILE* p;
18861   unlink("try.out");
18862   p = fopen("try.out", "w");
18863 #ifdef TRY_FPUTC
18864   fputc('x', p);
18865 #else
18866 # ifdef TRY_FPRINTF
18867   fprintf(p, "x");
18868 # endif
18869 #endif
18870 #ifdef TRY_FFLUSH_NULL
18871   fflush(NULL);
18872 #endif
18873 #ifdef TRY_FFLUSH_ALL
18874   {
18875     long open_max = -1;
18876 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18877     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18878 # else
18879 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18880     open_max = sysconf(_SC_OPEN_MAX);
18881 #  else
18882 #   ifdef FOPEN_MAX
18883     open_max = FOPEN_MAX;
18884 #   else
18885 #    ifdef OPEN_MAX
18886     open_max = OPEN_MAX;
18887 #    else
18888 #     ifdef _NFILE
18889     open_max = _NFILE;
18890 #     endif
18891 #    endif
18892 #   endif
18893 #  endif
18894 # endif
18895 # ifdef HAS_STDIO_STREAM_ARRAY
18896     if (open_max > 0) {
18897       long i;
18898       for (i = 0; i < open_max; i++)
18899             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18900                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18901                 STDIO_STREAM_ARRAY[i]._flag)
18902                 fflush(&STDIO_STREAM_ARRAY[i]);
18903     }
18904   }
18905 # endif
18906 #endif
18907   _exit(42);
18908 }
18909 EOCP
18910 : first we have to find out how _not_ to flush
18911 $to try.c
18912 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18913     output=''
18914     set try -DTRY_FPUTC
18915     if eval $compile; then
18916             $run ./try 2>/dev/null
18917             code="$?"
18918             $from try.out
18919             if $test ! -s try.out -a "X$code" = X42; then
18920                 output=-DTRY_FPUTC
18921             fi
18922     fi
18923     case "$output" in
18924     '')
18925             set try -DTRY_FPRINTF
18926             if eval $compile; then
18927                     $run ./try 2>/dev/null
18928                     code="$?"
18929                     $from try.out
18930                     if $test ! -s try.out -a "X$code" = X42; then
18931                         output=-DTRY_FPRINTF
18932                     fi
18933             fi
18934         ;;
18935     esac
18936 fi
18937 : check for fflush NULL behaviour
18938 case "$fflushNULL" in
18939 '')     set try -DTRY_FFLUSH_NULL $output
18940         if eval $compile; then
18941                 $run ./try 2>/dev/null
18942                 code="$?"
18943                 $from try.out
18944                 if $test -s try.out -a "X$code" = X42; then
18945                         fflushNULL="`$cat try.out`"
18946                 else
18947                         if $test "X$code" != X42; then
18948                                 $cat >&4 <<EOM
18949 (If this test failed, don't worry, we'll try another method shortly.)
18950 EOM
18951                         fi
18952                 fi
18953         fi
18954         $rm_try
18955         case "$fflushNULL" in
18956         x)      $cat >&4 <<EOM
18957 Your fflush(NULL) works okay for output streams.
18958 Let's see if it clobbers input pipes...
18959 EOM
18960 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18961 # bug that improperly flushes the input end of pipes.  So we avoid the
18962 # autoflush on fork/system/exec support for now. :-(
18963 $cat >tryp.c <<EOCP
18964 #include <stdio.h>
18965 int
18966 main(int argc, char **argv)
18967 {
18968     char buf[1024];
18969     int i;
18970     char *bp = buf;
18971     while (1) {
18972         while ((i = getc(stdin)) != -1
18973                && (*bp++ = i) != '\n'
18974                && bp < &buf[1024])
18975         /* DO NOTHING */ ;
18976         *bp = '\0';
18977         fprintf(stdout, "%s", buf);
18978         fflush(NULL);
18979         if (i == -1)
18980             return 0;
18981         bp = buf;
18982     }
18983 }
18984 EOCP
18985                 fflushNULL="$define"
18986                 set tryp
18987                 if eval $compile; then
18988                     $rm -f tryp.out
18989                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18990                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18991                        $cat >&4 <<EOM
18992 fflush(NULL) seems to behave okay with input streams.
18993 EOM
18994                         fflushNULL="$define"
18995                     else
18996                         $cat >&4 <<EOM
18997 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18998 EOM
18999                         fflushNULL="$undef"
19000                     fi
19001                 fi
19002                 $rm -f core tryp.c tryp.core core.tryp.*
19003                 ;;
19004         '')     $cat >&4 <<EOM
19005 Your fflush(NULL) isn't working (contrary to ANSI C).
19006 EOM
19007                 fflushNULL="$undef"
19008                 ;;
19009         *)      $cat >&4 <<EOM
19010 Cannot figure out whether your fflush(NULL) works or not.
19011 I'm assuming it doesn't (contrary to ANSI C).
19012 EOM
19013                 fflushNULL="$undef"
19014                 ;;
19015         esac
19016         ;;
19017 $define|true|[yY]*)
19018         fflushNULL="$define"
19019         ;;
19020 *)
19021         fflushNULL="$undef"
19022         ;;
19023 esac
19024 : check explicit looping only if NULL did not work, and if the pipe
19025 : bug does not show up on an explicit flush too
19026 case "$fflushNULL" in
19027 "$undef")
19028         $cat >tryp.c <<EOCP
19029 #include <stdio.h>
19030 int
19031 main(int argc, char **argv)
19032 {
19033     char buf[1024];
19034     int i;
19035     char *bp = buf;
19036     while (1) {
19037         while ((i = getc(stdin)) != -1
19038                && (*bp++ = i) != '\n'
19039                && bp < &buf[1024])
19040         /* DO NOTHING */ ;
19041         *bp = '\0';
19042         fprintf(stdout, "%s", buf);
19043         fflush(stdin);
19044         if (i == -1)
19045             return 0;
19046         bp = buf;
19047     }
19048 }
19049 EOCP
19050         set tryp
19051         if eval $compile; then
19052             $rm -f tryp.out
19053             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19054             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19055                $cat >&4 <<EOM
19056 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19057 EOM
19058                 : now check for fflushall behaviour
19059                 case "$fflushall" in
19060                 '')     set try -DTRY_FFLUSH_ALL $output
19061                         if eval $compile; then
19062                                 $cat >&4 <<EOM
19063 (Now testing the other method--but note that this also may fail.)
19064 EOM
19065                                 $run ./try 2>/dev/null
19066                                 code=$?
19067                                 $from try.out
19068                                 if $test -s try.out -a "X$code" = X42; then
19069                                         fflushall="`$cat try.out`"
19070                                 fi
19071                         fi
19072                         $rm_try
19073                         case "$fflushall" in
19074                         x)      $cat >&4 <<EOM
19075 Whew. Flushing explicitly all the stdio streams works.
19076 EOM
19077                                 fflushall="$define"
19078                                 ;;
19079                         '')     $cat >&4 <<EOM
19080 Sigh. Flushing explicitly all the stdio streams doesn't work.
19081 EOM
19082                                 fflushall="$undef"
19083                                 ;;
19084                         *)      $cat >&4 <<EOM
19085 Cannot figure out whether flushing stdio streams explicitly works or not.
19086 I'm assuming it doesn't.
19087 EOM
19088                                 fflushall="$undef"
19089                                 ;;
19090                         esac
19091                         ;;
19092                 "$define"|true|[yY]*)
19093                         fflushall="$define"
19094                         ;;
19095                 *)
19096                         fflushall="$undef"
19097                         ;;
19098                 esac
19099             else
19100                 $cat >&4 <<EOM
19101 All is futile.  Even fflush(stdin) clobbers input pipes!
19102 EOM
19103                 fflushall="$undef"
19104             fi
19105         else
19106             fflushall="$undef"
19107         fi
19108         $rm -f core tryp.c tryp.core core.tryp.*
19109         ;;
19110 *)      fflushall="$undef"
19111         ;;
19112 esac
19113
19114 case "$fflushNULL$fflushall" in
19115 undefundef)
19116         $cat <<EOM
19117 OK, I give up.  I cannot figure out how to flush pending stdio output.
19118 We won't be flushing handles at all before fork/exec/popen.
19119 EOM
19120         ;;
19121 esac
19122 $rm_try tryp
19123
19124 : Store the full pathname to the ar program for use in the C program
19125 : Respect a hint or command line value for full_ar.
19126 case "$full_ar" in
19127 '') full_ar=$ar ;;
19128 esac
19129
19130 : Store the full pathname to the sed program for use in the C program
19131 full_sed=$sed
19132
19133 : see what type gids are declared as in the kernel
19134 echo " "
19135 echo "Looking for the type for group ids returned by getgid()."
19136 set gid_t gidtype xxx stdio.h sys/types.h
19137 eval $typedef
19138 case "$gidtype" in
19139 xxx)
19140         xxx=`./findhdr sys/user.h`
19141         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19142         case $1 in
19143         unsigned) dflt="$1 $2" ;;
19144         *) dflt="$1" ;;
19145         esac
19146         ;;
19147 *) dflt="$gidtype";;
19148 esac
19149 case "$gidtype" in
19150 gid_t) echo "gid_t found." ;;
19151 *)      rp="What is the type for group ids returned by getgid()?"
19152         . ./myread
19153         gidtype="$ans"
19154         ;;
19155 esac
19156
19157 : Check the size of GID
19158 echo " "
19159 case "$gidtype" in
19160 *_t) zzz="$gidtype"     ;;
19161 *)   zzz="gid"          ;;
19162 esac
19163 echo "Checking the size of $zzz..." >&4
19164 cat > try.c <<EOCP
19165 #include <sys/types.h>
19166 #include <stdio.h>
19167 #$i_stdlib I_STDLIB
19168 #ifdef I_STDLIB
19169 #include <stdlib.h>
19170 #endif
19171 int main() {
19172     printf("%d\n", (int)sizeof($gidtype));
19173     exit(0);
19174 }
19175 EOCP
19176 set try
19177 if eval $compile_ok; then
19178         yyy=`$run ./try`
19179         case "$yyy" in
19180         '')     gidsize=4
19181                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19182                 ;;
19183         *)      gidsize=$yyy
19184                 echo "Your $zzz is $gidsize bytes long."
19185                 ;;
19186         esac
19187 else
19188         gidsize=4
19189         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19190 fi
19191
19192
19193 : Check if GID is signed
19194 echo " "
19195 case "$gidtype" in
19196 *_t) zzz="$gidtype"     ;;
19197 *)   zzz="gid"          ;;
19198 esac
19199 echo "Checking the sign of $zzz..." >&4
19200 cat > try.c <<EOCP
19201 #include <sys/types.h>
19202 #include <stdio.h>
19203 int main() {
19204         $gidtype foo = -1;
19205         if (foo < 0)
19206                 printf("-1\n");
19207         else
19208                 printf("1\n");
19209 }
19210 EOCP
19211 set try
19212 if eval $compile; then
19213         yyy=`$run ./try`
19214         case "$yyy" in
19215         '')     gidsign=1
19216                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19217                 ;;
19218         *)      gidsign=$yyy
19219                 case "$gidsign" in
19220                  1) echo "Your $zzz is unsigned." ;;
19221                 -1) echo "Your $zzz is signed."   ;;
19222                 esac
19223                 ;;
19224         esac
19225 else
19226         gidsign=1
19227         echo "(I can't compile the test program--guessing unsigned.)" >&4
19228 fi
19229
19230
19231 : Check 64bit sizes
19232 echo " "
19233
19234 if $test X"$quadtype" != X; then
19235
19236 echo "Checking how to print 64-bit integers..." >&4
19237
19238 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19239         $cat >try.c <<'EOCP'
19240 #include <sys/types.h>
19241 #include <stdio.h>
19242 int main() {
19243   int q = 12345678901;
19244   printf("%ld\n", q);
19245 }
19246 EOCP
19247         set try
19248         if eval $compile; then
19249                 yyy=`$run ./try`
19250                 case "$yyy" in
19251                 12345678901)
19252                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19253                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19254                         echo "We will use %d."
19255                         ;;
19256                 esac
19257         fi
19258 fi
19259
19260 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19261         $cat >try.c <<'EOCP'
19262 #include <sys/types.h>
19263 #include <stdio.h>
19264 int main() {
19265   long q = 12345678901;
19266   printf("%ld\n", q);
19267 }
19268 EOCP
19269         set try
19270         if eval $compile; then
19271                 yyy=`$run ./try`
19272                 case "$yyy" in
19273                 12345678901)
19274                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19275                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19276                         echo "We will use %ld."
19277                         ;;
19278                 esac
19279         fi
19280 fi
19281
19282 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19283         $cat >try.c <<'EOCP'
19284 #include <sys/types.h>
19285 #include <inttypes.h>
19286 #include <stdio.h>
19287 int main() {
19288   int64_t q = 12345678901;
19289   printf("%" PRId64 "\n", q);
19290 }
19291 EOCP
19292         set try
19293         if eval $compile; then
19294                 yyy=`$run ./try`
19295                 case "$yyy" in
19296                 12345678901)
19297                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19298                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19299                         echo "We will use the C9X style."
19300                         ;;
19301                 esac
19302         fi
19303 fi
19304
19305 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19306         $cat >try.c <<EOCP
19307 #include <sys/types.h>
19308 #include <stdio.h>
19309 int main() {
19310   $quadtype q = 12345678901;
19311   printf("%Ld\n", q);
19312 }
19313 EOCP
19314         set try
19315         if eval $compile; then
19316                 yyy=`$run ./try`
19317                 case "$yyy" in
19318                 12345678901)
19319                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19320                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19321                         echo "We will use %Ld."
19322                         ;;
19323                 esac
19324         fi
19325 fi
19326
19327 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19328         $cat >try.c <<'EOCP'
19329 #include <sys/types.h>
19330 #include <stdio.h>
19331 int main() {
19332   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19333   printf("%lld\n", q);
19334 }
19335 EOCP
19336         set try
19337         if eval $compile; then
19338                 yyy=`$run ./try`
19339                 case "$yyy" in
19340                 12345678901)
19341                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19342                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19343                         echo "We will use the %lld style."
19344                         ;;
19345                 esac
19346         fi
19347 fi
19348
19349 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19350         $cat >try.c <<EOCP
19351 #include <sys/types.h>
19352 #include <stdio.h>
19353 int main() {
19354   $quadtype q = 12345678901;
19355   printf("%qd\n", q);
19356 }
19357 EOCP
19358         set try
19359         if eval $compile; then
19360                 yyy=`$run ./try`
19361                 case "$yyy" in
19362                 12345678901)
19363                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19364                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19365                         echo "We will use %qd."
19366                         ;;
19367                 esac
19368         fi
19369 fi
19370
19371 if $test X"$sPRId64" = X; then
19372         echo "Cannot figure out how to print 64-bit integers." >&4
19373 fi
19374 $rm_try
19375
19376 fi
19377
19378 case "$sPRId64" in
19379 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19380         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19381         ;;
19382 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19383         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19384         ;;
19385 esac
19386
19387 : Check format strings for internal types
19388 echo " "
19389 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19390
19391 if $test X"$ivsize" = X8; then
19392         ivdformat="$sPRId64"
19393         uvuformat="$sPRIu64"
19394         uvoformat="$sPRIo64"
19395         uvxformat="$sPRIx64"
19396         uvXUformat="$sPRIXU64"
19397 else
19398         if $test X"$ivsize" = X"$longsize"; then
19399                 ivdformat='"ld"'
19400                 uvuformat='"lu"'
19401                 uvoformat='"lo"'
19402                 uvxformat='"lx"'
19403                 uvXUformat='"lX"'
19404         else
19405                 if $test X"$ivsize" = X"$intsize"; then
19406                         ivdformat='"d"'
19407                         uvuformat='"u"'
19408                         uvoformat='"o"'
19409                         uvxformat='"x"'
19410                         uvXUformat='"X"'
19411                 else
19412                         : far out
19413                         if $test X"$ivsize" = X"$shortsize"; then
19414                                 ivdformat='"hd"'
19415                                 uvuformat='"hu"'
19416                                 uvoformat='"ho"'
19417                                 uvxformat='"hx"'
19418                                 uvXUformat='"hX"'
19419                         fi
19420                 fi
19421         fi
19422 fi
19423
19424 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19425         nveformat="$sPRIeldbl"
19426         nvfformat="$sPRIfldbl"
19427         nvgformat="$sPRIgldbl"
19428         nvEUformat="$sPRIEUldbl"
19429         nvFUformat="$sPRIFUldbl"
19430         nvGUformat="$sPRIGUldbl"
19431 else
19432         nveformat='"e"'
19433         nvfformat='"f"'
19434         nvgformat='"g"'
19435         nvEUformat='"E"'
19436         nvFUformat='"F"'
19437         nvGUformat='"G"'
19438 fi
19439
19440 case "$ivdformat" in
19441 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19442     exit 1
19443     ;;
19444 esac
19445
19446 : Check format string for GID
19447
19448 echo " "
19449 $echo "Checking the format string to be used for gids..." >&4
19450
19451 case "$gidsign" in
19452 -1)     if $test X"$gidsize" = X"$ivsize"; then
19453                 gidformat="$ivdformat"
19454         else
19455                 if $test X"$gidsize" = X"$longsize"; then
19456                         gidformat='"ld"'
19457                 else
19458                         if $test X"$gidsize" = X"$intsize"; then
19459                                 gidformat='"d"'
19460                         else
19461                                 if $test X"$gidsize" = X"$shortsize"; then
19462                                         gidformat='"hd"'
19463                                 fi
19464                         fi
19465                 fi
19466         fi
19467         ;;
19468 *)      if $test X"$gidsize" = X"$uvsize"; then
19469                 gidformat="$uvuformat"
19470         else
19471                 if $test X"$gidsize" = X"$longsize"; then
19472                         gidformat='"lu"'
19473                 else
19474                         if $test X"$gidsize" = X"$intsize"; then
19475                                 gidformat='"u"'
19476                         else
19477                                 if $test X"$gidsize" = X"$shortsize"; then
19478                                         gidformat='"hu"'
19479                                 fi
19480                         fi
19481                 fi
19482         fi
19483         ;;
19484 esac
19485
19486 : see if getgroups exists
19487 set getgroups d_getgrps
19488 eval $inlibc
19489
19490 : see if setgroups exists
19491 set setgroups d_setgrps
19492 eval $inlibc
19493
19494 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19495 echo " "
19496 case "$d_getgrps$d_setgrps" in
19497 *define*)
19498         case "$groupstype" in
19499         '') dflt="$gidtype" ;;
19500         *)  dflt="$groupstype" ;;
19501         esac
19502         $cat <<EOM
19503 What type of pointer is the second argument to getgroups() and setgroups()?
19504 Usually this is the same as group ids, $gidtype, but not always.
19505
19506 EOM
19507         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19508         . ./myread
19509         groupstype="$ans"
19510         ;;
19511 *)  groupstype="$gidtype";;
19512 esac
19513
19514 : MAD = Misc Attribute Definition
19515
19516 if $test $patchlevel -lt 9; then
19517 : MAD is not available in 5.8.x or earlier.
19518     ans=n;
19519 else
19520     case "$mad" in
19521     $define|true|[yY]*) dflt='y' ;;
19522     *)                  dflt='n' ;;
19523     esac
19524     cat <<EOM
19525
19526 Would you like to build with Misc Attribute Decoration? This is development
19527 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19528 overhead on the interpreter.
19529
19530 If this doesn't make any sense to you, just accept the default '$dflt'.
19531 EOM
19532     rp='Build Perl with MAD?'
19533     . ./myread
19534 fi
19535 case "$ans" in
19536 y|Y)    val="$define"
19537         madlyh='madly.h madly.act madly.tab'
19538         madlysrc='madly.c'
19539         madlyobj="madly$_o" ;;
19540 *)      val="$undef"
19541         madlyh=''
19542         madlysrc=''
19543         madlyobj='' ;;
19544 esac
19545 set mad
19546 eval $setvar
19547
19548 echo " "
19549 echo "Checking if your $make program sets \$(MAKE)..." >&4
19550 case "$make_set_make" in
19551 '')
19552         $sed 's/^X //' > testmake.mak << 'EOF'
19553 Xall:
19554 X       @echo 'maketemp="$(MAKE)"'
19555 EOF
19556         case "`$make -f testmake.mak 2>/dev/null`" in
19557         *maketemp=*) make_set_make='#' ;;
19558         *)      make_set_make="MAKE=$make" ;;
19559         esac
19560         $rm -f testmake.mak
19561         ;;
19562 esac
19563 case "$make_set_make" in
19564 '#') echo "Yup, it does.";;
19565 *) echo "Nope, it doesn't.";;
19566 esac
19567
19568 : see what type is used for mode_t
19569 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19570 set mode_t modetype int stdio.h sys/types.h
19571 eval $typedef_ask
19572
19573 : see if we need va_copy
19574 echo " "
19575 case "$i_stdarg" in
19576 "$define")
19577         $cat >try.c <<EOCP
19578 #include <stdarg.h>
19579 #include <stdio.h>
19580 #$i_stdlib I_STDLIB
19581 #ifdef I_STDLIB
19582 #include <stdlib.h>
19583 #endif
19584 #include <signal.h>
19585
19586 int
19587 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19588 {
19589   return vfprintf(f, fmt, *valp);
19590 }
19591
19592 int
19593 myvfprintf(FILE *f, const  char *fmt, va_list val)
19594 {
19595   return ivfprintf(f, fmt, &val);
19596 }
19597
19598 int
19599 myprintf(char *fmt, ...)
19600 {
19601   va_list val;
19602   va_start(val, fmt);
19603   return myvfprintf(stdout, fmt, val);
19604 }
19605
19606 int
19607 main(int ac, char **av)
19608 {
19609   signal(SIGSEGV, exit);
19610
19611   myprintf("%s%cs all right, then\n", "that", '\'');
19612   exit(0);
19613 }
19614 EOCP
19615         set try
19616         if eval $compile && $run ./try 2>&1 >/dev/null; then
19617                 case "`$run ./try`" in
19618                 "that's all right, then")
19619                         okay=yes
19620                         ;;
19621                 esac
19622         fi
19623         case "$okay" in
19624         yes)    echo "It seems that you don't need va_copy()." >&4
19625                 need_va_copy="$undef"
19626                 ;;
19627         *)      echo "It seems that va_copy() or similar will be needed." >&4
19628                 need_va_copy="$define"
19629                 ;;
19630         esac
19631         $rm_try
19632         ;;
19633 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19634         ;;
19635 esac
19636
19637 : see what type is used for size_t
19638 rp="What is the type used for the length parameter for string functions?"
19639 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19640 eval $typedef_ask
19641
19642 : check for type of arguments to gethostbyaddr. 
19643 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19644         case "$d_gethbyaddr" in
19645         $define)
19646                 $cat <<EOM
19647
19648 Checking to see what type of arguments are accepted by gethostbyaddr().
19649 EOM
19650                 hdrs="$define sys/types.h
19651                         $d_socket sys/socket.h 
19652                         $i_niin netinet/in.h 
19653                         $i_netdb netdb.h
19654                         $i_unistd unistd.h"
19655                 : The first arg can 'char *' or 'void *'
19656                 : The second arg is some of integral type
19657                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19658                         for yyy in size_t long int; do
19659                                 case "$netdb_host_type" in
19660                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19661                                         if ./protochk "$try" $hdrs; then
19662                                                 echo "Your system accepts $xxx for the first arg."
19663                                                 echo "...and $yyy for the second arg."
19664                                                 netdb_host_type="$xxx"
19665                                                 netdb_hlen_type="$yyy"
19666                                         fi
19667                                         ;;
19668                                 esac
19669                         done
19670                 done
19671                 : In case none of those worked, prompt the user.
19672                 case "$netdb_host_type" in
19673                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19674                         dflt='char *'
19675                         . ./myread
19676                         netdb_host_type=$ans
19677                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19678                         dflt="$sizetype"
19679                         . ./myread
19680                         netdb_hlen_type=$ans
19681                         ;;
19682                 esac
19683                 ;;
19684         *)      : no gethostbyaddr, so pick harmless defaults
19685                 netdb_host_type='char *'
19686                 netdb_hlen_type="$sizetype"
19687                 ;;
19688         esac
19689         # Remove the "const" if needed. -- but then we'll have a 
19690         # prototype clash!
19691         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19692 fi
19693
19694 : check for type of argument to gethostbyname. 
19695 if test "X$netdb_name_type" = X ; then
19696         case "$d_gethbyname" in
19697         $define)
19698                 $cat <<EOM
19699
19700 Checking to see what type of argument is accepted by gethostbyname().
19701 EOM
19702                 hdrs="$define sys/types.h
19703                         $d_socket sys/socket.h 
19704                         $i_niin netinet/in.h 
19705                         $i_netdb netdb.h
19706                         $i_unistd unistd.h"
19707                 for xxx in "const char *" "char *"; do
19708                         case "$netdb_name_type" in
19709                         '')     try="extern struct hostent *gethostbyname($xxx);"
19710                                 if ./protochk "$try" $hdrs; then
19711                                         echo "Your system accepts $xxx."
19712                                         netdb_name_type="$xxx"
19713                                 fi
19714                                 ;;
19715                         esac
19716                 done
19717                 : In case none of those worked, prompt the user.
19718                 case "$netdb_name_type" in
19719                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19720                         dflt='char *'
19721                         . ./myread
19722                         netdb_name_type=$ans
19723                         ;;
19724                 esac
19725                 ;;
19726         *)      : no gethostbyname, so pick harmless default
19727                 netdb_name_type='char *'
19728                 ;;
19729         esac
19730 fi
19731
19732 : check for type of 1st argument to getnetbyaddr. 
19733 if test "X$netdb_net_type" = X ; then
19734         case "$d_getnbyaddr" in
19735         $define)
19736                 $cat <<EOM
19737
19738 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19739 EOM
19740                 hdrs="$define sys/types.h
19741                         $d_socket sys/socket.h 
19742                         $i_niin netinet/in.h 
19743                         $i_netdb netdb.h
19744                         $i_unistd unistd.h"
19745                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19746                         case "$netdb_net_type" in
19747                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19748                                 if ./protochk "$try" $hdrs; then
19749                                         echo "Your system accepts $xxx."
19750                                         netdb_net_type="$xxx"
19751                                 fi
19752                                 ;;
19753                         esac
19754                 done
19755                 : In case none of those worked, prompt the user.
19756                 case "$netdb_net_type" in
19757                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19758                         dflt='long'
19759                         . ./myread
19760                         netdb_net_type=$ans
19761                         ;;
19762                 esac
19763                 ;;
19764         *)      : no getnetbyaddr, so pick harmless default
19765                 netdb_net_type='long'
19766                 ;;
19767         esac
19768 fi
19769 : locate the preferred pager for this system
19770 fn=f/
19771 case "$pager" in
19772 '')
19773         dflt=''
19774         case "$pg" in
19775         /*) dflt=$pg;;
19776         [a-zA-Z]:/*) dflt=$pg;;
19777         esac
19778         case "$more" in
19779         /*) dflt=$more;;
19780         [a-zA-Z]:/*) dflt=$more;;
19781         esac
19782         case "$less" in
19783         /*) dflt=$less;;
19784         [a-zA-Z]:/*) dflt=$less;;
19785         esac
19786         case "$dflt" in
19787         '') dflt=/usr/ucb/more;;
19788         esac
19789         ;;
19790 *)      dflt="$pager"
19791         : Instruct ./getfile to trust the hinted or previous pager value,
19792         : even if it does not begin with a slash.  For example, on os2,
19793         : pager might be cmd /c more.  See comments in UU/getfile.
19794         fn="f/($pager)"
19795         ;;
19796 esac
19797 echo " "
19798 rp='What pager is used on your system?'
19799 . ./getfile
19800 pager="$ans"
19801
19802 : see what type pids are declared as in the kernel
19803 rp="What is the type of process ids on this system?"
19804 set pid_t pidtype int stdio.h sys/types.h
19805 eval $typedef_ask
19806
19807 : see if ar generates random libraries by itself
19808 echo " "
19809 echo "Checking how to generate random libraries on your machine..." >&4
19810 echo 'int bar1() { return bar2(); }' > bar1.c
19811 echo 'int bar2() { return 2; }' > bar2.c
19812 $cat > foo.c <<EOP
19813 #$i_stdlib I_STDLIB
19814 #ifdef I_STDLIB
19815 #include <stdlib.h>
19816 #endif
19817 int main() { printf("%d\n", bar1()); exit(0); }
19818 EOP
19819 $cc $ccflags -c bar1.c >/dev/null 2>&1
19820 $cc $ccflags -c bar2.c >/dev/null 2>&1
19821 $cc $ccflags -c foo.c >/dev/null 2>&1
19822 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19823 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19824         $run ./foobar >/dev/null 2>&1; then
19825         echo "$ar appears to generate random libraries itself."
19826         orderlib=false
19827         if [ "X$ranlib" = "X" ]; then
19828             ranlib=":"
19829         fi
19830 elif $ar s bar$_a >/dev/null 2>&1 &&
19831         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19832         $run ./foobar >/dev/null 2>&1; then
19833                 echo "a table of contents needs to be added with '$ar s'."
19834                 orderlib=false
19835                 ranlib="$ar s"
19836 elif $ar ts bar$_a >/dev/null 2>&1 &&
19837         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19838         $run ./foobar >/dev/null 2>&1; then
19839                 echo "a table of contents needs to be added with '$ar ts'."
19840                 orderlib=false
19841                 ranlib="$ar ts"
19842 else
19843         case "$ranlib" in
19844         :) ranlib='';;
19845         '')
19846                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19847                 $test -f $ranlib || ranlib=''
19848                 ;;
19849         esac
19850         if $test -n "$ranlib"; then
19851                 echo "your system has '$ranlib'; we'll use that."
19852                 orderlib=false
19853         else
19854                 echo "your system doesn't seem to support random libraries"
19855                 echo "so we'll use lorder and tsort to order the libraries."
19856                 orderlib=true
19857                 ranlib=":"
19858         fi
19859 fi
19860 $rm -f foo* bar*
19861
19862 : check for type of arguments to select.
19863 case "$selecttype" in
19864 '') case "$d_select" in
19865         $define)
19866                 echo " "
19867                 $cat <<EOM
19868 Checking to see what type of arguments are accepted by select().
19869 EOM
19870                 hdrs="$define sys/types.h
19871                         $i_systime sys/time.h
19872                         $i_sysselct sys/select.h
19873                         $d_socket sys/socket.h"
19874                 : The first arg can be int, unsigned, or size_t
19875                 : The last arg may or may not be 'const'
19876                 val=''
19877                 : void pointer has been seen but using that
19878                 : breaks the selectminbits test
19879                 for xxx in 'fd_set *' 'int *'; do
19880                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19881                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19882                                         case "$val" in
19883                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19884                                                 if ./protochk "$try" $hdrs; then
19885                                                         echo "Your system accepts $xxx."
19886                                                         val="$xxx"
19887                                                 fi
19888                                                 ;;
19889                                         esac
19890                                 done
19891                         done
19892                 done
19893                 case "$val" in
19894                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19895                         case "$d_fd_set" in
19896                                 $define) dflt="fd_set *" ;;
19897                                 *)              dflt="int *" ;;
19898                         esac
19899                         . ./myread
19900                         val=$ans
19901                         ;;
19902                 esac
19903                 selecttype="$val"
19904                 ;;
19905         *)      : no select, so pick a harmless default
19906                 selecttype='int *'
19907                 ;;
19908         esac
19909         ;;
19910 esac
19911
19912 : check for the select 'width'
19913 case "$selectminbits" in
19914 '') safebits=`expr $ptrsize \* 8`
19915     case "$d_select" in
19916         $define)
19917                 $cat <<EOM
19918
19919 Checking to see on how many bits at a time your select() operates...
19920 EOM
19921                 $cat >try.c <<EOCP
19922 #include <sys/types.h>
19923 #$i_time I_TIME
19924 #$i_systime I_SYS_TIME
19925 #$i_systimek I_SYS_TIME_KERNEL
19926 #ifdef I_TIME
19927 #   include <time.h>
19928 #endif
19929 #ifdef I_SYS_TIME
19930 #   ifdef I_SYS_TIME_KERNEL
19931 #       define KERNEL
19932 #   endif
19933 #   include <sys/time.h>
19934 #   ifdef I_SYS_TIME_KERNEL
19935 #       undef KERNEL
19936 #   endif
19937 #endif
19938 #$i_sysselct I_SYS_SELECT
19939 #ifdef I_SYS_SELECT
19940 #include <sys/select.h>
19941 #endif
19942 #$d_socket HAS_SOCKET
19943 #ifdef HAS_SOCKET
19944 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19945 #endif
19946 #include <stdio.h>
19947 #$i_stdlib I_STDLIB
19948 #ifdef I_STDLIB
19949 #include <stdlib.h>
19950 #endif
19951 $selecttype b;
19952 #define S sizeof(*(b))
19953 #define MINBITS 64
19954 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19955 #define NBITS  (NBYTES * 8)
19956 int main() {
19957     char *s = (char *)malloc(NBYTES);
19958     struct timeval t;
19959     int i;
19960     FILE* fp;
19961     int fd;
19962
19963     if (!s)
19964         exit(1);
19965     fclose(stdin);
19966     fp = fopen("try.c", "r");
19967     if (fp == 0)
19968       exit(2);
19969     fd = fileno(fp);
19970     if (fd < 0)
19971       exit(3);
19972     b = ($selecttype)s;
19973     for (i = 0; i < NBITS; i++)
19974         FD_SET(i, b);
19975     t.tv_sec  = 0;
19976     t.tv_usec = 0;
19977     select(fd + 1, b, 0, 0, &t);
19978     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19979     free(s);
19980     printf("%d\n", i + 1);
19981     return 0;
19982 }
19983 EOCP
19984                 set try
19985                 if eval $compile_ok; then
19986                         selectminbits=`$run ./try`
19987                         case "$selectminbits" in
19988                         '')     cat >&4 <<EOM
19989 Cannot figure out on how many bits at a time your select() operates.
19990 I'll play safe and guess it is $safebits bits.
19991 EOM
19992                                 selectminbits=$safebits
19993                                 bits="$safebits bits"
19994                                 ;;
19995                         1)      bits="1 bit" ;;
19996                         *)      bits="$selectminbits bits" ;;
19997                         esac
19998                         echo "Your select() operates on $bits at a time." >&4
19999                 else
20000                         rp='What is the minimum number of bits your select() operates on?'
20001                         case "$byteorder" in
20002                         12345678)       dflt=64 ;;
20003                         1234)           dflt=32 ;;
20004                         *)              dflt=1  ;;
20005                         esac
20006                         . ./myread
20007                         val=$ans
20008                         selectminbits="$val"
20009                 fi
20010                 $rm_try
20011                 ;;
20012         *)      : no select, so pick a harmless default
20013                 selectminbits=$safebits
20014                 ;;
20015         esac
20016         ;;
20017 esac
20018
20019 : Trace out the files included by signal.h, then look for SIGxxx names.
20020 if [ "X$fieldn" = X ]; then
20021         : Just make some guesses.  We check them later.
20022         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20023 else
20024         xxx=`echo '#include <signal.h>' |
20025         $cppstdin $cppminus $cppflags 2>/dev/null |
20026         $grep '^[       ]*#.*include' |
20027         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20028                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20029 fi
20030 xxxfiles=''
20031 for xx in $xxx /dev/null ; do
20032         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20033 done
20034 case "$xxxfiles" in
20035 '')     xxxfiles=`./findhdr signal.h` ;;
20036 esac
20037 xxx=`awk '
20038 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20039         print substr($2, 4, 20)
20040 }
20041 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20042         print substr($3, 4, 20)
20043 }' $xxxfiles`
20044 : Append some common names just in case the awk scan failed.
20045 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20046 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20047 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20048 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20049 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20050
20051 : generate a few handy files for later
20052 $cat > signal.c <<EOCP
20053 #include <sys/types.h>
20054 #include <signal.h>
20055 #$i_stdlib I_STDLIB
20056 #ifdef I_STDLIB
20057 #include <stdlib.h>
20058 #endif
20059 #include <stdio.h>
20060 int main() {
20061
20062 /* Strange style to avoid deeply-nested #if/#else/#endif */
20063 #ifndef NSIG
20064 #  ifdef _NSIG
20065 #    define NSIG (_NSIG)
20066 #  endif
20067 #endif
20068
20069 #ifndef NSIG
20070 #  ifdef SIGMAX
20071 #    define NSIG (SIGMAX+1)
20072 #  endif
20073 #endif
20074
20075 #ifndef NSIG
20076 #  ifdef SIG_MAX
20077 #    define NSIG (SIG_MAX+1)
20078 #  endif
20079 #endif
20080
20081 #ifndef NSIG
20082 #  ifdef _SIG_MAX
20083 #    define NSIG (_SIG_MAX+1)
20084 #  endif
20085 #endif
20086
20087 #ifndef NSIG
20088 #  ifdef MAXSIG
20089 #    define NSIG (MAXSIG+1)
20090 #  endif
20091 #endif
20092
20093 #ifndef NSIG
20094 #  ifdef MAX_SIG
20095 #    define NSIG (MAX_SIG+1)
20096 #  endif
20097 #endif
20098
20099 #ifndef NSIG
20100 #  ifdef SIGARRAYSIZE
20101 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20102 #  endif
20103 #endif
20104
20105 #ifndef NSIG
20106 #  ifdef _sys_nsig
20107 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20108 #  endif
20109 #endif
20110
20111 /* Default to some arbitrary number that's big enough to get most
20112    of the common signals.
20113 */
20114 #ifndef NSIG
20115 #    define NSIG 50
20116 #endif
20117
20118 printf("NSIG %d\n", NSIG);
20119
20120 #ifndef JUST_NSIG
20121
20122 EOCP
20123
20124 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20125 {
20126         printf "#ifdef SIG"; printf $1; printf "\n"
20127         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20128         printf $1; printf ");\n"
20129         printf "#endif\n"
20130 }
20131 END {
20132         printf "#endif /* JUST_NSIG */\n";
20133         printf "exit(0);\n}\n";
20134 }
20135 ' >>signal.c
20136 $cat >signal.awk <<'EOP'
20137 BEGIN { ndups = 0 }
20138 $1 ~ /^NSIG$/ { nsig = $2 }
20139 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20140     if ($2 > maxsig) { maxsig = $2 }
20141     if (sig_name[$2]) {
20142         dup_name[ndups] = $1
20143         dup_num[ndups] = $2
20144         ndups++
20145     }
20146     else {
20147         sig_name[$2] = $1
20148         sig_num[$2] = $2
20149     }
20150 }
20151 END {
20152     if (nsig == 0) {
20153         nsig = maxsig + 1
20154     }
20155     printf("NSIG %d\n", nsig);
20156     for (n = 1; n < nsig; n++) {
20157         if (sig_name[n]) {
20158             printf("%s %d\n", sig_name[n], sig_num[n])
20159         }
20160         else {
20161             printf("NUM%d %d\n", n, n)
20162         }
20163     }
20164     for (n = 0; n < ndups; n++) {
20165         printf("%s %d\n", dup_name[n], dup_num[n])
20166     }
20167 }
20168 EOP
20169 $cat >signal_cmd <<EOS
20170 $startsh
20171 if $test -s signal.lst; then
20172     echo "Using your existing signal.lst file"
20173         exit 0
20174 fi
20175 xxx="$xxx"
20176 EOS
20177 $cat >>signal_cmd <<'EOS'
20178
20179 set signal
20180 if eval $compile_ok; then
20181         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20182                 $uniq | $awk -f signal.awk >signal.lst
20183 else
20184         echo "(I can't seem be able to compile the whole test program)" >&4
20185         echo "(I'll try it in little pieces.)" >&4
20186         set signal -DJUST_NSIG
20187         if eval $compile_ok; then
20188                 $run ./signal$_exe > signal.nsg
20189                 $cat signal.nsg
20190         else
20191                 echo "I can't seem to figure out how many signals you have." >&4
20192                 echo "Guessing 50." >&4
20193                 echo 'NSIG 50' > signal.nsg
20194         fi
20195         : Now look at all the signal names, one at a time.
20196         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20197                 $cat > signal.c <<EOCP
20198 #include <sys/types.h>
20199 #include <signal.h>
20200 #include <stdio.h>
20201 int main() {
20202 printf("$xx %d\n", SIG${xx});
20203 return 0;
20204 }
20205 EOCP
20206                 set signal
20207                 if eval $compile; then
20208                         echo "SIG${xx} found."
20209                         $run ./signal$_exe  >> signal.ls1
20210                 else
20211                         echo "SIG${xx} NOT found."
20212                 fi
20213         done
20214         if $test -s signal.ls1; then
20215                 $cat signal.nsg signal.ls1 |
20216                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20217         fi
20218
20219 fi
20220 if $test -s signal.lst; then
20221         :
20222 else
20223         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20224         echo 'kill -l' >signal
20225         set X `csh -f <signal`
20226         $rm -f signal
20227         shift
20228         case $# in
20229         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20230         esac
20231         echo $@ | $tr ' ' $trnl | \
20232             $awk '{ printf "%s %d\n", $1, ++s; }
20233                   END { printf "NSIG %d\n", ++s }' >signal.lst
20234 fi
20235 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20236 EOS
20237 chmod a+x signal_cmd
20238 $eunicefix signal_cmd
20239
20240 : generate list of signal names
20241 echo " "
20242 case "$sig_name_init" in
20243 '') doinit=yes ;;
20244 *)  case "$sig_num_init" in
20245     ''|*,*) doinit=yes ;;
20246     esac ;;
20247 esac
20248 case "$doinit" in
20249 yes)
20250         echo "Generating a list of signal names and numbers..." >&4
20251         . ./signal_cmd
20252         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20253         sig_name=`$awk 'BEGIN { printf "ZERO " }
20254                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20255         sig_num=`$awk  'BEGIN { printf "0 " }
20256                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20257         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20258                              !/^NSIG/   { printf "\"%s\", ", $1 }
20259                              END        { printf "0\n" }' signal.lst`
20260         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20261                              !/^NSIG/   { printf "%d, ", $2}
20262                              END        { printf "0\n"}' signal.lst`
20263         ;;
20264 esac
20265 echo "The following $sig_count signals are available:"
20266 echo " "
20267 echo $sig_name | $awk \
20268 'BEGIN { linelen = 0 }
20269 {
20270         for (i = 1; i <= NF; i++) {
20271                 name = "SIG" $i " "
20272                 linelen = linelen + length(name)
20273                 if (linelen > 70) {
20274                         printf "\n"
20275                         linelen = length(name)
20276                 }
20277                 printf "%s", name
20278         }
20279         printf "\n"
20280 }'
20281 sig_size=`echo $sig_name | awk '{print NF}'`
20282 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20283
20284 : Check size of size
20285 echo " "
20286 case "$sizetype" in
20287 *_t) zzz="$sizetype"    ;;
20288 *)   zzz="filesize"     ;;
20289 esac
20290 echo "Checking the size of $zzz..." >&4
20291 cat > try.c <<EOCP
20292 #include <sys/types.h>
20293 #include <stdio.h>
20294 #$i_stdlib I_STDLIB
20295 #ifdef I_STDLIB
20296 #include <stdlib.h>
20297 #endif
20298 int main() {
20299     printf("%d\n", (int)sizeof($sizetype));
20300     exit(0);
20301 }
20302 EOCP
20303 set try
20304 if eval $compile_ok; then
20305         yyy=`$run ./try`
20306         case "$yyy" in
20307         '')     sizesize=4
20308                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20309                 ;;
20310         *)      sizesize=$yyy
20311                 echo "Your $zzz size is $sizesize bytes."
20312                 ;;
20313         esac
20314 else
20315         sizesize=4
20316         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20317 fi
20318
20319
20320 : check for socklen_t
20321 echo " "
20322 echo "Checking to see if you have socklen_t..." >&4
20323 $cat >try.c <<EOCP
20324 #include <sys/types.h>
20325 #$d_socket HAS_SOCKET
20326 #ifdef HAS_SOCKET
20327 #include <sys/socket.h>
20328 #endif
20329 int main() { socklen_t x = 16; }
20330 EOCP
20331 set try
20332 if eval $compile; then
20333         val="$define"
20334         echo "You have socklen_t."
20335 else
20336         val="$undef"
20337         echo "You do not have socklen_t."
20338         case "$sizetype" in
20339         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20340         esac
20341 fi
20342 $rm_try
20343 set d_socklen_t
20344 eval $setvar
20345
20346 : see if this is a socks.h system
20347 set socks.h i_socks
20348 eval $inhdr
20349
20350 : check for type of the size argument to socket calls
20351 case "$d_socket" in
20352 "$define")
20353         $cat <<EOM
20354
20355 Checking to see what type is the last argument of accept().
20356 EOM
20357         yyy=''
20358         case "$d_socklen_t" in
20359         "$define") yyy="$yyy socklen_t"
20360         esac
20361         yyy="$yyy $sizetype int long unsigned"
20362         for xxx in $yyy; do
20363                 case "$socksizetype" in
20364                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20365                         case "$usesocks" in
20366                         "$define")
20367                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20368                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20369                                         socksizetype="$xxx"
20370                                 fi
20371                                 ;;
20372                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20373                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20374                                         socksizetype="$xxx"
20375                                 fi
20376                                 ;;
20377                         esac
20378                         ;;
20379                 esac
20380         done
20381 : In case none of those worked, prompt the user.
20382         case "$socksizetype" in
20383         '')     rp='What is the type for socket address structure sizes?'
20384                 dflt='int'
20385                 . ./myread
20386                 socksizetype=$ans
20387                 ;;
20388         esac
20389         ;;
20390 *)      : no sockets, so pick relatively harmless default
20391         socksizetype='int'
20392         ;;
20393 esac
20394
20395 : see what type is used for signed size_t
20396 set ssize_t ssizetype int stdio.h sys/types.h
20397 eval $typedef
20398 dflt="$ssizetype"
20399 $cat > try.c <<EOM
20400 #include <stdio.h>
20401 #$i_stdlib I_STDLIB
20402 #ifdef I_STDLIB
20403 #include <stdlib.h>
20404 #endif
20405 #include <sys/types.h>
20406 #define Size_t $sizetype
20407 #define SSize_t $dflt
20408 int main()
20409 {
20410         if (sizeof(Size_t) == sizeof(SSize_t))
20411                 printf("$dflt\n");
20412         else if (sizeof(Size_t) == sizeof(int))
20413                 printf("int\n");
20414         else
20415                 printf("long\n");
20416         exit(0);
20417 }
20418 EOM
20419 echo " "
20420 set try
20421 if eval $compile_ok && $run ./try > /dev/null; then
20422         ssizetype=`$run ./try`
20423         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20424 else
20425         $cat >&4 <<EOM
20426 Help! I can't compile and run the ssize_t test program: please enlighten me!
20427 (This is probably a misconfiguration in your system or libraries, and
20428 you really ought to fix it.  Still, I'll try anyway.)
20429
20430 I need a type that is the same size as $sizetype, but is guaranteed to
20431 be signed.  Common values are ssize_t, int and long.
20432
20433 EOM
20434         rp="What signed type is the same size as $sizetype?"
20435         . ./myread
20436         ssizetype="$ans"
20437 fi
20438 $rm_try
20439
20440 : see what type of char stdio uses.
20441 echo " "
20442 echo '#include <stdio.h>' > stdio.c
20443 $cppstdin $cppminus < stdio.c > stdioh
20444 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20445         echo "Your stdio uses unsigned chars." >&4
20446         stdchar="unsigned char"
20447 else
20448         echo "Your stdio uses signed chars." >&4
20449         stdchar="char"
20450 fi
20451 $rm -f stdio.* stdioh
20452
20453 : see what type uids are declared as in the kernel
20454 echo " "
20455 echo "Looking for the type for user ids returned by getuid()."
20456 set uid_t uidtype xxx stdio.h sys/types.h
20457 eval $typedef
20458 case "$uidtype" in
20459 xxx)
20460         xxx=`./findhdr sys/user.h`
20461         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20462         case $1 in
20463         unsigned) dflt="$1 $2" ;;
20464         *) dflt="$1" ;;
20465         esac
20466         ;;
20467 *) dflt="$uidtype";;
20468 esac
20469 case "$uidtype" in
20470 uid_t)  echo "uid_t found." ;;
20471 *)      rp="What is the type for user ids returned by getuid()?"
20472         . ./myread
20473         uidtype="$ans"
20474         ;;
20475 esac
20476
20477 : Check size of UID
20478 echo " "
20479 case "$uidtype" in
20480 *_t) zzz="$uidtype"     ;;
20481 *)   zzz="uid"          ;;
20482 esac
20483 echo "Checking the size of $zzz..." >&4
20484 cat > try.c <<EOCP
20485 #include <sys/types.h>
20486 #include <stdio.h>
20487 #$i_stdlib I_STDLIB
20488 #ifdef I_STDLIB
20489 #include <stdlib.h>
20490 #endif
20491 int main() {
20492     printf("%d\n", (int)sizeof($uidtype));
20493     exit(0);
20494 }
20495 EOCP
20496 set try
20497 if eval $compile_ok; then
20498         yyy=`$run ./try`
20499         case "$yyy" in
20500         '')     uidsize=4
20501                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20502                 ;;
20503         *)      uidsize=$yyy
20504                 echo "Your $zzz is $uidsize bytes long."
20505                 ;;
20506         esac
20507 else
20508         uidsize=4
20509         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20510 fi
20511
20512 : Check if UID is signed
20513 echo " "
20514 case "$uidtype" in
20515 *_t) zzz="$uidtype"     ;;
20516 *)   zzz="uid"          ;;
20517 esac
20518 echo "Checking the sign of $zzz..." >&4
20519 cat > try.c <<EOCP
20520 #include <sys/types.h>
20521 #include <stdio.h>
20522 int main() {
20523         $uidtype foo = -1;
20524         if (foo < 0)
20525                 printf("-1\n");
20526         else
20527                 printf("1\n");
20528 }
20529 EOCP
20530 set try
20531 if eval $compile; then
20532         yyy=`$run ./try`
20533         case "$yyy" in
20534         '')     uidsign=1
20535                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20536                 ;;
20537         *)      uidsign=$yyy
20538                 case "$uidsign" in
20539                  1) echo "Your $zzz is unsigned." ;;
20540                 -1) echo "Your $zzz is signed."   ;;
20541                 esac
20542                 ;;
20543         esac
20544 else
20545         uidsign=1
20546         echo "(I can't compile the test program--guessing unsigned.)" >&4
20547 fi
20548
20549
20550 : Check format string for UID
20551 echo " "
20552 $echo "Checking the format string to be used for uids..." >&4
20553
20554 case "$uidsign" in
20555 -1)     if $test X"$uidsize" = X"$ivsize"; then
20556                 uidformat="$ivdformat"
20557         else
20558                 if $test X"$uidsize" = X"$longsize"; then
20559                         uidformat='"ld"'
20560                 else
20561                         if $test X"$uidsize" = X"$intsize"; then
20562                                 uidformat='"d"'
20563                         else
20564                                 if $test X"$uidsize" = X"$shortsize"; then
20565                                         uidformat='"hd"'
20566                                 fi
20567                         fi
20568                 fi
20569         fi
20570         ;;
20571 *)      if $test X"$uidsize" = X"$uvsize"; then
20572                 uidformat="$uvuformat"
20573         else
20574                 if $test X"$uidsize" = X"$longsize"; then
20575                         uidformat='"lu"'
20576                 else
20577                         if $test X"$uidsize" = X"$intsize"; then
20578                                 uidformat='"u"'
20579                         else
20580                                 if $test X"$uidsize" = X"$shortsize"; then
20581                                         uidformat='"hu"'
20582                                 fi
20583                         fi
20584                 fi
20585         fi
20586         ;;
20587 esac
20588
20589 : Check if site customization support was requested
20590 case "$usesitecustomize" in
20591     $define|true|[Yy]*)
20592         usesitecustomize="$define"
20593         ;;
20594     *)
20595         usesitecustomize="$undef"
20596         ;;
20597     esac
20598
20599 : determine compiler compiler
20600 case "$yacc" in
20601 '')
20602         dflt=yacc;;
20603 *)
20604         dflt="$yacc";;
20605 esac
20606 echo " "
20607 comp='yacc'
20608 if $test -f "$byacc$_exe"; then
20609         dflt="$byacc"
20610         comp="byacc or $comp"
20611 fi
20612 if $test -f "$bison$_exe"; then
20613         comp="$comp or bison -y"
20614 fi
20615 rp="Which compiler compiler ($comp) shall I use?"
20616 . ./myread
20617 yacc="$ans"
20618 case "$yacc" in
20619 *bis*)
20620         case "$yacc" in
20621         *-y*) ;;
20622         *)
20623                 yacc="$yacc -y"
20624                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20625                 ;;
20626         esac
20627         ;;
20628 esac
20629
20630 : see if this is a assert.h system
20631 set assert.h i_assert
20632 eval $inhdr
20633
20634 : see if this is a fp.h system
20635 set fp.h i_fp
20636 eval $inhdr
20637
20638 : see if this is a fp_class.h system
20639 set fp_class.h i_fp_class
20640 eval $inhdr
20641
20642 : see if gdbm.h is available
20643 set gdbm.h t_gdbm
20644 eval $inhdr
20645 case "$t_gdbm" in
20646 $define)
20647         : see if gdbm_open exists
20648         set gdbm_open d_gdbm_open
20649         eval $inlibc
20650         case "$d_gdbm_open" in
20651         $undef)
20652                 t_gdbm="$undef"
20653                 echo "We won't be including <gdbm.h>"
20654                 ;;
20655         esac
20656         ;;
20657 esac
20658 val="$t_gdbm"
20659 set i_gdbm
20660 eval $setvar
20661
20662 : see if this is a ieeefp.h system
20663 case "$i_ieeefp" in
20664 '' ) set ieeefp.h i_ieeefp
20665      eval $inhdr
20666      ;;
20667 esac
20668
20669 : see if this is a libutil.h system
20670 set libutil.h i_libutil
20671 eval $inhdr
20672
20673 : see if mach cthreads are available
20674 if test "X$usethreads" = "X$define"; then
20675         set mach/cthreads.h i_machcthr
20676         eval $inhdr
20677 else
20678         i_machcthr="$undef"
20679 fi
20680
20681 : see if this is a mntent.h system
20682 set mntent.h i_mntent
20683 eval $inhdr
20684
20685 : see if ndbm.h is available
20686 set ndbm.h t_ndbm
20687 eval $inhdr
20688
20689 case "$t_ndbm" in
20690 $undef)
20691     # Some Linux distributions such as RedHat 7.1 put the
20692     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20693     if $test -f /usr/include/gdbm/ndbm.h; then
20694         echo '<gdbm/ndbm.h> found.'
20695         ccflags="$ccflags -I/usr/include/gdbm"
20696         cppflags="$cppflags -I/usr/include/gdbm"
20697         t_ndbm=$define
20698     fi
20699     ;;
20700 esac
20701
20702 case "$t_ndbm" in
20703 $define)
20704         : see if dbm_open exists
20705         set dbm_open d_dbm_open
20706         eval $inlibc
20707         case "$d_dbm_open" in
20708         $undef)
20709                 t_ndbm="$undef"
20710                 echo "We won't be including <ndbm.h>"
20711                 ;;
20712         esac
20713         ;;
20714 esac
20715 val="$t_ndbm"
20716 set i_ndbm
20717 eval $setvar
20718
20719 : see if net/errno.h is available
20720 val=''
20721 set net/errno.h val
20722 eval $inhdr
20723
20724 : Unfortunately, it causes problems on some systems.  Arrgh.
20725 case "$val" in
20726 $define)
20727         cat > try.c <<'EOM'
20728 #include <stdio.h>
20729 #include <errno.h>
20730 #include <net/errno.h>
20731 int func()
20732 {
20733         return ENOTSOCK;
20734 }
20735 EOM
20736         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20737                 echo "We'll be including <net/errno.h>." >&4
20738         else
20739                 echo "We won't be including <net/errno.h>." >&4
20740                 val="$undef"
20741         fi
20742         $rm_try
20743         ;;
20744 esac
20745 set i_neterrno
20746 eval $setvar
20747
20748 : see if netinet/tcp.h is available
20749 set netinet/tcp.h i_netinettcp
20750 eval $inhdr
20751
20752 : see if this is a poll.h system
20753 set poll.h i_poll
20754 eval $inhdr
20755
20756 : see if this is a prot.h system
20757 set prot.h i_prot
20758 eval $inhdr
20759
20760 : Preprocessor symbols
20761 echo " "
20762 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20763 $cat <<'EOSH' > Cppsym.know
20764 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20765 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20766 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20767 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20768 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20769 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20770 bull c cadmus clipper CMU COFF COMPILER_VERSION
20771 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20772 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20773 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20774 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20775 GLIBC GLIBC_MINOR
20776 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20777 H3050R H3050RX hbullx20 hcx host_mips
20778 hp200 hp300 hp700 HP700 hp800 hp9000
20779 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20780 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20781 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20782 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20783 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20784 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20785 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20786 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20787 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20788 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20789 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20790 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20791 MATH_HAS_NO_SIDE_EFFECTS
20792 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20793 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20794 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20795 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20796 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20797 NetBSD news1500 news1700 news1800 news1900 news3700
20798 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20799 ns32016 ns32332 ns32k nsc32000
20800 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20801 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20802 pc532 pdp11 PGC PIC plexus PORTAR posix
20803 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20804 POSIX_C_SOURCE POSIX_SOURCE POWER
20805 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20806 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20807 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20808 sony sony_news sonyrisc sparc sparclite spectrum
20809 stardent stdc STDC_EXT stratos sun sun3 sun386
20810 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20811 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20812 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20813 sysV68 sysV88 Tek4132 Tek4300 titan
20814 TM3200 TM5400 TM5600
20815 tower tower32 tower32_200 tower32_600 tower32_700
20816 tower32_800 tower32_850 tss
20817 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20818 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20819 unix UNIX95 UNIX99 unixpc unos
20820 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20821 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20822 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20823 USGr4 USGr4_2
20824 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20825 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20826 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20827 z8000
20828 EOSH
20829 # Maybe put other stuff here too.
20830 cat <<EOSH >>Cppsym.know
20831 $osname
20832 EOSH
20833 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20834 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20835 $cat Cppsym.know > Cppsym.c
20836 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20837 $rm -f Cppsym.a Cppsym.b Cppsym.c
20838 cat <<EOSH > Cppsym
20839 $startsh
20840 if $test \$# -gt 0; then
20841     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20842     if $test -s Cppsym.got; then
20843         $rm -f Cppsym.got
20844         exit 0
20845     fi
20846     $rm -f Cppsym.got
20847     exit 1
20848 else
20849     $tr " " "$trnl" | ./Cppsym.try
20850     exit 0
20851 fi
20852 EOSH
20853 chmod +x Cppsym
20854 $eunicefix Cppsym
20855 cat <<EOSH > Cppsym.try
20856 $startsh
20857 cat <<'EOCP' > try.c
20858 #include <stdio.h>
20859 #if cpp_stuff == 1
20860 #define STRINGIFY(a)    "a"
20861 #endif
20862 #if cpp_stuff == 42
20863 #define StGiFy(a)  #a
20864 #define STRINGIFY(a)    StGiFy(a)
20865 #endif
20866 #if $cpp_stuff != 1 && $cpp_stuff != 42
20867 #   include "Bletch: How does this C preprocessor stringify macros?"
20868 #endif
20869 int main() {
20870 EOCP
20871 $awk \\
20872 EOSH
20873 cat <<'EOSH' >> Cppsym.try
20874 'length($1) > 0 {
20875     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20876     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20877     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20878     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20879 }'       >> try.c
20880 echo 'return 0;}' >> try.c
20881 EOSH
20882 cat <<EOSH >> Cppsym.try
20883 ccflags="$ccflags"
20884 case "$osname-$gccversion" in
20885 irix-) ccflags="\$ccflags -woff 1178" ;;
20886 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20887 esac
20888 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20889 EOSH
20890 chmod +x Cppsym.try
20891 $eunicefix Cppsym.try
20892 ./Cppsym < Cppsym.know > Cppsym.true
20893 : Add in any linux cpp "predefined macros":
20894 case "$osname::$gccversion" in
20895   *linux*::*.*)
20896     tHdrH=_tmpHdr
20897     rm -f $tHdrH'.h' $tHdrH
20898     touch $tHdrH'.h'
20899     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20900        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20901        if [ -s $tHdrH'_cppsym.real' ]; then
20902           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20903        fi
20904     fi
20905     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20906   ;;
20907 esac
20908 : now check the C compiler for additional symbols
20909 postprocess_cc_v=''
20910 case "$osname" in
20911 aix) postprocess_cc_v="|$tr , ' '" ;;
20912 esac
20913 $cat >ccsym <<EOS
20914 $startsh
20915 $cat >tmp.c <<EOF
20916 extern int foo;
20917 EOF
20918 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20919 do
20920         case "\$i" in
20921         -D*) echo "\$i" | $sed 's/^-D//';;
20922         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20923         esac
20924 done
20925 $rm_try
20926 EOS
20927 postprocess_cc_v=''
20928 chmod +x ccsym
20929 $eunicefix ccsym
20930 ./ccsym > ccsym1.raw
20931 if $test -s ccsym1.raw; then
20932        $sort ccsym1.raw | $uniq >ccsym.raw
20933 else
20934        mv ccsym1.raw ccsym.raw
20935 fi
20936
20937 $awk '/\=/ { print $0; next }
20938         { print $0"=1" }' ccsym.raw >ccsym.list
20939 $comm -13 Cppsym.true ccsym.list >ccsym.own
20940 $comm -12 Cppsym.true ccsym.list >ccsym.com
20941 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20942 also=''
20943 if $test -z ccsym.raw; then
20944         echo "Your C compiler doesn't seem to define any symbols!" >&4
20945         echo " "
20946         echo "However, your C preprocessor defines the following symbols:"
20947         $cat Cppsym.true
20948         ccsymbols=''
20949         cppsymbols=`$cat Cppsym.true`
20950         cppsymbols=`echo $cppsymbols`
20951         cppccsymbols="$cppsymbols"
20952 else
20953         if $test -s ccsym.com; then
20954                 echo "Your C compiler and pre-processor define these symbols:"
20955                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20956                 also='also '
20957                 symbols='ones'
20958                 cppccsymbols=`$cat ccsym.com`
20959                 cppccsymbols=`echo $cppccsymbols`
20960                 $test "$silent" || sleep 1
20961         fi
20962         if $test -s ccsym.cpp; then
20963                 $test "$also" && echo " "
20964                 echo "Your C pre-processor ${also}defines the following symbols:"
20965                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20966                 also='further '
20967                 cppsymbols=`$cat ccsym.cpp`
20968                 cppsymbols=`echo $cppsymbols`
20969                 $test "$silent" || sleep 1
20970         fi
20971         if $test -s ccsym.own; then
20972                 $test "$also" && echo " "
20973                 echo "Your C compiler ${also}defines the following cpp symbols:"
20974                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20975                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20976                 ccsymbols=`$cat ccsym.own`
20977                 ccsymbols=`echo $ccsymbols`
20978                 $test "$silent" || sleep 1
20979         fi
20980 fi
20981
20982 : see if this is a termio system
20983 val="$undef"
20984 val2="$undef"
20985 val3="$undef"
20986 if $test `./findhdr termios.h`; then
20987         set tcsetattr i_termios
20988         eval $inlibc
20989         val3="$i_termios"
20990 fi
20991 echo " "
20992 case "$val3" in
20993 "$define") echo "You have POSIX termios.h... good!" >&4;;
20994 *) if ./Cppsym pyr; then
20995                 case "`/bin/universe`" in
20996                 ucb) if $test `./findhdr sgtty.h`; then
20997                                 val2="$define"
20998                                 echo "<sgtty.h> found." >&4
20999                         else
21000                                 echo "System is pyramid with BSD universe."
21001                                 echo "<sgtty.h> not found--you could have problems." >&4
21002                         fi;;
21003                 *) if $test `./findhdr termio.h`; then
21004                                 val="$define"
21005                                 echo "<termio.h> found." >&4
21006                         else
21007                                 echo "System is pyramid with USG universe."
21008                                 echo "<termio.h> not found--you could have problems." >&4
21009                         fi;;
21010                 esac
21011         elif ./usg; then
21012                 if $test `./findhdr termio.h`; then
21013                         echo "<termio.h> found." >&4
21014                         val="$define"
21015                 elif $test `./findhdr sgtty.h`; then
21016                         echo "<sgtty.h> found." >&4
21017                         val2="$define"
21018                 else
21019 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
21020                 fi
21021         else
21022                 if $test `./findhdr sgtty.h`; then
21023                         echo "<sgtty.h> found." >&4
21024                         val2="$define"
21025                 elif $test `./findhdr termio.h`; then
21026                         echo "<termio.h> found." >&4
21027                         val="$define"
21028                 else
21029 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
21030                 fi
21031         fi;;
21032 esac
21033 set i_termio; eval $setvar
21034 val=$val2; set i_sgtty; eval $setvar
21035 val=$val3; set i_termios; eval $setvar
21036
21037 : see if stddef is available
21038 set stddef.h i_stddef
21039 eval $inhdr
21040
21041 : see if sys/access.h is available
21042 set sys/access.h i_sysaccess
21043 eval $inhdr
21044
21045 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21046 set sys/filio.h i_sysfilio
21047 eval $inhdr
21048 echo " "
21049 if $test `./findhdr sys/ioctl.h`; then
21050         val="$define"
21051         echo '<sys/ioctl.h> found.' >&4
21052 else
21053         val="$undef"
21054         if $test $i_sysfilio = "$define"; then
21055             echo '<sys/ioctl.h> NOT found.' >&4
21056         else
21057                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21058                 $test $i_termio = "$define" && xxx="termio.h"
21059                 $test $i_termios = "$define" && xxx="termios.h"
21060 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21061         fi
21062 fi
21063 set i_sysioctl
21064 eval $setvar
21065
21066 : see if socket ioctl defs are in sys/sockio.h
21067 echo " "
21068 xxx=`./findhdr sys/sockio.h`
21069 if $test "$xxx"; then
21070         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21071                 val="$define"
21072                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21073         else
21074                 val="$undef"
21075                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21076         fi
21077 else
21078         val="$undef"
21079         $cat <<EOM
21080 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21081 EOM
21082 fi
21083 set i_syssockio
21084 eval $setvar
21085
21086 : see if this is a syslog.h system
21087 set syslog.h i_syslog
21088 eval $inhdr
21089
21090 : see if this is a sys/mode.h system
21091 set sys/mode.h i_sysmode
21092 eval $inhdr
21093
21094 : see if sys/resource.h has to be included
21095 set sys/resource.h i_sysresrc
21096 eval $inhdr
21097
21098 : see if sys/security.h is available
21099 set sys/security.h i_syssecrt
21100 eval $inhdr
21101
21102 : see if this is a sys/statvfs.h system
21103 set sys/statvfs.h i_sysstatvfs
21104 eval $inhdr
21105
21106 : see if this is a sys/un.h system
21107 set sys/un.h i_sysun
21108 eval $inhdr
21109
21110 : see if this is a sys/utsname.h system
21111 set sys/utsname.h i_sysutsname
21112 eval $inhdr
21113
21114 : see if this is a syswait system
21115 set sys/wait.h i_syswait
21116 eval $inhdr
21117
21118 : see if this is a ustat.h system
21119 set ustat.h i_ustat
21120 eval $inhdr
21121
21122 : see if this is an utime system
21123 set utime.h i_utime
21124 eval $inhdr
21125
21126 : see if this is a values.h system
21127 set values.h i_values
21128 eval $inhdr
21129
21130 : see if this is a vfork system
21131 case "$d_vfork" in
21132 "$define")
21133         set vfork.h i_vfork
21134         eval $inhdr
21135         ;;
21136 *)
21137         i_vfork="$undef"
21138         ;;
21139 esac
21140
21141 : Check extensions
21142 echo " "
21143 echo "Looking for extensions..." >&4
21144 : If we are using the old config.sh, known_extensions may contain
21145 : old or inaccurate or duplicate values.
21146 known_extensions=''
21147 nonxs_extensions=''
21148 : We do not use find because it might not be available.
21149 : We do not just use MANIFEST because the user may have dropped
21150 : some additional extensions into the source tree and expect them
21151 : to be built.
21152
21153 : Function to recursively find available extensions, ignoring DynaLoader
21154 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21155 find_extensions='
21156     for xxx in *; do
21157         case "$xxx" in
21158             DynaLoader|dynaload) ;;
21159             *)
21160             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21161                 known_extensions="$known_extensions $1$xxx";
21162             elif $test -f $xxx/Makefile.PL; then
21163                 nonxs_extensions="$nonxs_extensions $1$xxx";
21164             else
21165                 if $test -d $xxx -a $# -lt 10; then
21166                     set $1$xxx/ $*;
21167                     cd "$xxx";
21168                     eval $find_extensions;
21169                     cd ..;
21170                     shift;
21171                 fi;
21172             fi
21173             ;;
21174         esac;
21175     done'
21176 tdir=`pwd`
21177 cd "$rsrc/ext"
21178 set X
21179 shift
21180 eval $find_extensions
21181 # Special case:  Add in modules that nest beyond the first level.
21182 # Currently threads/shared and Hash/Util/FieldHash, since they are
21183 # not picked up by the recursive find above (and adding in general
21184 # recursive finding breaks SDBM_File/sdbm).
21185 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21186 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21187 set X $known_extensions
21188 shift
21189 known_extensions="$*"
21190 set X $nonxs_extensions
21191 shift
21192 nonxs_extensions="$*"
21193 cd "$tdir"
21194
21195 : Now see which are supported on this system.
21196 avail_ext=''
21197 for xxx in $known_extensions ; do
21198         case "$xxx" in
21199         DB_File|db_file)
21200                 case "$i_db" in
21201                 $define) avail_ext="$avail_ext $xxx" ;;
21202                 esac
21203                 ;;
21204         GDBM_File|gdbm_fil)
21205                 case "$i_gdbm" in
21206                 $define) avail_ext="$avail_ext $xxx" ;;
21207                 esac
21208                 ;;
21209         I18N/Langinfo|i18n_lan)
21210                 case "$i_langinfo$d_nl_langinfo" in
21211                 $define$define) avail_ext="$avail_ext $xxx" ;;
21212                 esac
21213                 ;;
21214         IPC/SysV|ipc/sysv)
21215                 : XXX Do we need a useipcsysv variable here
21216                 case "${d_msg}${d_sem}${d_shm}" in
21217                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21218                 esac
21219                 ;;
21220         NDBM_File|ndbm_fil)
21221                 case "$i_ndbm" in
21222                 $define)
21223                     case "$osname-$use64bitint" in
21224                     hpux-define)
21225                         case "$libs" in
21226                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21227                         esac
21228                         ;;
21229                     *) avail_ext="$avail_ext $xxx" ;;
21230                     esac
21231                     ;;
21232                 esac
21233                 ;;
21234         ODBM_File|odbm_fil)
21235                 case "${i_dbm}${i_rpcsvcdbm}" in
21236                 *"${define}"*)
21237                     case "$d_cplusplus" in
21238                     define) ;; # delete as a function name will not work
21239                     *)  case "$osname-$use64bitint" in
21240                         hpux-define)
21241                             case "$libs" in
21242                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21243                             esac
21244                             ;;
21245                         *) avail_ext="$avail_ext $xxx" ;;
21246                         esac
21247                         ;;
21248                     esac
21249                     ;;
21250                 esac
21251                 ;;
21252         Opcode|opcode)
21253                 case "$useopcode" in
21254                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21255                 esac
21256                 ;;
21257         POSIX|posix)
21258                 case "$useposix" in
21259                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21260                 esac
21261                 ;;
21262         Socket|socket)
21263                 case "$d_socket" in
21264                 true|$define|y)
21265                     case "$osname" in
21266                     beos) ;; # not unless BONE
21267                     *) avail_ext="$avail_ext $xxx" ;;
21268                     esac
21269                     ;;
21270                 esac
21271                 ;;
21272         Sys/Syslog|sys/syslog)
21273                 : XXX syslog requires socket
21274                 case "$d_socket" in
21275                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21276                 esac
21277                 ;;
21278         Thread|thread)
21279                 case "$usethreads" in
21280                 true|$define|y)
21281                         case "$use5005threads" in
21282                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21283                         esac
21284                 esac
21285                 ;;
21286         threads|threads/shared)
21287                 # threads and threads::shared are special cases.
21288                 # To stop people from asking "Perl 5.8.0 was supposed
21289                 # to have this new fancy threads implementation but my
21290                 # perl doesn't have it" and from people trying to
21291                 # (re)install the threads module using CPAN.pm and
21292                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21293                 # the threads.pm and threads/shared.pm will always be
21294                 # there, croaking informatively ("you need to rebuild
21295                 # all of Perl with threads, sorry") when threads haven't
21296                 # been compiled in.
21297                 # --jhi
21298                 avail_ext="$avail_ext $xxx"
21299                 ;;
21300         Win32*)
21301                 case "$osname" in
21302                 cygwin) avail_ext="$avail_ext $xxx" ;;
21303                 esac
21304                 ;;
21305         XS/APItest|xs/apitest)
21306                 # This is just for testing.  Skip it unless we have dynamic loading.
21307
21308                 case "$usedl" in
21309                 $define) avail_ext="$avail_ext $xxx" ;;
21310                 esac
21311                 ;;
21312         XS/Typemap|xs/typemap)
21313                 # This is just for testing.  Skip it unless we have dynamic loading.
21314                 case "$usedl" in
21315                 $define) avail_ext="$avail_ext $xxx" ;;
21316                 esac
21317                 ;;
21318         *)      avail_ext="$avail_ext $xxx"
21319                 ;;
21320         esac
21321 done
21322
21323 set X $avail_ext
21324 shift
21325 avail_ext="$*"
21326
21327 case "$onlyextensions" in
21328 '') ;;
21329 *)  keepextensions=''
21330     echo "You have requested that only certains extensions be included..." >&4
21331     for i in $onlyextensions; do
21332         case " $avail_ext " in
21333         *" $i "*)
21334             echo "Keeping extension $i."
21335             keepextensions="$keepextensions $i"
21336             ;;
21337         *) echo "Ignoring extension $i." ;;
21338         esac
21339     done
21340     avail_ext="$keepextensions"
21341     ;;
21342 esac
21343
21344 case "$noextensions" in
21345 '') ;;
21346 *)  keepextensions=''
21347     echo "You have requested that certain extensions be ignored..." >&4
21348     for i in $avail_ext; do
21349         case " $noextensions " in
21350         *" $i "*) echo "Ignoring extension $i." ;;
21351         *) echo "Keeping extension $i.";
21352            keepextensions="$keepextensions $i"
21353            ;;
21354         esac
21355     done
21356     avail_ext="$keepextensions"
21357     ;;
21358 esac
21359
21360 : Now see which nonxs extensions are supported on this system.
21361 : For now assume all are.
21362 nonxs_ext=''
21363 for xxx in $nonxs_extensions ; do
21364         case "$xxx" in
21365         *)      nonxs_ext="$nonxs_ext $xxx"
21366                 ;;
21367         esac
21368 done
21369
21370 set X $nonxs_ext
21371 shift
21372 nonxs_ext="$*"
21373
21374 case $usedl in
21375 $define)
21376         $cat <<EOM
21377 A number of extensions are supplied with $package.  You may choose to
21378 compile these extensions for dynamic loading (the default), compile
21379 them into the $package executable (static loading), or not include
21380 them at all.  Answer "none" to include no extensions.
21381 Note that DynaLoader is always built and need not be mentioned here.
21382
21383 EOM
21384         case "$dynamic_ext" in
21385         '')
21386                 : Exclude those listed in static_ext
21387                 dflt=''
21388                 for xxx in $avail_ext; do
21389                         case " $static_ext " in
21390                         *" $xxx "*) ;;
21391                         *) dflt="$dflt $xxx" ;;
21392                         esac
21393                 done
21394                 set X $dflt
21395                 shift
21396                 dflt="$*"
21397                 ;;
21398         *)      dflt="$dynamic_ext"
21399                 # Perhaps we are reusing an old out-of-date config.sh.
21400                 case "$hint" in
21401                 previous)
21402                         if test X"$dynamic_ext" != X"$avail_ext"; then
21403                                 $cat <<EOM
21404 NOTICE:  Your previous config.sh list may be incorrect.
21405 The extensions now available to you are
21406         ${avail_ext}
21407 but the default list from your previous config.sh is
21408         ${dynamic_ext}
21409
21410 EOM
21411                         fi
21412                         ;;
21413                 esac
21414                 ;;
21415         esac
21416         case "$dflt" in
21417         '')     dflt=none;;
21418         esac
21419         rp="What extensions do you wish to load dynamically?"
21420         . ./myread
21421         case "$ans" in
21422         none) dynamic_ext=' ' ;;
21423         *) dynamic_ext="$ans" ;;
21424         esac
21425
21426         case "$static_ext" in
21427         '')
21428                 : Exclude those already listed in dynamic linking
21429                 dflt=''
21430                 for xxx in $avail_ext; do
21431                         case " $dynamic_ext " in
21432                         *" $xxx "*) ;;
21433                         *) dflt="$dflt $xxx" ;;
21434                         esac
21435                 done
21436                 set X $dflt
21437                 shift
21438                 dflt="$*"
21439                 ;;
21440         *)  dflt="$static_ext"
21441                 ;;
21442         esac
21443
21444         case "$dflt" in
21445         '')     dflt=none;;
21446         esac
21447         rp="What extensions do you wish to load statically?"
21448         . ./myread
21449         case "$ans" in
21450         none) static_ext=' ' ;;
21451         *) static_ext="$ans" ;;
21452         esac
21453         ;;
21454 *)
21455         $cat <<EOM
21456 A number of extensions are supplied with $package.  Answer "none"
21457 to include no extensions.
21458 Note that DynaLoader is always built and need not be mentioned here.
21459
21460 EOM
21461         case "$static_ext" in
21462         '') dflt="$avail_ext" ;;
21463         *)      dflt="$static_ext"
21464                 # Perhaps we are reusing an old out-of-date config.sh.
21465                 case "$hint" in
21466                 previous)
21467                         if test X"$static_ext" != X"$avail_ext"; then
21468                                 $cat <<EOM
21469 NOTICE:  Your previous config.sh list may be incorrect.
21470 The extensions now available to you are
21471         ${avail_ext}
21472 but the default list from your previous config.sh is
21473         ${static_ext}
21474
21475 EOM
21476                         fi
21477                         ;;
21478                 esac
21479                 ;;
21480         esac
21481         : Exclude those that are not xs extensions
21482         case "$dflt" in
21483         '')     dflt=none;;
21484         esac
21485         rp="What extensions do you wish to include?"
21486         . ./myread
21487         case "$ans" in
21488         none) static_ext=' ' ;;
21489         *) static_ext="$ans" ;;
21490         esac
21491         ;;
21492 esac
21493 #
21494 # Encode is a special case.  If we are building Encode as a static
21495 # extension, we need to explicitly list its subextensions as well.
21496 # For other nested extensions, this is handled automatically by
21497 # the appropriate Makefile.PL.
21498 case " $static_ext " in
21499         *" Encode "*) # Add the subextensions of Encode
21500         cd "$rsrc/ext"
21501         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21502                 static_ext="$static_ext Encode/$xxx"
21503         done
21504         cd "$tdir"
21505         ;;
21506 esac
21507
21508 set X $dynamic_ext $static_ext $nonxs_ext
21509 shift
21510 extensions="$*"
21511
21512 # Sanity check:  We require an extension suitable for use with
21513 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21514 # should show up as failures in the test suite, but it's helpful to
21515 # catch them now.) The 'extensions' list is normally sorted
21516 # alphabetically, so we need to accept either
21517 #    DB_File ... Fcntl ... IO  ....
21518 # or something like
21519 #    Fcntl ... NDBM_File ... IO  ....
21520 case " $extensions"  in
21521 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21522 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21523 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21524 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21525    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21526    ;;
21527 esac
21528
21529 : Remove libraries needed only for extensions
21530 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21531 : The exception is SunOS 4.x, which needs them.
21532 case "${osname}X${osvers}" in
21533 sunos*X4*)
21534     perllibs="$libs"
21535     ;;
21536 *) case "$usedl" in
21537     $define|true|[yY]*)
21538             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21539             shift
21540             perllibs="$*"
21541             ;;
21542     *)  perllibs="$libs"
21543             ;;
21544     esac
21545     ;;
21546 esac
21547
21548 : Remove build directory name from cppstdin so it can be used from
21549 : either the present location or the final installed location.
21550 echo " "
21551 : Get out of the UU directory to get correct path name.
21552 cd ..
21553 case "$cppstdin" in
21554 `pwd`/cppstdin)
21555         echo "Stripping down cppstdin path name"
21556         cppstdin=cppstdin
21557         ;;
21558 esac
21559 cd UU
21560
21561 : end of configuration questions
21562 echo " "
21563 echo "End of configuration questions."
21564 echo " "
21565
21566 : back to where it started
21567 if test -d ../UU; then
21568         cd ..
21569 fi
21570
21571 : configuration may be unconditionally patched via a 'config.arch' file
21572 if $test -f config.arch; then
21573         echo "I see a config.arch file, loading it." >&4
21574         . ./config.arch
21575 fi
21576
21577 : configuration may be patched via a 'config.over' file
21578 if $test -f config.over; then
21579         echo " "
21580         dflt=y
21581         rp='I see a config.over file.  Do you wish to load it?'
21582         . UU/myread
21583         case "$ans" in
21584         n*) echo "OK, I'll ignore it.";;
21585         *)      . ./config.over
21586                 echo "Configuration override changes have been loaded."
21587                 ;;
21588         esac
21589 fi
21590
21591 : in case they want portability, strip down executable paths
21592 case "$d_portable" in
21593 "$define")
21594         echo " "
21595         echo "Stripping down executable paths..." >&4
21596         for file in $loclist $trylist; do
21597                 eval temp=\$$file
21598                 eval $file=`basename $temp`
21599         done
21600         ;;
21601 esac
21602
21603 : create config.sh file
21604 echo " "
21605 echo "Creating config.sh..." >&4
21606 $spitshell <<EOT >config.sh
21607 $startsh
21608 #
21609 # This file was produced by running the Configure script. It holds all the
21610 # definitions figured out by Configure. Should you modify one of these values,
21611 # do not forget to propagate your changes by running "Configure -der". You may
21612 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21613 #
21614
21615 # Package name      : $package
21616 # Source directory  : $src
21617 # Configuration time: $cf_time
21618 # Configured by     : $cf_by
21619 # Target system     : $myuname
21620
21621 EOT
21622 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21623 $spitshell <<EOT >>config.sh
21624
21625 Author='$Author'
21626 Date='$Date'
21627 Header='$Header'
21628 Id='$Id'
21629 Locker='$Locker'
21630 Log='$Log'
21631 RCSfile='$RCSfile'
21632 Revision='$Revision'
21633 Source='$Source'
21634 State='$State'
21635 _a='$_a'
21636 _exe='$_exe'
21637 _o='$_o'
21638 afs='$afs'
21639 afsroot='$afsroot'
21640 alignbytes='$alignbytes'
21641 ansi2knr='$ansi2knr'
21642 aphostname='$aphostname'
21643 api_revision='$api_revision'
21644 api_subversion='$api_subversion'
21645 api_version='$api_version'
21646 api_versionstring='$api_versionstring'
21647 ar='$ar'
21648 archlib='$archlib'
21649 archlibexp='$archlibexp'
21650 archname64='$archname64'
21651 archname='$archname'
21652 archobjs='$archobjs'
21653 asctime_r_proto='$asctime_r_proto'
21654 awk='$awk'
21655 baserev='$baserev'
21656 bash='$bash'
21657 bin='$bin'
21658 binexp='$binexp'
21659 bison='$bison'
21660 byacc='$byacc'
21661 byteorder='$byteorder'
21662 c='$c'
21663 castflags='$castflags'
21664 cat='$cat'
21665 cc='$cc'
21666 cccdlflags='$cccdlflags'
21667 ccdlflags='$ccdlflags'
21668 ccflags='$ccflags'
21669 ccflags_uselargefiles='$ccflags_uselargefiles'
21670 ccname='$ccname'
21671 ccsymbols='$ccsymbols'
21672 ccversion='$ccversion'
21673 cf_by='$cf_by'
21674 cf_email='$cf_email'
21675 cf_time='$cf_time'
21676 chgrp='$chgrp'
21677 chmod='$chmod'
21678 chown='$chown'
21679 clocktype='$clocktype'
21680 comm='$comm'
21681 compress='$compress'
21682 contains='$contains'
21683 cp='$cp'
21684 cpio='$cpio'
21685 cpp='$cpp'
21686 cpp_stuff='$cpp_stuff'
21687 cppccsymbols='$cppccsymbols'
21688 cppflags='$cppflags'
21689 cpplast='$cpplast'
21690 cppminus='$cppminus'
21691 cpprun='$cpprun'
21692 cppstdin='$cppstdin'
21693 cppsymbols='$cppsymbols'
21694 crypt_r_proto='$crypt_r_proto'
21695 cryptlib='$cryptlib'
21696 csh='$csh'
21697 ctermid_r_proto='$ctermid_r_proto'
21698 ctime_r_proto='$ctime_r_proto'
21699 d_Gconvert='$d_Gconvert'
21700 d_PRIEUldbl='$d_PRIEUldbl'
21701 d_PRIFUldbl='$d_PRIFUldbl'
21702 d_PRIGUldbl='$d_PRIGUldbl'
21703 d_PRIXU64='$d_PRIXU64'
21704 d_PRId64='$d_PRId64'
21705 d_PRIeldbl='$d_PRIeldbl'
21706 d_PRIfldbl='$d_PRIfldbl'
21707 d_PRIgldbl='$d_PRIgldbl'
21708 d_PRIi64='$d_PRIi64'
21709 d_PRIo64='$d_PRIo64'
21710 d_PRIu64='$d_PRIu64'
21711 d_PRIx64='$d_PRIx64'
21712 d_SCNfldbl='$d_SCNfldbl'
21713 d__fwalk='$d__fwalk'
21714 d_access='$d_access'
21715 d_accessx='$d_accessx'
21716 d_aintl='$d_aintl'
21717 d_alarm='$d_alarm'
21718 d_archlib='$d_archlib'
21719 d_asctime_r='$d_asctime_r'
21720 d_atolf='$d_atolf'
21721 d_atoll='$d_atoll'
21722 d_attribute_format='$d_attribute_format'
21723 d_attribute_malloc='$d_attribute_malloc'
21724 d_attribute_nonnull='$d_attribute_nonnull'
21725 d_attribute_noreturn='$d_attribute_noreturn'
21726 d_attribute_pure='$d_attribute_pure'
21727 d_attribute_unused='$d_attribute_unused'
21728 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21729 d_bcmp='$d_bcmp'
21730 d_bcopy='$d_bcopy'
21731 d_bsd='$d_bsd'
21732 d_bsdgetpgrp='$d_bsdgetpgrp'
21733 d_bsdsetpgrp='$d_bsdsetpgrp'
21734 d_builtin_choose_expr='$d_builtin_choose_expr'
21735 d_builtin_expect='$d_builtin_expect'
21736 d_bzero='$d_bzero'
21737 d_c99_variadic_macros='$d_c99_variadic_macros'
21738 d_casti32='$d_casti32'
21739 d_castneg='$d_castneg'
21740 d_charvspr='$d_charvspr'
21741 d_chown='$d_chown'
21742 d_chroot='$d_chroot'
21743 d_chsize='$d_chsize'
21744 d_class='$d_class'
21745 d_clearenv='$d_clearenv'
21746 d_closedir='$d_closedir'
21747 d_cmsghdr_s='$d_cmsghdr_s'
21748 d_const='$d_const'
21749 d_copysignl='$d_copysignl'
21750 d_cplusplus='$d_cplusplus'
21751 d_crypt='$d_crypt'
21752 d_crypt_r='$d_crypt_r'
21753 d_csh='$d_csh'
21754 d_ctermid='$d_ctermid'
21755 d_ctermid_r='$d_ctermid_r'
21756 d_ctime_r='$d_ctime_r'
21757 d_cuserid='$d_cuserid'
21758 d_dbl_dig='$d_dbl_dig'
21759 d_dbminitproto='$d_dbminitproto'
21760 d_difftime='$d_difftime'
21761 d_dir_dd_fd='$d_dir_dd_fd'
21762 d_dirfd='$d_dirfd'
21763 d_dirnamlen='$d_dirnamlen'
21764 d_dlerror='$d_dlerror'
21765 d_dlopen='$d_dlopen'
21766 d_dlsymun='$d_dlsymun'
21767 d_dosuid='$d_dosuid'
21768 d_drand48_r='$d_drand48_r'
21769 d_drand48proto='$d_drand48proto'
21770 d_dup2='$d_dup2'
21771 d_eaccess='$d_eaccess'
21772 d_endgrent='$d_endgrent'
21773 d_endgrent_r='$d_endgrent_r'
21774 d_endhent='$d_endhent'
21775 d_endhostent_r='$d_endhostent_r'
21776 d_endnent='$d_endnent'
21777 d_endnetent_r='$d_endnetent_r'
21778 d_endpent='$d_endpent'
21779 d_endprotoent_r='$d_endprotoent_r'
21780 d_endpwent='$d_endpwent'
21781 d_endpwent_r='$d_endpwent_r'
21782 d_endsent='$d_endsent'
21783 d_endservent_r='$d_endservent_r'
21784 d_eofnblk='$d_eofnblk'
21785 d_eunice='$d_eunice'
21786 d_faststdio='$d_faststdio'
21787 d_fchdir='$d_fchdir'
21788 d_fchmod='$d_fchmod'
21789 d_fchown='$d_fchown'
21790 d_fcntl='$d_fcntl'
21791 d_fcntl_can_lock='$d_fcntl_can_lock'
21792 d_fd_macros='$d_fd_macros'
21793 d_fd_set='$d_fd_set'
21794 d_fds_bits='$d_fds_bits'
21795 d_fgetpos='$d_fgetpos'
21796 d_finite='$d_finite'
21797 d_finitel='$d_finitel'
21798 d_flexfnam='$d_flexfnam'
21799 d_flock='$d_flock'
21800 d_flockproto='$d_flockproto'
21801 d_fork='$d_fork'
21802 d_fp_class='$d_fp_class'
21803 d_fpathconf='$d_fpathconf'
21804 d_fpclass='$d_fpclass'
21805 d_fpclassify='$d_fpclassify'
21806 d_fpclassl='$d_fpclassl'
21807 d_fpos64_t='$d_fpos64_t'
21808 d_frexpl='$d_frexpl'
21809 d_fs_data_s='$d_fs_data_s'
21810 d_fseeko='$d_fseeko'
21811 d_fsetpos='$d_fsetpos'
21812 d_fstatfs='$d_fstatfs'
21813 d_fstatvfs='$d_fstatvfs'
21814 d_fsync='$d_fsync'
21815 d_ftello='$d_ftello'
21816 d_ftime='$d_ftime'
21817 d_futimes='$d_futimes'
21818 d_getcwd='$d_getcwd'
21819 d_getespwnam='$d_getespwnam'
21820 d_getfsstat='$d_getfsstat'
21821 d_getgrent='$d_getgrent'
21822 d_getgrent_r='$d_getgrent_r'
21823 d_getgrgid_r='$d_getgrgid_r'
21824 d_getgrnam_r='$d_getgrnam_r'
21825 d_getgrps='$d_getgrps'
21826 d_gethbyaddr='$d_gethbyaddr'
21827 d_gethbyname='$d_gethbyname'
21828 d_gethent='$d_gethent'
21829 d_gethname='$d_gethname'
21830 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21831 d_gethostbyname_r='$d_gethostbyname_r'
21832 d_gethostent_r='$d_gethostent_r'
21833 d_gethostprotos='$d_gethostprotos'
21834 d_getitimer='$d_getitimer'
21835 d_getlogin='$d_getlogin'
21836 d_getlogin_r='$d_getlogin_r'
21837 d_getmnt='$d_getmnt'
21838 d_getmntent='$d_getmntent'
21839 d_getnbyaddr='$d_getnbyaddr'
21840 d_getnbyname='$d_getnbyname'
21841 d_getnent='$d_getnent'
21842 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21843 d_getnetbyname_r='$d_getnetbyname_r'
21844 d_getnetent_r='$d_getnetent_r'
21845 d_getnetprotos='$d_getnetprotos'
21846 d_getpagsz='$d_getpagsz'
21847 d_getpbyname='$d_getpbyname'
21848 d_getpbynumber='$d_getpbynumber'
21849 d_getpent='$d_getpent'
21850 d_getpgid='$d_getpgid'
21851 d_getpgrp2='$d_getpgrp2'
21852 d_getpgrp='$d_getpgrp'
21853 d_getppid='$d_getppid'
21854 d_getprior='$d_getprior'
21855 d_getprotobyname_r='$d_getprotobyname_r'
21856 d_getprotobynumber_r='$d_getprotobynumber_r'
21857 d_getprotoent_r='$d_getprotoent_r'
21858 d_getprotoprotos='$d_getprotoprotos'
21859 d_getprpwnam='$d_getprpwnam'
21860 d_getpwent='$d_getpwent'
21861 d_getpwent_r='$d_getpwent_r'
21862 d_getpwnam_r='$d_getpwnam_r'
21863 d_getpwuid_r='$d_getpwuid_r'
21864 d_getsbyname='$d_getsbyname'
21865 d_getsbyport='$d_getsbyport'
21866 d_getsent='$d_getsent'
21867 d_getservbyname_r='$d_getservbyname_r'
21868 d_getservbyport_r='$d_getservbyport_r'
21869 d_getservent_r='$d_getservent_r'
21870 d_getservprotos='$d_getservprotos'
21871 d_getspnam='$d_getspnam'
21872 d_getspnam_r='$d_getspnam_r'
21873 d_gettimeod='$d_gettimeod'
21874 d_gmtime_r='$d_gmtime_r'
21875 d_gnulibc='$d_gnulibc'
21876 d_grpasswd='$d_grpasswd'
21877 d_hasmntopt='$d_hasmntopt'
21878 d_htonl='$d_htonl'
21879 d_ilogbl='$d_ilogbl'
21880 d_inc_version_list='$d_inc_version_list'
21881 d_index='$d_index'
21882 d_inetaton='$d_inetaton'
21883 d_int64_t='$d_int64_t'
21884 d_isascii='$d_isascii'
21885 d_isfinite='$d_isfinite'
21886 d_isinf='$d_isinf'
21887 d_isnan='$d_isnan'
21888 d_isnanl='$d_isnanl'
21889 d_killpg='$d_killpg'
21890 d_lchown='$d_lchown'
21891 d_ldbl_dig='$d_ldbl_dig'
21892 d_libm_lib_version='$d_libm_lib_version'
21893 d_link='$d_link'
21894 d_localtime_r='$d_localtime_r'
21895 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21896 d_locconv='$d_locconv'
21897 d_lockf='$d_lockf'
21898 d_longdbl='$d_longdbl'
21899 d_longlong='$d_longlong'
21900 d_lseekproto='$d_lseekproto'
21901 d_lstat='$d_lstat'
21902 d_madvise='$d_madvise'
21903 d_malloc_good_size='$d_malloc_good_size'
21904 d_malloc_size='$d_malloc_size'
21905 d_mblen='$d_mblen'
21906 d_mbstowcs='$d_mbstowcs'
21907 d_mbtowc='$d_mbtowc'
21908 d_memchr='$d_memchr'
21909 d_memcmp='$d_memcmp'
21910 d_memcpy='$d_memcpy'
21911 d_memmove='$d_memmove'
21912 d_memset='$d_memset'
21913 d_mkdir='$d_mkdir'
21914 d_mkdtemp='$d_mkdtemp'
21915 d_mkfifo='$d_mkfifo'
21916 d_mkstemp='$d_mkstemp'
21917 d_mkstemps='$d_mkstemps'
21918 d_mktime='$d_mktime'
21919 d_mmap='$d_mmap'
21920 d_modfl='$d_modfl'
21921 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21922 d_modflproto='$d_modflproto'
21923 d_mprotect='$d_mprotect'
21924 d_msg='$d_msg'
21925 d_msg_ctrunc='$d_msg_ctrunc'
21926 d_msg_dontroute='$d_msg_dontroute'
21927 d_msg_oob='$d_msg_oob'
21928 d_msg_peek='$d_msg_peek'
21929 d_msg_proxy='$d_msg_proxy'
21930 d_msgctl='$d_msgctl'
21931 d_msgget='$d_msgget'
21932 d_msghdr_s='$d_msghdr_s'
21933 d_msgrcv='$d_msgrcv'
21934 d_msgsnd='$d_msgsnd'
21935 d_msync='$d_msync'
21936 d_munmap='$d_munmap'
21937 d_mymalloc='$d_mymalloc'
21938 d_nice='$d_nice'
21939 d_nl_langinfo='$d_nl_langinfo'
21940 d_nv_preserves_uv='$d_nv_preserves_uv'
21941 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21942 d_off64_t='$d_off64_t'
21943 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21944 d_oldpthreads='$d_oldpthreads'
21945 d_oldsock='$d_oldsock'
21946 d_open3='$d_open3'
21947 d_pathconf='$d_pathconf'
21948 d_pause='$d_pause'
21949 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21950 d_phostname='$d_phostname'
21951 d_pipe='$d_pipe'
21952 d_poll='$d_poll'
21953 d_portable='$d_portable'
21954 d_printf_format_null='$d_printf_format_null'
21955 d_procselfexe='$d_procselfexe'
21956 d_pseudofork='$d_pseudofork'
21957 d_pthread_atfork='$d_pthread_atfork'
21958 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21959 d_pthread_yield='$d_pthread_yield'
21960 d_pwage='$d_pwage'
21961 d_pwchange='$d_pwchange'
21962 d_pwclass='$d_pwclass'
21963 d_pwcomment='$d_pwcomment'
21964 d_pwexpire='$d_pwexpire'
21965 d_pwgecos='$d_pwgecos'
21966 d_pwpasswd='$d_pwpasswd'
21967 d_pwquota='$d_pwquota'
21968 d_qgcvt='$d_qgcvt'
21969 d_quad='$d_quad'
21970 d_random_r='$d_random_r'
21971 d_readdir64_r='$d_readdir64_r'
21972 d_readdir='$d_readdir'
21973 d_readdir_r='$d_readdir_r'
21974 d_readlink='$d_readlink'
21975 d_readv='$d_readv'
21976 d_recvmsg='$d_recvmsg'
21977 d_rename='$d_rename'
21978 d_rewinddir='$d_rewinddir'
21979 d_rmdir='$d_rmdir'
21980 d_safebcpy='$d_safebcpy'
21981 d_safemcpy='$d_safemcpy'
21982 d_sanemcmp='$d_sanemcmp'
21983 d_sbrkproto='$d_sbrkproto'
21984 d_scalbnl='$d_scalbnl'
21985 d_sched_yield='$d_sched_yield'
21986 d_scm_rights='$d_scm_rights'
21987 d_seekdir='$d_seekdir'
21988 d_select='$d_select'
21989 d_sem='$d_sem'
21990 d_semctl='$d_semctl'
21991 d_semctl_semid_ds='$d_semctl_semid_ds'
21992 d_semctl_semun='$d_semctl_semun'
21993 d_semget='$d_semget'
21994 d_semop='$d_semop'
21995 d_sendmsg='$d_sendmsg'
21996 d_setegid='$d_setegid'
21997 d_seteuid='$d_seteuid'
21998 d_setgrent='$d_setgrent'
21999 d_setgrent_r='$d_setgrent_r'
22000 d_setgrps='$d_setgrps'
22001 d_sethent='$d_sethent'
22002 d_sethostent_r='$d_sethostent_r'
22003 d_setitimer='$d_setitimer'
22004 d_setlinebuf='$d_setlinebuf'
22005 d_setlocale='$d_setlocale'
22006 d_setlocale_r='$d_setlocale_r'
22007 d_setnent='$d_setnent'
22008 d_setnetent_r='$d_setnetent_r'
22009 d_setpent='$d_setpent'
22010 d_setpgid='$d_setpgid'
22011 d_setpgrp2='$d_setpgrp2'
22012 d_setpgrp='$d_setpgrp'
22013 d_setprior='$d_setprior'
22014 d_setproctitle='$d_setproctitle'
22015 d_setprotoent_r='$d_setprotoent_r'
22016 d_setpwent='$d_setpwent'
22017 d_setpwent_r='$d_setpwent_r'
22018 d_setregid='$d_setregid'
22019 d_setresgid='$d_setresgid'
22020 d_setresuid='$d_setresuid'
22021 d_setreuid='$d_setreuid'
22022 d_setrgid='$d_setrgid'
22023 d_setruid='$d_setruid'
22024 d_setsent='$d_setsent'
22025 d_setservent_r='$d_setservent_r'
22026 d_setsid='$d_setsid'
22027 d_setvbuf='$d_setvbuf'
22028 d_sfio='$d_sfio'
22029 d_shm='$d_shm'
22030 d_shmat='$d_shmat'
22031 d_shmatprototype='$d_shmatprototype'
22032 d_shmctl='$d_shmctl'
22033 d_shmdt='$d_shmdt'
22034 d_shmget='$d_shmget'
22035 d_sigaction='$d_sigaction'
22036 d_signbit='$d_signbit'
22037 d_sigprocmask='$d_sigprocmask'
22038 d_sigsetjmp='$d_sigsetjmp'
22039 d_sitearch='$d_sitearch'
22040 d_snprintf='$d_snprintf'
22041 d_sockatmark='$d_sockatmark'
22042 d_sockatmarkproto='$d_sockatmarkproto'
22043 d_socket='$d_socket'
22044 d_socklen_t='$d_socklen_t'
22045 d_sockpair='$d_sockpair'
22046 d_socks5_init='$d_socks5_init'
22047 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22048 d_sqrtl='$d_sqrtl'
22049 d_srand48_r='$d_srand48_r'
22050 d_srandom_r='$d_srandom_r'
22051 d_sresgproto='$d_sresgproto'
22052 d_sresuproto='$d_sresuproto'
22053 d_statblks='$d_statblks'
22054 d_statfs_f_flags='$d_statfs_f_flags'
22055 d_statfs_s='$d_statfs_s'
22056 d_statvfs='$d_statvfs'
22057 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22058 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22059 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22060 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22061 d_stdio_stream_array='$d_stdio_stream_array'
22062 d_stdiobase='$d_stdiobase'
22063 d_stdstdio='$d_stdstdio'
22064 d_strchr='$d_strchr'
22065 d_strcoll='$d_strcoll'
22066 d_strctcpy='$d_strctcpy'
22067 d_strerrm='$d_strerrm'
22068 d_strerror='$d_strerror'
22069 d_strerror_r='$d_strerror_r'
22070 d_strftime='$d_strftime'
22071 d_strlcat='$d_strlcat'
22072 d_strlcpy='$d_strlcpy'
22073 d_strtod='$d_strtod'
22074 d_strtol='$d_strtol'
22075 d_strtold='$d_strtold'
22076 d_strtoll='$d_strtoll'
22077 d_strtoq='$d_strtoq'
22078 d_strtoul='$d_strtoul'
22079 d_strtoull='$d_strtoull'
22080 d_strtouq='$d_strtouq'
22081 d_strxfrm='$d_strxfrm'
22082 d_suidsafe='$d_suidsafe'
22083 d_symlink='$d_symlink'
22084 d_syscall='$d_syscall'
22085 d_syscallproto='$d_syscallproto'
22086 d_sysconf='$d_sysconf'
22087 d_sysernlst='$d_sysernlst'
22088 d_syserrlst='$d_syserrlst'
22089 d_system='$d_system'
22090 d_tcgetpgrp='$d_tcgetpgrp'
22091 d_tcsetpgrp='$d_tcsetpgrp'
22092 d_telldir='$d_telldir'
22093 d_telldirproto='$d_telldirproto'
22094 d_time='$d_time'
22095 d_times='$d_times'
22096 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22097 d_tm_tm_zone='$d_tm_tm_zone'
22098 d_tmpnam_r='$d_tmpnam_r'
22099 d_truncate='$d_truncate'
22100 d_ttyname_r='$d_ttyname_r'
22101 d_tzname='$d_tzname'
22102 d_u32align='$d_u32align'
22103 d_ualarm='$d_ualarm'
22104 d_umask='$d_umask'
22105 d_uname='$d_uname'
22106 d_union_semun='$d_union_semun'
22107 d_unordered='$d_unordered'
22108 d_unsetenv='$d_unsetenv'
22109 d_usleep='$d_usleep'
22110 d_usleepproto='$d_usleepproto'
22111 d_ustat='$d_ustat'
22112 d_vendorarch='$d_vendorarch'
22113 d_vendorbin='$d_vendorbin'
22114 d_vendorlib='$d_vendorlib'
22115 d_vendorscript='$d_vendorscript'
22116 d_vfork='$d_vfork'
22117 d_void_closedir='$d_void_closedir'
22118 d_voidsig='$d_voidsig'
22119 d_voidtty='$d_voidtty'
22120 d_volatile='$d_volatile'
22121 d_vprintf='$d_vprintf'
22122 d_vsnprintf='$d_vsnprintf'
22123 d_wait4='$d_wait4'
22124 d_waitpid='$d_waitpid'
22125 d_wcstombs='$d_wcstombs'
22126 d_wctomb='$d_wctomb'
22127 d_writev='$d_writev'
22128 d_xenix='$d_xenix'
22129 date='$date'
22130 db_hashtype='$db_hashtype'
22131 db_prefixtype='$db_prefixtype'
22132 db_version_major='$db_version_major'
22133 db_version_minor='$db_version_minor'
22134 db_version_patch='$db_version_patch'
22135 defvoidused='$defvoidused'
22136 direntrytype='$direntrytype'
22137 dlext='$dlext'
22138 dlsrc='$dlsrc'
22139 doublesize='$doublesize'
22140 drand01='$drand01'
22141 drand48_r_proto='$drand48_r_proto'
22142 dtrace='$dtrace'
22143 dynamic_ext='$dynamic_ext'
22144 eagain='$eagain'
22145 ebcdic='$ebcdic'
22146 echo='$echo'
22147 egrep='$egrep'
22148 emacs='$emacs'
22149 endgrent_r_proto='$endgrent_r_proto'
22150 endhostent_r_proto='$endhostent_r_proto'
22151 endnetent_r_proto='$endnetent_r_proto'
22152 endprotoent_r_proto='$endprotoent_r_proto'
22153 endpwent_r_proto='$endpwent_r_proto'
22154 endservent_r_proto='$endservent_r_proto'
22155 eunicefix='$eunicefix'
22156 exe_ext='$exe_ext'
22157 expr='$expr'
22158 extensions='$extensions'
22159 extras='$extras'
22160 fflushNULL='$fflushNULL'
22161 fflushall='$fflushall'
22162 find='$find'
22163 firstmakefile='$firstmakefile'
22164 flex='$flex'
22165 fpossize='$fpossize'
22166 fpostype='$fpostype'
22167 freetype='$freetype'
22168 from='$from'
22169 full_ar='$full_ar'
22170 full_csh='$full_csh'
22171 full_sed='$full_sed'
22172 gccansipedantic='$gccansipedantic'
22173 gccosandvers='$gccosandvers'
22174 gccversion='$gccversion'
22175 getgrent_r_proto='$getgrent_r_proto'
22176 getgrgid_r_proto='$getgrgid_r_proto'
22177 getgrnam_r_proto='$getgrnam_r_proto'
22178 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22179 gethostbyname_r_proto='$gethostbyname_r_proto'
22180 gethostent_r_proto='$gethostent_r_proto'
22181 getlogin_r_proto='$getlogin_r_proto'
22182 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22183 getnetbyname_r_proto='$getnetbyname_r_proto'
22184 getnetent_r_proto='$getnetent_r_proto'
22185 getprotobyname_r_proto='$getprotobyname_r_proto'
22186 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22187 getprotoent_r_proto='$getprotoent_r_proto'
22188 getpwent_r_proto='$getpwent_r_proto'
22189 getpwnam_r_proto='$getpwnam_r_proto'
22190 getpwuid_r_proto='$getpwuid_r_proto'
22191 getservbyname_r_proto='$getservbyname_r_proto'
22192 getservbyport_r_proto='$getservbyport_r_proto'
22193 getservent_r_proto='$getservent_r_proto'
22194 getspnam_r_proto='$getspnam_r_proto'
22195 gidformat='$gidformat'
22196 gidsign='$gidsign'
22197 gidsize='$gidsize'
22198 gidtype='$gidtype'
22199 glibpth='$glibpth'
22200 gmake='$gmake'
22201 gmtime_r_proto='$gmtime_r_proto'
22202 gnulibc_version='$gnulibc_version'
22203 grep='$grep'
22204 groupcat='$groupcat'
22205 groupstype='$groupstype'
22206 gzip='$gzip'
22207 h_fcntl='$h_fcntl'
22208 h_sysfile='$h_sysfile'
22209 hint='$hint'
22210 hostcat='$hostcat'
22211 html1dir='$html1dir'
22212 html1direxp='$html1direxp'
22213 html3dir='$html3dir'
22214 html3direxp='$html3direxp'
22215 i16size='$i16size'
22216 i16type='$i16type'
22217 i32size='$i32size'
22218 i32type='$i32type'
22219 i64size='$i64size'
22220 i64type='$i64type'
22221 i8size='$i8size'
22222 i8type='$i8type'
22223 i_arpainet='$i_arpainet'
22224 i_assert='$i_assert'
22225 i_bsdioctl='$i_bsdioctl'
22226 i_crypt='$i_crypt'
22227 i_db='$i_db'
22228 i_dbm='$i_dbm'
22229 i_dirent='$i_dirent'
22230 i_dld='$i_dld'
22231 i_dlfcn='$i_dlfcn'
22232 i_fcntl='$i_fcntl'
22233 i_float='$i_float'
22234 i_fp='$i_fp'
22235 i_fp_class='$i_fp_class'
22236 i_gdbm='$i_gdbm'
22237 i_grp='$i_grp'
22238 i_ieeefp='$i_ieeefp'
22239 i_inttypes='$i_inttypes'
22240 i_langinfo='$i_langinfo'
22241 i_libutil='$i_libutil'
22242 i_limits='$i_limits'
22243 i_locale='$i_locale'
22244 i_machcthr='$i_machcthr'
22245 i_malloc='$i_malloc'
22246 i_math='$i_math'
22247 i_memory='$i_memory'
22248 i_mntent='$i_mntent'
22249 i_ndbm='$i_ndbm'
22250 i_netdb='$i_netdb'
22251 i_neterrno='$i_neterrno'
22252 i_netinettcp='$i_netinettcp'
22253 i_niin='$i_niin'
22254 i_poll='$i_poll'
22255 i_prot='$i_prot'
22256 i_pthread='$i_pthread'
22257 i_pwd='$i_pwd'
22258 i_rpcsvcdbm='$i_rpcsvcdbm'
22259 i_sfio='$i_sfio'
22260 i_sgtty='$i_sgtty'
22261 i_shadow='$i_shadow'
22262 i_socks='$i_socks'
22263 i_stdarg='$i_stdarg'
22264 i_stddef='$i_stddef'
22265 i_stdlib='$i_stdlib'
22266 i_string='$i_string'
22267 i_sunmath='$i_sunmath'
22268 i_sysaccess='$i_sysaccess'
22269 i_sysdir='$i_sysdir'
22270 i_sysfile='$i_sysfile'
22271 i_sysfilio='$i_sysfilio'
22272 i_sysin='$i_sysin'
22273 i_sysioctl='$i_sysioctl'
22274 i_syslog='$i_syslog'
22275 i_sysmman='$i_sysmman'
22276 i_sysmode='$i_sysmode'
22277 i_sysmount='$i_sysmount'
22278 i_sysndir='$i_sysndir'
22279 i_sysparam='$i_sysparam'
22280 i_sysresrc='$i_sysresrc'
22281 i_syssecrt='$i_syssecrt'
22282 i_sysselct='$i_sysselct'
22283 i_syssockio='$i_syssockio'
22284 i_sysstat='$i_sysstat'
22285 i_sysstatfs='$i_sysstatfs'
22286 i_sysstatvfs='$i_sysstatvfs'
22287 i_systime='$i_systime'
22288 i_systimek='$i_systimek'
22289 i_systimes='$i_systimes'
22290 i_systypes='$i_systypes'
22291 i_sysuio='$i_sysuio'
22292 i_sysun='$i_sysun'
22293 i_sysutsname='$i_sysutsname'
22294 i_sysvfs='$i_sysvfs'
22295 i_syswait='$i_syswait'
22296 i_termio='$i_termio'
22297 i_termios='$i_termios'
22298 i_time='$i_time'
22299 i_unistd='$i_unistd'
22300 i_ustat='$i_ustat'
22301 i_utime='$i_utime'
22302 i_values='$i_values'
22303 i_varargs='$i_varargs'
22304 i_varhdr='$i_varhdr'
22305 i_vfork='$i_vfork'
22306 ignore_versioned_solibs='$ignore_versioned_solibs'
22307 inc_version_list='$inc_version_list'
22308 inc_version_list_init='$inc_version_list_init'
22309 incpath='$incpath'
22310 inews='$inews'
22311 initialinstalllocation='$initialinstalllocation'
22312 installarchlib='$installarchlib'
22313 installbin='$installbin'
22314 installhtml1dir='$installhtml1dir'
22315 installhtml3dir='$installhtml3dir'
22316 installman1dir='$installman1dir'
22317 installman3dir='$installman3dir'
22318 installprefix='$installprefix'
22319 installprefixexp='$installprefixexp'
22320 installprivlib='$installprivlib'
22321 installscript='$installscript'
22322 installsitearch='$installsitearch'
22323 installsitebin='$installsitebin'
22324 installsitehtml1dir='$installsitehtml1dir'
22325 installsitehtml3dir='$installsitehtml3dir'
22326 installsitelib='$installsitelib'
22327 installsiteman1dir='$installsiteman1dir'
22328 installsiteman3dir='$installsiteman3dir'
22329 installsitescript='$installsitescript'
22330 installstyle='$installstyle'
22331 installusrbinperl='$installusrbinperl'
22332 installvendorarch='$installvendorarch'
22333 installvendorbin='$installvendorbin'
22334 installvendorhtml1dir='$installvendorhtml1dir'
22335 installvendorhtml3dir='$installvendorhtml3dir'
22336 installvendorlib='$installvendorlib'
22337 installvendorman1dir='$installvendorman1dir'
22338 installvendorman3dir='$installvendorman3dir'
22339 installvendorscript='$installvendorscript'
22340 intsize='$intsize'
22341 issymlink='$issymlink'
22342 ivdformat='$ivdformat'
22343 ivsize='$ivsize'
22344 ivtype='$ivtype'
22345 known_extensions='$known_extensions'
22346 ksh='$ksh'
22347 ld='$ld'
22348 lddlflags='$lddlflags'
22349 ldflags='$ldflags'
22350 ldflags_uselargefiles='$ldflags_uselargefiles'
22351 ldlibpthname='$ldlibpthname'
22352 less='$less'
22353 lib_ext='$lib_ext'
22354 libc='$libc'
22355 libperl='$libperl'
22356 libpth='$libpth'
22357 libs='$libs'
22358 libsdirs='$libsdirs'
22359 libsfiles='$libsfiles'
22360 libsfound='$libsfound'
22361 libspath='$libspath'
22362 libswanted='$libswanted'
22363 libswanted_uselargefiles='$libswanted_uselargefiles'
22364 line='$line'
22365 lint='$lint'
22366 lkflags='$lkflags'
22367 ln='$ln'
22368 lns='$lns'
22369 localtime_r_proto='$localtime_r_proto'
22370 locincpth='$locincpth'
22371 loclibpth='$loclibpth'
22372 longdblsize='$longdblsize'
22373 longlongsize='$longlongsize'
22374 longsize='$longsize'
22375 lp='$lp'
22376 lpr='$lpr'
22377 ls='$ls'
22378 lseeksize='$lseeksize'
22379 lseektype='$lseektype'
22380 mad='$mad'
22381 madlyh='$madlyh'
22382 madlyobj='$madlyobj'
22383 madlysrc='$madlysrc'
22384 mail='$mail'
22385 mailx='$mailx'
22386 make='$make'
22387 make_set_make='$make_set_make'
22388 mallocobj='$mallocobj'
22389 mallocsrc='$mallocsrc'
22390 malloctype='$malloctype'
22391 man1dir='$man1dir'
22392 man1direxp='$man1direxp'
22393 man1ext='$man1ext'
22394 man3dir='$man3dir'
22395 man3direxp='$man3direxp'
22396 man3ext='$man3ext'
22397 mips_type='$mips_type'
22398 mistrustnm='$mistrustnm'
22399 mkdir='$mkdir'
22400 mmaptype='$mmaptype'
22401 modetype='$modetype'
22402 more='$more'
22403 multiarch='$multiarch'
22404 mv='$mv'
22405 myarchname='$myarchname'
22406 mydomain='$mydomain'
22407 myhostname='$myhostname'
22408 myuname='$myuname'
22409 n='$n'
22410 need_va_copy='$need_va_copy'
22411 netdb_hlen_type='$netdb_hlen_type'
22412 netdb_host_type='$netdb_host_type'
22413 netdb_name_type='$netdb_name_type'
22414 netdb_net_type='$netdb_net_type'
22415 nm='$nm'
22416 nm_opt='$nm_opt'
22417 nm_so_opt='$nm_so_opt'
22418 nonxs_ext='$nonxs_ext'
22419 nroff='$nroff'
22420 nvEUformat='$nvEUformat'
22421 nvFUformat='$nvFUformat'
22422 nvGUformat='$nvGUformat'
22423 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22424 nveformat='$nveformat'
22425 nvfformat='$nvfformat'
22426 nvgformat='$nvgformat'
22427 nvsize='$nvsize'
22428 nvtype='$nvtype'
22429 o_nonblock='$o_nonblock'
22430 obj_ext='$obj_ext'
22431 old_pthread_create_joinable='$old_pthread_create_joinable'
22432 optimize='$optimize'
22433 orderlib='$orderlib'
22434 osname='$osname'
22435 osvers='$osvers'
22436 otherlibdirs='$otherlibdirs'
22437 package='$package'
22438 pager='$pager'
22439 passcat='$passcat'
22440 patchlevel='$patchlevel'
22441 path_sep='$path_sep'
22442 perl5='$perl5'
22443 perl='$perl'
22444 perl_patchlevel='$perl_patchlevel'
22445 perladmin='$perladmin'
22446 perllibs='$perllibs'
22447 perlpath='$perlpath'
22448 pg='$pg'
22449 phostname='$phostname'
22450 pidtype='$pidtype'
22451 plibpth='$plibpth'
22452 pmake='$pmake'
22453 pr='$pr'
22454 prefix='$prefix'
22455 prefixexp='$prefixexp'
22456 privlib='$privlib'
22457 privlibexp='$privlibexp'
22458 procselfexe='$procselfexe'
22459 prototype='$prototype'
22460 ptrsize='$ptrsize'
22461 quadkind='$quadkind'
22462 quadtype='$quadtype'
22463 randbits='$randbits'
22464 randfunc='$randfunc'
22465 random_r_proto='$random_r_proto'
22466 randseedtype='$randseedtype'
22467 ranlib='$ranlib'
22468 rd_nodata='$rd_nodata'
22469 readdir64_r_proto='$readdir64_r_proto'
22470 readdir_r_proto='$readdir_r_proto'
22471 revision='$revision'
22472 rm='$rm'
22473 rm_try='$rm_try'
22474 rmail='$rmail'
22475 run='$run'
22476 runnm='$runnm'
22477 sPRIEUldbl='$sPRIEUldbl'
22478 sPRIFUldbl='$sPRIFUldbl'
22479 sPRIGUldbl='$sPRIGUldbl'
22480 sPRIXU64='$sPRIXU64'
22481 sPRId64='$sPRId64'
22482 sPRIeldbl='$sPRIeldbl'
22483 sPRIfldbl='$sPRIfldbl'
22484 sPRIgldbl='$sPRIgldbl'
22485 sPRIi64='$sPRIi64'
22486 sPRIo64='$sPRIo64'
22487 sPRIu64='$sPRIu64'
22488 sPRIx64='$sPRIx64'
22489 sSCNfldbl='$sSCNfldbl'
22490 sched_yield='$sched_yield'
22491 scriptdir='$scriptdir'
22492 scriptdirexp='$scriptdirexp'
22493 sed='$sed'
22494 seedfunc='$seedfunc'
22495 selectminbits='$selectminbits'
22496 selecttype='$selecttype'
22497 sendmail='$sendmail'
22498 setgrent_r_proto='$setgrent_r_proto'
22499 sethostent_r_proto='$sethostent_r_proto'
22500 setlocale_r_proto='$setlocale_r_proto'
22501 setnetent_r_proto='$setnetent_r_proto'
22502 setprotoent_r_proto='$setprotoent_r_proto'
22503 setpwent_r_proto='$setpwent_r_proto'
22504 setservent_r_proto='$setservent_r_proto'
22505 sh='$sh'
22506 shar='$shar'
22507 sharpbang='$sharpbang'
22508 shmattype='$shmattype'
22509 shortsize='$shortsize'
22510 shrpenv='$shrpenv'
22511 shsharp='$shsharp'
22512 sig_count='$sig_count'
22513 sig_name='$sig_name'
22514 sig_name_init='$sig_name_init'
22515 sig_num='$sig_num'
22516 sig_num_init='$sig_num_init'
22517 sig_size='$sig_size'
22518 signal_t='$signal_t'
22519 sitearch='$sitearch'
22520 sitearchexp='$sitearchexp'
22521 sitebin='$sitebin'
22522 sitebinexp='$sitebinexp'
22523 sitehtml1dir='$sitehtml1dir'
22524 sitehtml1direxp='$sitehtml1direxp'
22525 sitehtml3dir='$sitehtml3dir'
22526 sitehtml3direxp='$sitehtml3direxp'
22527 sitelib='$sitelib'
22528 sitelib_stem='$sitelib_stem'
22529 sitelibexp='$sitelibexp'
22530 siteman1dir='$siteman1dir'
22531 siteman1direxp='$siteman1direxp'
22532 siteman3dir='$siteman3dir'
22533 siteman3direxp='$siteman3direxp'
22534 siteprefix='$siteprefix'
22535 siteprefixexp='$siteprefixexp'
22536 sitescript='$sitescript'
22537 sitescriptexp='$sitescriptexp'
22538 sizesize='$sizesize'
22539 sizetype='$sizetype'
22540 sleep='$sleep'
22541 smail='$smail'
22542 so='$so'
22543 sockethdr='$sockethdr'
22544 socketlib='$socketlib'
22545 socksizetype='$socksizetype'
22546 sort='$sort'
22547 spackage='$spackage'
22548 spitshell='$spitshell'
22549 srand48_r_proto='$srand48_r_proto'
22550 srandom_r_proto='$srandom_r_proto'
22551 src='$src'
22552 ssizetype='$ssizetype'
22553 startperl='$startperl'
22554 startsh='$startsh'
22555 static_ext='$static_ext'
22556 stdchar='$stdchar'
22557 stdio_base='$stdio_base'
22558 stdio_bufsiz='$stdio_bufsiz'
22559 stdio_cnt='$stdio_cnt'
22560 stdio_filbuf='$stdio_filbuf'
22561 stdio_ptr='$stdio_ptr'
22562 stdio_stream_array='$stdio_stream_array'
22563 strerror_r_proto='$strerror_r_proto'
22564 strings='$strings'
22565 submit='$submit'
22566 subversion='$subversion'
22567 sysman='$sysman'
22568 tail='$tail'
22569 tar='$tar'
22570 targetarch='$targetarch'
22571 tbl='$tbl'
22572 tee='$tee'
22573 test='$test'
22574 timeincl='$timeincl'
22575 timetype='$timetype'
22576 tmpnam_r_proto='$tmpnam_r_proto'
22577 to='$to'
22578 touch='$touch'
22579 tr='$tr'
22580 trnl='$trnl'
22581 troff='$troff'
22582 ttyname_r_proto='$ttyname_r_proto'
22583 u16size='$u16size'
22584 u16type='$u16type'
22585 u32size='$u32size'
22586 u32type='$u32type'
22587 u64size='$u64size'
22588 u64type='$u64type'
22589 u8size='$u8size'
22590 u8type='$u8type'
22591 uidformat='$uidformat'
22592 uidsign='$uidsign'
22593 uidsize='$uidsize'
22594 uidtype='$uidtype'
22595 uname='$uname'
22596 uniq='$uniq'
22597 uquadtype='$uquadtype'
22598 use5005threads='$use5005threads'
22599 use64bitall='$use64bitall'
22600 use64bitint='$use64bitint'
22601 usecrosscompile='$usecrosscompile'
22602 usedl='$usedl'
22603 usedtrace='$usedtrace'
22604 usefaststdio='$usefaststdio'
22605 useithreads='$useithreads'
22606 uselargefiles='$uselargefiles'
22607 uselongdouble='$uselongdouble'
22608 usemallocwrap='$usemallocwrap'
22609 usemorebits='$usemorebits'
22610 usemultiplicity='$usemultiplicity'
22611 usemymalloc='$usemymalloc'
22612 usenm='$usenm'
22613 useopcode='$useopcode'
22614 useperlio='$useperlio'
22615 useposix='$useposix'
22616 usereentrant='$usereentrant'
22617 userelocatableinc='$userelocatableinc'
22618 usesfio='$usesfio'
22619 useshrplib='$useshrplib'
22620 usesitecustomize='$usesitecustomize'
22621 usesocks='$usesocks'
22622 usethreads='$usethreads'
22623 usevendorprefix='$usevendorprefix'
22624 usevfork='$usevfork'
22625 usrinc='$usrinc'
22626 uuname='$uuname'
22627 uvXUformat='$uvXUformat'
22628 uvoformat='$uvoformat'
22629 uvsize='$uvsize'
22630 uvtype='$uvtype'
22631 uvuformat='$uvuformat'
22632 uvxformat='$uvxformat'
22633 vendorarch='$vendorarch'
22634 vendorarchexp='$vendorarchexp'
22635 vendorbin='$vendorbin'
22636 vendorbinexp='$vendorbinexp'
22637 vendorhtml1dir='$vendorhtml1dir'
22638 vendorhtml1direxp='$vendorhtml1direxp'
22639 vendorhtml3dir='$vendorhtml3dir'
22640 vendorhtml3direxp='$vendorhtml3direxp'
22641 vendorlib='$vendorlib'
22642 vendorlib_stem='$vendorlib_stem'
22643 vendorlibexp='$vendorlibexp'
22644 vendorman1dir='$vendorman1dir'
22645 vendorman1direxp='$vendorman1direxp'
22646 vendorman3dir='$vendorman3dir'
22647 vendorman3direxp='$vendorman3direxp'
22648 vendorprefix='$vendorprefix'
22649 vendorprefixexp='$vendorprefixexp'
22650 vendorscript='$vendorscript'
22651 vendorscriptexp='$vendorscriptexp'
22652 version='$version'
22653 version_patchlevel_string='$version_patchlevel_string'
22654 versiononly='$versiononly'
22655 vi='$vi'
22656 voidflags='$voidflags'
22657 xlibpth='$xlibpth'
22658 yacc='$yacc'
22659 yaccflags='$yaccflags'
22660 zcat='$zcat'
22661 zip='$zip'
22662 EOT
22663
22664 : Add in command line options if available
22665 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22666
22667 : add special variables
22668 $test -f $src/patchlevel.h && \
22669 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22670 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22671 echo "PERL_CONFIG_SH=true" >>config.sh
22672
22673 : propagate old symbols
22674 if $test -f UU/config.sh; then
22675         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22676         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
22677                 config.sh config.sh UU/oldconfig.sh |\
22678                 $sort | $uniq -u >UU/oldsyms
22679         set X `cat UU/oldsyms`
22680         shift
22681         case $# in
22682         0) ;;
22683         *)
22684                 cat <<EOM
22685 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22686 EOM
22687                 echo ": Variables propagated from previous config.sh file." >>config.sh
22688                 for sym in `cat UU/oldsyms`; do
22689                         echo "    Propagating $hint variable "'$'"$sym..."
22690                         eval 'tmp="$'"${sym}"'"'
22691                         echo "$tmp" | \
22692                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22693                 done
22694                 ;;
22695         esac
22696 fi
22697
22698 : Finish up by extracting the .SH files
22699 case "$alldone" in
22700 exit)
22701         $rm -rf UU
22702         echo "Extraction done."
22703         exit 0
22704         ;;
22705 cont)
22706         ;;
22707 '')
22708         dflt=''
22709         nostick=true
22710         $cat <<EOM
22711
22712 If you'd like to make any changes to the config.sh file before I begin
22713 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22714
22715 EOM
22716         rp="Press return or use a shell escape to edit config.sh:"
22717         . UU/myread
22718         nostick=''
22719         case "$ans" in
22720         '') ;;
22721         *) : in case they cannot read
22722                 sh 1>&4 -c "$ans";;
22723         esac
22724         ;;
22725 esac
22726
22727 : if this fails, just run all the .SH files by hand
22728 . ./config.sh
22729
22730 echo " "
22731 exec 1>&4
22732 pwd=`pwd`
22733 . ./UU/extract
22734 cd "$pwd"
22735
22736 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22737         dflt=y
22738         case "$silent" in
22739         true) ;;
22740         *)
22741                 $cat <<EOM
22742
22743 Now you need to generate make dependencies by running "$make depend".
22744 You might prefer to run it in background: "$make depend > makedepend.out &"
22745 It can take a while, so you might not want to run it right now.
22746
22747 EOM
22748                 ;;
22749         esac
22750         rp="Run $make depend now?"
22751         . UU/myread
22752         case "$ans" in
22753         y*)
22754                 $make depend && echo "Now you must run '$make'."
22755                 ;;
22756         *)
22757                 echo "You must run '$make depend' then '$make'."
22758                 ;;
22759         esac
22760 elif test -f [Mm]akefile; then
22761         echo " "
22762         echo "Now you must run a $make."
22763 else
22764         echo "Configure done."
22765 fi
22766
22767 if $test -f Policy.sh; then
22768     $cat <<EOM
22769
22770 If you compile $package on a different machine or from a different object
22771 directory, copy the Policy.sh file from this object directory to the
22772 new one before you run Configure -- this will help you with most of
22773 the policy defaults.
22774
22775 EOM
22776 fi
22777 if $test -f config.msg; then
22778     echo "Hmm.  I also noted the following information while running:"
22779     echo " "
22780     $cat config.msg >&4
22781     $rm -f config.msg
22782 fi
22783 $rm -f kit*isdone ark*isdone
22784 $rm -rf UU
22785
22786 : End of Configure
22787