887238eda9821081a5b6838a7151457ab61abb2c
[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-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Jul 18 17:42:05 CEST 2007 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 if test ! -c /dev/null ; then
69         cat >&4 <<EOF
70 ***
71 *** I'm sorry, but /dev/null appears to be a file rather than a device.
72 *** Please consult your operating sytem's notes for making a device
73 *** in /dev.
74 *** Cannot continue, aborting.
75 ***
76 EOF
77         exit 1
78 fi
79
80 : compute my invocation name
81 me=$0
82 case "$0" in
83 */*)
84         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85         test "$me" || me=$0
86         ;;
87 esac
88
89 : Proper separator for the PATH environment variable
90 p_=:
91 : On OS/2 this directory should exist if this is not floppy only system :-]
92 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93     if test -n "$OS2_SHELL"; then
94                 p_=\;
95                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97                 is_os2=yes
98         elif test -n "$DJGPP"; then
99                 case "X${MACHTYPE:-nonesuchmach}" in
100                 *cygwin) ;;
101                 *) p_=\; ;;
102                 esac
103         fi
104 fi
105
106 : Proper PATH setting
107 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114 paths="$paths /sbin /usr/sbin /usr/libexec"
115 paths="$paths /system/gnu_library/bin"
116
117 for p in $paths
118 do
119         case "$p_$PATH$p_" in
120         *$p_$p$p_*) ;;
121         *) test -d $p && PATH=$PATH$p_$p ;;
122         esac
123 done
124
125 PATH=.$p_$PATH
126 export PATH
127
128 : shall we be using ksh?
129 inksh=''
130 needksh=''
131 avoidksh=''
132 newsh=/bin/ksh
133 changesh=''
134 if (PATH=.; alias -x) >/dev/null 2>&1; then
135                 inksh=true
136 fi
137 if test -f /hp-ux -a -f /bin/ksh; then
138         needksh='to avoid sh bug in "here document" expansion'
139 fi
140 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141         if test X`/usr/bin/uname -v` = X4; then
142                 avoidksh="to avoid AIX 4's /bin/sh"
143                 newsh=/usr/bin/bsh
144         fi
145 fi
146 if test -f /osf_boot -a -f /usr/sbin/setld; then
147         if test X`/usr/bin/uname -s` = XOSF1; then
148                 avoidksh="to avoid Digital UNIX' ksh"
149                 newsh=/bin/sh
150                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151         fi
152 fi
153 case "$inksh/$needksh" in
154 /[a-z]*)
155                 ENV=''
156                 changesh=true
157                 reason="$needksh"
158         ;;
159 esac
160 case "$inksh/$avoidksh" in
161 true/[a-z]*)
162         changesh=true
163         reason="$avoidksh"
164         ;;
165 esac
166 case "$inksh/$needksh-$avoidksh-" in
167 true/--)
168                 cat <<EOM
169 (I see you are using the Korn shell.  Some ksh's blow up on $me,
170 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171 EOM
172         ;;
173 esac
174 case "$changesh" in
175 true)
176         export newsh
177         echo "(Feeding myself to $newsh $reason.)"
178         case "$0" in
179         Configure|*/Configure) exec $newsh $0 "$@";;
180         *) exec $newsh Configure "$@";;
181         esac
182         ;;
183 esac
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 : Configure runs within the UU subdirectory
196 test -d UU || mkdir UU
197 cd UU && rm -f ./*
198
199 ccname=''
200 ccversion=''
201 ccsymbols=''
202 cppccsymbols=''
203 cppsymbols=''
204 from=''
205 run=''
206 targetarch=''
207 to=''
208 usecrosscompile=''
209 mistrustnm=''
210 perllibs=''
211 dynamic_ext=''
212 extensions=''
213 known_extensions=''
214 nonxs_ext=''
215 static_ext=''
216 useopcode=''
217 useposix=''
218 extras=''
219 d_bsd=''
220 d_eunice=''
221 d_xenix=''
222 eunicefix=''
223 Mcc=''
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 charsize=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
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 usefaststdio=''
1177 ccflags_uselargefiles=''
1178 ldflags_uselargefiles=''
1179 libswanted_uselargefiles=''
1180 uselargefiles=''
1181 uselongdouble=''
1182 usemorebits=''
1183 usemultiplicity=''
1184 nm_opt=''
1185 nm_so_opt=''
1186 runnm=''
1187 usenm=''
1188 useperlio=''
1189 usesocks=''
1190 d_oldpthreads=''
1191 use5005threads=''
1192 useithreads=''
1193 usereentrant=''
1194 usethreads=''
1195 incpath=''
1196 mips_type=''
1197 usrinc=''
1198 d_vendorarch=''
1199 installvendorarch=''
1200 vendorarch=''
1201 vendorarchexp=''
1202 d_vendorbin=''
1203 installvendorbin=''
1204 vendorbin=''
1205 vendorbinexp=''
1206 installvendorhtml1dir=''
1207 vendorhtml1dir=''
1208 vendorhtml1direxp=''
1209 installvendorhtml3dir=''
1210 vendorhtml3dir=''
1211 vendorhtml3direxp=''
1212 d_vendorlib=''
1213 installvendorlib=''
1214 vendorlib=''
1215 vendorlib_stem=''
1216 vendorlibexp=''
1217 installvendorman1dir=''
1218 vendorman1dir=''
1219 vendorman1direxp=''
1220 installvendorman3dir=''
1221 vendorman3dir=''
1222 vendorman3direxp=''
1223 usevendorprefix=''
1224 vendorprefix=''
1225 vendorprefixexp=''
1226 d_vendorscript=''
1227 installvendorscript=''
1228 vendorscript=''
1229 vendorscriptexp=''
1230 versiononly=''
1231 defvoidused=''
1232 voidflags=''
1233 yacc=''
1234 yaccflags=''
1235 CONFIG=''
1236
1237 define='define'
1238 undef='undef'
1239 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240 rmlist=''
1241
1242 : We must find out about Eunice early
1243 eunicefix=':'
1244 if test -f /etc/unixtovms; then
1245         eunicefix=/etc/unixtovms
1246 fi
1247 if test -f /etc/unixtovms.exe; then
1248         eunicefix=/etc/unixtovms.exe
1249 fi
1250
1251 : Set executable suffix now -- needed before hints available
1252 if test -f "/libs/version.library"; then
1253 : Amiga OS
1254     _exe=""
1255 elif test -f "/system/gnu_library/bin/ar.pm"; then
1256 : Stratus VOS
1257     _exe=".pm"
1258 elif test -n "$DJGPP"; then
1259 : DOS DJGPP
1260     _exe=".exe"
1261 elif test -d c:/. -o -n "$is_os2" ; then
1262 : OS/2 or cygwin
1263     _exe=".exe"
1264 fi
1265
1266 i_whoami=''
1267 : Trailing extension.  Override this in a hint file, if needed.
1268 : Extra object files, if any, needed on this platform.
1269 archobjs=''
1270 archname=''
1271 groupstype=''
1272 libnames=''
1273 : change the next line if compiling for Xenix/286 on Xenix/386
1274 xlibpth='/usr/lib/386 /lib/386'
1275 : Possible local library directories to search.
1276 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279 : general looking path for locating libraries
1280 glibpth="/lib /usr/lib $xlibpth"
1281 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1285
1286 : Private path used by Configure to find libraries.  Its value
1287 : is prepended to libpth. This variable takes care of special
1288 : machines, like the mips.  Usually, it should be empty.
1289 plibpth=''
1290
1291 : default library list
1292 libswanted=''
1293 : some systems want to use only the non-versioned libso:s
1294 ignore_versioned_solibs=''
1295 siteman1dir=''
1296 siteman3dir=''
1297 sitescript=''
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
1456 : Save command line options in file UU/cmdline.opt for later use in
1457 : generating config.sh.
1458 cat > cmdline.opt <<EOSH
1459 # Configure command line arguments.
1460 config_arg0='$0'
1461 config_args='$*'
1462 config_argc=$#
1463 EOSH
1464 argn=1
1465 args_exp=''
1466 args_sep=''
1467 for arg in "$@"; do
1468         cat >>cmdline.opt <<EOSH
1469 config_arg$argn='$arg'
1470 EOSH
1471         # Extreme backslashitis: replace each ' by '"'"'
1472         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473 $arg
1474 EOC
1475         arg_exp=`cat cmdl.opt`
1476         args_exp="$args_exp$args_sep'$arg_exp'"
1477         argn=`expr $argn + 1`
1478         args_sep=' '
1479 done
1480 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481 # used by ./hints/os2.sh
1482 rm -f cmdl.opt
1483
1484 : produce awk script to parse command line options
1485 cat >options.awk <<'EOF'
1486 BEGIN {
1487         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1488
1489         len = length(optstr);
1490         for (i = 1; i <= len; i++) {
1491                 c = substr(optstr, i, 1);
1492                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493                 if (a == ":") {
1494                         arg[c] = 1;
1495                         i++;
1496                 }
1497                 opt[c] = 1;
1498         }
1499 }
1500 {
1501         expect = 0;
1502         str = $0;
1503         if (substr(str, 1, 1) != "-") {
1504                 printf("'%s'\n", str);
1505                 next;
1506         }
1507         len = length($0);
1508         for (i = 2; i <= len; i++) {
1509                 c = substr(str, i, 1);
1510                 if (!opt[c]) {
1511                         printf("-%s\n", substr(str, i));
1512                         next;
1513                 }
1514                 printf("-%s\n", c);
1515                 if (arg[c]) {
1516                         if (i < len)
1517                                 printf("'%s'\n", substr(str, i + 1));
1518                         else
1519                                 expect = 1;
1520                         next;
1521                 }
1522         }
1523 }
1524 END {
1525         if (expect)
1526                 print "?";
1527 }
1528 EOF
1529
1530 : process the command line options
1531 set X `for arg in "$@"; do echo "X$arg"; done |
1532         sed -e s/X// | awk -f options.awk`
1533 eval "set $*"
1534 shift
1535 rm -f options.awk
1536
1537 : set up default values
1538 fastread=''
1539 reuseval=false
1540 config_sh=''
1541 alldone=''
1542 error=''
1543 silent=''
1544 extractsh=''
1545 override=''
1546 knowitall=''
1547 rm -f optdef.sh posthint.sh
1548 cat >optdef.sh <<EOS
1549 $startsh
1550 EOS
1551
1552
1553 : option parsing
1554 while test $# -gt 0; do
1555         case "$1" in
1556         -d) shift; fastread=yes;;
1557         -e) shift; alldone=cont;;
1558         -f)
1559                 shift
1560                 cd ..
1561                 if test -r "$1"; then
1562                         config_sh="$1"
1563                 else
1564                         echo "$me: cannot read config file $1." >&2
1565                         error=true
1566                 fi
1567                 cd UU
1568                 shift;;
1569         --help|\
1570         -h) shift; error=true;;
1571         -r) shift; reuseval=true;;
1572         -s) shift; silent=true; realsilent=true;;
1573         -E) shift; alldone=exit;;
1574         -K) shift; knowitall=true;;
1575         -O) shift; override=true;;
1576         -S) shift; silent=true; extractsh=true;;
1577         -D)
1578                 shift
1579                 case "$1" in
1580                 *=)
1581                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1582                         echo "$me: ignoring -D $1" >&2
1583                         ;;
1584                 *=*) echo "$1" | \
1585                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1586                 *) echo "$1='define'" >> optdef.sh;;
1587                 esac
1588                 shift
1589                 ;;
1590         -U)
1591                 shift
1592                 case "$1" in
1593                 *=) echo "$1" >> optdef.sh;;
1594                 *=*)
1595                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1596                         echo "$me: ignoring -U $1" >&2
1597                         ;;
1598                 *) echo "$1='undef'" >> optdef.sh;;
1599                 esac
1600                 shift
1601                 ;;
1602         -A)
1603             shift
1604             xxx=''
1605             yyy="$1"
1606             zzz=''
1607             uuu=undef
1608             case "$yyy" in
1609             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1610                  case "$zzz" in
1611                  *:*) zzz='' ;;
1612                  *)   xxx=append
1613                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1614                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1615                  esac
1616                  ;;
1617             esac
1618             case "$xxx" in
1619             '')  case "$yyy" in
1620                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1622                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1623                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1624                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1625                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1626                  esac
1627                  ;;       
1628             esac
1629             case "$xxx" in
1630             append)
1631                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1632             clear)
1633                 echo "$yyy=''"                  >> posthint.sh ;;
1634             define)
1635                 case "$zzz" in
1636                 '') zzz=define ;;
1637                 esac
1638                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1639             eval)
1640                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1641             prepend)
1642                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1643             undef)
1644                 case "$zzz" in
1645                 '') zzz="$uuu" ;;
1646                 esac
1647                 echo "$yyy=$zzz"                >> posthint.sh ;;
1648             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1649             esac
1650             shift
1651             ;;
1652         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1653             exit 0;;
1654         --) break;;
1655         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1656         *) break;;
1657         esac
1658 done
1659
1660 case "$error" in
1661 true)
1662         cat >&2 <<EOM
1663 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1664                  [-U symbol] [-U symbol=] [-A command:symbol...]
1665   -d : use defaults for all answers.
1666   -e : go on without questioning past the production of config.sh.
1667   -f : specify an alternate default configuration file.
1668   -h : print this help message and exit (with an error status).
1669   -r : reuse C symbols value if possible (skips costly nm extraction).
1670   -s : silent mode, only echoes questions and essential information.
1671   -D : define symbol to have some value:
1672          -D symbol         symbol gets the value 'define'
1673          -D symbol=value   symbol gets the value 'value'
1674        common used examples (see INSTALL for more info):
1675          -Duse64bitint            use 64bit integers
1676          -Duse64bitall            use 64bit integers and pointers
1677          -Dusethreads             use thread support
1678          -Dinc_version_list=none  do not include older perl trees in @INC
1679          -DEBUGGING=none          DEBUGGING options
1680          -Dcc=gcc                 choose your compiler
1681          -Dprefix=/opt/perl5      choose your destination
1682   -E : stop at the end of questions, after having produced config.sh.
1683   -K : do not use unless you know what you are doing.
1684   -O : let -D and -U override definitions from loaded configuration file.
1685   -S : perform variable substitutions on all .SH files (can mix with -f)
1686   -U : undefine symbol:
1687          -U symbol    symbol gets the value 'undef'
1688          -U symbol=   symbol gets completely empty
1689        e.g.:  -Uversiononly
1690   -A : manipulate symbol after the platform specific hints have been applied:
1691          -A append:symbol=value   append value to symbol
1692          -A symbol=value          like append:, but with a separating space
1693          -A define:symbol=value   define symbol to have value
1694          -A clear:symbol          define symbol to be ''
1695          -A define:symbol         define symbol to be 'define'
1696          -A eval:symbol=value     define symbol to be eval of value
1697          -A prepend:symbol=value  prepend value to symbol
1698          -A undef:symbol          define symbol to be 'undef'
1699          -A undef:symbol=         define symbol to be ''
1700        e.g.:  -A prepend:libswanted='cl pthread '
1701               -A ccflags=-DSOME_MACRO
1702   -V : print version number and exit (with a zero status).
1703 EOM
1704         exit 1
1705         ;;
1706 esac
1707
1708 : Sanity checks
1709 case "$fastread$alldone" in
1710 yescont|yesexit) ;;
1711 *)
1712         case "$extractsh" in
1713         true) ;;
1714         *)
1715                 if test ! -t 0; then
1716                         echo "Say 'sh Configure', not 'sh <Configure'"
1717                         exit 1
1718                 fi
1719                 ;;
1720         esac
1721         ;;
1722 esac
1723
1724 exec 4>&1
1725 case "$silent" in
1726 true) exec 1>/dev/null;;
1727 esac
1728
1729 : run the defines and the undefines, if any, but leave the file out there...
1730 touch optdef.sh
1731 . ./optdef.sh
1732 : create the posthint manipulation script and leave the file out there...
1733 touch posthint.sh
1734
1735 : set package name
1736 package=perl5
1737 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1738 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1739 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1740 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1741 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1742 esac
1743
1744 : Some greps do not return status, grrr.
1745 echo "grimblepritz" >grimble
1746 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1747         contains=contains
1748 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1749         contains=grep
1750 else
1751         contains=contains
1752 fi
1753 rm -f grimble
1754 : the following should work in any shell
1755 case "$contains" in
1756 contains*)
1757         echo " "
1758         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1759         cat >contains <<'EOSS'
1760 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1761 EOSS
1762 chmod +x contains
1763 esac
1764
1765 : Find the path to the source tree
1766 case "$src" in
1767 '') case "$0" in
1768     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1769          case "$src" in
1770          /*)    ;;
1771          .)     ;;
1772          *)     src=`cd ../$src && pwd` ;;
1773          esac
1774          ;;
1775     *)   src='.';;
1776     esac;;
1777 esac
1778 case "$src" in
1779 '')     src=/
1780         rsrc=/
1781         ;;
1782 /*) rsrc="$src";;
1783 *) rsrc="../$src";;
1784 esac
1785 if test -f $rsrc/Configure && \
1786         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1787 then
1788    : found it, so we are ok.
1789 else
1790         rsrc=''
1791         for src in . .. ../.. ../../.. ../../../..; do
1792                 if test -f ../$src/Configure && \
1793                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1794                 then
1795                         rsrc=../$src
1796                         break
1797                 fi
1798         done
1799 fi
1800 case "$rsrc" in
1801 '')
1802         cat <<EOM >&4
1803
1804 Sorry, I can't seem to locate the source dir for $package.  Please start
1805 Configure with an explicit path -- i.e. /some/path/Configure.
1806
1807 EOM
1808         exit 1
1809         ;;
1810 ../.)   rsrc='..';;
1811 *)
1812         echo " "
1813         echo "Sources for $package found in \"$src\"." >&4
1814         ;;
1815 esac
1816
1817 : script used to extract .SH files with variable substitutions
1818 cat >extract <<'EOS'
1819 PERL_CONFIG_SH=true
1820 echo "Doing variable substitutions on .SH files..."
1821 if test -f MANIFEST; then
1822         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1823 else
1824         echo "(Looking for .SH files under the source directory.)"
1825         set x `(cd "$src"; find . -name "*.SH" -print)`
1826 fi
1827 shift
1828 case $# in
1829 0) set x `(cd "$src"; echo *.SH)`; shift;;
1830 esac
1831 if test ! -f "$src/$1"; then
1832         shift
1833 fi
1834 mkdir_p='
1835 name=$1;
1836 create="";
1837 while test $name; do
1838         if test ! -d "$name"; then
1839                 create="$name $create";
1840                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1841                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1842         else
1843                 name="";
1844         fi;
1845 done;
1846 for file in $create; do
1847         mkdir $file;
1848 done
1849 '
1850 for file in $*; do
1851         case "$src" in
1852         ".")
1853                 case "$file" in
1854                 */*)
1855                         dir=`expr X$file : 'X\(.*\)/'`
1856                         file=`expr X$file : 'X.*/\(.*\)'`
1857                         (cd "$dir" && . ./$file)
1858                         ;;
1859                 *)
1860                         . ./$file
1861                         ;;
1862                 esac
1863                 ;;
1864         *)
1865                 case "$file" in
1866                 */*)
1867                         dir=`expr X$file : 'X\(.*\)/'`
1868                         file=`expr X$file : 'X.*/\(.*\)'`
1869                         (set x $dir; shift; eval $mkdir_p)
1870                         sh <"$src/$dir/$file"
1871                         ;;
1872                 *)
1873                         sh <"$src/$file"
1874                         ;;
1875                 esac
1876                 ;;
1877         esac
1878 done
1879 if test -f "$src/config_h.SH"; then
1880         if test ! -f config.h; then
1881         : oops, they left it out of MANIFEST, probably, so do it anyway.
1882         . "$src/config_h.SH"
1883         fi
1884 fi
1885 EOS
1886
1887 : extract files and exit if asked to do so
1888 case "$extractsh" in
1889 true)
1890         case "$realsilent" in
1891         true) ;;
1892         *) exec 1>&4;;
1893         esac
1894         case "$config_sh" in
1895         '') config_sh='config.sh';;
1896         esac
1897         echo " "
1898         echo "Fetching answers from $config_sh..."
1899         cd ..
1900         . $config_sh
1901         test "$override" && . ./optdef.sh
1902         echo " "
1903         . UU/extract
1904         rm -rf UU
1905         echo "Extraction done."
1906         exit 0
1907         ;;
1908 esac
1909
1910 : Eunice requires " " instead of "", can you believe it
1911 echo " "
1912 : Here we go...
1913 echo "Beginning of configuration questions for $package."
1914
1915 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1916
1917 : first determine how to suppress newline on echo command
1918 echo " "
1919 echo "Checking echo to see how to suppress newlines..."
1920 (echo "hi there\c" ; echo " ") >.echotmp
1921 if $contains c .echotmp >/dev/null 2>&1 ; then
1922         echo "...using -n."
1923         n='-n'
1924         c=''
1925 else
1926         cat <<'EOM'
1927 ...using \c
1928 EOM
1929         n=''
1930         c='\c'
1931 fi
1932 echo $n "The star should be here-->$c"
1933 echo '*'
1934 rm -f .echotmp
1935
1936 : Now test for existence of everything in MANIFEST
1937 echo " "
1938 if test -f "$rsrc/MANIFEST"; then
1939         echo "First let's make sure your kit is complete.  Checking..." >&4
1940         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1941         rm -f missing
1942         tmppwd=`pwd`
1943         for filelist in x??; do
1944                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1945         done
1946         if test -s missing; then
1947                 cat missing >&4
1948                 cat >&4 <<'EOM'
1949
1950 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952 You have the option of continuing the configuration process, despite the
1953 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1954 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1955 and contact the author (perlbug@perl.org).
1956
1957 EOM
1958                 echo $n "Continue? [n] $c" >&4
1959                 read ans
1960                 case "$ans" in
1961                 y*)
1962                         echo "Continuing..." >&4
1963                         rm -f missing
1964                         ;;
1965                 *)
1966                         echo "ABORTING..." >&4
1967                         kill $$
1968                         ;;
1969                 esac
1970         else
1971                 echo "Looks good..."
1972         fi
1973 else
1974         echo "There is no MANIFEST file.  I hope your kit is complete !"
1975 fi
1976 rm -f missing x??
1977
1978 echo " "
1979 : Find the appropriate value for a newline for tr
1980 if test -n "$DJGPP"; then
1981        trnl='\012'
1982 fi
1983 if test X"$trnl" = X; then
1984         case "`echo foo|tr '\n' x 2>/dev/null`" in
1985         foox) trnl='\n' ;;
1986         esac
1987 fi
1988 if test X"$trnl" = X; then
1989         case "`echo foo|tr '\012' x 2>/dev/null`" in
1990         foox) trnl='\012' ;;
1991         esac
1992 fi
1993 if test X"$trnl" = X; then
1994        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995        fooxy) trnl='\n\r' ;;
1996        esac
1997 fi
1998 if test X"$trnl" = X; then
1999         cat <<EOM >&2
2000
2001 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003 EOM
2004         exit 1
2005 fi
2006
2007 : compute the number of columns on the terminal for proper question formatting
2008 case "$COLUMNS" in
2009 '') COLUMNS='80';;
2010 esac
2011
2012 : set up the echo used in my read
2013 myecho="case \"\$xxxm\" in
2014 '') echo $n \"\$rp $c\" >&4;;
2015 *) case \"\$rp\" in
2016         '') echo $n \"[\$xxxm] $c\";;
2017         *)
2018                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2019                         echo \"\$rp\" >&4
2020                         echo $n \"[\$xxxm] $c\" >&4
2021                 else
2022                         echo $n \"\$rp [\$xxxm] $c\" >&4
2023                 fi
2024                 ;;
2025         esac;;
2026 esac"
2027
2028 : now set up to do reads with possible shell escape and default assignment
2029 cat <<EOSC >myread
2030 $startsh
2031 xxxm=\$dflt
2032 $myecho
2033 ans='!'
2034 case "\$fastread" in
2035 yes) case "\$dflt" in
2036         '') ;;
2037         *) ans='';
2038                 case "\$silent-\$rp" in
2039                 true-) ;;
2040                 *) echo " " >&4;;
2041                 esac;;
2042         esac;;
2043 *) case "\$silent" in
2044         true) case "\$rp" in
2045                 '') ans='';;
2046                 esac;;
2047         esac;;
2048 esac
2049 while expr "X\$ans" : "X!" >/dev/null; do
2050         read answ
2051         set x \$xxxm
2052         shift
2053         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2054         case  "\$answ" in
2055         "!")
2056                 sh 1>&4
2057                 echo " "
2058                 $myecho
2059                 ;;
2060         !*)
2061                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062                 shift
2063                 sh 1>&4 -c "\$*"
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         "\$ans")
2068                 case "\$ans" in
2069                 \\&*)
2070                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071                         shift
2072                         case "\$1" in
2073                         -d)
2074                                 fastread=yes
2075                                 echo "(OK, I'll run with -d after this question.)" >&4
2076                                 ;;
2077                         -*)
2078                                 echo "*** Sorry, \$1 not supported yet." >&4
2079                                 ;;
2080                         esac
2081                         $myecho
2082                         ans=!
2083                         ;;
2084                 esac;;
2085         *)
2086                 case "\$aok" in
2087                 y)
2088                         echo "*** Substitution done -- please confirm."
2089                         xxxm="\$ans"
2090                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2091                         xxxm="\$ans"
2092                         ans=!
2093                         ;;
2094                 *)
2095                         echo "*** Error -- try again."
2096                         ans=!
2097                         ;;
2098                 esac
2099                 $myecho
2100                 ;;
2101         esac
2102         case "\$ans\$xxxm\$nostick" in
2103         '')
2104                 ans=!
2105                 $myecho
2106                 ;;
2107         esac
2108 done
2109 case "\$ans" in
2110 '') ans="\$xxxm";;
2111 esac
2112 EOSC
2113
2114 : create .config dir to save info across Configure sessions
2115 test -d ../.config || mkdir ../.config
2116 cat >../.config/README <<EOF
2117 This directory created by Configure to save information that should
2118 persist across sessions for $package.
2119
2120 You may safely delete it if you wish.
2121 EOF
2122
2123 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2124 case "$usedevel" in
2125 $define|true|[yY]*) ;;
2126 *) case "$xversion" in
2127    *[13579])
2128         cat >&4 <<EOH
2129 *** WHOA THERE!!! ***
2130
2131     This is an UNSTABLE DEVELOPMENT release.
2132     The version of this $package distribution is $xversion, that is, odd,
2133     (as opposed to even) and that signifies a development release.
2134     If you want a maintenance release, you want an even-numbered version.
2135
2136     Do ***NOT*** install this into production use.
2137     Data corruption and crashes are possible.
2138
2139     It is most seriously suggested that you do not continue any further
2140     unless you want to help in developing and debugging Perl.
2141
2142     If you *still* want to build perl, you can answer 'y' now,
2143     or pass -Dusedevel to Configure.
2144
2145 EOH
2146         rp='Do you really want to continue?'
2147         dflt='n'
2148         . ./myread
2149         case "$ans" in
2150         [yY]) echo >&4 "Okay, continuing."
2151               usedevel="$define" ;;
2152         *) echo >&4 "Okay, bye."
2153            exit 1
2154            ;;
2155         esac
2156         ;;
2157     esac
2158     ;;
2159 esac
2160 case "$usedevel" in
2161 $define|true|[yY]*)
2162         case "$versiononly" in
2163         '') versiononly="$define" ;;
2164         esac
2165         case "$installusrbinperl" in
2166         '') installusrbinperl="$undef" ;;
2167         esac
2168         ;;
2169 esac
2170
2171 : general instructions
2172 needman=true
2173 firsttime=true
2174 user=`(logname) 2>/dev/null`
2175 case "$user" in
2176 '') user=`whoami 2>&1`;;
2177 esac
2178 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179         firsttime=false
2180         echo " "
2181         rp='Would you like to see the instructions?'
2182         dflt=n
2183         . ./myread
2184         case "$ans" in
2185         [yY]*) ;;
2186         *) needman=false;;
2187         esac
2188 fi
2189 if $needman; then
2190         cat <<EOH
2191
2192 This installation shell script will examine your system and ask you questions
2193 to determine how the perl5 package should be installed. If you get
2194 stuck on a question, you may use a ! shell escape to start a subshell or
2195 execute a command.  Many of the questions will have default answers in square
2196 brackets; typing carriage return will give you the default.
2197
2198 On some of the questions which ask for file or directory names you are allowed
2199 to use the ~name construct to specify the login directory belonging to "name",
2200 even if you don't have a shell which knows about that.  Questions where this is
2201 allowed will be marked "(~name ok)".
2202
2203 EOH
2204         rp=''
2205         dflt='Type carriage return to continue'
2206         . ./myread
2207         cat <<'EOH'
2208
2209 The prompter used in this script allows you to use shell variables and
2210 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2211 in the default answer, as if the default line was a set of arguments given to a
2212 script shell.  This means you may also use $* to repeat the whole default line,
2213 so you do not have to re-type everything to add something to the default.
2214
2215 Everytime there is a substitution, you will have to confirm.  If there is an
2216 error (e.g. an unmatched backtick), the default answer will remain unchanged
2217 and you will be prompted again.
2218
2219 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2220 the questions and use the computed defaults (or the previous answers if there
2221 was already a config.sh file). Type 'Configure -h' for a list of options.
2222 You may also start interactively and then answer '& -d' at any prompt to turn
2223 on the non-interactive behaviour for the remainder of the execution.
2224
2225 EOH
2226         . ./myread
2227         cat <<EOH
2228
2229 Much effort has been expended to ensure that this shell script will run on any
2230 Unix system.  If despite that it blows up on yours, your best bet is to edit
2231 Configure and run it again.  If you can't run Configure for some reason,
2232 you'll have to generate a config.sh file by hand.  Whatever problems you
2233 have, let me (perlbug@perl.org) know how I blew it.
2234
2235 This installation script affects things in two ways:
2236
2237 1) it may do direct variable substitutions on some of the files included
2238    in this kit.
2239 2) it builds a config.h file for inclusion in C programs.  You may edit
2240    any of these files as the need arises after running this script.
2241
2242 If you make a mistake on a question, there is no easy way to back up to it
2243 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2244 files.  Configure will offer to let you do this before it runs the SH files.
2245
2246 EOH
2247         dflt='Type carriage return to continue'
2248         . ./myread
2249         case "$firsttime" in
2250         true) echo $user >>../.config/instruct;;
2251         esac
2252 fi
2253
2254 : find out where common programs are
2255 echo " "
2256 echo "Locating common programs..." >&4
2257 cat <<EOSC >loc
2258 $startsh
2259 case \$# in
2260 0) exit 1;;
2261 esac
2262 thing=\$1
2263 shift
2264 dflt=\$1
2265 shift
2266 for dir in \$*; do
2267         case "\$thing" in
2268         .)
2269         if test -d \$dir/\$thing; then
2270                 echo \$dir
2271                 exit 0
2272         fi
2273         ;;
2274         *)
2275         for thisthing in \$dir/\$thing; do
2276                 : just loop through to pick last item
2277         done
2278         if test -f \$thisthing; then
2279                 echo \$thisthing
2280                 exit 0
2281         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282                 echo \$thisthing
2283                 exit 0
2284         elif test -f \$dir/\$thing.exe; then
2285                 if test -n "$DJGPP"; then
2286                         echo \$dir/\$thing.exe
2287                 elif test "$eunicefix" != ":"; then
2288                         : on Eunice apparently
2289                         echo \$dir/\$thing
2290                         exit 0
2291                 fi
2292                 exit 0
2293         fi
2294         ;;
2295         esac
2296 done
2297 echo \$dflt
2298 exit 1
2299 EOSC
2300 chmod +x loc
2301 $eunicefix loc
2302 loclist="
2303 awk
2304 cat
2305 chmod
2306 comm
2307 cp
2308 echo
2309 expr
2310 grep
2311 ls
2312 mkdir
2313 rm
2314 sed
2315 sort
2316 touch
2317 tr
2318 uniq
2319 "
2320 trylist="
2321 Mcc
2322 ar
2323 bison
2324 byacc
2325 cpp
2326 csh
2327 date
2328 egrep
2329 gmake
2330 gzip
2331 less
2332 ln
2333 make
2334 more
2335 nm
2336 nroff
2337 pg
2338 test
2339 uname
2340 zip
2341 "
2342 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343 pth="$pth /lib /usr/lib"
2344 for file in $loclist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't know where '$file' is, and my life depends on it." >&4
2369                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370                 exit 1
2371                 ;;
2372         esac
2373 done
2374 echo " "
2375 echo "Don't worry if any of the following aren't found..."
2376 say=offhand
2377 for file in $trylist; do
2378         eval xxx=\$$file
2379         case "$xxx" in
2380         /*|?:[\\/]*)
2381                 if test -f "$xxx"; then
2382                         : ok
2383                 else
2384                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385                         xxx=`./loc $file $file $pth`
2386                 fi
2387                 ;;
2388         '') xxx=`./loc $file $file $pth`;;
2389         *) xxx=`./loc $xxx $xxx $pth`;;
2390         esac
2391         eval $file=$xxx$_exe
2392         eval _$file=$xxx
2393         case "$xxx" in
2394         /*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         ?:[\\/]*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         *)
2401                 echo "I don't see $file out there, $say."
2402                 say=either
2403                 ;;
2404         esac
2405 done
2406 case "$egrep" in
2407 egrep)
2408         echo "Substituting grep for egrep."
2409         egrep=$grep
2410         _egrep=$grep
2411         ;;
2412 esac
2413 case "$ln" in
2414 ln)
2415         echo "Substituting cp for ln."
2416         ln=$cp
2417         _ln=$cp
2418         ;;
2419 esac
2420 case "$make" in
2421 make)   
2422         case "$gmake" in
2423         gmake)
2424         echo "I can't find make or gmake, and my life depends on it." >&4
2425         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426         exit 1
2427         ;;
2428         esac
2429         ;;
2430 esac    
2431 case "$gmake" in
2432 gmake)  ;;
2433 *)      # We can't have osname yet.
2434         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435                 # Assume that gmake, if found, is definitely GNU make
2436                 # and prefer it over the system make.
2437                 echo "Substituting gmake for make."
2438                 make=$gmake
2439                 _make=$gmake
2440         fi
2441         ;;
2442 esac
2443 case "$test" in
2444 test)
2445         echo "Hopefully test is built into your sh."
2446         ;;
2447 *)
2448         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449                 echo "Using the test built into your sh."
2450                 test=test
2451                 _test=test
2452         fi
2453         ;;
2454 esac
2455 case "$echo" in
2456 echo)
2457         echo "Hopefully echo is built into your sh."
2458         ;;
2459 '') ;;
2460 *)
2461         echo " "
2462 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463         $echo $n "hi there$c" >foo1
2464         echo $n "hi there$c" >foo2
2465         if cmp foo1 foo2 >/dev/null 2>&1; then
2466                 echo "They are compatible.  In fact, they may be identical."
2467         else
2468                 case "$n" in
2469                 '-n') n='' c='\c';;
2470                 *) n='-n' c='';;
2471                 esac
2472                 cat <<FOO
2473 They are not compatible!  You are probably running ksh on a non-USG system.
2474 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475 have echo built in and we may have to run some Bourne shell scripts.  That
2476 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478 FOO
2479                 $echo $n "The star should be here-->$c"
2480                 $echo "*"
2481         fi
2482         $rm -f foo1 foo2
2483         ;;
2484 esac
2485
2486 cat <<EOS >trygcc
2487 $startsh
2488 EOS
2489 cat <<'EOSC' >>trygcc
2490 case "$cc" in
2491 '') ;;
2492 *)  $rm -f try try.*
2493     $cat >try.c <<EOM
2494 int main(int argc, char *argv[]) {
2495   return 0;
2496 }
2497 EOM
2498     if $cc -o try $ccflags $ldflags try.c; then
2499        :
2500     else
2501         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2502         despair=yes
2503         trygcc=yes
2504         case "$cc" in
2505         *gcc*) trygcc=no ;;
2506         esac
2507         # Skip this test because it gives a false match on output like:
2508         #    ./trygcc: line 23: cc: command not found
2509         # case "`$cc -v -c try.c 2>&1`" in
2510         # *gcc*) trygcc=no ;;
2511         # esac
2512         if $test X"$trygcc" = Xyes; then
2513             if gcc -o try -c try.c; then
2514                 echo " "
2515                 echo "You seem to have a working gcc, though." >&4
2516                 # Switching compilers may undo the work of hints files.
2517                 # The most common problem is -D_REENTRANT for threads.
2518                 # This heuristic catches that case, but gets false positives
2519                 # if -Dusethreads was not actually specified.  Better to
2520                 # bail out here with a useful message than fail 
2521                 # mysteriously later. Should we perhaps just try to
2522                 # re-invoke Configure -Dcc=gcc config_args ?
2523                 if $test -f usethreads.cbu; then
2524                         $cat >&4 <<EOM 
2525
2526 *** However, any setting of the C compiler flags (e.g. for thread support)
2527 *** will be lost.  It may be necessary for you to restart Configure and
2528 *** add -Dcc=gcc to your Configure command line.
2529
2530 EOM
2531                         rp="Would you like to go ahead and try gcc anyway?"
2532                         dflt=n
2533                 else
2534                         rp="Would you like to use it?"
2535                         dflt=y
2536                 fi
2537                 if $test -f myread; then
2538                     . ./myread
2539                 else
2540                     if $test -f UU/myread; then
2541                         . ./UU/myread
2542                     else
2543                         echo "Cannot find myread, sorry.  Aborting." >&2
2544                         exit 1
2545                     fi
2546                 fi  
2547                 case "$ans" in
2548                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2549                 esac
2550             fi
2551         fi
2552     fi
2553     $rm -f try try.*
2554     ;;
2555 esac
2556 EOSC
2557
2558 cat <<EOS >checkcc
2559 $startsh
2560 EOS
2561 cat <<'EOSC' >>checkcc
2562 case "$cc" in        
2563 '') ;;
2564 *)  $rm -f try try.*              
2565     $cat >try.c <<EOM
2566 int main(int argc, char *argv[]) {
2567   return 0;
2568 }
2569 EOM
2570     if $cc -o try $ccflags $ldflags try.c; then
2571        :
2572     else
2573         if $test X"$despair" = Xyes; then
2574            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2575         fi
2576         $cat >&4 <<EOM         
2577 You need to find a working C compiler.
2578 Either (purchase and) install the C compiler supplied by your OS vendor,
2579 or for a free C compiler try http://gcc.gnu.org/
2580 I cannot continue any further, aborting.
2581 EOM
2582         exit 1
2583     fi
2584     $rm -f try try.*
2585     ;;
2586 esac
2587 EOSC
2588
2589 : determine whether symbolic links are supported
2590 echo " "
2591 $touch blurfl
2592 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2593         echo "Symbolic links are supported." >&4
2594         lns="$ln -s"
2595 else
2596         echo "Symbolic links are NOT supported." >&4
2597         lns="$ln"
2598 fi
2599 $rm -f blurfl sym
2600
2601 : determine whether symbolic links are supported
2602 echo " "
2603 case "$lns" in
2604 *"ln"*" -s")
2605         echo "Checking how to test for symbolic links..." >&4
2606         $lns blurfl sym
2607         if $test "X$issymlink" = X; then
2608                 case "$newsh" in
2609                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2610                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2611                 esac
2612                 if test $? = 0; then
2613                         issymlink="test -h"
2614                 else
2615                         echo "Your builtin 'test -h' may be broken." >&4
2616                         case "$test" in
2617                         /*)     ;;
2618                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2619                                 for p in $pth
2620                                 do
2621                                         if test -f "$p/$test"; then
2622                                                 test="$p/$test"
2623                                                 break
2624                                         fi
2625                                 done
2626                                 ;;
2627                         esac
2628                         case "$test" in
2629                         /*)
2630                                 echo "Trying external '$test -h'." >&4
2631                                 issymlink="$test -h"
2632                                 if $test ! -h sym >/dev/null 2>&1; then
2633                                         echo "External '$test -h' is broken, too." >&4
2634                                         issymlink=''
2635                                 fi
2636                                 ;;
2637                         *)      issymlink='' ;;
2638                         esac
2639                 fi              
2640         fi
2641         if $test "X$issymlink" = X; then
2642                 if $test -L sym 2>/dev/null; then
2643                         issymlink="$test -L"
2644                         echo "The builtin '$test -L' worked." >&4
2645                 fi
2646         fi
2647         if $test "X$issymlink" != X; then
2648                 echo "You can test for symbolic links with '$issymlink'." >&4
2649         else
2650                 echo "I do not know how you can test for symbolic links." >&4
2651         fi
2652         $rm -f blurfl sym
2653         ;;
2654 *)      echo "No symbolic links, so not testing for their testing..." >&4
2655         ;;
2656 esac
2657 echo " "
2658
2659
2660 case "$mksymlinks" in
2661 $define|true|[yY]*)
2662         case "$src" in
2663         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2664                 exit 1
2665                 ;;
2666         *)      case "$lns:$issymlink" in
2667                 *"ln"*" -s:"*"test -"?)
2668                         echo "Creating the symbolic links..." >&4
2669                         echo "(First creating the subdirectories...)" >&4
2670                         cd ..
2671                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2672                                 read directory
2673                                 test -z "$directory" && break
2674                                 mkdir -p $directory
2675                         done
2676                         # Sanity check 1.
2677                         if test ! -d t/base; then
2678                                 echo "Failed to create the subdirectories.  Aborting." >&4
2679                                 exit 1
2680                         fi
2681                         echo "(Then creating the symlinks...)" >&4
2682                         awk '{print $1}' $src/MANIFEST | while true; do
2683                                 read filename
2684                                 test -z "$filename" && break
2685                                 if test -f $filename; then
2686                                         if $issymlink $filename; then
2687                                                 rm -f $filename
2688                                         fi
2689                                 fi
2690                                 if test -f $filename; then
2691                                         echo "$filename already exists, not symlinking."
2692                                 else
2693                                         ln -s $src/$filename $filename
2694                                 fi
2695                         done
2696                         # Sanity check 2.
2697                         if test ! -f t/base/lex.t; then
2698                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2699                                 exit 1
2700                         fi
2701                         cd UU
2702                         ;;
2703                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2704                         ;;
2705                 esac
2706                 ;;
2707         esac
2708         ;;
2709 esac
2710
2711
2712 case "$usecrosscompile" in
2713 $define|true|[yY]*)
2714         $echo "Cross-compiling..."
2715         croak=''
2716         case "$cc" in
2717         *-*-gcc) # A cross-compiling gcc, probably.
2718             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2719             ar=$targetarch-ar
2720             # leave out ld, choosing it is more complex
2721             nm=$targetarch-nm
2722             ranlib=$targetarch-ranlib
2723             $echo 'extern int foo;' > try.c
2724             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2725             shift
2726             if $test $# -gt 0; then
2727                 incpth="$incpth $*"
2728                 incpth="`$echo $incpth|$sed 's/^ //'`"
2729                 echo "Guessing incpth '$incpth'." >&4
2730                 for i in $*; do
2731                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2732                     if $test -d $j; then
2733                         libpth="$libpth $j"
2734                     fi
2735                 done   
2736                 libpth="`$echo $libpth|$sed 's/^ //'`"
2737                 echo "Guessing libpth '$libpth'." >&4
2738             fi
2739             $rm -f try.c
2740             ;;
2741         esac
2742         case "$targetarch" in
2743         '') echo "Targetarch not defined." >&4; croak=y ;;
2744         *)  echo "Using targetarch $targetarch." >&4 ;;
2745         esac
2746         case "$incpth" in
2747         '') echo "Incpth not defined." >&4; croak=y ;;
2748         *)  echo "Using incpth '$incpth'." >&4 ;;
2749         esac
2750         case "$libpth" in
2751         '') echo "Libpth not defined." >&4; croak=y ;;
2752         *)  echo "Using libpth '$libpth'." >&4 ;;
2753         esac
2754         case "$usrinc" in
2755         '') for i in $incpth; do
2756                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2757                     usrinc=$i
2758                     echo "Guessing usrinc $usrinc." >&4
2759                     break
2760                 fi
2761             done
2762             case "$usrinc" in
2763             '') echo "Usrinc not defined." >&4; croak=y ;;
2764             esac
2765             ;;
2766         *)  echo "Using usrinc $usrinc." >&4 ;;
2767         esac
2768         case "$targethost" in
2769         '') echo "Targethost not defined." >&4; croak=y ;;
2770         *)  echo "Using targethost $targethost." >&4
2771         esac
2772         locincpth=' '
2773         loclibpth=' '
2774         case "$croak" in
2775         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2776         esac
2777         case "$src" in
2778         /*) run=$src/Cross/run
2779             targetmkdir=$src/Cross/mkdir
2780             to=$src/Cross/to
2781             from=$src/Cross/from
2782             ;;
2783         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2784             run=$pwd/Cross/run
2785             targetmkdir=$pwd/Cross/mkdir
2786             to=$pwd/Cross/to
2787             from=$pwd/Cross/from
2788             ;;
2789         esac
2790         case "$targetrun" in
2791         '') targetrun=ssh ;;
2792         esac
2793         case "$targetto" in
2794         '') targetto=scp ;;
2795         esac
2796         case "$targetfrom" in
2797         '') targetfrom=scp ;;
2798         esac
2799         run=$run-$targetrun
2800         to=$to-$targetto
2801         from=$from-$targetfrom
2802         case "$targetdir" in
2803         '')  targetdir=/tmp
2804              echo "Guessing targetdir $targetdir." >&4
2805              ;;
2806         esac
2807         case "$targetuser" in
2808         '')  targetuser=root
2809              echo "Guessing targetuser $targetuser." >&4
2810              ;;
2811         esac
2812         case "$targetfrom" in
2813         scp)    q=-q ;;
2814         *)      q='' ;;
2815         esac
2816         case "$targetrun" in
2817         ssh|rsh)
2818             cat >$run <<EOF
2819 #!/bin/sh
2820 case "\$1" in
2821 -cwd)
2822   shift
2823   cwd=\$1
2824   shift
2825   ;;
2826 esac
2827 case "\$cwd" in
2828 '') cwd=$targetdir ;;
2829 esac
2830 exe=\$1
2831 shift
2832 if $test ! -f \$exe.xok; then
2833   $to \$exe
2834   $touch \$exe.xok
2835 fi
2836 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2837 EOF
2838             ;;
2839         *)  echo "Unknown targetrun '$targetrun'" >&4
2840             exit 1
2841             ;;
2842         esac
2843         case "$targetmkdir" in
2844         */Cross/mkdir)
2845             cat >$targetmkdir <<EOF
2846 #!/bin/sh
2847 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2848 EOF
2849             $chmod a+rx $targetmkdir
2850             ;;
2851         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2852             exit 1
2853             ;;
2854         esac
2855         case "$targetto" in
2856         scp|rcp)
2857             cat >$to <<EOF
2858 #!/bin/sh
2859 for f in \$@
2860 do
2861   case "\$f" in
2862   /*)
2863     $targetmkdir \`dirname \$f\`
2864     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2865     ;;
2866   *)
2867     $targetmkdir $targetdir/\`dirname \$f\`
2868     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2869     ;;
2870   esac
2871 done
2872 exit 0
2873 EOF
2874             ;;
2875         cp) cat >$to <<EOF
2876 #!/bin/sh
2877 for f in \$@
2878 do
2879   case "\$f" in
2880   /*)
2881     $mkdir -p $targetdir/\`dirname \$f\`
2882     $cp \$f $targetdir/\$f || exit 1
2883     ;;
2884   *)
2885     $targetmkdir $targetdir/\`dirname \$f\`
2886     $cp \$f $targetdir/\$f || exit 1
2887     ;;
2888   esac
2889 done
2890 exit 0
2891 EOF
2892             ;;
2893         *)  echo "Unknown targetto '$targetto'" >&4
2894             exit 1
2895             ;;
2896         esac
2897         case "$targetfrom" in
2898         scp|rcp)
2899           cat >$from <<EOF
2900 #!/bin/sh
2901 for f in \$@
2902 do
2903   $rm -f \$f
2904   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2905 done
2906 exit 0
2907 EOF
2908             ;;
2909         cp) cat >$from <<EOF
2910 #!/bin/sh
2911 for f in \$@
2912 do
2913   $rm -f \$f
2914   cp $targetdir/\$f . || exit 1
2915 done
2916 exit 0
2917 EOF
2918             ;;
2919         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2920             exit 1
2921             ;;
2922         esac
2923         if $test ! -f $run; then
2924             echo "Target 'run' script '$run' not found." >&4
2925         else
2926             $chmod a+rx $run
2927         fi
2928         if $test ! -f $to; then
2929             echo "Target 'to' script '$to' not found." >&4
2930         else
2931             $chmod a+rx $to
2932         fi
2933         if $test ! -f $from; then
2934             echo "Target 'from' script '$from' not found." >&4
2935         else
2936             $chmod a+rx $from
2937         fi
2938         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2939             exit 1
2940         fi
2941         cat >&4 <<EOF
2942 Using '$run' for remote execution,
2943 and '$from' and '$to'
2944 for remote file transfer.
2945 EOF
2946         ;;
2947 *)      run=''
2948         to=:
2949         from=:
2950         usecrosscompile='undef'
2951         targetarch=''
2952         ;;
2953 esac
2954
2955 : see whether [:lower:] and [:upper:] are supported character classes
2956 echo " "
2957 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2958 ABYZ)
2959         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2960         up='[:upper:]'
2961         low='[:lower:]'
2962         ;;
2963 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2964         # (0xd9 and 0xe2), therefore that is a nice testing point.
2965         if test "X$up" = X -o "X$low" = X; then
2966             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2967             rs) up='[A-Z]'
2968                 low='[a-z]'
2969                 ;;
2970             esac
2971         fi
2972         if test "X$up" = X -o "X$low" = X; then
2973             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2974             rs) up='A-Z'
2975                 low='a-z'
2976                 ;;
2977             esac
2978         fi
2979         if test "X$up" = X -o "X$low" = X; then
2980             case "`echo RS | od -x 2>/dev/null`" in
2981             *D9E2*|*d9e2*)
2982                 echo "Hey, this might be EBCDIC." >&4
2983                 if test "X$up" = X -o "X$low" = X; then
2984                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2985                     rs) up='[A-IJ-RS-Z]'
2986                         low='[a-ij-rs-z]'
2987                         ;;
2988                     esac
2989                 fi
2990                 if test "X$up" = X -o "X$low" = X; then
2991                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2992                     rs) up='A-IJ-RS-Z'
2993                         low='a-ij-rs-z'
2994                         ;;
2995                     esac
2996                 fi
2997                 ;;
2998             esac
2999         fi
3000 esac
3001 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3002 rs)
3003     echo "Using $up and $low to convert case." >&4
3004     ;;
3005 *)
3006     echo "I don't know how to translate letters from upper to lower case." >&4
3007     echo "Your tr is not acting any way I know of." >&4
3008     exit 1
3009     ;;
3010 esac
3011 : set up the translation script tr, must be called with ./tr of course
3012 cat >tr <<EOSC
3013 $startsh
3014 case "\$1\$2" in
3015 '[A-Z][a-z]') exec $tr '$up' '$low';;
3016 '[a-z][A-Z]') exec $tr '$low' '$up';;
3017 esac
3018 exec $tr "\$@"
3019 EOSC
3020 chmod +x tr
3021 $eunicefix tr
3022
3023 : Try to determine whether config.sh was made on this system
3024 case "$config_sh" in
3025 '')
3026 myuname=`$uname -a 2>/dev/null`
3027 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3028 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3029 # because the A-Z/a-z are not consecutive.
3030 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3031         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3032 newmyuname="$myuname"
3033 dflt=n
3034 case "$knowitall" in
3035 '')
3036         if test -f ../config.sh; then
3037                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3038                         eval "`grep myuname= ../config.sh`"
3039                 fi
3040                 if test "X$myuname" = "X$newmyuname"; then
3041                         dflt=y
3042                 fi
3043         fi
3044         ;;
3045 *) dflt=y;;
3046 esac
3047
3048 : Get old answers from old config file if Configure was run on the
3049 : same system, otherwise use the hints.
3050 hint=default
3051 cd ..
3052 if test -f config.sh; then
3053         echo " "
3054         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3055         . UU/myread
3056         case "$ans" in
3057         n*|N*) echo "OK, I'll ignore it."
3058                 mv config.sh config.sh.old
3059                 myuname="$newmyuname"
3060                 ;;
3061         *)  echo "Fetching default answers from your old config.sh file..." >&4
3062                 tmp_n="$n"
3063                 tmp_c="$c"
3064                 tmp_sh="$sh"
3065                 . ./config.sh
3066                 cp config.sh UU
3067                 n="$tmp_n"
3068                 c="$tmp_c"
3069                 : Older versions did not always set $sh.  Catch re-use of such
3070                 : an old config.sh.
3071                 case "$sh" in
3072                 '') sh="$tmp_sh" ;;
3073                 esac
3074                 hint=previous
3075                 ;;
3076         esac
3077 fi
3078 . ./UU/checkcc
3079 if test ! -f config.sh; then
3080         $cat <<EOM
3081
3082 First time through, eh?  I have some defaults handy for some systems
3083 that need some extra help getting the Configure answers right:
3084
3085 EOM
3086         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3087         dflt=''
3088         : Half the following guesses are probably wrong... If you have better
3089         : tests or hints, please send them to perlbug@perl.org
3090         : The metaconfig authors would also appreciate a copy...
3091         $test -f /irix && osname=irix
3092         $test -f /xenix && osname=sco_xenix
3093         $test -f /dynix && osname=dynix
3094         $test -f /dnix && osname=dnix
3095         $test -f /lynx.os && osname=lynxos
3096         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3097         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3098         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3099         $test -f /bin/mips && /bin/mips && osname=mips
3100         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3101                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3102         $test -d /usr/apollo/bin && osname=apollo
3103         $test -f /etc/saf/_sactab && osname=svr4
3104         $test -d /usr/include/minix && osname=minix
3105         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3106         if $test -d /MachTen -o -d /MachTen_Folder; then
3107                 osname=machten
3108                 if $test -x /sbin/version; then
3109                         osvers=`/sbin/version | $awk '{print $2}' |
3110                         $sed -e 's/[A-Za-z]$//'`
3111                 elif $test -x /usr/etc/version; then
3112                         osvers=`/usr/etc/version | $awk '{print $2}' |
3113                         $sed -e 's/[A-Za-z]$//'`
3114                 else
3115                         osvers="$2.$3"
3116                 fi
3117         fi
3118
3119         $test -f /sys/posix.dll &&
3120                 $test -f /usr/bin/what &&
3121                 set X `/usr/bin/what /sys/posix.dll` &&
3122                 $test "$3" = UWIN &&
3123                 osname=uwin &&
3124                 osvers="$5"
3125
3126         if $test -f $uname; then
3127                 set X $myuname
3128                 shift
3129
3130                 case "$5" in
3131                 fps*) osname=fps ;;
3132                 mips*)
3133                         case "$4" in
3134                         umips) osname=umips ;;
3135                         *) osname=mips ;;
3136                         esac;;
3137                 [23]100) osname=mips ;;
3138                 next*) osname=next ;;
3139                 i386*)
3140                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3141                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3142                                 osname='sco'
3143                                 osvers=$tmp
3144                         elif $test -f /etc/kconfig; then
3145                                 osname=isc
3146                                 if test "$lns" = "$ln -s"; then
3147                                         osvers=4
3148                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3149                                         osvers=3
3150                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3151                                         osvers=2
3152                                 fi
3153                         fi
3154                         tmp=''
3155                         ;;
3156                 pc*)
3157                         if test -n "$DJGPP"; then
3158                                 osname=dos
3159                                 osvers=djgpp
3160                         fi
3161                         ;;
3162                 esac
3163
3164                 case "$1" in
3165                 aix) osname=aix
3166                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3167                         case "$tmp" in
3168                         # oslevel can fail with:
3169                         # oslevel: Unable to acquire lock.
3170                         *not\ found) osvers="$4"."$3" ;;
3171                         '<3240'|'<>3240') osvers=3.2.0 ;;
3172                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3173                         '=3250'|'>3250') osvers=3.2.5 ;;
3174                         *) osvers=$tmp;;
3175                         esac
3176                         ;;
3177                 bsd386) osname=bsd386
3178                         osvers=`$uname -r`
3179                         ;;
3180                 cygwin*) osname=cygwin
3181                         osvers="$3"
3182                         ;;
3183                 *dc.osx) osname=dcosx
3184                         osvers="$3"
3185                         ;;
3186                 dnix) osname=dnix
3187                         osvers="$3"
3188                         ;;
3189                 domainos) osname=apollo
3190                         osvers="$3"
3191                         ;;
3192                 dgux)   osname=dgux
3193                         osvers="$3"
3194                         ;;
3195                 dragonfly) osname=dragonfly
3196                         osvers="$3"
3197                         ;;
3198                 dynixptx*) osname=dynixptx
3199                         osvers=`echo "$4"|sed 's/^v//'`
3200                         ;;
3201                 freebsd) osname=freebsd
3202                         osvers="$3" ;;
3203                 genix)  osname=genix ;;
3204                 gnu)    osname=gnu
3205                         osvers="$3" ;;
3206                 hp*)    osname=hpux
3207                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3208                         ;;
3209                 irix*)  osname=irix
3210                         case "$3" in
3211                         4*) osvers=4 ;;
3212                         5*) osvers=5 ;;
3213                         *)      osvers="$3" ;;
3214                         esac
3215                         ;;
3216                 linux)  osname=linux
3217                         case "$3" in
3218                         *)      osvers="$3" ;;
3219                         esac
3220                         ;;
3221                 MiNT)   osname=mint
3222                         ;;
3223                 netbsd*) osname=netbsd
3224                         osvers="$3"
3225                         ;;
3226                 news-os) osvers="$3"
3227                         case "$3" in
3228                         4*) osname=newsos4 ;;
3229                         *) osname=newsos ;;
3230                         esac
3231                         ;;
3232                 next*) osname=next ;;
3233                 nonstop-ux) osname=nonstopux ;;
3234                 openbsd) osname=openbsd
3235                         osvers="$3"
3236                         ;;
3237                 os2)    osname=os2
3238                         osvers="$4"
3239                         ;;
3240                 POSIX-BC | posix-bc ) osname=posix-bc
3241                         osvers="$3"
3242                         ;;
3243                 powerux | power_ux | powermax_os | powermaxos | \
3244                 powerunix | power_unix) osname=powerux
3245                         osvers="$3"
3246                         ;;
3247                 qnx) osname=qnx
3248                         osvers="$4"
3249                         ;;
3250                 solaris) osname=solaris
3251                         case "$3" in
3252                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3253                         *)      osvers="$3" ;;
3254                         esac
3255                         ;;
3256                 sunos) osname=sunos
3257                         case "$3" in
3258                         5*) osname=solaris
3259                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3260                         *)      osvers="$3" ;;
3261                         esac
3262                         ;;
3263                 titanos) osname=titanos
3264                         case "$3" in
3265                         1*) osvers=1 ;;
3266                         2*) osvers=2 ;;
3267                         3*) osvers=3 ;;
3268                         4*) osvers=4 ;;
3269                         *)      osvers="$3" ;;
3270                         esac
3271                         ;;
3272                 ultrix) osname=ultrix
3273                         osvers="$3"
3274                         ;;
3275                 osf1|mls+)      case "$5" in
3276                                 alpha)
3277                                         osname=dec_osf
3278                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3279                                         case "$osvers" in
3280                                         [1-9].[0-9]*) ;;
3281                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3282                                         esac
3283                                         ;;
3284                         hp*)    osname=hp_osf1  ;;
3285                         mips)   osname=mips_osf1 ;;
3286                         esac
3287                         ;;
3288                 # UnixWare 7.1.2 is known as Open UNIX 8
3289                 openunix|unixware) osname=svr5
3290                         osvers="$4"
3291                         ;;
3292                 uts)    osname=uts
3293                         osvers="$3"
3294                         ;;
3295                 vos) osvers="$3"
3296                         ;;
3297                 $2) case "$osname" in
3298                         *isc*) ;;
3299                         *freebsd*) ;;
3300                         svr*)
3301                                 : svr4.x or possibly later
3302                                 case "svr$3" in
3303                                 ${osname}*)
3304                                         osname=svr$3
3305                                         osvers=$4
3306                                         ;;
3307                                 esac
3308                                 case "$osname" in
3309                                 svr4.0)
3310                                         : Check for ESIX
3311                                         if test -f /stand/boot ; then
3312                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3313                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3314                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3315                                                         if test -n "$isesix"; then
3316                                                                 osname=esix4
3317                                                         fi
3318                                                 fi
3319                                         fi
3320                                         ;;
3321                                 esac
3322                                 ;;
3323                         *)      if test -f /etc/systemid; then
3324                                         osname=sco
3325                                         set `echo $3 | $sed 's/\./ /g'` $4
3326                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3327                                                 osvers=$1.$2.$3
3328                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3329                                                 osvers=$1.$2
3330                                         elif $test -f $src/hints/sco_$1.sh; then
3331                                                 osvers=$1
3332                                         fi
3333                                 else
3334                                         case "$osname" in
3335                                         '') : Still unknown.  Probably a generic Sys V.
3336                                                 osname="sysv"
3337                                                 osvers="$3"
3338                                                 ;;
3339                                         esac
3340                                 fi
3341                                 ;;
3342                         esac
3343                         ;;
3344                 *)      case "$osname" in
3345                         '') : Still unknown.  Probably a generic BSD.
3346                                 osname="$1"
3347                                 osvers="$3"
3348                                 ;;
3349                         esac
3350                         ;;
3351                 esac
3352         else
3353                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3354                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3355                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3356                                 osname=news_os
3357                         fi
3358                         $rm -f UU/kernel.what
3359                 elif test -d c:/. -o -n "$is_os2" ; then
3360                         set X $myuname
3361                         osname=os2
3362                         osvers="$5"
3363                 fi
3364         fi
3365
3366         case "$targetarch" in
3367         '') ;;
3368         *)  hostarch=$osname
3369             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3370             osvers=''
3371             ;;
3372         esac
3373
3374         : Now look for a hint file osname_osvers, unless one has been
3375         : specified already.
3376         case "$hintfile" in
3377         ''|' ')
3378                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3379                 : Also try without trailing minor version numbers.
3380                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3381                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3382                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3383                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3384                 case "$file" in
3385                 '') dflt=none ;;
3386                 *)  case "$osvers" in
3387                         '') dflt=$file
3388                                 ;;
3389                         *)  if $test -f $src/hints/$file.sh ; then
3390                                         dflt=$file
3391                                 elif $test -f $src/hints/$xfile.sh ; then
3392                                         dflt=$xfile
3393                                 elif $test -f $src/hints/$xxfile.sh ; then
3394                                         dflt=$xxfile
3395                                 elif $test -f $src/hints/$xxxfile.sh ; then
3396                                         dflt=$xxxfile
3397                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3398                                         dflt=$xxxxfile
3399                                 elif $test -f "$src/hints/${osname}.sh" ; then
3400                                         dflt="${osname}"
3401                                 else
3402                                         dflt=none
3403                                 fi
3404                                 ;;
3405                         esac
3406                         ;;
3407                 esac
3408                 if $test -f Policy.sh ; then
3409                         case "$dflt" in
3410                         *Policy*) ;;
3411                         none) dflt="Policy" ;;
3412                         *) dflt="Policy $dflt" ;;
3413                         esac
3414                 fi
3415                 ;;
3416         *)
3417                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3418                 ;;
3419         esac
3420
3421         if $test -f Policy.sh ; then
3422                 $cat <<EOM
3423
3424 There's also a Policy hint file available, which should make the
3425 site-specific (policy) questions easier to answer.
3426 EOM
3427
3428         fi
3429
3430         $cat <<EOM
3431
3432 You may give one or more space-separated answers, or "none" if appropriate.
3433 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3434 previous run of Configure, you may specify it as well as or instead of
3435 OS-specific hints.  If hints are provided for your OS, you should use them:
3436 although Perl can probably be built without hints on many platforms, using
3437 hints often improve performance and may enable features that Configure can't
3438 set up on its own. If there are no hints that match your OS, specify "none";
3439 DO NOT give a wrong version or a wrong OS.
3440
3441 EOM
3442
3443         rp="Which of these apply, if any?"
3444         . UU/myread
3445         tans=$ans
3446         for file in $tans; do
3447                 if $test X$file = XPolicy -a -f Policy.sh; then
3448                         . Policy.sh
3449                         $cat Policy.sh >> UU/config.sh
3450                 elif $test -f $src/hints/$file.sh; then
3451                         . $src/hints/$file.sh
3452                         $cat $src/hints/$file.sh >> UU/config.sh
3453                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3454                         : nothing
3455                 else
3456                         : Give one chance to correct a possible typo.
3457                         echo "$file.sh does not exist"
3458                         dflt=$file
3459                         rp="hint to use instead?"
3460                         . UU/myread
3461                         for file in $ans; do
3462                                 if $test -f "$src/hints/$file.sh"; then
3463                                         . $src/hints/$file.sh
3464                                         $cat $src/hints/$file.sh >> UU/config.sh
3465                                 elif $test X$ans = X -o X$ans = Xnone ; then
3466                                         : nothing
3467                                 else
3468                                         echo "$file.sh does not exist -- ignored."
3469                                 fi
3470                         done
3471                 fi
3472         done
3473
3474         hint=recommended
3475         : Remember our hint file for later.
3476         if $test -f "$src/hints/$file.sh" ; then
3477                 hintfile="$file"
3478         else
3479                 hintfile=''
3480         fi
3481 fi
3482 cd UU
3483 ;;
3484 *)
3485         echo " "
3486         echo "Fetching default answers from $config_sh..." >&4
3487         tmp_n="$n"
3488         tmp_c="$c"
3489         cd ..
3490         cp $config_sh config.sh 2>/dev/null
3491         chmod +w config.sh
3492         . ./config.sh
3493         cd UU
3494         cp ../config.sh .
3495         n="$tmp_n"
3496         c="$tmp_c"
3497         hint=previous
3498         ;;
3499 esac
3500 test "$override" && . ./optdef.sh
3501
3502 : Restore computed paths
3503 for file in $loclist $trylist; do
3504         eval $file="\$_$file"
3505 done
3506
3507 cat << EOM
3508
3509 Configure uses the operating system name and version to set some defaults.
3510 The default value is probably right if the name rings a bell. Otherwise,
3511 since spelling matters for me, either accept the default or answer "none"
3512 to leave it blank.
3513
3514 EOM
3515 case "$osname" in
3516         ''|' ')
3517                 case "$hintfile" in
3518                 ''|' '|none) dflt=none ;;
3519                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3520                 esac
3521                 ;;
3522         *) dflt="$osname" ;;
3523 esac
3524 rp="Operating system name?"
3525 . ./myread
3526 case "$ans" in
3527 none)  osname='' ;;
3528 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3529 esac
3530 echo " "
3531 case "$osvers" in
3532         ''|' ')
3533                 case "$hintfile" in
3534                 ''|' '|none) dflt=none ;;
3535                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3536                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3537                         case "$dflt" in
3538                         ''|' ') dflt=none ;;
3539                         esac
3540                         ;;
3541                 esac
3542                 ;;
3543         *) dflt="$osvers" ;;
3544 esac
3545 rp="Operating system version?"
3546 . ./myread
3547 case "$ans" in
3548 none)  osvers='' ;;
3549 *) osvers="$ans" ;;
3550 esac
3551
3552
3553 . ./posthint.sh
3554
3555 : who configured the system
3556 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3557 case "$cf_by" in
3558 "")
3559         cf_by=`(logname) 2>/dev/null`
3560         case "$cf_by" in
3561         "")
3562                 cf_by=`(whoami) 2>/dev/null`
3563                 case "$cf_by" in
3564                 "") cf_by=unknown ;;
3565                 esac ;;
3566         esac ;;
3567 esac
3568
3569 : decide how portable to be.  Allow command line overrides.
3570 case "$d_portable" in
3571 "$undef") ;;
3572 *)      d_portable="$define" ;;
3573 esac
3574
3575 : set up shell script to do ~ expansion
3576 cat >filexp <<EOSS
3577 $startsh
3578 : expand filename
3579 case "\$1" in
3580  ~/*|~)
3581         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3582         ;;
3583  ~*)
3584         if $test -f /bin/csh; then
3585                 /bin/csh -f -c "glob \$1"
3586                 failed=\$?
3587                 echo ""
3588                 exit \$failed
3589         else
3590                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3591                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3592                 if $test ! -d "\$dir"; then
3593                         me=\`basename \$0\`
3594                         echo "\$me: can't locate home directory for: \$name" >&2
3595                         exit 1
3596                 fi
3597                 case "\$1" in
3598                 */*)
3599                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3600                         ;;
3601                 *)
3602                         echo \$dir
3603                         ;;
3604                 esac
3605         fi
3606         ;;
3607 *)
3608         echo \$1
3609         ;;
3610 esac
3611 EOSS
3612 chmod +x filexp
3613 $eunicefix filexp
3614
3615 : now set up to get a file name
3616 cat <<EOS >getfile
3617 $startsh
3618 EOS
3619 cat <<'EOSC' >>getfile
3620 tilde=''
3621 fullpath=''
3622 already=''
3623 skip=''
3624 none_ok=''
3625 exp_file=''
3626 nopath_ok=''
3627 orig_rp="$rp"
3628 orig_dflt="$dflt"
3629 case "$gfpth" in
3630 '') gfpth='.' ;;
3631 esac
3632
3633 case "$fn" in
3634 *\(*)
3635         : getfile will accept an answer from the comma-separated list
3636         : enclosed in parentheses even if it does not meet other criteria.
3637         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3638         fn=`echo $fn | sed 's/(.*)//'`
3639         ;;
3640 esac
3641
3642 case "$fn" in
3643 *:*)
3644         loc_file=`expr $fn : '.*:\(.*\)'`
3645         fn=`expr $fn : '\(.*\):.*'`
3646         ;;
3647 esac
3648
3649 case "$fn" in
3650 *~*) tilde=true;;
3651 esac
3652 case "$fn" in
3653 */*) fullpath=true;;
3654 esac
3655 case "$fn" in
3656 *+*) skip=true;;
3657 esac
3658 case "$fn" in
3659 *n*) none_ok=true;;
3660 esac
3661 case "$fn" in
3662 *e*) exp_file=true;;
3663 esac
3664 case "$fn" in
3665 *p*) nopath_ok=true;;
3666 esac
3667
3668 case "$fn" in
3669 *f*) type='File';;
3670 *d*) type='Directory';;
3671 *l*) type='Locate';;
3672 esac
3673
3674 what="$type"
3675 case "$what" in
3676 Locate) what='File';;
3677 esac
3678
3679 case "$exp_file" in
3680 '')
3681         case "$d_portable" in
3682         "$define") ;;
3683         *) exp_file=true;;
3684         esac
3685         ;;
3686 esac
3687
3688 cd ..
3689 while test "$type"; do
3690         redo=''
3691         rp="$orig_rp"
3692         dflt="$orig_dflt"
3693         case "$tilde" in
3694         true) rp="$rp (~name ok)";;
3695         esac
3696         . UU/myread
3697         if test -f UU/getfile.ok && \
3698                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3699         then
3700                 value="$ans"
3701                 ansexp="$ans"
3702                 break
3703         fi
3704         case "$ans" in
3705         none)
3706                 value=''
3707                 ansexp=''
3708                 case "$none_ok" in
3709                 true) type='';;
3710                 esac
3711                 ;;
3712         *)
3713                 case "$tilde" in
3714                 '') value="$ans"
3715                         ansexp="$ans";;
3716                 *)
3717                         value=`UU/filexp $ans`
3718                         case $? in
3719                         0)
3720                                 if test "$ans" != "$value"; then
3721                                         echo "(That expands to $value on this system.)"
3722                                 fi
3723                                 ;;
3724                         *) value="$ans";;
3725                         esac
3726                         ansexp="$value"
3727                         case "$exp_file" in
3728                         '') value="$ans";;
3729                         esac
3730                         ;;
3731                 esac
3732                 case "$fullpath" in
3733                 true)
3734                         case "$ansexp" in
3735                         /*) value="$ansexp" ;;
3736                         [a-zA-Z]:/*) value="$ansexp" ;;
3737                         *)
3738                                 redo=true
3739                                 case "$already" in
3740                                 true)
3741                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3742                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3743                                         ;;
3744                                 *)
3745                                 echo "Please give a full path name, starting with slash." >&4
3746                                         case "$tilde" in
3747                                         true)
3748                                 echo "Note that using ~name is ok provided it expands well." >&4
3749                                                 already=true
3750                                                 ;;
3751                                         esac
3752                                 esac
3753                                 ;;
3754                         esac
3755                         ;;
3756                 esac
3757                 case "$redo" in
3758                 '')
3759                         case "$type" in
3760                         File)
3761                                 for fp in $gfpth; do
3762                                         if test "X$fp" = X.; then
3763                                             pf="$ansexp"
3764                                         else    
3765                                             pf="$fp/$ansexp"
3766                                         fi
3767                                         if test -f "$pf"; then
3768                                                 type=''
3769                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3770                                         then
3771                                                 echo "($value is not a plain file, but that's ok.)"
3772                                                 type=''
3773                                         fi
3774                                         if test X"$type" = X; then
3775                                             value="$pf"
3776                                             break
3777                                         fi
3778                                 done
3779                                 ;;
3780                         Directory)
3781                                 for fp in $gfpth; do
3782                                         if test "X$fp" = X.; then
3783                                             dir="$ans"
3784                                             direxp="$ansexp"
3785                                         else    
3786                                             dir="$fp/$ansexp"
3787                                             direxp="$fp/$ansexp"
3788                                         fi
3789                                         if test -d "$direxp"; then
3790                                                 type=''
3791                                                 value="$dir"
3792                                                 break
3793                                         fi
3794                                 done
3795                                 ;;
3796                         Locate)
3797                                 if test -d "$ansexp"; then
3798                                         echo "(Looking for $loc_file in directory $value.)"
3799                                         value="$value/$loc_file"
3800                                         ansexp="$ansexp/$loc_file"
3801                                 fi
3802                                 if test -f "$ansexp"; then
3803                                         type=''
3804                                 fi
3805                                 case "$nopath_ok" in
3806                                 true)   case "$value" in
3807                                         */*) ;;
3808                                         *)      echo "Assuming $value will be in people's path."
3809                                                 type=''
3810                                                 ;;
3811                                         esac
3812                                         ;;
3813                                 esac
3814                                 ;;
3815                         esac
3816
3817                         case "$skip" in
3818                         true) type='';
3819                         esac
3820
3821                         case "$type" in
3822                         '') ;;
3823                         *)
3824                                 if test "$fastread" = yes; then
3825                                         dflt=y
3826                                 else
3827                                         dflt=n
3828                                 fi
3829                                 rp="$what $value doesn't exist.  Use that name anyway?"
3830                                 . UU/myread
3831                                 dflt=''
3832                                 case "$ans" in
3833                                 y*) type='';;
3834                                 *) echo " ";;
3835                                 esac
3836                                 ;;
3837                         esac
3838                         ;;
3839                 esac
3840                 ;;
3841         esac
3842 done
3843 cd UU
3844 ans="$value"
3845 rp="$orig_rp"
3846 dflt="$orig_dflt"
3847 rm -f getfile.ok
3848 test "X$gfpthkeep" != Xy && gfpth=""
3849 EOSC
3850
3851 : determine root of directory hierarchy where package will be installed.
3852 case "$prefix" in
3853 '')
3854         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3855         ;;
3856 *?/)
3857         dflt=`echo "$prefix" | sed 's/.$//'`
3858         ;;
3859 *)
3860         dflt="$prefix"
3861         ;;
3862 esac
3863 $cat <<EOM
3864
3865 By default, $package will be installed in $dflt/bin, manual pages
3866 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3867 installation directories. Typically this is something like /usr/local.
3868 If you wish to have binaries under /usr/bin but other parts of the
3869 installation under /usr/local, that's ok: you will be prompted
3870 separately for each of the installation directories, the prefix being
3871 only used to set the defaults.
3872
3873 EOM
3874 fn=d~
3875 rp='Installation prefix to use?'
3876 . ./getfile
3877 oldprefix=''
3878 case "$prefix" in
3879 '') ;;
3880 *)
3881         case "$ans" in
3882         "$prefix") ;;
3883         *) oldprefix="$prefix";;
3884         esac
3885         ;;
3886 esac
3887 prefix="$ans"
3888 prefixexp="$ansexp"
3889
3890 case "$afsroot" in
3891 '')     afsroot=/afs ;;
3892 *)      afsroot=$afsroot ;;
3893 esac
3894
3895 : is AFS running?
3896 echo " "
3897 case "$afs" in
3898 $define|true)   afs=true ;;
3899 $undef|false)   afs=false ;;
3900 *)      if test -d $afsroot; then
3901                 afs=true
3902         else
3903                 afs=false
3904         fi
3905         ;;
3906 esac
3907 if $afs; then
3908         echo "AFS may be running... I'll be extra cautious then..." >&4
3909 else
3910         echo "AFS does not seem to be running..." >&4
3911 fi
3912
3913 : determine installation prefix for where package is to be installed.
3914 if $afs; then 
3915 $cat <<EOM
3916
3917 Since you are running AFS, I need to distinguish the directory in which
3918 files will reside from the directory in which they are installed (and from
3919 which they are presumably copied to the former directory by occult means).
3920
3921 EOM
3922         case "$installprefix" in
3923         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3924         *) dflt="$installprefix";;
3925         esac
3926 else
3927 $cat <<EOM
3928
3929 In some special cases, particularly when building $package for distribution,
3930 it is convenient to distinguish the directory in which files should be
3931 installed from the directory ($prefix) in which they will
3932 eventually reside.  For most users, these two directories are the same.
3933
3934 EOM
3935         case "$installprefix" in
3936         '') dflt=$prefix ;;
3937         *) dflt=$installprefix;;
3938         esac
3939 fi
3940 fn=d~
3941 rp='What installation prefix should I use for installing files?'
3942 . ./getfile
3943 installprefix="$ans"
3944 installprefixexp="$ansexp"
3945
3946 : Perform the prefixexp/installprefixexp correction if necessary
3947 cat <<EOS >installprefix
3948 $startsh
3949 EOS
3950 cat <<'EOSC' >>installprefix
3951 : Change installation prefix, if necessary.
3952 if $test X"$prefix" != X"$installprefix"; then
3953     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3954 else
3955     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3956 fi
3957 EOSC
3958 chmod +x installprefix
3959 $eunicefix installprefix
3960
3961 : Set variables such as privlib and privlibexp from the output of ./getfile
3962 : performing the prefixexp/installprefixexp correction if necessary.
3963 cat <<EOS >setprefixvar
3964 $startsh
3965 EOS
3966 cat <<'EOSC' >>setprefixvar
3967 eval "${prefixvar}=\"\$ans\""
3968 eval "${prefixvar}exp=\"\$ansexp\""
3969 . ./installprefix
3970 EOSC
3971 chmod +x setprefixvar
3972 $eunicefix setprefixvar
3973
3974 : set up the script used to warn in case of inconsistency
3975 cat <<EOS >whoa
3976 $startsh
3977 EOS
3978 cat <<'EOSC' >>whoa
3979 dflt=y
3980 case "$hint" in
3981     recommended)
3982         case "$hintfile" in
3983         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3984                 ;;
3985         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3986                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3987                 ;;
3988         esac
3989         ;;
3990     *)  echo " "
3991         echo "*** WHOA THERE!!! ***" >&4
3992         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3993         ;;
3994 esac
3995 rp="    Keep the $hint value?"
3996 . ./myread
3997 case "$ans" in
3998 y) td=$was; tu=$was;;
3999 esac
4000 EOSC
4001
4002 : function used to set $1 to $val
4003 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4004 case "$val$was" in
4005 $define$undef) . ./whoa; eval "$var=\$td";;
4006 $undef$define) . ./whoa; eval "$var=\$tu";;
4007 *) eval "$var=$val";;
4008 esac'
4009
4010 case "$usesocks" in
4011 $define|true|[yY]*)     dflt='y';;
4012 *) dflt='n';;
4013 esac
4014 cat <<EOM
4015
4016 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4017 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4018 to use the PerlIO abstraction layer, this will be implicitly selected.
4019
4020 If this doesn't make any sense to you, just accept the default '$dflt'.
4021 EOM
4022 rp='Build Perl for SOCKS?'
4023 . ./myread
4024 case "$ans" in
4025 y|Y)    val="$define" ;;     
4026 *)      val="$undef" ;;
4027 esac
4028 set usesocks
4029 eval $setvar
4030
4031 case "$usesocks" in
4032 $define|true|[yY]*) useperlio="$define";;
4033 esac
4034
4035 case "$useperlio" in
4036 $define|true|[yY]*|'')  dflt='y';;
4037 *) dflt='n';;
4038 esac
4039 cat <<EOM
4040
4041 Previous version of $package used the standard IO mechanisms as
4042 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4043 alternate IO mechanisms via the PerlIO abstraction layer, but the
4044 stdio mechanism is still available if needed.  The abstraction layer
4045 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4046 Using PerlIO with sfio may cause problems with some extension modules.
4047
4048 If this doesn't make any sense to you, just accept the default '$dflt'.
4049 EOM
4050 rp='Use the PerlIO abstraction layer?'
4051 . ./myread
4052 case "$ans" in
4053 y|Y) 
4054         val="$define"
4055         ;;
4056 *)      
4057         echo "Ok, doing things the stdio way."
4058         val="$undef"
4059         ;;
4060 esac
4061 set useperlio
4062 eval $setvar 
4063
4064 case "$usesocks" in
4065 $define|true|[yY]*)
4066         case "$useperlio" in
4067         $define|true|[yY]*) ;;
4068         *)      cat >&4 <<EOM
4069
4070 You are using the SOCKS proxy protocol library which means that you
4071 should also use the PerlIO layer.  You may be headed for trouble.
4072
4073 EOM
4074                 ;;
4075         esac
4076         ;;
4077 esac
4078
4079         
4080 : get the patchlevel
4081 echo " "
4082 echo "Getting the current patchlevel..." >&4
4083 if $test -r $rsrc/patchlevel.h;then
4084         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4085         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4086         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4087         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4088         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4089         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4090         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4091 else
4092         revision=0
4093         patchlevel=0
4094         subversion=0
4095         api_revision=0
4096         api_version=0
4097         api_subversion=0
4098         perl_patchlevel=0
4099         $echo "(You do not have patchlevel.h.  Eek.)"
4100 fi
4101 if $test -r $rsrc/.patch ; then
4102         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4103                 perl_patchlevel=`cat $rsrc/.patch`
4104         fi
4105 fi
4106 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4107 version_patchlevel_string="version $patchlevel subversion $subversion"
4108 case "$perl_patchlevel" in
4109 0|'') ;;
4110 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4111 esac
4112
4113 $echo "(You have $package $version_patchlevel_string.)"
4114
4115 case "$osname" in
4116 dos|vms)
4117         : XXX Should be a Configure test for double-dots in filenames.
4118         version=`echo $revision $patchlevel $subversion | \
4119                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4120         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4121                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4122         ;;
4123 *)
4124         version=`echo $revision $patchlevel $subversion | \
4125                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4126         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4127                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4128         ;;
4129 esac
4130 : Special case the 5.005_xx maintenance series, which used 5.005
4131 : without any subversion label as a subdirectory in $sitelib
4132 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4133         api_versionstring='5.005'
4134 fi
4135
4136 case "$usethreads" in
4137 $define|true|[yY]*)     dflt='y';;
4138 *)     # Catch case where user specified ithreads or 5005threads but
4139        # forgot -Dusethreads (A.D. 4/2002)
4140        case "$useithreads$use5005threads" in
4141        *$define*)      
4142                 case "$useperlio" in
4143                 "$define")      dflt='y' ;;
4144                 *)              dflt='n' ;;
4145                 esac
4146                 ;;
4147        *)       dflt='n';;
4148        esac
4149        ;;
4150 esac
4151 cat <<EOM
4152
4153 Perl can be built to take advantage of threads on some systems.
4154 To do so, Configure can be run with -Dusethreads.
4155
4156 Note that Perl built with threading support runs slightly slower
4157 and uses more memory than plain Perl. The current implementation
4158 is believed to be stable, but it is fairly new, and so should be
4159 treated with caution.
4160
4161 If this doesn't make any sense to you, just accept the default '$dflt'.
4162 EOM
4163 rp='Build a threading Perl?'
4164 . ./myread
4165 case "$ans" in
4166 y|Y)    val="$define" ;;
4167 *)      val="$undef" ;;
4168 esac
4169 set usethreads
4170 eval $setvar
4171
4172 if $test $patchlevel -lt 9; then
4173     case "$usethreads" in
4174     $define)
4175         $cat <<EOM
4176
4177 Since release 5.6, Perl has had two different threading implementations,
4178 the newer interpreter-based version (ithreads) with one interpreter per
4179 thread, and the older 5.005 version (5005threads).
4180 The 5005threads version is effectively unmaintained and will probably be
4181 removed in Perl 5.10, so there should be no need to build a Perl using it
4182 unless needed for backwards compatibility with some existing 5.005threads
4183 code.
4184
4185 EOM
4186         : Default to ithreads unless overridden on command line or with
4187         : old config.sh
4188         dflt='y'
4189         case "$use5005threads" in
4190                 $define|true|[yY]*) dflt='n';;
4191         esac
4192         case "$useithreads" in
4193                 $undef|false|[nN]*) dflt='n';;
4194         esac
4195         rp='Use the newer interpreter-based ithreads?'
4196         . ./myread
4197         case "$ans" in
4198         y|Y)    val="$define" ;;
4199         *)      val="$undef" ;;
4200         esac
4201         set useithreads
4202         eval $setvar
4203         : Now set use5005threads to the opposite value.
4204         case "$useithreads" in
4205         $define) val="$undef" ;;
4206         *) val="$define" ;;
4207         esac
4208         set use5005threads
4209         eval $setvar
4210         ;;
4211     *)
4212         useithreads="$undef"
4213         use5005threads="$undef"
4214         ;;
4215     esac
4216
4217     case "$useithreads$use5005threads" in
4218     "$define$define")
4219         $cat >&4 <<EOM
4220
4221 You cannot have both the ithreads and the 5.005 threads enabled
4222 at the same time.  Disabling the 5.005 threads since they are
4223 much less stable than the ithreads.
4224
4225 EOM
4226         use5005threads="$undef"
4227         ;;
4228     esac
4229
4230 else
4231 : perl-5.9.x and later
4232
4233     if test X"$usethreads" = "X$define"; then
4234         case "$use5005threads" in
4235             $define|true|[yY]*)
4236                 $cat >&4 <<EOM
4237
4238 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4239
4240 EOM
4241             ;;
4242         esac
4243     fi
4244
4245     use5005threads="$undef"
4246     useithreads="$usethreads"
4247 fi
4248
4249 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4250         cat >&4 <<EOF
4251 ***
4252 *** To build with ithreads you must also use the PerlIO layer.
4253 *** Cannot continue, aborting.
4254 ***
4255 EOF
4256         exit 1
4257 fi
4258
4259 case "$d_oldpthreads" in
4260 '')     : Configure tests would be welcome here.  For now, assume undef.
4261         val="$undef" ;;
4262 *)      val="$d_oldpthreads" ;;
4263 esac
4264 set d_oldpthreads
4265 eval $setvar
4266
4267
4268 : Look for a hint-file generated 'call-back-unit'.  If the
4269 : user has specified that a threading perl is to be built,
4270 : we may need to set or change some other defaults.
4271 if $test -f usethreads.cbu; then
4272     echo "Your platform has some specific hints regarding threaded builds, using them..."
4273     . ./usethreads.cbu
4274 else
4275     case "$usethreads" in
4276         "$define"|true|[yY]*)
4277                 $cat <<EOM
4278 (Your platform does not have any specific hints for threaded builds.
4279  Assuming POSIX threads, then.)
4280 EOM
4281         ;;
4282     esac
4283 fi
4284
4285 cat <<EOM
4286
4287 Perl can be built so that multiple Perl interpreters can coexist
4288 within the same Perl executable.
4289 EOM
4290
4291 case "$useithreads" in
4292 $define)
4293         cat <<EOM
4294 This multiple interpreter support is required for interpreter-based threads.
4295 EOM
4296         val="$define"
4297         ;;
4298 *)      case "$usemultiplicity" in
4299         $define|true|[yY]*)     dflt='y';;
4300         *) dflt='n';;
4301         esac
4302         echo " "
4303         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4304         rp='Build Perl for multiplicity?'
4305         . ./myread
4306         case "$ans" in
4307         y|Y)    val="$define" ;;
4308         *)      val="$undef" ;;
4309         esac
4310         ;;
4311 esac
4312 set usemultiplicity
4313 eval $setvar
4314
4315
4316 case "$usemorebits" in
4317 "$define"|true|[yY]*)
4318         use64bitint="$define"
4319         uselongdouble="$define"
4320         usemorebits="$define"
4321         ;;
4322 *)      usemorebits="$undef"
4323         ;;
4324 esac
4325
4326 : make some quick guesses about what we are up against
4327 echo " "
4328 $echo $n "Hmm...  $c"
4329 echo exit 1 >bsd
4330 echo exit 1 >usg
4331 echo exit 1 >v7
4332 echo exit 1 >osf1
4333 echo exit 1 >eunice
4334 echo exit 1 >xenix
4335 echo exit 1 >venix
4336 echo exit 1 >os2
4337 d_bsd="$undef"
4338 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4339 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4340 then
4341         echo "Looks kind of like an OSF/1 system, but we'll see..."
4342         echo exit 0 >osf1
4343 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4344         xxx=`./loc addbib blurfl $pth`
4345         if $test -f $xxx; then
4346         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4347                 echo exit 0 >bsd
4348                 echo exit 0 >usg
4349         else
4350                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4351                         echo "Looks kind of like an extended USG system, but we'll see..."
4352                 else
4353                         echo "Looks kind of like a USG system, but we'll see..."
4354                 fi
4355                 echo exit 0 >usg
4356         fi
4357 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358         echo "Looks kind of like a BSD system, but we'll see..."
4359         d_bsd="$define"
4360         echo exit 0 >bsd
4361 else
4362         echo "Looks kind of like a Version 7 system, but we'll see..."
4363         echo exit 0 >v7
4364 fi
4365 case "$eunicefix" in
4366 *unixtovms*)
4367         $cat <<'EOI'
4368 There is, however, a strange, musty smell in the air that reminds me of
4369 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4370 EOI
4371         echo exit 0 >eunice
4372         d_eunice="$define"
4373 : it so happens the Eunice I know will not run shell scripts in Unix format
4374         ;;
4375 *)
4376         echo " "
4377         echo "Congratulations.  You aren't running Eunice."
4378         d_eunice="$undef"
4379         ;;
4380 esac
4381 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4382 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4383 : semicolon as a patch separator
4384 case "$p_" in
4385 :) ;;
4386 *)
4387         $cat <<'EOI'
4388 I have the feeling something is not exactly right, however...don't tell me...
4389 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4390 (Or you may be running DOS with DJGPP.)
4391 EOI
4392         echo exit 0 >os2
4393         ;;
4394 esac
4395 if test -f /xenix; then
4396         echo "Actually, this looks more like a XENIX system..."
4397         echo exit 0 >xenix
4398         d_xenix="$define"
4399 else
4400         echo " "
4401         echo "It's not Xenix..."
4402         d_xenix="$undef"
4403 fi
4404 chmod +x xenix
4405 $eunicefix xenix
4406 if test -f /venix; then
4407         echo "Actually, this looks more like a VENIX system..."
4408         echo exit 0 >venix
4409 else
4410         echo " "
4411         if ./xenix; then
4412                 : null
4413         else
4414                 echo "Nor is it Venix..."
4415         fi
4416 fi
4417 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4418 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4419 $rm -f foo
4420
4421 case "$cc" in
4422 '') dflt=cc;;
4423 *) dflt="$cc";;
4424 esac
4425 rp="Use which C compiler?"
4426 . ./myread
4427 cc="$ans"
4428
4429 : See if they have not cc but they do have gcc
4430 . ./trygcc
4431 : Look for a hint-file generated 'call-back-unit'.  Now that the
4432 : user has specified the compiler, we may need to set or change some
4433 : other defaults.
4434 if $test -f cc.cbu; then
4435     . ./cc.cbu
4436 fi
4437 . ./checkcc
4438
4439 echo " "
4440 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4441 $cat >try.c <<EOM
4442 #include <stdio.h>
4443 int main() {
4444 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4445 #ifdef __VERSION__
4446         printf("%s\n", __VERSION__);
4447 #else
4448         printf("%s\n", "1");
4449 #endif
4450 #endif
4451         return(0);
4452 }
4453 EOM
4454 if $cc -o try $ccflags $ldflags try.c; then
4455         gccversion=`$run ./try`
4456         case "$gccversion" in
4457         '') echo "You are not using GNU cc." ;;
4458         *)  echo "You are using GNU cc $gccversion."
4459             ccname=gcc
4460             ;;
4461         esac
4462 else
4463         echo " "
4464         echo "*** WHOA THERE!!! ***" >&4
4465         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4466         case "$knowitall" in
4467         '')
4468         echo "    You'd better start hunting for one and let me know about it." >&4
4469                 exit 1
4470                 ;;
4471         esac
4472 fi
4473 $rm -f try try.*
4474 case "$gccversion" in
4475 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4476 esac
4477 case "$gccversion" in
4478 '') gccosandvers='' ;;
4479 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4480    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4481    gccshortvers=''
4482    case "$gccosandvers" in
4483    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4484    $osname$osvers) ;; # looking good
4485    $osname*) cat <<EOM >&4
4486
4487 *** WHOA THERE!!! ***
4488
4489     Your gcc has not been compiled for the exact release of
4490     your operating system ($gccosandvers versus $osname$osvers).
4491
4492     In general it is a good idea to keep gcc synchronized with
4493     the operating system because otherwise serious problems
4494     may ensue when trying to compile software, like Perl.
4495
4496     I'm trying to be optimistic here, though, and will continue.
4497     If later during the configuration and build icky compilation
4498     problems appear (headerfile conflicts being the most common
4499     manifestation), I suggest reinstalling the gcc to match
4500     your operating system release.
4501
4502 EOM
4503       ;;
4504    *) gccosandvers='' ;; # failed to parse, better be silent
4505    esac
4506    ;;
4507 esac
4508 case "$ccname" in
4509 '') ccname="$cc" ;;
4510 esac
4511
4512 # gcc 3.* complain about adding -Idirectories that they already know about,
4513 # so we will take those off from locincpth.
4514 case "$gccversion" in
4515 3*)
4516     echo "main(){}">try.c
4517     for incdir in $locincpth; do
4518        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4519              grep '^c[cp]p*[01]: warning: changing search order '`
4520        if test "X$warn" != X; then
4521            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4522        fi
4523     done
4524     $rm -f try try.*
4525 esac
4526
4527 : What should the include directory be ?
4528 echo " "
4529 $echo $n "Hmm...  $c"
4530 dflt='/usr/include'
4531 incpath=''
4532 mips_type=''
4533 if $test -f /bin/mips && /bin/mips; then
4534         echo "Looks like a MIPS system..."
4535         $cat >usr.c <<'EOCP'
4536 #ifdef SYSTYPE_BSD43
4537 /bsd43
4538 #endif
4539 EOCP
4540         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4541                 dflt='/bsd43/usr/include'
4542                 incpath='/bsd43'
4543                 mips_type='BSD 4.3'
4544         else
4545                 mips_type='System V'
4546         fi
4547         $rm -f usr.c usr.out
4548         echo "and you're compiling with the $mips_type compiler and libraries."
4549         xxx_prompt=y
4550         echo "exit 0" >mips
4551 else
4552         echo "Doesn't look like a MIPS system."
4553         xxx_prompt=n
4554         echo "exit 1" >mips
4555 fi
4556 chmod +x mips
4557 $eunicefix mips
4558 case "$usrinc" in
4559 '') ;;
4560 *) dflt="$usrinc";;
4561 esac
4562 case "$xxx_prompt" in
4563 y)      fn=d/
4564         echo " "
4565         rp='Where are the include files you want to use?'
4566         . ./getfile
4567         usrinc="$ans"
4568         ;;
4569 *)      usrinc="$dflt"
4570         ;;
4571 esac
4572
4573 : see how we invoke the C preprocessor
4574 echo " "
4575 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4576 cat <<'EOT' >testcpp.c
4577 #define ABC abc
4578 #define XYZ xyz
4579 ABC.XYZ
4580 EOT
4581 cd ..
4582 if test ! -f cppstdin; then
4583         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4584                 # AIX cc -E doesn't show the absolute headerfile
4585                 # locations but we'll cheat by using the -M flag.
4586                 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
4587         else
4588                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4589         fi
4590 else
4591         echo "Keeping your $hint cppstdin wrapper."
4592 fi
4593 chmod 755 cppstdin
4594 wrapper=`pwd`/cppstdin
4595 ok='false'
4596 cd UU
4597
4598 if $test "X$cppstdin" != "X" && \
4599         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4600         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4601 then
4602         echo "You used to use $cppstdin $cppminus so we'll use that again."
4603         case "$cpprun" in
4604         '') echo "But let's see if we can live without a wrapper..." ;;
4605         *)
4606                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4607                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4608                 then
4609                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4610                         ok='true'
4611                 else
4612                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4613                 fi
4614                 ;;
4615         esac
4616 else
4617         case "$cppstdin" in
4618         '') ;;
4619         *)
4620                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4621                 ;;
4622         esac
4623 fi
4624
4625 if $ok; then
4626         : nothing
4627 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4628         $cc -E <testcpp.c >testcpp.out 2>&1; \
4629         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4630         echo "Yup, it does."
4631         x_cpp="$cc -E"
4632         x_minus='';
4633 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4634         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4635         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4636         echo "Yup, it does."
4637         x_cpp="$cc -E"
4638         x_minus='-';
4639 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4640         $cc -P <testcpp.c >testcpp.out 2>&1; \
4641         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4642         echo "Yipee, that works!"
4643         x_cpp="$cc -P"
4644         x_minus='';
4645 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4646         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4648         echo "At long last!"
4649         x_cpp="$cc -P"
4650         x_minus='-';
4651 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4652         $cpp <testcpp.c >testcpp.out 2>&1; \
4653         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654         echo "It works!"
4655         x_cpp="$cpp"
4656         x_minus='';
4657 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4658         $cpp - <testcpp.c >testcpp.out 2>&1; \
4659         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660         echo "Hooray, it works!  I was beginning to wonder."
4661         x_cpp="$cpp"
4662         x_minus='-';
4663 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4664         $wrapper <testcpp.c >testcpp.out 2>&1; \
4665         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666         x_cpp="$wrapper"
4667         x_minus=''
4668         echo "Eureka!"
4669 else
4670         dflt=''
4671         rp="No dice.  I can't find a C preprocessor.  Name one:"
4672         . ./myread
4673         x_cpp="$ans"
4674         x_minus=''
4675         $x_cpp <testcpp.c >testcpp.out 2>&1
4676         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4677                 echo "OK, that will do." >&4
4678         else
4679 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4680                 exit 1
4681         fi
4682 fi
4683
4684 case "$ok" in
4685 false)
4686         cppstdin="$x_cpp"
4687         cppminus="$x_minus"
4688         cpprun="$x_cpp"
4689         cpplast="$x_minus"
4690         set X $x_cpp
4691         shift
4692         case "$1" in
4693         "$cpp")
4694                 echo "Perhaps can we force $cc -E using a wrapper..."
4695                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4696                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4697                 then
4698                         echo "Yup, we can."
4699                         cppstdin="$wrapper"
4700                         cppminus='';
4701                 else
4702                         echo "Nope, we'll have to live without it..."
4703                 fi
4704                 ;;
4705         esac
4706         case "$cpprun" in
4707         "$wrapper")
4708                 cpprun=''
4709                 cpplast=''
4710                 ;;
4711         esac
4712         ;;
4713 esac
4714
4715 case "$cppstdin" in
4716 "$wrapper"|'cppstdin') ;;
4717 *) $rm -f $wrapper;;
4718 esac
4719 $rm -f testcpp.c testcpp.out
4720
4721 : Set private lib path
4722 case "$plibpth" in
4723 '') if ./mips; then
4724                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4725         fi;;
4726 esac
4727 case "$libpth" in
4728 ' ') dlist='';;
4729 '') dlist="$loclibpth $plibpth $glibpth";;
4730 *) dlist="$libpth";;
4731 esac
4732
4733 : Now check and see which directories actually exist, avoiding duplicates
4734 libpth=''
4735 for xxx in $dlist
4736 do
4737     if $test -d $xxx; then
4738                 case " $libpth " in
4739                 *" $xxx "*) ;;
4740                 *) libpth="$libpth $xxx";;
4741                 esac
4742     fi
4743 done
4744 $cat <<'EOM'
4745
4746 Some systems have incompatible or broken versions of libraries.  Among
4747 the directories listed in the question below, please remove any you
4748 know not to be holding relevant libraries, and add any that are needed.
4749 Say "none" for none.
4750
4751 EOM
4752 case "$libpth" in
4753 '') dflt='none';;
4754 *)
4755         set X $libpth
4756         shift
4757         dflt=${1+"$@"}
4758         ;;
4759 esac
4760 rp="Directories to use for library searches?"
4761 . ./myread
4762 case "$ans" in
4763 none) libpth=' ';;
4764 *) libpth="$ans";;
4765 esac
4766
4767 : compute shared library extension
4768 case "$so" in
4769 '')
4770         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4771                 dflt='sl'
4772         else
4773                 dflt='so'
4774         fi
4775         ;;
4776 *) dflt="$so";;
4777 esac
4778 $cat <<EOM
4779
4780 On some systems, shared libraries may be available.  Answer 'none' if
4781 you want to suppress searching of shared libraries for the remainder
4782 of this configuration.
4783
4784 EOM
4785 rp='What is the file extension used for shared libraries?'
4786 . ./myread
4787 so="$ans"
4788
4789 : Define several unixisms.
4790 : Hints files or command line option can be used to override them.
4791 : The convoluted testing is in case hints files set either the old
4792 : or the new name.
4793 case "$_exe" in
4794 '')     case "$exe_ext" in
4795         '')     ;;
4796         *)      _exe="$exe_ext" ;;
4797         esac
4798         ;;
4799 esac
4800 case "$_a" in
4801 '')     case "$lib_ext" in
4802     '') _a='.a';;
4803         *)      _a="$lib_ext" ;;
4804         esac
4805         ;;
4806 esac
4807 case "$_o" in
4808 '') case "$obj_ext" in
4809         '')     _o='.o';;
4810         *)      _o="$obj_ext";;
4811         esac
4812         ;;
4813 esac
4814 case "$p_" in
4815 '') case "$path_sep" in
4816         '')     p_=':';;
4817         *)      p_="$path_sep";;
4818         esac
4819         ;;
4820 esac
4821 exe_ext=$_exe
4822 lib_ext=$_a
4823 obj_ext=$_o
4824 path_sep=$p_
4825
4826 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4827
4828 : Which makefile gets called first.  This is used by make depend.
4829 case "$firstmakefile" in
4830 '') firstmakefile='makefile';;
4831 esac
4832
4833 case "$ccflags" in
4834 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4835 esac
4836
4837 case "$uselongdouble" in
4838 $define|true|[yY]*)     dflt='y';;
4839 *) dflt='n';;
4840 esac
4841 cat <<EOM
4842
4843 Perl can be built to take advantage of long doubles which
4844 (if available) may give more accuracy and range for floating point numbers.
4845
4846 If this doesn't make any sense to you, just accept the default '$dflt'.
4847 EOM
4848 rp='Try to use long doubles if available?'
4849 . ./myread
4850 case "$ans" in
4851 y|Y)    val="$define"   ;;
4852 *)      val="$undef"    ;;
4853 esac
4854 set uselongdouble
4855 eval $setvar
4856
4857 case "$uselongdouble" in
4858 true|[yY]*) uselongdouble="$define" ;;
4859 esac
4860
4861 : Look for a hint-file generated 'call-back-unit'.  If the
4862 : user has specified that long doubles should be used,
4863 : we may need to set or change some other defaults.
4864 if $test -f uselongdouble.cbu; then
4865     echo "Your platform has some specific hints regarding long doubles, using them..."
4866     . ./uselongdouble.cbu
4867 else
4868     case "$uselongdouble" in
4869         $define)
4870                 $cat <<EOM
4871 (Your platform does not have any specific hints for long doubles.)
4872 EOM
4873         ;;
4874     esac
4875 fi
4876
4877 : Looking for optional libraries
4878 echo " "
4879 echo "Checking for optional libraries..." >&4
4880 case "$libs" in
4881 ' '|'') dflt='';;
4882 *) dflt="$libs";;
4883 esac
4884 case "$libswanted" in
4885 '') libswanted='c_s';;
4886 esac
4887 case "$usesocks" in
4888 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4889 esac
4890 libsfound=''
4891 libsfiles=''
4892 libsdirs=''
4893 libspath=''
4894 for thisdir in $libpth $xlibpth; do
4895   test -d $thisdir && libspath="$libspath $thisdir"
4896 done
4897 for thislib in $libswanted; do
4898         for thisdir in $libspath; do
4899             xxx=''
4900             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4901                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4902                 $test -f "$xxx" && eval $libscheck
4903                 $test -f "$xxx" && libstyle=shared
4904             fi
4905             if test ! -f "$xxx"; then
4906                 xxx=$thisdir/lib$thislib.$so
4907                 $test -f "$xxx" && eval $libscheck
4908                 $test -f "$xxx" && libstyle=shared
4909             fi  
4910             if test ! -f "$xxx"; then
4911                 xxx=$thisdir/lib$thislib$_a
4912                 $test -f "$xxx" && eval $libscheck
4913                 $test -f "$xxx" && libstyle=static
4914             fi
4915             if test ! -f "$xxx"; then
4916                 xxx=$thisdir/$thislib$_a
4917                 $test -f "$xxx" && eval $libscheck
4918                 $test -f "$xxx" && libstyle=static
4919             fi
4920             if test ! -f "$xxx"; then
4921                 xxx=$thisdir/lib${thislib}_s$_a
4922                 $test -f "$xxx" && eval $libscheck
4923                 $test -f "$xxx" && libstyle=static
4924                 $test -f "$xxx" && thislib=${thislib}_s
4925             fi
4926             if test ! -f "$xxx"; then
4927                 xxx=$thisdir/Slib$thislib$_a
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=static
4930             fi
4931             if $test -f "$xxx"; then
4932                 case "$libstyle" in
4933                 shared) echo "Found -l$thislib (shared)." ;;
4934                 static) echo "Found -l$thislib." ;;
4935                 *)      echo "Found -l$thislib ($libstyle)." ;;
4936                 esac
4937                 case " $dflt " in
4938                 *"-l$thislib "*);;
4939                 *) dflt="$dflt -l$thislib"
4940                    libsfound="$libsfound $xxx"
4941                    yyy=`basename $xxx`
4942                    libsfiles="$libsfiles $yyy"
4943                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4944                    case " $libsdirs " in
4945                    *" $yyy "*) ;;
4946                    *) libsdirs="$libsdirs $yyy" ;;
4947                    esac
4948                    ;;
4949                 esac
4950                 break
4951             fi  
4952         done
4953         if $test ! -f "$xxx"; then
4954             echo "No -l$thislib."
4955         fi
4956 done
4957 set X $dflt
4958 shift
4959 dflt="$*"
4960 case "$libs" in
4961 '') dflt="$dflt";;
4962 *) dflt="$libs";;
4963 esac
4964 case "$dflt" in
4965 ' '|'') dflt='none';;
4966 esac
4967
4968 $cat <<EOM
4969
4970 In order to compile $package on your machine, a number of libraries
4971 are usually needed.  Include any other special libraries here as well.
4972 Say "none" for none.  The default list is almost always right.
4973 EOM
4974
4975 echo " "
4976 rp="What libraries to use?"
4977 . ./myread
4978 case "$ans" in
4979 none) libs=' ';;
4980 *) libs="$ans";;
4981 esac
4982
4983 : determine optimization, if desired, or use for debug flag also
4984 case "$optimize" in
4985 ' '|$undef) dflt='none';;
4986 '') dflt='-O';;
4987 *) dflt="$optimize";;
4988 esac
4989 $cat <<EOH
4990
4991 By default, $package compiles with the -O flag to use the optimizer.
4992 Alternately, you might want to use the symbolic debugger, which uses
4993 the -g flag (on traditional Unix systems).  Either flag can be
4994 specified here.  To use neither flag, specify the word "none".
4995
4996 EOH
4997 rp="What optimizer/debugger flag should be used?"
4998 . ./myread
4999 optimize="$ans"
5000 case "$optimize" in
5001 'none') optimize=" ";;
5002 esac
5003
5004 : Check what DEBUGGING is required from the command line
5005 : -DEBUGGING      or -DDEBUGGING or
5006 : -DEBUGGING=both                       = -g + -DDEBUGGING
5007 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5008 : -DEBUGGING=none or -UDEBUGGING        =
5009 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5010 case "$EBUGGING" in
5011 '')     ;;
5012 *)      DEBUGGING=$EBUGGING ;;
5013 esac
5014
5015 case "$DEBUGGING" in
5016 -g|both|$define)
5017     case "$optimize" in
5018         *-g*) ;;
5019         *)    optimize="$optimize -g" ;;
5020     esac ;;
5021 none|$undef)
5022     case "$optimize" in
5023         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5024                 shift
5025                 optimize="$*"
5026                 ;;
5027     esac ;;
5028 esac
5029
5030 dflt=''
5031 case "$DEBUGGING" in
5032 both|$define) dflt='-DDEBUGGING'
5033 esac
5034
5035 : We will not override a previous value, but we might want to
5036 : augment a hint file
5037 case "$hint" in
5038 default|recommended)
5039         case "$gccversion" in
5040         1*) dflt="$dflt -fpcc-struct-return" ;;
5041         esac
5042         case "$optimize:$DEBUGGING" in
5043         *-g*:old) dflt="$dflt -DDEBUGGING";;
5044         esac
5045         case "$gccversion" in
5046         2*) if test -d /etc/conf/kconfig.d &&
5047                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5048                 then
5049                         # Interactive Systems (ISC) POSIX mode.
5050                         dflt="$dflt -posix"
5051                 fi
5052                 ;;
5053         esac
5054         case "$gccversion" in
5055         1*) ;;
5056         2.[0-8]*) ;;
5057         ?*)     echo " "
5058                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5059                 echo 'int main(void) { return 0; }' > gcctest.c
5060                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5061                         echo "Yes, it does." 2>&1
5062                         case "$ccflags" in
5063                         *strict-aliasing*)
5064                                 echo "Leaving current flags $ccflags alone." 2>&1
5065                                 ;;
5066                         *) dflt="$dflt -fno-strict-aliasing" ;;
5067                         esac
5068                 else
5069                         echo "Nope, it doesn't, but that's ok." 2>&1
5070                 fi
5071                 ;;
5072         esac
5073         # For gcc, adding -pipe speeds up compilations for some, but apparently
5074         # some assemblers can't read from stdin.  (It also slows down compilations
5075         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5076         case "$gccversion" in
5077         ?*)     echo " "
5078                 echo "Checking if your compiler accepts -pipe" 2>&1
5079                 echo 'int main(void) { return 0; }' > gcctest.c
5080                 if $cc -pipe -o gcctest gcctest.c; then
5081                         echo "Yes, it does." 2>&1
5082                         case "$ccflags" in
5083                         *-pipe*)
5084                                 echo "Leaving current flags $ccflags alone." 2>&1
5085                                 ;;
5086                         *) dflt="$dflt -pipe" ;;
5087                         esac
5088                 else
5089                         echo "Nope, it doesn't, but that's ok." 2>&1
5090                 fi
5091                 ;;
5092         esac
5093         ;;
5094 esac
5095
5096 case "$mips_type" in
5097 *BSD*|'') inclwanted="$locincpth $usrinc";;
5098 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5099 esac
5100 for thisincl in $inclwanted; do
5101         if $test -d $thisincl; then
5102                 if $test x$thisincl != x$usrinc; then
5103                         case "$dflt" in
5104                         *" -I$thisincl "*);;
5105                         *) dflt="$dflt -I$thisincl ";;
5106                         esac
5107                 fi
5108         fi
5109 done
5110
5111 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5112         xxx=true;
5113 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5114         xxx=true;
5115 else
5116         xxx=false;
5117 fi;
5118 if $xxx; then
5119         case "$dflt" in
5120         *$2*);;
5121         *) dflt="$dflt -D$2";;
5122         esac;
5123 fi'
5124
5125 set signal.h LANGUAGE_C; eval $inctest
5126
5127 case "$usesocks" in
5128 $define)
5129         ccflags="$ccflags -DSOCKS"
5130         ;;
5131 esac
5132
5133 case "$hint" in
5134 default|recommended) dflt="$ccflags $dflt" ;;
5135 *) dflt="$ccflags";;
5136 esac
5137
5138 case "$dflt" in
5139 ''|' ') dflt=none;;
5140 esac
5141
5142 $cat <<EOH
5143
5144 Your C compiler may want other flags.  For this question you should include
5145 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5146 but you should NOT include libraries or ld flags like -lwhatever.  If you
5147 want $package to honor its debug switch, you should include -DDEBUGGING here.
5148 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5149
5150 To use no flags, specify the word "none".
5151
5152 EOH
5153 set X $dflt
5154 shift
5155 dflt=${1+"$@"}
5156 rp="Any additional cc flags?"
5157 . ./myread
5158 case "$ans" in
5159 none) ccflags='';;
5160 *) ccflags="$ans";;
5161 esac
5162
5163 : the following weeds options from ccflags that are of no interest to cpp
5164 case "$cppflags" in
5165 '') cppflags="$ccflags" ;;
5166 *)  cppflags="$cppflags $ccflags" ;;
5167 esac
5168 case "$gccversion" in
5169 1*) cppflags="$cppflags -D__GNUC__"
5170 esac
5171 case "$mips_type" in
5172 '');;
5173 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5174 esac
5175 case "$cppflags" in
5176 '');;
5177 *)
5178         echo " "
5179         echo "Let me guess what the preprocessor flags are..." >&4
5180         set X $cppflags
5181         shift
5182         cppflags=''
5183         $cat >cpp.c <<'EOM'
5184 #define BLURFL foo
5185
5186 BLURFL xx LFRULB
5187 EOM
5188         previous=''
5189         for flag in $*
5190         do
5191                 case "$flag" in
5192                 -*) ftry="$flag";;
5193                 *) ftry="$previous $flag";;
5194                 esac
5195                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5196                         >cpp1.out 2>/dev/null && \
5197                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5198                         >cpp2.out 2>/dev/null && \
5199                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5200                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5201                 then
5202                         cppflags="$cppflags $ftry"
5203                         previous=''
5204                 else
5205                         previous="$flag"
5206                 fi
5207         done
5208         set X $cppflags
5209         shift
5210         cppflags=${1+"$@"}
5211         case "$cppflags" in
5212         *-*)  echo "They appear to be: $cppflags";;
5213         esac
5214         $rm -f cpp.c cpp?.out
5215         ;;
5216 esac
5217
5218 : flags used in final linking phase
5219 case "$ldflags" in
5220 '') if ./venix; then
5221                 dflt='-i -z'
5222         else
5223                 dflt=''
5224         fi
5225         case "$ccflags" in
5226         *-posix*) dflt="$dflt -posix" ;;
5227         esac
5228         ;;
5229 *) dflt="$ldflags";;
5230 esac
5231
5232 : Try to guess additional flags to pick up local libraries.
5233 for thislibdir in $libpth; do
5234         case " $loclibpth " in
5235         *" $thislibdir "*)
5236                 case "$dflt " in
5237                 *"-L$thislibdir "*) ;;
5238                 *)  dflt="$dflt -L$thislibdir" ;;
5239                 esac
5240                 ;;
5241         esac
5242 done
5243
5244 case "$dflt" in
5245 '') dflt='none' ;;
5246 esac
5247
5248 $cat <<EOH
5249
5250 Your C linker may need flags.  For this question you should
5251 include -L/whatever and any other flags used by the C linker, but you
5252 should NOT include libraries like -lwhatever.
5253
5254 Make sure you include the appropriate -L/path flags if your C linker
5255 does not normally search all of the directories you specified above,
5256 namely
5257         $libpth
5258 To use no flags, specify the word "none".
5259
5260 EOH
5261
5262 rp="Any additional ld flags (NOT including libraries)?"
5263 . ./myread
5264 case "$ans" in
5265 none) ldflags='';;
5266 *) ldflags="$ans";;
5267 esac
5268 rmlist="$rmlist pdp11"
5269
5270 : coherency check
5271 echo " "
5272 echo "Checking your choice of C compiler and flags for coherency..." >&4
5273 $cat > try.c <<'EOF'
5274 #include <stdio.h>
5275 int main() { printf("Ok\n"); return(0); }
5276 EOF
5277 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5278 shift
5279 $cat >try.msg <<'EOM'
5280 I've tried to compile and run the following simple program:
5281
5282 EOM
5283 $cat try.c >> try.msg
5284
5285 $cat >> try.msg <<EOM
5286
5287 I used the command:
5288
5289         $*
5290         $run ./try
5291
5292 and I got the following output:
5293
5294 EOM
5295 dflt=y
5296 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5297         if $sh -c "$run ./try" >>try.msg 2>&1; then
5298                 xxx=`$run ./try`
5299                 case "$xxx" in
5300                 "Ok") dflt=n ;;
5301                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5302                         case " $libs " in
5303                         *" -lsfio "*)
5304                                 cat >> try.msg <<'EOQS'
5305 If $libs contains -lsfio, and sfio is mis-configured, then it
5306 sometimes (apparently) runs and exits with a 0 status, but with no
5307 output!  It may have to do with sfio's use of _exit vs. exit.
5308
5309 EOQS
5310                                 rp="You have a big problem.  Shall I abort Configure"
5311                                 dflt=y
5312                                 ;;
5313                         esac
5314                         ;;
5315                 esac
5316         else
5317                 echo "The program compiled OK, but exited with status $?." >>try.msg
5318                 rp="You have a problem.  Shall I abort Configure"
5319                 dflt=y
5320         fi
5321 else
5322         echo "I can't compile the test program." >>try.msg
5323         rp="You have a BIG problem.  Shall I abort Configure"
5324         dflt=y
5325 fi
5326 case "$dflt" in
5327 y)
5328         $cat try.msg >&4
5329         case "$knowitall" in
5330         '')
5331                 echo "(The supplied flags or libraries might be incorrect.)"
5332                 ;;
5333         *) dflt=n;;
5334         esac
5335         echo " "
5336         . ./myread
5337         case "$ans" in
5338         n*|N*) ;;
5339         *)      echo "Ok.  Stopping Configure." >&4
5340                 exit 1
5341                 ;;
5342         esac
5343         ;;
5344 n) echo "OK, that should do.";;
5345 esac
5346 $rm_try
5347
5348 : define a shorthand compile call
5349 compile='
5350 mc_file=$1;
5351 shift;
5352 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5353 : define a shorthand compile call for compilations that should be ok.
5354 compile_ok='
5355 mc_file=$1;
5356 shift;
5357 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5358
5359 : determine filename position in cpp output
5360 echo " "
5361 echo "Computing filename position in cpp output for #include directives..." >&4
5362 case "$osname" in
5363 vos) testaccess=-e ;;
5364 *)   testaccess=-r ;;
5365 esac
5366 echo '#include <stdio.h>' > foo.c
5367 $cat >fieldn <<EOF
5368 $startsh
5369 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5370 $grep '^[       ]*#.*stdio\.h' | \
5371 while read cline; do
5372         pos=1
5373         set \$cline
5374         while $test \$# -gt 0; do
5375                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5376                         echo "\$pos"
5377                         exit 0
5378                 fi
5379                 shift
5380                 pos=\`expr \$pos + 1\`
5381         done
5382 done
5383 EOF
5384 chmod +x fieldn
5385 fieldn=`./fieldn`
5386 $rm -f foo.c fieldn
5387 case $fieldn in
5388 '') pos='???';;
5389 1) pos=first;;
5390 2) pos=second;;
5391 3) pos=third;;
5392 *) pos="${fieldn}th";;
5393 esac
5394 echo "Your cpp writes the filename in the $pos field of the line."
5395
5396 case "$osname" in
5397 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5398 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5399 *)   cppfilter='' ;;
5400 esac
5401 : locate header file
5402 $cat >findhdr <<EOF
5403 $startsh
5404 wanted=\$1
5405 name=''
5406 for usrincdir in $usrinc
5407 do
5408         if test -f \$usrincdir/\$wanted; then
5409                 echo "\$usrincdir/\$wanted"
5410                 exit 0
5411         fi
5412 done
5413 awkprg='{ print \$$fieldn }'
5414 echo "#include <\$wanted>" > foo\$\$.c
5415 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5416 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5417 while read cline; do
5418         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5419         case "\$name" in
5420         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5421         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5422         *) exit 2;;
5423         esac;
5424 done;
5425 #
5426 # status = 0: grep returned 0 lines, case statement not executed
5427 # status = 1: headerfile found
5428 # status = 2: while loop executed, no headerfile found
5429 #
5430 status=\$?
5431 $rm -f foo\$\$.c;
5432 if test \$status -eq 1; then
5433         exit 0;
5434 fi
5435 exit 1
5436 EOF
5437 chmod +x findhdr
5438
5439 : define an alternate in-header-list? function
5440 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5441 cont=true; xxf="echo \"<\$1> found.\" >&4";
5442 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5443 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5444 esac;
5445 case $# in 4) instead=instead;; *) instead="at last";; esac;
5446 while $test "$cont"; do
5447         xxx=`./findhdr $1`
5448         var=$2; eval "was=\$$2";
5449         if $test "$xxx" && $test -r "$xxx";
5450         then eval $xxf;
5451         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5452                 cont="";
5453         else eval $xxnf;
5454         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5455         set $yyy; shift; shift; yyy=$@;
5456         case $# in 0) cont="";;
5457         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5458                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5459         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5460                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5461         esac;
5462 done;
5463 while $test "$yyy";
5464 do set $yyy; var=$2; eval "was=\$$2";
5465         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5466         set $yyy; shift; shift; yyy=$@;
5467 done'
5468
5469 : see if stdlib is available
5470 set stdlib.h i_stdlib
5471 eval $inhdr
5472
5473 : check for lengths of integral types
5474 echo " "
5475 case "$intsize" in
5476 '')
5477         echo "Checking to see how big your integers are..." >&4
5478         $cat >try.c <<EOCP
5479 #include <stdio.h>
5480 #$i_stdlib I_STDLIB
5481 #ifdef I_STDLIB
5482 #include <stdlib.h>
5483 #endif
5484 int main()
5485 {
5486         printf("intsize=%d;\n", (int)sizeof(int));
5487         printf("longsize=%d;\n", (int)sizeof(long));
5488         printf("shortsize=%d;\n", (int)sizeof(short));
5489         exit(0);
5490 }
5491 EOCP
5492         set try
5493         if eval $compile_ok && $run ./try > /dev/null; then
5494                 eval `$run ./try`
5495                 echo "Your integers are $intsize bytes long."
5496                 echo "Your long integers are $longsize bytes long."
5497                 echo "Your short integers are $shortsize bytes long."
5498         else
5499                 $cat >&4 <<EOM
5500 !
5501 Help! I can't compile and run the intsize test program: please enlighten me!
5502 (This is probably a misconfiguration in your system or libraries, and
5503 you really ought to fix it.  Still, I'll try anyway.)
5504 !
5505 EOM
5506                 dflt=4
5507                 rp="What is the size of an integer (in bytes)?"
5508                 . ./myread
5509                 intsize="$ans"
5510                 dflt=$intsize
5511                 rp="What is the size of a long integer (in bytes)?"
5512                 . ./myread
5513                 longsize="$ans"
5514                 dflt=2
5515                 rp="What is the size of a short integer (in bytes)?"
5516                 . ./myread
5517                 shortsize="$ans"
5518         fi
5519         ;;
5520 esac
5521 $rm_try
5522
5523 : check for long long
5524 echo " "
5525 echo "Checking to see if you have long long..." >&4
5526 echo 'int main() { long long x = 7; return 0; }' > try.c
5527 set try
5528 if eval $compile; then
5529         val="$define"
5530         echo "You have long long."
5531 else
5532         val="$undef"
5533         echo "You do not have long long."
5534 fi
5535 $rm_try
5536 set d_longlong
5537 eval $setvar
5538
5539 : check for length of long long
5540 case "${d_longlong}${longlongsize}" in
5541 $define)
5542         echo " "
5543         echo "Checking to see how big your long longs are..." >&4
5544         $cat >try.c <<'EOCP'
5545 #include <stdio.h>
5546 int main()
5547 {
5548     printf("%d\n", (int)sizeof(long long));
5549     return(0);
5550 }
5551 EOCP
5552         set try
5553         if eval $compile_ok; then
5554                 longlongsize=`$run ./try`
5555                 echo "Your long longs are $longlongsize bytes long."
5556         else
5557                 dflt='8'
5558                 echo " "
5559                 echo "(I can't seem to compile the test program.  Guessing...)"
5560                 rp="What is the size of a long long (in bytes)?"
5561                 . ./myread
5562                 longlongsize="$ans"
5563         fi
5564         if $test "X$longsize" = "X$longlongsize"; then
5565                 echo "(That isn't any different from an ordinary long.)"
5566         fi
5567         ;;
5568 esac
5569 $rm_try
5570
5571 : see if inttypes.h is available
5572 : we want a real compile instead of Inhdr because some systems
5573 : have an inttypes.h which includes non-existent headers
5574 echo " "
5575 $cat >try.c <<EOCP
5576 #include <inttypes.h>
5577 int main() {
5578         static int32_t foo32 = 0x12345678;
5579 }
5580 EOCP
5581 set try
5582 if eval $compile; then
5583         echo "<inttypes.h> found." >&4
5584         val="$define"
5585 else
5586         echo "<inttypes.h> NOT found." >&4
5587         val="$undef"
5588 fi
5589 $rm_try
5590 set i_inttypes
5591 eval $setvar
5592
5593 : check for int64_t
5594 echo " "
5595 echo "Checking to see if you have int64_t..." >&4
5596 $cat >try.c <<EOCP
5597 #include <sys/types.h>
5598 #$i_inttypes I_INTTYPES
5599 #ifdef I_INTTYPES
5600 #include <inttypes.h>
5601 #endif
5602 int main() { int64_t x = 7; }
5603 EOCP
5604 set try
5605 if eval $compile; then
5606         val="$define"
5607         echo "You have int64_t."
5608 else
5609         val="$undef"
5610         echo "You do not have int64_t."
5611 fi
5612 $rm_try
5613 set d_int64_t
5614 eval $setvar
5615
5616
5617 echo " "
5618 echo "Checking which 64-bit integer type we could use..." >&4
5619
5620 case "$intsize" in
5621 8) val=int
5622    set quadtype
5623    eval $setvar
5624    val='"unsigned int"'
5625    set uquadtype
5626    eval $setvar
5627    quadkind=1
5628    ;;
5629 *) case "$longsize" in
5630    8) val=long
5631       set quadtype
5632       eval $setvar
5633       val='"unsigned long"'
5634       set uquadtype
5635       eval $setvar
5636       quadkind=2
5637       ;;
5638    *) case "$d_longlong:$longlongsize" in
5639       define:8)
5640         val='"long long"'
5641         set quadtype
5642         eval $setvar
5643         val='"unsigned long long"'
5644         set uquadtype
5645         eval $setvar
5646         quadkind=3
5647         ;;
5648       *) case "$d_int64_t" in
5649          define)
5650            val=int64_t
5651            set quadtype
5652            eval $setvar
5653            val=uint64_t
5654            set uquadtype
5655            eval $setvar
5656            quadkind=4
5657            ;;
5658          esac
5659          ;;
5660       esac
5661       ;;
5662    esac
5663    ;;
5664 esac
5665
5666 case "$quadtype" in
5667 '')     echo "Alas, no 64-bit integer types in sight." >&4
5668         d_quad="$undef"
5669         ;;
5670 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5671         d_quad="$define"
5672         ;;
5673 esac
5674
5675
5676 case "$uselonglong" in
5677 "$define"|true|[yY]*)
5678         cat <<EOM >&4
5679
5680 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5681 EOM
5682         use64bitint="$define"
5683         ;;
5684 esac                          
5685 case "$use64bits" in
5686 "$define"|true|[yY]*)
5687         cat <<EOM >&4
5688
5689 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5690 EOM
5691         use64bitint="$define"
5692         ;;
5693 esac                          
5694 case "$use64bitints" in
5695 "$define"|true|[yY]*)
5696         cat <<EOM >&4
5697
5698 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5699 EOM
5700         use64bitint="$define"
5701         ;;
5702 esac                          
5703 case "$use64bitsint" in
5704 "$define"|true|[yY]*)
5705         cat <<EOM >&4
5706
5707 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5708 EOM
5709         use64bitint="$define"
5710         ;;
5711 esac                          
5712 case "$uselonglongs" in
5713 "$define"|true|[yY]*)
5714         cat <<EOM >&4
5715
5716 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5717 EOM
5718         use64bitint="$define"
5719         ;;
5720 esac                          
5721 case "$use64bitsall" in
5722 "$define"|true|[yY]*)
5723         cat <<EOM >&4
5724
5725 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5726 EOM
5727         use64bitall="$define"
5728         ;;
5729 esac                          
5730
5731 case "$ccflags" in
5732 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5733 esac
5734 case "$use64bitall" in
5735 "$define"|true|[yY]*) use64bitint="$define" ;;
5736 esac
5737
5738 case "$longsize" in
5739 8) cat <<EOM
5740
5741 You have natively 64-bit long integers.
5742 EOM
5743    val="$define"
5744    ;;
5745 *) case "$use64bitint" in
5746    "$define"|true|[yY]*) dflt='y';;
5747    *) dflt='n';;
5748    esac
5749    case "$d_quad" in
5750    "$define") ;;
5751    *) dflt='n' ;;
5752    esac
5753    cat <<EOM
5754
5755 Perl can be built to take advantage of 64-bit integer types
5756 on some systems.  To do so, Configure can be run with -Duse64bitint.
5757 Choosing this option will most probably introduce binary incompatibilities.
5758
5759 If this doesn't make any sense to you, just accept the default '$dflt'.
5760 (The default has been chosen based on your configuration.)
5761 EOM
5762    rp='Try to use 64-bit integers, if available?'
5763    . ./myread
5764    case "$ans" in
5765    [yY]*) val="$define" ;;
5766    *)     val="$undef"  ;;
5767    esac
5768    ;;
5769 esac
5770 set use64bitint
5771 eval $setvar
5772
5773 case "$use64bitall" in
5774 "$define"|true|[yY]*) dflt='y' ;;
5775 *) case "$longsize" in
5776    8) dflt='y' ;;
5777    *) dflt='n' ;;
5778    esac
5779    ;;
5780 esac    
5781 cat <<EOM
5782
5783 You may also choose to try maximal 64-bitness.  It means using as much
5784 64-bitness as possible on the platform.  This in turn means even more
5785 binary incompatibilities.  On the other hand, your platform may not
5786 have any more 64-bitness available than what you already have chosen.
5787
5788 If this doesn't make any sense to you, just accept the default '$dflt'.
5789 (The default has been chosen based on your configuration.)
5790 EOM
5791 rp='Try to use maximal 64-bit support, if available?'
5792 . ./myread
5793 case "$ans" in
5794 [yY]*) val="$define" ;;
5795 *)     val="$undef"  ;;
5796 esac
5797 set use64bitall
5798 eval $setvar
5799 case "$use64bitall" in
5800 "$define")
5801         case "$use64bitint" in
5802         "$undef")
5803                 cat <<EOM
5804
5805 Since you have chosen a maximally 64-bit build, I'm also turning on
5806 the use of 64-bit integers.
5807 EOM
5808                 use64bitint="$define" ;;
5809         esac
5810         ;;
5811 esac
5812
5813 : Look for a hint-file generated 'call-back-unit'.  If the
5814 : user has specified that a 64-bit perl is to be built,
5815 : we may need to set or change some other defaults.
5816 if $test -f use64bitint.cbu; then
5817         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5818         . ./use64bitint.cbu
5819 fi
5820 case "$use64bitint" in
5821 "$define"|true|[yY]*)
5822         case "$longsize" in
5823         4) case "$archname64" in
5824            '') archname64=64int ;;
5825            esac
5826            ;;
5827         esac
5828         ;;
5829 esac
5830
5831 : Look for a hint-file generated 'call-back-unit'.  If the
5832 : user has specified that a maximally 64-bit perl is to be built,
5833 : we may need to set or change some other defaults.
5834 if $test -f use64bitall.cbu; then
5835         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5836         . ./use64bitall.cbu
5837 fi
5838 case "$use64bitall" in
5839 "$define"|true|[yY]*)
5840         case "$longsize" in
5841         4) case "$archname64" in
5842            ''|64int) archname64=64all ;;
5843            esac
5844            ;;
5845         esac
5846         ;;
5847 esac
5848
5849 case "$d_quad:$use64bitint" in
5850 $undef:$define)
5851         cat >&4 <<EOF
5852
5853 *** You have chosen to use 64-bit integers,
5854 *** but none can be found.
5855 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5856 *** Cannot continue, aborting.
5857
5858 EOF
5859         exit 1
5860         ;;
5861 esac
5862
5863 : check for length of double
5864 echo " "
5865 case "$doublesize" in
5866 '')
5867         echo "Checking to see how big your double precision numbers are..." >&4
5868         $cat >try.c <<EOCP
5869 #include <stdio.h>
5870 #$i_stdlib I_STDLIB
5871 #ifdef I_STDLIB
5872 #include <stdlib.h>
5873 #endif
5874 int main()
5875 {
5876     printf("%d\n", (int)sizeof(double));
5877     exit(0);
5878 }
5879 EOCP
5880         set try
5881         if eval $compile_ok; then
5882                 doublesize=`$run ./try`
5883                 echo "Your double is $doublesize bytes long."
5884         else
5885                 dflt='8'
5886                 echo "(I can't seem to compile the test program.  Guessing...)"
5887                 rp="What is the size of a double precision number (in bytes)?"
5888                 . ./myread
5889                 doublesize="$ans"
5890         fi
5891         ;;
5892 esac
5893 $rm_try
5894
5895 : check for long doubles
5896 echo " "
5897 echo "Checking to see if you have long double..." >&4
5898 echo 'int main() { long double x = 7.0; }' > try.c
5899 set try
5900 if eval $compile; then
5901         val="$define"
5902         echo "You have long double."
5903 else
5904         val="$undef"
5905         echo "You do not have long double."
5906 fi
5907 $rm_try
5908 set d_longdbl
5909 eval $setvar
5910
5911 : check for length of long double
5912 case "${d_longdbl}${longdblsize}" in
5913 $define)
5914         echo " "
5915         echo "Checking to see how big your long doubles are..." >&4
5916         $cat >try.c <<'EOCP'
5917 #include <stdio.h>
5918 int main()
5919 {
5920         printf("%d\n", sizeof(long double));
5921 }
5922 EOCP
5923         set try
5924         set try
5925         if eval $compile; then
5926                 longdblsize=`$run ./try`
5927                 echo "Your long doubles are $longdblsize bytes long."
5928         else
5929                 dflt='8'
5930                 echo " "
5931                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5932                 rp="What is the size of a long double (in bytes)?"
5933                 . ./myread
5934                 longdblsize="$ans"
5935         fi
5936         if $test "X$doublesize" = "X$longdblsize"; then
5937                 echo "That isn't any different from an ordinary double."
5938                 echo "I'll keep your setting anyway, but you may see some"
5939                 echo "harmless compilation warnings."
5940         fi
5941         ;;
5942 esac
5943 $rm_try
5944
5945 : determine the architecture name
5946 echo " "
5947 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5948         tarch=`arch`"-$osname"
5949 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5950         if uname -m > tmparch 2>&1 ; then
5951                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5952                         -e 's/$/'"-$osname/" tmparch`
5953         else
5954                 tarch="$osname"
5955         fi
5956         $rm -f tmparch
5957 else
5958         tarch="$osname"
5959 fi
5960 case "$myarchname" in
5961 ''|"$tarch") ;;
5962 *)
5963         echo "(Your architecture name used to be $myarchname.)"
5964         archname=''
5965         ;;
5966 esac
5967 case "$targetarch" in
5968 '') ;;
5969 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5970 esac
5971 myarchname="$tarch"
5972 case "$archname" in
5973 '') dflt="$tarch";;
5974 *) dflt="$archname";;
5975 esac
5976 rp='What is your architecture name'
5977 . ./myread
5978 archname="$ans"
5979 case "$usethreads" in
5980 $define)
5981         echo "Threads selected." >&4
5982         case "$archname" in
5983         *-thread*) echo "...and architecture name already has -thread." >&4
5984                 ;;
5985         *)      archname="$archname-thread"
5986                 echo "...setting architecture name to $archname." >&4
5987                 ;;
5988         esac
5989         ;;
5990 esac
5991 case "$usemultiplicity" in
5992 $define)
5993         echo "Multiplicity selected." >&4
5994         case "$archname" in
5995         *-multi*) echo "...and architecture name already has -multi." >&4
5996                 ;;
5997         *)      archname="$archname-multi"
5998                 echo "...setting architecture name to $archname." >&4
5999                 ;;
6000         esac
6001         ;;
6002 esac
6003 case "$use64bitint$use64bitall" in
6004 *"$define"*)
6005         case "$archname64" in
6006         '')
6007                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6008                 ;;
6009         *)
6010                 case "$use64bitint" in
6011                 "$define") echo "64 bit integers selected." >&4 ;;
6012                 esac
6013                 case "$use64bitall" in
6014                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6015                 esac
6016                 case "$archname" in
6017                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6018                         ;;
6019                 *)      archname="$archname-$archname64"
6020                         echo "...setting architecture name to $archname." >&4
6021                         ;;
6022                 esac
6023                 ;;
6024         esac
6025 esac
6026 case "$uselongdouble" in
6027 $define)
6028         echo "Long doubles selected." >&4
6029         case "$longdblsize" in
6030         $doublesize)
6031                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6032                 ;;
6033         *)
6034                 case "$archname" in
6035                 *-ld*) echo "...and architecture name already has -ld." >&4
6036                         ;;
6037                 *)      archname="$archname-ld"
6038                         echo "...setting architecture name to $archname." >&4
6039                         ;;
6040                 esac
6041                 ;;
6042         esac
6043         ;;
6044 esac
6045 case "$useperlio" in
6046 $define)
6047         echo "Perlio selected." >&4
6048         ;;
6049 *)
6050         echo "Perlio not selected, using stdio." >&4
6051         case "$archname" in
6052         *-stdio*) echo "...and architecture name already has -stdio." >&4
6053                 ;;
6054         *)      archname="$archname-stdio"
6055                 echo "...setting architecture name to $archname." >&4
6056                 ;;
6057         esac
6058         ;;
6059 esac
6060 if $test -f archname.cbu; then
6061         echo "Your platform has some specific hints for architecture name, using them..."
6062         . ./archname.cbu
6063 fi
6064
6065 : set the prefixit variable, to compute a suitable default value
6066 prefixit='case "$3" in
6067 ""|none)
6068         case "$oldprefix" in
6069         "") eval "$1=\"\$$2\"";;
6070         *)
6071                 case "$3" in
6072                 "") eval "$1=";;
6073                 none)
6074                         eval "tp=\"\$$2\"";
6075                         case "$tp" in
6076                         ""|" ") eval "$1=\"\$$2\"";;
6077                         *) eval "$1=";;
6078                         esac;;
6079                 esac;;
6080         esac;;
6081 *)
6082         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6083         case "$tp" in
6084         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6085         /*-$oldprefix/*|\~*-$oldprefix/*)
6086                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6087         *) eval "$1=\"\$$2\"";;
6088         esac;;
6089 esac'
6090
6091 : determine installation style
6092 : For now, try to deduce it from prefix unless it is already set.
6093 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6094 case "$installstyle" in
6095 '')     case "$prefix" in
6096                 *perl*) dflt='lib';;
6097                 *) dflt='lib/perl5' ;;
6098         esac
6099         ;;
6100 *)      dflt="$installstyle" ;;
6101 esac
6102 : Probably not worth prompting for this since we prompt for all
6103 : the directories individually, and the prompt would be too long and
6104 : confusing anyway.
6105 installstyle=$dflt
6106
6107 : determine where public executables go
6108 echo " "
6109 set dflt bin bin
6110 eval $prefixit
6111 fn=d~
6112 rp='Pathname where the public executables will reside?'
6113 . ./getfile
6114 if $test "X$ansexp" != "X$binexp"; then
6115         installbin=''
6116 fi
6117 prefixvar=bin
6118 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6119 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6120 :     this via initialinstalllocation
6121 . ./setprefixvar
6122
6123 case "$userelocatableinc" in
6124 $define|true|[yY]*)     dflt='y' ;;
6125 *)                      dflt='n' ;;
6126 esac
6127 cat <<EOM
6128
6129 Would you like to build Perl so that the installation is relocatable, so that
6130 library paths in @INC are determined relative to the path of the perl binary?
6131 This is not advised for system Perl installs, or if you need to run setid
6132 scripts or scripts under taint mode.
6133
6134 If this doesn't make any sense to you, just accept the default '$dflt'.
6135 EOM
6136 rp='Use relocatable @INC?'
6137 . ./myread
6138 case "$ans" in
6139 y|Y)    val="$define" ;;
6140 *)      val="$undef"  ;;
6141 esac
6142 set userelocatableinc
6143 eval $setvar
6144
6145 initialinstalllocation="$binexp"
6146 : Default prefix is now "up one level from where the binaries are"
6147 case "$userelocatableinc" in
6148 $define|true|[yY]*)
6149     bin=".../"
6150     binexp=".../"
6151     prefix=".../.."
6152     prefixexp=".../.."
6153     installprefixexp=".../.."
6154     ;;
6155 esac
6156
6157 : determine where private library files go
6158 : Usual default is /usr/local/lib/perl5/$version.
6159 : Also allow things like /opt/perl/lib/$version, since
6160 : /opt/perl/lib/perl5... would be redundant.
6161 : The default "style" setting is made in installstyle.U
6162 case "$installstyle" in
6163 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6164 *)       set dflt privlib lib/$version ;;
6165 esac
6166 eval $prefixit
6167 $cat <<EOM
6168
6169 There are some auxiliary files for $package that need to be put into a
6170 private library directory that is accessible by everyone.
6171
6172 EOM
6173 fn=$binexp
6174 fn=d~+
6175 rp='Pathname where the private library files will reside?'
6176 . ./getfile
6177 prefixvar=privlib
6178 . ./setprefixvar
6179
6180 : set the prefixup variable, to restore leading tilda escape
6181 prefixup='case "$prefixexp" in
6182 "$prefix") ;;
6183 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6184 esac'
6185
6186 : determine where public architecture dependent libraries go
6187 set archlib archlib
6188 eval $prefixit
6189 : privlib default is /usr/local/lib/$package/$version
6190 : archlib default is /usr/local/lib/$package/$version/$archname
6191 : privlib may have an optional trailing /share.
6192 tdflt=`echo $privlib | $sed 's,/share$,,'`
6193 tdflt=$tdflt/$archname
6194 case "$archlib" in
6195 '')     dflt=$tdflt
6196         ;;
6197 *)      dflt="$archlib"
6198     ;;
6199 esac
6200 $cat <<EOM
6201
6202 $spackage contains architecture-dependent library files.  If you are
6203 sharing libraries in a heterogeneous environment, you might store
6204 these files in a separate location.  Otherwise, you can just include
6205 them with the rest of the public library files.
6206
6207 EOM
6208 fn=$binexp
6209 fn=d+~
6210 rp='Where do you want to put the public architecture-dependent libraries?'
6211 . ./getfile
6212 prefixvar=archlib
6213 . ./setprefixvar
6214 if $test X"$archlib" = X"$privlib"; then
6215         d_archlib="$undef"
6216 else
6217         d_archlib="$define"
6218 fi
6219
6220 : see if setuid scripts can be secure
6221 $cat <<EOM
6222
6223 Some kernels have a bug that prevents setuid #! scripts from being
6224 secure.  Some sites have disabled setuid #! scripts because of this.
6225
6226 First let's decide if your kernel supports secure setuid #! scripts.
6227 (If setuid #! scripts would be secure but have been disabled anyway,
6228 don't say that they are secure if asked.)
6229
6230 EOM
6231
6232 val="$undef"
6233 if $test -d /dev/fd; then
6234         echo "#!$ls" >reflect
6235         chmod +x,u+s reflect
6236         ./reflect >flect 2>&1
6237         if $contains "/dev/fd" flect >/dev/null; then
6238                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6239                 val="$define"
6240         else
6241                 $cat <<EOM
6242 If you are not sure if they are secure, I can check but I'll need a
6243 username and password different from the one you are using right now.
6244 If you don't have such a username or don't want me to test, simply
6245 enter 'none'.
6246
6247 EOM
6248                 rp='Other username to test security of setuid scripts with?'
6249                 dflt='none'
6250                 . ./myread
6251                 case "$ans" in
6252                 n|none)
6253                         case "$d_suidsafe" in
6254                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6255                                 dflt=n;;
6256                         "$undef")
6257                                 echo "Well, the $hint value is *not* secure." >&4
6258                                 dflt=n;;
6259                         *)      echo "Well, the $hint value *is* secure." >&4
6260                                 dflt=y;;
6261                         esac
6262                         ;;
6263                 *)
6264                         $rm -f reflect flect
6265                         echo "#!$ls" >reflect
6266                         chmod +x,u+s reflect
6267                         echo >flect
6268                         chmod a+w flect
6269                         echo '"su" will (probably) prompt you for '"$ans's password."
6270                         su $ans -c './reflect >flect'
6271                         if $contains "/dev/fd" flect >/dev/null; then
6272                                 echo "Okay, it looks like setuid scripts are secure." >&4
6273                                 dflt=y
6274                         else
6275                                 echo "I don't think setuid scripts are secure." >&4
6276                                 dflt=n
6277                         fi
6278                         ;;
6279                 esac
6280                 rp='Does your kernel have *secure* setuid scripts?'
6281                 . ./myread
6282                 case "$ans" in
6283                 [yY]*)  val="$define";;
6284                 *)      val="$undef";;
6285                 esac
6286         fi
6287 else
6288         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6289         echo "(That's for file descriptors, not floppy disks.)"
6290         val="$undef"
6291 fi
6292 set d_suidsafe
6293 eval $setvar
6294
6295 $rm -f reflect flect
6296
6297 : now see if they want to do setuid emulation
6298 echo " "
6299 val="$undef"
6300 case "$d_suidsafe" in
6301 "$define")
6302         val="$undef"
6303         echo "No need to emulate SUID scripts since they are secure here." >&4
6304         ;;
6305 *)
6306         $cat <<EOM
6307 Some systems have disabled setuid scripts, especially systems where
6308 setuid scripts cannot be secure.  On systems where setuid scripts have
6309 been disabled, the setuid/setgid bits on scripts are currently
6310 useless.  It is possible for $package to detect those bits and emulate
6311 setuid/setgid in a secure fashion.  This emulation will only work if
6312 setuid scripts have been disabled in your kernel.
6313
6314 EOM
6315         case "$d_dosuid" in
6316         "$define") dflt=y ;;
6317         *) dflt=n ;;
6318         esac
6319         rp="Do you want to do setuid/setgid emulation?"
6320         . ./myread
6321         case "$ans" in
6322         [yY]*)  val="$define";;
6323         *)      val="$undef";;
6324         esac
6325         ;;
6326 esac
6327 set d_dosuid
6328 eval $setvar
6329
6330 : Find perl5.005 or later.
6331 echo "Looking for a previously installed perl5.005 or later... "
6332 case "$perl5" in
6333 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6334                 : Check if this perl is recent and can load a simple module
6335                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6336                         perl5=$tdir/perl
6337                         break;
6338                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6339                         perl5=$tdir/perl5
6340                         break;
6341                 fi
6342         done
6343         ;;
6344 *)      perl5="$perl5"
6345         ;;
6346 esac
6347 case "$perl5" in
6348 '')     echo "None found.  That's ok.";;
6349 *)      echo "Using $perl5." ;;
6350 esac
6351
6352 $cat <<EOM
6353
6354 After $package is installed, you may wish to install various
6355 add-on modules and utilities.  Typically, these add-ons will
6356 be installed under $prefix with the rest
6357 of this package.  However, you may wish to install such add-ons
6358 elsewhere under a different prefix.
6359
6360 If you do not wish to put everything under a single prefix, that's
6361 ok.  You will be prompted for the individual locations; this siteprefix
6362 is only used to suggest the defaults.
6363
6364 The default should be fine for most people.
6365
6366 EOM
6367 fn=d~+
6368 rp='Installation prefix to use for add-on modules and utilities?'
6369 : XXX Here might be another good place for an installstyle setting.
6370 case "$siteprefix" in
6371 '') dflt=$prefix ;;
6372 *)  dflt=$siteprefix ;;
6373 esac
6374 . ./getfile
6375 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6376 oldsiteprefix=''
6377 case "$siteprefix" in
6378 '') ;;
6379 *)      case "$ans" in
6380         "$prefix") ;;
6381         *) oldsiteprefix="$prefix";;
6382         esac
6383         ;;
6384 esac
6385 siteprefix="$ans"
6386 siteprefixexp="$ansexp"
6387
6388 : determine where site specific libraries go.
6389 : Usual default is /usr/local/lib/perl5/site_perl/$version
6390 : The default "style" setting is made in installstyle.U
6391 : XXX No longer works with Prefixit stuff.
6392 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6393 case "$sitelib" in
6394 '') case "$installstyle" in
6395         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6396         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6397         esac
6398         ;;
6399 *)      dflt="$sitelib"
6400         ;;
6401 esac
6402 $cat <<EOM
6403
6404 The installation process will create a directory for
6405 site-specific extensions and modules.  Most users find it convenient
6406 to place all site-specific files in this directory rather than in the
6407 main distribution directory.
6408
6409 EOM
6410 fn=d~+
6411 rp='Pathname for the site-specific library files?'
6412 . ./getfile
6413 prefixvar=sitelib
6414 . ./setprefixvar
6415 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6416
6417 : Determine list of previous versions to include in @INC
6418 $cat > getverlist <<EOPL
6419 #!$perl5 -w
6420 use File::Basename;
6421 \$api_versionstring = "$api_versionstring";
6422 \$version = "$version";
6423 \$stem = "$sitelib_stem";
6424 \$archname = "$archname";
6425 EOPL
6426         $cat >> getverlist <<'EOPL'
6427 # The list found is store twice for each entry: the original name, and
6428 # the binary broken down version as pack "sss", so sorting is easy and
6429 # unambiguous. This will work for all versions that have a maximum of
6430 # three digit groups, separate by '.'s or '_'s. Names are extended with
6431 # ".0.0" to ensure at least three elements for the pack.
6432 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6433
6434 # Can't have leading @ because metaconfig interprets it as a command!
6435 ;@inc_version_list=();
6436 # XXX Redo to do opendir/readdir?
6437 if (-d $stem) {
6438     chdir($stem);
6439     ;@candidates = map {
6440         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6441 }
6442 else {
6443     ;@candidates = ();
6444 }
6445
6446 ($pversion, $aversion, $vsn5005) = map {
6447     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6448 foreach $d (@candidates) {
6449     if ($d->[1] lt $pversion) {
6450         if ($d->[1] ge $aversion) {
6451             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6452         }
6453         elsif ($d->[1] ge $vsn5005) {
6454             unshift(@inc_version_list, grep { -d } $d->[0]);
6455         }
6456     }
6457     else {
6458         # Skip newer version.  I.e. don't look in
6459         # 5.7.0 if we're installing 5.6.1.
6460     }
6461 }
6462
6463 if (@inc_version_list) {
6464     print join(' ', @inc_version_list);
6465 }
6466 else {
6467     # Blank space to preserve value for next Configure run.
6468     print " ";
6469 }
6470 EOPL
6471 chmod +x getverlist
6472 case "$inc_version_list" in
6473 '')     if test -x "$perl5$exe_ext"; then
6474                 dflt=`$perl5 getverlist`
6475         else
6476                 dflt='none'
6477         fi
6478         ;;
6479 $undef) dflt='none' ;;
6480 *)  eval dflt=\"$inc_version_list\" ;;
6481 esac
6482 case "$dflt" in
6483 ''|' ') dflt=none ;;
6484 esac
6485 case "$dflt" in
6486 5.005) dflt=none ;;
6487 esac
6488 $cat <<EOM
6489
6490 In order to ease the process of upgrading, this version of perl
6491 can be configured to use modules built and installed with earlier
6492 versions of perl that were installed under $prefix.  Specify here
6493 the list of earlier versions that this version of perl should check.
6494 If Configure detected no earlier versions of perl installed under
6495 $prefix, then the list will be empty.  Answer 'none' to tell perl
6496 to not search earlier versions.
6497
6498 The default should almost always be sensible, so if you're not sure,
6499 just accept the default.
6500 EOM
6501
6502 rp='List of earlier versions to include in @INC?'
6503 . ./myread
6504 case "$ans" in
6505 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6506 *) inc_version_list="$ans" ;;
6507 esac
6508 case "$inc_version_list" in
6509 ''|' ')
6510         inc_version_list_init='0'
6511         d_inc_version_list="$undef"
6512         ;;
6513 *)      inc_version_list_init=`echo $inc_version_list |
6514                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6515         d_inc_version_list="$define"
6516         ;;
6517 esac
6518 $rm -f getverlist
6519
6520 : see if this is a malloc.h system
6521 : we want a real compile instead of Inhdr because some systems have a
6522 : malloc.h that just gives a compile error saying to use stdlib.h instead
6523 echo " "
6524 $cat >try.c <<EOCP
6525 #include <stdlib.h>
6526 #include <malloc.h>
6527 int main () { return 0; }
6528 EOCP
6529 set try
6530 if eval $compile; then
6531     echo "<malloc.h> found." >&4
6532     val="$define"
6533 else
6534     echo "<malloc.h> NOT found." >&4
6535     val="$undef"
6536 fi
6537 $rm_try
6538 set i_malloc
6539 eval $setvar
6540
6541 : check for void type
6542 echo " "
6543 echo "Checking to see how well your C compiler groks the void type..." >&4
6544 case "$voidflags" in
6545 '')
6546         $cat >try.c <<EOCP
6547 #$i_stdlib I_STDLIB
6548 #ifdef I_STDLIB
6549 #include <stdlib.h>
6550 #endif
6551 #if TRY & 1
6552 void sub() {
6553 #else
6554 sub() {
6555 #endif
6556         extern void moo();      /* function returning void */
6557         void (*goo)();          /* ptr to func returning void */
6558 #if TRY & 8
6559         void *hue;              /* generic ptr */
6560 #endif
6561 #if TRY & 2
6562         void (*foo[10])();
6563 #endif
6564
6565 #if TRY & 4
6566         if(goo == moo) {
6567                 exit(0);
6568         }
6569 #endif
6570         exit(0);
6571 }
6572 int main() { sub(); }
6573 EOCP
6574         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6575                 voidflags=$defvoidused
6576         echo "Good.  It appears to support void to the level $package wants.">&4
6577                 if $contains warning .out >/dev/null 2>&1; then
6578                         echo "However, you might get some warnings that look like this:"
6579                         $cat .out
6580                 fi
6581         else
6582 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6583                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6584                         echo "It supports 1..."
6585                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6586                                 echo "It also supports 2..."
6587                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6588                                         voidflags=7
6589                                         echo "And it supports 4 but not 8 definitely."
6590                                 else
6591                                         echo "It doesn't support 4..."
6592                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6593                                                 voidflags=11
6594                                                 echo "But it supports 8."
6595                                         else
6596                                                 voidflags=3
6597                                                 echo "Neither does it support 8."
6598                                         fi
6599                                 fi
6600                         else
6601                                 echo "It does not support 2..."
6602                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6603                                         voidflags=13
6604                                         echo "But it supports 4 and 8."
6605                                 else
6606                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6607                                                 voidflags=5
6608                                                 echo "And it supports 4 but has not heard about 8."
6609                                         else
6610                                                 echo "However it supports 8 but not 4."
6611                                         fi
6612                                 fi
6613                         fi
6614                 else
6615                         echo "There is no support at all for void."
6616                         voidflags=0
6617                 fi
6618         fi
6619 esac
6620 case "$voidflags" in
6621 "$defvoidused") ;;
6622 *)      $cat >&4 <<'EOM'
6623   Support flag bits are:
6624     1: basic void declarations.
6625     2: arrays of pointers to functions returning void.
6626     4: operations between pointers to and addresses of void functions.
6627     8: generic void pointers.
6628 EOM
6629         dflt="$voidflags";
6630         rp="Your void support flags add up to what?"
6631         . ./myread
6632         voidflags="$ans"
6633         ;;
6634 esac
6635 $rm_try
6636
6637 : check for length of pointer
6638 echo " "
6639 case "$ptrsize" in
6640 '')
6641         echo "Checking to see how big your pointers are..." >&4
6642         if test "$voidflags" -gt 7; then
6643                 echo '#define VOID_PTR char *' > try.c
6644         else
6645                 echo '#define VOID_PTR void *' > try.c
6646         fi
6647         $cat >>try.c <<EOCP
6648 #include <stdio.h>
6649 #$i_stdlib I_STDLIB
6650 #ifdef I_STDLIB
6651 #include <stdlib.h>
6652 #endif
6653 int main()
6654 {
6655     printf("%d\n", (int)sizeof(VOID_PTR));
6656     exit(0);
6657 }
6658 EOCP
6659         set try
6660         if eval $compile_ok; then
6661                 ptrsize=`$run ./try`
6662                 echo "Your pointers are $ptrsize bytes long."
6663         else
6664                 dflt='4'
6665                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6666                 rp="What is the size of a pointer (in bytes)?"
6667                 . ./myread
6668                 ptrsize="$ans"
6669         fi
6670         ;;
6671 esac
6672 $rm_try
6673 case "$use64bitall" in
6674 "$define"|true|[yY]*)
6675         case "$ptrsize" in
6676         4)      cat <<EOM >&4
6677
6678 *** You have chosen a maximally 64-bit build,
6679 *** but your pointers are only 4 bytes wide.
6680 *** Please rerun Configure without -Duse64bitall.
6681 EOM
6682                 case "$d_quad" in
6683                 define)
6684                         cat <<EOM >&4
6685 *** Since you have quads, you could possibly try with -Duse64bitint.
6686 EOM
6687                         ;;
6688                 esac
6689                 cat <<EOM >&4
6690 *** Cannot continue, aborting.
6691
6692 EOM
6693
6694                 exit 1
6695                 ;;
6696         esac
6697         ;;
6698 esac
6699
6700
6701 : determine whether to use malloc wrapping
6702 echo " "
6703 case "$usemallocwrap" in
6704 [yY]*|true|$define)     dflt='y' ;;
6705 [nN]*|false|$undef)     dflt='n' ;;
6706 *)      case "$usedevel" in
6707         [yY]*|true|$define)     dflt='y' ;;
6708         *) dflt='n' ;;
6709         esac
6710         ;;
6711 esac
6712 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6713 . ./myread
6714 usemallocwrap="$ans"
6715 case "$ans" in
6716 y*|true)
6717         usemallocwrap="$define" ;;
6718 *)
6719         usemallocwrap="$undef" ;;
6720 esac
6721
6722 : determine which malloc to compile in
6723 echo " "
6724 case "$usemymalloc" in
6725 [yY]*|true|$define)     dflt='y' ;;
6726 [nN]*|false|$undef)     dflt='n' ;;
6727 *)      case "$ptrsize" in
6728         4) dflt='y' ;;
6729         *) dflt='n' ;;
6730         esac
6731         ;;
6732 esac
6733 rp="Do you wish to attempt to use the malloc that comes with $package?"
6734 . ./myread
6735 usemymalloc="$ans"
6736 case "$ans" in
6737 y*|true)
6738         usemymalloc='y'
6739         mallocsrc='malloc.c'
6740         mallocobj="malloc$_o"
6741         d_mymalloc="$define"
6742         case "$libs" in
6743         *-lmalloc*)
6744                 : Remove malloc from list of libraries to use
6745                 echo "Removing unneeded -lmalloc from library list" >&4
6746                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6747                 shift
6748                 libs="$*"
6749                 echo "libs = $libs" >&4
6750                 ;;
6751         esac
6752         ;;
6753 *)
6754         usemymalloc='n'
6755         mallocsrc=''
6756         mallocobj=''
6757         d_mymalloc="$undef"
6758         ;;
6759 esac
6760
6761 : compute the return types of malloc and free
6762 echo " "
6763 $cat >malloc.c <<END
6764 #$i_malloc I_MALLOC
6765 #$i_stdlib I_STDLIB
6766 #include <stdio.h>
6767 #include <sys/types.h>
6768 #ifdef I_MALLOC
6769 #include <malloc.h>
6770 #endif
6771 #ifdef I_STDLIB
6772 #include <stdlib.h>
6773 #endif
6774 #ifdef TRY_MALLOC
6775 void *malloc();
6776 #endif
6777 #ifdef TRY_FREE
6778 void free();
6779 #endif
6780 END
6781 case "$malloctype" in
6782 '')
6783         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6784                 malloctype='void *'
6785         else
6786                 malloctype='char *'
6787         fi
6788         ;;
6789 esac
6790 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6791
6792 case "$freetype" in
6793 '')
6794         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6795                 freetype='void'
6796         else
6797                 freetype='int'
6798         fi
6799         ;;
6800 esac
6801 echo "Your system uses $freetype free(), it would seem." >&4
6802 $rm -f malloc.[co]
6803 : determine where site specific architecture-dependent libraries go.
6804 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6805 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6806 : sitelib may have an optional trailing /share.
6807 case "$sitearch" in
6808 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6809         dflt="$dflt/$archname"
6810         ;;
6811 *)      dflt="$sitearch"
6812         ;;
6813 esac
6814 set sitearch sitearch none
6815 eval $prefixit
6816 $cat <<EOM
6817
6818 The installation process will also create a directory for
6819 architecture-dependent site-specific extensions and modules.
6820
6821 EOM
6822 fn=d~+
6823 rp='Pathname for the site-specific architecture-dependent library files?'
6824 . ./getfile
6825 prefixvar=sitearch
6826 . ./setprefixvar
6827 if $test X"$sitearch" = X"$sitelib"; then
6828         d_sitearch="$undef"
6829 else
6830         d_sitearch="$define"
6831 fi
6832
6833 $cat <<EOM
6834
6835 The installation process will also create a directory for
6836 vendor-supplied add-ons.  Vendors who supply perl with their system
6837 may find it convenient to place all vendor-supplied files in this
6838 directory rather than in the main distribution directory.  This will
6839 ease upgrades between binary-compatible maintenance versions of perl.
6840
6841 Of course you may also use these directories in whatever way you see
6842 fit.  For example, you might use them to access modules shared over a
6843 company-wide network.
6844
6845 The default answer should be fine for most people.
6846 This causes further questions about vendor add-ons to be skipped
6847 and no vendor-specific directories will be configured for perl.
6848
6849 EOM
6850 rp='Do you want to configure vendor-specific add-on directories?'
6851 case "$usevendorprefix" in
6852 define|true|[yY]*) dflt=y ;;
6853 *)      : User may have set vendorprefix directly on Configure command line.
6854         case "$vendorprefix" in
6855         ''|' ') dflt=n ;;
6856         *)      dflt=y ;;
6857         esac
6858         ;;
6859 esac
6860 . ./myread
6861 case "$ans" in
6862 [yY]*)  fn=d~+
6863         rp='Installation prefix to use for vendor-supplied add-ons?'
6864         case "$vendorprefix" in
6865         '') dflt='' ;;
6866         *)  dflt=$vendorprefix ;;
6867         esac
6868         . ./getfile
6869         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6870         oldvendorprefix=''
6871         case "$vendorprefix" in
6872         '') ;;
6873         *)      case "$ans" in
6874                 "$prefix") ;;
6875                 *) oldvendorprefix="$prefix";;
6876                 esac
6877                 ;;
6878         esac
6879         usevendorprefix="$define"
6880         vendorprefix="$ans"
6881         vendorprefixexp="$ansexp"
6882         ;;
6883 *)      usevendorprefix="$undef"
6884         vendorprefix=''
6885         vendorprefixexp=''
6886         ;;
6887 esac
6888
6889 case "$vendorprefix" in
6890 '')     d_vendorlib="$undef"
6891         vendorlib=''
6892         vendorlibexp=''
6893         ;;
6894 *)      d_vendorlib="$define"
6895         : determine where vendor-supplied modules go.
6896         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6897         case "$vendorlib" in
6898         '')
6899                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6900                 case "$installstyle" in
6901                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6902                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6903                 esac
6904                 ;;
6905         *)      dflt="$vendorlib"
6906                 ;;
6907         esac
6908         fn=d~+
6909         rp='Pathname for the vendor-supplied library files?'
6910         . ./getfile
6911         vendorlib="$ans"
6912         vendorlibexp="$ansexp"
6913         ;;
6914 esac
6915 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6916 prefixvar=vendorlib
6917 . ./installprefix
6918
6919 case "$vendorprefix" in
6920 '')     d_vendorarch="$undef"
6921         vendorarch=''
6922         vendorarchexp=''
6923         ;;
6924 *)      d_vendorarch="$define"
6925         : determine where vendor-supplied architecture-dependent libraries go.
6926         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6927         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6928         : vendorlib may have an optional trailing /share.
6929         case "$vendorarch" in
6930         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6931                 dflt="$dflt/$archname"
6932                 ;;
6933         *)      dflt="$vendorarch" ;;
6934         esac
6935         fn=d~+
6936         rp='Pathname for vendor-supplied architecture-dependent files?'
6937         . ./getfile
6938         vendorarch="$ans"
6939         vendorarchexp="$ansexp"
6940         ;;
6941 esac
6942 prefixvar=vendorarch
6943 . ./installprefix
6944
6945 : Final catch-all directories to search
6946 $cat <<EOM
6947
6948 Lastly, you can have perl look in other directories for extensions and
6949 modules in addition to those already specified.
6950 These directories will be searched after 
6951         $sitearch 
6952         $sitelib 
6953 EOM
6954 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6955 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6956 echo ' '
6957 case "$otherlibdirs" in
6958 ''|' ') dflt='none' ;;
6959 *)      dflt="$otherlibdirs" ;;
6960 esac
6961 $cat <<EOM
6962 Enter a colon-separated set of extra paths to include in perl's @INC
6963 search path, or enter 'none' for no extra paths.
6964
6965 EOM
6966
6967 rp='Colon-separated list of additional directories for perl to search?'
6968 . ./myread
6969 case "$ans" in
6970 ' '|''|none)    otherlibdirs=' ' ;;     
6971 *)      otherlibdirs="$ans" ;;
6972 esac
6973 case "$otherlibdirs" in
6974 ' ') val=$undef ;;
6975 *)      val=$define ;;
6976 esac
6977 set d_perl_otherlibdirs
6978 eval $setvar
6979
6980 : Cruising for prototypes
6981 echo " "
6982 echo "Checking out function prototypes..." >&4
6983 $cat >prototype.c <<EOCP
6984 #$i_stdlib I_STDLIB
6985 #ifdef I_STDLIB
6986 #include <stdlib.h>
6987 #endif
6988 int main(int argc, char *argv[]) {
6989         exit(0);}
6990 EOCP
6991 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6992         echo "Your C compiler appears to support function prototypes."
6993         val="$define"
6994 else
6995         echo "Your C compiler doesn't seem to understand function prototypes."
6996         val="$undef"
6997 fi
6998 set prototype
6999 eval $setvar
7000 $rm -f prototype*
7001
7002 case "$prototype" in
7003 "$define") ;;
7004 *)      ansi2knr='ansi2knr'
7005         echo " "
7006         cat <<EOM >&4
7007
7008 $me:  FATAL ERROR:
7009 This version of $package can only be compiled by a compiler that 
7010 understands function prototypes.  Unfortunately, your C compiler 
7011         $cc $ccflags
7012 doesn't seem to understand them.  Sorry about that.
7013
7014 If GNU cc is available for your system, perhaps you could try that instead.  
7015
7016 Eventually, we hope to support building Perl with pre-ANSI compilers.
7017 If you would like to help in that effort, please contact <perlbug@perl.org>.
7018
7019 Aborting Configure now.
7020 EOM
7021         exit 2
7022         ;;
7023 esac
7024
7025 echo " "
7026 case "$extras" in
7027 '') dflt='n';;
7028 *) dflt='y';;
7029 esac
7030 cat <<EOM
7031 Perl can be built with extra modules or bundles of modules which
7032 will be fetched from the CPAN and installed alongside Perl.
7033
7034 Notice that you will need access to the CPAN; either via the Internet,
7035 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7036 be asked later to configure the CPAN.pm module which will in turn do
7037 the installation of the rest of the extra modules or bundles.)
7038
7039 Notice also that if the modules require any external software such as
7040 libraries and headers (the libz library and the zlib.h header for the
7041 Compress::Zlib module, for example) you MUST have any such software
7042 already installed, this configuration process will NOT install such
7043 things for you.
7044
7045 If this doesn't make any sense to you, just accept the default '$dflt'.
7046 EOM
7047 rp='Install any extra modules (y or n)?'
7048 . ./myread
7049 case "$ans" in
7050 y|Y)
7051         cat <<EOM
7052
7053 Please list any extra modules or bundles to be installed from CPAN,
7054 with spaces between the names.  The names can be in any format the
7055 'install' command of CPAN.pm will understand.  (Answer 'none',
7056 without the quotes, to install no extra modules or bundles.)
7057 EOM
7058         rp='Extras?'
7059         dflt="$extras"
7060         . ./myread
7061         extras="$ans"
7062 esac
7063 case "$extras" in
7064 ''|'none')
7065         val=''
7066         $rm -f ../extras.lst
7067         ;;
7068 *)      echo "(Saving the list of extras for later...)"
7069         echo "$extras" > ../extras.lst
7070         val="'$extras'"
7071         ;;
7072 esac
7073 set extras
7074 eval $setvar
7075 echo " "
7076
7077 : determine where html pages for programs go
7078 set html1dir html1dir none
7079 eval $prefixit
7080 $cat <<EOM
7081
7082 If you wish to install html files for programs in $spackage, indicate
7083 the appropriate directory here.  To skip installing html files,
7084 answer "none".
7085 EOM
7086 case "$html1dir" in
7087 ''|none|$undef|' ') dflt=none ;;
7088 *) dflt=$html1dir ;;
7089 esac
7090 fn=dn+~
7091 rp="Directory for the main $spackage html pages?"
7092 . ./getfile
7093 prefixvar=html1dir
7094 . ./setprefixvar
7095 : Use ' ' for none so value is preserved next time through Configure
7096 $test X"$html1dir" = "X" && html1dir=' '
7097
7098 : determine where html pages for libraries and modules go
7099 set html3dir html3dir none
7100 eval $prefixit
7101 $cat <<EOM
7102
7103 If you wish to install html files for modules associated with $spackage,
7104 indicate the appropriate directory here.  To skip installing html files,
7105 answer "none".
7106 EOM
7107 : There is no obvious default.  If they have specified html1dir, then
7108 : try to key off that, possibly changing .../html1 into .../html3.
7109 case "$html3dir" in
7110 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7111 *) dflt=$html3dir ;;
7112 esac
7113 fn=dn+~
7114 rp="Directory for the $spackage module html pages?"
7115 . ./getfile
7116 prefixvar=html3dir
7117 . ./setprefixvar
7118 : Use ' ' for none so value is preserved next time through Configure
7119 $test X"$html3dir" = "X" && html3dir=' '
7120
7121 : determine whether to install perl also as /usr/bin/perl
7122
7123 echo " "
7124 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7125         $cat <<EOM
7126 Many scripts expect perl to be installed as /usr/bin/perl.
7127
7128 If you want to, I can install the perl you are about to compile
7129 as /usr/bin/perl (in addition to $bin/perl).
7130 EOM
7131         if test -f /usr/bin/perl; then
7132             $cat <<EOM
7133
7134 However, please note that because you already have a /usr/bin/perl,
7135 overwriting that with a new Perl would very probably cause problems.
7136 Therefore I'm assuming you don't want to do that (unless you insist).
7137
7138 EOM
7139             case "$installusrbinperl" in
7140             "$define"|[yY]*)    dflt='y';;
7141             *)                  dflt='n';;
7142             esac
7143         else
7144             $cat <<EOM
7145
7146 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7147
7148 EOM
7149             case "$installusrbinperl" in
7150             "$undef"|[nN]*)     dflt='n';;
7151             *)                  dflt='y';;
7152             esac
7153         fi
7154         rp="Do you want to install perl as /usr/bin/perl?"
7155         . ./myread
7156         case "$ans" in
7157         [yY]*)  val="$define";;
7158         *)      val="$undef" ;;
7159         esac
7160 else
7161         val="$undef"
7162 fi
7163 set installusrbinperl
7164 eval $setvar
7165
7166 echo " "
7167 echo "Checking for GNU C Library..." >&4
7168 cat >try.c <<'EOCP'
7169 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7170    alone are insufficient to distinguish different versions, such as
7171    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7172    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7173 */
7174 #include <stdio.h>
7175 int main(void)
7176 {
7177 #ifdef __GLIBC__
7178 #   ifdef __GLIBC_MINOR__
7179 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7180 #           include <gnu/libc-version.h>
7181             printf("%s\n",  gnu_get_libc_version());
7182 #       else
7183             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7184 #       endif
7185 #   else
7186         printf("%d\n",  __GLIBC__);
7187 #   endif
7188     return 0;
7189 #else
7190     return 1;
7191 #endif
7192 }
7193 EOCP
7194 set try
7195 if eval $compile_ok && $run ./try > glibc.ver; then
7196         val="$define"
7197         gnulibc_version=`$cat glibc.ver`
7198         echo "You are using the GNU C Library version $gnulibc_version"
7199 else
7200         val="$undef"
7201         gnulibc_version=''
7202         echo "You are not using the GNU C Library"
7203 fi
7204 $rm_try glibc.ver
7205 set d_gnulibc
7206 eval $setvar
7207
7208 : see if nm is to be used to determine whether a symbol is defined or not
7209 case "$usenm" in
7210 '')
7211         dflt=''
7212         case "$d_gnulibc" in
7213         "$define")
7214                 echo " "
7215                 echo "nm probably won't work on the GNU C Library." >&4
7216                 dflt=n
7217                 ;;
7218         esac
7219         case "$dflt" in
7220         '') 
7221                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7222                         echo " "
7223                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7224                         echo "'nm' won't be sufficient on this sytem." >&4
7225                         dflt=n
7226                 fi
7227                 ;;
7228         esac
7229         case "$dflt" in
7230         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7231                 if $test $dflt -gt 20; then
7232                         dflt=y
7233                 else
7234                         dflt=n
7235                 fi
7236                 ;;
7237         esac
7238         ;;
7239 *)
7240         case "$usenm" in
7241         true|$define) dflt=y;;
7242         *) dflt=n;;
7243         esac
7244         ;;
7245 esac
7246 $cat <<EOM
7247
7248 I can use $nm to extract the symbols from your C libraries. This
7249 is a time consuming task which may generate huge output on the disk (up
7250 to 3 megabytes) but that should make the symbols extraction faster. The
7251 alternative is to skip the 'nm' extraction part and to compile a small
7252 test program instead to determine whether each symbol is present. If
7253 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7254 this may be the best solution.
7255
7256 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7257
7258 EOM
7259 rp="Shall I use $nm to extract C symbols from the libraries?"
7260 . ./myread
7261 case "$ans" in
7262 [Nn]*) usenm=false;;
7263 *) usenm=true;;
7264 esac
7265
7266 runnm=$usenm
7267 case "$reuseval" in
7268 true) runnm=false;;
7269 esac
7270
7271 : nm options which may be necessary
7272 case "$nm_opt" in
7273 '') if $test -f /mach_boot; then
7274                 nm_opt=''       # Mach
7275         elif $test -d /usr/ccs/lib; then
7276                 nm_opt='-p'     # Solaris (and SunOS?)
7277         elif $test -f /dgux; then
7278                 nm_opt='-p'     # DG-UX
7279         elif $test -f /lib64/rld; then
7280                 nm_opt='-p'     # 64-bit Irix
7281         else
7282                 nm_opt=''
7283         fi;;
7284 esac
7285
7286 : nm options which may be necessary for shared libraries but illegal
7287 : for archive libraries.  Thank you, Linux.
7288 case "$nm_so_opt" in
7289 '')     case "$myuname" in
7290         *linux*|gnu*)
7291                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7292                         nm_so_opt='--dynamic'
7293                 fi
7294                 ;;
7295         esac
7296         ;;
7297 esac
7298
7299 case "$runnm" in
7300 true)
7301 : get list of predefined functions in a handy place
7302 echo " "
7303 case "$libc" in
7304 '') libc=unknown
7305         case "$libs" in
7306         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7307         esac
7308         ;;
7309 esac
7310 case "$libs" in
7311 '') ;;
7312 *)  for thislib in $libs; do
7313         case "$thislib" in
7314         -lc|-lc_s)
7315                 : Handle C library specially below.
7316                 ;;
7317         -l*)
7318                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7319                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7320                         :
7321                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7322                         :
7323                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7324                         :
7325                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7326                         :
7327                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7328                         :
7329                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7330                         :
7331                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7332                         :
7333                 else
7334                         try=''
7335                 fi
7336                 libnames="$libnames $try"
7337                 ;;
7338         *) libnames="$libnames $thislib" ;;
7339         esac
7340         done
7341         ;;
7342 esac
7343 xxx=normal
7344 case "$libc" in
7345 unknown)
7346         set /lib/libc.$so
7347         for xxx in $libpth; do
7348                 $test -r $1 || set $xxx/libc.$so
7349                 : The messy sed command sorts on library version numbers.
7350                 $test -r $1 || \
7351                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7352                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7353                                 h
7354                                 s/[0-9][0-9]*/0000&/g
7355                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7356                                 G
7357                                 s/\n/ /' | \
7358                          $sort | $sed -e 's/^.* //'`
7359                 eval set \$$#
7360         done
7361         $test -r $1 || set /usr/ccs/lib/libc.$so
7362         $test -r $1 || set /lib/libsys_s$_a
7363         ;;
7364 *)
7365         set blurfl
7366         ;;
7367 esac
7368 if $test -r "$1"; then
7369         echo "Your (shared) C library seems to be in $1."
7370         libc="$1"
7371 elif $test -r /lib/libc && $test -r /lib/clib; then
7372         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7373         xxx=apollo
7374         libc='/lib/clib /lib/libc'
7375         if $test -r /lib/syslib; then
7376                 echo "(Your math library is in /lib/syslib.)"
7377                 libc="$libc /lib/syslib"
7378         fi
7379 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7380         echo "Your C library seems to be in $libc, as you said before."
7381 elif $test -r $incpath/usr/lib/libc$_a; then
7382         libc=$incpath/usr/lib/libc$_a;
7383         echo "Your C library seems to be in $libc.  That's fine."
7384 elif $test -r /lib/libc$_a; then
7385         libc=/lib/libc$_a;
7386         echo "Your C library seems to be in $libc.  You're normal."
7387 else
7388         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7389                 :
7390         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7391                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7392         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7393                 :
7394         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7395                 :
7396         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7397                 :
7398         else
7399                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7400         fi
7401         if $test -r "$tans"; then
7402                 echo "Your C library seems to be in $tans, of all places."
7403                 libc=$tans
7404         else
7405                 libc='blurfl'
7406         fi
7407 fi
7408 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7409         dflt="$libc"
7410         cat <<EOM
7411
7412 If the guess above is wrong (which it might be if you're using a strange
7413 compiler, or your machine supports multiple models), you can override it here.
7414
7415 EOM
7416 else
7417         dflt=''
7418         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7419         cat >&4 <<EOM
7420 I can't seem to find your C library.  I've looked in the following places:
7421
7422 EOM
7423         $sed 's/^/      /' libpath
7424         cat <<EOM
7425
7426 None of these seems to contain your C library. I need to get its name...
7427
7428 EOM
7429 fi
7430 fn=f
7431 rp='Where is your C library?'
7432 . ./getfile
7433 libc="$ans"
7434
7435 echo " "
7436 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7437 set X `cat libnames`
7438 shift
7439 xxx=files
7440 case $# in 1) xxx=file; esac
7441 echo "Extracting names from the following $xxx for later perusal:" >&4
7442 echo " "
7443 $sed 's/^/      /' libnames >&4
7444 echo " "
7445 $echo $n "This may take a while...$c" >&4
7446
7447 for file in $*; do
7448         case $file in
7449         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7450         *) $nm $nm_opt $file 2>/dev/null;;
7451         esac
7452 done >libc.tmp
7453
7454 $echo $n ".$c"
7455 $grep fprintf libc.tmp > libc.ptf
7456 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7457 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7458 xxx='[ADTSIW]'
7459 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7460         eval $xscan;\
7461         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7462                 eval $xrun
7463 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7464         eval $xscan;\
7465         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7466                 eval $xrun
7467 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7468         eval $xscan;\
7469         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7470                 eval $xrun
7471 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7472         eval $xscan;\
7473         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7474                 eval $xrun
7475 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7476         eval $xscan;\
7477         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7478                 eval $xrun
7479 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7480         eval $xscan;\
7481         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7482                 eval $xrun
7483 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7484                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7485         eval $xscan;\
7486         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7487                 eval $xrun
7488 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7489         eval $xscan;\
7490         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7491                 eval $xrun
7492 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7493         eval $xscan;\
7494         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7495                 eval $xrun
7496 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7497         eval $xscan;\
7498         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7499                 eval $xrun
7500 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7501         eval $xscan;\
7502         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7503                 eval $xrun
7504 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7505         eval $xscan;\
7506         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7507                 eval $xrun
7508 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7509         eval $xscan;\
7510         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7511                 eval $xrun
7512 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7513         eval $xscan;\
7514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7515                 eval $xrun
7516 else
7517         $nm -p $* 2>/dev/null >libc.tmp
7518         $grep fprintf libc.tmp > libc.ptf
7519         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7520                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7521         then
7522                 nm_opt='-p'
7523                 eval $xrun
7524         else
7525                 echo " "
7526                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7527                 com=''
7528                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7529                         for thisname in $libnames $libc; do
7530                                 $ar t $thisname >>libc.tmp
7531                         done
7532                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7533                         echo "Ok." >&4
7534                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7535                         # Repeat libc to extract forwarders to DLL entries too
7536                         for thisname in $libnames $libc; do
7537                                 $ar tv $thisname >>libc.tmp
7538                                 # Revision 50 of EMX has bug in $ar.
7539                                 # it will not extract forwarders to DLL entries
7540                                 # Use emximp which will extract exactly them.
7541                                 emximp -o tmp.imp $thisname \
7542                                     2>/dev/null && \
7543                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7544                                     < tmp.imp >>libc.tmp
7545                                 $rm tmp.imp
7546                         done
7547                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7548                         echo "Ok." >&4
7549                 else
7550                         echo "$ar didn't seem to work right." >&4
7551                         echo "Maybe this is a Cray...trying bld instead..." >&4
7552                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7553                         then
7554                                 for thisname in $libnames; do
7555                                         bld t $libnames | \
7556                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7557                                         $ar t $thisname >>libc.tmp
7558                                 done
7559                                 echo "Ok." >&4
7560                         else
7561                                 echo "That didn't work either.  Giving up." >&4
7562                                 exit 1
7563                         fi
7564                 fi
7565         fi
7566 fi
7567 nm_extract="$com"
7568 case "$PASE" in
7569 define)
7570     echo " "
7571     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7572     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7573     ;;
7574 *)  if $test -f /lib/syscalls.exp; then
7575         echo " "
7576         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7577         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7578     fi
7579     ;;
7580 esac
7581 ;;
7582 esac
7583 $rm -f libnames libpath
7584
7585 : see if dld is available
7586 set dld.h i_dld
7587 eval $inhdr
7588
7589
7590 echo " "
7591 echo "Checking for C++..." >&4
7592 $cat >try.c <<'EOCP'
7593 #include <stdio.h>
7594 int main(void)
7595 {
7596 #ifdef __cplusplus
7597     return 0;
7598 #else
7599     return 1;
7600 #endif
7601 }
7602 EOCP
7603 set try
7604 if eval $compile_ok && $run ./try; then
7605         val="$define"
7606         echo "You are using a C++ compiler."
7607 else
7608         val="$undef"
7609         echo "You are not using a C++ compiler."
7610 fi
7611 $rm_try cplusplus$$
7612 set d_cplusplus
7613 eval $setvar
7614
7615 : is a C symbol defined?
7616 csym='tlook=$1;
7617 case "$3" in
7618 -v) tf=libc.tmp; tdc="";;
7619 -a) tf=libc.tmp; tdc="[]";;
7620 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7621 esac;
7622 tx=yes;
7623 case "$reuseval-$4" in
7624 true-) ;;
7625 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7626 esac;
7627 case "$tx" in
7628 yes)
7629         tval=false;
7630         case "$d_cplusplus" in
7631                 $define) extern_C=\"C\";;
7632         esac;
7633         if $test "$runnm" = true; then
7634                 if $contains $tlook $tf >/dev/null 2>&1; then
7635                         tval=true;
7636                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7637                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7638                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7639                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7640                         $rm_try;
7641                 fi;
7642         else
7643                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7644                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7645                 $rm_try;
7646         fi;
7647         ;;
7648 *)
7649         case "$tval" in
7650         $define) tval=true;;
7651         *) tval=false;;
7652         esac;
7653         ;;
7654 esac;
7655 eval "$2=$tval"'
7656
7657 : define an is-in-libc? function
7658 inlibc='echo " "; td=$define; tu=$undef;
7659 sym=$1; var=$2; eval "was=\$$2";
7660 tx=yes;
7661 case "$reuseval$was" in
7662 true) ;;
7663 true*) tx=no;;
7664 esac;
7665 case "$tx" in
7666 yes)
7667         set $sym tres -f;
7668         eval $csym;
7669         case "$tres" in
7670         true)
7671                 echo "$sym() found." >&4;
7672                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7673         *)
7674                 echo "$sym() NOT found." >&4;
7675                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7676         esac;;
7677 *)
7678         case "$was" in
7679         $define) echo "$sym() found." >&4;;
7680         *) echo "$sym() NOT found." >&4;;
7681         esac;;
7682 esac'
7683
7684 : see if dlopen exists
7685 xxx_runnm="$runnm"
7686 xxx_ccflags="$ccflags"
7687 runnm=false
7688 : with g++ one needs -shared to get is-in-libc to work for dlopen
7689 case "$gccversion" in
7690 '')     ;;
7691 *)      case "$d_cplusplus" in
7692         "$define") ccflags="$ccflags -shared" ;;
7693         esac
7694         ;;
7695 esac
7696 set dlopen d_dlopen
7697 eval $inlibc
7698 runnm="$xxx_runnm"
7699 ccflags="$xxx_ccflags"
7700
7701 : see if this is a unistd.h system
7702 set unistd.h i_unistd
7703 eval $inhdr
7704
7705 : determine which dynamic loading, if any, to compile in
7706 echo " "
7707 dldir="ext/DynaLoader"
7708 case "$usedl" in
7709 $define|y|true)
7710         dflt='y'
7711         usedl="$define"
7712         ;;
7713 $undef|n|false)
7714         dflt='n'
7715         usedl="$undef"
7716         ;;
7717 *)
7718         dflt='n'
7719         case "$d_dlopen" in
7720             $define) dflt='y' ;;
7721         esac
7722         case "$i_dld" in
7723             $define) dflt='y' ;;
7724         esac
7725         : Does a dl_xxx.xs file exist for this operating system
7726         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7727         ;;
7728 esac
7729 rp="Do you wish to use dynamic loading?"
7730 . ./myread
7731 usedl="$ans"
7732 case "$ans" in
7733 y*) usedl="$define"
7734         case "$dlsrc" in
7735         '')
7736                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7737                         dflt="$dldir/dl_${osname}.xs"
7738                 elif $test "$d_dlopen" = "$define" ; then
7739                         dflt="$dldir/dl_dlopen.xs"
7740                 elif $test "$i_dld" = "$define" ; then
7741                         dflt="$dldir/dl_dld.xs"
7742                 else
7743                         dflt=''
7744                 fi
7745                 ;;
7746         *)      dflt="$dldir/$dlsrc"
7747                 ;;
7748         esac
7749     echo "The following dynamic loading files are available:"
7750         : Can not go over to $dldir because getfile has path hard-coded in.
7751         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7752         rp="Source file to use for dynamic loading"
7753         fn="fne"
7754         gfpth="$src"
7755         . ./getfile
7756         usedl="$define"
7757         : emulate basename
7758         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7759
7760         $cat << EOM
7761
7762 Some systems may require passing special flags to $cc -c to
7763 compile modules that will be used to create a shared library.
7764 To use no flags, say "none".
7765
7766 EOM
7767     case "$cccdlflags" in
7768     '') case "$gccversion" in
7769                 '') case "$osname" in
7770                         hpux)   dflt='+z' ;;
7771                         next)   dflt='none' ;;
7772                         irix*)  dflt='-KPIC' ;;
7773                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7774                         sunos)  dflt='-pic' ;;
7775                         *)      dflt='none' ;;
7776                     esac
7777                         ;;
7778                 *)  case "$osname" in
7779                         darwin) dflt='none' ;;
7780                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7781                         *)      dflt='-fpic' ;;
7782                     esac ;;
7783             esac ;;
7784         ' ') dflt='none' ;;
7785     *)  dflt="$cccdlflags" ;;
7786     esac
7787     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7788     . ./myread
7789     case "$ans" in
7790     none) cccdlflags=' ' ;;
7791     *) cccdlflags="$ans" ;;
7792     esac
7793
7794     cat << EOM
7795
7796 Some systems use ld to create libraries that can be dynamically loaded,
7797 while other systems (such as those using ELF) use $cc.
7798
7799 EOM
7800         case "$ld" in
7801         '')     $cat >try.c <<EOM
7802 /* Test for whether ELF binaries are produced */
7803 #include <fcntl.h>
7804 #$i_stdlib I_STDLIB
7805 #ifdef I_STDLIB
7806 #include <stdlib.h>
7807 #endif
7808 #$i_unistd I_UNISTD
7809 #ifdef I_UNISTD
7810 #include <unistd.h>
7811 #endif
7812 int main() {
7813         char b[4];
7814         int i = open("a.out",O_RDONLY);
7815         if(i == -1)
7816                 exit(1); /* fail */
7817         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7818                 exit(0); /* succeed (yes, it's ELF) */
7819         else
7820                 exit(1); /* fail */
7821 }
7822 EOM
7823                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7824                         cat <<EOM
7825 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7826 EOM
7827                         dflt="$cc"
7828                 else
7829                         echo "I'll use ld to build dynamic libraries."
7830                         dflt='ld'
7831                 fi
7832                 $rm_try
7833                 ;;
7834         *)      dflt="$ld"
7835                 ;;
7836         esac
7837
7838     rp="What command should be used to create dynamic libraries?"
7839     . ./myread
7840         ld="$ans"
7841
7842     cat << EOM
7843
7844 Some systems may require passing special flags to $ld to create a
7845 library that can be dynamically loaded.  If your ld flags include
7846 -L/other/path options to locate libraries outside your loader's normal
7847 search path, you may need to specify those -L options here as well.  To
7848 use no flags, say "none".
7849
7850 EOM
7851     case "$lddlflags" in
7852     '') case "$osname" in
7853                         beos) dflt='-nostart' ;;
7854                         hpux) dflt='-b';
7855                               case "$gccversion" in
7856                               '') dflt="$dflt +vnocompatwarnings" ;;
7857                               esac
7858                               ;;
7859                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7860                         next)  dflt='none' ;;
7861                         solaris) dflt='-G' ;;
7862                         sunos) dflt='-assert nodefinitions' ;;
7863                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7864                 *)     dflt='none' ;;
7865                         esac
7866                         ;;
7867     *) dflt="$lddlflags" ;;
7868     esac
7869
7870         : Try to guess additional flags to pick up local libraries.
7871         : Be careful not to append to a plain 'none'
7872         case "$dflt" in
7873         none) dflt='' ;;
7874         esac
7875         for thisflag in $ldflags; do
7876                 case "$thisflag" in
7877                 -L*|-R*|-Wl,-R*)
7878                         case " $dflt " in
7879                         *" $thisflag "*) ;;
7880                         *) dflt="$dflt $thisflag" ;;
7881                         esac
7882                         ;;
7883                 esac
7884         done
7885
7886         case "$dflt" in
7887         ''|' ') dflt='none' ;;
7888         esac
7889
7890     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7891     . ./myread
7892     case "$ans" in
7893     none) lddlflags=' ' ;;
7894     *) lddlflags="$ans" ;;
7895     esac
7896
7897         cat <<EOM
7898
7899 Some systems may require passing special flags to $cc to indicate that
7900 the resulting executable will use dynamic linking.  To use no flags,
7901 say "none".
7902
7903 EOM
7904     case "$ccdlflags" in
7905     '') case "$osname" in
7906             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7907             next|sunos) dflt='none' ;;
7908             *)          dflt='none' ;;
7909             esac ;;
7910     ' ')  dflt='none' ;;
7911     *)  dflt="$ccdlflags" ;;
7912     esac
7913     rp="Any special flags to pass to $cc to use dynamic linking?"
7914     . ./myread
7915     case "$ans" in
7916     none) ccdlflags=' ' ;;
7917     *) ccdlflags="$ans" ;;
7918     esac
7919     ;;
7920 *)  usedl="$undef"
7921         ld='ld'
7922     dlsrc='dl_none.xs'
7923     lddlflags=''
7924     ccdlflags=''
7925     ;;
7926 esac
7927
7928 also=''
7929 case "$usedl" in
7930 $undef)
7931         # No dynamic loading being used, so don't bother even to prompt.
7932         useshrplib='false'
7933         ;;
7934 *)      case "$useshrplib" in
7935         '')     case "$osname" in
7936                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7937                         dflt=y
7938                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7939                         ;;
7940                 next*)
7941                         case "$osvers" in
7942                         4*)     dflt=y
7943                                 also='Building a shared libperl is needed for MAB support.'
7944                                 ;;
7945                         *)      dflt=n
7946                                 ;;
7947                         esac
7948                         ;;
7949                 *)      dflt=n
7950                         ;;
7951                 esac
7952                 ;;
7953         $define|true|[Yy]*)
7954                 dflt=y
7955                 ;;
7956         *)      dflt=n
7957                 ;;
7958         esac
7959         $cat << EOM
7960
7961 The perl executable is normally obtained by linking perlmain.c with
7962 libperl${_a}, any static extensions (usually just DynaLoader), and
7963 any other libraries needed on this system (such as -lm, etc.).  Since
7964 your system supports dynamic loading, it is probably possible to build
7965 a shared libperl.$so.  If you will have more than one executable linked
7966 to libperl.$so, this will significantly reduce the size of each
7967 executable, but it may have a noticeable effect on performance.  The
7968 default is probably sensible for your system.
7969 $also
7970
7971 EOM
7972         rp="Build a shared libperl.$so (y/n)"
7973         . ./myread
7974         case "$ans" in
7975         true|$define|[Yy]*)
7976                 useshrplib='true'  ;;
7977         *)      useshrplib='false' ;;
7978         esac
7979         ;;
7980 esac
7981
7982 case "$useshrplib" in
7983 true)
7984         case "$libperl" in
7985         '')
7986                 # Figure out a good name for libperl.so.  Since it gets stored in
7987                 # a version-specific architecture-dependent library, the version
7988                 # number isn't really that important, except for making cc/ld happy.
7989                 #
7990                 # A name such as libperl.so.3.1
7991                 majmin="libperl.$so.$patchlevel.$subversion"
7992                 # A name such as libperl.so.301
7993                 majonly=`echo $patchlevel $subversion |
7994                         $awk '{printf "%d%02d", $1, $2}'`
7995                 majonly=libperl.$so.$majonly
7996                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7997                 # rely on figuring it out from the naming of libc.
7998                 case "${osname}${osvers}" in
7999                 next4*)
8000                         dflt=libperl.5.$so
8001                         # XXX How handle the --version stuff for MAB?
8002                         ;;
8003                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8004                         dflt=libperl.$so
8005                         ;;
8006                 cygwin*) # ld links against an importlib
8007                         dflt=libperl$lib_ext
8008                         ;;
8009                 *)      # Try to guess based on whether libc has major.minor.
8010                         case "$libc" in
8011                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8012                         *libc.$so.[0-9]*) dflt=$majonly ;;
8013                         *)      dflt=libperl.$so ;;
8014                         esac
8015                         ;;
8016                 esac
8017                 ;;
8018         *)      dflt=$libperl
8019                 ;;
8020         esac
8021         cat << EOM
8022
8023 I need to select a good name for the shared libperl.  If your system uses
8024 library names with major and minor numbers, then you might want something
8025 like $majmin.  Alternatively, if your system uses a single version
8026 number for shared libraries, then you might want to use $majonly.
8027 Or, your system might be quite happy with a simple libperl.$so.
8028
8029 Since the shared libperl will get installed into a version-specific
8030 architecture-dependent directory, the version number of the shared perl
8031 library probably isn't important, so the default should be o.k.
8032
8033 EOM
8034         rp='What name do you want to give to the shared libperl?'
8035         . ./myread
8036         libperl=$ans
8037         echo "Ok, I'll use $libperl"
8038         ;;
8039 *)
8040         libperl="libperl${_a}"
8041         ;;
8042 esac
8043
8044 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8045 case "$shrpdir" in
8046 '') ;;
8047 *)      $cat >&4 <<EOM
8048 WARNING:  Use of the shrpdir variable for the installation location of
8049 the shared $libperl is not supported.  It was never documented and
8050 will not work in this version.  Let me (perlbug@perl.org)
8051 know of any problems this may cause.
8052
8053 EOM
8054         case "$shrpdir" in
8055         "$archlibexp/CORE")
8056                 $cat >&4 <<EOM
8057 But your current setting of $shrpdir is
8058 the default anyway, so it's harmless.
8059 EOM
8060                 ;;
8061         *)
8062                 $cat >&4 <<EOM
8063 Further, your current attempted setting of $shrpdir
8064 conflicts with the value of $archlibexp/CORE
8065 that installperl will use.
8066 EOM
8067                 ;;
8068         esac
8069         ;;
8070 esac
8071
8072 # How will the perl executable find the installed shared $libperl?
8073 # Add $xxx to ccdlflags.
8074 # If we can't figure out a command-line option, use $shrpenv to
8075 # set env LD_RUN_PATH.  The main perl makefile uses this.
8076 shrpdir=$archlibexp/CORE
8077 xxx=''
8078 tmp_shrpenv=''
8079 if "$useshrplib"; then
8080     case "$osname" in 
8081         aix)
8082                 # We'll set it in Makefile.SH...
8083                 ;;
8084         solaris)
8085                 xxx="-R $shrpdir"
8086                 ;;
8087         freebsd|netbsd|openbsd|interix|dragonfly)
8088                 xxx="-Wl,-R$shrpdir"
8089                 ;;
8090         bsdos|linux|irix*|dec_osf|gnu*)
8091                 xxx="-Wl,-rpath,$shrpdir"
8092                 ;;
8093         next)
8094                 # next doesn't like the default...
8095                 ;;
8096         beos)
8097                 # beos doesn't like the default, either.
8098                 ;;
8099         hpux*)
8100                 # hpux doesn't like the default, either.
8101                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8102                 ;;
8103         *)
8104                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8105                 ;;
8106         esac
8107         case "$xxx" in
8108         '') ;;
8109         *)      
8110                 # Only add $xxx if it isn't already in ccdlflags.
8111                 case " $ccdlflags " in
8112                 *" $xxx "*)     ;;
8113                 *)      ccdlflags="$ccdlflags $xxx"
8114                         cat <<EOM >&4
8115
8116 Adding $xxx to the flags
8117 passed to $ld so that the perl executable will find the 
8118 installed shared $libperl.
8119
8120 EOM
8121                         ;;
8122                 esac
8123                 ;;
8124         esac
8125 fi
8126 # Fix ccdlflags in AIX for building external extensions.
8127 # (For building Perl itself bare -bE:perl.exp is needed,
8128 #  Makefile.SH takes care of this.)
8129 case "$osname" in
8130 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8131 esac
8132 # Respect a hint or command-line value.
8133 case "$shrpenv" in
8134 '') shrpenv="$tmp_shrpenv" ;;
8135 esac
8136 case "$ldlibpthname" in
8137 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8138 none)   ldlibpthname='' ;;
8139 esac
8140
8141 : determine where manual pages are on this system
8142 echo " "
8143 case "$sysman" in
8144 '') 
8145         syspath='/usr/share/man/man1 /usr/man/man1'
8146         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8147         syspath="$syspath /usr/man/u_man/man1"
8148         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8149         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8150         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8151         sysman=`./loc . /usr/man/man1 $syspath`
8152         ;;
8153 esac
8154 if $test -d "$sysman"; then
8155         echo "System manual is in $sysman." >&4
8156 else
8157         echo "Could not find manual pages in source form." >&4
8158 fi
8159
8160 : determine where manual pages go
8161 set man1dir man1dir none
8162 eval $prefixit
8163 $cat <<EOM
8164
8165 $spackage has manual pages available in source form.
8166 EOM
8167 case "$nroff" in
8168 nroff)
8169         echo "However, you don't have nroff, so they're probably useless to you."
8170         case "$man1dir" in
8171         '') man1dir="none";;
8172         esac;;
8173 esac
8174 echo "If you don't want the manual sources installed, answer 'none'."
8175 case "$man1dir" in
8176 ' ') dflt=none
8177         ;;
8178 '')
8179         lookpath="$prefixexp/share/man/man1"
8180         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8181         lookpath="$lookpath $prefixexp/man/p_man/man1"
8182         lookpath="$lookpath $prefixexp/man/u_man/man1"
8183         lookpath="$lookpath $prefixexp/man/man.1"
8184         case "$sysman" in
8185         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8186         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8187         esac
8188         set dflt
8189         eval $prefixup
8190         ;;
8191 *)  dflt="$man1dir"
8192         ;;
8193 esac
8194 echo " "
8195 fn=dn+~
8196 rp="Where do the main $spackage manual pages (source) go?"
8197 . ./getfile
8198 if $test "X$man1direxp" != "X$ansexp"; then
8199         installman1dir=''
8200 fi
8201 prefixvar=man1dir
8202 . ./setprefixvar
8203
8204 case "$man1dir" in
8205 '')     man1dir=' '
8206         installman1dir='';;
8207 esac
8208
8209 : What suffix to use on installed man pages
8210
8211 case "$man1dir" in
8212 ' ')
8213         man1ext='0'
8214         ;;
8215 *)
8216         rp="What suffix should be used for the main $spackage man pages?"
8217         case "$man1ext" in
8218         '')     case "$man1dir" in
8219                 *1)  dflt=1 ;;
8220                 *1p) dflt=1p ;;
8221                 *1pm) dflt=1pm ;;
8222                 *l) dflt=l;;
8223                 *n) dflt=n;;
8224                 *o) dflt=o;;
8225                 *p) dflt=p;;
8226                 *C) dflt=C;;
8227                 *L) dflt=L;;
8228                 *L1) dflt=L1;;
8229                 *) dflt=1;;
8230                 esac
8231                 ;;
8232         *)      dflt="$man1ext";;
8233         esac
8234         . ./myread
8235         man1ext="$ans"
8236         ;;
8237 esac
8238
8239 : see if we can have long filenames
8240 echo " "
8241 first=123456789abcdef
8242 $rm -f $first
8243 if (echo hi >$first) 2>/dev/null; then
8244         if $test -f 123456789abcde; then
8245                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8246                 val="$undef"
8247         else
8248                 echo 'You can have filenames longer than 14 characters.'>&4
8249                 val="$define"
8250         fi
8251 else
8252         $cat <<'EOM'
8253 You can't have filenames longer than 14 chars.
8254 You can't even think about them!
8255 EOM
8256         val="$undef"
8257 fi 
8258 set d_flexfnam
8259 eval $setvar
8260 $rm -rf 123456789abcde*
8261
8262 : determine where library module manual pages go
8263 set man3dir man3dir none
8264 eval $prefixit
8265 $cat <<EOM
8266
8267 $spackage has manual pages for many of the library modules.
8268 EOM
8269
8270 case "$nroff" in
8271 nroff)
8272         $cat <<'EOM'
8273 However, you don't have nroff, so they're probably useless to you.
8274 EOM
8275         case "$man3dir" in
8276         '') man3dir="none";;
8277         esac;;
8278 esac
8279
8280 case "$d_flexfnam" in
8281 undef)
8282         $cat <<'EOM'
8283 However, your system can't handle the long file names like File::Basename.3.
8284 EOM
8285         case "$man3dir" in
8286         '') man3dir="none";;
8287         esac;;
8288 esac
8289
8290 echo "If you don't want the manual sources installed, answer 'none'."
8291 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8292 case "$man3dir" in
8293 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8294         if $test -d "$privlib/man/man3"; then
8295                 cat <<EOM >&4
8296
8297 WARNING:  Previous versions of perl installed man3 pages into
8298 $privlib/man/man3.  This version will suggest a
8299 new default of $dflt.
8300 EOM
8301                 tdflt=$dflt
8302                 dflt='n'
8303                 rp='Do you wish to preserve the old behavior?(y/n)'
8304                 . ./myread
8305                 case "$ans" in
8306                 y*) dflt="$privlib/man/man3" ;;
8307                 *)  dflt=$tdflt ;;
8308                 esac
8309     fi
8310         ;;
8311 *)      dflt="$man3dir" ;;
8312 esac
8313 case "$dflt" in
8314 ' ') dflt=none ;;
8315 esac
8316 echo " "
8317 fn=dn+~
8318 rp="Where do the $package library man pages (source) go?"
8319 . ./getfile
8320 prefixvar=man3dir
8321 . ./setprefixvar
8322
8323 case "$man3dir" in
8324 '')     man3dir=' '
8325         installman3dir='';;
8326 esac
8327
8328 : What suffix to use on installed man pages
8329 case "$man3dir" in
8330 ' ')
8331         man3ext='0'
8332         ;;
8333 *)
8334         rp="What suffix should be used for the $package library man pages?"
8335         case "$man3ext" in
8336         '')     case "$man3dir" in
8337                 *3)  dflt=3 ;;
8338                 *3p) dflt=3p ;;
8339                 *3pm) dflt=3pm ;;
8340                 *l) dflt=l;;
8341                 *n) dflt=n;;
8342                 *o) dflt=o;;
8343                 *p) dflt=p;;
8344                 *C) dflt=C;;
8345                 *L) dflt=L;;
8346                 *L3) dflt=L3;;
8347                 *) dflt=3;;
8348                 esac
8349                 ;;
8350         *)      dflt="$man3ext";;
8351         esac
8352         . ./myread
8353         man3ext="$ans"
8354         ;;
8355 esac
8356
8357 : see if we have to deal with yellow pages, now NIS.
8358 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8359         if $test -f /usr/etc/nibindd; then
8360                 echo " "
8361                 echo "I'm fairly confident you're on a NeXT."
8362                 echo " "
8363                 rp='Do you get the hosts file via NetInfo?'
8364                 dflt=y
8365                 case "$hostcat" in
8366                 nidump*) ;;
8367                 '') ;;
8368                 *) dflt=n;;
8369                 esac
8370                 . ./myread
8371                 case "$ans" in
8372                 y*) hostcat='nidump hosts .';;
8373                 *)      case "$hostcat" in
8374                         nidump*) hostcat='';;
8375                         esac
8376                         ;;
8377                 esac
8378         fi
8379         case "$hostcat" in
8380         nidump*) ;;
8381         *)
8382                 case "$hostcat" in
8383                 *ypcat*) dflt=y;;
8384                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8385                                 dflt=y
8386                         else
8387                                 dflt=n
8388                         fi;;
8389                 *) dflt=n;;
8390                 esac
8391                 echo " "
8392                 rp='Are you getting the hosts file via yellow pages?'
8393                 . ./myread
8394                 case "$ans" in
8395                 y*) hostcat='ypcat hosts';;
8396                 *) hostcat='cat /etc/hosts';;
8397                 esac
8398                 ;;
8399         esac
8400 fi
8401 case "$hostcat" in
8402 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8403 esac
8404 case "$groupcat" in
8405 '') test -f /etc/group && groupcat='cat /etc/group';;
8406 esac
8407 case "$passcat" in
8408 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8409 esac
8410
8411 : now get the host name
8412 echo " "
8413 echo "Figuring out host name..." >&4
8414 case "$myhostname" in
8415 '') cont=true
8416         echo 'Maybe "hostname" will work...'
8417         if tans=`sh -c hostname 2>&1` ; then
8418                 myhostname=$tans
8419                 phostname=hostname
8420                 cont=''
8421         fi
8422         ;;
8423 *) cont='';;
8424 esac
8425 if $test "$cont"; then
8426         if ./xenix; then
8427                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8428                 if tans=`cat /etc/systemid 2>&1` ; then
8429                         myhostname=$tans
8430                         phostname='cat /etc/systemid'
8431                         echo "Whadyaknow.  Xenix always was a bit strange..."
8432                         cont=''
8433                 fi
8434         elif $test -r /etc/systemid; then
8435                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8436         fi
8437 fi
8438 if $test "$cont"; then
8439         echo 'No, maybe "uuname -l" will work...'
8440         if tans=`sh -c 'uuname -l' 2>&1` ; then
8441                 myhostname=$tans
8442                 phostname='uuname -l'
8443         else
8444                 echo 'Strange.  Maybe "uname -n" will work...'
8445                 if tans=`sh -c 'uname -n' 2>&1` ; then
8446                         myhostname=$tans
8447                         phostname='uname -n'
8448                 else
8449                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8450                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8451                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8452                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8453                         else
8454                                 case "$myhostname" in
8455                                 '') echo "Does this machine have an identity crisis or something?"
8456                                         phostname='';;
8457                                 *)
8458                                         echo "Well, you said $myhostname before..."
8459                                         phostname='echo $myhostname';;
8460                                 esac
8461                         fi
8462                 fi
8463         fi
8464 fi
8465 case "$myhostname" in
8466 '') myhostname=noname ;;
8467 esac
8468 : you do not want to know about this
8469 set $myhostname
8470 myhostname=$1
8471
8472 : verify guess
8473 if $test "$myhostname" ; then
8474         dflt=y
8475         rp='Your host name appears to be "'$myhostname'".'" Right?"
8476         . ./myread
8477         case "$ans" in
8478         y*) ;;
8479         *) myhostname='';;
8480         esac
8481 fi
8482
8483 : bad guess or no guess
8484 while $test "X$myhostname" = X ; do
8485         dflt=''
8486         rp="Please type the (one word) name of your host:"
8487         . ./myread
8488         myhostname="$ans"
8489 done
8490
8491 : translate upper to lower if necessary
8492 case "$myhostname" in
8493 *[A-Z]*)
8494         echo "(Normalizing case in your host name)"
8495         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8496         ;;
8497 esac
8498
8499 case "$myhostname" in
8500 *.*)
8501         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8502         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8503         echo "(Trimming domain name from host name--host name is now $myhostname)"
8504         ;;
8505 *) case "$mydomain" in
8506         '')
8507                 {
8508                         test "X$hostcat" = "Xypcat hosts" &&
8509                         ypmatch "$myhostname" hosts 2>/dev/null |\
8510                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8511                         $test -s hosts
8512                 } || {
8513                         test "X$hostcat" != "X" &&
8514                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8515                                         /[       ]$myhostname[  . ]/p" > hosts
8516                 }
8517                 tmp_re="[       . ]"
8518                 if $test -f hosts; then
8519                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8520                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8521                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8522                                 hosts | $sort | $uniq | \
8523                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8524                         case `$echo X$dflt` in
8525                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8526                                 dflt=.
8527                                 ;;
8528                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8529                                 ;;
8530                         esac
8531                 else
8532                         echo "(I cannot locate a hosts database anywhere)"
8533                         dflt=.
8534                 fi
8535                 case "$dflt" in
8536                 .)
8537                         tans=`./loc resolv.conf X /etc /usr/etc`
8538                         if $test -f "$tans"; then
8539                                 echo "(Attempting domain name extraction from $tans)"
8540                                 dflt=.`$sed -n -e 's/   / /g' \
8541                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8542                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8543                                 case "$dflt" in
8544                                 .) dflt=.`$sed -n -e 's/        / /g' \
8545                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8546                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8547                                         ;;
8548                                 esac
8549                         fi
8550                         ;;
8551                 esac
8552                 case "$dflt" in
8553                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8554                         dflt=.`sh -c domainname 2>/dev/null`
8555                         case "$dflt" in
8556                         '') dflt='.';;
8557                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8558                         esac
8559                         ;;
8560                 esac
8561                 case "$dflt$osname" in
8562                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8563                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8564                         ;;
8565                 esac
8566                 case "$dflt" in
8567                 .) echo "(Lost all hope -- silly guess then)"
8568                         dflt='.nonet'
8569                         ;;
8570                 esac
8571                 $rm -f hosts
8572                 ;;
8573         *) dflt="$mydomain";;
8574         esac;;
8575 esac
8576 echo " "
8577 rp="What is your domain name?"
8578 . ./myread
8579 tans="$ans"
8580 case "$ans" in
8581 '') ;;
8582 .*) ;;
8583 *) tans=".$tans";;
8584 esac
8585 mydomain="$tans"
8586
8587 : translate upper to lower if necessary
8588 case "$mydomain" in
8589 *[A-Z]*)
8590         echo "(Normalizing case in your domain name)"
8591         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8592         ;;
8593 esac
8594
8595 : a little sanity check here
8596 case "$phostname" in
8597 '') ;;
8598 *)
8599         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8600         $myhostname$mydomain|$myhostname) ;;
8601         *)
8602                 case "$phostname" in
8603                 sed*)
8604                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8605                         ;;
8606                 *)
8607                         echo "(That doesn't agree with your $phostname command, by the way.)"
8608                         ;;
8609                 esac
8610         ;;
8611         esac
8612         ;;
8613 esac
8614
8615 $cat <<EOM
8616
8617 I need to get your e-mail address in Internet format if possible, i.e.
8618 something like user@host.domain. Please answer accurately since I have
8619 no easy means to double check it. The default value provided below
8620 is most probably close to reality but may not be valid from outside
8621 your organization...
8622
8623 EOM
8624 cont=x
8625 while test "$cont"; do
8626         case "$cf_email" in
8627         '') dflt="$cf_by@$myhostname$mydomain";;
8628         *) dflt="$cf_email";;
8629         esac
8630         rp='What is your e-mail address?'
8631         . ./myread
8632         cf_email="$ans"
8633         case "$cf_email" in
8634         *@*.*) cont='' ;;
8635         *)
8636                 rp='Address does not look like an Internet one.  Use it anyway?'
8637                 case "$fastread" in
8638                 yes) dflt=y ;;
8639                 *) dflt=n ;;
8640                 esac
8641                 . ./myread
8642                 case "$ans" in
8643                 y*) cont='' ;;
8644                 *) echo " " ;;
8645                 esac
8646                 ;;
8647         esac
8648 done
8649
8650 $cat <<EOM
8651
8652 If you or somebody else will be maintaining perl at your site, please
8653 fill in the correct e-mail address here so that they may be contacted
8654 if necessary. Currently, the "perlbug" program included with perl
8655 will send mail to this address in addition to perlbug@perl.org. You may
8656 enter "none" for no administrator.
8657
8658 EOM
8659 case "$perladmin" in
8660 '') dflt="$cf_email";;
8661 *) dflt="$perladmin";;
8662 esac
8663 rp='Perl administrator e-mail address'
8664 . ./myread
8665 perladmin="$ans"
8666
8667 : determine whether to only install version-specific parts.
8668 echo " "
8669 $cat <<EOM
8670 Do you want to install only the version-specific parts of the perl
8671 distribution?  Usually you do *not* want to do this.
8672 EOM
8673 case "$versiononly" in
8674 "$define"|[Yy]*|true) dflt='y' ;;
8675 *) dflt='n';
8676 esac
8677 rp="Do you want to install only the version-specific parts of perl?"
8678 . ./myread
8679 case "$ans" in
8680 [yY]*)  val="$define";;
8681 *)      val="$undef" ;;
8682 esac
8683 set versiononly
8684 eval $setvar
8685
8686 case "$versiononly" in
8687 "$define") inc_version_list=''
8688            inc_version_list_init=0
8689            ;;
8690 esac
8691
8692 : figure out how to guarantee perl startup
8693 : XXX Note that this currently takes advantage of the bug that binexp ignores
8694 :     the Configure -Dinstallprefix setting, which in turn means that under
8695 :     relocatable @INC, initialinstalllocation is what binexp started as.
8696 case "$startperl" in
8697 '')
8698         case "$sharpbang" in
8699         *!)
8700                 $cat <<EOH
8701
8702 I can use the #! construct to start perl on your system. This will
8703 make startup of perl scripts faster, but may cause problems if you
8704 want to share those scripts and perl is not in a standard place
8705 ($initialinstalllocation/perl) on all your platforms. The alternative
8706 is to force a shell by starting the script with a single ':' character.
8707
8708 EOH
8709                 case "$versiononly" in
8710                 "$define")      dflt="$initialinstalllocation/perl$version";;
8711                 *)              dflt="$initialinstalllocation/perl";;
8712                 esac
8713                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8714                 . ./myread
8715                 case "$ans" in
8716                 none)   startperl=": # use perl";;
8717                 *)      startperl="#!$ans"
8718                         if $test 30 -lt `echo "$ans" | wc -c`; then
8719                                 $cat >&4 <<EOM
8720
8721 WARNING:  Some systems limit the #! command to 32 characters.
8722 If you experience difficulty running Perl scripts with #!, try
8723 installing Perl in a directory with a shorter pathname.
8724
8725 EOM
8726                         fi ;;
8727                 esac
8728                 ;;
8729         *) startperl=": # use perl"
8730                 ;;
8731         esac
8732         ;;
8733 esac
8734 echo "I'll use $startperl to start perl scripts."
8735
8736 : figure best path for perl in scripts
8737 case "$perlpath" in
8738 '')
8739         case "$versiononly" in
8740         "$define")      perlpath="$initialinstalllocation/perl$version";;
8741         *)              perlpath="$initialinstalllocation/perl";;
8742         esac
8743         case "$startperl" in
8744         *!*) ;;
8745         *)
8746                 $cat <<EOH
8747
8748 I will use the "eval 'exec'" idiom to start Perl on your system.
8749 I can use the full path of your Perl binary for this purpose, but
8750 doing so may cause problems if you want to share those scripts and
8751 Perl is not always in a standard place ($initialinstalllocation/perl).
8752
8753 EOH
8754                 dflt="$initialinstalllocation/perl"
8755                 rp="What path shall I use in \"eval 'exec'\"?"
8756                 . ./myread
8757                 perlpath="$ans"
8758                 ;;
8759         esac
8760         ;;
8761 esac
8762 case "$startperl" in
8763 *!*)    ;;
8764 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8765 esac
8766
8767 : determine where public executable scripts go
8768 set scriptdir scriptdir
8769 eval $prefixit
8770 case "$scriptdir" in
8771 '')
8772         dflt="$bin"
8773         : guess some guesses
8774         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8775         $test -d /usr/share/bin     && dflt=/usr/share/bin
8776         $test -d /usr/local/script  && dflt=/usr/local/script
8777         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8778         $test -d $prefixexp/script  && dflt=$prefixexp/script
8779         set dflt
8780         eval $prefixup
8781         ;;
8782 *)  dflt="$scriptdir"
8783         ;;
8784 esac
8785 $cat <<EOM
8786
8787 Some installations have a separate directory just for executable scripts so
8788 that they can mount it across multiple architectures but keep the scripts in
8789 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8790 Or you might just lump your scripts in with all your other executables.
8791
8792 EOM
8793 fn=d~
8794 rp='Where do you keep publicly executable scripts?'
8795 . ./getfile
8796 if $test "X$ansexp" != "X$scriptdirexp"; then
8797         installscript=''
8798 fi
8799 installscriptdir=''
8800 prefixvar=scriptdir
8801 . ./setprefixvar
8802 : A little fix up for an irregularly named variable.
8803 installscript="$installscriptdir"
8804
8805 : determine where add-on public executables go
8806 case "$sitebin" in
8807 '')     dflt=$siteprefix/bin ;;
8808 *)      dflt=$sitebin ;;
8809 esac
8810 fn=d~
8811 rp='Pathname where the add-on public executables should be installed?'
8812 . ./getfile
8813 prefixvar=sitebin
8814 . ./setprefixvar
8815
8816 : determine where add-on html pages go
8817 : There is no standard location, so try to copy the previously-selected
8818 : directory structure for the core html pages.
8819 case "$sitehtml1dir" in
8820 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8821 *)     dflt=$sitehtml1dir ;;
8822 esac
8823 case "$dflt" in
8824 ''|' ') dflt=none ;;
8825 esac
8826 fn=dn+~
8827 rp='Pathname where the site-specific html pages should be installed?'
8828 . ./getfile
8829 prefixvar=sitehtml1dir
8830 . ./setprefixvar
8831
8832 : determine where add-on library html pages go
8833 : There is no standard location, so try to copy the previously-selected
8834 : directory structure for the core html pages.
8835 case "$sitehtml3dir" in
8836 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8837 *)     dflt=$sitehtml3dir ;;
8838 esac
8839 case "$dflt" in
8840 ''|' ') dflt=none ;;
8841 esac
8842 fn=dn+~
8843 rp='Pathname where the site-specific library html pages should be installed?'
8844 . ./getfile
8845 prefixvar=sitehtml3dir
8846 . ./setprefixvar
8847
8848 : determine where add-on manual pages go
8849 case "$siteman1dir" in
8850 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8851 *)      dflt=$siteman1dir ;;
8852 esac
8853 case "$dflt" in
8854 ''|' ') dflt=none ;;
8855 esac
8856 fn=dn+~
8857 rp='Pathname where the site-specific manual pages should be installed?'
8858 . ./getfile
8859 prefixvar=siteman1dir
8860 . ./setprefixvar
8861
8862 : determine where add-on library man pages go
8863 case "$siteman3dir" in
8864 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8865 *)      dflt=$siteman3dir ;;
8866 esac
8867 case "$dflt" in
8868 ''|' ') dflt=none ;;
8869 esac
8870 fn=dn+~
8871 rp='Pathname where the site-specific library manual pages should be installed?'
8872 . ./getfile
8873 prefixvar=siteman3dir
8874 . ./setprefixvar
8875
8876 : determine where add-on public executable scripts go
8877 case "$sitescript" in
8878 '')     dflt=$siteprefix/script
8879         $test -d $dflt || dflt=$sitebin ;;
8880 *)  dflt="$sitescript" ;;
8881 esac
8882 fn=d~+
8883 rp='Pathname where add-on public executable scripts should be installed?'
8884 . ./getfile
8885 prefixvar=sitescript
8886 . ./setprefixvar
8887
8888 case "$usefaststdio" in
8889 $define|true|[yY]*|'')
8890         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8891         case "$xversion" in
8892         [68])   dflt='y' ;;
8893         *)      dflt='n' ;;
8894         esac
8895         ;;
8896 *) dflt='n';;
8897 esac
8898 cat <<EOM
8899
8900 Perl can be built to use 'fast stdio', which means using the stdio
8901 library but also directly manipulating the stdio buffers to enable
8902 faster I/O.  Using stdio is better for backward compatibility (especially
8903 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8904 interface has been preferred instead of stdio.
8905
8906 If this doesn't make any sense to you, just accept the default '$dflt'.
8907 EOM
8908 rp='Use the "fast stdio" if available?'
8909 . ./myread
8910 case "$ans" in
8911 y|Y)    val="$define" ;;     
8912 *)      val="$undef" ;;
8913 esac
8914 set usefaststdio
8915 eval $setvar
8916
8917
8918 : define an is-a-typedef? function
8919 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8920 case "$inclist" in
8921 "") inclist="sys/types.h";;
8922 esac;
8923 eval "varval=\$$var";
8924 case "$varval" in
8925 "")
8926         $rm -f temp.c;
8927         for inc in $inclist; do
8928                 echo "#include <$inc>" >>temp.c;
8929         done;
8930         echo "#ifdef $type" >> temp.c;
8931         echo "printf(\"We have $type\");" >> temp.c;
8932         echo "#endif" >> temp.c;
8933         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8934         if $contains $type temp.E >/dev/null 2>&1; then
8935                 eval "$var=\$type";
8936         else
8937                 eval "$var=\$def";
8938         fi;
8939         $rm -f temp.?;;
8940 *) eval "$var=\$varval";;
8941 esac'
8942
8943 : define an is-a-typedef? function that prompts if the type is not available.
8944 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8945 case "$inclist" in
8946 "") inclist="sys/types.h";;
8947 esac;
8948 eval "varval=\$$var";
8949 case "$varval" in
8950 "")
8951         $rm -f temp.c;
8952         for inc in $inclist; do
8953                 echo "#include <$inc>" >>temp.c;
8954         done;
8955         echo "#ifdef $type" >> temp.c;
8956         echo "printf(\"We have $type\");" >> temp.c;
8957         echo "#endif" >> temp.c;
8958         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8959         echo " " ;
8960         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8961         if $contains $type temp.E >/dev/null 2>&1; then
8962                 echo "$type found." >&4;
8963                 eval "$var=\$type";
8964         else
8965                 echo "$type NOT found." >&4;
8966                 dflt="$def";
8967                 . ./myread ;
8968                 eval "$var=\$ans";
8969         fi;
8970         $rm -f temp.?;;
8971 *) eval "$var=\$varval";;
8972 esac'
8973
8974 : see what type lseek is declared as in the kernel
8975 rp="What is the type used for lseek's offset on this system?"
8976 set off_t lseektype long stdio.h sys/types.h
8977 eval $typedef_ask
8978
8979 echo " "
8980 echo "Checking to see how big your file offsets are..." >&4
8981 $cat >try.c <<EOCP
8982 #include <sys/types.h>
8983 #include <stdio.h>
8984 int main()
8985 {
8986     printf("%d\n", (int)sizeof($lseektype));
8987     return(0);
8988 }
8989 EOCP
8990 set try
8991 if eval $compile_ok; then
8992         lseeksize=`$run ./try`
8993         echo "Your file offsets are $lseeksize bytes long."
8994 else
8995         dflt=$longsize
8996         echo " "
8997         echo "(I can't seem to compile the test program.  Guessing...)"
8998         rp="What is the size of your file offsets (in bytes)?"
8999         . ./myread
9000         lseeksize="$ans"
9001 fi
9002 $rm_try
9003
9004 : see what type file positions are declared as in the library
9005 rp="What is the type for file position used by fsetpos()?"
9006 set fpos_t fpostype long stdio.h sys/types.h
9007 eval $typedef_ask
9008
9009 echo " "
9010 case "$fpostype" in
9011 *_t) zzz="$fpostype"    ;;
9012 *)   zzz="fpos_t"       ;;
9013 esac
9014 echo "Checking the size of $zzz..." >&4 
9015 cat > try.c <<EOCP
9016 #include <sys/types.h>
9017 #include <stdio.h>
9018 #$i_stdlib I_STDLIB
9019 #ifdef I_STDLIB
9020 #include <stdlib.h>
9021 #endif
9022 int main() {
9023     printf("%d\n", (int)sizeof($fpostype));
9024     exit(0);
9025 }
9026 EOCP
9027 set try
9028 if eval $compile_ok; then
9029         yyy=`$run ./try`
9030         case "$yyy" in
9031         '')     fpossize=4
9032                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9033                 ;;
9034         *)      fpossize=$yyy
9035                 echo "Your $zzz is $fpossize bytes long."
9036                 ;;
9037         esac
9038 else
9039         dflt="$longsize"
9040         echo " " >&4
9041         echo "(I can't compile the test program.  Guessing...)" >&4
9042         rp="What is the size of your file positions (in bytes)?"
9043         . ./myread
9044         fpossize="$ans"
9045 fi
9046
9047 # Backward compatibility (uselfs is deprecated).
9048 case "$uselfs" in
9049 "$define"|true|[yY]*)
9050         cat <<EOM >&4
9051
9052 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9053 EOM
9054         uselargefiles="$define"
9055         ;;
9056 esac
9057
9058 case "$lseeksize:$fpossize" in
9059 8:8) cat <<EOM
9060
9061 You can have files larger than 2 gigabytes.
9062 EOM
9063    val="$define" ;;
9064 *)    case "$uselargefiles" in
9065    "$undef"|false|[nN]*) dflt='n' ;;
9066    *)   dflt='y' ;;
9067    esac
9068    cat <<EOM
9069
9070 Perl can be built to understand large files (files larger than 2 gigabytes)
9071 on some systems.  To do so, Configure can be run with -Duselargefiles.
9072
9073 If this doesn't make any sense to you, just accept the default '$dflt'.
9074 EOM
9075    rp='Try to understand large files, if available?'
9076    . ./myread
9077    case "$ans" in
9078    y|Y)         val="$define" ;;
9079    *)           val="$undef"  ;;
9080    esac
9081    ;;
9082 esac
9083 set uselargefiles
9084 eval $setvar
9085 : Look for a hint-file generated 'call-back-unit'.  If the
9086 : user has specified that a large files perl is to be built,
9087 : we may need to set or change some other defaults.
9088 if $test -f uselargefiles.cbu; then
9089         echo "Your platform has some specific hints regarding large file builds, using them..."
9090         . ./uselargefiles.cbu
9091 fi
9092 case "$uselargefiles" in
9093 "$define")
9094         if $test -f uselargefiles.cbu; then
9095                 echo " "
9096                 echo "Rechecking to see how big your file offsets are..." >&4
9097                 $cat >try.c <<EOCP
9098 #include <sys/types.h>
9099 #include <stdio.h>
9100 int main()
9101 {
9102     printf("%d\n", (int)sizeof($lseektype));
9103     return(0);
9104 }
9105 EOCP
9106                 set try
9107                 if eval $compile_ok; then
9108                         lseeksize=`$run ./try`
9109                         $echo "Your file offsets are now $lseeksize bytes long."
9110                 else
9111                         dflt="$lseeksize"
9112                         echo " "
9113                         echo "(I can't seem to compile the test program.  Guessing...)"
9114                         rp="What is the size of your file offsets (in bytes)?"
9115                         . ./myread
9116                         lseeksize="$ans"
9117                 fi
9118                 case "$fpostype" in
9119                 *_t) zzz="$fpostype"    ;;
9120                 *)   zzz="fpos_t"       ;;
9121                 esac
9122                 $echo $n "Rechecking the size of $zzz...$c" >&4
9123                 $cat > try.c <<EOCP
9124 #include <sys/types.h>
9125 #include <stdio.h>
9126 #$i_stdlib I_STDLIB
9127 #ifdef I_STDLIB
9128 #include <stdlib.h>
9129 #endif
9130 int main() {
9131     printf("%d\n", (int)sizeof($fpostype));
9132     return(0);
9133 }
9134 EOCP
9135                 set try
9136                 if eval $compile_ok; then
9137                         yyy=`$run ./try`
9138                         dflt="$lseeksize"
9139                         case "$yyy" in
9140                         '')     echo " "
9141                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9142                                 ;;
9143                         *)      fpossize=$yyy
9144                                 echo " $fpossize bytes." >&4
9145                                 ;;
9146                         esac
9147                 else
9148                         dflt="$fpossize"
9149                         echo " "
9150                         echo "(I can't compile the test program.  Guessing...)" >&4
9151                         rp="What is the size of your file positions (in bytes)?"
9152                         . ./myread
9153                         fpossize="$ans"
9154                 fi
9155                 $rm_try
9156         fi
9157         ;;
9158 esac
9159
9160 case "$vendorprefix" in
9161 '')     d_vendorbin="$undef"
9162         vendorbin=''
9163         vendorbinexp=''
9164         ;;
9165 *)      d_vendorbin="$define"
9166         : determine where vendor-supplied executables go.
9167         case "$vendorbin" in
9168         '') dflt=$vendorprefix/bin ;;
9169         *)      dflt="$vendorbin" ;;
9170         esac
9171         fn=d~+
9172         rp='Pathname for the vendor-supplied executables directory?'
9173         . ./getfile
9174         vendorbin="$ans"
9175         vendorbinexp="$ansexp"
9176         ;;
9177 esac
9178 prefixvar=vendorbin
9179 . ./installprefix
9180
9181 case "$vendorprefix" in
9182 '')     vendorhtml1dir=''
9183         vendorhtml1direxp=''
9184         ;;
9185 *)      : determine where vendor-supplied html pages go.
9186         : There is no standard location, so try to copy the previously-selected
9187         : directory structure for the core html pages.
9188         : XXX Better default suggestions would be welcome.
9189         case "$vendorhtml1dir" in
9190         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9191         *)      dflt=$vendorhtml1dir ;;
9192         esac
9193         case "$dflt" in
9194         ''|' ') dflt=none ;;
9195         esac
9196         fn=dn+~
9197         rp='Pathname for the vendor-supplied html pages?'
9198         . ./getfile
9199         vendorhtml1dir="$ans"
9200         vendorhtml1direxp="$ansexp"
9201         ;;
9202 esac
9203 : Use ' ' for none so value is preserved next time through Configure
9204 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9205 prefixvar=vendorhtml1dir
9206 . ./installprefix
9207
9208 case "$vendorprefix" in
9209 '')     vendorhtml3dir=''
9210         vendorhtml3direxp=''
9211         ;;
9212 *)      : determine where vendor-supplied module html pages go.
9213         : There is no standard location, so try to copy the previously-selected
9214         : directory structure for the core html pages.
9215         : XXX Better default suggestions would be welcome.
9216         case "$vendorhtml3dir" in
9217         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9218         *)      dflt=$vendorhtml3dir ;;
9219         esac
9220         case "$dflt" in
9221         ''|' ') dflt=none ;;
9222         esac
9223         fn=dn+~
9224         rp='Pathname for the vendor-supplied html pages?'
9225         . ./getfile
9226         vendorhtml3dir="$ans"
9227         vendorhtml3direxp="$ansexp"
9228         ;;
9229 esac
9230 : Use ' ' for none so value is preserved next time through Configure
9231 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9232 prefixvar=vendorhtml3dir
9233 . ./installprefix
9234
9235 case "$vendorprefix" in
9236 '')     vendorman1dir=''
9237         vendorman1direxp=''
9238         ;;
9239 *)      : determine where vendor-supplied manual pages go.
9240         case "$vendorman1dir" in
9241         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9242         *)      dflt=$vendorman1dir ;;
9243         esac
9244         case "$dflt" in
9245         ''|' ') dflt=none ;;
9246         esac
9247         fn=nd~+
9248         rp='Pathname for the vendor-supplied manual section 1 pages?'
9249         . ./getfile
9250         vendorman1dir="$ans"
9251         vendorman1direxp="$ansexp"
9252         ;;
9253 esac
9254 : Use ' ' for none so value is preserved next time through Configure
9255 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9256 prefixvar=vendorman1dir
9257 . ./installprefix
9258
9259 case "$vendorprefix" in
9260 '')     vendorman3dir=''
9261         vendorman3direxp=''
9262         ;;
9263 *)      : determine where vendor-supplied module manual pages go.
9264         case "$vendorman3dir" in
9265         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9266         *)      dflt=$vendorman3dir ;;
9267         esac
9268         case "$dflt" in
9269         ''|' ') dflt=none ;;
9270         esac
9271         fn=nd~+
9272         rp='Pathname for the vendor-supplied manual section 3 pages?'
9273         . ./getfile
9274         vendorman3dir="$ans"
9275         vendorman3direxp="$ansexp"
9276         ;;
9277 esac
9278 : Use ' ' for none so value is preserved next time through Configure
9279 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9280 prefixvar=vendorman3dir
9281 . ./installprefix
9282
9283 case "$vendorprefix" in
9284 '')     d_vendorscript="$undef"
9285         vendorscript=''
9286         vendorscriptexp=''
9287         ;;
9288 *)      d_vendorscript="$define"
9289         : determine where vendor-supplied scripts go.
9290         case "$vendorscript" in
9291         '')     dflt=$vendorprefix/script
9292                 $test -d $dflt || dflt=$vendorbin ;;
9293         *)  dflt="$vendorscript" ;;
9294         esac
9295         $cat <<EOM
9296
9297 The installation process will create a directory for
9298 vendor-supplied scripts.
9299
9300 EOM
9301         fn=d~+
9302         rp='Pathname for the vendor-supplied scripts directory?'
9303         . ./getfile
9304         vendorscript="$ans"
9305         vendorscriptexp="$ansexp"
9306         ;;
9307 esac
9308 prefixvar=vendorscript
9309 . ./installprefix
9310
9311 : see if qgcvt exists
9312 set qgcvt d_qgcvt
9313 eval $inlibc
9314
9315 echo " "
9316
9317 if $test X"$d_longdbl" = X"$define"; then
9318
9319 echo "Checking how to print long doubles..." >&4
9320
9321 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9322         $cat >try.c <<'EOCP'
9323 #include <sys/types.h>
9324 #include <stdio.h>
9325 int main() {
9326   double d = 123.456;
9327   printf("%.3f\n", d);
9328 }
9329 EOCP
9330         set try
9331         if eval $compile; then
9332                 yyy=`$run ./try`
9333                 case "$yyy" in
9334                 123.456)
9335                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9336                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9337                         echo "We will use %f."
9338                         ;;
9339                 esac
9340         fi
9341 fi
9342
9343 if $test X"$sPRIfldbl" = X; then
9344         $cat >try.c <<'EOCP'
9345 #include <sys/types.h>
9346 #include <stdio.h>
9347 int main() {
9348   long double d = 123.456;
9349   printf("%.3Lf\n", d);
9350 }
9351 EOCP
9352         set try
9353         if eval $compile; then
9354                 yyy=`$run ./try`
9355                 case "$yyy" in
9356                 123.456)
9357                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9358                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9359                         echo "We will use %Lf."
9360                         ;;
9361                 esac
9362         fi
9363 fi
9364
9365 if $test X"$sPRIfldbl" = X; then
9366         $cat >try.c <<'EOCP'
9367 #include <sys/types.h>
9368 #include <stdio.h>
9369 int main() {
9370   long double d = 123.456;
9371   printf("%.3llf\n", d);
9372 }
9373 EOCP
9374         set try
9375         if eval $compile; then
9376                 yyy=`$run ./try`
9377                 case "$yyy" in
9378                 123.456)
9379                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9380                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9381                         echo "We will use %llf."
9382                         ;;
9383                 esac
9384         fi
9385 fi
9386
9387 if $test X"$sPRIfldbl" = X; then
9388         $cat >try.c <<'EOCP'
9389 #include <sys/types.h>
9390 #include <stdio.h>
9391 int main() {
9392   long double d = 123.456;
9393   printf("%.3lf\n", d);
9394 }
9395 EOCP
9396         set try
9397         if eval $compile; then
9398                 yyy=`$run ./try`
9399                 case "$yyy" in
9400                 123.456)
9401                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9402                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9403                         echo "We will use %lf."
9404                         ;;
9405                 esac
9406         fi
9407 fi
9408
9409 if $test X"$sPRIfldbl" = X; then
9410         echo "Cannot figure out how to print long doubles." >&4
9411 else
9412         sSCNfldbl=$sPRIfldbl    # expect consistency
9413 fi
9414
9415 $rm_try
9416
9417 fi # d_longdbl
9418
9419 case "$sPRIfldbl" in
9420 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9421         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9422         d_SCNfldbl="$undef";
9423         ;;
9424 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9425         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9426         d_SCNfldbl="$define";
9427         ;;
9428 esac
9429
9430 : Check how to convert floats to strings.
9431
9432 if test "X$d_Gconvert" = X; then
9433
9434 echo " "
9435 echo "Checking for an efficient way to convert floats to strings."
9436 echo " " > try.c
9437 case "$uselongdouble" in
9438 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9439 esac
9440 case "$d_longdbl" in
9441 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9442 esac
9443 case "$d_PRIgldbl" in
9444 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9445 esac
9446 $cat >>try.c <<EOP
9447 #ifdef TRY_gconvert
9448 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9449 char *myname = "gconvert";
9450 #endif
9451 #ifdef TRY_gcvt
9452 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9453 char *myname = "gcvt";
9454 #endif
9455 #ifdef TRY_qgcvt
9456 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9457 char *myname = "qgcvt";
9458 #define DOUBLETYPE long double
9459 #endif
9460 #ifdef TRY_sprintf
9461 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9462 #ifdef HAS_PRIgldbl
9463 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9464 #else
9465 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9466 #endif
9467 #else
9468 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9469 #endif
9470 char *myname = "sprintf";
9471 #endif
9472
9473 #ifndef DOUBLETYPE
9474 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9475 #define DOUBLETYPE long double
9476 #else
9477 #define DOUBLETYPE double
9478 #endif
9479 #endif
9480
9481 #include <stdio.h>
9482
9483 #define I_STDLIB $i_stdlib
9484 #ifdef I_STDLIB
9485 #include <stdlib.h>
9486 #endif
9487
9488 int
9489 checkit(expect, got)
9490 char *expect;
9491 char *got;
9492 {
9493     if (strcmp(expect, got)) {
9494                 printf("%s oddity:  Expected %s, got %s\n",
9495                         myname, expect, got);
9496                 exit(1);
9497         }
9498 }
9499
9500 int main()
9501 {
9502         char buf[64];
9503         buf[63] = '\0';
9504
9505         /* This must be 1st test on (which?) platform */
9506         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9507         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9508         checkit("0.1", buf);
9509
9510         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9511         checkit("0.01", buf);
9512
9513         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9514         checkit("0.001", buf);
9515
9516         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9517         checkit("0.0001", buf);
9518
9519         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9520         if (strlen(buf) > 5)
9521             checkit("9e-005", buf); /* for Microsoft ?? */
9522         else
9523             checkit("9e-05", buf);
9524
9525         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9526         checkit("1", buf);
9527
9528         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9529         checkit("1.1", buf);
9530
9531         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9532         checkit("1.01", buf);
9533
9534         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9535         checkit("1.001", buf);
9536
9537         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9538         checkit("1.0001", buf);
9539
9540         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9541         checkit("1.00001", buf);
9542
9543         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9544         checkit("1.000001", buf);
9545
9546         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9547         checkit("0", buf);
9548
9549         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9550         checkit("-1", buf);
9551
9552         /* Some Linux gcvt's give 1.e+5 here. */
9553         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9554         checkit("100000", buf);
9555
9556         /* Some Linux gcvt's give -1.e+5 here. */
9557         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9558         checkit("-100000", buf);
9559
9560         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9561         checkit("123.456", buf);
9562
9563         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9564         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9565         /* 34 should be enough to scare even long double
9566          * places into using the e notation. */
9567         if (strlen(buf) > 5)
9568             checkit("1e+034", buf); /* for Microsoft */
9569         else
9570             checkit("1e+34", buf);
9571
9572         /* For Perl, if you add additional tests here, also add them to
9573          * t/base/num.t for benefit of platforms not using Configure or
9574          * overriding d_Gconvert */
9575
9576         exit(0);
9577 }
9578 EOP
9579 : first add preferred functions to our list
9580 xxx_list=""
9581 for xxx_convert in $gconvert_preference; do
9582     case $xxx_convert in
9583     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9584     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9585     esac
9586 done
9587 : then add any others
9588 for xxx_convert in gconvert gcvt sprintf; do
9589     case "$xxx_list" in
9590     *$xxx_convert*) ;;
9591     *) xxx_list="$xxx_list $xxx_convert" ;;
9592     esac
9593 done
9594
9595 case "$d_longdbl$uselongdouble" in
9596 "$define$define")
9597     : again, add prefered functions to our list first
9598     xxx_ld_list=""
9599     for xxx_convert in $gconvert_ld_preference; do
9600         case $xxx_convert in
9601         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9602         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9603         esac
9604     done
9605     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9606     for xxx_convert in qgcvt sprintf $xxx_list; do
9607         case "$xxx_ld_list" in
9608         $xxx_convert*|*" $xxx_convert"*) ;;
9609         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9610         esac
9611     done
9612     : if sprintf cannot do long doubles, move it to the end
9613     if test "$d_PRIgldbl" != "$define"; then
9614         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9615     fi
9616     : if no qgcvt, remove it
9617     if test "$d_qgcvt" != "$define"; then
9618         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9619     fi
9620     : use the ld_list
9621     xxx_list="$xxx_ld_list"
9622     ;;
9623 esac
9624
9625 for xxx_convert in $xxx_list; do
9626         echo "Trying $xxx_convert..."
9627         $rm -f try try$_o core
9628         set try -DTRY_$xxx_convert
9629         if eval $compile; then
9630                 echo "$xxx_convert() found." >&4
9631                 if $run ./try; then
9632                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9633                         break;
9634                 else
9635                         echo "...But $xxx_convert didn't work as I expected."
9636                         xxx_convert=''
9637                 fi
9638         else
9639                 echo "$xxx_convert NOT found." >&4
9640         fi
9641 done
9642
9643 if test X$xxx_convert = X; then
9644     echo "*** WHOA THERE!!! ***" >&4
9645     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9646     xxx_convert=sprintf
9647 fi
9648
9649 case "$xxx_convert" in
9650 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9651 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9652 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9653 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9654    "$define$define$define")
9655       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9656    "$define$define$undef")
9657       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9658    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9659    esac
9660    ;;
9661 esac
9662
9663 fi
9664 $rm_try
9665
9666 : see if _fwalk exists
9667 set fwalk d__fwalk
9668 eval $inlibc
9669
9670 : Initialize h_fcntl
9671 h_fcntl=false
9672
9673 : Initialize h_sysfile
9674 h_sysfile=false
9675
9676 : access call always available on UNIX
9677 set access d_access
9678 eval $inlibc
9679
9680 : locate the flags for 'access()'
9681 case "$d_access" in
9682 "$define")
9683         echo " "
9684         $cat >access.c <<EOCP
9685 #include <sys/types.h>
9686 #ifdef I_FCNTL
9687 #include <fcntl.h>
9688 #endif
9689 #ifdef I_SYS_FILE
9690 #include <sys/file.h>
9691 #endif
9692 #ifdef I_UNISTD
9693 #include <unistd.h>
9694 #endif
9695 #$i_stdlib I_STDLIB
9696 #ifdef I_STDLIB
9697 #include <stdlib.h>
9698 #endif
9699 int main() {
9700         exit(R_OK);
9701 }
9702 EOCP
9703         : check sys/file.h first, no particular reason here
9704         if $test `./findhdr sys/file.h` && \
9705                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9706                 h_sysfile=true;
9707                 echo "<sys/file.h> defines the *_OK access constants." >&4
9708         elif $test `./findhdr fcntl.h` && \
9709                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9710                 h_fcntl=true;
9711                 echo "<fcntl.h> defines the *_OK access constants." >&4
9712         elif $test `./findhdr unistd.h` && \
9713                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9714                 echo "<unistd.h> defines the *_OK access constants." >&4
9715         else
9716                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9717         fi
9718         ;;
9719 esac
9720 $rm -f access*
9721
9722 : see if accessx exists
9723 set accessx d_accessx
9724 eval $inlibc
9725
9726 : see if aintl exists
9727 set aintl d_aintl
9728 eval $inlibc
9729
9730 : see if alarm exists
9731 set alarm d_alarm
9732 eval $inlibc
9733
9734 : see if POSIX threads are available
9735 set pthread.h i_pthread
9736 eval $inhdr
9737
9738 : define a fucntion to check prototypes
9739 $cat > protochk <<EOSH
9740 $startsh
9741 cc="$cc"
9742 optimize="$optimize"
9743 ccflags="$ccflags"
9744 prototype="$prototype"
9745 define="$define"
9746 rm_try="$rm_try"
9747 usethreads=$usethreads
9748 i_pthread=$i_pthread
9749 pthread_h_first=$pthread_h_first
9750 EOSH
9751
9752 $cat >> protochk <<'EOSH'
9753
9754 $rm_try
9755 foo="$1"
9756 shift
9757 while test $# -ge 2; do
9758         case "$1" in
9759                 $define) echo "#include <$2>" >> try.c ;;
9760                 literal) echo "$2" >> try.c ;;
9761         esac
9762     # Extra magic for the benefit of systems that need pthread.h
9763     # to be included early to correctly detect threadsafe functions.
9764     # Such functions must guarantee themselves, though, that the usethreads
9765     # and i_pthread have been defined, before calling protochk.
9766     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9767         echo "#include <pthread.h>" >> try.c
9768         pthread_h_done=yes
9769     fi
9770     shift 2
9771 done
9772 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9773 cat >> try.c <<'EOCP'
9774 #ifdef CAN_PROTOTYPE
9775 #define _(args) args
9776 #else
9777 #define _(args) ()
9778 #endif
9779 EOCP
9780 echo "$foo" >> try.c
9781 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9782 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9783 status=$?
9784 $rm_try
9785 exit $status
9786 EOSH
9787 chmod +x protochk
9788 $eunicefix protochk
9789
9790 hasproto='varname=$1; func=$2; shift; shift;
9791 while $test $# -ge 2; do
9792         case "$1" in
9793         $define) echo "#include <$2>";;
9794         esac ;
9795     shift 2;
9796 done > try.c;
9797 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9798 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9799         echo "$func() prototype found.";
9800         val="$define";
9801 else
9802         echo "$func() prototype NOT found.";
9803         val="$undef";
9804 fi;
9805 set $varname;
9806 eval $setvar;
9807 $rm_try tryout.c'
9808
9809 : see if sys/types.h has to be included
9810 set sys/types.h i_systypes
9811 eval $inhdr
9812
9813 : see if sys/select.h has to be included
9814 set sys/select.h i_sysselct
9815 eval $inhdr
9816
9817 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9818 while $test $# -ge 2; do
9819         case "$1" in
9820         $define) echo "#include <$2>";;
9821         esac ;
9822     shift 2;
9823 done > try.c;
9824 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9825 set try;
9826 if eval $compile; then
9827         val="$define";
9828 else
9829         val="$undef";
9830 fi;
9831 set $varname;
9832 eval $setvar;
9833 $rm_try'
9834
9835 : see if we should include time.h, sys/time.h, or both
9836 echo " "
9837 if test "X$timeincl" = X; then
9838         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9839         $echo $n "I'm now running the test program...$c"
9840         $cat >try.c <<EOCP
9841 #include <sys/types.h>
9842 #ifdef I_TIME
9843 #include <time.h>
9844 #endif
9845 #ifdef I_SYSTIME
9846 #ifdef SYSTIMEKERNEL
9847 #define KERNEL
9848 #endif
9849 #include <sys/time.h>
9850 #endif
9851 #ifdef I_SYSSELECT
9852 #include <sys/select.h>
9853 #endif
9854 #$i_stdlib I_STDLIB
9855 #ifdef I_STDLIB
9856 #include <stdlib.h>
9857 #endif
9858 int main()
9859 {
9860         struct tm foo;
9861 #ifdef S_TIMEVAL
9862         struct timeval bar;
9863 #endif
9864 #ifdef S_TIMEZONE
9865         struct timezone tzp;
9866 #endif
9867         if (foo.tm_sec == foo.tm_sec)
9868                 exit(0);
9869 #ifdef S_TIMEVAL
9870         if (bar.tv_sec == bar.tv_sec)
9871                 exit(0);
9872 #endif
9873         exit(1);
9874 }
9875 EOCP
9876         flags=''
9877         for s_timezone in '-DS_TIMEZONE' ''; do
9878         sysselect=''
9879         for s_timeval in '-DS_TIMEVAL' ''; do
9880         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9881         for i_time in '' '-DI_TIME'; do
9882         for i_systime in '-DI_SYSTIME' ''; do
9883                 case "$flags" in
9884                 '') $echo $n ".$c"
9885                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9886                         if eval $compile; then
9887                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9888                                 shift
9889                                 flags="$*"
9890                                 echo " "
9891                                 $echo $n "Succeeded with $flags$c"
9892                         fi
9893                         ;;
9894                 esac
9895         done
9896         done
9897         done
9898         done
9899         done
9900         timeincl=''
9901         echo " "
9902         case "$flags" in
9903         *SYSTIMEKERNEL*) i_systimek="$define"
9904                 timeincl=`./findhdr sys/time.h`
9905                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9906         *) i_systimek="$undef";;
9907         esac
9908         case "$flags" in
9909         *I_TIME*) i_time="$define"
9910                 timeincl=`./findhdr time.h`" $timeincl"
9911                 echo "We'll include <time.h>." >&4;;
9912         *) i_time="$undef";;
9913         esac
9914         case "$flags" in
9915         *I_SYSTIME*) i_systime="$define"
9916                 timeincl=`./findhdr sys/time.h`" $timeincl"
9917                 echo "We'll include <sys/time.h>." >&4;;
9918         *) i_systime="$undef";;
9919         esac
9920         $rm_try
9921 fi
9922 : see if struct tm knows about tm_zone
9923 case "$i_systime$i_time" in
9924 *$define*)
9925         echo " "
9926         echo "Checking to see if your struct tm has tm_zone field..." >&4
9927         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9928         eval $hasfield
9929         ;;
9930 *)      val="$undef"
9931         set d_tm_tm_zone
9932         eval $setvar
9933         ;;
9934 esac
9935 case "$d_tm_tm_zone" in
9936 "$define")      echo "Yes, it does."   ;;
9937 *)              echo "No, it doesn't." ;;
9938 esac
9939 : see if struct tm knows about tm_gmtoff
9940 case "$i_systime$i_time" in
9941 *$define*)
9942         echo " "
9943         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9944         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9945         eval $hasfield
9946         ;;
9947 *)      val="$undef"
9948         set d_tm_tm_gmtoff
9949         eval $setvar
9950         ;;
9951 esac
9952 case "$d_tm_tm_gmtoff" in
9953 "$define")      echo "Yes, it does."   ;;
9954 *)              echo "No, it doesn't." ;;
9955 esac
9956
9957 : see if asctime_r exists
9958 set asctime_r d_asctime_r
9959 eval $inlibc
9960 case "$d_asctime_r" in
9961 "$define")
9962         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9963         case "$d_asctime_r_proto:$usethreads" in
9964         ":define")      d_asctime_r_proto=define
9965                 set d_asctime_r_proto asctime_r $hdrs
9966                 eval $hasproto ;;
9967         *)      ;;
9968         esac
9969         case "$d_asctime_r_proto" in
9970         define)
9971         case "$asctime_r_proto" in
9972         ''|0) try='char* asctime_r(const struct tm*, char*);'
9973         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9974         esac
9975         case "$asctime_r_proto" in
9976         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9977         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9978         esac
9979         case "$asctime_r_proto" in
9980         ''|0) try='int asctime_r(const struct tm*, char*);'
9981         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9982         esac
9983         case "$asctime_r_proto" in
9984         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9985         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9986         esac
9987         case "$asctime_r_proto" in
9988         ''|0)   d_asctime_r=undef
9989                 asctime_r_proto=0
9990                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9991         * )     case "$asctime_r_proto" in
9992                 REENTRANT_PROTO*) ;;
9993                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9994                 esac
9995                 echo "Prototype: $try" ;;
9996         esac
9997         ;;
9998         *)      case "$usethreads" in
9999                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10000                 esac
10001                 d_asctime_r=undef
10002                 asctime_r_proto=0
10003                 ;;
10004         esac
10005         ;;
10006 *)      asctime_r_proto=0
10007         ;;
10008 esac
10009
10010 : see if atolf exists
10011 set atolf d_atolf
10012 eval $inlibc
10013
10014 : see if atoll exists
10015 set atoll d_atoll
10016 eval $inlibc
10017
10018 : Look for GCC-style attribute format
10019 case "$d_attribute_format" in
10020 '')
10021 echo " "
10022 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10023 $cat >attrib.c <<'EOCP'
10024 #include <stdio.h>
10025 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10026 EOCP
10027 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10028         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10029                 echo "Your C compiler doesn't support __attribute__((format))."
10030                 val="$undef"
10031         else
10032                 echo "Your C compiler supports __attribute__((format))."
10033                 val="$define"
10034         fi
10035 else
10036         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10037         val="$undef"
10038 fi
10039 ;;
10040 *) val="$d_attribute_format" ;;
10041 esac
10042 set d_attribute_format
10043 eval $setvar
10044 $rm -f attrib*
10045
10046 : Look for GCC-style attribute format with null format allowed
10047 case "$d_printf_format_null" in
10048 '') case "$d_attribute_format" in
10049     $define)
10050         echo " "
10051         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10052 $cat >attrib.c <<EOCP
10053 #include <stdio.h>
10054 #$i_stdlib I_STDLIB
10055 #ifdef I_STDLIB
10056 #include <stdlib.h>
10057 #endif
10058 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10059 int null_printf (char* pat,...) { return (int)pat; }
10060 int main () { exit(null_printf(NULL)); }
10061 EOCP
10062         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10063             : run the executable in case it produces a run-time warning
10064             if $run ./attrib >>attrib.out 2>&1; then
10065                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10066                     echo "Your C compiler doesn't allow __printf__ format to be null."
10067                     val="$undef"
10068                 else
10069                     echo "Your C compiler allows __printf__ format to be null."
10070                     val="$define"
10071                 fi
10072             else
10073             echo "Your C compiler executable failed with __printf__ format null."
10074             val="$undef"
10075         fi
10076     else
10077         echo "Your C compiler fails with __printf__ format null."
10078         val="$undef"
10079     fi
10080     ;;
10081     *)  val="$undef" ;;
10082     esac
10083 ;;
10084 *)  val="$d_printf_format_null" ;;
10085 esac
10086 set d_printf_format_null
10087 eval $setvar
10088 $rm -f attrib*
10089
10090 : Look for GCC-style attribute malloc
10091 case "$d_attribute_malloc" in
10092 '')
10093 echo " "
10094 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10095 $cat >attrib.c <<'EOCP'
10096 #include <stdio.h>
10097 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10098 EOCP
10099 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10100         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10101                 echo "Your C compiler doesn't support __attribute__((malloc))."
10102                 val="$undef"
10103         else
10104                 echo "Your C compiler supports __attribute__((malloc))."
10105                 val="$define"
10106         fi
10107 else
10108         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10109         val="$undef"
10110 fi
10111 ;;
10112 *) val="$d_attribute_malloc" ;;
10113 esac
10114 set d_attribute_malloc
10115 eval $setvar
10116 $rm -f attrib*
10117
10118 : Look for GCC-style attribute nonnull
10119 case "$d_attribute_nonnull" in
10120 '')
10121 echo " "
10122 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10123 $cat >attrib.c <<'EOCP'
10124 #include <stdio.h>
10125 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10126 EOCP
10127 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10128         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10129                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10130                 val="$undef"
10131         else
10132                 echo "Your C compiler supports __attribute__((nonnull))."
10133                 val="$define"
10134         fi
10135 else
10136         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10137         val="$undef"
10138 fi
10139 ;;
10140 *) val="$d_attribute_nonnull" ;;
10141 esac
10142 set d_attribute_nonnull
10143 eval $setvar
10144 $rm -f attrib*
10145
10146 : Look for GCC-style attribute noreturn
10147 case "$d_attribute_noreturn" in
10148 '')
10149 echo " "
10150 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10151 $cat >attrib.c <<'EOCP'
10152 #include <stdio.h>
10153 void fall_over_dead( void ) __attribute__((noreturn));
10154 EOCP
10155 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10156         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10157                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10158                 val="$undef"
10159         else
10160                 echo "Your C compiler supports __attribute__((noreturn))."
10161                 val="$define"
10162         fi
10163 else
10164         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10165         val="$undef"
10166 fi
10167 ;;
10168 *) val="$d_attribute_noreturn" ;;
10169 esac
10170 set d_attribute_noreturn
10171 eval $setvar
10172 $rm -f attrib*
10173
10174 : Look for GCC-style attribute pure
10175 case "$d_attribute_pure" in
10176 '')
10177 echo " "
10178 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10179 $cat >attrib.c <<'EOCP'
10180 #include <stdio.h>
10181 int square( int n ) __attribute__((pure));
10182 EOCP
10183 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10184         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10185                 echo "Your C compiler doesn't support __attribute__((pure))."
10186                 val="$undef"
10187         else
10188                 echo "Your C compiler supports __attribute__((pure))."
10189                 val="$define"
10190         fi
10191 else
10192         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10193         val="$undef"
10194 fi
10195 ;;
10196 *) val="$d_attribute_pure" ;;
10197 esac
10198 set d_attribute_pure
10199 eval $setvar
10200 $rm -f attrib*
10201
10202 : Look for GCC-style attribute unused
10203 case "$d_attribute_unused" in
10204 '')
10205 echo " "
10206 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10207 $cat >attrib.c <<'EOCP'
10208 #include <stdio.h>
10209 int do_something( int dummy __attribute__((unused)), int n );
10210 EOCP
10211 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10212         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10213                 echo "Your C compiler doesn't support __attribute__((unused))."
10214                 val="$undef"
10215         else
10216                 echo "Your C compiler supports __attribute__((unused))."
10217                 val="$define"
10218         fi
10219 else
10220         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10221         val="$undef"
10222 fi
10223 ;;
10224 *) val="$d_attribute_unused" ;;
10225 esac
10226 set d_attribute_unused
10227 eval $setvar
10228 $rm -f attrib*
10229
10230 : Look for GCC-style attribute warn_unused_result
10231 case "$d_attribute_warn_unused_result" in
10232 '')
10233 echo " "
10234 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10235 $cat >attrib.c <<'EOCP'
10236 #include <stdio.h>
10237 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10238 EOCP
10239 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10240         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10241                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10242                 val="$undef"
10243         else
10244                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10245                 val="$define"
10246         fi
10247 else
10248         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10249         val="$undef"
10250 fi
10251 ;;
10252 *) val="$d_attribute_warn_unused_result" ;;
10253 esac
10254 set d_attribute_warn_unused_result
10255 eval $setvar
10256 $rm -f attrib*
10257
10258 : see if bcmp exists
10259 set bcmp d_bcmp
10260 eval $inlibc
10261
10262 : see if bcopy exists
10263 set bcopy d_bcopy
10264 eval $inlibc
10265
10266 : see if getpgrp exists
10267 set getpgrp d_getpgrp
10268 eval $inlibc
10269
10270 case "$d_getpgrp" in
10271 "$define")
10272         echo " "
10273         echo "Checking to see which flavor of getpgrp is in use..."
10274         $cat >try.c <<EOP
10275 #$i_unistd I_UNISTD
10276 #include <sys/types.h>
10277 #ifdef I_UNISTD
10278 #  include <unistd.h>
10279 #endif
10280 #$i_stdlib I_STDLIB
10281 #ifdef I_STDLIB
10282 #include <stdlib.h>
10283 #endif
10284 int main()
10285 {
10286         if (getuid() == 0) {
10287                 printf("(I see you are running Configure as super-user...)\n");
10288                 setuid(1);
10289         }
10290 #ifdef TRY_BSD_PGRP
10291         if (getpgrp(1) == 0)
10292                 exit(0);
10293 #else
10294         if (getpgrp() > 0)
10295                 exit(0);
10296 #endif
10297         exit(1);
10298 }
10299 EOP
10300         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10301                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10302                 val="$define"
10303         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10304                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10305                 val="$undef"
10306         else
10307                 echo "I can't seem to compile and run the test program."
10308                 if ./usg; then
10309                         xxx="a USG one, i.e. you use getpgrp()."
10310                 else
10311                         # SVR4 systems can appear rather BSD-ish.
10312                         case "$i_unistd" in
10313                         $undef)
10314                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10315                                 val="$define"
10316                                 ;;
10317                         $define)
10318                                 xxx="probably a USG one, i.e. you use getpgrp()."
10319                                 val="$undef"
10320                                 ;;
10321                         esac
10322                 fi
10323                 echo "Assuming your getpgrp is $xxx" >&4
10324         fi
10325         ;;
10326 *) val="$undef";;
10327 esac
10328 set d_bsdgetpgrp
10329 eval $setvar
10330 $rm_try
10331
10332 : see if setpgrp exists
10333 set setpgrp d_setpgrp
10334 eval $inlibc
10335
10336 case "$d_setpgrp" in
10337 "$define")
10338         echo " "
10339         echo "Checking to see which flavor of setpgrp is in use..."
10340         $cat >try.c <<EOP
10341 #$i_unistd I_UNISTD
10342 #include <sys/types.h>
10343 #ifdef I_UNISTD
10344 #  include <unistd.h>
10345 #endif
10346 #$i_stdlib I_STDLIB
10347 #ifdef I_STDLIB
10348 #include <stdlib.h>
10349 #endif
10350 int main()
10351 {
10352         if (getuid() == 0) {
10353                 printf("(I see you are running Configure as super-user...)\n");
10354                 setuid(1);
10355         }
10356 #ifdef TRY_BSD_PGRP
10357         if (-1 == setpgrp(1, 1))
10358                 exit(0);
10359 #else
10360         if (setpgrp() != -1)
10361                 exit(0);
10362 #endif
10363         exit(1);
10364 }
10365 EOP
10366         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10367                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10368                 val="$define"
10369         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10370                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10371                 val="$undef"
10372         else
10373                 echo "(I can't seem to compile and run the test program.)"
10374                 if ./usg; then
10375                         xxx="a USG one, i.e. you use setpgrp()."
10376                 else
10377                         # SVR4 systems can appear rather BSD-ish.
10378                         case "$i_unistd" in
10379                         $undef)
10380                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10381                                 val="$define"
10382                                 ;;
10383                         $define)
10384                                 xxx="probably a USG one, i.e. you use setpgrp()."
10385                                 val="$undef"
10386                                 ;;
10387                         esac
10388                 fi
10389                 echo "Assuming your setpgrp is $xxx" >&4
10390         fi
10391         ;;
10392 *) val="$undef";;
10393 esac
10394 set d_bsdsetpgrp
10395 eval $setvar
10396 $rm_try
10397
10398 : Look for GCC-style __builtin_choose_expr
10399 case "$d_builtin_choose_expr" in
10400 '')
10401     echo " "
10402     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10403     $cat >try.c <<'EOCP'
10404 #include <assert.h>
10405 #include <stdlib.h>
10406 #include <stdio.h>
10407
10408 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10409
10410 int main(void) {
10411     assert( SYRINX(1) == 2112 );
10412     assert( SYRINX(1) != 5150 );
10413     assert( SYRINX(0) == 5150 );
10414     assert( SYRINX(0) != 2112 );
10415     puts( "All good!" );
10416     exit(0);
10417 }
10418
10419 EOCP
10420     set try
10421     if eval $compile; then
10422         echo "Your C compiler supports __builtin_choose_expr."
10423         val="$define"
10424     else
10425         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10426         val="$undef"
10427     fi
10428 ;;
10429 *) val="$d_builtin_choose_expr" ;;
10430 esac
10431
10432 set d_builtin_choose_expr
10433 eval $setvar
10434 $rm_try
10435
10436 : Look for GCC-style __builtin_expect
10437 case "$d_builtin_expect" in
10438 '')
10439     echo " "
10440     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10441     $cat >builtin.c <<'EOCP'
10442 int main(void) {
10443     int n = 50;
10444     if ( __builtin_expect(n, 0) ) n = 1;
10445 }
10446 EOCP
10447     set try
10448     if eval $compile; then
10449         echo "Your C compiler supports __builtin_choose_expr."
10450         val="$define"
10451     else
10452         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10453         val="$undef"
10454     fi
10455     ;;
10456 *) val="$d_builtin_expect" ;;
10457 esac
10458
10459 set d_builtin_expect
10460 eval $setvar
10461 $rm_try
10462
10463 : see if bzero exists
10464 set bzero d_bzero
10465 eval $inlibc
10466
10467 : see if stdarg is available
10468 echo " "
10469 if $test `./findhdr stdarg.h`; then
10470         echo "<stdarg.h> found." >&4
10471         valstd="$define"
10472 else
10473         echo "<stdarg.h> NOT found." >&4
10474         valstd="$undef"
10475 fi
10476
10477 : see if varags is available
10478 echo " "
10479 if $test `./findhdr varargs.h`; then
10480         echo "<varargs.h> found." >&4
10481 else
10482         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10483 fi
10484
10485 : set up the varargs testing programs
10486 $cat > varargs.c <<EOP
10487 #ifdef I_STDARG
10488 #include <stdarg.h>
10489 #endif
10490 #ifdef I_VARARGS
10491 #include <varargs.h>
10492 #endif
10493
10494 #ifdef I_STDARG
10495 int f(char *p, ...)
10496 #else
10497 int f(va_alist)
10498 va_dcl
10499 #endif
10500 {
10501         va_list ap;
10502 #ifndef I_STDARG
10503         char *p;
10504 #endif
10505 #ifdef I_STDARG
10506         va_start(ap,p);
10507 #else
10508         va_start(ap);
10509         p = va_arg(ap, char *);
10510 #endif
10511         va_end(ap);
10512         return 0;
10513 }
10514 EOP
10515 $cat > varargs <<EOP
10516 $startsh
10517 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10518         echo "true"
10519 else
10520         echo "false"
10521 fi
10522 $rm -f varargs$_o
10523 EOP
10524 chmod +x varargs
10525
10526 : now check which varargs header should be included
10527 echo " "
10528 i_varhdr=''
10529 case "$valstd" in
10530 "$define")
10531         if `./varargs I_STDARG`; then
10532                 val='stdarg.h'
10533         elif `./varargs I_VARARGS`; then
10534                 val='varargs.h'
10535         fi
10536         ;;
10537 *)
10538         if `./varargs I_VARARGS`; then
10539                 val='varargs.h'
10540         fi
10541         ;;
10542 esac
10543 case "$val" in
10544 '')
10545 echo "I could not find the definition for va_dcl... You have problems..." >&4
10546         val="$undef"; set i_stdarg; eval $setvar
10547         val="$undef"; set i_varargs; eval $setvar
10548         ;;
10549 *) 
10550         set i_varhdr
10551         eval $setvar
10552         case "$i_varhdr" in
10553         stdarg.h)
10554                 val="$define"; set i_stdarg; eval $setvar
10555                 val="$undef"; set i_varargs; eval $setvar
10556                 ;;
10557         varargs.h)
10558                 val="$undef"; set i_stdarg; eval $setvar
10559                 val="$define"; set i_varargs; eval $setvar
10560                 ;;
10561         esac
10562         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10563 esac
10564 $rm -f varargs*
10565
10566 : see if the Compiler supports C99 variadic macros
10567 case "$i_stdarg$i_stdlib" in
10568     "$define$define")
10569     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10570     $cat >try.c <<EOCP
10571 #include <stdio.h>
10572 #include <stdarg.h>
10573
10574 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10575
10576 int main() {
10577   char buf[20];
10578   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10579   puts(buf);
10580   return 0;
10581 }
10582 EOCP
10583     set try
10584     if eval $compile && $run ./try 2>&1 >/dev/null; then
10585         case "`$run ./try`" in
10586             "123 456 789")
10587             echo "You have C99 variadic macros." >&4
10588             d_c99_variadic_macros="$define"
10589             ;;
10590             *)
10591             echo "You don't have functional C99 variadic macros." >&4
10592             d_c99_variadic_macros="$undef"
10593             ;;
10594         esac
10595     else
10596         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10597         d_c99_variadic_macros="$undef"
10598     fi
10599     $rm_try
10600     ;;
10601     *)
10602     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10603     d_c99_variadic_macros="$undef"
10604     ;;
10605 esac
10606
10607 : see if signal is declared as pointer to function returning int or void
10608 echo " "
10609 xxx=`./findhdr signal.h`
10610 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10611 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10612         echo "You have int (*signal())() instead of void." >&4
10613         val="$undef"
10614 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10615         echo "You have void (*signal())()." >&4
10616         val="$define"
10617 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10618         echo "You have int (*signal())() instead of void." >&4
10619         val="$undef"
10620 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10621         echo "You have void (*signal())()." >&4
10622         val="$define"
10623 else
10624         case "$d_voidsig" in
10625         '')
10626         echo "I can't determine whether signal handler returns void or int..." >&4
10627                 dflt=void
10628                 rp="What type does your signal handler return?"
10629                 . ./myread
10630                 case "$ans" in
10631                 v*) val="$define";;
10632                 *) val="$undef";;
10633                 esac;;
10634         "$define")
10635                 echo "As you already told me, signal handler returns void." >&4
10636                 val="$define"
10637                 ;;
10638         *)      echo "As you already told me, signal handler returns int." >&4
10639                 val="$undef"
10640                 ;;
10641         esac
10642 fi
10643 set d_voidsig
10644 eval $setvar
10645 case "$d_voidsig" in
10646 "$define") signal_t="void";;
10647 *) signal_t="int";;
10648 esac
10649 $rm -f $$.tmp
10650
10651 : check for ability to cast large floats to 32-bit ints.
10652 echo " "
10653 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10654 if $test "$intsize" -ge 4; then
10655         xxx=int
10656 else
10657         xxx=long
10658 fi
10659 $cat >try.c <<EOCP
10660 #include <stdio.h>
10661 #$i_stdlib I_STDLIB
10662 #ifdef I_STDLIB
10663 #include <stdlib.h>
10664 #endif
10665 #include <sys/types.h>
10666 #include <signal.h>
10667 $signal_t blech(int s) { exit(3); }
10668 int main()
10669 {
10670         $xxx i32;
10671         double f, g;
10672         int result = 0;
10673         char str[16];
10674         signal(SIGFPE, blech);
10675
10676         /* Don't let compiler optimize the test away.  Store the number
10677            in a writable string for gcc to pass to sscanf under HP/UX.
10678         */
10679         sprintf(str, "2147483647");
10680         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10681         g = 10 * f;
10682         i32  = ($xxx) g;
10683
10684         /* x86 processors will probably give 0x8000 0000, which is a
10685            sign change.  We don't want that.  We want to mimic SPARC
10686            behavior here, which is to preserve the sign and give
10687            back 0x7fff ffff.
10688         */
10689         if (i32 != ($xxx) f)
10690                 result |= 1;
10691         exit(result);
10692 }
10693 EOCP
10694 set try
10695 if eval $compile_ok; then
10696         $run ./try
10697         yyy=$?
10698 else
10699         echo "(I can't seem to compile the test program--assuming it can't)"
10700         yyy=1
10701 fi
10702 case "$yyy" in
10703 0)      val="$define"
10704         echo "Yup, it can."
10705         ;;
10706 *)      val="$undef"
10707         echo "Nope, it can't."
10708         ;;
10709 esac
10710 set d_casti32
10711 eval $setvar
10712 $rm_try
10713
10714 : check for ability to cast negative floats to unsigned
10715 echo " "
10716 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10717 $cat >try.c <<EOCP
10718 #include <stdio.h>
10719 #$i_stdlib I_STDLIB
10720 #ifdef I_STDLIB
10721 #include <stdlib.h>
10722 #endif
10723 #include <sys/types.h>
10724 #include <signal.h>
10725 $signal_t blech(int s) { exit(7); }
10726 $signal_t blech_in_list(int s) { exit(4); }
10727 unsigned long dummy_long(unsigned long p) { return p; }
10728 unsigned int dummy_int(unsigned int p) { return p; }
10729 unsigned short dummy_short(unsigned short p) { return p; }
10730 int main()
10731 {
10732         double f;
10733         unsigned long along;
10734         unsigned int aint;
10735         unsigned short ashort;
10736         int result = 0;
10737         char str[16];
10738
10739         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10740            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10741            optimized the whole file away
10742         */
10743         /* Store the number in a writable string for gcc to pass to
10744            sscanf under HP/UX.
10745         */
10746         sprintf(str, "-123");
10747         sscanf(str, "%lf", &f);  /* f = -123.; */
10748
10749         signal(SIGFPE, blech);
10750         along = (unsigned long)f;
10751         aint = (unsigned int)f;
10752         ashort = (unsigned short)f;
10753         if (along != (unsigned long)-123)
10754                 result |= 1;
10755         if (aint != (unsigned int)-123)
10756                 result |= 1;
10757         if (ashort != (unsigned short)-123)
10758                 result |= 1;
10759         sprintf(str, "1073741824.");
10760         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10761         f = f + f;
10762         along = 0;
10763         along = (unsigned long)f;
10764         if (along != 0x80000000)
10765                 result |= 2;
10766         f -= 1.;
10767         along = 0;
10768         along = (unsigned long)f;
10769         if (along != 0x7fffffff)
10770                 result |= 1;
10771         f += 2.;
10772         along = 0;
10773         along = (unsigned long)f;
10774         if (along != 0x80000001)
10775                 result |= 2;
10776         if (result)
10777                 exit(result);
10778         signal(SIGFPE, blech_in_list);
10779         sprintf(str, "123.");
10780         sscanf(str, "%lf", &f);  /* f = 123.; */
10781         along = dummy_long((unsigned long)f);
10782         aint = dummy_int((unsigned int)f);
10783         ashort = dummy_short((unsigned short)f);
10784         if (along != (unsigned long)123)
10785                 result |= 4;
10786         if (aint != (unsigned int)123)
10787                 result |= 4;
10788         if (ashort != (unsigned short)123)
10789                 result |= 4;
10790         exit(result);
10791
10792 }
10793 EOCP
10794 set try
10795 if eval $compile_ok; then
10796         $run ./try
10797         castflags=$?
10798 else
10799         echo "(I can't seem to compile the test program--assuming it can't)"
10800         castflags=7
10801 fi
10802 case "$castflags" in
10803 0)      val="$define"
10804         echo "Yup, it can."
10805         ;;
10806 *)      val="$undef"
10807         echo "Nope, it can't."
10808         ;;
10809 esac
10810 set d_castneg
10811 eval $setvar
10812 $rm_try
10813
10814 : see if vprintf exists
10815 echo " "
10816 if set vprintf val -f d_vprintf; eval $csym; $val; then
10817         echo 'vprintf() found.' >&4
10818         val="$define"
10819         $cat >try.c <<EOF
10820 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10821 #$i_varargs I_VARARGS
10822
10823 #$i_stdlib I_STDLIB
10824 #$i_unistd I_UNISTD
10825
10826 #ifdef I_STDARG
10827 #  include <stdarg.h>
10828 #else /* I_VARARGS */
10829 #  include <varargs.h>
10830 #endif
10831
10832 #ifdef I_UNISTD
10833 #  include <unistd.h>
10834 #endif
10835
10836 #ifdef I_STDLIB
10837 #  include <stdlib.h>
10838 #endif
10839
10840 #include <stdio.h> /* vsprintf prototype */
10841
10842 #ifdef I_STDARG
10843 void xxx(int n, ...)
10844 {
10845     va_list args;
10846     char buf[10];
10847     va_start(args, n);
10848     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10849 }
10850 int main() { xxx(1, "foo"); }
10851
10852 #else /* I_VARARGS */
10853
10854 xxx(va_alist)
10855 va_dcl
10856 {
10857     va_list args;
10858     char buf[10];
10859     va_start(args);
10860     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10861 }
10862 int main() { xxx("foo"); }
10863
10864 #endif
10865
10866 EOF
10867         set try
10868         if eval $compile_ok; then
10869                 if $run ./try; then
10870                         echo "Your vsprintf() returns (int)." >&4
10871                         val2="$undef"
10872                 else
10873                         echo "Your vsprintf() returns (char*)." >&4
10874                         val2="$define"
10875                 fi
10876         else
10877                 echo 'I am unable to compile the vsprintf() test program.' >&4
10878                 # We shouldn't get here.  If we do, assume the standard signature,
10879                 # not the old BSD one.
10880                 echo 'Guessing that vsprintf() returns (int).' >&4
10881                 val2="$undef"
10882         fi
10883 else
10884         echo 'vprintf() NOT found.' >&4
10885         val="$undef"
10886         val2="$undef"
10887 fi
10888 $rm_try
10889 set d_vprintf
10890 eval $setvar
10891 val=$val2
10892 set d_charvspr
10893 eval $setvar
10894
10895 : see if chown exists
10896 set chown d_chown
10897 eval $inlibc
10898
10899 : see if chroot exists
10900 set chroot d_chroot
10901 eval $inlibc
10902
10903 : see if chsize exists
10904 set chsize d_chsize
10905 eval $inlibc
10906
10907 : see if class exists
10908 set class d_class
10909 eval $inlibc
10910
10911 : see if clearenv exists
10912 set clearenv d_clearenv
10913 eval $inlibc
10914
10915 hasstruct='varname=$1; struct=$2; shift; shift;
10916 while $test $# -ge 2; do
10917         case "$1" in
10918         $define) echo "#include <$2>";;
10919         esac ;
10920     shift 2;
10921 done > try.c;
10922 echo "int main () { struct $struct foo; }" >> try.c;
10923 set try;
10924 if eval $compile; then
10925         val="$define";
10926 else
10927         val="$undef";
10928 fi;
10929 set $varname;
10930 eval $setvar;
10931 $rm_try'
10932
10933 socketlib=''
10934 sockethdr=''
10935 : see whether socket exists
10936 echo " "
10937 $echo $n "Hmm... $c" >&4
10938 if set socket val -f d_socket; eval $csym; $val; then
10939         echo "Looks like you have Berkeley networking support." >&4
10940         d_socket="$define"
10941         if set setsockopt val -f; eval $csym; $val; then
10942                 d_oldsock="$undef"
10943         else
10944                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10945                 d_oldsock="$define"
10946         fi
10947 else
10948         if $contains socklib libc.list >/dev/null 2>&1; then
10949                 echo "Looks like you have Berkeley networking support." >&4
10950                 d_socket="$define"
10951                 : we will have to assume that it supports the 4.2 BSD interface
10952                 d_oldsock="$undef"
10953         else
10954                 echo "You don't have Berkeley networking in libc$_a..." >&4
10955                 if test "X$d_socket" = "X$define"; then
10956                    echo "...but you seem to believe that you have sockets." >&4
10957                 else
10958                         for net in net socket
10959                         do
10960                                 if test -f /usr/lib/lib$net$_a; then
10961                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10962                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10963                                         if $contains socket libc.list >/dev/null 2>&1; then
10964                                                 d_socket="$define"
10965                                                 socketlib="-l$net"
10966                                                 case "$net" in
10967                                                 net)
10968                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10969                                                         sockethdr="-I/usr/netinclude"
10970                                                         ;;
10971                                                 esac
10972                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10973                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10974                                                         d_oldsock="$undef"
10975                                                 else
10976                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10977                                                         d_oldsock="$define"
10978                                                 fi
10979                                                 break
10980                                         fi
10981                                 fi
10982                         done
10983                         if test "X$d_socket" != "X$define"; then
10984                            echo "or anywhere else I see." >&4
10985                            d_socket="$undef"
10986                            d_oldsock="$undef"
10987                         fi
10988                 fi
10989         fi
10990 fi
10991
10992 : see if socketpair exists
10993 set socketpair d_sockpair
10994 eval $inlibc
10995
10996
10997 echo " "
10998 echo "Checking the availability of certain socket constants..." >&4
10999 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11000         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11001         $cat >try.c <<EOF
11002 #include <sys/types.h>
11003 #include <sys/socket.h>
11004 int main() {
11005     int i = $ENUM;
11006 }
11007 EOF
11008         val="$undef"
11009         set try; if eval $compile; then
11010                 val="$define"
11011         fi
11012         set d_${enum}; eval $setvar
11013         $rm_try
11014 done
11015
11016 : see if this is a sys/uio.h system
11017 set sys/uio.h i_sysuio
11018 eval $inhdr
11019
11020
11021 echo " "
11022 echo "Checking to see if your system supports struct cmsghdr..." >&4
11023 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11024 eval $hasstruct
11025 case "$d_cmsghdr_s" in
11026 "$define")      echo "Yes, it does."   ;;
11027 *)              echo "No, it doesn't." ;;
11028 esac
11029
11030
11031 : check for const keyword
11032 echo " "
11033 echo 'Checking to see if your C compiler knows about "const"...' >&4
11034 $cat >const.c <<'EOCP'
11035 typedef struct spug { int drokk; } spug;
11036 int main()
11037 {
11038         const char *foo;
11039         const spug y = { 0 };
11040 }
11041 EOCP
11042 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11043         val="$define"
11044         echo "Yup, it does."
11045 else
11046         val="$undef"
11047         echo "Nope, it doesn't."
11048 fi
11049 set d_const
11050 eval $setvar
11051
11052 : see if copysignl exists
11053 set copysignl d_copysignl
11054 eval $inlibc
11055
11056 : see if crypt exists
11057 echo " "
11058 set crypt d_crypt
11059 eval $inlibc
11060 case "$d_crypt" in
11061 $define) cryptlib='' ;;
11062 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11063                 echo 'crypt() found.' >&4
11064                 val="$define"
11065                 cryptlib=''
11066         else
11067                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11068                 if $test -z "$cryptlib"; then
11069                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11070                 else
11071                         cryptlib=-lcrypt
11072                 fi
11073                 if $test -z "$cryptlib"; then
11074                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11075                 else
11076                         cryptlib=-lcrypt
11077                 fi
11078                 if $test -z "$cryptlib"; then
11079                         cryptlib=`./loc libcrypt$_a "" $libpth`
11080                 else
11081                         cryptlib=-lcrypt
11082                 fi
11083                 if $test -z "$cryptlib"; then
11084                         echo 'crypt() NOT found.' >&4
11085                         val="$undef"
11086                 else
11087                         val="$define"
11088                 fi
11089         fi
11090         set d_crypt
11091         eval $setvar
11092         ;;
11093 esac
11094
11095 : see if this is a crypt.h system
11096 set crypt.h i_crypt
11097 eval $inhdr
11098
11099 : see if crypt_r exists
11100 set crypt_r d_crypt_r
11101 eval $inlibc
11102 case "$d_crypt_r" in
11103 "$define")
11104         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11105         case "$d_crypt_r_proto:$usethreads" in
11106         ":define")      d_crypt_r_proto=define
11107                 set d_crypt_r_proto crypt_r $hdrs
11108                 eval $hasproto ;;
11109         *)      ;;
11110         esac
11111         case "$d_crypt_r_proto" in
11112         define)
11113         case "$crypt_r_proto" in
11114         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11115         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11116         esac
11117         case "$crypt_r_proto" in
11118         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11119         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11120         esac
11121         case "$crypt_r_proto" in
11122         ''|0)   d_crypt_r=undef
11123                 crypt_r_proto=0
11124                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11125         * )     case "$crypt_r_proto" in
11126                 REENTRANT_PROTO*) ;;
11127                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11128                 esac
11129                 echo "Prototype: $try" ;;
11130         esac
11131         ;;
11132         *)      case "$usethreads" in
11133                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11134                 esac
11135                 d_crypt_r=undef
11136                 crypt_r_proto=0
11137                 ;;
11138         esac
11139         ;;
11140 *)      crypt_r_proto=0
11141         ;;
11142 esac
11143
11144 : get csh whereabouts
11145 case "$csh" in
11146 'csh') val="$undef" ;;
11147 *) val="$define" ;;
11148 esac
11149 set d_csh
11150 eval $setvar
11151 : Respect a hint or command line value for full_csh.
11152 case "$full_csh" in
11153 '') full_csh=$csh ;;
11154 esac
11155
11156 : see if ctermid exists
11157 set ctermid d_ctermid
11158 eval $inlibc
11159
11160 : see if ctermid_r exists
11161 set ctermid_r d_ctermid_r
11162 eval $inlibc
11163 case "$d_ctermid_r" in
11164 "$define")
11165         hdrs="$i_systypes sys/types.h define stdio.h "
11166         case "$d_ctermid_r_proto:$usethreads" in
11167         ":define")      d_ctermid_r_proto=define
11168                 set d_ctermid_r_proto ctermid_r $hdrs
11169                 eval $hasproto ;;
11170         *)      ;;
11171         esac
11172         case "$d_ctermid_r_proto" in
11173         define)
11174         case "$ctermid_r_proto" in
11175         ''|0) try='char* ctermid_r(char*);'
11176         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11177         esac
11178         case "$ctermid_r_proto" in
11179         ''|0)   d_ctermid_r=undef
11180                 ctermid_r_proto=0
11181                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11182         * )     case "$ctermid_r_proto" in
11183                 REENTRANT_PROTO*) ;;
11184                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11185                 esac
11186                 echo "Prototype: $try" ;;
11187         esac
11188         ;;
11189         *)      case "$usethreads" in
11190                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11191                 esac
11192                 d_ctermid_r=undef
11193                 ctermid_r_proto=0
11194                 ;;
11195         esac
11196         ;;
11197 *)      ctermid_r_proto=0
11198         ;;
11199 esac
11200
11201 : see if ctime_r exists
11202 set ctime_r d_ctime_r
11203 eval $inlibc
11204 case "$d_ctime_r" in
11205 "$define")
11206         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11207         case "$d_ctime_r_proto:$usethreads" in
11208         ":define")      d_ctime_r_proto=define
11209                 set d_ctime_r_proto ctime_r $hdrs
11210                 eval $hasproto ;;
11211         *)      ;;
11212         esac
11213         case "$d_ctime_r_proto" in
11214         define)
11215         case "$ctime_r_proto" in
11216         ''|0) try='char* ctime_r(const time_t*, char*);'
11217         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11218         esac
11219         case "$ctime_r_proto" in
11220         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11221         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11222         esac
11223         case "$ctime_r_proto" in
11224         ''|0) try='int ctime_r(const time_t*, char*);'
11225         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11226         esac
11227         case "$ctime_r_proto" in
11228         ''|0) try='int ctime_r(const time_t*, char*, int);'
11229         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11230         esac
11231         case "$ctime_r_proto" in
11232         ''|0)   d_ctime_r=undef
11233                 ctime_r_proto=0
11234                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11235         * )     case "$ctime_r_proto" in
11236                 REENTRANT_PROTO*) ;;
11237                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11238                 esac
11239                 echo "Prototype: $try" ;;
11240         esac
11241         ;;
11242         *)      case "$usethreads" in
11243                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11244                 esac
11245                 d_ctime_r=undef
11246                 ctime_r_proto=0
11247                 ;;
11248         esac
11249         ;;
11250 *)      ctime_r_proto=0
11251         ;;
11252 esac
11253
11254 : see if cuserid exists
11255 set cuserid d_cuserid
11256 eval $inlibc
11257
11258 : see if this is a limits.h system
11259 set limits.h i_limits
11260 eval $inhdr
11261
11262 : see if this is a float.h system
11263 set float.h i_float
11264 eval $inhdr
11265
11266 : See if number of significant digits in a double precision number is known
11267 echo " "
11268 $cat >dbl_dig.c <<EOM
11269 #$i_limits I_LIMITS
11270 #$i_float I_FLOAT
11271 #ifdef I_LIMITS
11272 #include <limits.h>
11273 #endif
11274 #ifdef I_FLOAT
11275 #include <float.h>
11276 #endif
11277 #ifdef DBL_DIG
11278 printf("Contains DBL_DIG");
11279 #endif
11280 EOM
11281 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11282 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11283         echo "DBL_DIG found." >&4
11284         val="$define"
11285 else
11286         echo "DBL_DIG NOT found." >&4
11287         val="$undef"
11288 fi
11289 $rm -f dbl_dig.?
11290 set d_dbl_dig
11291 eval $setvar
11292
11293 : see if dbm.h is available
11294 : see if dbmclose exists
11295 set dbmclose d_dbmclose
11296 eval $inlibc
11297
11298 case "$d_dbmclose" in
11299 $define)
11300         set dbm.h i_dbm
11301         eval $inhdr
11302         case "$i_dbm" in
11303         $define)
11304                 val="$undef"
11305                 set i_rpcsvcdbm
11306                 eval $setvar
11307                 ;;
11308         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11309                 eval $inhdr
11310                 ;;
11311         esac
11312         ;;
11313 *)      echo "We won't be including <dbm.h>"
11314         val="$undef"
11315         set i_dbm
11316         eval $setvar
11317         val="$undef"
11318         set i_rpcsvcdbm
11319         eval $setvar
11320         ;;
11321 esac
11322
11323 : see if prototype for dbminit is available
11324 echo " "
11325 set d_dbminitproto dbminit $i_dbm dbm.h
11326 eval $hasproto
11327
11328 : see if difftime exists
11329 set difftime d_difftime
11330 eval $inlibc
11331
11332 : see if this is a dirent system
11333 echo " "
11334 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11335         val="$define"
11336         echo "<dirent.h> found." >&4
11337 else
11338         val="$undef"
11339         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11340                 echo "<sys/dir.h> found." >&4
11341                 echo " "
11342         else
11343                 xinc=`./findhdr sys/ndir.h`
11344         fi
11345         echo "<dirent.h> NOT found." >&4
11346 fi
11347 set i_dirent
11348 eval $setvar
11349
11350 : Look for type of directory structure.
11351 echo " "
11352 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11353
11354 case "$direntrytype" in
11355 ''|' ')
11356         case "$i_dirent" in
11357         $define) guess1='struct dirent' ;;
11358         *) guess1='struct direct'  ;;
11359         esac
11360         ;;
11361 *)      guess1="$direntrytype"
11362         ;;
11363 esac
11364
11365 case "$guess1" in
11366 'struct dirent') guess2='struct direct' ;;
11367 *) guess2='struct dirent' ;;
11368 esac
11369
11370 if $contains "$guess1" try.c >/dev/null 2>&1; then
11371         direntrytype="$guess1"
11372         echo "Your directory entries are $direntrytype." >&4
11373 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11374         direntrytype="$guess2"
11375         echo "Your directory entries seem to be $direntrytype." >&4
11376 else
11377         echo "I don't recognize your system's directory entries." >&4
11378         rp="What type is used for directory entries on this system?"
11379         dflt="$guess1"
11380         . ./myread
11381         direntrytype="$ans"
11382 fi
11383 $rm_try
11384
11385 : see if the directory entry stores field length
11386 echo " "
11387 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11388 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11389         echo "Good, your directory entry keeps length information in d_namlen." >&4
11390         val="$define"
11391 else
11392         echo "Your directory entry does not know about the d_namlen field." >&4
11393         val="$undef"
11394 fi
11395 set d_dirnamlen
11396 eval $setvar
11397 $rm_try
11398
11399 : Look for DIR.dd_fd
11400 case "$i_dirent" in
11401 "$define")
11402     echo "Checking to see if DIR has a dd_fd member variable" >&4
11403     $cat >try.c <<EOCP
11404 #$i_stdlib I_STDLIB
11405 #ifdef I_STDLIB
11406 #include <stdlib.h>
11407 #endif
11408 #include <dirent.h>
11409
11410 int main() {
11411     DIR dir;
11412     dir.dd_fd = 1;
11413     return 0;
11414 }
11415 EOCP
11416     val=$undef
11417     set try
11418     if eval $compile; then
11419         echo "Yes, it does."
11420         val="$define"
11421     else
11422         echo "No, it does not."
11423         val="$undef"
11424     fi
11425     ;;
11426 *)
11427     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11428     val="$undef"
11429     ;;
11430 esac
11431 set d_dir_dd_fd
11432 eval $setvar
11433 $rm_try
11434
11435 : see if this is an sysdir system
11436 set sys/dir.h i_sysdir
11437 eval $inhdr
11438
11439 : see if this is an sysndir system
11440 set sys/ndir.h i_sysndir
11441 eval $inhdr
11442
11443 : Look for dirfd
11444 echo " "
11445 $cat >dirfd.c <<EOM
11446 #include <stdio.h>
11447 #$i_stdlib I_STDLIB
11448 #ifdef I_STDLIB
11449 #include <stdlib.h>
11450 #endif
11451 #$i_dirent I_DIRENT             /**/
11452 #$i_sysdir I_SYS_DIR            /**/
11453 #$i_sysndir I_SYS_NDIR          /**/
11454 #$i_systypes I_SYS_TYPES        /**/
11455 #if defined(I_SYS_TYPES)
11456 #include <sys/types.h>
11457 #endif
11458 #if defined(I_DIRENT)
11459 #include <dirent.h>
11460 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11461 #include <sys/dir.h>
11462 #endif
11463 #else
11464 #ifdef I_SYS_NDIR
11465 #include <sys/ndir.h>
11466 #else
11467 #ifdef I_SYS_DIR
11468 #ifdef hp9000s500
11469 #include <ndir.h>       /* may be wrong in the future */
11470 #else
11471 #include <sys/dir.h>
11472 #endif
11473 #endif
11474 #endif
11475 #endif 
11476 int main() {
11477         DIR *dirp = opendir(".");
11478         if (dirfd(dirp) >= 0)
11479                 exit(0);
11480         else
11481                 exit(1);
11482 }
11483 EOM
11484 val=$undef
11485 set dirfd
11486 if eval $compile; then
11487         val="$define"
11488 fi
11489 case "$val" in
11490 $define)        echo "dirfd() found." >&4       ;;
11491 *)              echo "dirfd() NOT found." >&4   ;;
11492 esac
11493 set d_dirfd
11494 eval $setvar
11495 $rm -f dirfd*
11496
11497 : see if dlerror exists
11498 xxx_runnm="$runnm"
11499 runnm=false
11500 set dlerror d_dlerror
11501 eval $inlibc
11502 runnm="$xxx_runnm"
11503
11504 : see if dlfcn is available
11505 set dlfcn.h i_dlfcn
11506 eval $inhdr
11507
11508 case "$usedl" in
11509 $define|y|true)
11510         $cat << EOM
11511
11512 On a few systems, the dynamically loaded modules that perl generates and uses
11513 will need a different extension than shared libs. The default will probably
11514 be appropriate.
11515
11516 EOM
11517         case "$dlext" in
11518         '')     dflt="$so" ;;
11519         *)      dflt="$dlext" ;;
11520         esac
11521         rp='What is the extension of dynamically loaded modules'
11522         . ./myread
11523         dlext="$ans"
11524         ;;
11525 *)
11526         dlext="none"
11527         ;;
11528 esac
11529
11530 : Check if dlsym need a leading underscore
11531 echo " "
11532 val="$undef"
11533
11534 case "$dlsrc" in
11535 dl_dlopen.xs)
11536         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11537         $cat >dyna.c <<'EOM'
11538 fred () { }
11539 EOM
11540
11541 $cat >fred.c<<EOM
11542
11543 #include <stdio.h>
11544 #$i_stdlib I_STDLIB
11545 #ifdef I_STDLIB
11546 #include <stdlib.h>
11547 #endif
11548 #$i_dlfcn I_DLFCN
11549 #ifdef I_DLFCN
11550 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11551 #else
11552 #include <sys/types.h>
11553 #include <nlist.h>
11554 #include <link.h>
11555 #endif
11556
11557 extern int fred() ;
11558
11559 int main()
11560 {
11561     void * handle ;
11562     void * symbol ;
11563 #ifndef RTLD_LAZY
11564     int mode = 1 ;
11565 #else
11566     int mode = RTLD_LAZY ;
11567 #endif
11568     handle = dlopen("./dyna.$dlext", mode) ;
11569     if (handle == NULL) {
11570         printf ("1\n") ;
11571         fflush (stdout) ;
11572         exit(0);
11573     }
11574     symbol = dlsym(handle, "fred") ;
11575     if (symbol == NULL) {
11576         /* try putting a leading underscore */
11577         symbol = dlsym(handle, "_fred") ;
11578         if (symbol == NULL) {
11579             printf ("2\n") ;
11580             fflush (stdout) ;
11581             exit(0);
11582         }
11583         printf ("3\n") ;
11584     }
11585     else
11586         printf ("4\n") ;
11587     fflush (stdout) ;
11588     exit(0);
11589 }
11590 EOM
11591         : Call the object file tmp-dyna.o in case dlext=o.
11592         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11593                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11594                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11595                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11596                 xxx=`$run ./fred`
11597                 case $xxx in
11598                 1)      echo "Test program failed using dlopen." >&4
11599                         echo "Perhaps you should not use dynamic loading." >&4;;
11600                 2)      echo "Test program failed using dlsym." >&4
11601                         echo "Perhaps you should not use dynamic loading." >&4;;
11602                 3)      echo "dlsym needs a leading underscore" >&4
11603                         val="$define" ;;
11604                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11605                 esac
11606         else
11607                 echo "I can't compile and run the test program." >&4
11608                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11609         fi
11610         ;;
11611 esac
11612                 
11613 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11614
11615 set d_dlsymun
11616 eval $setvar
11617
11618 : see if drand48_r exists
11619 set drand48_r d_drand48_r
11620 eval $inlibc
11621 case "$d_drand48_r" in
11622 "$define")
11623         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11624         case "$d_drand48_r_proto:$usethreads" in
11625         ":define")      d_drand48_r_proto=define
11626                 set d_drand48_r_proto drand48_r $hdrs
11627                 eval $hasproto ;;
11628         *)      ;;
11629         esac
11630         case "$d_drand48_r_proto" in
11631         define)
11632         case "$drand48_r_proto" in
11633         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11634         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11635         esac
11636         case "$drand48_r_proto" in
11637         ''|0)   d_drand48_r=undef
11638                 drand48_r_proto=0
11639                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11640         * )     case "$drand48_r_proto" in
11641                 REENTRANT_PROTO*) ;;
11642                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11643                 esac
11644                 echo "Prototype: $try" ;;
11645         esac
11646         ;;
11647         *)      case "$usethreads" in
11648                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11649                 esac
11650                 d_drand48_r=undef
11651                 drand48_r_proto=0
11652                 ;;
11653         esac
11654         ;;
11655 *)      drand48_r_proto=0
11656         ;;
11657 esac
11658
11659 : see if prototype for drand48 is available
11660 echo " "
11661 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11662 eval $hasproto
11663
11664 : see if dup2 exists
11665 set dup2 d_dup2
11666 eval $inlibc
11667
11668 : see if eaccess exists
11669 set eaccess d_eaccess
11670 eval $inlibc
11671
11672 : see if endgrent exists
11673 set endgrent d_endgrent
11674 eval $inlibc
11675
11676 : see if this is an grp system
11677 set grp.h i_grp
11678 eval $inhdr
11679
11680 case "$i_grp" in
11681 $define)
11682         xxx=`./findhdr grp.h`
11683         $cppstdin $cppflags $cppminus < $xxx >$$.h
11684
11685         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11686                 val="$define"
11687         else
11688                 val="$undef"
11689         fi
11690         set d_grpasswd
11691         eval $setvar
11692
11693         $rm -f $$.h
11694         ;;
11695 *)
11696         val="$undef";
11697         set d_grpasswd; eval $setvar
11698         ;;
11699 esac
11700
11701 : see if endgrent_r exists
11702 set endgrent_r d_endgrent_r
11703 eval $inlibc
11704 case "$d_endgrent_r" in
11705 "$define")
11706         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11707         case "$d_endgrent_r_proto:$usethreads" in
11708         ":define")      d_endgrent_r_proto=define
11709                 set d_endgrent_r_proto endgrent_r $hdrs
11710                 eval $hasproto ;;
11711         *)      ;;
11712         esac
11713         case "$d_endgrent_r_proto" in
11714         define)
11715         case "$endgrent_r_proto" in
11716         ''|0) try='int endgrent_r(FILE**);'
11717         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11718         esac
11719         case "$endgrent_r_proto" in
11720         ''|0) try='void endgrent_r(FILE**);'
11721         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11722         esac
11723         case "$endgrent_r_proto" in
11724         ''|0)   d_endgrent_r=undef
11725                 endgrent_r_proto=0
11726                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11727         * )     case "$endgrent_r_proto" in
11728                 REENTRANT_PROTO*) ;;
11729                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11730                 esac
11731                 echo "Prototype: $try" ;;
11732         esac
11733         ;;
11734         *)      case "$usethreads" in
11735                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11736                 esac
11737                 d_endgrent_r=undef
11738                 endgrent_r_proto=0
11739                 ;;
11740         esac
11741         ;;
11742 *)      endgrent_r_proto=0
11743         ;;
11744 esac
11745
11746 : see if endhostent exists
11747 set endhostent d_endhent
11748 eval $inlibc
11749
11750 : see if this is a netdb.h system
11751 set netdb.h i_netdb
11752 eval $inhdr
11753
11754 : see if endhostent_r exists
11755 set endhostent_r d_endhostent_r
11756 eval $inlibc
11757 case "$d_endhostent_r" in
11758 "$define")
11759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11760         case "$d_endhostent_r_proto:$usethreads" in
11761         ":define")      d_endhostent_r_proto=define
11762                 set d_endhostent_r_proto endhostent_r $hdrs
11763                 eval $hasproto ;;
11764         *)      ;;
11765         esac
11766         case "$d_endhostent_r_proto" in
11767         define)
11768         case "$endhostent_r_proto" in
11769         ''|0) try='int endhostent_r(struct hostent_data*);'
11770         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11771         esac
11772         case "$endhostent_r_proto" in
11773         ''|0) try='void endhostent_r(struct hostent_data*);'
11774         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11775         esac
11776         case "$endhostent_r_proto" in
11777         ''|0)   d_endhostent_r=undef
11778                 endhostent_r_proto=0
11779                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11780         * )     case "$endhostent_r_proto" in
11781                 REENTRANT_PROTO*) ;;
11782                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11783                 esac
11784                 echo "Prototype: $try" ;;
11785         esac
11786         ;;
11787         *)      case "$usethreads" in
11788                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11789                 esac
11790                 d_endhostent_r=undef
11791                 endhostent_r_proto=0
11792                 ;;
11793         esac
11794         ;;
11795 *)      endhostent_r_proto=0
11796         ;;
11797 esac
11798
11799 : see if endnetent exists
11800 set endnetent d_endnent
11801 eval $inlibc
11802
11803 : see if endnetent_r exists
11804 set endnetent_r d_endnetent_r
11805 eval $inlibc
11806 case "$d_endnetent_r" in
11807 "$define")
11808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11809         case "$d_endnetent_r_proto:$usethreads" in
11810         ":define")      d_endnetent_r_proto=define
11811                 set d_endnetent_r_proto endnetent_r $hdrs
11812                 eval $hasproto ;;
11813         *)      ;;
11814         esac
11815         case "$d_endnetent_r_proto" in
11816         define)
11817         case "$endnetent_r_proto" in
11818         ''|0) try='int endnetent_r(struct netent_data*);'
11819         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11820         esac
11821         case "$endnetent_r_proto" in
11822         ''|0) try='void endnetent_r(struct netent_data*);'
11823         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11824         esac
11825         case "$endnetent_r_proto" in
11826         ''|0)   d_endnetent_r=undef
11827                 endnetent_r_proto=0
11828                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11829         * )     case "$endnetent_r_proto" in
11830                 REENTRANT_PROTO*) ;;
11831                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11832                 esac
11833                 echo "Prototype: $try" ;;
11834         esac
11835         ;;
11836         *)      case "$usethreads" in
11837                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11838                 esac
11839                 d_endnetent_r=undef
11840                 endnetent_r_proto=0
11841                 ;;
11842         esac
11843         ;;
11844 *)      endnetent_r_proto=0
11845         ;;
11846 esac
11847
11848 : see if endprotoent exists
11849 set endprotoent d_endpent
11850 eval $inlibc
11851
11852 : see if endprotoent_r exists
11853 set endprotoent_r d_endprotoent_r
11854 eval $inlibc
11855 case "$d_endprotoent_r" in
11856 "$define")
11857         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11858         case "$d_endprotoent_r_proto:$usethreads" in
11859         ":define")      d_endprotoent_r_proto=define
11860                 set d_endprotoent_r_proto endprotoent_r $hdrs
11861                 eval $hasproto ;;
11862         *)      ;;
11863         esac
11864         case "$d_endprotoent_r_proto" in
11865         define)
11866         case "$endprotoent_r_proto" in
11867         ''|0) try='int endprotoent_r(struct protoent_data*);'
11868         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11869         esac
11870         case "$endprotoent_r_proto" in
11871         ''|0) try='void endprotoent_r(struct protoent_data*);'
11872         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11873         esac
11874         case "$endprotoent_r_proto" in
11875         ''|0)   d_endprotoent_r=undef
11876                 endprotoent_r_proto=0
11877                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11878         * )     case "$endprotoent_r_proto" in
11879                 REENTRANT_PROTO*) ;;
11880                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11881                 esac
11882                 echo "Prototype: $try" ;;
11883         esac
11884         ;;
11885         *)      case "$usethreads" in
11886                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11887                 esac
11888                 d_endprotoent_r=undef
11889                 endprotoent_r_proto=0
11890                 ;;
11891         esac
11892         ;;
11893 *)      endprotoent_r_proto=0
11894         ;;
11895 esac
11896
11897 : see if endpwent exists
11898 set endpwent d_endpwent
11899 eval $inlibc
11900
11901 : see if this is a pwd.h system
11902 set pwd.h i_pwd
11903 eval $inhdr
11904
11905 case "$i_pwd" in
11906 $define)
11907         xxx=`./findhdr pwd.h`
11908         $cppstdin $cppflags $cppminus < $xxx >$$.h
11909
11910         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11911                 val="$define"
11912         else
11913                 val="$undef"
11914         fi
11915         set d_pwquota
11916         eval $setvar
11917
11918         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11919                 val="$define"
11920         else
11921                 val="$undef"
11922         fi
11923         set d_pwage
11924         eval $setvar
11925
11926         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11927                 val="$define"
11928         else
11929                 val="$undef"
11930         fi
11931         set d_pwchange
11932         eval $setvar
11933
11934         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11935                 val="$define"
11936         else
11937                 val="$undef"
11938         fi
11939         set d_pwclass
11940         eval $setvar
11941
11942         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11943                 val="$define"
11944         else
11945                 val="$undef"
11946         fi
11947         set d_pwexpire
11948         eval $setvar
11949
11950         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11951                 val="$define"
11952         else
11953                 val="$undef"
11954         fi
11955         set d_pwcomment
11956         eval $setvar
11957
11958         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11959                 val="$define"
11960         else
11961                 val="$undef"
11962         fi
11963         set d_pwgecos
11964         eval $setvar
11965
11966         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11967                 val="$define"
11968         else
11969                 val="$undef"
11970         fi
11971         set d_pwpasswd
11972         eval $setvar
11973
11974         $rm -f $$.h
11975         ;;
11976 *)
11977         val="$undef"; 
11978         set d_pwquota; eval $setvar
11979         set d_pwage; eval $setvar
11980         set d_pwchange; eval $setvar
11981         set d_pwclass; eval $setvar
11982         set d_pwexpire; eval $setvar
11983         set d_pwcomment; eval $setvar
11984         set d_pwgecos; eval $setvar
11985         set d_pwpasswd; eval $setvar
11986         ;;
11987 esac
11988
11989 : see if endpwent_r exists
11990 set endpwent_r d_endpwent_r
11991 eval $inlibc
11992 case "$d_endpwent_r" in
11993 "$define")
11994         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11995         case "$d_endpwent_r_proto:$usethreads" in
11996         ":define")      d_endpwent_r_proto=define
11997                 set d_endpwent_r_proto endpwent_r $hdrs
11998                 eval $hasproto ;;
11999         *)      ;;
12000         esac
12001         case "$d_endpwent_r_proto" in
12002         define)
12003         case "$endpwent_r_proto" in
12004         ''|0) try='int endpwent_r(FILE**);'
12005         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12006         esac
12007         case "$endpwent_r_proto" in
12008         ''|0) try='void endpwent_r(FILE**);'
12009         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12010         esac
12011         case "$endpwent_r_proto" in
12012         ''|0)   d_endpwent_r=undef
12013                 endpwent_r_proto=0
12014                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12015         * )     case "$endpwent_r_proto" in
12016                 REENTRANT_PROTO*) ;;
12017                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12018                 esac
12019                 echo "Prototype: $try" ;;
12020         esac
12021         ;;
12022         *)      case "$usethreads" in
12023                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12024                 esac
12025                 d_endpwent_r=undef
12026                 endpwent_r_proto=0
12027                 ;;
12028         esac
12029         ;;
12030 *)      endpwent_r_proto=0
12031         ;;
12032 esac
12033
12034 : see if endservent exists
12035 set endservent d_endsent
12036 eval $inlibc
12037
12038 : see if endservent_r exists
12039 set endservent_r d_endservent_r
12040 eval $inlibc
12041 case "$d_endservent_r" in
12042 "$define")
12043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12044         case "$d_endservent_r_proto:$usethreads" in
12045         ":define")      d_endservent_r_proto=define
12046                 set d_endservent_r_proto endservent_r $hdrs
12047                 eval $hasproto ;;
12048         *)      ;;
12049         esac
12050         case "$d_endservent_r_proto" in
12051         define)
12052         case "$endservent_r_proto" in
12053         ''|0) try='int endservent_r(struct servent_data*);'
12054         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12055         esac
12056         case "$endservent_r_proto" in
12057         ''|0) try='void endservent_r(struct servent_data*);'
12058         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12059         esac
12060         case "$endservent_r_proto" in
12061         ''|0)   d_endservent_r=undef
12062                 endservent_r_proto=0
12063                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12064         * )     case "$endservent_r_proto" in
12065                 REENTRANT_PROTO*) ;;
12066                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12067                 esac
12068                 echo "Prototype: $try" ;;
12069         esac
12070         ;;
12071         *)      case "$usethreads" in
12072                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12073                 esac
12074                 d_endservent_r=undef
12075                 endservent_r_proto=0
12076                 ;;
12077         esac
12078         ;;
12079 *)      endservent_r_proto=0
12080         ;;
12081 esac
12082
12083 : Locate the flags for 'open()'
12084 echo " "
12085 $cat >try.c <<EOCP
12086 #include <sys/types.h>
12087 #ifdef I_FCNTL
12088 #include <fcntl.h>
12089 #endif
12090 #ifdef I_SYS_FILE
12091 #include <sys/file.h>
12092 #endif
12093 #$i_stdlib I_STDLIB
12094 #ifdef I_STDLIB
12095 #include <stdlib.h>
12096 #endif
12097 int main() {
12098         if(O_RDONLY);
12099 #ifdef O_TRUNC
12100         exit(0);
12101 #else
12102         exit(1);
12103 #endif
12104 }
12105 EOCP
12106 : check sys/file.h first to get FREAD on Sun
12107 if $test `./findhdr sys/file.h` && \
12108                 set try -DI_SYS_FILE && eval $compile; then
12109         h_sysfile=true;
12110         echo "<sys/file.h> defines the O_* constants..." >&4
12111         if $run ./try; then
12112                 echo "and you have the 3 argument form of open()." >&4
12113                 val="$define"
12114         else
12115                 echo "but not the 3 argument form of open().  Oh, well." >&4
12116                 val="$undef"
12117         fi
12118 elif $test `./findhdr fcntl.h` && \
12119                 set try -DI_FCNTL && eval $compile; then
12120         h_fcntl=true;
12121         echo "<fcntl.h> defines the O_* constants..." >&4
12122         if $run ./try; then
12123                 echo "and you have the 3 argument form of open()." >&4
12124                 val="$define"
12125         else
12126                 echo "but not the 3 argument form of open().  Oh, well." >&4
12127                 val="$undef"
12128         fi
12129 else
12130         val="$undef"
12131         echo "I can't find the O_* constant definitions!  You got problems." >&4
12132 fi
12133 set d_open3
12134 eval $setvar
12135 $rm_try
12136
12137 : see which of string.h or strings.h is needed
12138 echo " "
12139 strings=`./findhdr string.h`
12140 if $test "$strings" && $test -r "$strings"; then
12141         echo "Using <string.h> instead of <strings.h>." >&4
12142         val="$define"
12143 else
12144         val="$undef"
12145         strings=`./findhdr strings.h`
12146         if $test "$strings" && $test -r "$strings"; then
12147                 echo "Using <strings.h> instead of <string.h>." >&4
12148         else
12149                 echo "No string header found -- You'll surely have problems." >&4
12150         fi
12151 fi
12152 set i_string
12153 eval $setvar
12154 case "$i_string" in
12155 "$undef") strings=`./findhdr strings.h`;;
12156 *)        strings=`./findhdr string.h`;;
12157 esac
12158
12159 : see if this is a sys/file.h system
12160 val=''
12161 set sys/file.h val
12162 eval $inhdr
12163
12164 : do we need to include sys/file.h ?
12165 case "$val" in
12166 "$define")
12167         echo " "
12168         if $h_sysfile; then
12169                 val="$define"
12170                 echo "We'll be including <sys/file.h>." >&4
12171         else
12172                 val="$undef"
12173                 echo "We won't be including <sys/file.h>." >&4
12174         fi
12175         ;;
12176 *)
12177         h_sysfile=false
12178         ;;
12179 esac
12180 set i_sysfile
12181 eval $setvar
12182
12183 : see if fcntl.h is there
12184 val=''
12185 set fcntl.h val
12186 eval $inhdr
12187
12188 : see if we can include fcntl.h
12189 case "$val" in
12190 "$define")
12191         echo " "
12192         if $h_fcntl; then
12193                 val="$define"
12194                 echo "We'll be including <fcntl.h>." >&4
12195         else
12196                 val="$undef"
12197                 if $h_sysfile; then
12198         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12199                 else
12200                         echo "We won't be including <fcntl.h>." >&4
12201                 fi
12202         fi
12203         ;;
12204 *)
12205         h_fcntl=false
12206         val="$undef"
12207         ;;
12208 esac
12209 set i_fcntl
12210 eval $setvar
12211
12212 : see if fork exists
12213 set fork d_fork
12214 eval $inlibc
12215
12216 : see if pipe exists
12217 set pipe d_pipe
12218 eval $inlibc
12219
12220 : check for non-blocking I/O stuff
12221 case "$h_sysfile" in
12222 true) echo "#include <sys/file.h>" > head.c;;
12223 *)
12224        case "$h_fcntl" in
12225        true) echo "#include <fcntl.h>" > head.c;;
12226        *) echo "#include <sys/fcntl.h>" > head.c;;
12227        esac
12228        ;;
12229 esac
12230 echo " "
12231 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12232 case "$o_nonblock" in
12233 '')
12234         $cat head.c > try.c
12235         $cat >>try.c <<EOCP
12236 #include <stdio.h>
12237 #$i_stdlib I_STDLIB
12238 #ifdef I_STDLIB
12239 #include <stdlib.h>
12240 #endif
12241 #$i_fcntl I_FCNTL
12242 #ifdef I_FCNTL
12243 #include <fcntl.h>
12244 #endif
12245 int main() {
12246 #ifdef O_NONBLOCK
12247         printf("O_NONBLOCK\n");
12248         exit(0);
12249 #endif
12250 #ifdef O_NDELAY
12251         printf("O_NDELAY\n");
12252         exit(0);
12253 #endif
12254 #ifdef FNDELAY
12255         printf("FNDELAY\n");
12256         exit(0);
12257 #endif
12258         exit(0);
12259 }
12260 EOCP
12261         set try
12262         if eval $compile_ok; then
12263                 o_nonblock=`$run ./try`
12264                 case "$o_nonblock" in
12265                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12266                 *) echo "Seems like we can use $o_nonblock.";;
12267                 esac
12268         else
12269                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12270         fi
12271         ;;
12272 *) echo "Using $hint value $o_nonblock.";;
12273 esac
12274 $rm_try
12275
12276 echo " "
12277 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12278 case "$eagain" in
12279 '')
12280         case "$d_fork:$d_pipe" in
12281         define:define)
12282         $cat head.c > try.c
12283         $cat >>try.c <<EOCP
12284 #include <errno.h>
12285 #include <sys/types.h>
12286 #include <signal.h>
12287 #include <stdio.h>
12288 #$i_stdlib I_STDLIB
12289 #ifdef I_STDLIB
12290 #include <stdlib.h>
12291 #endif
12292 #$i_fcntl I_FCNTL
12293 #ifdef I_FCNTL
12294 #include <fcntl.h>
12295 #endif
12296 #define MY_O_NONBLOCK $o_nonblock
12297 #ifndef errno  /* XXX need better Configure test */
12298 extern int errno;
12299 #endif
12300 #$i_unistd I_UNISTD
12301 #ifdef I_UNISTD
12302 #include <unistd.h>
12303 #endif
12304 #$i_string I_STRING
12305 #ifdef I_STRING
12306 #include <string.h>
12307 #else
12308 #include <strings.h>
12309 #endif
12310 $signal_t blech(int x) { exit(3); }
12311 EOCP
12312         $cat >> try.c <<'EOCP'
12313 int main()
12314 {
12315         int pd[2];
12316         int pu[2];
12317         char buf[1];
12318         char string[100];
12319
12320         pipe(pd);       /* Down: child -> parent */
12321         pipe(pu);       /* Up: parent -> child */
12322         if (0 != fork()) {
12323                 int ret;
12324                 close(pd[1]);   /* Parent reads from pd[0] */
12325                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12326 #ifdef F_SETFL
12327                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12328                         exit(1);
12329 #else
12330                 exit(4);
12331 #endif
12332                 signal(SIGALRM, blech);
12333                 alarm(5);
12334                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12335                         exit(2);
12336                 sprintf(string, "%d\n", ret);
12337                 write(2, string, strlen(string));
12338                 alarm(0);
12339 #ifdef EAGAIN
12340                 if (errno == EAGAIN) {
12341                         printf("EAGAIN\n");
12342                         goto ok;
12343                 }
12344 #endif
12345 #ifdef EWOULDBLOCK
12346                 if (errno == EWOULDBLOCK)
12347                         printf("EWOULDBLOCK\n");
12348 #endif
12349         ok:
12350                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12351                 sleep(2);                               /* Give it time to close our pipe */
12352                 alarm(5);
12353                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12354                 alarm(0);
12355                 sprintf(string, "%d\n", ret);
12356                 write(4, string, strlen(string));
12357                 exit(0);
12358         }
12359
12360         close(pd[0]);                   /* We write to pd[1] */
12361         close(pu[1]);                   /* We read from pu[0] */
12362         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12363         close(pd[1]);                   /* Pipe pd is now fully closed! */
12364         exit(0);                                /* Bye bye, thank you for playing! */
12365 }
12366 EOCP
12367         set try
12368         if eval $compile_ok; then
12369                 echo "$startsh" >mtry
12370                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12371                 chmod +x mtry
12372                 ./mtry >/dev/null 2>&1
12373                 case $? in
12374                 0) eagain=`$cat try.out`;;
12375                 1) echo "Could not perform non-blocking setting!";;
12376                 2) echo "I did a successful read() for something that was not there!";;
12377                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12378                 4) echo "Could not find F_SETFL!";;
12379                 *) echo "Something terribly wrong happened during testing.";;
12380                 esac
12381                 rd_nodata=`$cat try.ret`
12382                 echo "A read() system call with no data present returns $rd_nodata."
12383                 case "$rd_nodata" in
12384                 0|-1) ;;
12385                 *)
12386                         echo "(That's peculiar, fixing that to be -1.)"
12387                         rd_nodata=-1
12388                         ;;
12389                 esac
12390                 case "$eagain" in
12391                 '')
12392                         echo "Forcing errno EAGAIN on read() with no data available."
12393                         eagain=EAGAIN
12394                         ;;
12395                 *)
12396                         echo "Your read() sets errno to $eagain when no data is available."
12397                         ;;
12398                 esac
12399                 status=`$cat try.err`
12400                 case "$status" in
12401                 0) echo "And it correctly returns 0 to signal EOF.";;
12402                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12403                 *) echo "However, your read() returns '$status' on EOF??";;
12404                 esac
12405                 val="$define"
12406                 if test "$status" = "$rd_nodata"; then
12407                         echo "WARNING: you can't distinguish between EOF and no data!"
12408                         val="$undef"
12409                 fi
12410         else
12411                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12412                 eagain=EAGAIN
12413         fi
12414         ;;
12415         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12416                 eagain=EAGAIN
12417                 val="$define"
12418                 ;;
12419         esac
12420         set d_eofnblk
12421         eval $setvar
12422         ;;
12423 *)
12424         echo "Using $hint value $eagain."
12425         echo "Your read() returns $rd_nodata when no data is present."
12426         case "$d_eofnblk" in
12427         "$define") echo "And you can see EOF because read() returns 0.";;
12428         "$undef") echo "But you can't see EOF status from read() returned value.";;
12429         *)
12430                 echo "(Assuming you can't see EOF status from read anyway.)"
12431                 d_eofnblk=$undef
12432                 ;;
12433         esac
12434         ;;
12435 esac
12436 $rm_try head.c mtry
12437
12438 : see if _ptr and _cnt from stdio act std
12439 echo " "
12440
12441 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12442         echo "(Looks like you have stdio.h from BSD.)"
12443         case "$stdio_ptr" in
12444         '') stdio_ptr='((fp)->_p)'
12445                 ptr_lval=$define
12446                 ;;
12447         *)      ptr_lval=$d_stdio_ptr_lval;;
12448         esac
12449         case "$stdio_cnt" in
12450         '') stdio_cnt='((fp)->_r)'
12451                 cnt_lval=$define
12452                 ;;
12453         *)      cnt_lval=$d_stdio_cnt_lval;;
12454         esac
12455         case "$stdio_base" in
12456         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12457         esac
12458         case "$stdio_bufsiz" in
12459         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12460         esac
12461 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12462         echo "(Looks like you have stdio.h from Linux.)"
12463         case "$stdio_ptr" in
12464         '') stdio_ptr='((fp)->_IO_read_ptr)'
12465                 ptr_lval=$define
12466                 ;;
12467         *)      ptr_lval=$d_stdio_ptr_lval;;
12468         esac
12469         case "$stdio_cnt" in
12470         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12471                 cnt_lval=$undef
12472                 ;;
12473         *)      cnt_lval=$d_stdio_cnt_lval;;
12474         esac
12475         case "$stdio_base" in
12476         '') stdio_base='((fp)->_IO_read_base)';;
12477         esac
12478         case "$stdio_bufsiz" in
12479         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12480         esac
12481 else
12482         case "$stdio_ptr" in
12483         '') stdio_ptr='((fp)->_ptr)'
12484                 ptr_lval=$define
12485                 ;;
12486         *)      ptr_lval=$d_stdio_ptr_lval;;
12487         esac
12488         case "$stdio_cnt" in
12489         '') stdio_cnt='((fp)->_cnt)'
12490                 cnt_lval=$define
12491                 ;;
12492         *)      cnt_lval=$d_stdio_cnt_lval;;
12493         esac
12494         case "$stdio_base" in
12495         '') stdio_base='((fp)->_base)';;
12496         esac
12497         case "$stdio_bufsiz" in
12498         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12499         esac
12500 fi
12501
12502 : test whether _ptr and _cnt really work
12503 echo "Checking how std your stdio is..." >&4
12504 $cat >try.c <<EOP
12505 #include <stdio.h>
12506 #$i_stdlib I_STDLIB
12507 #ifdef I_STDLIB
12508 #include <stdlib.h>
12509 #endif
12510 #define FILE_ptr(fp)    $stdio_ptr
12511 #define FILE_cnt(fp)    $stdio_cnt
12512 int main() {
12513         FILE *fp = fopen("try.c", "r");
12514         char c = getc(fp);
12515         if (
12516                 18 <= FILE_cnt(fp) &&
12517                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12518         )
12519                 exit(0);
12520         exit(1);
12521 }
12522 EOP
12523 val="$undef"
12524 set try
12525 if eval $compile && $to try.c; then
12526         if $run ./try; then
12527                 echo "Your stdio acts pretty std."
12528                 val="$define"
12529         else
12530                 echo "Your stdio isn't very std."
12531         fi
12532 else
12533         echo "Your stdio doesn't appear very std."
12534 fi
12535 $rm_try
12536
12537 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12538 # direct buffer manipulation no longer works.  The Configure tests
12539 # should be changed to correctly detect this, but until then,
12540 # the following check should at least let perl compile and run.
12541 # (This quick fix should be updated before 5.8.1.)
12542 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12543 # A. Dougherty, June 3, 2002.
12544 case "$d_gnulibc" in
12545 $define)
12546         case "$gnulibc_version" in
12547         2.[01]*)  ;;
12548         2.2) ;;
12549         2.2.[0-9]) ;;
12550         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12551                 val="$undef"
12552                 ;;
12553         esac
12554         ;;
12555 esac
12556 set d_stdstdio
12557 eval $setvar
12558
12559 : Can _ptr be used as an lvalue?
12560 case "$d_stdstdio$ptr_lval" in
12561 $define$define) val=$define ;;
12562 *) val=$undef ;;
12563 esac
12564 set d_stdio_ptr_lval
12565 eval $setvar
12566
12567 : Can _cnt be used as an lvalue?
12568 case "$d_stdstdio$cnt_lval" in
12569 $define$define) val=$define ;;
12570 *) val=$undef ;;
12571 esac
12572 set d_stdio_cnt_lval
12573 eval $setvar
12574
12575
12576 : test whether setting _ptr sets _cnt as a side effect
12577 d_stdio_ptr_lval_sets_cnt="$undef"
12578 d_stdio_ptr_lval_nochange_cnt="$undef"
12579 case "$d_stdio_ptr_lval$d_stdstdio" in
12580 $define$define)
12581         echo "Checking to see what happens if we set the stdio ptr..." >&4
12582 $cat >try.c <<EOP
12583 #include <stdio.h>
12584 /* Can we scream? */
12585 /* Eat dust sed :-) */
12586 /* In the buffer space, no one can hear you scream. */
12587 #$i_stdlib I_STDLIB
12588 #ifdef I_STDLIB
12589 #include <stdlib.h>
12590 #endif
12591 #define FILE_ptr(fp)    $stdio_ptr
12592 #define FILE_cnt(fp)    $stdio_cnt
12593 #include <sys/types.h>
12594 int main() {
12595         FILE *fp = fopen("try.c", "r");
12596         int c;
12597         char *ptr;
12598         size_t cnt;
12599         if (!fp) {
12600             puts("Fail even to read");
12601             exit(1);
12602         }
12603         c = getc(fp); /* Read away the first # */
12604         if (c == EOF) {
12605             puts("Fail even to read");
12606             exit(1);
12607         }
12608         if (!(
12609                 18 <= FILE_cnt(fp) &&
12610                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12611         )) {
12612                 puts("Fail even to read");
12613                 exit (1);
12614         }
12615         ptr = (char*) FILE_ptr(fp);
12616         cnt = (size_t)FILE_cnt(fp);
12617
12618         FILE_ptr(fp) += 42;
12619
12620         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12621                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12622                 exit (1);
12623         }
12624         if (FILE_cnt(fp) <= 20) {
12625                 printf ("Fail (<20 chars to test)");
12626                 exit (1);
12627         }
12628         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12629                 puts("Fail compare");
12630                 exit (1);
12631         }
12632         if (cnt == FILE_cnt(fp)) {
12633                 puts("Pass_unchanged");
12634                 exit (0);
12635         }
12636         if (FILE_cnt(fp) == (cnt - 42)) {
12637                 puts("Pass_changed");
12638                 exit (0);
12639         }
12640         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12641         return 1;
12642
12643 }
12644 EOP
12645         set try
12646         if eval $compile && $to try.c; then
12647                 case `$run ./try` in
12648                 Pass_changed)
12649                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12650                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12651                 Pass_unchanged)
12652                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12653                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12654                 Fail*)
12655                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12656                 *)
12657                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12658         esac
12659         else
12660                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12661         fi
12662         $rm_try
12663         ;;
12664 esac
12665
12666 : see if _base is also standard
12667 val="$undef"
12668 case "$d_stdstdio" in
12669 $define)
12670         $cat >try.c <<EOP
12671 #include <stdio.h>
12672 #$i_stdlib I_STDLIB
12673 #ifdef I_STDLIB
12674 #include <stdlib.h>
12675 #endif
12676 #define FILE_base(fp)   $stdio_base
12677 #define FILE_bufsiz(fp) $stdio_bufsiz
12678 int main() {
12679         FILE *fp = fopen("try.c", "r");
12680         char c = getc(fp);
12681         if (
12682                 19 <= FILE_bufsiz(fp) &&
12683                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12684         )
12685                 exit(0);
12686         exit(1);
12687 }
12688 EOP
12689         set try
12690         if eval $compile && $to try.c; then
12691                 if $run ./try; then
12692                         echo "And its _base field acts std."
12693                         val="$define"
12694                 else
12695                         echo "But its _base field isn't std."
12696                 fi
12697         else
12698                 echo "However, it seems to be lacking the _base field."
12699         fi
12700         $rm_try
12701         ;;
12702 esac
12703 set d_stdiobase
12704 eval $setvar
12705
12706 : see if fast_stdio exists
12707 val="$undef"
12708 case "$d_stdstdio:$d_stdio_ptr_lval" in
12709 "$define:$define")
12710         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12711         *$define*)
12712                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12713                 val="$define"
12714                 ;;
12715         esac
12716         ;;
12717 esac
12718 set d_faststdio
12719 eval $setvar
12720
12721
12722
12723 : see if fchdir exists
12724 set fchdir d_fchdir
12725 eval $inlibc
12726
12727 : see if fchmod exists
12728 set fchmod d_fchmod
12729 eval $inlibc
12730
12731 : see if fchown exists
12732 set fchown d_fchown
12733 eval $inlibc
12734
12735 : see if this is an fcntl system
12736 set fcntl d_fcntl
12737 eval $inlibc
12738
12739 echo " "
12740 : See if fcntl-based locking works.
12741 $cat >try.c <<EOCP
12742 #$i_stdlib I_STDLIB
12743 #ifdef I_STDLIB
12744 #include <stdlib.h>
12745 #endif
12746 #include <unistd.h>
12747 #include <fcntl.h>
12748 #include <signal.h>
12749 $signal_t blech(int x) { exit(3); }
12750 int main() {
12751 #if defined(F_SETLK) && defined(F_SETLKW)
12752      struct flock flock;
12753      int retval, fd;
12754      fd = open("try.c", O_RDONLY);
12755      flock.l_type = F_RDLCK;
12756      flock.l_whence = SEEK_SET;
12757      flock.l_start = flock.l_len = 0;
12758      signal(SIGALRM, blech);
12759      alarm(10);
12760      retval = fcntl(fd, F_SETLK, &flock);
12761      close(fd);
12762      (retval < 0 ? exit(2) : exit(0));
12763 #else
12764      exit(2);
12765 #endif
12766 }
12767 EOCP
12768 echo "Checking if fcntl-based file locking works... "
12769 case "$d_fcntl" in
12770 "$define")
12771         set try
12772         if eval $compile_ok; then
12773                 if $run ./try; then
12774                         echo "Yes, it seems to work."
12775                         val="$define"
12776                 else
12777                         echo "Nope, it didn't work."
12778                         val="$undef"
12779                         case "$?" in
12780                         3) $cat >&4 <<EOM
12781 ***
12782 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12783 *** This is (almost) impossible.
12784 *** If your NFS lock daemons are not feeling well, something like
12785 *** this may happen, please investigate.  Cannot continue, aborting.
12786 ***
12787 EOM
12788                                 exit 1
12789                                 ;;
12790                         esac
12791                 fi
12792         else
12793                 echo "I'm unable to compile the test program, so I'll assume not."
12794                 val="$undef"
12795         fi
12796         ;;
12797 *) val="$undef";
12798         echo "Nope, since you don't even have fcntl()."
12799         ;;
12800 esac
12801 set d_fcntl_can_lock
12802 eval $setvar
12803 $rm_try
12804
12805 : check for fd_set items
12806 $cat <<EOM
12807
12808 Checking to see how well your C compiler handles fd_set and friends ...
12809 EOM
12810 $cat >try.c <<EOCP
12811 #$i_stdlib I_STDLIB
12812 #ifdef I_STDLIB
12813 #include <stdlib.h>
12814 #endif
12815 #$i_systime I_SYS_TIME
12816 #$i_sysselct I_SYS_SELECT
12817 #$d_socket HAS_SOCKET
12818 #include <sys/types.h>
12819 #ifdef HAS_SOCKET
12820 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12821 #endif
12822 #ifdef I_SYS_TIME
12823 #include <sys/time.h>
12824 #endif
12825 #ifdef I_SYS_SELECT
12826 #include <sys/select.h>
12827 #endif
12828 int main() {
12829         fd_set fds;
12830
12831 #ifdef TRYBITS
12832         if(fds.fds_bits);
12833 #endif
12834
12835 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12836         exit(0);
12837 #else
12838         exit(1);
12839 #endif
12840 }
12841 EOCP
12842 set try -DTRYBITS
12843 if eval $compile; then
12844         d_fds_bits="$define"
12845         d_fd_set="$define"
12846         echo "Well, your system knows about the normal fd_set typedef..." >&4
12847         if $run ./try; then
12848                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12849                 d_fd_macros="$define"
12850         else
12851                 $cat >&4 <<'EOM'
12852 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12853 EOM
12854                 d_fd_macros="$undef"
12855         fi
12856 else
12857         $cat <<'EOM'
12858 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12859 EOM
12860         set try
12861         if eval $compile; then
12862                 d_fds_bits="$undef"
12863                 d_fd_set="$define"
12864                 echo "Well, your system has some sort of fd_set available..." >&4
12865                 if $run ./try; then
12866                         echo "and you have the normal fd_set macros." >&4
12867                         d_fd_macros="$define"
12868                 else
12869                         $cat <<'EOM'
12870 but not the normal fd_set macros!  Gross!  More work for me...
12871 EOM
12872                         d_fd_macros="$undef"
12873                 fi
12874         else
12875         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12876                 d_fd_set="$undef"
12877                 d_fds_bits="$undef"
12878                 d_fd_macros="$undef"
12879         fi
12880 fi
12881 $rm_try
12882
12883 : see if fgetpos exists
12884 set fgetpos d_fgetpos
12885 eval $inlibc
12886
12887 : see if finite exists
12888 set finite d_finite
12889 eval $inlibc
12890
12891 : see if finitel exists
12892 set finitel d_finitel
12893 eval $inlibc
12894
12895 : see if flock exists
12896 set flock d_flock
12897 eval $inlibc
12898
12899 : see if prototype for flock is available
12900 echo " "
12901 set d_flockproto flock $i_sysfile sys/file.h
12902 eval $hasproto
12903
12904 : see if fp_class exists
12905 set fp_class d_fp_class
12906 eval $inlibc
12907
12908 : see if pathconf exists
12909 set pathconf d_pathconf
12910 eval $inlibc
12911
12912 : see if fpathconf exists
12913 set fpathconf d_fpathconf
12914 eval $inlibc
12915
12916 : see if fpclass exists
12917 set fpclass d_fpclass
12918 eval $inlibc
12919
12920 : see if fpclassify exists
12921 set fpclassify d_fpclassify
12922 eval $inlibc
12923
12924 : see if fpclassl exists
12925 set fpclassl d_fpclassl
12926 eval $inlibc
12927
12928
12929 : check for fpos64_t
12930 echo " "
12931 echo "Checking to see if you have fpos64_t..." >&4
12932 $cat >try.c <<EOCP
12933 #include <stdio.h>
12934 int main() { fpos64_t x = 7; }
12935 EOCP
12936 set try
12937 if eval $compile; then
12938         val="$define"
12939         echo "You have fpos64_t."
12940 else
12941         val="$undef"
12942         echo "You do not have fpos64_t."
12943         case "$fpossize" in
12944         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12945         esac
12946 fi
12947 $rm_try
12948 set d_fpos64_t
12949 eval $setvar
12950
12951 : see if frexpl exists
12952 set frexpl d_frexpl
12953 eval $inlibc
12954
12955 : see if this is a sys/param system
12956 set sys/param.h i_sysparam
12957 eval $inhdr
12958
12959 : see if this is a sys/mount.h system
12960 set sys/mount.h i_sysmount
12961 eval $inhdr
12962
12963
12964 echo " "
12965 echo "Checking to see if your system supports struct fs_data..." >&4
12966 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12967 eval $hasstruct
12968 case "$d_fs_data_s" in
12969 "$define")      echo "Yes, it does."   ;;
12970 *)              echo "No, it doesn't." ;;
12971 esac
12972
12973 : see if fseeko exists
12974 set fseeko d_fseeko
12975 eval $inlibc
12976 case "$longsize" in
12977 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12978 esac
12979
12980 : see if fsetpos exists
12981 set fsetpos d_fsetpos
12982 eval $inlibc
12983
12984
12985 : see if fstatfs exists
12986 set fstatfs d_fstatfs
12987 eval $inlibc
12988
12989
12990 : see if statvfs exists
12991 set statvfs d_statvfs
12992 eval $inlibc
12993
12994 : see if fstatvfs exists
12995 set fstatvfs d_fstatvfs
12996 eval $inlibc
12997
12998
12999 : see if fsync exists
13000 set fsync d_fsync
13001 eval $inlibc
13002
13003 : see if ftello exists
13004 set ftello d_ftello
13005 eval $inlibc
13006 case "$longsize" in
13007 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13008 esac
13009
13010 d_futimes="$undef"
13011 : check for a working futimes
13012 echo " "
13013 echo "Checking if you have a working futimes()" >&4
13014 $cat >try.c <<EOCP
13015 #include <stdio.h>
13016 #include <sys/time.h>
13017 #include <errno.h>
13018 #include <fcntl.h>
13019
13020 int main ()
13021 {
13022     int fd, rv;
13023     fd = open ("try.c", O_RDWR);
13024     if (-1 == fd) exit (1);
13025     rv = futimes (fd, NULL);
13026     exit (rv == -1 ? errno : 0);
13027 }
13028 EOCP
13029 set try
13030 if eval $compile; then
13031     `$run ./try`
13032     rc=$?
13033     case "$rc" in
13034         0)  echo "Yes, you have" >&4
13035             d_futimes="$define"
13036             ;;
13037         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13038             ;;
13039     esac
13040 else
13041     echo "No, it does not (probably harmless)" >&4
13042 fi
13043 $rm_try
13044
13045 : see if getcwd exists
13046 set getcwd d_getcwd
13047 eval $inlibc
13048
13049 : see if getespwnam exists
13050 set getespwnam d_getespwnam
13051 eval $inlibc
13052
13053
13054 : see if getfsstat exists
13055 set getfsstat d_getfsstat
13056 eval $inlibc
13057
13058 : see if getgrent exists
13059 set getgrent d_getgrent
13060 eval $inlibc
13061
13062 : see if getgrent_r exists
13063 set getgrent_r d_getgrent_r
13064 eval $inlibc
13065 case "$d_getgrent_r" in
13066 "$define")
13067         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13068         case "$d_getgrent_r_proto:$usethreads" in
13069         ":define")      d_getgrent_r_proto=define
13070                 set d_getgrent_r_proto getgrent_r $hdrs
13071                 eval $hasproto ;;
13072         *)      ;;
13073         esac
13074         case "$d_getgrent_r_proto" in
13075         define)
13076         case "$getgrent_r_proto" in
13077         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13078         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13079         esac
13080         case "$getgrent_r_proto" in
13081         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13082         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13083         esac
13084         case "$getgrent_r_proto" in
13085         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13086         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13087         esac
13088         case "$getgrent_r_proto" in
13089         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13090         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13091         esac
13092         case "$getgrent_r_proto" in
13093         ''|0) try='int getgrent_r(struct group*, char*, int);'
13094         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13095         esac
13096         case "$getgrent_r_proto" in
13097         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13098         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13099         esac
13100         case "$getgrent_r_proto" in
13101         ''|0)   d_getgrent_r=undef
13102                 getgrent_r_proto=0
13103                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13104         * )     case "$getgrent_r_proto" in
13105                 REENTRANT_PROTO*) ;;
13106                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13107                 esac
13108                 echo "Prototype: $try" ;;
13109         esac
13110         ;;
13111         *)      case "$usethreads" in
13112                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13113                 esac
13114                 d_getgrent_r=undef
13115                 getgrent_r_proto=0
13116                 ;;
13117         esac
13118         ;;
13119 *)      getgrent_r_proto=0
13120         ;;
13121 esac
13122
13123 : see if getgrgid_r exists
13124 set getgrgid_r d_getgrgid_r
13125 eval $inlibc
13126 case "$d_getgrgid_r" in
13127 "$define")
13128         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13129         case "$d_getgrgid_r_proto:$usethreads" in
13130         ":define")      d_getgrgid_r_proto=define
13131                 set d_getgrgid_r_proto getgrgid_r $hdrs
13132                 eval $hasproto ;;
13133         *)      ;;
13134         esac
13135         case "$d_getgrgid_r_proto" in
13136         define)
13137         case "$getgrgid_r_proto" in
13138         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13139         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13140         esac
13141         case "$getgrgid_r_proto" in
13142         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13143         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13144         esac
13145         case "$getgrgid_r_proto" in
13146         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13147         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13148         esac
13149         case "$getgrgid_r_proto" in
13150         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13151         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13152         esac
13153         case "$getgrgid_r_proto" in
13154         ''|0)   d_getgrgid_r=undef
13155                 getgrgid_r_proto=0
13156                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13157         * )     case "$getgrgid_r_proto" in
13158                 REENTRANT_PROTO*) ;;
13159                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13160                 esac
13161                 echo "Prototype: $try" ;;
13162         esac
13163         ;;
13164         *)      case "$usethreads" in
13165                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13166                 esac
13167                 d_getgrgid_r=undef
13168                 getgrgid_r_proto=0
13169                 ;;
13170         esac
13171         ;;
13172 *)      getgrgid_r_proto=0
13173         ;;
13174 esac
13175
13176 : see if getgrnam_r exists
13177 set getgrnam_r d_getgrnam_r
13178 eval $inlibc
13179 case "$d_getgrnam_r" in
13180 "$define")
13181         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13182         case "$d_getgrnam_r_proto:$usethreads" in
13183         ":define")      d_getgrnam_r_proto=define
13184                 set d_getgrnam_r_proto getgrnam_r $hdrs
13185                 eval $hasproto ;;
13186         *)      ;;
13187         esac
13188         case "$d_getgrnam_r_proto" in
13189         define)
13190         case "$getgrnam_r_proto" in
13191         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13192         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13193         esac
13194         case "$getgrnam_r_proto" in
13195         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13196         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13197         esac
13198         case "$getgrnam_r_proto" in
13199         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13200         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13201         esac
13202         case "$getgrnam_r_proto" in
13203         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13204         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13205         esac
13206         case "$getgrnam_r_proto" in
13207         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13208         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13209         esac
13210         case "$getgrnam_r_proto" in
13211         ''|0)   d_getgrnam_r=undef
13212                 getgrnam_r_proto=0
13213                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13214         * )     case "$getgrnam_r_proto" in
13215                 REENTRANT_PROTO*) ;;
13216                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13217                 esac
13218                 echo "Prototype: $try" ;;
13219         esac
13220         ;;
13221         *)      case "$usethreads" in
13222                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13223                 esac
13224                 d_getgrnam_r=undef
13225                 getgrnam_r_proto=0
13226                 ;;
13227         esac
13228         ;;
13229 *)      getgrnam_r_proto=0
13230         ;;
13231 esac
13232
13233 : see if gethostbyaddr exists
13234 set gethostbyaddr d_gethbyaddr
13235 eval $inlibc
13236
13237 : see if gethostbyname exists
13238 set gethostbyname d_gethbyname
13239 eval $inlibc
13240
13241 : see if gethostent exists
13242 set gethostent d_gethent
13243 eval $inlibc
13244
13245 : see how we will look up host name
13246 echo " "
13247 call=''
13248 if set gethostname val -f d_gethname; eval $csym; $val; then
13249         echo 'gethostname() found.' >&4
13250         d_gethname="$define"
13251         call=gethostname
13252 fi
13253 if set uname val -f d_uname; eval $csym; $val; then
13254         if ./xenix; then
13255                 $cat <<'EOM'
13256 uname() was found, but you're running xenix, and older versions of xenix
13257 have a broken uname(). If you don't really know whether your xenix is old
13258 enough to have a broken system call, use the default answer.
13259
13260 EOM
13261                 dflt=y
13262                 case "$d_uname" in
13263                 "$define") dflt=n;;
13264                 esac
13265                 rp='Is your uname() broken?'
13266                 . ./myread
13267                 case "$ans" in
13268                 n*) d_uname="$define"; call=uname;;
13269                 esac
13270         else
13271                 echo 'uname() found.' >&4
13272                 d_uname="$define"
13273                 case "$call" in
13274                 '') call=uname ;;
13275                 esac
13276         fi
13277 fi
13278 case "$d_gethname" in
13279 '') d_gethname="$undef";;
13280 esac
13281 case "$d_uname" in
13282 '') d_uname="$undef";;
13283 esac
13284 case "$d_uname$d_gethname" in
13285 *define*)
13286         dflt=n
13287         cat <<EOM
13288  
13289 Every now and then someone has a $call() that lies about the hostname
13290 but can't be fixed for political or economic reasons.  If you wish, I can
13291 pretend $call() isn't there and maybe compute hostname at run-time
13292 thanks to the '$phostname' command.
13293
13294 EOM
13295         rp="Shall I ignore $call() from now on?"
13296         . ./myread
13297         case "$ans" in
13298         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13299         esac;;
13300 esac
13301 case "$phostname" in
13302 '') aphostname='';;
13303 *) case "$aphostname" in
13304         /*) ;;
13305         *) set X $phostname
13306                 shift
13307                 file=$1
13308                 shift
13309                 file=`./loc $file $file $pth`
13310                 aphostname=`echo $file $*`
13311                 ;;
13312         esac
13313         ;;
13314 esac
13315 case "$d_uname$d_gethname" in
13316 *define*) ;;
13317 *)
13318         case "$phostname" in
13319         '')
13320                 echo "There will be no way for $package to get your hostname." >&4;;
13321         *)
13322         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13323                 ;;
13324         esac;;
13325 esac
13326 case "$d_phostname" in
13327 '') d_phostname="$undef";;
13328 esac
13329
13330 : see if gethostbyaddr_r exists
13331 set gethostbyaddr_r d_gethostbyaddr_r
13332 eval $inlibc
13333 case "$d_gethostbyaddr_r" in
13334 "$define")
13335         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13336         case "$d_gethostbyaddr_r_proto:$usethreads" in
13337         ":define")      d_gethostbyaddr_r_proto=define
13338                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13339                 eval $hasproto ;;
13340         *)      ;;
13341         esac
13342         case "$d_gethostbyaddr_r_proto" in
13343         define)
13344         case "$gethostbyaddr_r_proto" in
13345         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13346         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13347         esac
13348         case "$gethostbyaddr_r_proto" in
13349         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13350         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13351         esac
13352         case "$gethostbyaddr_r_proto" in
13353         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13354         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13355         esac
13356         case "$gethostbyaddr_r_proto" in
13357         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13358         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13359         esac
13360         case "$gethostbyaddr_r_proto" in
13361         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13362         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13363         esac
13364         case "$gethostbyaddr_r_proto" in
13365         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13366         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13367         esac
13368         case "$gethostbyaddr_r_proto" in
13369         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13370         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13371         esac
13372         case "$gethostbyaddr_r_proto" in
13373         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13374         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13375         esac
13376         case "$gethostbyaddr_r_proto" in
13377         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13378         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13379         esac
13380         case "$gethostbyaddr_r_proto" in
13381         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13382         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13383         esac
13384         case "$gethostbyaddr_r_proto" in
13385         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13386         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13387         esac
13388         case "$gethostbyaddr_r_proto" in
13389         ''|0)   d_gethostbyaddr_r=undef
13390                 gethostbyaddr_r_proto=0
13391                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13392         * )     case "$gethostbyaddr_r_proto" in
13393                 REENTRANT_PROTO*) ;;
13394                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13395                 esac
13396                 echo "Prototype: $try" ;;
13397         esac
13398         ;;
13399         *)      case "$usethreads" in
13400                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13401                 esac
13402                 d_gethostbyaddr_r=undef
13403                 gethostbyaddr_r_proto=0
13404                 ;;
13405         esac
13406         ;;
13407 *)      gethostbyaddr_r_proto=0
13408         ;;
13409 esac
13410
13411 : see if gethostbyname_r exists
13412 set gethostbyname_r d_gethostbyname_r
13413 eval $inlibc
13414 case "$d_gethostbyname_r" in
13415 "$define")
13416         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13417         case "$d_gethostbyname_r_proto:$usethreads" in
13418         ":define")      d_gethostbyname_r_proto=define
13419                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13420                 eval $hasproto ;;
13421         *)      ;;
13422         esac
13423         case "$d_gethostbyname_r_proto" in
13424         define)
13425         case "$gethostbyname_r_proto" in
13426         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13427         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13428         esac
13429         case "$gethostbyname_r_proto" in
13430         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13431         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13432         esac
13433         case "$gethostbyname_r_proto" in
13434         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13435         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13436         esac
13437         case "$gethostbyname_r_proto" in
13438         ''|0)   d_gethostbyname_r=undef
13439                 gethostbyname_r_proto=0
13440                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13441         * )     case "$gethostbyname_r_proto" in
13442                 REENTRANT_PROTO*) ;;
13443                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13444                 esac
13445                 echo "Prototype: $try" ;;
13446         esac
13447         ;;
13448         *)      case "$usethreads" in
13449                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13450                 esac
13451                 d_gethostbyname_r=undef
13452                 gethostbyname_r_proto=0
13453                 ;;
13454         esac
13455         ;;
13456 *)      gethostbyname_r_proto=0
13457         ;;
13458 esac
13459
13460 : see if gethostent_r exists
13461 set gethostent_r d_gethostent_r
13462 eval $inlibc
13463 case "$d_gethostent_r" in
13464 "$define")
13465         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13466         case "$d_gethostent_r_proto:$usethreads" in
13467         ":define")      d_gethostent_r_proto=define
13468                 set d_gethostent_r_proto gethostent_r $hdrs
13469                 eval $hasproto ;;
13470         *)      ;;
13471         esac
13472         case "$d_gethostent_r_proto" in
13473         define)
13474         case "$gethostent_r_proto" in
13475         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13476         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13477         esac
13478         case "$gethostent_r_proto" in
13479         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13480         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13481         esac
13482         case "$gethostent_r_proto" in
13483         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13484         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13485         esac
13486         case "$gethostent_r_proto" in
13487         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13488         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13489         esac
13490         case "$gethostent_r_proto" in
13491         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13492         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13493         esac
13494         case "$gethostent_r_proto" in
13495         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13496         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13497         esac
13498         case "$gethostent_r_proto" in
13499         ''|0)   d_gethostent_r=undef
13500                 gethostent_r_proto=0
13501                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13502         * )     case "$gethostent_r_proto" in
13503                 REENTRANT_PROTO*) ;;
13504                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13505                 esac
13506                 echo "Prototype: $try" ;;
13507         esac
13508         ;;
13509         *)      case "$usethreads" in
13510                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13511                 esac
13512                 d_gethostent_r=undef
13513                 gethostent_r_proto=0
13514                 ;;
13515         esac
13516         ;;
13517 *)      gethostent_r_proto=0
13518         ;;
13519 esac
13520
13521 : see if prototypes for various gethostxxx netdb.h functions are available
13522 echo " "
13523 set d_gethostprotos gethostent $i_netdb netdb.h
13524 eval $hasproto
13525
13526 : see if getitimer exists
13527 set getitimer d_getitimer
13528 eval $inlibc
13529
13530 : see if getlogin exists
13531 set getlogin d_getlogin
13532 eval $inlibc
13533
13534 : see if getlogin_r exists
13535 set getlogin_r d_getlogin_r
13536 eval $inlibc
13537 case "$d_getlogin_r" in
13538 "$define")
13539         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13540         case "$d_getlogin_r_proto:$usethreads" in
13541         ":define")      d_getlogin_r_proto=define
13542                 set d_getlogin_r_proto getlogin_r $hdrs
13543                 eval $hasproto ;;
13544         *)      ;;
13545         esac
13546         case "$d_getlogin_r_proto" in
13547         define)
13548         case "$getlogin_r_proto" in
13549         ''|0) try='int getlogin_r(char*, size_t);'
13550         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13551         esac
13552         case "$getlogin_r_proto" in
13553         ''|0) try='int getlogin_r(char*, int);'
13554         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13555         esac
13556         case "$getlogin_r_proto" in
13557         ''|0) try='char* getlogin_r(char*, size_t);'
13558         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13559         esac
13560         case "$getlogin_r_proto" in
13561         ''|0) try='char* getlogin_r(char*, int);'
13562         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13563         esac
13564         case "$getlogin_r_proto" in
13565         ''|0)   d_getlogin_r=undef
13566                 getlogin_r_proto=0
13567                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13568         * )     case "$getlogin_r_proto" in
13569                 REENTRANT_PROTO*) ;;
13570                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13571                 esac
13572                 echo "Prototype: $try" ;;
13573         esac
13574         ;;
13575         *)      case "$usethreads" in
13576                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13577                 esac
13578                 d_getlogin_r=undef
13579                 getlogin_r_proto=0
13580                 ;;
13581         esac
13582         ;;
13583 *)      getlogin_r_proto=0
13584         ;;
13585 esac
13586
13587 : see if getmnt exists
13588 set getmnt d_getmnt
13589 eval $inlibc
13590
13591 : see if getmntent exists
13592 set getmntent d_getmntent
13593 eval $inlibc
13594
13595 : see if getnetbyaddr exists
13596 set getnetbyaddr d_getnbyaddr
13597 eval $inlibc
13598
13599 : see if getnetbyname exists
13600 set getnetbyname d_getnbyname
13601 eval $inlibc
13602
13603 : see if getnetent exists
13604 set getnetent d_getnent
13605 eval $inlibc
13606
13607 : see if getnetbyaddr_r exists
13608 set getnetbyaddr_r d_getnetbyaddr_r
13609 eval $inlibc
13610 case "$d_getnetbyaddr_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13613         case "$d_getnetbyaddr_r_proto:$usethreads" in
13614         ":define")      d_getnetbyaddr_r_proto=define
13615                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_getnetbyaddr_r_proto" in
13620         define)
13621         case "$getnetbyaddr_r_proto" in
13622         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13623         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13624         esac
13625         case "$getnetbyaddr_r_proto" in
13626         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13627         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13628         esac
13629         case "$getnetbyaddr_r_proto" in
13630         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13631         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13632         esac
13633         case "$getnetbyaddr_r_proto" in
13634         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13635         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13636         esac
13637         case "$getnetbyaddr_r_proto" in
13638         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13639         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13640         esac
13641         case "$getnetbyaddr_r_proto" in
13642         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13643         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13644         esac
13645         case "$getnetbyaddr_r_proto" in
13646         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13647         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13648         esac
13649         case "$getnetbyaddr_r_proto" in
13650         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13651         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13652         esac
13653         case "$getnetbyaddr_r_proto" in
13654         ''|0)   d_getnetbyaddr_r=undef
13655                 getnetbyaddr_r_proto=0
13656                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13657         * )     case "$getnetbyaddr_r_proto" in
13658                 REENTRANT_PROTO*) ;;
13659                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13660                 esac
13661                 echo "Prototype: $try" ;;
13662         esac
13663         ;;
13664         *)      case "$usethreads" in
13665                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13666                 esac
13667                 d_getnetbyaddr_r=undef
13668                 getnetbyaddr_r_proto=0
13669                 ;;
13670         esac
13671         ;;
13672 *)      getnetbyaddr_r_proto=0
13673         ;;
13674 esac
13675
13676 : see if getnetbyname_r exists
13677 set getnetbyname_r d_getnetbyname_r
13678 eval $inlibc
13679 case "$d_getnetbyname_r" in
13680 "$define")
13681         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13682         case "$d_getnetbyname_r_proto:$usethreads" in
13683         ":define")      d_getnetbyname_r_proto=define
13684                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13685                 eval $hasproto ;;
13686         *)      ;;
13687         esac
13688         case "$d_getnetbyname_r_proto" in
13689         define)
13690         case "$getnetbyname_r_proto" in
13691         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13692         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13693         esac
13694         case "$getnetbyname_r_proto" in
13695         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13696         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13697         esac
13698         case "$getnetbyname_r_proto" in
13699         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13700         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13701         esac
13702         case "$getnetbyname_r_proto" in
13703         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13704         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13705         esac
13706         case "$getnetbyname_r_proto" in
13707         ''|0)   d_getnetbyname_r=undef
13708                 getnetbyname_r_proto=0
13709                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13710         * )     case "$getnetbyname_r_proto" in
13711                 REENTRANT_PROTO*) ;;
13712                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13713                 esac
13714                 echo "Prototype: $try" ;;
13715         esac
13716         ;;
13717         *)      case "$usethreads" in
13718                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13719                 esac
13720                 d_getnetbyname_r=undef
13721                 getnetbyname_r_proto=0
13722                 ;;
13723         esac
13724         ;;
13725 *)      getnetbyname_r_proto=0
13726         ;;
13727 esac
13728
13729 : see if getnetent_r exists
13730 set getnetent_r d_getnetent_r
13731 eval $inlibc
13732 case "$d_getnetent_r" in
13733 "$define")
13734         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13735         case "$d_getnetent_r_proto:$usethreads" in
13736         ":define")      d_getnetent_r_proto=define
13737                 set d_getnetent_r_proto getnetent_r $hdrs
13738                 eval $hasproto ;;
13739         *)      ;;
13740         esac
13741         case "$d_getnetent_r_proto" in
13742         define)
13743         case "$getnetent_r_proto" in
13744         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13745         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13746         esac
13747         case "$getnetent_r_proto" in
13748         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13749         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13750         esac
13751         case "$getnetent_r_proto" in
13752         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13753         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13754         esac
13755         case "$getnetent_r_proto" in
13756         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13757         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13758         esac
13759         case "$getnetent_r_proto" in
13760         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13761         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13762         esac
13763         case "$getnetent_r_proto" in
13764         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13765         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13766         esac
13767         case "$getnetent_r_proto" in
13768         ''|0)   d_getnetent_r=undef
13769                 getnetent_r_proto=0
13770                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13771         * )     case "$getnetent_r_proto" in
13772                 REENTRANT_PROTO*) ;;
13773                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13774                 esac
13775                 echo "Prototype: $try" ;;
13776         esac
13777         ;;
13778         *)      case "$usethreads" in
13779                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13780                 esac
13781                 d_getnetent_r=undef
13782                 getnetent_r_proto=0
13783                 ;;
13784         esac
13785         ;;
13786 *)      getnetent_r_proto=0
13787         ;;
13788 esac
13789
13790 : see if prototypes for various getnetxxx netdb.h functions are available
13791 echo " "
13792 set d_getnetprotos getnetent $i_netdb netdb.h
13793 eval $hasproto
13794
13795 : see if getpagesize exists
13796 set getpagesize d_getpagsz
13797 eval $inlibc
13798
13799
13800 : see if getprotobyname exists
13801 set getprotobyname d_getpbyname
13802 eval $inlibc
13803
13804 : see if getprotobynumber exists
13805 set getprotobynumber d_getpbynumber
13806 eval $inlibc
13807
13808 : see if getprotoent exists
13809 set getprotoent d_getpent
13810 eval $inlibc
13811
13812 : see if getpgid exists
13813 set getpgid d_getpgid
13814 eval $inlibc
13815
13816 : see if getpgrp2 exists
13817 set getpgrp2 d_getpgrp2
13818 eval $inlibc
13819
13820 : see if getppid exists
13821 set getppid d_getppid
13822 eval $inlibc
13823
13824 : see if getpriority exists
13825 set getpriority d_getprior
13826 eval $inlibc
13827
13828 : see if getprotobyname_r exists
13829 set getprotobyname_r d_getprotobyname_r
13830 eval $inlibc
13831 case "$d_getprotobyname_r" in
13832 "$define")
13833         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13834         case "$d_getprotobyname_r_proto:$usethreads" in
13835         ":define")      d_getprotobyname_r_proto=define
13836                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13837                 eval $hasproto ;;
13838         *)      ;;
13839         esac
13840         case "$d_getprotobyname_r_proto" in
13841         define)
13842         case "$getprotobyname_r_proto" in
13843         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13844         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13845         esac
13846         case "$getprotobyname_r_proto" in
13847         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13848         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13849         esac
13850         case "$getprotobyname_r_proto" in
13851         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13852         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13853         esac
13854         case "$getprotobyname_r_proto" in
13855         ''|0)   d_getprotobyname_r=undef
13856                 getprotobyname_r_proto=0
13857                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13858         * )     case "$getprotobyname_r_proto" in
13859                 REENTRANT_PROTO*) ;;
13860                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13861                 esac
13862                 echo "Prototype: $try" ;;
13863         esac
13864         ;;
13865         *)      case "$usethreads" in
13866                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13867                 esac
13868                 d_getprotobyname_r=undef
13869                 getprotobyname_r_proto=0
13870                 ;;
13871         esac
13872         ;;
13873 *)      getprotobyname_r_proto=0
13874         ;;
13875 esac
13876
13877 : see if getprotobynumber_r exists
13878 set getprotobynumber_r d_getprotobynumber_r
13879 eval $inlibc
13880 case "$d_getprotobynumber_r" in
13881 "$define")
13882         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13883         case "$d_getprotobynumber_r_proto:$usethreads" in
13884         ":define")      d_getprotobynumber_r_proto=define
13885                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13886                 eval $hasproto ;;
13887         *)      ;;
13888         esac
13889         case "$d_getprotobynumber_r_proto" in
13890         define)
13891         case "$getprotobynumber_r_proto" in
13892         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13893         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13894         esac
13895         case "$getprotobynumber_r_proto" in
13896         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13897         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13898         esac
13899         case "$getprotobynumber_r_proto" in
13900         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13901         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13902         esac
13903         case "$getprotobynumber_r_proto" in
13904         ''|0)   d_getprotobynumber_r=undef
13905                 getprotobynumber_r_proto=0
13906                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13907         * )     case "$getprotobynumber_r_proto" in
13908                 REENTRANT_PROTO*) ;;
13909                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13910                 esac
13911                 echo "Prototype: $try" ;;
13912         esac
13913         ;;
13914         *)      case "$usethreads" in
13915                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13916                 esac
13917                 d_getprotobynumber_r=undef
13918                 getprotobynumber_r_proto=0
13919                 ;;
13920         esac
13921         ;;
13922 *)      getprotobynumber_r_proto=0
13923         ;;
13924 esac
13925
13926 : see if getprotoent_r exists
13927 set getprotoent_r d_getprotoent_r
13928 eval $inlibc
13929 case "$d_getprotoent_r" in
13930 "$define")
13931         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13932         case "$d_getprotoent_r_proto:$usethreads" in
13933         ":define")      d_getprotoent_r_proto=define
13934                 set d_getprotoent_r_proto getprotoent_r $hdrs
13935                 eval $hasproto ;;
13936         *)      ;;
13937         esac
13938         case "$d_getprotoent_r_proto" in
13939         define)
13940         case "$getprotoent_r_proto" in
13941         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13942         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13943         esac
13944         case "$getprotoent_r_proto" in
13945         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13946         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13947         esac
13948         case "$getprotoent_r_proto" in
13949         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13950         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13951         esac
13952         case "$getprotoent_r_proto" in
13953         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13954         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13955         esac
13956         case "$getprotoent_r_proto" in
13957         ''|0)   d_getprotoent_r=undef
13958                 getprotoent_r_proto=0
13959                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13960         * )     case "$getprotoent_r_proto" in
13961                 REENTRANT_PROTO*) ;;
13962                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13963                 esac
13964                 echo "Prototype: $try" ;;
13965         esac
13966         ;;
13967         *)      case "$usethreads" in
13968                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13969                 esac
13970                 d_getprotoent_r=undef
13971                 getprotoent_r_proto=0
13972                 ;;
13973         esac
13974         ;;
13975 *)      getprotoent_r_proto=0
13976         ;;
13977 esac
13978
13979 : see if prototypes for various getprotoxxx netdb.h functions are available
13980 echo " "
13981 set d_getprotoprotos getprotoent $i_netdb netdb.h
13982 eval $hasproto
13983
13984 : see if getprpwnam exists
13985 set getprpwnam d_getprpwnam
13986 eval $inlibc
13987
13988 : see if getpwent exists
13989 set getpwent d_getpwent
13990 eval $inlibc
13991
13992 : see if getpwent_r exists
13993 set getpwent_r d_getpwent_r
13994 eval $inlibc
13995 case "$d_getpwent_r" in
13996 "$define")
13997         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13998         case "$d_getpwent_r_proto:$usethreads" in
13999         ":define")      d_getpwent_r_proto=define
14000                 set d_getpwent_r_proto getpwent_r $hdrs
14001                 eval $hasproto ;;
14002         *)      ;;
14003         esac
14004         case "$d_getpwent_r_proto" in
14005         define)
14006         case "$getpwent_r_proto" in
14007         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14008         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14009         esac
14010         case "$getpwent_r_proto" in
14011         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14012         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14013         esac
14014         case "$getpwent_r_proto" in
14015         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14016         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14017         esac
14018         case "$getpwent_r_proto" in
14019         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14020         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14021         esac
14022         case "$getpwent_r_proto" in
14023         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14024         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14025         esac
14026         case "$getpwent_r_proto" in
14027         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14028         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14029         esac
14030         case "$getpwent_r_proto" in
14031         ''|0)   d_getpwent_r=undef
14032                 getpwent_r_proto=0
14033                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14034         * )     case "$getpwent_r_proto" in
14035                 REENTRANT_PROTO*) ;;
14036                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14037                 esac
14038                 echo "Prototype: $try" ;;
14039         esac
14040         ;;
14041         *)      case "$usethreads" in
14042                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14043                 esac
14044                 d_getpwent_r=undef
14045                 getpwent_r_proto=0
14046                 ;;
14047         esac
14048         ;;
14049 *)      getpwent_r_proto=0
14050         ;;
14051 esac
14052
14053 : see if getpwnam_r exists
14054 set getpwnam_r d_getpwnam_r
14055 eval $inlibc
14056 case "$d_getpwnam_r" in
14057 "$define")
14058         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14059         case "$d_getpwnam_r_proto:$usethreads" in
14060         ":define")      d_getpwnam_r_proto=define
14061                 set d_getpwnam_r_proto getpwnam_r $hdrs
14062                 eval $hasproto ;;
14063         *)      ;;
14064         esac
14065         case "$d_getpwnam_r_proto" in
14066         define)
14067         case "$getpwnam_r_proto" in
14068         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14069         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14070         esac
14071         case "$getpwnam_r_proto" in
14072         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14073         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14074         esac
14075         case "$getpwnam_r_proto" in
14076         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14077         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14078         esac
14079         case "$getpwnam_r_proto" in
14080         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14081         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14082         esac
14083         case "$getpwnam_r_proto" in
14084         ''|0)   d_getpwnam_r=undef
14085                 getpwnam_r_proto=0
14086                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14087         * )     case "$getpwnam_r_proto" in
14088                 REENTRANT_PROTO*) ;;
14089                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14090                 esac
14091                 echo "Prototype: $try" ;;
14092         esac
14093         ;;
14094         *)      case "$usethreads" in
14095                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14096                 esac
14097                 d_getpwnam_r=undef
14098                 getpwnam_r_proto=0
14099                 ;;
14100         esac
14101         ;;
14102 *)      getpwnam_r_proto=0
14103         ;;
14104 esac
14105
14106 : see if getpwuid_r exists
14107 set getpwuid_r d_getpwuid_r
14108 eval $inlibc
14109 case "$d_getpwuid_r" in
14110 "$define")
14111         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14112         case "$d_getpwuid_r_proto:$usethreads" in
14113         ":define")      d_getpwuid_r_proto=define
14114                 set d_getpwuid_r_proto getpwuid_r $hdrs
14115                 eval $hasproto ;;
14116         *)      ;;
14117         esac
14118         case "$d_getpwuid_r_proto" in
14119         define)
14120         case "$getpwuid_r_proto" in
14121         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14122         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14123         esac
14124         case "$getpwuid_r_proto" in
14125         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14126         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14127         esac
14128         case "$getpwuid_r_proto" in
14129         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14130         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14131         esac
14132         case "$getpwuid_r_proto" in
14133         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14134         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14135         esac
14136         case "$getpwuid_r_proto" in
14137         ''|0)   d_getpwuid_r=undef
14138                 getpwuid_r_proto=0
14139                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14140         * )     case "$getpwuid_r_proto" in
14141                 REENTRANT_PROTO*) ;;
14142                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14143                 esac
14144                 echo "Prototype: $try" ;;
14145         esac
14146         ;;
14147         *)      case "$usethreads" in
14148                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14149                 esac
14150                 d_getpwuid_r=undef
14151                 getpwuid_r_proto=0
14152                 ;;
14153         esac
14154         ;;
14155 *)      getpwuid_r_proto=0
14156         ;;
14157 esac
14158
14159
14160 : see if getservbyname exists
14161 set getservbyname d_getsbyname
14162 eval $inlibc
14163
14164 : see if getservbyport exists
14165 set getservbyport d_getsbyport
14166 eval $inlibc
14167
14168 : see if getservent exists
14169 set getservent d_getsent
14170 eval $inlibc
14171
14172 : see if getservbyname_r exists
14173 set getservbyname_r d_getservbyname_r
14174 eval $inlibc
14175 case "$d_getservbyname_r" in
14176 "$define")
14177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14178         case "$d_getservbyname_r_proto:$usethreads" in
14179         ":define")      d_getservbyname_r_proto=define
14180                 set d_getservbyname_r_proto getservbyname_r $hdrs
14181                 eval $hasproto ;;
14182         *)      ;;
14183         esac
14184         case "$d_getservbyname_r_proto" in
14185         define)
14186         case "$getservbyname_r_proto" in
14187         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14188         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14189         esac
14190         case "$getservbyname_r_proto" in
14191         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14192         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14193         esac
14194         case "$getservbyname_r_proto" in
14195         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14196         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14197         esac
14198         case "$getservbyname_r_proto" in
14199         ''|0)   d_getservbyname_r=undef
14200                 getservbyname_r_proto=0
14201                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14202         * )     case "$getservbyname_r_proto" in
14203                 REENTRANT_PROTO*) ;;
14204                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14205                 esac
14206                 echo "Prototype: $try" ;;
14207         esac
14208         ;;
14209         *)      case "$usethreads" in
14210                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14211                 esac
14212                 d_getservbyname_r=undef
14213                 getservbyname_r_proto=0
14214                 ;;
14215         esac
14216         ;;
14217 *)      getservbyname_r_proto=0
14218         ;;
14219 esac
14220
14221 : see if getservbyport_r exists
14222 set getservbyport_r d_getservbyport_r
14223 eval $inlibc
14224 case "$d_getservbyport_r" in
14225 "$define")
14226         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14227         case "$d_getservbyport_r_proto:$usethreads" in
14228         ":define")      d_getservbyport_r_proto=define
14229                 set d_getservbyport_r_proto getservbyport_r $hdrs
14230                 eval $hasproto ;;
14231         *)      ;;
14232         esac
14233         case "$d_getservbyport_r_proto" in
14234         define)
14235         case "$getservbyport_r_proto" in
14236         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14237         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14238         esac
14239         case "$getservbyport_r_proto" in
14240         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14241         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14242         esac
14243         case "$getservbyport_r_proto" in
14244         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14245         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14246         esac
14247         case "$getservbyport_r_proto" in
14248         ''|0)   d_getservbyport_r=undef
14249                 getservbyport_r_proto=0
14250                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14251         * )     case "$getservbyport_r_proto" in
14252                 REENTRANT_PROTO*) ;;
14253                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14254                 esac
14255                 echo "Prototype: $try" ;;
14256         esac
14257         ;;
14258         *)      case "$usethreads" in
14259                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14260                 esac
14261                 d_getservbyport_r=undef
14262                 getservbyport_r_proto=0
14263                 ;;
14264         esac
14265         ;;
14266 *)      getservbyport_r_proto=0
14267         ;;
14268 esac
14269
14270 : see if getservent_r exists
14271 set getservent_r d_getservent_r
14272 eval $inlibc
14273 case "$d_getservent_r" in
14274 "$define")
14275         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14276         case "$d_getservent_r_proto:$usethreads" in
14277         ":define")      d_getservent_r_proto=define
14278                 set d_getservent_r_proto getservent_r $hdrs
14279                 eval $hasproto ;;
14280         *)      ;;
14281         esac
14282         case "$d_getservent_r_proto" in
14283         define)
14284         case "$getservent_r_proto" in
14285         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14286         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14287         esac
14288         case "$getservent_r_proto" in
14289         ''|0) try='int getservent_r(struct servent*, char*, int);'
14290         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14291         esac
14292         case "$getservent_r_proto" in
14293         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14294         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14295         esac
14296         case "$getservent_r_proto" in
14297         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14298         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14299         esac
14300         case "$getservent_r_proto" in
14301         ''|0)   d_getservent_r=undef
14302                 getservent_r_proto=0
14303                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14304         * )     case "$getservent_r_proto" in
14305                 REENTRANT_PROTO*) ;;
14306                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14307                 esac
14308                 echo "Prototype: $try" ;;
14309         esac
14310         ;;
14311         *)      case "$usethreads" in
14312                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14313                 esac
14314                 d_getservent_r=undef
14315                 getservent_r_proto=0
14316                 ;;
14317         esac
14318         ;;
14319 *)      getservent_r_proto=0
14320         ;;
14321 esac
14322
14323 : see if prototypes for various getservxxx netdb.h functions are available
14324 echo " "
14325 set d_getservprotos getservent $i_netdb netdb.h
14326 eval $hasproto
14327
14328 : see if getspnam exists
14329 set getspnam d_getspnam
14330 eval $inlibc
14331
14332 : see if this is a shadow.h system
14333 set shadow.h i_shadow
14334 eval $inhdr
14335
14336 : see if getspnam_r exists
14337 set getspnam_r d_getspnam_r
14338 eval $inlibc
14339 case "$d_getspnam_r" in
14340 "$define")
14341         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14342         case "$d_getspnam_r_proto:$usethreads" in
14343         ":define")      d_getspnam_r_proto=define
14344                 set d_getspnam_r_proto getspnam_r $hdrs
14345                 eval $hasproto ;;
14346         *)      ;;
14347         esac
14348         case "$d_getspnam_r_proto" in
14349         define)
14350         case "$getspnam_r_proto" in
14351         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14352         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14353         esac
14354         case "$getspnam_r_proto" in
14355         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14356         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14357         esac
14358         case "$getspnam_r_proto" in
14359         ''|0)   d_getspnam_r=undef
14360                 getspnam_r_proto=0
14361                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14362         * )     case "$getspnam_r_proto" in
14363                 REENTRANT_PROTO*) ;;
14364                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14365                 esac
14366                 echo "Prototype: $try" ;;
14367         esac
14368         ;;
14369         *)      case "$usethreads" in
14370                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14371                 esac
14372                 d_getspnam_r=undef
14373                 getspnam_r_proto=0
14374                 ;;
14375         esac
14376         ;;
14377 *)      getspnam_r_proto=0
14378         ;;
14379 esac
14380
14381 : see if gettimeofday or ftime exists
14382 set gettimeofday d_gettimeod
14383 eval $inlibc
14384 case "$d_gettimeod" in
14385 "$undef")
14386         set ftime d_ftime 
14387         eval $inlibc
14388         ;;
14389 *)
14390         val="$undef"; set d_ftime; eval $setvar
14391         ;;
14392 esac
14393 case "$d_gettimeod$d_ftime" in
14394 "$undef$undef")
14395         echo " "
14396         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14397         ;;
14398 esac
14399
14400 : see if gmtime_r exists
14401 set gmtime_r d_gmtime_r
14402 eval $inlibc
14403 case "$d_gmtime_r" in
14404 "$define")
14405         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14406         case "$d_gmtime_r_proto:$usethreads" in
14407         ":define")      d_gmtime_r_proto=define
14408                 set d_gmtime_r_proto gmtime_r $hdrs
14409                 eval $hasproto ;;
14410         *)      ;;
14411         esac
14412         case "$d_gmtime_r_proto" in
14413         define)
14414         case "$gmtime_r_proto" in
14415         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14416         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14417         esac
14418         case "$gmtime_r_proto" in
14419         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14420         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14421         esac
14422         case "$gmtime_r_proto" in
14423         ''|0)   d_gmtime_r=undef
14424                 gmtime_r_proto=0
14425                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14426         * )     case "$gmtime_r_proto" in
14427                 REENTRANT_PROTO*) ;;
14428                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14429                 esac
14430                 echo "Prototype: $try" ;;
14431         esac
14432         ;;
14433         *)      case "$usethreads" in
14434                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14435                 esac
14436                 d_gmtime_r=undef
14437                 gmtime_r_proto=0
14438                 ;;
14439         esac
14440         ;;
14441 *)      gmtime_r_proto=0
14442         ;;
14443 esac
14444
14445 : see if hasmntopt exists
14446 set hasmntopt d_hasmntopt
14447 eval $inlibc
14448
14449 : see if this is a netinet/in.h or sys/in.h system
14450 set netinet/in.h i_niin sys/in.h i_sysin
14451 eval $inhdr
14452
14453 : see if arpa/inet.h has to be included
14454 set arpa/inet.h i_arpainet
14455 eval $inhdr
14456
14457 : see if htonl --and friends-- exists
14458 val=''
14459 set htonl val
14460 eval $inlibc
14461
14462 : Maybe they are macros.
14463 case "$val" in
14464 $undef)
14465         $cat >htonl.c <<EOM
14466 #include <stdio.h>
14467 #include <sys/types.h>
14468 #$i_niin I_NETINET_IN
14469 #$i_sysin I_SYS_IN
14470 #$i_arpainet I_ARPA_INET
14471 #ifdef I_NETINET_IN
14472 #include <netinet/in.h>
14473 #endif
14474 #ifdef I_SYS_IN
14475 #include <sys/in.h>
14476 #endif
14477 #ifdef I_ARPA_INET
14478 #include <arpa/inet.h>
14479 #endif
14480 #ifdef htonl
14481 printf("Defined as a macro.");
14482 #endif
14483 EOM
14484         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14485         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14486                 val="$define"
14487                 echo "But it seems to be defined as a macro." >&4
14488         fi
14489         $rm -f htonl.?
14490         ;;
14491 esac
14492 set d_htonl
14493 eval $setvar
14494
14495 : see if ilogbl exists
14496 set ilogbl d_ilogbl
14497 eval $inlibc
14498
14499 : index or strchr
14500 echo " "
14501 if set index val -f; eval $csym; $val; then
14502         if set strchr val -f d_strchr; eval $csym; $val; then
14503                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14504                         val="$define"
14505                         vali="$undef"
14506                         echo "strchr() found." >&4
14507                 else
14508                         val="$undef"
14509                         vali="$define"
14510                         echo "index() found." >&4
14511                 fi
14512         else
14513                 val="$undef"
14514                 vali="$define"
14515                 echo "index() found." >&4
14516         fi
14517 else
14518         if set strchr val -f d_strchr; eval $csym; $val; then
14519                 val="$define"
14520                 vali="$undef"
14521                 echo "strchr() found." >&4
14522         else
14523                 echo "No index() or strchr() found!" >&4
14524                 val="$undef"
14525                 vali="$undef"
14526         fi
14527 fi
14528 set d_strchr; eval $setvar
14529 val="$vali"
14530 set d_index; eval $setvar
14531
14532 : check whether inet_aton exists
14533 set inet_aton d_inetaton
14534 eval $inlibc
14535
14536 : Look for isascii
14537 echo " "
14538 $cat >isascii.c <<EOCP
14539 #include <stdio.h>
14540 #include <ctype.h>
14541 #$i_stdlib I_STDLIB
14542 #ifdef I_STDLIB
14543 #include <stdlib.h>
14544 #endif
14545 int main() {
14546         int c = 'A';
14547         if (isascii(c))
14548                 exit(0);
14549         else
14550                 exit(1);
14551 }
14552 EOCP
14553 set isascii
14554 if eval $compile; then
14555         echo "isascii() found." >&4
14556         val="$define"
14557 else
14558         echo "isascii() NOT found." >&4
14559         val="$undef"
14560 fi
14561 set d_isascii
14562 eval $setvar
14563 $rm -f isascii*
14564
14565 : see if isfinite exists
14566 set isfinite d_isfinite
14567 eval $inlibc
14568
14569 : see if isinf exists
14570 set isinf d_isinf
14571 eval $inlibc
14572
14573 : see if isnan exists
14574 set isnan d_isnan
14575 eval $inlibc
14576
14577 : see if isnanl exists
14578 set isnanl d_isnanl
14579 eval $inlibc
14580
14581 : see if killpg exists
14582 set killpg d_killpg
14583 eval $inlibc
14584
14585 : see if lchown exists
14586 echo " "
14587 $cat > try.c <<'EOCP'
14588 /* System header to define __stub macros and hopefully few prototypes,
14589     which can conflict with char lchown(); below.  */
14590 #include <assert.h>
14591 /* Override any gcc2 internal prototype to avoid an error.  */
14592 /* We use char because int might match the return type of a gcc2
14593    builtin and then its argument prototype would still apply.  */
14594 char lchown();
14595 int main() {
14596     /*  The GNU C library defines this for functions which it implements
14597         to always fail with ENOSYS.  Some functions are actually named
14598         something starting with __ and the normal name is an alias.  */
14599 #if defined (__stub_lchown) || defined (__stub___lchown)
14600 choke me
14601 #else
14602 lchown();
14603 #endif
14604 ; return 0; }
14605 EOCP
14606 set try
14607 if eval $compile; then
14608     $echo "lchown() found." >&4
14609     val="$define"
14610 else
14611     $echo "lchown() NOT found." >&4
14612     val="$undef"
14613 fi
14614 set d_lchown
14615 eval $setvar
14616
14617 : See if number of significant digits in a double precision number is known
14618 echo " "
14619 $cat >ldbl_dig.c <<EOM
14620 #$i_limits I_LIMITS
14621 #$i_float I_FLOAT
14622 #ifdef I_LIMITS
14623 #include <limits.h>
14624 #endif
14625 #ifdef I_FLOAT
14626 #include <float.h>
14627 #endif
14628 #ifdef LDBL_DIG
14629 printf("Contains LDBL_DIG");
14630 #endif
14631 EOM
14632 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14633 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14634         echo "LDBL_DIG found." >&4
14635         val="$define"
14636 else
14637         echo "LDBL_DIG NOT found." >&4
14638         val="$undef"
14639 fi
14640 $rm -f ldbl_dig.?
14641 set d_ldbl_dig
14642 eval $setvar
14643
14644 : see if this is a math.h system
14645 set math.h i_math
14646 eval $inhdr
14647
14648 d_libm_lib_version="$undef"
14649 case $i_math in
14650     $define)
14651         : check to see if math.h defines _LIB_VERSION
14652         echo " "
14653         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14654         $cat >try.c <<EOCP
14655 #include <unistd.h>
14656 #include <math.h>
14657 int main (int argc, char *argv[])
14658 {
14659     printf ("%d\n", _LIB_VERSION);
14660     return (0);
14661     } /* main */
14662 EOCP
14663         set try
14664         if eval $compile; then
14665             foo=`$run ./try`
14666             echo "Yes, it does ($foo)" >&4
14667             d_libm_lib_version="$define"
14668         else
14669             echo "No, it does not (probably harmless)" >&4
14670             fi
14671         $rm_try
14672         ;;
14673
14674     esac
14675
14676 : see if link exists
14677 set link d_link
14678 eval $inlibc
14679
14680 : see if localtime_r exists
14681 set localtime_r d_localtime_r
14682 eval $inlibc
14683 case "$d_localtime_r" in
14684 "$define")
14685         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14686         case "$d_localtime_r_proto:$usethreads" in
14687         ":define")      d_localtime_r_proto=define
14688                 set d_localtime_r_proto localtime_r $hdrs
14689                 eval $hasproto ;;
14690         *)      ;;
14691         esac
14692         case "$d_localtime_r_proto" in
14693         define)
14694         case "$localtime_r_proto" in
14695         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14696         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14697         esac
14698         case "$localtime_r_proto" in
14699         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14700         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14701         esac
14702         case "$localtime_r_proto" in
14703         ''|0)   d_localtime_r=undef
14704                 localtime_r_proto=0
14705                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14706         * )     case "$localtime_r_proto" in
14707                 REENTRANT_PROTO*) ;;
14708                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14709                 esac
14710                 echo "Prototype: $try" ;;
14711         esac
14712         ;;
14713         *)      case "$usethreads" in
14714                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14715                 esac
14716                 d_localtime_r=undef
14717                 localtime_r_proto=0
14718                 ;;
14719         esac
14720         ;;
14721 *)      localtime_r_proto=0
14722         ;;
14723 esac
14724
14725 : see if localtime_r calls tzset
14726 case "$localtime_r_proto" in
14727 REENTRANT_PROTO*)
14728         $cat >try.c <<EOCP
14729 /*  Does our libc's localtime_r call tzset ?
14730  *  return 0 if so, 1 otherwise.
14731  */
14732 #include <sys/types.h>
14733 #include <unistd.h>
14734 #include <time.h>
14735 #include <string.h>
14736 #include <malloc.h>
14737 int main()
14738 {
14739     time_t t = time(0L);
14740     char w_tz[]="TZ" "=GMT+5",
14741          e_tz[]="TZ" "=GMT-5",
14742         *tz_e = (char*)malloc(16),
14743         *tz_w = (char*)malloc(16);
14744     struct tm tm_e, tm_w;
14745     memset(&tm_e,'\0',sizeof(struct tm));
14746     memset(&tm_w,'\0',sizeof(struct tm));
14747     strcpy(tz_e,e_tz);
14748     strcpy(tz_w,w_tz);
14749
14750     putenv(tz_e);
14751     localtime_r(&t, &tm_e);
14752
14753     putenv(tz_w);
14754     localtime_r(&t, &tm_w);
14755
14756     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14757         return 1;
14758     return 0;
14759 }
14760 EOCP
14761         set try
14762         if eval $compile; then
14763             if $run ./try; then
14764                 d_localtime_r_needs_tzset=undef;
14765             else
14766                 d_localtime_r_needs_tzset=define;
14767             fi;
14768         else
14769             d_localtime_r_needs_tzset=undef;
14770         fi;
14771      ;;
14772   *)
14773      d_localtime_r_needs_tzset=undef;
14774      ;;
14775 esac
14776 $rm_try
14777
14778 : see if localeconv exists
14779 set localeconv d_locconv
14780 eval $inlibc
14781
14782 : see if lockf exists
14783 set lockf d_lockf
14784 eval $inlibc
14785
14786 : see if prototype for lseek is available
14787 echo " "
14788 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14789 eval $hasproto
14790
14791 : see if lstat exists
14792 set lstat d_lstat
14793 eval $inlibc
14794
14795 : see if madvise exists
14796 set madvise d_madvise
14797 eval $inlibc
14798
14799 : see if malloc_size exists
14800 set malloc_size d_malloc_size
14801 eval $inlibc
14802
14803 : see if malloc_size_good exists
14804 set malloc_good_size d_malloc_good_size
14805 eval $inlibc
14806
14807 : see if mblen exists
14808 set mblen d_mblen
14809 eval $inlibc
14810
14811 : see if mbstowcs exists
14812 set mbstowcs d_mbstowcs
14813 eval $inlibc
14814
14815 : see if mbtowc exists
14816 set mbtowc d_mbtowc
14817 eval $inlibc
14818
14819 : see if memchr exists
14820 set memchr d_memchr
14821 eval $inlibc
14822
14823 : see if memcmp exists
14824 set memcmp d_memcmp
14825 eval $inlibc
14826
14827 : see if memcpy exists
14828 set memcpy d_memcpy
14829 eval $inlibc
14830
14831 : see if memmove exists
14832 set memmove d_memmove
14833 eval $inlibc
14834
14835 : see if memset exists
14836 set memset d_memset
14837 eval $inlibc
14838
14839 : see if mkdir exists
14840 set mkdir d_mkdir
14841 eval $inlibc
14842
14843 : see if mkdtemp exists
14844 set mkdtemp d_mkdtemp
14845 eval $inlibc
14846
14847 : see if mkfifo exists
14848 set mkfifo d_mkfifo
14849 eval $inlibc
14850
14851 : see if mkstemp exists
14852 set mkstemp d_mkstemp
14853 eval $inlibc
14854
14855 : see if mkstemps exists
14856 set mkstemps d_mkstemps
14857 eval $inlibc
14858
14859 : see if mktime exists
14860 set mktime d_mktime
14861 eval $inlibc
14862
14863 : see if this is a sys/mman.h system
14864 set sys/mman.h i_sysmman
14865 eval $inhdr
14866
14867 : see if mmap exists
14868 set mmap d_mmap
14869 eval $inlibc
14870 : see what shmat returns
14871 : default to something harmless
14872 mmaptype='void *'
14873 case "$i_sysmman$d_mmap" in
14874 "$define$define")
14875         $cat >mmap.c <<'END'
14876 #include <sys/mman.h>
14877 void *mmap();
14878 END
14879         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14880                 mmaptype='void *'
14881         else
14882                 mmaptype='caddr_t'
14883         fi
14884         echo "and it returns ($mmaptype)." >&4
14885         ;;
14886 esac
14887
14888
14889
14890 : see if sqrtl exists
14891 set sqrtl d_sqrtl
14892 eval $inlibc
14893
14894 : see if scalbnl exists
14895 set scalbnl d_scalbnl
14896 eval $inlibc
14897
14898 : see if modfl exists
14899 set modfl d_modfl
14900 eval $inlibc
14901
14902 : see if prototype for modfl is available
14903 echo " "
14904 set d_modflproto modfl $i_math math.h
14905 eval $hasproto
14906
14907 d_modfl_pow32_bug="$undef"
14908
14909 case "$d_longdbl$d_modfl" in
14910 $define$define)
14911         $cat <<EOM
14912 Checking to see whether your modfl() is okay for large values...
14913 EOM
14914 $cat >try.c <<EOCP
14915 #include <math.h>
14916 #include <stdio.h>
14917 EOCP
14918 if $test "X$d_modflproto" != "X$define"; then
14919         $cat >>try.c <<EOCP
14920 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14921 long double modfl (long double, long double *);
14922 EOCP
14923 fi
14924 $cat >>try.c <<EOCP
14925 int main() {
14926     long double nv = 4294967303.15;
14927     long double v, w;
14928     v = modfl(nv, &w);
14929 #ifdef __GLIBC__
14930     printf("glibc");
14931 #endif
14932     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14933     return 0;
14934 }
14935 EOCP
14936         case "$osname:$gccversion" in
14937         aix:)   saveccflags="$ccflags"
14938                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14939         esac
14940         set try
14941         if eval $compile; then
14942                 foo=`$run ./try`
14943                 case "$foo" in
14944                 *" 4294967303.150000 1.150000 4294967302.000000")
14945                         echo >&4 "Your modfl() is broken for large values."
14946                         d_modfl_pow32_bug="$define"
14947                         case "$foo" in
14948                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14949                         ;;
14950                         esac
14951                         ;;
14952                 *" 4294967303.150000 0.150000 4294967303.000000")
14953                         echo >&4 "Your modfl() seems okay for large values."
14954                         ;;
14955                 *)      echo >&4 "I don't understand your modfl() at all."
14956                         d_modfl="$undef"
14957                         ;;
14958                 esac
14959                 $rm_try
14960         else
14961                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14962                 d_modfl="$undef"
14963         fi
14964         case "$osname:$gccversion" in
14965         aix:)   ccflags="$saveccflags" ;; # restore
14966         esac
14967         ;;
14968 esac
14969
14970 if $test "$uselongdouble" = "$define"; then
14971     message=""
14972     if $test "$d_sqrtl" != "$define"; then
14973         message="$message sqrtl"
14974     fi
14975     if $test "$d_modfl" != "$define"; then
14976         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14977             echo "You have both aintl and copysignl, so I can emulate modfl."
14978         else
14979             message="$message modfl"
14980         fi
14981     fi
14982     if $test "$d_frexpl" != "$define"; then
14983         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14984             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14985         else
14986             message="$message frexpl"
14987         fi
14988     fi
14989
14990     if $test "$message" != ""; then
14991         $cat <<EOM >&4
14992
14993 *** You requested the use of long doubles but you do not seem to have
14994 *** the following mathematical functions needed for long double support:
14995 ***    $message
14996 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14997 *** Cannot continue, aborting.
14998
14999 EOM
15000
15001         exit 1
15002     fi
15003 fi
15004
15005 : see if mprotect exists
15006 set mprotect d_mprotect
15007 eval $inlibc
15008
15009 : see if msgctl exists
15010 set msgctl d_msgctl
15011 eval $inlibc
15012
15013 : see if msgget exists
15014 set msgget d_msgget
15015 eval $inlibc
15016
15017 : see if msgsnd exists
15018 set msgsnd d_msgsnd
15019 eval $inlibc
15020
15021 : see if msgrcv exists
15022 set msgrcv d_msgrcv
15023 eval $inlibc
15024
15025 : see how much of the 'msg*(2)' library is present.
15026 h_msg=true
15027 echo " "
15028 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15029 *"$undef"*) h_msg=false;;
15030 esac
15031 case "$osname" in
15032 freebsd)
15033     case "`ipcs 2>&1`" in
15034     "SVID messages"*"not configured"*)
15035         echo "Your $osname does not have the msg*(2) configured." >&4
15036         h_msg=false
15037         val="$undef"
15038         set msgctl d_msgctl
15039         eval $setvar
15040         set msgget d_msgget
15041         eval $setvar
15042         set msgsnd d_msgsnd
15043         eval $setvar
15044         set msgrcv d_msgrcv
15045         eval $setvar
15046         ;;
15047     esac
15048     ;;
15049 esac
15050 : we could also check for sys/ipc.h ...
15051 if $h_msg && $test `./findhdr sys/msg.h`; then
15052         echo "You have the full msg*(2) library." >&4
15053         val="$define"
15054 else
15055         echo "You don't have the full msg*(2) library." >&4
15056         val="$undef"
15057 fi
15058 set d_msg
15059 eval $setvar
15060
15061
15062 echo " "
15063 echo "Checking to see if your system supports struct msghdr..." >&4
15064 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15065 eval $hasstruct
15066 case "$d_msghdr_s" in
15067 "$define")      echo "Yes, it does."   ;;
15068 *)              echo "No, it doesn't." ;;
15069 esac
15070
15071
15072 : see if msync exists
15073 set msync d_msync
15074 eval $inlibc
15075
15076 : see if munmap exists
15077 set munmap d_munmap
15078 eval $inlibc
15079
15080 : see if nice exists
15081 set nice d_nice
15082 eval $inlibc
15083
15084 : see if this is a langinfo.h system
15085 set langinfo.h i_langinfo
15086 eval $inhdr
15087
15088 : see if nl_langinfo exists
15089 set nl_langinfo d_nl_langinfo
15090 eval $inlibc
15091
15092 : check for length of character
15093 echo " "
15094 case "$charsize" in
15095 '')
15096         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15097         $cat >try.c <<EOCP
15098 #include <stdio.h>
15099 #$i_stdlib I_STDLIB
15100 #ifdef I_STDLIB
15101 #include <stdlib.h>
15102 #endif
15103 int main()
15104 {
15105     printf("%d\n", (int)sizeof(char));
15106     exit(0);
15107 }
15108 EOCP
15109         set try
15110         if eval $compile_ok; then
15111                 dflt=`$run ./try`
15112         else
15113                 dflt='1'
15114                 echo "(I can't seem to compile the test program.  Guessing...)"
15115         fi
15116         ;;
15117 *)
15118         dflt="$charsize"
15119         ;;
15120 esac
15121 rp="What is the size of a character (in bytes)?"
15122 . ./myread
15123 charsize="$ans"
15124 $rm_try
15125
15126 : check for volatile keyword
15127 echo " "
15128 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15129 $cat >try.c <<'EOCP'
15130 int main()
15131 {
15132         typedef struct _goo_struct goo_struct;
15133         goo_struct * volatile goo = ((goo_struct *)0);
15134         struct _goo_struct {
15135                 long long_int;
15136                 int reg_int;
15137                 char char_var;
15138         };
15139         typedef unsigned short foo_t;
15140         char *volatile foo;
15141         volatile int bar;
15142         volatile foo_t blech;
15143         foo = foo;
15144 }
15145 EOCP
15146 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15147         val="$define"
15148         echo "Yup, it does."
15149 else
15150         val="$undef"
15151         echo "Nope, it doesn't."
15152 fi
15153 set d_volatile
15154 eval $setvar
15155 $rm_try
15156
15157
15158 echo " "
15159 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15160
15161 case "$use64bitint:$d_quad:$quadtype" in
15162 define:define:?*)
15163         ivtype="$quadtype"
15164         uvtype="$uquadtype"
15165         ivsize=8
15166         uvsize=8
15167         ;;
15168 *)      ivtype="long"
15169         uvtype="unsigned long"
15170         ivsize=$longsize
15171         uvsize=$longsize
15172         ;;
15173 esac
15174
15175 case "$uselongdouble:$d_longdbl" in
15176 define:define)
15177         nvtype="long double"
15178         nvsize=$longdblsize
15179         ;;
15180 *)      nvtype=double
15181         nvsize=$doublesize
15182         ;;
15183 esac
15184
15185 $echo "(IV will be "$ivtype", $ivsize bytes)"
15186 $echo "(UV will be "$uvtype", $uvsize bytes)"
15187 $echo "(NV will be "$nvtype", $nvsize bytes)"
15188
15189 $cat >try.c <<EOCP
15190 #$i_inttypes I_INTTYPES
15191 #ifdef I_INTTYPES
15192 #include <inttypes.h>
15193 #endif
15194 #include <stdio.h>
15195 int main() {
15196 #ifdef INT8
15197    int8_t i =  INT8_MAX;
15198   uint8_t u = UINT8_MAX;
15199   printf("int8_t\n");
15200 #endif
15201 #ifdef INT16
15202    int16_t i =  INT16_MAX;
15203   uint16_t i = UINT16_MAX;
15204   printf("int16_t\n");
15205 #endif
15206 #ifdef INT32
15207    int32_t i =  INT32_MAX;
15208   uint32_t u = UINT32_MAX;
15209   printf("int32_t\n");
15210 #endif
15211 }
15212 EOCP
15213
15214 case "$i8type" in
15215 '')     case "$charsize" in
15216         1)      i8type=char
15217                 u8type="unsigned char"
15218                 i8size=$charsize
15219                 u8size=$charsize
15220                 ;;
15221         esac
15222         ;;
15223 esac
15224 case "$i8type" in
15225 '')     set try -DINT8
15226         if eval $compile; then
15227                 case "`$run ./try`" in
15228                 int8_t) i8type=int8_t
15229                         u8type=uint8_t
15230                         i8size=1
15231                         u8size=1
15232                         ;;
15233                 esac
15234         fi
15235         ;;
15236 esac
15237 case "$i8type" in
15238 '')     if $test $charsize -ge 1; then
15239                 i8type=char
15240                 u8type="unsigned char"
15241                 i8size=$charsize
15242                 u8size=$charsize
15243         fi
15244         ;;
15245 esac
15246
15247 case "$i16type" in
15248 '')     case "$shortsize" in
15249         2)      i16type=short
15250                 u16type="unsigned short"
15251                 i16size=$shortsize
15252                 u16size=$shortsize
15253                 ;;
15254         esac
15255         ;;
15256 esac
15257 case "$i16type" in
15258 '')     set try -DINT16
15259         if eval $compile; then
15260                 case "`$run ./try`" in
15261                 int16_t)
15262                         i16type=int16_t
15263                         u16type=uint16_t
15264                         i16size=2
15265                         u16size=2
15266                         ;;
15267                 esac
15268         fi
15269         ;;
15270 esac
15271 case "$i16type" in
15272 '')     if $test $shortsize -ge 2; then
15273                 i16type=short
15274                 u16type="unsigned short"
15275                 i16size=$shortsize
15276                 u16size=$shortsize
15277         fi
15278         ;;
15279 esac
15280
15281 case "$i32type" in
15282 '')     case "$longsize" in
15283         4)      i32type=long
15284                 u32type="unsigned long"
15285                 i32size=$longsize
15286                 u32size=$longsize
15287                 ;;
15288         *)      case "$intsize" in
15289                 4)      i32type=int
15290                         u32type="unsigned int"
15291                         i32size=$intsize
15292                         u32size=$intsize
15293                         ;;
15294                 esac
15295                 ;;
15296         esac
15297         ;;
15298 esac
15299 case "$i32type" in
15300 '')     set try -DINT32
15301         if eval $compile; then
15302                 case "`$run ./try`" in
15303                 int32_t)
15304                         i32type=int32_t
15305                         u32type=uint32_t
15306                         i32size=4
15307                         u32size=4
15308                         ;;
15309                 esac
15310         fi
15311         ;;
15312 esac
15313 case "$i32type" in
15314 '')     if $test $intsize -ge 4; then
15315                 i32type=int
15316                 u32type="unsigned int"
15317                 i32size=$intsize
15318                 u32size=$intsize
15319         fi
15320         ;;
15321 esac
15322
15323 case "$i64type" in
15324 '')     case "$d_quad:$quadtype" in
15325         define:?*)
15326                 i64type="$quadtype"
15327                 u64type="$uquadtype"
15328                 i64size=8
15329                 u64size=8
15330                 ;;
15331         esac
15332         ;;
15333 esac
15334
15335 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15336 : volatile so that the compiler has to store it out to memory.
15337 if test X"$d_volatile" = X"$define"; then
15338         volatile=volatile
15339 fi
15340 $cat <<EOP >try.c
15341 #include <stdio.h>
15342 #$i_stdlib I_STDLIB
15343 #ifdef I_STDLIB
15344 #include <stdlib.h>
15345 #endif
15346 #include <sys/types.h>
15347 #include <signal.h>
15348 #ifdef SIGFPE
15349 $volatile int bletched = 0;
15350 $signal_t blech(int s) { bletched = 1; }
15351 #endif
15352 int main() {
15353     $uvtype u = 0;
15354     $nvtype d;
15355     int     n = 8 * $uvsize;
15356     int     i;
15357 #ifdef SIGFPE
15358     signal(SIGFPE, blech);
15359 #endif
15360
15361     for (i = 0; i < n; i++) {
15362       u = u << 1 | ($uvtype)1;
15363       d = ($nvtype)u;
15364       if (($uvtype)d != u)
15365         break;
15366       if (d <= 0)
15367         break;
15368       d = ($nvtype)(u - 1);
15369       if (($uvtype)d != (u - 1))
15370         break;
15371 #ifdef SIGFPE
15372       if (bletched)
15373         break;
15374 #endif
15375     }
15376     printf("%d\n", ((i == n) ? -n : i));
15377     exit(0);
15378 }
15379 EOP
15380 set try
15381
15382 d_nv_preserves_uv="$undef"
15383 if eval $compile; then
15384         nv_preserves_uv_bits="`$run ./try`"
15385 fi
15386 case "$nv_preserves_uv_bits" in
15387 \-[1-9]*)
15388         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15389         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15390         d_nv_preserves_uv="$define"
15391         ;;
15392 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15393         d_nv_preserves_uv="$undef" ;;
15394 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15395         nv_preserves_uv_bits="0" ;;
15396 esac
15397 $rm_try
15398
15399 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15400 : volatile so that the compiler has to store it out to memory.
15401 if test X"$d_volatile" = X"$define"; then
15402         volatile=volatile
15403 fi
15404 $cat <<EOP >try.c
15405 #include <stdio.h>
15406 #$i_stdlib I_STDLIB
15407 #ifdef I_STDLIB
15408 #include <stdlib.h>
15409 #endif
15410 #$i_string I_STRING
15411 #ifdef I_STRING
15412 #  include <string.h>
15413 #else
15414 #  include <strings.h>
15415 #endif
15416 #include <sys/types.h>
15417 #include <signal.h>
15418 #ifdef SIGFPE
15419 $volatile int bletched = 0;
15420 $signal_t blech(int s) { bletched = 1; }
15421 #endif
15422
15423 int checkit($nvtype d, char *where) {
15424     unsigned char *p = (char *)&d;
15425     unsigned char *end = p + sizeof(d);
15426     int fail = 0;
15427
15428     while (p < end)
15429         fail += *p++;
15430
15431     if (!fail)
15432         return 0;
15433
15434     p = (char *)&d;
15435     printf("No - %s: 0x", where);
15436     while (p < end)
15437         printf ("%02X", *p++);
15438     printf("\n");
15439     return 1;
15440 }
15441
15442 int main(int argc, char **argv) {
15443     $nvtype d = 0.0;
15444     int fail = 0;
15445     fail += checkit(d, "0.0");
15446
15447     /* The compiler shouldn't be assuming that bletched is 0  */
15448     d = bletched;
15449
15450     fail += checkit(d, "bleched");
15451
15452 #ifdef SIGFPE
15453     signal(SIGFPE, blech);
15454 #endif
15455
15456     /* Paranoia - the compiler should have no way of knowing that ANSI says
15457        that argv[argc] will always be NULL.  Actually, if it did assume this it
15458        would be buggy, as this is C and main() can be called from elsewhere in
15459        the program.  */
15460     d = argv[argc] ? 1 : 0;
15461
15462     if (d) {
15463         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15464     }
15465
15466     fail += checkit(d, "ternary");
15467
15468     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15469
15470     if (d != 0.0) {
15471         printf("No - memset doesn't give 0.0\n");
15472         /* This might just blow up:  */
15473         printf("(gives %g)\n", d);
15474         return 1;
15475     }
15476
15477 #ifdef SIGFPE
15478     if (bletched) {
15479         printf("No - something bleched\n");
15480         return 1;
15481     }
15482 #endif
15483     if (fail) {
15484       printf("No - %d fail(s)\n", fail);
15485       return 1;
15486     }
15487     printf("Yes\n");
15488     return 0;
15489 }
15490 EOP
15491 set try
15492
15493 d_nv_zero_is_allbits_zero="$undef"
15494 if eval $compile; then
15495     xxx="`$run ./try`"
15496     case "$?" in
15497         0)
15498             case "$xxx" in
15499                 Yes)  cat >&4 <<EOM
15500 0.0 is represented as all bits zero in memory
15501 EOM
15502                     d_nv_zero_is_allbits_zero="$define"
15503                     ;;
15504                 *)  cat >&4 <<EOM
15505 0.0 is not represented as all bits zero in memory
15506 EOM
15507                     d_nv_zero_is_allbits_zero="$undef"
15508                     ;;
15509             esac
15510             ;;
15511         *)  cat >&4 <<EOM
15512 0.0 is not represented as all bits zero in memory
15513 EOM
15514             d_nv_zero_is_allbits_zero="$undef"
15515             ;;
15516     esac
15517 fi
15518 $rm_try
15519
15520 : check for off64_t
15521 echo " "
15522 echo "Checking to see if you have off64_t..." >&4
15523 $cat >try.c <<EOCP
15524 #include <sys/types.h>
15525 #include <unistd.h>
15526 int main() { off64_t x = 7; }
15527 EOCP
15528 set try
15529 if eval $compile; then
15530         val="$define"
15531         echo "You have off64_t."
15532 else
15533         val="$undef"
15534         echo "You do not have off64_t."
15535         case "$lseeksize" in
15536         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15537         esac
15538 fi
15539 $rm_try
15540 set d_off64_t
15541 eval $setvar
15542
15543 : how to create joinable pthreads
15544 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15545         echo " "
15546         echo "Checking what constant to use for creating joinable pthreads..." >&4
15547         $cat >try.c <<'EOCP'
15548 #include <pthread.h>
15549 int main() {
15550     int detachstate = JOINABLE;
15551 }
15552 EOCP
15553         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15554         if eval $compile; then
15555                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15556                 val="$undef" # Yes, undef.
15557                 set d_old_pthread_create_joinable
15558                 eval $setvar
15559                 val=""
15560                 set old_pthread_create_joinable
15561                 eval $setvar
15562         else
15563                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15564                 if eval $compile; then
15565                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15566                         val="$define"
15567                         set d_old_pthread_create_joinable
15568                         eval $setvar
15569                         val=PTHREAD_CREATE_UNDETACHED
15570                         set old_pthread_create_joinable
15571                         eval $setvar
15572                 else
15573                         set try -DJOINABLE=__UNDETACHED
15574                         if eval $compile; then
15575                                 echo "You seem to use __UNDETACHED." >&4
15576                                 val="$define"
15577                                 set d_old_pthread_create_joinable
15578                                 eval $setvar
15579                                 val=__UNDETACHED
15580                                 set old_pthread_create_joinable
15581                                 eval $setvar
15582                         else
15583                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15584                                 val="$define"
15585                                 set d_old_pthread_create_joinable
15586                                 eval $setvar
15587                                 val=0
15588                                 set old_pthread_create_joinable
15589                                 eval $setvar
15590                         fi
15591                 fi
15592         fi
15593         $rm_try
15594 else
15595     d_old_pthread_create_joinable="$undef"
15596     old_pthread_create_joinable=""
15597 fi
15598
15599 : see if pause exists
15600 set pause d_pause
15601 eval $inlibc
15602
15603 : see if poll exists
15604 set poll d_poll
15605 eval $inlibc
15606
15607 : see if readlink exists
15608 set readlink d_readlink
15609 eval $inlibc
15610
15611 echo " "
15612 procselfexe=''
15613 val="$undef"
15614 case "$d_readlink" in
15615 "$define")
15616         if $issymlink /proc/self/exe ; then
15617                 $ls -l /proc/self/exe > reflect
15618                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15619                         echo "You have Linux-like /proc/self/exe."
15620                         procselfexe='"/proc/self/exe"'
15621                         val="$define"
15622                 fi
15623         fi
15624         if $issymlink /proc/curproc/file ; then
15625                 $ls -l /proc/curproc/file > reflect
15626                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15627                         echo "You have BSD-like /proc/curproc/file."
15628                         procselfexe='"/proc/curproc/file"'
15629                         val="$define"
15630                 fi
15631         fi
15632         ;;
15633 esac
15634 $rm -f reflect
15635 set d_procselfexe
15636 eval $setvar
15637
15638 : backward compatibility for d_hvfork
15639 if test X$d_hvfork != X; then
15640         d_vfork="$d_hvfork"
15641         d_hvfork=''
15642 fi
15643 : see if there is a vfork
15644 val=''
15645 set vfork val
15646 eval $inlibc
15647
15648 d_pseudofork=$undef
15649
15650 : Ok, but do we want to use it. vfork is reportedly unreliable in
15651 : perl on Solaris 2.x, and probably elsewhere.
15652 case "$val" in
15653 $define)
15654         echo " "
15655         case "$usevfork" in
15656         false) dflt='n';;
15657         *) dflt='y';;
15658         esac
15659         cat <<'EOM'
15660
15661 Perl can only use a vfork() that doesn't suffer from strict
15662 restrictions on calling functions or modifying global data in
15663 the child.  For example, glibc-2.1 contains such a vfork()
15664 that is unsuitable.  If your system provides a proper fork()
15665 call, chances are that you do NOT want perl to use vfork().
15666
15667 EOM
15668         rp="Do you still want to use vfork()?"
15669         . ./myread
15670         case "$ans" in
15671         y|Y) ;;
15672         *)
15673                 echo "Ok, we won't use vfork()."
15674                 val="$undef"
15675                 ;;
15676         esac
15677         ;;
15678 esac
15679 set d_vfork
15680 eval $setvar
15681 case "$d_vfork" in
15682 $define) usevfork='true';;
15683 *) usevfork='false';;
15684 esac
15685
15686 : see whether the pthread_atfork exists
15687 $cat >try.c <<EOP
15688 #include <pthread.h>
15689 #include <stdio.h>
15690 int main() {
15691 #ifdef  PTHREAD_ATFORK
15692         pthread_atfork(NULL,NULL,NULL);
15693 #endif
15694 }
15695 EOP
15696
15697 : see if pthread_atfork exists
15698 set try -DPTHREAD_ATFORK
15699 if eval $compile; then
15700     val="$define"
15701 else
15702     val="$undef"
15703 fi
15704 case "$usethreads" in
15705 $define)
15706         case "$val" in
15707         $define) echo 'pthread_atfork found.' >&4        ;;
15708         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15709         esac
15710 esac
15711 set d_pthread_atfork
15712 eval $setvar
15713
15714 : see if pthread_attr_setscope exists
15715 set pthread_attr_setscope d_pthread_attr_setscope
15716 eval $inlibc
15717
15718
15719 : see whether the various POSIXish _yields exist
15720 $cat >try.c <<EOP
15721 #include <pthread.h>
15722 #include <stdio.h>
15723 int main() {
15724 #ifdef SCHED_YIELD
15725         sched_yield();
15726 #else
15727 #ifdef PTHREAD_YIELD
15728         pthread_yield();
15729 #else
15730 #ifdef PTHREAD_YIELD_NULL
15731         pthread_yield(NULL);
15732 #endif
15733 #endif
15734 #endif
15735 }
15736 EOP
15737 : see if sched_yield exists
15738 set try -DSCHED_YIELD
15739 if eval $compile; then
15740     val="$define"
15741     sched_yield='sched_yield()'
15742 else
15743     val="$undef"
15744 fi
15745 case "$usethreads" in
15746 $define)
15747         case "$val" in
15748         $define) echo 'sched_yield() found.' >&4        ;;
15749         *)       echo 'sched_yield() NOT found.' >&4    ;;
15750         esac
15751 esac
15752 set d_sched_yield
15753 eval $setvar
15754
15755 : see if pthread_yield exists
15756 set try -DPTHREAD_YIELD
15757 if eval $compile; then
15758     val="$define"
15759     case "$sched_yield" in
15760     '') sched_yield='pthread_yield()' ;;
15761     esac
15762 else
15763     set try -DPTHREAD_YIELD_NULL
15764     if eval $compile; then
15765         val="$define"
15766         case "$sched_yield" in
15767         '') sched_yield='pthread_yield(NULL)' ;;
15768         esac
15769     else
15770         val="$undef"
15771     fi
15772 fi
15773 case "$usethreads" in
15774 $define)
15775         case "$val" in
15776         $define) echo 'pthread_yield() found.' >&4      ;;
15777         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15778         esac
15779         ;;
15780 esac
15781 set d_pthread_yield
15782 eval $setvar
15783 case "$sched_yield" in
15784 '') sched_yield=undef ;;
15785 esac
15786 $rm_try
15787
15788 : see if random_r exists
15789 set random_r d_random_r
15790 eval $inlibc
15791 case "$d_random_r" in
15792 "$define")
15793         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15794         case "$d_random_r_proto:$usethreads" in
15795         ":define")      d_random_r_proto=define
15796                 set d_random_r_proto random_r $hdrs
15797                 eval $hasproto ;;
15798         *)      ;;
15799         esac
15800         case "$d_random_r_proto" in
15801         define)
15802         case "$random_r_proto" in
15803         ''|0) try='int random_r(int*, struct random_data*);'
15804         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15805         esac
15806         case "$random_r_proto" in
15807         ''|0) try='int random_r(long*, struct random_data*);'
15808         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15809         esac
15810         case "$random_r_proto" in
15811         ''|0) try='int random_r(struct random_data*, int32_t*);'
15812         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15813         esac
15814         case "$random_r_proto" in
15815         ''|0)   d_random_r=undef
15816                 random_r_proto=0
15817                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15818         * )     case "$random_r_proto" in
15819                 REENTRANT_PROTO*) ;;
15820                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15821                 esac
15822                 echo "Prototype: $try" ;;
15823         esac
15824         ;;
15825         *)      case "$usethreads" in
15826                 define) echo "random_r has no prototype, not using it." >&4 ;;
15827                 esac
15828                 d_random_r=undef
15829                 random_r_proto=0
15830                 ;;
15831         esac
15832         ;;
15833 *)      random_r_proto=0
15834         ;;
15835 esac
15836
15837 : see if readdir and friends exist
15838 set readdir d_readdir
15839 eval $inlibc
15840 set seekdir d_seekdir
15841 eval $inlibc
15842 set telldir d_telldir
15843 eval $inlibc
15844 set rewinddir d_rewinddir
15845 eval $inlibc
15846
15847 : see if readdir64_r exists
15848 set readdir64_r d_readdir64_r
15849 eval $inlibc
15850 case "$d_readdir64_r" in
15851 "$define")
15852         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15853         case "$d_readdir64_r_proto:$usethreads" in
15854         ":define")      d_readdir64_r_proto=define
15855                 set d_readdir64_r_proto readdir64_r $hdrs
15856                 eval $hasproto ;;
15857         *)      ;;
15858         esac
15859         case "$d_readdir64_r_proto" in
15860         define)
15861         case "$readdir64_r_proto" in
15862         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15863         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15864         esac
15865         case "$readdir64_r_proto" in
15866         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15867         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15868         esac
15869         case "$readdir64_r_proto" in
15870         ''|0)   d_readdir64_r=undef
15871                 readdir64_r_proto=0
15872                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15873         * )     case "$readdir64_r_proto" in
15874                 REENTRANT_PROTO*) ;;
15875                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15876                 esac
15877                 echo "Prototype: $try" ;;
15878         esac
15879         ;;
15880         *)      case "$usethreads" in
15881                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15882                 esac
15883                 d_readdir64_r=undef
15884                 readdir64_r_proto=0
15885                 ;;
15886         esac
15887         ;;
15888 *)      readdir64_r_proto=0
15889         ;;
15890 esac
15891
15892 : see if readdir_r exists
15893 set readdir_r d_readdir_r
15894 eval $inlibc
15895 case "$d_readdir_r" in
15896 "$define")
15897         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15898         case "$d_readdir_r_proto:$usethreads" in
15899         ":define")      d_readdir_r_proto=define
15900                 set d_readdir_r_proto readdir_r $hdrs
15901                 eval $hasproto ;;
15902         *)      ;;
15903         esac
15904         case "$d_readdir_r_proto" in
15905         define)
15906         case "$readdir_r_proto" in
15907         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15908         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15909         esac
15910         case "$readdir_r_proto" in
15911         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15912         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15913         esac
15914         case "$readdir_r_proto" in
15915         ''|0)   d_readdir_r=undef
15916                 readdir_r_proto=0
15917                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15918         * )     case "$readdir_r_proto" in
15919                 REENTRANT_PROTO*) ;;
15920                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15921                 esac
15922                 echo "Prototype: $try" ;;
15923         esac
15924         ;;
15925         *)      case "$usethreads" in
15926                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15927                 esac
15928                 d_readdir_r=undef
15929                 readdir_r_proto=0
15930                 ;;
15931         esac
15932         ;;
15933 *)      readdir_r_proto=0
15934         ;;
15935 esac
15936
15937 : see if readv exists
15938 set readv d_readv
15939 eval $inlibc
15940
15941 : see if recvmsg exists
15942 set recvmsg d_recvmsg
15943 eval $inlibc
15944
15945 : see if rename exists
15946 set rename d_rename
15947 eval $inlibc
15948
15949 : see if rmdir exists
15950 set rmdir d_rmdir
15951 eval $inlibc
15952
15953 : see if memory.h is available.
15954 val=''
15955 set memory.h val
15956 eval $inhdr
15957
15958 : See if it conflicts with string.h
15959 case "$val" in
15960 $define)
15961         case "$strings" in
15962         '') ;;
15963         *)
15964                 $cppstdin $cppflags $cppminus < $strings > mem.h
15965                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15966                         echo " "
15967                         echo "We won't be including <memory.h>."
15968                         val="$undef"
15969                 fi
15970                 $rm -f mem.h
15971                 ;;
15972         esac
15973 esac
15974 set i_memory
15975 eval $setvar
15976
15977 : can bcopy handle overlapping blocks?
15978 echo " "
15979 val="$undef"
15980 case "$d_memmove" in
15981 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15982 *)      case "$d_bcopy" in
15983         "$define")
15984                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15985                 $cat >try.c <<EOCP
15986 #$i_memory I_MEMORY
15987 #$i_stdlib I_STDLIB
15988 #$i_string I_STRING
15989 #$i_unistd I_UNISTD
15990 EOCP
15991         $cat >>try.c <<'EOCP'
15992 #include <stdio.h>
15993 #ifdef I_MEMORY
15994 #  include <memory.h>
15995 #endif
15996 #ifdef I_STDLIB
15997 #  include <stdlib.h>
15998 #endif
15999 #ifdef I_STRING
16000 #  include <string.h>
16001 #else
16002 #  include <strings.h>
16003 #endif
16004 #ifdef I_UNISTD
16005 #  include <unistd.h>  /* Needed for NetBSD */
16006 #endif
16007 int main()
16008 {
16009 char buf[128], abc[128];
16010 char *b;
16011 int len;
16012 int off;
16013 int align;
16014
16015 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16016    try to store the string in read-only memory. */
16017 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16018
16019 for (align = 7; align >= 0; align--) {
16020         for (len = 36; len; len--) {
16021                 b = buf+align;
16022                 bcopy(abc, b, len);
16023                 for (off = 1; off <= len; off++) {
16024                         bcopy(b, b+off, len);
16025                         bcopy(b+off, b, len);
16026                         if (bcmp(b, abc, len))
16027                                 exit(1);
16028                 }
16029         }
16030 }
16031 exit(0);
16032 }
16033 EOCP
16034                 set try
16035                 if eval $compile_ok; then
16036                         if $run ./try 2>/dev/null; then
16037                                 echo "Yes, it can."
16038                                 val="$define"
16039                         else
16040                                 echo "It can't, sorry."
16041                         fi
16042                 else
16043                         echo "(I can't compile the test program, so we'll assume not...)"
16044                 fi
16045                 ;;
16046         esac
16047         $rm_try
16048         ;;
16049 esac
16050 set d_safebcpy
16051 eval $setvar
16052
16053 : can memcpy handle overlapping blocks?
16054 echo " "
16055 val="$undef"
16056 case "$d_memmove" in
16057 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16058 *)      case "$d_memcpy" in
16059         "$define")
16060                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16061                 $cat >try.c <<EOCP
16062 #$i_memory I_MEMORY
16063 #$i_stdlib I_STDLIB
16064 #$i_string I_STRING
16065 #$i_unistd I_UNISTD
16066 EOCP
16067         $cat >>try.c <<'EOCP'
16068 #include <stdio.h>
16069 #ifdef I_MEMORY
16070 #  include <memory.h>
16071 #endif
16072 #ifdef I_STDLIB
16073 #  include <stdlib.h>
16074 #endif
16075 #ifdef I_STRING
16076 #  include <string.h>
16077 #else
16078 #  include <strings.h>
16079 #endif
16080 #ifdef I_UNISTD
16081 #  include <unistd.h>  /* Needed for NetBSD */
16082 #endif
16083 int main()
16084 {
16085 char buf[128], abc[128];
16086 char *b;
16087 int len;
16088 int off;
16089 int align;
16090
16091 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16092    try to store the string in read-only memory. */
16093 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16094
16095 for (align = 7; align >= 0; align--) {
16096         for (len = 36; len; len--) {
16097                 b = buf+align;
16098                 memcpy(b, abc, len);
16099                 for (off = 1; off <= len; off++) {
16100                         memcpy(b+off, b, len);
16101                         memcpy(b, b+off, len);
16102                         if (memcmp(b, abc, len))
16103                                 exit(1);
16104                 }
16105         }
16106 }
16107 exit(0);
16108 }
16109 EOCP
16110                 set try
16111                 if eval $compile_ok; then
16112                         if $run ./try 2>/dev/null; then
16113                                 echo "Yes, it can."
16114                                 val="$define"
16115                         else
16116                                 echo "It can't, sorry."
16117                         fi
16118                 else
16119                         echo "(I can't compile the test program, so we'll assume not...)"
16120                 fi
16121                 ;;
16122         esac
16123         $rm_try
16124         ;;
16125 esac
16126 set d_safemcpy
16127 eval $setvar
16128
16129 : can memcmp be trusted to compare relative magnitude?
16130 val="$undef"
16131 case "$d_memcmp" in
16132 "$define")
16133         echo " "
16134         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16135         $cat >try.c <<EOCP
16136 #$i_memory I_MEMORY
16137 #$i_stdlib I_STDLIB
16138 #$i_string I_STRING
16139 #$i_unistd I_UNISTD
16140 EOCP
16141         $cat >>try.c <<'EOCP'
16142 #include <stdio.h>
16143 #ifdef I_MEMORY
16144 #  include <memory.h>
16145 #endif
16146 #ifdef I_STDLIB
16147 #  include <stdlib.h>
16148 #endif
16149 #ifdef I_STRING
16150 #  include <string.h>
16151 #else
16152 #  include <strings.h>
16153 #endif
16154 #ifdef I_UNISTD
16155 #  include <unistd.h>  /* Needed for NetBSD */
16156 #endif
16157 int main()
16158 {
16159 char a = -1;
16160 char b = 0;
16161 if ((a < b) && memcmp(&a, &b, 1) < 0)
16162         exit(1);
16163 exit(0);
16164 }
16165 EOCP
16166         set try
16167         if eval $compile_ok; then
16168                 if $run ./try 2>/dev/null; then
16169                         echo "Yes, it can."
16170                         val="$define"
16171                 else
16172                         echo "No, it can't (it uses signed chars)."
16173                 fi
16174         else
16175                 echo "(I can't compile the test program, so we'll assume not...)"
16176         fi
16177         ;;
16178 esac
16179 $rm_try
16180 set d_sanemcmp
16181 eval $setvar
16182
16183 : see if prototype for sbrk is available
16184 echo " "
16185 set d_sbrkproto sbrk $i_unistd unistd.h
16186 eval $hasproto
16187
16188 : see if select exists
16189 set select d_select
16190 eval $inlibc
16191
16192 : see if semctl exists
16193 set semctl d_semctl
16194 eval $inlibc
16195
16196 : see if semget exists
16197 set semget d_semget
16198 eval $inlibc
16199
16200 : see if semop exists
16201 set semop d_semop
16202 eval $inlibc
16203
16204 : see how much of the 'sem*(2)' library is present.
16205 h_sem=true
16206 echo " "
16207 case "$d_semctl$d_semget$d_semop" in
16208 *"$undef"*) h_sem=false;;
16209 esac
16210 case "$osname" in
16211 freebsd)
16212     case "`ipcs 2>&1`" in
16213     "SVID messages"*"not configured"*)
16214         echo "Your $osname does not have the sem*(2) configured." >&4
16215         h_sem=false
16216         val="$undef"
16217         set semctl d_semctl
16218         eval $setvar
16219         set semget d_semget
16220         eval $setvar
16221         set semop d_semop
16222         eval $setvar
16223         ;;
16224     esac
16225     ;;
16226 esac
16227 : we could also check for sys/ipc.h ...
16228 if $h_sem && $test `./findhdr sys/sem.h`; then
16229         echo "You have the full sem*(2) library." >&4
16230         val="$define"
16231 else
16232         echo "You don't have the full sem*(2) library." >&4
16233         val="$undef"
16234 fi
16235 set d_sem
16236 eval $setvar
16237
16238 : see whether sys/sem.h defines union semun
16239 echo " "
16240 $cat > try.c <<'END'
16241 #include <sys/types.h>
16242 #include <sys/ipc.h>
16243 #include <sys/sem.h>
16244 int main () { union semun semun; semun.buf = 0; }
16245 END
16246 set try
16247 if eval $compile; then
16248     echo "You have union semun in <sys/sem.h>." >&4
16249     val="$define"
16250 else
16251     echo "You do not have union semun in <sys/sem.h>." >&4
16252     val="$undef"
16253 fi
16254 $rm_try
16255 set d_union_semun
16256 eval $setvar
16257
16258 : see how to do semctl IPC_STAT
16259 case "$d_sem" in
16260 $define)
16261     echo " "
16262     $cat > tryh.h <<END
16263 #ifndef S_IRUSR
16264 #   ifdef S_IREAD
16265 #       define S_IRUSR S_IREAD
16266 #       define S_IWUSR S_IWRITE
16267 #       define S_IXUSR S_IEXEC
16268 #   else
16269 #       define S_IRUSR 0400
16270 #       define S_IWUSR 0200
16271 #       define S_IXUSR 0100
16272 #   endif
16273 #   define S_IRGRP (S_IRUSR>>3)
16274 #   define S_IWGRP (S_IWUSR>>3)
16275 #   define S_IXGRP (S_IXUSR>>3)
16276 #   define S_IROTH (S_IRUSR>>6)
16277 #   define S_IWOTH (S_IWUSR>>6)
16278 #   define S_IXOTH (S_IXUSR>>6)
16279 #endif
16280 #ifndef S_IRWXU
16281 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16282 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16283 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16284 #endif
16285 END
16286     : see whether semctl IPC_STAT can use union semun
16287     case "$d_semctl_semun" in
16288     '')
16289       val="$undef"
16290       $cat > try.c <<END
16291 #include <sys/types.h>
16292 #include <sys/ipc.h>
16293 #include <sys/sem.h>
16294 #include <sys/stat.h>
16295 #include <stdio.h>
16296 #include <errno.h>
16297 #include "tryh.h"
16298 #ifndef errno
16299 extern int errno;
16300 #endif
16301 #$d_union_semun HAS_UNION_SEMUN
16302 int main() {
16303     union semun
16304 #ifndef HAS_UNION_SEMUN
16305     {
16306         int val;
16307         struct semid_ds *buf;
16308         unsigned short *array;
16309     }
16310 #endif
16311     arg;
16312     int sem, st;
16313
16314 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16315     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16316     if (sem > -1) {
16317         struct semid_ds argbuf;
16318         arg.buf = &argbuf;
16319 #       ifdef IPC_STAT
16320         st = semctl(sem, 0, IPC_STAT, arg);
16321         if (st == 0)
16322             printf("semun\n");
16323         else
16324 #       endif /* IPC_STAT */
16325             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16326 #       ifdef IPC_RMID
16327         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16328 #       endif /* IPC_RMID */
16329             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16330     } else
16331 #endif /* IPC_PRIVATE && ... */
16332         printf("semget failed: errno = %d\n", errno);
16333   return 0;
16334 }
16335 END
16336       set try
16337       if eval $compile; then
16338           xxx=`$run ./try`
16339           case "$xxx" in
16340           semun) val="$define" ;;
16341           esac
16342       fi
16343       $rm_try
16344       set d_semctl_semun
16345       eval $setvar
16346       ;;
16347     esac
16348     case "$d_semctl_semun" in
16349     $define)
16350         echo "You can use union semun for semctl IPC_STAT." >&4
16351         also='also'
16352         ;;
16353     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16354         also=''
16355         ;;
16356     esac
16357
16358     : see whether semctl IPC_STAT can use struct semid_ds pointer
16359     case "$d_semctl_semid_ds" 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 "tryh.h"
16368 #include <stdio.h>
16369 #include <errno.h>
16370 #ifndef errno
16371 extern int errno;
16372 #endif
16373 int main() {
16374     struct semid_ds arg;
16375     int sem, st;
16376
16377 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16378     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16379     if (sem > -1) {
16380 #       ifdef IPC_STAT
16381         st = semctl(sem, 0, IPC_STAT, &arg);
16382         if (st == 0)
16383             printf("semid_ds\n");
16384         else
16385 #       endif /* IPC_STAT */
16386             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16387 #       ifdef IPC_RMID
16388         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16389 #       endif /* IPC_RMID */
16390             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16391     } else
16392 #endif /* IPC_PRIVATE && ... */
16393         printf("semget failed: errno = %d\n", errno);
16394
16395     return 0;
16396 }
16397 END
16398       set try
16399       if eval $compile; then
16400           xxx=`$run ./try`
16401           case "$xxx" in
16402           semid_ds) val="$define" ;;
16403           esac
16404       fi
16405       $rm_try
16406       set d_semctl_semid_ds
16407       eval $setvar
16408       ;;
16409     esac
16410     case "$d_semctl_semid_ds" in
16411     $define)
16412         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16413         ;;
16414     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16415         ;;
16416     esac
16417     ;;
16418 *)  val="$undef"
16419
16420     # We do not have the full sem*(2) library, so assume we can not
16421     # use either.
16422
16423     set d_semctl_semun
16424     eval $setvar
16425
16426     set d_semctl_semid_ds
16427     eval $setvar
16428     ;;
16429 esac
16430 $rm_try tryh.h
16431
16432 : see if sendmsg exists
16433 set sendmsg d_sendmsg
16434 eval $inlibc
16435
16436 : see if setegid exists
16437 set setegid d_setegid
16438 eval $inlibc
16439
16440 : see if seteuid exists
16441 set seteuid d_seteuid
16442 eval $inlibc
16443
16444 : see if setgrent exists
16445 set setgrent d_setgrent
16446 eval $inlibc
16447
16448 : see if setgrent_r exists
16449 set setgrent_r d_setgrent_r
16450 eval $inlibc
16451 case "$d_setgrent_r" in
16452 "$define")
16453         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16454         case "$d_setgrent_r_proto:$usethreads" in
16455         ":define")      d_setgrent_r_proto=define
16456                 set d_setgrent_r_proto setgrent_r $hdrs
16457                 eval $hasproto ;;
16458         *)      ;;
16459         esac
16460         case "$d_setgrent_r_proto" in
16461         define)
16462         case "$setgrent_r_proto" in
16463         ''|0) try='int setgrent_r(FILE**);'
16464         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16465         esac
16466         case "$setgrent_r_proto" in
16467         ''|0) try='void setgrent_r(FILE**);'
16468         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16469         esac
16470         case "$setgrent_r_proto" in
16471         ''|0)   d_setgrent_r=undef
16472                 setgrent_r_proto=0
16473                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16474         * )     case "$setgrent_r_proto" in
16475                 REENTRANT_PROTO*) ;;
16476                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16477                 esac
16478                 echo "Prototype: $try" ;;
16479         esac
16480         ;;
16481         *)      case "$usethreads" in
16482                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16483                 esac
16484                 d_setgrent_r=undef
16485                 setgrent_r_proto=0
16486                 ;;
16487         esac
16488         ;;
16489 *)      setgrent_r_proto=0
16490         ;;
16491 esac
16492
16493 : see if sethostent exists
16494 set sethostent d_sethent
16495 eval $inlibc
16496
16497 : see if sethostent_r exists
16498 set sethostent_r d_sethostent_r
16499 eval $inlibc
16500 case "$d_sethostent_r" in
16501 "$define")
16502         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16503         case "$d_sethostent_r_proto:$usethreads" in
16504         ":define")      d_sethostent_r_proto=define
16505                 set d_sethostent_r_proto sethostent_r $hdrs
16506                 eval $hasproto ;;
16507         *)      ;;
16508         esac
16509         case "$d_sethostent_r_proto" in
16510         define)
16511         case "$sethostent_r_proto" in
16512         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16513         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16514         esac
16515         case "$sethostent_r_proto" in
16516         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16517         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16518         esac
16519         case "$sethostent_r_proto" in
16520         ''|0)   d_sethostent_r=undef
16521                 sethostent_r_proto=0
16522                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16523         * )     case "$sethostent_r_proto" in
16524                 REENTRANT_PROTO*) ;;
16525                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16526                 esac
16527                 echo "Prototype: $try" ;;
16528         esac
16529         ;;
16530         *)      case "$usethreads" in
16531                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16532                 esac
16533                 d_sethostent_r=undef
16534                 sethostent_r_proto=0
16535                 ;;
16536         esac
16537         ;;
16538 *)      sethostent_r_proto=0
16539         ;;
16540 esac
16541
16542 : see if setitimer exists
16543 set setitimer d_setitimer
16544 eval $inlibc
16545
16546 : see if setlinebuf exists
16547 set setlinebuf d_setlinebuf
16548 eval $inlibc
16549
16550 : see if setlocale exists
16551 set setlocale d_setlocale
16552 eval $inlibc
16553
16554 : see if locale.h is available
16555 set locale.h i_locale
16556 eval $inhdr
16557
16558 : see if setlocale_r exists
16559 set setlocale_r d_setlocale_r
16560 eval $inlibc
16561 case "$d_setlocale_r" in
16562 "$define")
16563         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16564         case "$d_setlocale_r_proto:$usethreads" in
16565         ":define")      d_setlocale_r_proto=define
16566                 set d_setlocale_r_proto setlocale_r $hdrs
16567                 eval $hasproto ;;
16568         *)      ;;
16569         esac
16570         case "$d_setlocale_r_proto" in
16571         define)
16572         case "$setlocale_r_proto" in
16573         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16574         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16575         esac
16576         case "$setlocale_r_proto" in
16577         ''|0)   d_setlocale_r=undef
16578                 setlocale_r_proto=0
16579                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16580         * )     case "$setlocale_r_proto" in
16581                 REENTRANT_PROTO*) ;;
16582                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16583                 esac
16584                 echo "Prototype: $try" ;;
16585         esac
16586         ;;
16587         *)      case "$usethreads" in
16588                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16589                 esac
16590                 d_setlocale_r=undef
16591                 setlocale_r_proto=0
16592                 ;;
16593         esac
16594         ;;
16595 *)      setlocale_r_proto=0
16596         ;;
16597 esac
16598
16599 : see if setnetent exists
16600 set setnetent d_setnent
16601 eval $inlibc
16602
16603 : see if setnetent_r exists
16604 set setnetent_r d_setnetent_r
16605 eval $inlibc
16606 case "$d_setnetent_r" in
16607 "$define")
16608         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16609         case "$d_setnetent_r_proto:$usethreads" in
16610         ":define")      d_setnetent_r_proto=define
16611                 set d_setnetent_r_proto setnetent_r $hdrs
16612                 eval $hasproto ;;
16613         *)      ;;
16614         esac
16615         case "$d_setnetent_r_proto" in
16616         define)
16617         case "$setnetent_r_proto" in
16618         ''|0) try='int setnetent_r(int, struct netent_data*);'
16619         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16620         esac
16621         case "$setnetent_r_proto" in
16622         ''|0) try='void setnetent_r(int, struct netent_data*);'
16623         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16624         esac
16625         case "$setnetent_r_proto" in
16626         ''|0)   d_setnetent_r=undef
16627                 setnetent_r_proto=0
16628                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16629         * )     case "$setnetent_r_proto" in
16630                 REENTRANT_PROTO*) ;;
16631                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16632                 esac
16633                 echo "Prototype: $try" ;;
16634         esac
16635         ;;
16636         *)      case "$usethreads" in
16637                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16638                 esac
16639                 d_setnetent_r=undef
16640                 setnetent_r_proto=0
16641                 ;;
16642         esac
16643         ;;
16644 *)      setnetent_r_proto=0
16645         ;;
16646 esac
16647
16648 : see if setprotoent exists
16649 set setprotoent d_setpent
16650 eval $inlibc
16651
16652 : see if setpgid exists
16653 set setpgid d_setpgid
16654 eval $inlibc
16655
16656 : see if setpgrp2 exists
16657 set setpgrp2 d_setpgrp2
16658 eval $inlibc
16659
16660 : see if setpriority exists
16661 set setpriority d_setprior
16662 eval $inlibc
16663
16664 : see if setproctitle exists
16665 set setproctitle d_setproctitle
16666 eval $inlibc
16667
16668 : see if setprotoent_r exists
16669 set setprotoent_r d_setprotoent_r
16670 eval $inlibc
16671 case "$d_setprotoent_r" in
16672 "$define")
16673         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16674         case "$d_setprotoent_r_proto:$usethreads" in
16675         ":define")      d_setprotoent_r_proto=define
16676                 set d_setprotoent_r_proto setprotoent_r $hdrs
16677                 eval $hasproto ;;
16678         *)      ;;
16679         esac
16680         case "$d_setprotoent_r_proto" in
16681         define)
16682         case "$setprotoent_r_proto" in
16683         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16684         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16685         esac
16686         case "$setprotoent_r_proto" in
16687         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16688         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16689         esac
16690         case "$setprotoent_r_proto" in
16691         ''|0)   d_setprotoent_r=undef
16692                 setprotoent_r_proto=0
16693                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16694         * )     case "$setprotoent_r_proto" in
16695                 REENTRANT_PROTO*) ;;
16696                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16697                 esac
16698                 echo "Prototype: $try" ;;
16699         esac
16700         ;;
16701         *)      case "$usethreads" in
16702                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16703                 esac
16704                 d_setprotoent_r=undef
16705                 setprotoent_r_proto=0
16706                 ;;
16707         esac
16708         ;;
16709 *)      setprotoent_r_proto=0
16710         ;;
16711 esac
16712
16713 : see if setpwent exists
16714 set setpwent d_setpwent
16715 eval $inlibc
16716
16717 : see if setpwent_r exists
16718 set setpwent_r d_setpwent_r
16719 eval $inlibc
16720 case "$d_setpwent_r" in
16721 "$define")
16722         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16723         case "$d_setpwent_r_proto:$usethreads" in
16724         ":define")      d_setpwent_r_proto=define
16725                 set d_setpwent_r_proto setpwent_r $hdrs
16726                 eval $hasproto ;;
16727         *)      ;;
16728         esac
16729         case "$d_setpwent_r_proto" in
16730         define)
16731         case "$setpwent_r_proto" in
16732         ''|0) try='int setpwent_r(FILE**);'
16733         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16734         esac
16735         case "$setpwent_r_proto" in
16736         ''|0) try='void setpwent_r(FILE**);'
16737         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16738         esac
16739         case "$setpwent_r_proto" in
16740         ''|0)   d_setpwent_r=undef
16741                 setpwent_r_proto=0
16742                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16743         * )     case "$setpwent_r_proto" in
16744                 REENTRANT_PROTO*) ;;
16745                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16746                 esac
16747                 echo "Prototype: $try" ;;
16748         esac
16749         ;;
16750         *)      case "$usethreads" in
16751                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16752                 esac
16753                 d_setpwent_r=undef
16754                 setpwent_r_proto=0
16755                 ;;
16756         esac
16757         ;;
16758 *)      setpwent_r_proto=0
16759         ;;
16760 esac
16761
16762 : see if setregid exists
16763 set setregid d_setregid
16764 eval $inlibc
16765 set setresgid d_setresgid
16766 eval $inlibc
16767
16768 : see if setreuid exists
16769 set setreuid d_setreuid
16770 eval $inlibc
16771 set setresuid d_setresuid
16772 eval $inlibc
16773
16774 : see if setrgid exists
16775 set setrgid d_setrgid
16776 eval $inlibc
16777
16778 : see if setruid exists
16779 set setruid d_setruid
16780 eval $inlibc
16781
16782 : see if setservent exists
16783 set setservent d_setsent
16784 eval $inlibc
16785
16786 : see if setservent_r exists
16787 set setservent_r d_setservent_r
16788 eval $inlibc
16789 case "$d_setservent_r" in
16790 "$define")
16791         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16792         case "$d_setservent_r_proto:$usethreads" in
16793         ":define")      d_setservent_r_proto=define
16794                 set d_setservent_r_proto setservent_r $hdrs
16795                 eval $hasproto ;;
16796         *)      ;;
16797         esac
16798         case "$d_setservent_r_proto" in
16799         define)
16800         case "$setservent_r_proto" in
16801         ''|0) try='int setservent_r(int, struct servent_data*);'
16802         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16803         esac
16804         case "$setservent_r_proto" in
16805         ''|0) try='void setservent_r(int, struct servent_data*);'
16806         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16807         esac
16808         case "$setservent_r_proto" in
16809         ''|0)   d_setservent_r=undef
16810                 setservent_r_proto=0
16811                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16812         * )     case "$setservent_r_proto" in
16813                 REENTRANT_PROTO*) ;;
16814                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16815                 esac
16816                 echo "Prototype: $try" ;;
16817         esac
16818         ;;
16819         *)      case "$usethreads" in
16820                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16821                 esac
16822                 d_setservent_r=undef
16823                 setservent_r_proto=0
16824                 ;;
16825         esac
16826         ;;
16827 *)      setservent_r_proto=0
16828         ;;
16829 esac
16830
16831 : see if setsid exists
16832 set setsid d_setsid
16833 eval $inlibc
16834
16835 : see if setvbuf exists
16836 set setvbuf d_setvbuf
16837 eval $inlibc
16838
16839 : see if sfio.h is available
16840 set sfio.h i_sfio
16841 eval $inhdr
16842
16843
16844 : see if sfio library is available
16845 case "$i_sfio" in
16846 $define)
16847         val=''
16848         set sfreserve val
16849         eval $inlibc
16850         ;;
16851 *)
16852         val="$undef"
16853         ;;
16854 esac
16855 : Ok, but do we want to use it.
16856 case "$val" in
16857 $define)
16858         case "$usesfio" in
16859         true|$define|[yY]*) dflt='y';;
16860         *) dflt='n';;
16861         esac
16862         echo "$package can use the sfio library, but it is experimental."
16863         case "$useperlio" in
16864         "$undef")
16865             echo "For sfio also the PerlIO abstraction layer is needed."
16866             echo "Earlier you said you wouldn't want that."
16867             ;;
16868         esac
16869         rp="You seem to have sfio available, do you want to try using it?"
16870         . ./myread
16871         case "$ans" in
16872         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16873                 useperlio="$define"
16874                 val="$define"
16875                 ;;
16876         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16877                 val="$undef"
16878                 ;;
16879         esac
16880         ;;
16881 *)      case "$usesfio" in
16882         true|$define|[yY]*)
16883                 echo "Sorry, cannot find sfio on this machine." >&4
16884                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16885                 val="$undef"
16886                 ;;
16887         esac
16888         ;;
16889 esac
16890 set d_sfio
16891 eval $setvar
16892 case "$d_sfio" in
16893 $define) usesfio='true';;
16894 *) usesfio='false';;
16895 esac
16896 case "$d_sfio" in
16897 $define) ;;
16898 *)      : Remove sfio from list of libraries to use
16899         case "$libs" in
16900         *-lsfio*)
16901                 echo "Removing unneeded -lsfio from library list" >&4
16902                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16903                 shift
16904                 libs="$*"
16905                 echo "libs = $libs" >&4
16906                 ;;
16907         esac
16908 ;;
16909 esac
16910
16911
16912 : see if shmctl exists
16913 set shmctl d_shmctl
16914 eval $inlibc
16915
16916 : see if shmget exists
16917 set shmget d_shmget
16918 eval $inlibc
16919
16920 : see if shmat exists
16921 set shmat d_shmat
16922 eval $inlibc
16923 : see what shmat returns
16924 case "$d_shmat" in
16925 "$define")
16926         $cat >shmat.c <<'END'
16927 #include <sys/shm.h>
16928 void *shmat();
16929 END
16930         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16931                 shmattype='void *'
16932         else
16933                 shmattype='char *'
16934         fi
16935         echo "and it returns ($shmattype)." >&4
16936         : see if a prototype for shmat is available
16937         xxx=`./findhdr sys/shm.h`
16938         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16939         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16940                 val="$define"
16941         else
16942                 val="$undef"
16943         fi
16944         $rm -f shmat.[co]
16945         ;;
16946 *)
16947         val="$undef"
16948         ;;
16949 esac
16950 set d_shmatprototype
16951 eval $setvar
16952
16953 : see if shmdt exists
16954 set shmdt d_shmdt
16955 eval $inlibc
16956
16957 : see how much of the 'shm*(2)' library is present.
16958 h_shm=true
16959 echo " "
16960 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16961 *"$undef"*) h_shm=false;;
16962 esac
16963 case "$osname" in
16964 freebsd)
16965     case "`ipcs 2>&1`" in
16966     "SVID shared memory"*"not configured"*)
16967         echo "Your $osname does not have the shm*(2) configured." >&4
16968         h_shm=false
16969         val="$undef"
16970         set shmctl d_shmctl
16971         evat $setvar
16972         set shmget d_shmget
16973         evat $setvar
16974         set shmat d_shmat
16975         evat $setvar
16976         set shmdt d_shmdt
16977         evat $setvar
16978         ;;
16979     esac
16980     ;;
16981 esac
16982 : we could also check for sys/ipc.h ...
16983 if $h_shm && $test `./findhdr sys/shm.h`; then
16984         echo "You have the full shm*(2) library." >&4
16985         val="$define"
16986 else
16987         echo "You don't have the full shm*(2) library." >&4
16988         val="$undef"
16989 fi
16990 set d_shm
16991 eval $setvar
16992
16993 echo " "
16994 : see if we have sigaction
16995 if set sigaction val -f d_sigaction; eval $csym; $val; then
16996         echo 'sigaction() found.' >&4
16997         $cat > try.c <<EOP
16998 #include <stdio.h>
16999 #include <sys/types.h>
17000 #include <signal.h>
17001 #$i_stdlib I_STDLIB
17002 #ifdef I_STDLIB
17003 #include <stdlib.h>
17004 #endif
17005 int main()
17006 {
17007     struct sigaction act, oact;
17008     act.sa_flags = 0;
17009     oact.sa_handler = 0;
17010     /* so that act and oact are used */
17011     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17012 }
17013 EOP
17014         set try
17015         if eval $compile_ok; then
17016                 val="$define"
17017         else
17018                 echo "But you don't seem to have a useable struct sigaction." >&4
17019                 val="$undef"
17020         fi
17021 else
17022         echo 'sigaction NOT found.' >&4
17023         val="$undef"
17024 fi
17025 set d_sigaction; eval $setvar
17026 $rm_try
17027
17028 : see if this is a sunmath.h system
17029 set sunmath.h i_sunmath
17030 eval $inhdr
17031
17032 : see if signbit exists
17033 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17034 $cat >try.c <<EOCP
17035 #$i_math I_MATH
17036 #$i_sunmath I_SUNMATH
17037 #ifdef I_MATH
17038 #  include <math.h>
17039 #endif
17040 #ifdef I_SUNMATH  /* Solaris special math library */
17041 #  include <sunmath.h>
17042 #endif
17043 #define NV $nvtype
17044 int main(int argc, char **argv)
17045 {
17046     NV x = 0.0;
17047     NV y = -0.0;
17048     if ((signbit(x) == 0) && (signbit(y) != 0))
17049         return 0;
17050     else
17051         return 1;
17052 }
17053 EOCP
17054 val="$undef"
17055 set try
17056 if eval $compile; then
17057     if $run ./try; then
17058         $echo "Yes." >&4
17059         val="$define"
17060     else
17061         $echo "Signbit seems to be available, but doesn't work as I expected."
17062         $echo "I won't use it." >&4
17063         val="$undef"
17064     fi
17065 else
17066     $echo "Nope." >&4
17067     dflt="$undef"
17068 fi
17069 set d_signbit
17070 eval $setvar
17071 $rm_try
17072
17073 : see if sigprocmask exists
17074 set sigprocmask d_sigprocmask
17075 eval $inlibc
17076
17077 : see if sigsetjmp exists
17078 echo " "
17079 case "$d_sigsetjmp" in
17080 '')
17081         $cat >try.c <<EOP
17082 #include <setjmp.h>
17083 #$i_stdlib I_STDLIB
17084 #ifdef I_STDLIB
17085 #include <stdlib.h>
17086 #endif
17087 sigjmp_buf env;
17088 int set = 1;
17089 int main()
17090 {
17091         if (sigsetjmp(env,1))
17092                 exit(set);
17093         set = 0;
17094         siglongjmp(env, 1);
17095         exit(1);
17096 }
17097 EOP
17098         set try
17099         if eval $compile; then
17100                 if $run ./try >/dev/null 2>&1; then
17101                         echo "POSIX sigsetjmp found." >&4
17102                         val="$define"
17103                 else
17104                         $cat >&4 <<EOM
17105 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17106 I'll ignore them.
17107 EOM
17108                         val="$undef"
17109                 fi
17110         else
17111                 echo "sigsetjmp not found." >&4
17112                 val="$undef"
17113         fi
17114         ;;
17115 *) val="$d_sigsetjmp"
17116         case "$d_sigsetjmp" in
17117         $define) echo "POSIX sigsetjmp found." >&4;;
17118         $undef) echo "sigsetjmp not found." >&4;;
17119         esac
17120         ;;
17121 esac
17122 set d_sigsetjmp
17123 eval $setvar
17124 $rm_try
17125
17126 : see if snprintf exists
17127 set snprintf d_snprintf
17128 eval $inlibc
17129
17130 : see if vsnprintf exists
17131 set vsnprintf d_vsnprintf
17132 eval $inlibc
17133
17134 case "$d_snprintf-$d_vsnprintf" in
17135 "$define-$define")
17136     $cat <<EOM
17137 Checking whether your snprintf() and vsnprintf() work okay...
17138 EOM
17139     $cat >try.c <<'EOCP'
17140 /* v?snprintf testing logic courtesy of Russ Allbery.
17141  * According to C99:
17142  * - if the buffer is too short it still must be \0-terminated
17143  * - if the buffer is too short the potentially required length
17144  *   must be returned and not -1
17145  * - if the buffer is NULL the potentially required length
17146  *   must be returned and not -1 or core dump
17147  */
17148 #include <stdio.h>
17149 #include <stdarg.h>
17150
17151 char buf[2];
17152
17153 int test (char *format, ...)
17154 {
17155     va_list args;
17156     int count;
17157
17158     va_start (args, format);
17159     count = vsnprintf (buf, sizeof buf, format, args);
17160     va_end (args);
17161     return count;
17162 }
17163
17164 int main ()
17165 {
17166     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17167              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17168 }
17169 EOCP
17170     set try
17171     if eval $compile; then
17172         `$run ./try`
17173         case "$?" in
17174         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17175         *) cat <<EOM >&4
17176 Your snprintf() and snprintf() don't seem to be working okay.
17177 EOM
17178            d_snprintf="$undef"
17179            d_vsnprintf="$undef"
17180            ;;
17181         esac
17182     else
17183         echo "(I can't seem to compile the test program--assuming they don't)"
17184         d_snprintf="$undef"
17185         d_vsnprintf="$undef"
17186     fi
17187     $rm_try
17188     ;;
17189 esac
17190
17191 : see if sockatmark exists
17192 set sockatmark d_sockatmark
17193 eval $inlibc
17194
17195 : see if prototype for sockatmark is available
17196 echo " "
17197 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17198 eval $hasproto
17199
17200 : see if socks5_init exists
17201 set socks5_init d_socks5_init
17202 eval $inlibc
17203
17204 : see if sprintf returns the length of the string in the buffer as per ANSI
17205 $echo "Checking whether sprintf returns the length of the string..." >&4
17206 $cat <<EOP >try.c
17207 #include <stdio.h>
17208 #$i_stdlib I_STDLIB
17209 #ifdef I_STDLIB
17210 #include <stdlib.h>
17211 #endif
17212 #$i_string I_STRING
17213 #ifdef I_STRING
17214 #  include <string.h>
17215 #else
17216 #  include <strings.h>
17217 #endif
17218 #$i_math I_MATH
17219 #ifdef I_MATH
17220 #include <math.h>
17221 #endif
17222
17223 char buffer[256];
17224
17225 int check (size_t expect, int test) {
17226   size_t got = strlen(buffer);
17227   if (expect == got)
17228     return 0;
17229
17230   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17231        test, buffer);
17232   exit (test);
17233 }
17234
17235 int main(int argc, char **argv) {
17236   int test = 0;
17237
17238   check(sprintf(buffer, ""), ++test);
17239   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17240   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17241
17242   return 0;
17243 }
17244 EOP
17245 set try
17246
17247 d_sprintf_returns_strlen="$undef"
17248 if eval $compile; then
17249     xxx="`$run ./try`"
17250     case "$?" in
17251         0) cat >&4 <<EOM
17252 sprintf returns the length of the string (as ANSI says it should)
17253 EOM
17254         d_sprintf_returns_strlen="$define"
17255         ;;
17256         *) cat >&4 <<EOM
17257 sprintf does not return the length of the string (how old is this system?)
17258 EOM
17259         d_sprintf_returns_strlen="$undef"
17260         ;;
17261     esac
17262 fi
17263 $rm_try
17264
17265 : see if srand48_r exists
17266 set srand48_r d_srand48_r
17267 eval $inlibc
17268 case "$d_srand48_r" in
17269 "$define")
17270         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17271         case "$d_srand48_r_proto:$usethreads" in
17272         ":define")      d_srand48_r_proto=define
17273                 set d_srand48_r_proto srand48_r $hdrs
17274                 eval $hasproto ;;
17275         *)      ;;
17276         esac
17277         case "$d_srand48_r_proto" in
17278         define)
17279         case "$srand48_r_proto" in
17280         ''|0) try='int srand48_r(long, struct drand48_data*);'
17281         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17282         esac
17283         case "$srand48_r_proto" in
17284         ''|0)   d_srand48_r=undef
17285                 srand48_r_proto=0
17286                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17287         * )     case "$srand48_r_proto" in
17288                 REENTRANT_PROTO*) ;;
17289                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17290                 esac
17291                 echo "Prototype: $try" ;;
17292         esac
17293         ;;
17294         *)      case "$usethreads" in
17295                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17296                 esac
17297                 d_srand48_r=undef
17298                 srand48_r_proto=0
17299                 ;;
17300         esac
17301         ;;
17302 *)      srand48_r_proto=0
17303         ;;
17304 esac
17305
17306 : see if srandom_r exists
17307 set srandom_r d_srandom_r
17308 eval $inlibc
17309 case "$d_srandom_r" in
17310 "$define")
17311         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17312         case "$d_srandom_r_proto:$usethreads" in
17313         ":define")      d_srandom_r_proto=define
17314                 set d_srandom_r_proto srandom_r $hdrs
17315                 eval $hasproto ;;
17316         *)      ;;
17317         esac
17318         case "$d_srandom_r_proto" in
17319         define)
17320         case "$srandom_r_proto" in
17321         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17322         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17323         esac
17324         case "$srandom_r_proto" in
17325         ''|0)   d_srandom_r=undef
17326                 srandom_r_proto=0
17327                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17328         * )     case "$srandom_r_proto" in
17329                 REENTRANT_PROTO*) ;;
17330                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17331                 esac
17332                 echo "Prototype: $try" ;;
17333         esac
17334         ;;
17335         *)      case "$usethreads" in
17336                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17337                 esac
17338                 d_srandom_r=undef
17339                 srandom_r_proto=0
17340                 ;;
17341         esac
17342         ;;
17343 *)      srandom_r_proto=0
17344         ;;
17345 esac
17346
17347 : see if prototype for setresgid is available
17348 echo " "
17349 set d_sresgproto setresgid $i_unistd unistd.h
17350 eval $hasproto
17351
17352 : see if prototype for setresuid is available
17353 echo " "
17354 set d_sresuproto setresuid $i_unistd unistd.h
17355 eval $hasproto
17356
17357 : see if sys/stat.h is available
17358 set sys/stat.h i_sysstat
17359 eval $inhdr
17360
17361
17362 : see if stat knows about block sizes
17363 echo " "
17364 echo "Checking to see if your struct stat has st_blocks field..." >&4
17365 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17366 eval $hasfield
17367
17368
17369 : see if this is a sys/vfs.h system
17370 set sys/vfs.h i_sysvfs
17371 eval $inhdr
17372
17373
17374 : see if this is a sys/statfs.h system
17375 set sys/statfs.h i_sysstatfs
17376 eval $inhdr
17377
17378
17379 echo " "
17380 echo "Checking to see if your system supports struct statfs..." >&4
17381 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
17382 eval $hasstruct
17383 case "$d_statfs_s" in
17384 "$define")      echo "Yes, it does."   ;;
17385 *)              echo "No, it doesn't." ;;
17386 esac
17387
17388
17389
17390 : see if struct statfs knows about f_flags
17391 case "$d_statfs_s" in
17392 define) 
17393         echo " "
17394         echo "Checking to see if your struct statfs has f_flags field..." >&4
17395         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
17396         eval $hasfield
17397         ;;
17398 *)      val="$undef"
17399         set d_statfs_f_flags
17400         eval $setvar
17401         ;;
17402 esac
17403 case "$d_statfs_f_flags" in
17404 "$define")      echo "Yes, it does."   ;;
17405 *)              echo "No, it doesn't." ;;
17406 esac
17407
17408 $cat >&4 <<EOM
17409 Checking how to access stdio streams by file descriptor number...
17410 EOM
17411 case "$stdio_stream_array" in
17412 '')     $cat >try.c <<EOCP
17413 #include <stdio.h>
17414 int main() {
17415   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17416     printf("yes\n");
17417 }
17418 EOCP
17419         for s in _iob __iob __sF
17420         do
17421                 set try -DSTDIO_STREAM_ARRAY=$s
17422                 if eval $compile; then
17423                         case "`$run ./try`" in
17424                         yes)    stdio_stream_array=$s; break ;;
17425                         esac
17426                 fi
17427         done
17428         $rm_try
17429 esac
17430 case "$stdio_stream_array" in
17431 '')     $cat >&4 <<EOM
17432 I can't figure out how to access stdio streams by file descriptor number.
17433 EOM
17434         d_stdio_stream_array="$undef"
17435         ;;
17436 *)      $cat >&4 <<EOM
17437 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17438 EOM
17439         d_stdio_stream_array="$define"
17440         ;;
17441 esac
17442
17443 : see if strcoll exists
17444 set strcoll d_strcoll
17445 eval $inlibc
17446
17447 : check for structure copying
17448 echo " "
17449 echo "Checking to see if your C compiler can copy structs..." >&4
17450 $cat >try.c <<'EOCP'
17451 int main()
17452 {
17453         struct blurfl {
17454                 int dyick;
17455         } foo, bar;
17456
17457         foo = bar;
17458 }
17459 EOCP
17460 if $cc -c try.c >/dev/null 2>&1 ; then
17461         val="$define"
17462         echo "Yup, it can."
17463 else
17464         val="$undef"
17465         echo "Nope, it can't."
17466 fi
17467 set d_strctcpy
17468 eval $setvar
17469 $rm_try
17470
17471 : see if strerror and/or sys_errlist[] exist
17472 echo " "
17473 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17474     if set strerror val -f d_strerror; eval $csym; $val; then
17475                 echo 'strerror() found.' >&4
17476                 d_strerror="$define"
17477                 d_strerrm='strerror(e)'
17478                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17479                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17480                         d_syserrlst="$define"
17481                 else
17482                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17483                         d_syserrlst="$undef"
17484                 fi
17485     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17486                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17487                 echo 'strerror() found in string header.' >&4
17488                 d_strerror="$define"
17489                 d_strerrm='strerror(e)'
17490                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17491                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17492                                 d_syserrlst="$define"
17493                 else
17494                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17495                         d_syserrlst="$undef"
17496                 fi
17497     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17498                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17499                 d_strerror="$undef"
17500                 d_syserrlst="$define"
17501                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17502     else
17503                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17504                 d_strerror="$undef"
17505                 d_syserrlst="$undef"
17506                 d_strerrm='"unknown"'
17507     fi
17508 fi
17509
17510 : see if strerror_r exists
17511 set strerror_r d_strerror_r
17512 eval $inlibc
17513 case "$d_strerror_r" in
17514 "$define")
17515         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17516         case "$d_strerror_r_proto:$usethreads" in
17517         ":define")      d_strerror_r_proto=define
17518                 set d_strerror_r_proto strerror_r $hdrs
17519                 eval $hasproto ;;
17520         *)      ;;
17521         esac
17522         case "$d_strerror_r_proto" in
17523         define)
17524         case "$strerror_r_proto" in
17525         ''|0) try='int strerror_r(int, char*, size_t);'
17526         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17527         esac
17528         case "$strerror_r_proto" in
17529         ''|0) try='int strerror_r(int, char*, int);'
17530         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17531         esac
17532         case "$strerror_r_proto" in
17533         ''|0) try='char* strerror_r(int, char*, size_t);'
17534         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17535         esac
17536         case "$strerror_r_proto" in
17537         ''|0)   d_strerror_r=undef
17538                 strerror_r_proto=0
17539                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17540         * )     case "$strerror_r_proto" in
17541                 REENTRANT_PROTO*) ;;
17542                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17543                 esac
17544                 echo "Prototype: $try" ;;
17545         esac
17546         ;;
17547         *)      case "$usethreads" in
17548                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17549                 esac
17550                 d_strerror_r=undef
17551                 strerror_r_proto=0
17552                 ;;
17553         esac
17554         ;;
17555 *)      strerror_r_proto=0
17556         ;;
17557 esac
17558
17559 : see if strftime exists
17560 set strftime d_strftime
17561 eval $inlibc
17562
17563 : see if strlcat exists
17564 set strlcat d_strlcat
17565 eval $inlibc
17566
17567 : see if strlcpy exists
17568 set strlcpy d_strlcpy
17569 eval $inlibc
17570
17571 : see if strtod exists
17572 set strtod d_strtod
17573 eval $inlibc
17574
17575 : see if strtol exists
17576 set strtol d_strtol
17577 eval $inlibc
17578
17579 : see if strtold exists
17580 set strtold d_strtold
17581 eval $inlibc
17582
17583 : see if strtoll exists
17584 set strtoll d_strtoll
17585 eval $inlibc
17586
17587 case "$d_longlong-$d_strtoll" in
17588 "$define-$define")
17589         $cat <<EOM
17590 Checking whether your strtoll() works okay...
17591 EOM
17592         $cat >try.c <<'EOCP'
17593 #include <errno.h>
17594 #ifdef __hpux
17595 #define strtoll __strtoll
17596 #endif
17597 #ifdef __EMX__
17598 #define strtoll _strtoll
17599 #endif
17600 #include <stdio.h>
17601 extern long long int strtoll(char *s, char **, int); 
17602 static int bad = 0;
17603 int check(char *s, long long ell, int een) {
17604         long long gll;
17605         errno = 0;
17606         gll = strtoll(s, 0, 10);
17607         if (!((gll == ell) && (errno == een)))
17608                 bad++;
17609 }
17610 int main() {
17611         check(" 1",                                      1LL, 0);
17612         check(" 0",                                      0LL, 0);
17613         check("-1",                                     -1LL, 0);
17614         check("-9223372036854775808", -9223372036854775808LL, 0);
17615         check("-9223372036854775808", -9223372036854775808LL, 0);
17616         check(" 9223372036854775807",  9223372036854775807LL, 0);
17617         check("-9223372036854775808", -9223372036854775808LL, 0);
17618         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17619         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17620         if (!bad)
17621                 printf("ok\n");
17622 }
17623 EOCP
17624         set try
17625         if eval $compile; then
17626                 yyy=`$run ./try`
17627                 case "$yyy" in
17628                 ok) echo "Your strtoll() seems to be working okay." ;;
17629                 *) cat <<EOM >&4
17630 Your strtoll() doesn't seem to be working okay.
17631 EOM
17632                    d_strtoll="$undef"
17633                    ;;
17634                 esac
17635         else
17636                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17637                 d_strtoll="$undef"
17638         fi
17639         ;;
17640 esac
17641
17642 : see if strtoq exists
17643 set strtoq d_strtoq
17644 eval $inlibc
17645
17646 : see if strtoul exists
17647 set strtoul d_strtoul
17648 eval $inlibc
17649
17650 case "$d_strtoul" in
17651 "$define")
17652         $cat <<EOM
17653 Checking whether your strtoul() works okay...
17654 EOM
17655         $cat >try.c <<'EOCP'
17656 #include <errno.h>
17657 #include <stdio.h>
17658 extern unsigned long int strtoul(char *s, char **, int); 
17659 static int bad = 0;
17660 void check(char *s, unsigned long eul, int een) {
17661         unsigned long gul;
17662         errno = 0;
17663         gul = strtoul(s, 0, 10);
17664         if (!((gul == eul) && (errno == een)))
17665                 bad++;
17666 }
17667 int main() {
17668         check(" 1", 1L, 0);
17669         check(" 0", 0L, 0);
17670 EOCP
17671         case "$longsize" in
17672         8)
17673             $cat >>try.c <<'EOCP'
17674         check("18446744073709551615", 18446744073709551615UL, 0);
17675         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17676 #if 0 /* strtoul() for /^-/ strings is undefined. */
17677         check("-1", 18446744073709551615UL, 0);
17678         check("-18446744073709551614", 2, 0);
17679         check("-18446744073709551615", 1, 0);
17680         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17681         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17682 #endif
17683 EOCP
17684                 ;;
17685         4)
17686                     $cat >>try.c <<'EOCP'
17687         check("4294967295", 4294967295UL, 0);
17688         check("4294967296", 4294967295UL, ERANGE);
17689 #if 0 /* strtoul() for /^-/ strings is undefined. */
17690         check("-1", 4294967295UL, 0);
17691         check("-4294967294", 2, 0);
17692         check("-4294967295", 1, 0);
17693         check("-4294967296", 4294967295UL, ERANGE);
17694         check("-4294967297", 4294967295UL, ERANGE);
17695 #endif
17696 EOCP
17697                 ;;
17698         *)
17699 : Should we write these tests to be more portable by sprintf-ing
17700 : ~0 and then manipulating that char string as input for strtol?
17701                 ;;
17702         esac
17703         $cat >>try.c <<'EOCP'
17704         if (!bad)
17705                 printf("ok\n");
17706         return 0;
17707 }
17708 EOCP
17709         set try
17710         if eval $compile; then
17711                 case "`$run ./try`" in
17712                 ok) echo "Your strtoul() seems to be working okay." ;;
17713                 *) cat <<EOM >&4
17714 Your strtoul() doesn't seem to be working okay.
17715 EOM
17716                    d_strtoul="$undef"
17717                    ;;
17718                 esac
17719         else
17720                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17721                 d_strtoul="$undef"
17722         fi
17723         ;;
17724 esac
17725
17726 : see if strtoull exists
17727 set strtoull d_strtoull
17728 eval $inlibc
17729
17730 case "$d_longlong-$d_strtoull" in
17731 "$define-$define")
17732         $cat <<EOM
17733 Checking whether your strtoull() works okay...
17734 EOM
17735         $cat >try.c <<'EOCP'
17736 #include <errno.h>
17737 #ifdef __hpux
17738 #define strtoull __strtoull
17739 #endif
17740 #include <stdio.h>
17741 extern unsigned long long int strtoull(char *s, char **, int); 
17742 static int bad = 0;
17743 int check(char *s, long long eull, int een) {
17744         long long gull;
17745         errno = 0;
17746         gull = strtoull(s, 0, 10);
17747         if (!((gull == eull) && (errno == een)))
17748                 bad++;
17749 }
17750 int main() {
17751         check(" 1",                                        1LL, 0);
17752         check(" 0",                                        0LL, 0);
17753         check("18446744073709551615",  18446744073709551615ULL, 0);
17754         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17755 #if 0 /* strtoull() for /^-/ strings is undefined. */
17756         check("-1",                    18446744073709551615ULL, 0);
17757         check("-18446744073709551614",                     2LL, 0);
17758         check("-18446744073709551615",                     1LL, 0);
17759         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17760         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17761 #endif
17762         if (!bad)
17763                 printf("ok\n");
17764 }
17765 EOCP
17766         set try
17767         if eval $compile; then
17768                 case "`$run ./try`" in
17769                 ok) echo "Your strtoull() seems to be working okay." ;;
17770                 *) cat <<EOM >&4
17771 Your strtoull() doesn't seem to be working okay.
17772 EOM
17773                    d_strtoull="$undef"
17774                    ;;
17775                 esac
17776         else
17777                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17778                 d_strtoull="$undef"
17779         fi
17780         ;;
17781 esac
17782
17783 : see if strtouq exists
17784 set strtouq d_strtouq
17785 eval $inlibc
17786
17787 case "$d_strtouq" in
17788 "$define")
17789         $cat <<EOM
17790 Checking whether your strtouq() works okay...
17791 EOM
17792         $cat >try.c <<'EOCP'
17793 #include <errno.h>
17794 #include <stdio.h>
17795 extern unsigned long long int strtouq(char *s, char **, int); 
17796 static int bad = 0;
17797 void check(char *s, unsigned long long eull, int een) {
17798         unsigned long long gull;
17799         errno = 0;
17800         gull = strtouq(s, 0, 10);
17801         if (!((gull == eull) && (errno == een)))
17802                 bad++;
17803 }
17804 int main() {
17805         check(" 1",                                        1LL, 0);
17806         check(" 0",                                        0LL, 0);
17807         check("18446744073709551615",  18446744073709551615ULL, 0);
17808         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17809 #if 0 /* strtouq() for /^-/ strings is undefined. */
17810         check("-1",                    18446744073709551615ULL, 0);
17811         check("-18446744073709551614",                     2LL, 0);
17812         check("-18446744073709551615",                     1LL, 0);
17813         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17814         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17815 #endif
17816         if (!bad)
17817                 printf("ok\n");
17818         return 0;
17819 }
17820 EOCP
17821         set try
17822         if eval $compile; then
17823                 case "`$run ./try`" in
17824                 ok) echo "Your strtouq() seems to be working okay." ;;
17825                 *) cat <<EOM >&4
17826 Your strtouq() doesn't seem to be working okay.
17827 EOM
17828                    d_strtouq="$undef"
17829                    ;;
17830                 esac
17831         else
17832                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17833                 d_strtouq="$undef"
17834         fi
17835         ;;
17836 esac
17837
17838 : see if strxfrm exists
17839 set strxfrm d_strxfrm
17840 eval $inlibc
17841
17842 : see if symlink exists
17843 set symlink d_symlink
17844 eval $inlibc
17845
17846 : see if syscall exists
17847 set syscall d_syscall
17848 eval $inlibc
17849
17850 : see if prototype for syscall is available
17851 echo " "
17852 set d_syscallproto syscall $i_unistd unistd.h
17853 eval $hasproto
17854
17855 : see if sysconf exists
17856 set sysconf d_sysconf
17857 eval $inlibc
17858
17859 : see if system exists
17860 set system d_system
17861 eval $inlibc
17862
17863 : see if tcgetpgrp exists
17864 set tcgetpgrp d_tcgetpgrp
17865 eval $inlibc
17866
17867 : see if tcsetpgrp exists
17868 set tcsetpgrp d_tcsetpgrp
17869 eval $inlibc
17870
17871 : see if prototype for telldir is available
17872 echo " "
17873 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17874 eval $hasproto
17875
17876 : see if time exists
17877 echo " "
17878 if test "X$d_time" = X -o X"$timetype" = X; then
17879     if set time val -f d_time; eval $csym; $val; then
17880                 echo 'time() found.' >&4
17881                 val="$define"
17882                 rp="What is the type returned by time() on this system?"
17883                 set time_t timetype long stdio.h sys/types.h
17884                 eval $typedef_ask
17885     else
17886                 echo 'time() not found, hope that will do.' >&4
17887                 val="$undef"
17888                 timetype='int';
17889     fi
17890     set d_time
17891     eval $setvar
17892 fi
17893
17894 : see if this is a sys/times.h system
17895 set sys/times.h i_systimes
17896 eval $inhdr
17897
17898 : see if times exists
17899 echo " "
17900 if set times val -f d_times; eval $csym; $val; then
17901         echo 'times() found.' >&4
17902         d_times="$define"
17903         inc=''
17904         case "$i_systimes" in
17905         "$define") inc='sys/times.h';;
17906         esac
17907         rp="What is the type returned by times() on this system?"
17908         set clock_t clocktype long stdio.h sys/types.h $inc
17909         eval $typedef_ask
17910 else
17911         echo 'times() NOT found, hope that will do.' >&4
17912         d_times="$undef"
17913         clocktype='int'
17914 fi
17915
17916 : see if tmpnam_r exists
17917 set tmpnam_r d_tmpnam_r
17918 eval $inlibc
17919 case "$d_tmpnam_r" in
17920 "$define")
17921         hdrs="$i_systypes sys/types.h define stdio.h "
17922         case "$d_tmpnam_r_proto:$usethreads" in
17923         ":define")      d_tmpnam_r_proto=define
17924                 set d_tmpnam_r_proto tmpnam_r $hdrs
17925                 eval $hasproto ;;
17926         *)      ;;
17927         esac
17928         case "$d_tmpnam_r_proto" in
17929         define)
17930         case "$tmpnam_r_proto" in
17931         ''|0) try='char* tmpnam_r(char*);'
17932         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17933         esac
17934         case "$tmpnam_r_proto" in
17935         ''|0)   d_tmpnam_r=undef
17936                 tmpnam_r_proto=0
17937                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17938         * )     case "$tmpnam_r_proto" in
17939                 REENTRANT_PROTO*) ;;
17940                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17941                 esac
17942                 echo "Prototype: $try" ;;
17943         esac
17944         ;;
17945         *)      case "$usethreads" in
17946                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17947                 esac
17948                 d_tmpnam_r=undef
17949                 tmpnam_r_proto=0
17950                 ;;
17951         esac
17952         ;;
17953 *)      tmpnam_r_proto=0
17954         ;;
17955 esac
17956
17957 : see if truncate exists
17958 set truncate d_truncate
17959 eval $inlibc
17960
17961 : see if ttyname_r exists
17962 set ttyname_r d_ttyname_r
17963 eval $inlibc
17964 case "$d_ttyname_r" in
17965 "$define")
17966         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17967         case "$d_ttyname_r_proto:$usethreads" in
17968         ":define")      d_ttyname_r_proto=define
17969                 set d_ttyname_r_proto ttyname_r $hdrs
17970                 eval $hasproto ;;
17971         *)      ;;
17972         esac
17973         case "$d_ttyname_r_proto" in
17974         define)
17975         case "$ttyname_r_proto" in
17976         ''|0) try='int ttyname_r(int, char*, size_t);'
17977         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17978         esac
17979         case "$ttyname_r_proto" in
17980         ''|0) try='int ttyname_r(int, char*, int);'
17981         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17982         esac
17983         case "$ttyname_r_proto" in
17984         ''|0) try='char* ttyname_r(int, char*, int);'
17985         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17986         esac
17987         case "$ttyname_r_proto" in
17988         ''|0)   d_ttyname_r=undef
17989                 ttyname_r_proto=0
17990                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17991         * )     case "$ttyname_r_proto" in
17992                 REENTRANT_PROTO*) ;;
17993                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17994                 esac
17995                 echo "Prototype: $try" ;;
17996         esac
17997         ;;
17998         *)      case "$usethreads" in
17999                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18000                 esac
18001                 d_ttyname_r=undef
18002                 ttyname_r_proto=0
18003                 ;;
18004         esac
18005         ;;
18006 *)      ttyname_r_proto=0
18007         ;;
18008 esac
18009
18010 : see if tzname[] exists
18011 echo " "
18012 if set tzname val -a d_tzname; eval $csym; $val; then
18013         val="$define"
18014         echo 'tzname[] found.' >&4
18015 else
18016         val="$undef"
18017         echo 'tzname[] NOT found.' >&4
18018 fi
18019 set d_tzname
18020 eval $setvar
18021
18022 case "$osname" in
18023 next|rhapsody|darwin) multiarch="$define" ;;
18024 esac
18025 case "$multiarch" in
18026 ''|[nN]*) multiarch="$undef" ;;
18027 esac
18028
18029 : check for ordering of bytes in a UV
18030 echo " "
18031 case "$usecrosscompile$multiarch" in
18032 *$define*)
18033         $cat <<EOM
18034 You seem to be either cross-compiling or doing a multiarchitecture build,
18035 skipping the byteorder check.
18036
18037 EOM
18038         byteorder='ffff'
18039         ;;
18040 *)
18041         case "$byteorder" in
18042         '')
18043                 $cat <<'EOM'
18044 In the following, larger digits indicate more significance.  A big-endian
18045 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18046 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18047 machines may have weird orders like 3412.  A Cray will report 87654321,
18048 an Alpha will report 12345678. If the test program works the default is
18049 probably right.
18050 I'm now running the test program...
18051 EOM
18052                 $cat >try.c <<EOCP
18053 #include <stdio.h>
18054 #$i_stdlib I_STDLIB
18055 #ifdef I_STDLIB
18056 #include <stdlib.h>
18057 #endif
18058 #include <sys/types.h>
18059 typedef $uvtype UV;
18060 int main()
18061 {
18062         int i;
18063         union {
18064                 UV l;
18065                 char c[$uvsize];
18066         } u;
18067
18068         if ($uvsize > 4)
18069                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18070         else
18071                 u.l = (UV)0x04030201;
18072         for (i = 0; i < $uvsize; i++)
18073                 printf("%c", u.c[i]+'0');
18074         printf("\n");
18075         exit(0);
18076 }
18077 EOCP
18078                 xxx_prompt=y
18079                 set try
18080                 if eval $compile && $run ./try > /dev/null; then
18081                         dflt=`$run ./try`
18082                         case "$dflt" in
18083                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18084                                 echo "(The test program ran ok.)"
18085                                 echo "byteorder=$dflt"
18086                                 xxx_prompt=n
18087                         ;;
18088                         ????|????????) echo "(The test program ran ok.)" ;;
18089                         *) echo "(The test program didn't run right for some reason.)" ;;
18090                         esac
18091                 else
18092                         dflt='4321'
18093                         cat <<'EOM'
18094 (I can't seem to compile the test program.  Guessing big-endian...)
18095 EOM
18096                 fi
18097                 case "$xxx_prompt" in
18098                 y)
18099                         rp="What is the order of bytes in $uvtype?"
18100                         . ./myread
18101                         byteorder="$ans"
18102                         ;;
18103                 *)      byteorder=$dflt
18104                         ;;
18105                 esac
18106                 ;;
18107         esac
18108         $rm_try
18109         ;;
18110 esac
18111
18112 $cat <<EOM
18113
18114 Checking to see whether you can access character data unalignedly...
18115 EOM
18116 case "$d_u32align" in
18117 '')   $cat >try.c <<EOCP
18118 #include <stdio.h>
18119 #$i_stdlib I_STDLIB
18120 #ifdef I_STDLIB
18121 #include <stdlib.h>
18122 #endif
18123 #define U32 $u32type
18124 #define BYTEORDER 0x$byteorder
18125 #define U8 $u8type
18126 #include <signal.h>
18127 #ifdef SIGBUS
18128 $signal_t bletch(int s) { exit(4); }
18129 #endif
18130 int main() {
18131 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18132     U8 buf[8];
18133     U32 *up;
18134     int i;
18135
18136     if (sizeof(U32) != 4) {
18137         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18138         exit(1);
18139     }
18140
18141     fflush(stdout);
18142
18143 #ifdef SIGBUS
18144     signal(SIGBUS, bletch);
18145 #endif
18146
18147     buf[0] = 0;
18148     buf[1] = 0;
18149     buf[2] = 0;
18150     buf[3] = 1;
18151     buf[4] = 0;
18152     buf[5] = 0;
18153     buf[6] = 0;
18154     buf[7] = 1;
18155
18156     for (i = 0; i < 4; i++) {
18157         up = (U32*)(buf + i);
18158         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18159                (*up == 1 << (8*(3-i)))  /* little-endian */
18160               )
18161            )
18162         {
18163             printf("read failed (%x)\n", *up);
18164             exit(2);
18165         }
18166     }
18167
18168     /* write test */
18169     for (i = 0; i < 4; i++) {
18170         up = (U32*)(buf + i);
18171         *up = 0xBeef;
18172         if (*up != 0xBeef) {
18173             printf("write failed (%x)\n", *up);
18174             exit(3);
18175         }
18176     }
18177
18178     exit(0);
18179 #else
18180     printf("1\n");
18181     exit(1);
18182 #endif
18183     return 0;
18184 }
18185 EOCP
18186 set try
18187 if eval $compile_ok; then
18188         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18189         $run ./try 2>&1 >/dev/null
18190         case "$?" in
18191         0)      cat >&4 <<EOM
18192 You can access character data pretty unalignedly.
18193 EOM
18194                 d_u32align="$undef"
18195                 ;;
18196         *)      cat >&4 <<EOM
18197 It seems that you must access character data in an aligned manner.
18198 EOM
18199                 d_u32align="$define"
18200                 ;;
18201         esac
18202 else
18203         rp='Can you access character data at unaligned addresses?'
18204         dflt='n'
18205         . ./myread
18206         case "$ans" in
18207         [yY]*)  d_u32align="$undef"  ;;
18208         *)      d_u32align="$define" ;;
18209         esac
18210 fi
18211 $rm_try
18212 ;;
18213 esac
18214
18215 : see if ualarm exists
18216 set ualarm d_ualarm
18217 eval $inlibc
18218
18219 : see if umask exists
18220 set umask d_umask
18221 eval $inlibc
18222
18223 : see if unordered exists
18224 set unordered d_unordered
18225 eval $inlibc
18226
18227 : see if unsetenv exists
18228 set unsetenv d_unsetenv
18229 eval $inlibc
18230
18231 : see if usleep exists
18232 set usleep d_usleep
18233 eval $inlibc
18234
18235 : see if prototype for usleep is available
18236 echo " "
18237 set d_usleepproto usleep $i_unistd unistd.h
18238 eval $hasproto
18239
18240 : see if ustat exists
18241 set ustat d_ustat
18242 eval $inlibc
18243
18244 : see if closedir exists
18245 set closedir d_closedir
18246 eval $inlibc
18247
18248 case "$d_closedir" in
18249 "$define")
18250         echo " "
18251         echo "Checking whether closedir() returns a status..." >&4
18252         cat > try.c <<EOM
18253 #$i_dirent I_DIRENT             /**/
18254 #$i_sysdir I_SYS_DIR            /**/
18255 #$i_sysndir I_SYS_NDIR          /**/
18256 #$i_systypes I_SYS_TYPES        /**/
18257
18258 #if defined(I_SYS_TYPES)
18259 #include <sys/types.h>
18260 #endif
18261 #if defined(I_DIRENT)
18262 #include <dirent.h>
18263 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18264 #include <sys/dir.h>
18265 #endif
18266 #else
18267 #ifdef I_SYS_NDIR
18268 #include <sys/ndir.h>
18269 #else
18270 #ifdef I_SYS_DIR
18271 #ifdef hp9000s500
18272 #include <ndir.h>       /* may be wrong in the future */
18273 #else
18274 #include <sys/dir.h>
18275 #endif
18276 #endif
18277 #endif
18278 #endif
18279 int main() { return closedir(opendir(".")); }
18280 EOM
18281         set try
18282         if eval $compile_ok; then
18283                 if $run ./try > /dev/null 2>&1 ; then
18284                         echo "Yes, it does."
18285                         val="$undef"
18286                 else
18287                         echo "No, it doesn't."
18288                         val="$define"
18289                 fi
18290         else
18291                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18292                 val="$define"
18293         fi
18294         ;;
18295 *)
18296         val="$undef";
18297         ;;
18298 esac
18299 set d_void_closedir
18300 eval $setvar
18301 $rm_try
18302
18303 : see if there is a wait4
18304 set wait4 d_wait4
18305 eval $inlibc
18306
18307 : see if waitpid exists
18308 set waitpid d_waitpid
18309 eval $inlibc
18310
18311 : see if wcstombs exists
18312 set wcstombs d_wcstombs
18313 eval $inlibc
18314
18315 : see if wctomb exists
18316 set wctomb d_wctomb
18317 eval $inlibc
18318
18319 : see if writev exists
18320 set writev d_writev
18321 eval $inlibc
18322
18323 : preserve RCS keywords in files with variable substitution, grrr
18324 Date='$Date'
18325 Id='$Id'
18326 Log='$Log'
18327 RCSfile='$RCSfile'
18328 Revision='$Revision'
18329
18330 : check for alignment requirements
18331 echo " "
18332 case "$usecrosscompile$multiarch" in
18333 *$define*)
18334         $cat <<EOM
18335 You seem to be either cross-compiling or doing a multiarchitecture build,
18336 skipping the memory alignment check.
18337
18338 EOM
18339         case "$alignbytes" in
18340         '') alignbytes=8 ;;
18341         esac
18342         ;;
18343 *)
18344         case "$alignbytes" in
18345         '') echo "Checking alignment constraints..." >&4
18346                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18347                         $cat >try.c <<'EOCP'
18348 typedef long double NV;
18349 EOCP
18350                 else
18351                         $cat >try.c <<'EOCP'
18352 typedef double NV;
18353 EOCP
18354                 fi
18355                 $cat >>try.c <<'EOCP'
18356 #include <stdio.h>
18357 struct foobar {
18358         char foo;
18359         NV bar;
18360 } try_algn;
18361 int main()
18362 {
18363     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18364     return(0);
18365 }
18366 EOCP
18367                 set try
18368                 if eval $compile_ok; then
18369                         dflt=`$run ./try`
18370                 else
18371                         dflt='8'
18372                         echo "(I can't seem to compile the test program...)"
18373                 fi
18374                 ;;
18375         *) dflt="$alignbytes"
18376                 ;;
18377         esac
18378         rp="Doubles must be aligned on a how-many-byte boundary?"
18379         . ./myread
18380         alignbytes="$ans"
18381         $rm_try
18382         ;;
18383 esac
18384
18385
18386 : set the base revision
18387 baserev=5.0
18388
18389 : how do we concatenate cpp tokens here?
18390 echo " "
18391 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18392 $cat >cpp_stuff.c <<'EOCP'
18393 #define RCAT(a,b)a/**/b
18394 #define ACAT(a,b)a ## b
18395 RCAT(Rei,ser)
18396 ACAT(Cir,cus)
18397 EOCP
18398 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18399 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18400         echo "Oh!  Smells like ANSI's been here." >&4
18401         echo "We can catify or stringify, separately or together!"
18402         cpp_stuff=42
18403 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18404         echo "Ah, yes!  The good old days!" >&4
18405         echo "However, in the good old days we don't know how to stringify and"
18406         echo "catify at the same time."
18407         cpp_stuff=1
18408 else
18409         $cat >&4 <<EOM
18410 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18411 You're going to have to edit the values of CAT[2-5] in config.h...
18412 EOM
18413         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18414 fi
18415 $rm -f cpp_stuff.*
18416
18417 : see if this is a db.h system
18418 set db.h i_db
18419 eval $inhdr
18420
18421 case "$i_db" in
18422 $define)
18423         : Check db version.
18424         echo " "
18425         echo "Checking Berkeley DB version ..." >&4
18426         $cat >try.c <<EOCP
18427 #$d_const HASCONST
18428 #ifndef HASCONST
18429 #define const
18430 #endif
18431 #include <sys/types.h>
18432 #include <stdio.h>
18433 #$i_stdlib I_STDLIB
18434 #ifdef I_STDLIB
18435 #include <stdlib.h>
18436 #endif
18437 #include <db.h>
18438 int main(int argc, char *argv[])
18439 {
18440 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18441     int Major, Minor, Patch ;
18442     unsigned long Version ;
18443     (void)db_version(&Major, &Minor, &Patch) ;
18444     if (argc == 2) {
18445         printf("%d %d %d %d %d %d\n",
18446                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18447                Major, Minor, Patch);
18448         exit(0);
18449     }
18450     printf("You have Berkeley DB Version 2 or greater.\n");
18451
18452     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18453                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18454     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18455                 Major, Minor, Patch) ;
18456
18457     /* check that db.h & libdb are compatible */
18458     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18459         printf("db.h and libdb are incompatible.\n") ;
18460         exit(3);
18461     }
18462
18463     printf("db.h and libdb are compatible.\n") ;
18464
18465     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18466                 + DB_VERSION_PATCH ;
18467
18468     /* needs to be >= 2.3.4 */
18469     if (Version < 2003004) {
18470     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18471         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18472         exit(2);
18473     }
18474
18475     exit(0);
18476 #else
18477 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18478     if (argc == 2) {
18479         printf("1 0 0\n");
18480         exit(0);
18481     }
18482     printf("You have Berkeley DB Version 1.\n");
18483     exit(0);    /* DB version < 2: the coast is clear. */
18484 #else
18485     exit(1);    /* <db.h> not Berkeley DB? */
18486 #endif
18487 #endif
18488 }
18489 EOCP
18490         set try
18491         if eval $compile_ok && $run ./try; then
18492                 echo 'Looks OK.' >&4
18493                 set `$run ./try 1`
18494                 db_version_major=$1
18495                 db_version_minor=$2
18496                 db_version_patch=$3
18497         else
18498                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18499                 i_db=$undef
18500                 case " $libs " in
18501                 *"-ldb "*)
18502                         : Remove db from list of libraries to use
18503                         echo "Removing unusable -ldb from library list" >&4
18504                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18505                         shift
18506                         libs="$*"
18507                         echo "libs = $libs" >&4
18508                         ;;
18509                 esac
18510         fi
18511         $rm_try
18512         ;;
18513 esac
18514
18515 case "$i_db" in
18516 define)
18517         : Check the return type needed for hash
18518         echo " "
18519         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18520         $cat >try.c <<EOCP
18521 #$d_const HASCONST
18522 #ifndef HASCONST
18523 #define const
18524 #endif
18525 #include <sys/types.h>
18526 #include <db.h>
18527
18528 #ifndef DB_VERSION_MAJOR
18529 u_int32_t hash_cb (ptr, size)
18530 const void *ptr;
18531 size_t size;
18532 {
18533 }
18534 HASHINFO info;
18535 int main()
18536 {
18537         info.hash = hash_cb;
18538 }
18539 #endif
18540 EOCP
18541         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18542                 if $contains warning try.out >>/dev/null 2>&1 ; then
18543                         db_hashtype='int'
18544                 else
18545                         db_hashtype='u_int32_t'
18546                 fi
18547         else
18548                 : XXX Maybe we should just give up here.
18549                 db_hashtype=u_int32_t
18550                 $cat try.out >&4
18551                 echo "Help:  I can't seem to compile the db test program." >&4
18552                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18553         fi
18554         $rm_try
18555         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18556         ;;
18557 *)      db_hashtype=u_int32_t
18558         ;;
18559 esac
18560 case "$i_db" in
18561 define)
18562         : Check the return type needed for prefix
18563         echo " "
18564         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18565         cat >try.c <<EOCP
18566 #$d_const HASCONST
18567 #ifndef HASCONST
18568 #define const
18569 #endif
18570 #include <sys/types.h>
18571 #include <db.h>
18572
18573 #ifndef DB_VERSION_MAJOR
18574 size_t prefix_cb (key1, key2)
18575 const DBT *key1;
18576 const DBT *key2;
18577 {
18578 }
18579 BTREEINFO info;
18580 int main()
18581 {
18582         info.prefix = prefix_cb;
18583 }
18584 #endif
18585 EOCP
18586         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18587                 if $contains warning try.out >>/dev/null 2>&1 ; then
18588                         db_prefixtype='int'
18589                 else
18590                         db_prefixtype='size_t'
18591                 fi
18592         else
18593                 db_prefixtype='size_t'
18594                 : XXX Maybe we should just give up here.
18595                 $cat try.out >&4
18596                 echo "Help:  I can't seem to compile the db test program." >&4
18597                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18598         fi
18599         $rm_try
18600         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18601         ;;
18602 *)      db_prefixtype='size_t'
18603         ;;
18604 esac
18605
18606 : How can we generate normalized random numbers ?
18607 echo " "
18608 echo "Looking for a random number function..." >&4
18609 case "$randfunc" in
18610 '')
18611         if set drand48 val -f; eval $csym; $val; then
18612                 dflt="drand48"
18613                 echo "Good, found drand48()." >&4
18614         elif set random val -f; eval $csym; $val; then
18615                 dflt="random"
18616                 echo "OK, found random()." >&4
18617         else
18618                 dflt="rand"
18619                 echo "Yick, looks like I have to use rand()." >&4
18620         fi
18621         echo " "
18622         ;;
18623 *)
18624         dflt="$randfunc"
18625         ;;
18626 esac
18627 cont=true
18628
18629 case "$ccflags" in
18630 *-Dmy_rand=*|*-Dmy_srand=*)
18631         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18632         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18633         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18634         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18635         ;;
18636 esac
18637
18638 while $test "$cont"; do
18639         rp="Use which function to generate random numbers?"
18640         . ./myread
18641         if $test "$ans" = "$dflt"; then
18642                 : null
18643         else
18644                 randbits=''
18645         fi
18646         randfunc="$ans"
18647         if set $ans val -f; eval $csym; $val; then
18648                 cont=''
18649         else
18650                 dflt=y
18651                 rp="I cannot find function $ans. Use that name anyway?"
18652                 . ./myread
18653                 dflt=rand
18654                 case "$ans" in
18655                         [yY]*) cont='';;
18656                 esac
18657         fi
18658         case "$cont" in
18659         '')
18660                 case "$randfunc" in
18661                 drand48)
18662                         drand01="drand48()"
18663                         seedfunc="srand48"
18664                         randbits=48
18665                         randseedtype=long
18666                         ;;
18667                 rand|random)
18668                         case "$randbits" in
18669                         '')
18670 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18671                                 $cat >try.c <<EOCP
18672 #$i_unistd I_UNISTD
18673 #$i_stdlib I_STDLIB
18674 #include <stdio.h>
18675 #ifdef I_UNISTD
18676 #  include <unistd.h>
18677 #endif
18678 #ifdef I_STDLIB
18679 #  include <stdlib.h>
18680 #endif
18681 int main()
18682 {
18683         register int i;
18684         register unsigned long tmp;
18685         register unsigned long max = 0L;
18686
18687         for (i = 1000; i; i--) {
18688                 tmp = (unsigned long) $randfunc();
18689                 if (tmp > max) max = tmp;
18690         }
18691         for (i = 0; max; i++)
18692                 max /= 2;
18693         printf("%d\n",i);
18694 }
18695 EOCP
18696                                 set try
18697                                 if eval $compile_ok; then
18698                                         dflt=`try`
18699                                 else
18700                                         dflt='?'
18701                                         echo "(I can't seem to compile the test program...)"
18702                                 fi
18703                                 ;;
18704                         *)
18705                                 dflt="$randbits"
18706                                 ;;
18707                         esac
18708                         rp="How many bits does your $randfunc() function produce?"
18709                         . ./myread
18710                         randbits="$ans"
18711                         $rm_try
18712                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18713                         seedfunc="s$randfunc"
18714                         randseedtype=unsigned
18715                         ;;
18716                 *)
18717                         dflt="31"
18718                         rp="How many bits does your $randfunc() function produce?"
18719                         . ./myread
18720                         randbits="$ans"
18721                         seedfunc="s$randfunc"
18722                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18723                         if set $seedfunc val -f; eval $csym; $val; then
18724                                 echo "(Using $seedfunc() to seed random generator)"
18725                         else
18726                                 echo "(Warning: no $seedfunc() to seed random generator)"
18727                                 seedfunc=rand
18728                         fi
18729                         randseedtype=unsigned
18730                         ;;
18731                 esac
18732                 ;;
18733         esac
18734 done
18735
18736 echo " "
18737 echo "Determining whether or not we are on an EBCDIC system..." >&4
18738 $cat >try.c <<'EOM'
18739 int main()
18740 {
18741   if ('M'==0xd4) return 0;
18742   return 1;
18743 }
18744 EOM
18745
18746 val=$undef
18747 set try
18748 if eval $compile_ok; then
18749         if $run ./try; then
18750                 echo "You seem to speak EBCDIC." >&4
18751                 val="$define"
18752         else
18753                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18754         fi
18755 else
18756         echo "I'm unable to compile the test program." >&4
18757         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18758 fi
18759 $rm_try
18760 set ebcdic
18761 eval $setvar
18762
18763 echo " "
18764 $cat >&4 <<EOM
18765 Checking how to flush all pending stdio output...
18766 EOM
18767 # I only know how to find the first 32 possibly open files on SunOS.
18768 # See also hints/sunos_4_1.sh and util.c  --AD
18769 case "$osname" in
18770 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18771 esac
18772 $cat >>try.c <<EOCP
18773 #include <stdio.h>
18774 #$i_stdlib I_STDLIB
18775 #ifdef I_STDLIB
18776 #include <stdlib.h>
18777 #endif
18778 #$i_unistd I_UNISTD
18779 #ifdef I_UNISTD
18780 # include <unistd.h>
18781 #endif
18782 #$d_sysconf HAS_SYSCONF
18783 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18784 #ifdef HAS_STDIO_STREAM_ARRAY
18785 # define STDIO_STREAM_ARRAY $stdio_stream_array
18786 #endif
18787 int main() {
18788   FILE* p;
18789   unlink("try.out");
18790   p = fopen("try.out", "w");
18791 #ifdef TRY_FPUTC
18792   fputc('x', p);
18793 #else
18794 # ifdef TRY_FPRINTF
18795   fprintf(p, "x");
18796 # endif
18797 #endif
18798 #ifdef TRY_FFLUSH_NULL
18799   fflush(NULL);
18800 #endif
18801 #ifdef TRY_FFLUSH_ALL
18802   {
18803     long open_max = -1;
18804 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18805     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18806 # else
18807 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18808     open_max = sysconf(_SC_OPEN_MAX);
18809 #  else
18810 #   ifdef FOPEN_MAX
18811     open_max = FOPEN_MAX;
18812 #   else
18813 #    ifdef OPEN_MAX
18814     open_max = OPEN_MAX;
18815 #    else
18816 #     ifdef _NFILE
18817     open_max = _NFILE;
18818 #     endif
18819 #    endif
18820 #   endif
18821 #  endif
18822 # endif
18823 # ifdef HAS_STDIO_STREAM_ARRAY
18824     if (open_max > 0) {
18825       long i;
18826       for (i = 0; i < open_max; i++)
18827             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18828                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18829                 STDIO_STREAM_ARRAY[i]._flag)
18830                 fflush(&STDIO_STREAM_ARRAY[i]);
18831     }
18832   }
18833 # endif
18834 #endif
18835   _exit(42);
18836 }
18837 EOCP
18838 : first we have to find out how _not_ to flush
18839 $to try.c
18840 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18841     output=''
18842     set try -DTRY_FPUTC
18843     if eval $compile; then
18844             $run ./try 2>/dev/null
18845             code="$?"
18846             $from try.out
18847             if $test ! -s try.out -a "X$code" = X42; then
18848                 output=-DTRY_FPUTC
18849             fi
18850     fi
18851     case "$output" in
18852     '')
18853             set try -DTRY_FPRINTF
18854             if eval $compile; then
18855                     $run ./try 2>/dev/null
18856                     code="$?"
18857                     $from try.out
18858                     if $test ! -s try.out -a "X$code" = X42; then
18859                         output=-DTRY_FPRINTF
18860                     fi
18861             fi
18862         ;;
18863     esac
18864 fi
18865 : check for fflush NULL behaviour
18866 case "$fflushNULL" in
18867 '')     set try -DTRY_FFLUSH_NULL $output
18868         if eval $compile; then
18869                 $run ./try 2>/dev/null
18870                 code="$?"
18871                 $from try.out
18872                 if $test -s try.out -a "X$code" = X42; then
18873                         fflushNULL="`$cat try.out`"
18874                 else
18875                         if $test "X$code" != X42; then
18876                                 $cat >&4 <<EOM
18877 (If this test failed, don't worry, we'll try another method shortly.)
18878 EOM
18879                         fi
18880                 fi
18881         fi
18882         $rm_try
18883         case "$fflushNULL" in
18884         x)      $cat >&4 <<EOM
18885 Your fflush(NULL) works okay for output streams.
18886 Let's see if it clobbers input pipes...
18887 EOM
18888 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18889 # bug that improperly flushes the input end of pipes.  So we avoid the
18890 # autoflush on fork/system/exec support for now. :-(
18891 $cat >tryp.c <<EOCP
18892 #include <stdio.h>
18893 int
18894 main(int argc, char **argv)
18895 {
18896     char buf[1024];
18897     int i;
18898     char *bp = buf;
18899     while (1) {
18900         while ((i = getc(stdin)) != -1
18901                && (*bp++ = i) != '\n'
18902                && bp < &buf[1024])
18903         /* DO NOTHING */ ;
18904         *bp = '\0';
18905         fprintf(stdout, "%s", buf);
18906         fflush(NULL);
18907         if (i == -1)
18908             return 0;
18909         bp = buf;
18910     }
18911 }
18912 EOCP
18913                 fflushNULL="$define"
18914                 set tryp
18915                 if eval $compile; then
18916                     $rm -f tryp.out
18917                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18918                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18919                        $cat >&4 <<EOM
18920 fflush(NULL) seems to behave okay with input streams.
18921 EOM
18922                         fflushNULL="$define"
18923                     else
18924                         $cat >&4 <<EOM
18925 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18926 EOM
18927                         fflushNULL="$undef"
18928                     fi
18929                 fi
18930                 $rm -f core tryp.c tryp.core core.tryp.*
18931                 ;;
18932         '')     $cat >&4 <<EOM
18933 Your fflush(NULL) isn't working (contrary to ANSI C).
18934 EOM
18935                 fflushNULL="$undef"
18936                 ;;
18937         *)      $cat >&4 <<EOM
18938 Cannot figure out whether your fflush(NULL) works or not.
18939 I'm assuming it doesn't (contrary to ANSI C).
18940 EOM
18941                 fflushNULL="$undef"
18942                 ;;
18943         esac
18944         ;;
18945 $define|true|[yY]*)
18946         fflushNULL="$define"
18947         ;;
18948 *)
18949         fflushNULL="$undef"
18950         ;;
18951 esac
18952 : check explicit looping only if NULL did not work, and if the pipe
18953 : bug does not show up on an explicit flush too
18954 case "$fflushNULL" in
18955 "$undef")
18956         $cat >tryp.c <<EOCP
18957 #include <stdio.h>
18958 int
18959 main(int argc, char **argv)
18960 {
18961     char buf[1024];
18962     int i;
18963     char *bp = buf;
18964     while (1) {
18965         while ((i = getc(stdin)) != -1
18966                && (*bp++ = i) != '\n'
18967                && bp < &buf[1024])
18968         /* DO NOTHING */ ;
18969         *bp = '\0';
18970         fprintf(stdout, "%s", buf);
18971         fflush(stdin);
18972         if (i == -1)
18973             return 0;
18974         bp = buf;
18975     }
18976 }
18977 EOCP
18978         set tryp
18979         if eval $compile; then
18980             $rm -f tryp.out
18981             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18982             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18983                $cat >&4 <<EOM
18984 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18985 EOM
18986                 : now check for fflushall behaviour
18987                 case "$fflushall" in
18988                 '')     set try -DTRY_FFLUSH_ALL $output
18989                         if eval $compile; then
18990                                 $cat >&4 <<EOM
18991 (Now testing the other method--but note that this also may fail.)
18992 EOM
18993                                 $run ./try 2>/dev/null
18994                                 code=$?
18995                                 $from try.out
18996                                 if $test -s try.out -a "X$code" = X42; then
18997                                         fflushall="`$cat try.out`"
18998                                 fi
18999                         fi
19000                         $rm_try
19001                         case "$fflushall" in
19002                         x)      $cat >&4 <<EOM
19003 Whew. Flushing explicitly all the stdio streams works.
19004 EOM
19005                                 fflushall="$define"
19006                                 ;;
19007                         '')     $cat >&4 <<EOM
19008 Sigh. Flushing explicitly all the stdio streams doesn't work.
19009 EOM
19010                                 fflushall="$undef"
19011                                 ;;
19012                         *)      $cat >&4 <<EOM
19013 Cannot figure out whether flushing stdio streams explicitly works or not.
19014 I'm assuming it doesn't.
19015 EOM
19016                                 fflushall="$undef"
19017                                 ;;
19018                         esac
19019                         ;;
19020                 "$define"|true|[yY]*)
19021                         fflushall="$define"
19022                         ;;
19023                 *)
19024                         fflushall="$undef"
19025                         ;;
19026                 esac
19027             else
19028                 $cat >&4 <<EOM
19029 All is futile.  Even fflush(stdin) clobbers input pipes!
19030 EOM
19031                 fflushall="$undef"
19032             fi
19033         else
19034             fflushall="$undef"
19035         fi
19036         $rm -f core tryp.c tryp.core core.tryp.*
19037         ;;
19038 *)      fflushall="$undef"
19039         ;;
19040 esac
19041
19042 case "$fflushNULL$fflushall" in
19043 undefundef)
19044         $cat <<EOM
19045 OK, I give up.  I cannot figure out how to flush pending stdio output.
19046 We won't be flushing handles at all before fork/exec/popen.
19047 EOM
19048         ;;
19049 esac
19050 $rm_try
19051
19052 : Store the full pathname to the ar program for use in the C program
19053 : Respect a hint or command line value for full_ar.
19054 case "$full_ar" in
19055 '') full_ar=$ar ;;
19056 esac
19057
19058 : Store the full pathname to the sed program for use in the C program
19059 full_sed=$sed
19060
19061 : see what type gids are declared as in the kernel
19062 echo " "
19063 echo "Looking for the type for group ids returned by getgid()."
19064 set gid_t gidtype xxx stdio.h sys/types.h
19065 eval $typedef
19066 case "$gidtype" in
19067 xxx)
19068         xxx=`./findhdr sys/user.h`
19069         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19070         case $1 in
19071         unsigned) dflt="$1 $2" ;;
19072         *) dflt="$1" ;;
19073         esac
19074         ;;
19075 *) dflt="$gidtype";;
19076 esac
19077 case "$gidtype" in
19078 gid_t) echo "gid_t found." ;;
19079 *)      rp="What is the type for group ids returned by getgid()?"
19080         . ./myread
19081         gidtype="$ans"
19082         ;;
19083 esac
19084
19085 echo " "
19086 case "$gidtype" in
19087 *_t) zzz="$gidtype"     ;;
19088 *)   zzz="gid"          ;;
19089 esac
19090 echo "Checking the size of $zzz..." >&4 
19091 cat > try.c <<EOCP
19092 #include <sys/types.h>
19093 #include <stdio.h>
19094 #$i_stdlib I_STDLIB
19095 #ifdef I_STDLIB
19096 #include <stdlib.h>
19097 #endif
19098 int main() {
19099     printf("%d\n", (int)sizeof($gidtype));
19100     exit(0);
19101 }
19102 EOCP
19103 set try
19104 if eval $compile_ok; then
19105         yyy=`$run ./try`
19106         case "$yyy" in
19107         '')     gidsize=4
19108                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19109                 ;;
19110         *)      gidsize=$yyy
19111                 echo "Your $zzz is $gidsize bytes long."
19112                 ;;
19113         esac
19114 else
19115         gidsize=4
19116         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19117 fi
19118
19119
19120 echo " "
19121 case "$gidtype" in
19122 *_t) zzz="$gidtype"     ;;
19123 *)   zzz="gid"          ;;
19124 esac
19125 echo "Checking the sign of $zzz..." >&4 
19126 cat > try.c <<EOCP
19127 #include <sys/types.h>
19128 #include <stdio.h>
19129 int main() {
19130         $gidtype foo = -1;
19131         if (foo < 0)
19132                 printf("-1\n");
19133         else
19134                 printf("1\n");
19135 }
19136 EOCP
19137 set try
19138 if eval $compile; then
19139         yyy=`$run ./try`
19140         case "$yyy" in
19141         '')     gidsign=1
19142                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19143                 ;;
19144         *)      gidsign=$yyy
19145                 case "$gidsign" in
19146                  1) echo "Your $zzz is unsigned." ;;
19147                 -1) echo "Your $zzz is signed."   ;;
19148                 esac
19149                 ;;
19150         esac
19151 else
19152         gidsign=1
19153         echo "(I can't compile the test program--guessing unsigned.)" >&4
19154 fi
19155
19156
19157 echo " "
19158
19159 if $test X"$quadtype" != X; then
19160
19161 echo "Checking how to print 64-bit integers..." >&4
19162
19163 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19164         $cat >try.c <<'EOCP'
19165 #include <sys/types.h>
19166 #include <stdio.h>
19167 int main() {
19168   int q = 12345678901;
19169   printf("%ld\n", q);
19170 }
19171 EOCP
19172         set try
19173         if eval $compile; then
19174                 yyy=`$run ./try`
19175                 case "$yyy" in
19176                 12345678901)
19177                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19178                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19179                         echo "We will use %d."
19180                         ;;
19181                 esac
19182         fi
19183 fi
19184
19185 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19186         $cat >try.c <<'EOCP'
19187 #include <sys/types.h>
19188 #include <stdio.h>
19189 int main() {
19190   long q = 12345678901;
19191   printf("%ld\n", q);
19192 }
19193 EOCP
19194         set try
19195         if eval $compile; then
19196                 yyy=`$run ./try`
19197                 case "$yyy" in
19198                 12345678901)
19199                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19200                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19201                         echo "We will use %ld."
19202                         ;;
19203                 esac
19204         fi
19205 fi
19206
19207 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19208         $cat >try.c <<'EOCP'
19209 #include <sys/types.h>
19210 #include <inttypes.h>
19211 #include <stdio.h>
19212 int main() {
19213   int64_t q = 12345678901;
19214   printf("%" PRId64 "\n", q);
19215 }
19216 EOCP
19217         set try
19218         if eval $compile; then
19219                 yyy=`$run ./try`
19220                 case "$yyy" in
19221                 12345678901)
19222                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19223                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19224                         echo "We will use the C9X style."
19225                         ;;
19226                 esac
19227         fi
19228 fi
19229
19230 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19231         $cat >try.c <<EOCP
19232 #include <sys/types.h>
19233 #include <stdio.h>
19234 int main() {
19235   $quadtype q = 12345678901;
19236   printf("%Ld\n", q);
19237 }
19238 EOCP
19239         set try
19240         if eval $compile; then
19241                 yyy=`$run ./try`
19242                 case "$yyy" in
19243                 12345678901)
19244                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19245                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19246                         echo "We will use %Ld."
19247                         ;;
19248                 esac
19249         fi
19250 fi
19251
19252 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19253         $cat >try.c <<'EOCP'
19254 #include <sys/types.h>
19255 #include <stdio.h>
19256 int main() {
19257   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19258   printf("%lld\n", q);
19259 }
19260 EOCP
19261         set try
19262         if eval $compile; then
19263                 yyy=`$run ./try`
19264                 case "$yyy" in
19265                 12345678901)
19266                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19267                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19268                         echo "We will use the %lld style."
19269                         ;;
19270                 esac
19271         fi
19272 fi
19273
19274 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19275         $cat >try.c <<EOCP
19276 #include <sys/types.h>
19277 #include <stdio.h>
19278 int main() {
19279   $quadtype q = 12345678901;
19280   printf("%qd\n", q);
19281 }
19282 EOCP
19283         set try
19284         if eval $compile; then
19285                 yyy=`$run ./try`
19286                 case "$yyy" in
19287                 12345678901)
19288                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19289                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19290                         echo "We will use %qd."
19291                         ;;
19292                 esac
19293         fi
19294 fi
19295
19296 if $test X"$sPRId64" = X; then
19297         echo "Cannot figure out how to print 64-bit integers." >&4
19298 fi
19299 $rm_try
19300
19301 fi
19302
19303 case "$sPRId64" in
19304 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19305         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19306         ;;
19307 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19308         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19309         ;;
19310 esac
19311
19312
19313 echo " "
19314 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19315
19316 if $test X"$ivsize" = X8; then
19317         ivdformat="$sPRId64"
19318         uvuformat="$sPRIu64"
19319         uvoformat="$sPRIo64"
19320         uvxformat="$sPRIx64"
19321         uvXUformat="$sPRIXU64"
19322 else
19323         if $test X"$ivsize" = X"$longsize"; then
19324                 ivdformat='"ld"'
19325                 uvuformat='"lu"'
19326                 uvoformat='"lo"'
19327                 uvxformat='"lx"'
19328                 uvXUformat='"lX"'
19329         else
19330                 if $test X"$ivsize" = X"$intsize"; then
19331                         ivdformat='"d"'
19332                         uvuformat='"u"'
19333                         uvoformat='"o"'
19334                         uvxformat='"x"'
19335                         uvXUformat='"X"'
19336                 else
19337                         : far out
19338                         if $test X"$ivsize" = X"$shortsize"; then
19339                                 ivdformat='"hd"'
19340                                 uvuformat='"hu"'
19341                                 uvoformat='"ho"'
19342                                 uvxformat='"hx"'
19343                                 uvXUformat='"hX"'
19344                         fi
19345                 fi
19346         fi
19347 fi
19348
19349 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19350         nveformat="$sPRIeldbl"
19351         nvfformat="$sPRIfldbl"
19352         nvgformat="$sPRIgldbl"
19353         nvEUformat="$sPRIEUldbl"
19354         nvFUformat="$sPRIFUldbl"
19355         nvGUformat="$sPRIGUldbl"
19356 else
19357         nveformat='"e"'
19358         nvfformat='"f"'
19359         nvgformat='"g"'
19360         nvEUformat='"E"'
19361         nvFUformat='"F"'
19362         nvGUformat='"G"'
19363 fi
19364
19365 case "$ivdformat" in
19366 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19367     exit 1
19368     ;;
19369 esac
19370
19371
19372 echo " "
19373 $echo "Checking the format string to be used for gids..." >&4
19374
19375 case "$gidsign" in
19376 -1)     if $test X"$gidsize" = X"$ivsize"; then
19377                 gidformat="$ivdformat"
19378         else
19379                 if $test X"$gidsize" = X"$longsize"; then
19380                         gidformat='"ld"'
19381                 else
19382                         if $test X"$gidsize" = X"$intsize"; then
19383                                 gidformat='"d"'
19384                         else
19385                                 if $test X"$gidsize" = X"$shortsize"; then
19386                                         gidformat='"hd"'
19387                                 fi
19388                         fi
19389                 fi
19390         fi
19391         ;;
19392 *)      if $test X"$gidsize" = X"$uvsize"; then
19393                 gidformat="$uvuformat"
19394         else
19395                 if $test X"$gidsize" = X"$longsize"; then
19396                         gidformat='"lu"'
19397                 else
19398                         if $test X"$gidsize" = X"$intsize"; then
19399                                 gidformat='"u"'
19400                         else
19401                                 if $test X"$gidsize" = X"$shortsize"; then
19402                                         gidformat='"hu"'
19403                                 fi
19404                         fi
19405                 fi
19406         fi
19407         ;;
19408 esac
19409
19410 : see if getgroups exists
19411 set getgroups d_getgrps
19412 eval $inlibc
19413
19414 : see if setgroups exists
19415 set setgroups d_setgrps
19416 eval $inlibc
19417
19418
19419 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19420 echo " "
19421 case "$d_getgrps$d_setgrps" in
19422 *define*)
19423         case "$groupstype" in
19424         '') dflt="$gidtype" ;;
19425         *)  dflt="$groupstype" ;;
19426         esac
19427         $cat <<EOM
19428 What type of pointer is the second argument to getgroups() and setgroups()?
19429 Usually this is the same as group ids, $gidtype, but not always.
19430
19431 EOM
19432         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19433         . ./myread
19434         groupstype="$ans"
19435         ;;
19436 *)  groupstype="$gidtype";;
19437 esac
19438
19439
19440 if $test $patchlevel -lt 9; then
19441 : MAD is not available in 5.8.x or earlier.
19442     ans=n;
19443 else
19444     case "$mad" in
19445     $define|true|[yY]*) dflt='y' ;;
19446     *)                  dflt='n' ;;
19447     esac
19448     cat <<EOM
19449
19450 Would you like to build with Misc Attribute Decoration? This is development
19451 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19452 overhead on the interpreter.
19453
19454 If this doesn't make any sense to you, just accept the default '$dflt'.
19455 EOM
19456     rp='Build Perl with MAD?'
19457     . ./myread
19458 fi
19459 case "$ans" in
19460 y|Y)    val="$define"
19461         madlyh='madly.h madly.act madly.tab'
19462         madlysrc='madly.c'
19463         madlyobj="madly$_o" ;;
19464 *)      val="$undef"
19465         madlyh=''
19466         madlysrc=''
19467         madlyobj='' ;;
19468 esac
19469 set mad
19470 eval $setvar
19471
19472 echo " "
19473 echo "Checking if your $make program sets \$(MAKE)..." >&4
19474 case "$make_set_make" in
19475 '')
19476         $sed 's/^X //' > testmake.mak << 'EOF'
19477 Xall:
19478 X       @echo 'maketemp="$(MAKE)"'
19479 EOF
19480         case "`$make -f testmake.mak 2>/dev/null`" in
19481         *maketemp=*) make_set_make='#' ;;
19482         *)      make_set_make="MAKE=$make" ;;
19483         esac
19484         $rm -f testmake.mak
19485         ;;
19486 esac
19487 case "$make_set_make" in
19488 '#') echo "Yup, it does.";;
19489 *) echo "Nope, it doesn't.";;
19490 esac
19491
19492 : see what type is used for mode_t
19493 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19494 set mode_t modetype int stdio.h sys/types.h
19495 eval $typedef_ask
19496
19497 : see if we need va_copy
19498 echo " "
19499 case "$i_stdarg" in
19500 "$define")
19501         $cat >try.c <<EOCP
19502 #include <stdarg.h>
19503 #include <stdio.h>
19504 #$i_stdlib I_STDLIB
19505 #ifdef I_STDLIB
19506 #include <stdlib.h>
19507 #endif
19508 #include <signal.h>
19509
19510 int
19511 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19512 {
19513   return vfprintf(f, fmt, *valp);
19514 }
19515
19516 int
19517 myvfprintf(FILE *f, const  char *fmt, va_list val)
19518 {
19519   return ivfprintf(f, fmt, &val);
19520 }
19521
19522 int
19523 myprintf(char *fmt, ...)
19524 {
19525   va_list val;
19526   va_start(val, fmt);
19527   return myvfprintf(stdout, fmt, val);
19528 }
19529
19530 int
19531 main(int ac, char **av)
19532 {
19533   signal(SIGSEGV, exit);
19534
19535   myprintf("%s%cs all right, then\n", "that", '\'');
19536   exit(0);
19537 }
19538 EOCP
19539         set try
19540         if eval $compile && $run ./try 2>&1 >/dev/null; then
19541                 case "`$run ./try`" in
19542                 "that's all right, then")
19543                         okay=yes
19544                         ;;
19545                 esac
19546         fi
19547         case "$okay" in
19548         yes)    echo "It seems that you don't need va_copy()." >&4
19549                 need_va_copy="$undef"
19550                 ;;
19551         *)      echo "It seems that va_copy() or similar will be needed." >&4
19552                 need_va_copy="$define"
19553                 ;;
19554         esac
19555         $rm_try
19556         ;;
19557 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19558         ;;
19559 esac
19560
19561 : see what type is used for size_t
19562 rp="What is the type used for the length parameter for string functions?"
19563 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19564 eval $typedef_ask
19565
19566 : check for type of arguments to gethostbyaddr. 
19567 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19568         case "$d_gethbyaddr" in
19569         $define)
19570                 $cat <<EOM
19571
19572 Checking to see what type of arguments are accepted by gethostbyaddr().
19573 EOM
19574                 hdrs="$define sys/types.h
19575                         $d_socket sys/socket.h 
19576                         $i_niin netinet/in.h 
19577                         $i_netdb netdb.h
19578                         $i_unistd unistd.h"
19579                 : The first arg can 'char *' or 'void *'
19580                 : The second arg is some of integral type
19581                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19582                         for yyy in size_t long int; do
19583                                 case "$netdb_host_type" in
19584                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19585                                         if ./protochk "$try" $hdrs; then
19586                                                 echo "Your system accepts $xxx for the first arg."
19587                                                 echo "...and $yyy for the second arg."
19588                                                 netdb_host_type="$xxx"
19589                                                 netdb_hlen_type="$yyy"
19590                                         fi
19591                                         ;;
19592                                 esac
19593                         done
19594                 done
19595                 : In case none of those worked, prompt the user.
19596                 case "$netdb_host_type" in
19597                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19598                         dflt='char *'
19599                         . ./myread
19600                         netdb_host_type=$ans
19601                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19602                         dflt="$sizetype"
19603                         . ./myread
19604                         netdb_hlen_type=$ans
19605                         ;;
19606                 esac
19607                 ;;
19608         *)      : no gethostbyaddr, so pick harmless defaults
19609                 netdb_host_type='char *'
19610                 netdb_hlen_type="$sizetype"
19611                 ;;
19612         esac
19613         # Remove the "const" if needed. -- but then we'll have a 
19614         # prototype clash!
19615         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19616 fi
19617
19618 : check for type of argument to gethostbyname. 
19619 if test "X$netdb_name_type" = X ; then
19620         case "$d_gethbyname" in
19621         $define)
19622                 $cat <<EOM
19623
19624 Checking to see what type of argument is accepted by gethostbyname().
19625 EOM
19626                 hdrs="$define sys/types.h
19627                         $d_socket sys/socket.h 
19628                         $i_niin netinet/in.h 
19629                         $i_netdb netdb.h
19630                         $i_unistd unistd.h"
19631                 for xxx in "const char *" "char *"; do
19632                         case "$netdb_name_type" in
19633                         '')     try="extern struct hostent *gethostbyname($xxx);"
19634                                 if ./protochk "$try" $hdrs; then
19635                                         echo "Your system accepts $xxx."
19636                                         netdb_name_type="$xxx"
19637                                 fi
19638                                 ;;
19639                         esac
19640                 done
19641                 : In case none of those worked, prompt the user.
19642                 case "$netdb_name_type" in
19643                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19644                         dflt='char *'
19645                         . ./myread
19646                         netdb_name_type=$ans
19647                         ;;
19648                 esac
19649                 ;;
19650         *)      : no gethostbyname, so pick harmless default
19651                 netdb_name_type='char *'
19652                 ;;
19653         esac
19654 fi
19655
19656 : check for type of 1st argument to getnetbyaddr. 
19657 if test "X$netdb_net_type" = X ; then
19658         case "$d_getnbyaddr" in
19659         $define)
19660                 $cat <<EOM
19661
19662 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19663 EOM
19664                 hdrs="$define sys/types.h
19665                         $d_socket sys/socket.h 
19666                         $i_niin netinet/in.h 
19667                         $i_netdb netdb.h
19668                         $i_unistd unistd.h"
19669                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19670                         case "$netdb_net_type" in
19671                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19672                                 if ./protochk "$try" $hdrs; then
19673                                         echo "Your system accepts $xxx."
19674                                         netdb_net_type="$xxx"
19675                                 fi
19676                                 ;;
19677                         esac
19678                 done
19679                 : In case none of those worked, prompt the user.
19680                 case "$netdb_net_type" in
19681                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19682                         dflt='long'
19683                         . ./myread
19684                         netdb_net_type=$ans
19685                         ;;
19686                 esac
19687                 ;;
19688         *)      : no getnetbyaddr, so pick harmless default
19689                 netdb_net_type='long'
19690                 ;;
19691         esac
19692 fi
19693 : locate the preferred pager for this system
19694 fn=f/
19695 case "$pager" in
19696 '')
19697         dflt=''
19698         case "$pg" in
19699         /*) dflt=$pg;;
19700         [a-zA-Z]:/*) dflt=$pg;;
19701         esac
19702         case "$more" in
19703         /*) dflt=$more;;
19704         [a-zA-Z]:/*) dflt=$more;;
19705         esac
19706         case "$less" in
19707         /*) dflt=$less;;
19708         [a-zA-Z]:/*) dflt=$less;;
19709         esac
19710         case "$dflt" in
19711         '') dflt=/usr/ucb/more;;
19712         esac
19713         ;;
19714 *)      dflt="$pager"
19715         : Instruct ./getfile to trust the hinted or previous pager value,
19716         : even if it does not begin with a slash.  For example, on os2,
19717         : pager might be cmd /c more.  See comments in UU/getfile.
19718         fn="f/($pager)"
19719         ;;
19720 esac
19721 echo " "
19722 rp='What pager is used on your system?'
19723 . ./getfile
19724 pager="$ans"
19725
19726 : see what type pids are declared as in the kernel
19727 rp="What is the type of process ids on this system?"
19728 set pid_t pidtype int stdio.h sys/types.h
19729 eval $typedef_ask
19730
19731 : see if ar generates random libraries by itself
19732 echo " "
19733 echo "Checking how to generate random libraries on your machine..." >&4
19734 echo 'int bar1() { return bar2(); }' > bar1.c
19735 echo 'int bar2() { return 2; }' > bar2.c
19736 $cat > foo.c <<EOP
19737 #$i_stdlib I_STDLIB
19738 #ifdef I_STDLIB
19739 #include <stdlib.h>
19740 #endif
19741 int main() { printf("%d\n", bar1()); exit(0); }
19742 EOP
19743 $cc $ccflags -c bar1.c >/dev/null 2>&1
19744 $cc $ccflags -c bar2.c >/dev/null 2>&1
19745 $cc $ccflags -c foo.c >/dev/null 2>&1
19746 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19747 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19748         $run ./foobar >/dev/null 2>&1; then
19749         echo "$ar appears to generate random libraries itself."
19750         orderlib=false
19751         if [ "X$ranlib" = "X" ]; then
19752             ranlib=":"
19753         fi
19754 elif $ar s bar$_a >/dev/null 2>&1 &&
19755         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19756         $run ./foobar >/dev/null 2>&1; then
19757                 echo "a table of contents needs to be added with '$ar s'."
19758                 orderlib=false
19759                 ranlib="$ar s"
19760 elif $ar ts bar$_a >/dev/null 2>&1 &&
19761         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19762         $run ./foobar >/dev/null 2>&1; then
19763                 echo "a table of contents needs to be added with '$ar ts'."
19764                 orderlib=false
19765                 ranlib="$ar ts"
19766 else
19767         case "$ranlib" in
19768         :) ranlib='';;
19769         '')
19770                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19771                 $test -f $ranlib || ranlib=''
19772                 ;;
19773         esac
19774         if $test -n "$ranlib"; then
19775                 echo "your system has '$ranlib'; we'll use that."
19776                 orderlib=false
19777         else
19778                 echo "your system doesn't seem to support random libraries"
19779                 echo "so we'll use lorder and tsort to order the libraries."
19780                 orderlib=true
19781                 ranlib=":"
19782         fi
19783 fi
19784 $rm -f foo* bar*
19785
19786 : check for type of arguments to select. 
19787 case "$selecttype" in
19788 '') case "$d_select" in
19789         $define)
19790                 echo " "
19791                 $cat <<EOM
19792 Checking to see what type of arguments are accepted by select().
19793 EOM
19794                 hdrs="$define sys/types.h
19795                         $i_systime sys/time.h 
19796                         $i_sysselct sys/select.h
19797                         $d_socket sys/socket.h"
19798                 : The first arg can be int, unsigned, or size_t
19799                 : The last arg may or may not be 'const'
19800                 val=''
19801                 : void pointer has been seen but using that
19802                 : breaks the selectminbits test
19803                 for xxx in 'fd_set *' 'int *'; do
19804                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19805                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19806                                         case "$val" in
19807                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19808                                                 if ./protochk "$try" $hdrs; then
19809                                                         echo "Your system accepts $xxx."
19810                                                         val="$xxx"
19811                                                 fi
19812                                                 ;;
19813                                         esac
19814                                 done
19815                         done
19816                 done
19817                 case "$val" in
19818                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19819                         case "$d_fd_set" in
19820                                 $define) dflt="fd_set *" ;;
19821                                 *)              dflt="int *" ;;
19822                         esac
19823                         . ./myread
19824                         val=$ans
19825                         ;;
19826                 esac
19827                 selecttype="$val"
19828                 ;;
19829         *)      : no select, so pick a harmless default
19830                 selecttype='int *'
19831                 ;;
19832         esac
19833         ;;
19834 esac
19835
19836 : check for the select 'width'
19837 case "$selectminbits" in
19838 '') safebits=`expr $ptrsize \* 8`
19839     case "$d_select" in
19840         $define)
19841                 $cat <<EOM
19842
19843 Checking to see on how many bits at a time your select() operates...
19844 EOM
19845                 $cat >try.c <<EOCP
19846 #include <sys/types.h>
19847 #$i_time I_TIME
19848 #$i_systime I_SYS_TIME
19849 #$i_systimek I_SYS_TIME_KERNEL
19850 #ifdef I_TIME
19851 #   include <time.h>
19852 #endif
19853 #ifdef I_SYS_TIME
19854 #   ifdef I_SYS_TIME_KERNEL
19855 #       define KERNEL
19856 #   endif
19857 #   include <sys/time.h>
19858 #   ifdef I_SYS_TIME_KERNEL
19859 #       undef KERNEL
19860 #   endif
19861 #endif
19862 #$i_sysselct I_SYS_SELECT
19863 #ifdef I_SYS_SELECT
19864 #include <sys/select.h>
19865 #endif
19866 #$d_socket HAS_SOCKET
19867 #ifdef HAS_SOCKET
19868 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19869 #endif
19870 #include <stdio.h>
19871 #$i_stdlib I_STDLIB
19872 #ifdef I_STDLIB
19873 #include <stdlib.h>
19874 #endif
19875 $selecttype b;
19876 #define S sizeof(*(b))
19877 #define MINBITS 64
19878 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19879 #define NBITS  (NBYTES * 8)
19880 int main() {
19881     char *s = (char *)malloc(NBYTES);
19882     struct timeval t;
19883     int i;
19884     FILE* fp;
19885     int fd;
19886
19887     if (!s)
19888         exit(1);
19889     fclose(stdin);
19890     fp = fopen("try.c", "r");
19891     if (fp == 0)
19892       exit(2);
19893     fd = fileno(fp);
19894     if (fd < 0)
19895       exit(3);
19896     b = ($selecttype)s;
19897     for (i = 0; i < NBITS; i++)
19898         FD_SET(i, b);
19899     t.tv_sec  = 0;
19900     t.tv_usec = 0;
19901     select(fd + 1, b, 0, 0, &t);
19902     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19903     free(s);
19904     printf("%d\n", i + 1);
19905     return 0;
19906 }
19907 EOCP
19908                 set try
19909                 if eval $compile_ok; then
19910                         selectminbits=`$run ./try`
19911                         case "$selectminbits" in
19912                         '')     cat >&4 <<EOM
19913 Cannot figure out on how many bits at a time your select() operates.
19914 I'll play safe and guess it is $safebits bits.
19915 EOM
19916                                 selectminbits=$safebits
19917                                 bits="$safebits bits"
19918                                 ;;
19919                         1)      bits="1 bit" ;;
19920                         *)      bits="$selectminbits bits" ;;
19921                         esac
19922                         echo "Your select() operates on $bits at a time." >&4
19923                 else
19924                         rp='What is the minimum number of bits your select() operates on?'
19925                         case "$byteorder" in
19926                         12345678)       dflt=64 ;;
19927                         1234)           dflt=32 ;;
19928                         *)              dflt=1  ;;
19929                         esac
19930                         . ./myread
19931                         val=$ans
19932                         selectminbits="$val"
19933                 fi
19934                 $rm_try
19935                 ;;
19936         *)      : no select, so pick a harmless default
19937                 selectminbits=$safebits
19938                 ;;
19939         esac
19940         ;;
19941 esac
19942
19943 : Trace out the files included by signal.h, then look for SIGxxx names.
19944 : Remove SIGARRAYSIZE used by HPUX.
19945 : Remove SIGSTKSIZE used by Linux.
19946 : Remove SIGSTKSZ used by Posix.
19947 : Remove SIGTYP void lines used by OS2.
19948 : Some cpps, like os390, dont give the file name anywhere
19949 if [ "X$fieldn" = X ]; then
19950         : Just make some guesses.  We check them later.
19951         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19952 else
19953         xxx=`echo '#include <signal.h>' |
19954         $cppstdin $cppminus $cppflags 2>/dev/null |
19955         $grep '^[       ]*#.*include' | 
19956         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19957 fi
19958 : Check this list of files to be sure we have parsed the cpp output ok.
19959 : This will also avoid potentially non-existent files, such 
19960 : as ../foo/bar.h
19961 xxxfiles=''
19962 for xx in $xxx /dev/null ; do
19963         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19964 done
19965 : If we have found no files, at least try signal.h
19966 case "$xxxfiles" in
19967 '')     xxxfiles=`./findhdr signal.h` ;;
19968 esac
19969 xxx=`awk '
19970 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19971         print substr($2, 4, 20)
19972 }
19973 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19974         print substr($3, 4, 20)
19975 }' $xxxfiles`
19976 : Append some common names just in case the awk scan failed.
19977 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19978 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19979 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19980 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19981 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19982
19983 : generate a few handy files for later
19984 $cat > signal.c <<EOCP
19985 #include <sys/types.h>
19986 #include <signal.h>
19987 #$i_stdlib I_STDLIB
19988 #ifdef I_STDLIB
19989 #include <stdlib.h>
19990 #endif
19991 #include <stdio.h>
19992 int main() {
19993
19994 /* Strange style to avoid deeply-nested #if/#else/#endif */
19995 #ifndef NSIG
19996 #  ifdef _NSIG
19997 #    define NSIG (_NSIG)
19998 #  endif
19999 #endif
20000
20001 #ifndef NSIG
20002 #  ifdef SIGMAX
20003 #    define NSIG (SIGMAX+1)
20004 #  endif
20005 #endif
20006
20007 #ifndef NSIG
20008 #  ifdef SIG_MAX
20009 #    define NSIG (SIG_MAX+1)
20010 #  endif
20011 #endif
20012
20013 #ifndef NSIG
20014 #  ifdef _SIG_MAX
20015 #    define NSIG (_SIG_MAX+1)
20016 #  endif
20017 #endif
20018
20019 #ifndef NSIG
20020 #  ifdef MAXSIG
20021 #    define NSIG (MAXSIG+1)
20022 #  endif
20023 #endif
20024
20025 #ifndef NSIG
20026 #  ifdef MAX_SIG
20027 #    define NSIG (MAX_SIG+1)
20028 #  endif
20029 #endif
20030
20031 #ifndef NSIG
20032 #  ifdef SIGARRAYSIZE
20033 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20034 #  endif
20035 #endif
20036
20037 #ifndef NSIG
20038 #  ifdef _sys_nsig
20039 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20040 #  endif
20041 #endif
20042
20043 /* Default to some arbitrary number that's big enough to get most
20044    of the common signals.
20045 */
20046 #ifndef NSIG
20047 #    define NSIG 50
20048 #endif
20049
20050 printf("NSIG %d\n", NSIG);
20051
20052 #ifndef JUST_NSIG
20053
20054 EOCP
20055
20056 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20057 {
20058         printf "#ifdef SIG"; printf $1; printf "\n"
20059         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20060         printf $1; printf ");\n"
20061         printf "#endif\n"
20062 }
20063 END {
20064         printf "#endif /* JUST_NSIG */\n";
20065         printf "exit(0);\n}\n";
20066 }
20067 ' >>signal.c
20068 $cat >signal.awk <<'EOP'
20069 BEGIN { ndups = 0 }
20070 $1 ~ /^NSIG$/ { nsig = $2 }
20071 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20072     if ($2 > maxsig) { maxsig = $2 }
20073     if (sig_name[$2]) {
20074         dup_name[ndups] = $1
20075         dup_num[ndups] = $2
20076         ndups++ 
20077     }
20078     else {
20079         sig_name[$2] = $1
20080         sig_num[$2] = $2
20081     }
20082 }
20083 END { 
20084     if (nsig == 0) {
20085         nsig = maxsig + 1
20086     }
20087     printf("NSIG %d\n", nsig);
20088     for (n = 1; n < nsig; n++) {
20089         if (sig_name[n]) {
20090             printf("%s %d\n", sig_name[n], sig_num[n])
20091         }
20092         else {
20093             printf("NUM%d %d\n", n, n) 
20094         }
20095     }
20096     for (n = 0; n < ndups; n++) {
20097         printf("%s %d\n", dup_name[n], dup_num[n])
20098     }
20099 }
20100 EOP
20101 $cat >signal_cmd <<EOS
20102 $startsh
20103 if $test -s signal.lst; then
20104     echo "Using your existing signal.lst file"
20105         exit 0
20106 fi
20107 xxx="$xxx"
20108 EOS
20109 $cat >>signal_cmd <<'EOS'
20110
20111 set signal
20112 if eval $compile_ok; then
20113         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20114 else
20115         echo "(I can't seem be able to compile the whole test program)" >&4
20116         echo "(I'll try it in little pieces.)" >&4
20117         set signal -DJUST_NSIG
20118         if eval $compile_ok; then
20119                 $run ./signal$_exe > signal.nsg
20120                 $cat signal.nsg
20121         else
20122                 echo "I can't seem to figure out how many signals you have." >&4
20123                 echo "Guessing 50." >&4
20124                 echo 'NSIG 50' > signal.nsg
20125         fi
20126         : Now look at all the signal names, one at a time.
20127         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20128                 $cat > signal.c <<EOCP
20129 #include <sys/types.h>
20130 #include <signal.h>
20131 #include <stdio.h>
20132 int main() {
20133 printf("$xx %d\n", SIG${xx});
20134 return 0;
20135 }
20136 EOCP
20137                 set signal
20138                 if eval $compile; then
20139                         echo "SIG${xx} found."
20140                         $run ./signal$_exe  >> signal.ls1
20141                 else
20142                         echo "SIG${xx} NOT found."
20143                 fi
20144         done
20145         if $test -s signal.ls1; then
20146                 $cat signal.nsg signal.ls1 |
20147                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20148         fi
20149
20150 fi
20151 if $test -s signal.lst; then
20152         :
20153 else
20154         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20155         echo 'kill -l' >signal
20156         set X `csh -f <signal`
20157         $rm -f signal
20158         shift
20159         case $# in
20160         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20161         esac
20162         echo $@ | $tr ' ' $trnl | \
20163             $awk '{ printf "%s %d\n", $1, ++s; }
20164                   END { printf "NSIG %d\n", ++s }' >signal.lst
20165 fi
20166 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20167 EOS
20168 chmod a+x signal_cmd
20169 $eunicefix signal_cmd
20170
20171 : generate list of signal names
20172 echo " "
20173 case "$sig_name_init" in
20174 '') doinit=yes ;;
20175 *)  case "$sig_num_init" in
20176     ''|*,*) doinit=yes ;;
20177     esac ;;
20178 esac
20179 case "$doinit" in
20180 yes)
20181         echo "Generating a list of signal names and numbers..." >&4
20182         . ./signal_cmd
20183         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20184         sig_name=`$awk 'BEGIN { printf "ZERO " }
20185                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20186         sig_num=`$awk  'BEGIN { printf "0 " }
20187                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20188         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20189                              !/^NSIG/   { printf "\"%s\", ", $1 }
20190                              END        { printf "0\n" }' signal.lst`
20191         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20192                              !/^NSIG/   { printf "%d, ", $2}
20193                              END        { printf "0\n"}' signal.lst`
20194         ;;
20195 esac
20196 echo "The following $sig_count signals are available:"
20197 echo " "
20198 echo $sig_name | $awk \
20199 'BEGIN { linelen = 0 }
20200 {
20201         for (i = 1; i <= NF; i++) {
20202                 name = "SIG" $i " "
20203                 linelen = linelen + length(name)
20204                 if (linelen > 70) {
20205                         printf "\n"
20206                         linelen = length(name)
20207                 }
20208                 printf "%s", name
20209         }
20210         printf "\n"
20211 }'
20212 sig_size=`echo $sig_name | awk '{print NF}'`
20213 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20214
20215 echo " "
20216 case "$sizetype" in
20217 *_t) zzz="$sizetype"    ;;
20218 *)   zzz="filesize"     ;;
20219 esac
20220 echo "Checking the size of $zzz..." >&4 
20221 cat > try.c <<EOCP
20222 #include <sys/types.h>
20223 #include <stdio.h>
20224 #$i_stdlib I_STDLIB
20225 #ifdef I_STDLIB
20226 #include <stdlib.h>
20227 #endif
20228 int main() {
20229     printf("%d\n", (int)sizeof($sizetype));
20230     exit(0);
20231 }
20232 EOCP
20233 set try
20234 if eval $compile_ok; then
20235         yyy=`$run ./try`
20236         case "$yyy" in
20237         '')     sizesize=4
20238                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20239                 ;;
20240         *)      sizesize=$yyy
20241                 echo "Your $zzz size is $sizesize bytes."
20242                 ;;
20243         esac
20244 else
20245         sizesize=4
20246         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20247 fi
20248
20249
20250 : check for socklen_t
20251 echo " "
20252 echo "Checking to see if you have socklen_t..." >&4
20253 $cat >try.c <<EOCP
20254 #include <sys/types.h>
20255 #$d_socket HAS_SOCKET
20256 #ifdef HAS_SOCKET
20257 #include <sys/socket.h>
20258 #endif
20259 int main() { socklen_t x = 16; }
20260 EOCP
20261 set try
20262 if eval $compile; then
20263         val="$define"
20264         echo "You have socklen_t."
20265 else
20266         val="$undef"
20267         echo "You do not have socklen_t."
20268         case "$sizetype" in
20269         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20270         esac
20271 fi
20272 $rm_try
20273 set d_socklen_t
20274 eval $setvar
20275
20276 : see if this is a socks.h system
20277 set socks.h i_socks
20278 eval $inhdr
20279
20280 : check for type of the size argument to socket calls
20281 case "$d_socket" in
20282 "$define")
20283         $cat <<EOM
20284
20285 Checking to see what type is the last argument of accept().
20286 EOM
20287         yyy=''
20288         case "$d_socklen_t" in
20289         "$define") yyy="$yyy socklen_t"
20290         esac
20291         yyy="$yyy $sizetype int long unsigned"
20292         for xxx in $yyy; do
20293                 case "$socksizetype" in
20294                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20295                         case "$usesocks" in
20296                         "$define")
20297                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20298                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20299                                         socksizetype="$xxx"
20300                                 fi
20301                                 ;;
20302                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20303                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20304                                         socksizetype="$xxx"
20305                                 fi
20306                                 ;;
20307                         esac
20308                         ;;
20309                 esac
20310         done
20311 : In case none of those worked, prompt the user.
20312         case "$socksizetype" in
20313         '')     rp='What is the type for socket address structure sizes?'
20314                 dflt='int'
20315                 . ./myread
20316                 socksizetype=$ans
20317                 ;;
20318         esac
20319         ;;
20320 *)      : no sockets, so pick relatively harmless default
20321         socksizetype='int'
20322         ;;
20323 esac
20324
20325 : see what type is used for signed size_t
20326 set ssize_t ssizetype int stdio.h sys/types.h
20327 eval $typedef
20328 dflt="$ssizetype"
20329 $cat > try.c <<EOM
20330 #include <stdio.h>
20331 #$i_stdlib I_STDLIB
20332 #ifdef I_STDLIB
20333 #include <stdlib.h>
20334 #endif
20335 #include <sys/types.h>
20336 #define Size_t $sizetype
20337 #define SSize_t $dflt
20338 int main()
20339 {
20340         if (sizeof(Size_t) == sizeof(SSize_t))
20341                 printf("$dflt\n");
20342         else if (sizeof(Size_t) == sizeof(int))
20343                 printf("int\n");
20344         else
20345                 printf("long\n");
20346         exit(0);
20347 }
20348 EOM
20349 echo " "
20350 set try
20351 if eval $compile_ok && $run ./try > /dev/null; then
20352         ssizetype=`$run ./try`
20353         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20354 else
20355         $cat >&4 <<EOM
20356 Help! I can't compile and run the ssize_t test program: please enlighten me!
20357 (This is probably a misconfiguration in your system or libraries, and
20358 you really ought to fix it.  Still, I'll try anyway.)
20359
20360 I need a type that is the same size as $sizetype, but is guaranteed to
20361 be signed.  Common values are ssize_t, int and long.
20362
20363 EOM
20364         rp="What signed type is the same size as $sizetype?"
20365         . ./myread
20366         ssizetype="$ans"
20367 fi
20368 $rm_try
20369
20370 : see what type of char stdio uses.
20371 echo " "
20372 echo '#include <stdio.h>' > stdio.c
20373 $cppstdin $cppminus < stdio.c > stdioh
20374 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20375         echo "Your stdio uses unsigned chars." >&4
20376         stdchar="unsigned char"
20377 else
20378         echo "Your stdio uses signed chars." >&4
20379         stdchar="char"
20380 fi
20381 $rm -f stdio.* stdioh
20382
20383 : see what type uids are declared as in the kernel
20384 echo " "
20385 echo "Looking for the type for user ids returned by getuid()."
20386 set uid_t uidtype xxx stdio.h sys/types.h
20387 eval $typedef
20388 case "$uidtype" in
20389 xxx)
20390         xxx=`./findhdr sys/user.h`
20391         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20392         case $1 in
20393         unsigned) dflt="$1 $2" ;;
20394         *) dflt="$1" ;;
20395         esac
20396         ;;
20397 *) dflt="$uidtype";;
20398 esac
20399 case "$uidtype" in
20400 uid_t)  echo "uid_t found." ;;
20401 *)      rp="What is the type for user ids returned by getuid()?"
20402         . ./myread
20403         uidtype="$ans"
20404         ;;
20405 esac
20406
20407 echo " "
20408 case "$uidtype" in
20409 *_t) zzz="$uidtype"     ;;
20410 *)   zzz="uid"          ;;
20411 esac
20412 echo "Checking the size of $zzz..." >&4 
20413 cat > try.c <<EOCP
20414 #include <sys/types.h>
20415 #include <stdio.h>
20416 #$i_stdlib I_STDLIB
20417 #ifdef I_STDLIB
20418 #include <stdlib.h>
20419 #endif
20420 int main() {
20421     printf("%d\n", (int)sizeof($uidtype));
20422     exit(0);
20423 }
20424 EOCP
20425 set try
20426 if eval $compile_ok; then
20427         yyy=`$run ./try`
20428         case "$yyy" in
20429         '')     uidsize=4
20430                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20431                 ;;
20432         *)      uidsize=$yyy
20433                 echo "Your $zzz is $uidsize bytes long."
20434                 ;;
20435         esac
20436 else
20437         uidsize=4
20438         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20439 fi
20440
20441 echo " "
20442 case "$uidtype" in
20443 *_t) zzz="$uidtype"     ;;
20444 *)   zzz="uid"          ;;
20445 esac
20446 echo "Checking the sign of $zzz..." >&4
20447 cat > try.c <<EOCP
20448 #include <sys/types.h>
20449 #include <stdio.h>
20450 int main() {
20451         $uidtype foo = -1;
20452         if (foo < 0)
20453                 printf("-1\n");
20454         else
20455                 printf("1\n");
20456 }
20457 EOCP
20458 set try
20459 if eval $compile; then
20460         yyy=`$run ./try`
20461         case "$yyy" in
20462         '')     uidsign=1
20463                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20464                 ;;
20465         *)      uidsign=$yyy
20466                 case "$uidsign" in
20467                  1) echo "Your $zzz is unsigned." ;;
20468                 -1) echo "Your $zzz is signed."   ;;
20469                 esac
20470                 ;;
20471         esac
20472 else
20473         uidsign=1
20474         echo "(I can't compile the test program--guessing unsigned.)" >&4
20475 fi
20476
20477
20478
20479 echo " "
20480 $echo "Checking the format string to be used for uids..." >&4
20481
20482 case "$uidsign" in
20483 -1)     if $test X"$uidsize" = X"$ivsize"; then
20484                 uidformat="$ivdformat"
20485         else
20486                 if $test X"$uidsize" = X"$longsize"; then
20487                         uidformat='"ld"'
20488                 else
20489                         if $test X"$uidsize" = X"$intsize"; then
20490                                 uidformat='"d"'
20491                         else
20492                                 if $test X"$uidsize" = X"$shortsize"; then
20493                                         uidformat='"hd"'
20494                                 fi
20495                         fi
20496                 fi
20497         fi
20498         ;;
20499 *)      if $test X"$uidsize" = X"$uvsize"; then
20500                 uidformat="$uvuformat"
20501         else
20502                 if $test X"$uidsize" = X"$longsize"; then
20503                         uidformat='"lu"'
20504                 else
20505                         if $test X"$uidsize" = X"$intsize"; then
20506                                 uidformat='"u"'
20507                         else
20508                                 if $test X"$uidsize" = X"$shortsize"; then
20509                                         uidformat='"hu"'
20510                                 fi
20511                         fi
20512                 fi
20513         fi
20514         ;;
20515 esac
20516
20517
20518 case "$usesitecustomize" in
20519     $define|true|[Yy]*)
20520         usesitecustomize="$define"
20521         ;;
20522     *)
20523         usesitecustomize="$undef"
20524         ;;
20525     esac
20526
20527 : determine compiler compiler
20528 case "$yacc" in
20529 '')
20530         dflt=yacc;;
20531 *)
20532         dflt="$yacc";;
20533 esac
20534 echo " "
20535 comp='yacc'
20536 if $test -f "$byacc$_exe"; then
20537         dflt="$byacc"
20538         comp="byacc or $comp"
20539 fi
20540 if $test -f "$bison$_exe"; then
20541         comp="$comp or bison -y"
20542 fi
20543 rp="Which compiler compiler ($comp) shall I use?"
20544 . ./myread
20545 yacc="$ans"
20546 case "$yacc" in
20547 *bis*)
20548         case "$yacc" in
20549         *-y*) ;;
20550         *)
20551                 yacc="$yacc -y"
20552                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20553                 ;;
20554         esac
20555         ;;
20556 esac
20557
20558 : see if this is a fp.h system
20559 set fp.h i_fp
20560 eval $inhdr
20561
20562 : see if this is a fp_class.h system
20563 set fp_class.h i_fp_class
20564 eval $inhdr
20565
20566 : see if gdbm.h is available
20567 set gdbm.h t_gdbm
20568 eval $inhdr
20569 case "$t_gdbm" in
20570 $define)
20571         : see if gdbm_open exists
20572         set gdbm_open d_gdbm_open
20573         eval $inlibc
20574         case "$d_gdbm_open" in
20575         $undef)
20576                 t_gdbm="$undef"
20577                 echo "We won't be including <gdbm.h>"
20578                 ;;
20579         esac
20580         ;;
20581 esac
20582 val="$t_gdbm"
20583 set i_gdbm
20584 eval $setvar
20585
20586 : see if this is a ieeefp.h system
20587 case "$i_ieeefp" in
20588 '' ) set ieeefp.h i_ieeefp
20589      eval $inhdr
20590      ;;
20591 esac
20592
20593 : see if this is a libutil.h system
20594 set libutil.h i_libutil
20595 eval $inhdr
20596
20597 : see if mach cthreads are available
20598 if test "X$usethreads" = "X$define"; then
20599         set mach/cthreads.h i_machcthr
20600         eval $inhdr
20601 else
20602         i_machcthr="$undef"
20603 fi
20604
20605
20606
20607 : see if this is a mntent.h system
20608 set mntent.h i_mntent
20609 eval $inhdr
20610
20611 : see if ndbm.h is available
20612 set ndbm.h t_ndbm
20613 eval $inhdr
20614
20615 case "$t_ndbm" in
20616 $undef)
20617     # Some Linux distributions such as RedHat 7.1 put the
20618     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20619     if $test -f /usr/include/gdbm/ndbm.h; then
20620         echo '<gdbm/ndbm.h> found.'
20621         ccflags="$ccflags -I/usr/include/gdbm"
20622         cppflags="$cppflags -I/usr/include/gdbm"
20623         t_ndbm=$define
20624     fi
20625     ;;
20626 esac
20627
20628 case "$t_ndbm" in
20629 $define)
20630         : see if dbm_open exists
20631         set dbm_open d_dbm_open
20632         eval $inlibc
20633         case "$d_dbm_open" in
20634         $undef)
20635                 t_ndbm="$undef"
20636                 echo "We won't be including <ndbm.h>"
20637                 ;;
20638         esac
20639         ;;
20640 esac
20641 val="$t_ndbm"
20642 set i_ndbm
20643 eval $setvar
20644
20645 : see if net/errno.h is available
20646 val=''
20647 set net/errno.h val
20648 eval $inhdr
20649
20650 : Unfortunately, it causes problems on some systems.  Arrgh.
20651 case "$val" in
20652 $define)
20653         cat > try.c <<'EOM'
20654 #include <stdio.h>
20655 #include <errno.h>
20656 #include <net/errno.h>
20657 int func()
20658 {
20659         return ENOTSOCK;
20660 }
20661 EOM
20662         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20663                 echo "We'll be including <net/errno.h>." >&4
20664         else
20665                 echo "We won't be including <net/errno.h>." >&4
20666                 val="$undef"
20667         fi
20668         $rm_try
20669         ;;
20670 esac
20671 set i_neterrno
20672 eval $setvar
20673
20674 : see if netinet/tcp.h is available
20675 set netinet/tcp.h i_netinettcp
20676 eval $inhdr
20677
20678 : see if this is a poll.h system
20679 set poll.h i_poll
20680 eval $inhdr
20681
20682 : see if this is a prot.h system
20683 set prot.h i_prot
20684 eval $inhdr
20685
20686 echo " "
20687 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20688 $cat <<'EOSH' > Cppsym.know
20689 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20690 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20691 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20692 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20693 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20694 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20695 bull c cadmus clipper CMU COFF COMPILER_VERSION
20696 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20697 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20698 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20699 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20700 GLIBC GLIBC_MINOR
20701 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20702 H3050R H3050RX hbullx20 hcx host_mips
20703 hp200 hp300 hp700 HP700 hp800 hp9000
20704 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20705 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20706 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20707 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20708 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20709 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20710 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20711 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20712 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20713 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20714 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20715 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20716 MATH_HAS_NO_SIDE_EFFECTS
20717 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20718 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20719 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20720 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20721 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20722 NetBSD news1500 news1700 news1800 news1900 news3700
20723 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20724 ns32016 ns32332 ns32k nsc32000
20725 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20726 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20727 pc532 pdp11 PGC PIC plexus PORTAR posix
20728 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20729 POSIX_C_SOURCE POSIX_SOURCE POWER
20730 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20731 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20732 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20733 sony sony_news sonyrisc sparc sparclite spectrum
20734 stardent stdc STDC_EXT stratos sun sun3 sun386
20735 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20736 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20737 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20738 sysV68 sysV88 Tek4132 Tek4300 titan
20739 TM3200 TM5400 TM5600
20740 tower tower32 tower32_200 tower32_600 tower32_700
20741 tower32_800 tower32_850 tss
20742 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20743 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20744 unix UNIX95 UNIX99 unixpc unos
20745 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20746 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20747 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20748 USGr4 USGr4_2
20749 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20750 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20751 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20752 z8000
20753 EOSH
20754 # Maybe put other stuff here too.
20755 cat <<EOSH >>Cppsym.know
20756 $osname
20757 EOSH
20758 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20759 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20760 $cat Cppsym.know > Cppsym.c
20761 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20762 $rm -f Cppsym.a Cppsym.b Cppsym.c
20763 cat <<EOSH > Cppsym
20764 $startsh
20765 if $test \$# -gt 0; then
20766     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20767     if $test -s Cppsym.got; then
20768         $rm -f Cppsym.got
20769         exit 0
20770     fi
20771     $rm -f Cppsym.got
20772     exit 1
20773 else
20774     $tr " " "$trnl" | ./Cppsym.try
20775     exit 0
20776 fi
20777 EOSH
20778 chmod +x Cppsym
20779 $eunicefix Cppsym
20780 cat <<EOSH > Cppsym.try
20781 $startsh
20782 cat <<'EOCP' > try.c
20783 #include <stdio.h>
20784 #if cpp_stuff == 1
20785 #define STRINGIFY(a)    "a"
20786 #endif
20787 #if cpp_stuff == 42
20788 #define StGiFy(a)  #a
20789 #define STRINGIFY(a)    StGiFy(a)
20790 #endif
20791 #if $cpp_stuff != 1 && $cpp_stuff != 42
20792 #   include "Bletch: How does this C preprocessor stringify macros?"
20793 #endif
20794 int main() {
20795 EOCP
20796 $awk \\
20797 EOSH
20798 cat <<'EOSH' >> Cppsym.try
20799 'length($1) > 0 {
20800     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20801     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20802     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20803     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20804 }'       >> try.c
20805 echo 'return 0;}' >> try.c
20806 EOSH
20807 cat <<EOSH >> Cppsym.try
20808 ccflags="$ccflags"
20809 case "$osname-$gccversion" in
20810 irix-) ccflags="\$ccflags -woff 1178" ;;
20811 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20812 esac
20813 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20814 EOSH
20815 chmod +x Cppsym.try
20816 $eunicefix Cppsym.try
20817 ./Cppsym < Cppsym.know > Cppsym.true
20818 : Add in any linux cpp "predefined macros":
20819 case "$osname::$gccversion" in
20820   *linux*::*.*)
20821     tHdrH=_tmpHdr
20822     rm -f $tHdrH'.h' $tHdrH
20823     touch $tHdrH'.h'
20824     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20825        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20826        if [ -s $tHdrH'_cppsym.real' ]; then
20827           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20828        fi
20829     fi
20830     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20831   ;;
20832 esac
20833 : now check the C compiler for additional symbols
20834 postprocess_cc_v=''
20835 case "$osname" in
20836 aix) postprocess_cc_v="|$tr , ' '" ;;
20837 esac
20838 $cat >ccsym <<EOS
20839 $startsh
20840 $cat >tmp.c <<EOF
20841 extern int foo;
20842 EOF
20843 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20844 do
20845         case "\$i" in
20846         -D*) echo "\$i" | $sed 's/^-D//';;
20847         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20848         esac
20849 done
20850 $rm_try
20851 EOS
20852 postprocess_cc_v=''
20853 chmod +x ccsym
20854 $eunicefix ccsym
20855 ./ccsym > ccsym1.raw
20856 if $test -s ccsym1.raw; then
20857        $sort ccsym1.raw | $uniq >ccsym.raw
20858 else
20859        mv ccsym1.raw ccsym.raw
20860 fi
20861
20862 $awk '/\=/ { print $0; next }
20863         { print $0"=1" }' ccsym.raw >ccsym.list
20864 $comm -13 Cppsym.true ccsym.list >ccsym.own
20865 $comm -12 Cppsym.true ccsym.list >ccsym.com
20866 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20867 also=''
20868 if $test -z ccsym.raw; then
20869         echo "Your C compiler doesn't seem to define any symbols!" >&4
20870         echo " "
20871         echo "However, your C preprocessor defines the following symbols:"
20872         $cat Cppsym.true
20873         ccsymbols=''
20874         cppsymbols=`$cat Cppsym.true`
20875         cppsymbols=`echo $cppsymbols`
20876         cppccsymbols="$cppsymbols"
20877 else
20878         if $test -s ccsym.com; then
20879                 echo "Your C compiler and pre-processor define these symbols:"
20880                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20881                 also='also '
20882                 symbols='ones'
20883                 cppccsymbols=`$cat ccsym.com`
20884                 cppccsymbols=`echo $cppccsymbols`
20885                 $test "$silent" || sleep 1
20886         fi
20887         if $test -s ccsym.cpp; then
20888                 $test "$also" && echo " "
20889                 echo "Your C pre-processor ${also}defines the following symbols:"
20890                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20891                 also='further '
20892                 cppsymbols=`$cat ccsym.cpp`
20893                 cppsymbols=`echo $cppsymbols`
20894                 $test "$silent" || sleep 1
20895         fi
20896         if $test -s ccsym.own; then
20897                 $test "$also" && echo " "
20898                 echo "Your C compiler ${also}defines the following cpp symbols:"
20899                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20900                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20901                 ccsymbols=`$cat ccsym.own`
20902                 ccsymbols=`echo $ccsymbols`
20903                 $test "$silent" || sleep 1
20904         fi
20905 fi
20906
20907 : see if this is a termio system
20908 val="$undef"
20909 val2="$undef"
20910 val3="$undef"
20911 if $test `./findhdr termios.h`; then
20912         set tcsetattr i_termios
20913         eval $inlibc
20914         val3="$i_termios"
20915 fi
20916 echo " "
20917 case "$val3" in
20918 "$define") echo "You have POSIX termios.h... good!" >&4;;
20919 *) if ./Cppsym pyr; then
20920                 case "`/bin/universe`" in
20921                 ucb) if $test `./findhdr sgtty.h`; then
20922                                 val2="$define"
20923                                 echo "<sgtty.h> found." >&4
20924                         else
20925                                 echo "System is pyramid with BSD universe."
20926                                 echo "<sgtty.h> not found--you could have problems." >&4
20927                         fi;;
20928                 *) if $test `./findhdr termio.h`; then
20929                                 val="$define"
20930                                 echo "<termio.h> found." >&4
20931                         else
20932                                 echo "System is pyramid with USG universe."
20933                                 echo "<termio.h> not found--you could have problems." >&4
20934                         fi;;
20935                 esac
20936         elif ./usg; then
20937                 if $test `./findhdr termio.h`; then
20938                         echo "<termio.h> found." >&4
20939                         val="$define"
20940                 elif $test `./findhdr sgtty.h`; then
20941                         echo "<sgtty.h> found." >&4
20942                         val2="$define"
20943                 else
20944 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20945                 fi
20946         else
20947                 if $test `./findhdr sgtty.h`; then
20948                         echo "<sgtty.h> found." >&4
20949                         val2="$define"
20950                 elif $test `./findhdr termio.h`; then
20951                         echo "<termio.h> found." >&4
20952                         val="$define"
20953                 else
20954 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20955                 fi
20956         fi;;
20957 esac
20958 set i_termio; eval $setvar
20959 val=$val2; set i_sgtty; eval $setvar
20960 val=$val3; set i_termios; eval $setvar
20961
20962 : see if stddef is available
20963 set stddef.h i_stddef
20964 eval $inhdr
20965
20966 : see if sys/access.h is available
20967 set sys/access.h i_sysaccess
20968 eval $inhdr
20969
20970 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20971 set sys/filio.h i_sysfilio
20972 eval $inhdr
20973 echo " "
20974 if $test `./findhdr sys/ioctl.h`; then
20975         val="$define"
20976         echo '<sys/ioctl.h> found.' >&4
20977 else
20978         val="$undef"
20979         if $test $i_sysfilio = "$define"; then
20980             echo '<sys/ioctl.h> NOT found.' >&4
20981         else
20982                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20983                 $test $i_termio = "$define" && xxx="termio.h"
20984                 $test $i_termios = "$define" && xxx="termios.h"
20985 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20986         fi
20987 fi
20988 set i_sysioctl
20989 eval $setvar
20990
20991 : see if socket ioctl defs are in sys/sockio.h
20992 echo " "
20993 xxx=`./findhdr sys/sockio.h`
20994 if $test "$xxx"; then
20995         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20996                 val="$define"
20997                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20998         else
20999                 val="$undef"
21000                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21001         fi
21002 else
21003         val="$undef"
21004         $cat <<EOM
21005 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21006 EOM
21007 fi
21008 set i_syssockio
21009 eval $setvar
21010
21011
21012 : see if this is a syslog.h system
21013 set syslog.h i_syslog
21014 eval $inhdr
21015
21016
21017 : see if this is a sys/mode.h system
21018 set sys/mode.h i_sysmode
21019 eval $inhdr
21020
21021 : see if sys/resource.h has to be included
21022 set sys/resource.h i_sysresrc
21023 eval $inhdr
21024
21025 : see if sys/security.h is available
21026 set sys/security.h i_syssecrt
21027 eval $inhdr
21028
21029 : see if this is a sys/statvfs.h system
21030 set sys/statvfs.h i_sysstatvfs
21031 eval $inhdr
21032
21033 : see if this is a sys/un.h system
21034 set sys/un.h i_sysun
21035 eval $inhdr
21036
21037
21038 : see if this is a sys/utsname.h system
21039 set sys/utsname.h i_sysutsname
21040 eval $inhdr
21041
21042 : see if this is a syswait system
21043 set sys/wait.h i_syswait
21044 eval $inhdr
21045
21046 : see if this is a ustat.h system
21047 set ustat.h i_ustat
21048 eval $inhdr
21049
21050 : see if this is an utime system
21051 set utime.h i_utime
21052 eval $inhdr
21053
21054 : see if this is a values.h system
21055 set values.h i_values
21056 eval $inhdr
21057
21058 : see if this is a vfork system
21059 case "$d_vfork" in
21060 "$define")
21061         set vfork.h i_vfork
21062         eval $inhdr
21063         ;;
21064 *)
21065         i_vfork="$undef"
21066         ;;
21067 esac
21068
21069 echo " "
21070 echo "Looking for extensions..." >&4
21071 : If we are using the old config.sh, known_extensions may contain
21072 : old or inaccurate or duplicate values.
21073 known_extensions=''
21074 nonxs_extensions=''
21075 : We do not use find because it might not be available.
21076 : We do not just use MANIFEST because the user may have dropped
21077 : some additional extensions into the source tree and expect them
21078 : to be built.
21079
21080 : Function to recursively find available extensions, ignoring DynaLoader
21081 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21082 find_extensions='
21083     for xxx in *; do
21084         case "$xxx" in
21085             DynaLoader|dynaload) ;;
21086             *)
21087             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21088                 known_extensions="$known_extensions $1$xxx";
21089             elif $test -f $xxx/Makefile.PL; then
21090                 nonxs_extensions="$nonxs_extensions $1$xxx";
21091             else
21092                 if $test -d $xxx -a $# -lt 10; then
21093                     set $1$xxx/ $*;
21094                     cd "$xxx";
21095                     eval $find_extensions;
21096                     cd ..;
21097                     shift;
21098                 fi;
21099             fi
21100             ;;
21101         esac;
21102     done'
21103 tdir=`pwd`
21104 cd "$rsrc/ext"
21105 set X
21106 shift
21107 eval $find_extensions
21108 # Special case:  Add in threads/shared since it is not picked up by the
21109 # recursive find above (and adding in general recursive finding breaks
21110 # SDBM_File/sdbm).  A.D.  10/25/2001.
21111 known_extensions="$known_extensions threads/shared"
21112 set X $known_extensions
21113 shift
21114 known_extensions="$*"
21115 set X $nonxs_extensions
21116 shift
21117 nonxs_extensions="$*"
21118 cd "$tdir"
21119
21120 : Now see which are supported on this system.
21121 avail_ext=''
21122 for xxx in $known_extensions ; do
21123         case "$xxx" in
21124         DB_File|db_file)
21125                 case "$i_db" in
21126                 $define) avail_ext="$avail_ext $xxx" ;;
21127                 esac
21128                 ;;
21129         GDBM_File|gdbm_fil)
21130                 case "$i_gdbm" in
21131                 $define) avail_ext="$avail_ext $xxx" ;;
21132                 esac
21133                 ;;
21134         I18N/Langinfo|i18n_lan)
21135                 case "$i_langinfo$d_nl_langinfo" in
21136                 $define$define) avail_ext="$avail_ext $xxx" ;;
21137                 esac
21138                 ;;
21139         IPC/SysV|ipc/sysv)
21140                 : XXX Do we need a useipcsysv variable here
21141                 case "${d_msg}${d_sem}${d_shm}" in
21142                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21143                 esac
21144                 ;;
21145         NDBM_File|ndbm_fil)
21146                 case "$i_ndbm" in
21147                 $define)
21148                     case "$osname-$use64bitint" in
21149                     hpux-define)
21150                         case "$libs" in
21151                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21152                         esac
21153                         ;;
21154                     *) avail_ext="$avail_ext $xxx" ;;
21155                     esac
21156                     ;;
21157                 esac
21158                 ;;
21159         ODBM_File|odbm_fil)
21160                 case "${i_dbm}${i_rpcsvcdbm}" in
21161                 *"${define}"*)
21162                     case "$d_cplusplus" in
21163                     define) ;; # delete as a function name will not work
21164                     *)  case "$osname-$use64bitint" in
21165                         hpux-define)
21166                             case "$libs" in
21167                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21168                             esac
21169                             ;;
21170                         *) avail_ext="$avail_ext $xxx" ;;
21171                         esac
21172                         ;;
21173                     esac
21174                     ;;
21175                 esac
21176                 ;;
21177         Opcode|opcode)
21178                 case "$useopcode" in
21179                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21180                 esac
21181                 ;;
21182         POSIX|posix)
21183                 case "$useposix" in
21184                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21185                 esac
21186                 ;;
21187         Socket|socket)
21188                 case "$d_socket" in
21189                 true|$define|y)
21190                     case "$osname" in
21191                     beos) ;; # not unless BONE
21192                     *) avail_ext="$avail_ext $xxx" ;;
21193                     esac
21194                     ;;
21195                 esac
21196                 ;;
21197         Sys/Syslog|sys/syslog)
21198                 : XXX syslog requires socket
21199                 case "$d_socket" in
21200                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21201                 esac
21202                 ;;
21203         Thread|thread)
21204                 case "$usethreads" in
21205                 true|$define|y)
21206                         case "$use5005threads" in
21207                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21208                         esac
21209                 esac
21210                 ;;
21211         threads|threads/shared)
21212                 # threads and threads::shared are special cases.
21213                 # To stop people from asking "Perl 5.8.0 was supposed
21214                 # to have this new fancy threads implementation but my
21215                 # perl doesn't have it" and from people trying to
21216                 # (re)install the threads module using CPAN.pm and
21217                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21218                 # the threads.pm and threads/shared.pm will always be
21219                 # there, croaking informatively ("you need to rebuild
21220                 # all of Perl with threads, sorry") when threads haven't
21221                 # been compiled in.
21222                 # --jhi
21223                 avail_ext="$avail_ext $xxx"
21224                 ;;
21225         Win32*)
21226                 case "$osname" in
21227                 cygwin) avail_ext="$avail_ext $xxx" ;;
21228                 esac
21229                 ;;
21230         XS/APItest|xs/apitest)
21231                 # This is just for testing.  Skip it unless we have dynamic loading.
21232
21233                 case "$usedl" in
21234                 $define) avail_ext="$avail_ext $xxx" ;;
21235                 esac
21236                 ;;
21237         XS/Typemap|xs/typemap)
21238                 # This is just for testing.  Skip it unless we have dynamic loading.
21239                 case "$usedl" in
21240                 $define) avail_ext="$avail_ext $xxx" ;;
21241                 esac
21242                 ;;
21243         *)      avail_ext="$avail_ext $xxx"
21244                 ;;
21245         esac
21246 done
21247
21248 set X $avail_ext
21249 shift
21250 avail_ext="$*"
21251
21252 case "$onlyextensions" in
21253 '') ;;
21254 *)  keepextensions=''
21255     echo "You have requested that only certains extensions be included..." >&4
21256     for i in $onlyextensions; do
21257         case " $avail_ext " in
21258         *" $i "*)
21259             echo "Keeping extension $i."
21260             keepextensions="$keepextensions $i"
21261             ;;
21262         *) echo "Ignoring extension $i." ;;
21263         esac
21264     done
21265     avail_ext="$keepextensions"
21266     ;;
21267 esac
21268
21269 case "$noextensions" in
21270 '') ;;
21271 *)  keepextensions=''
21272     echo "You have requested that certain extensions be ignored..." >&4
21273     for i in $avail_ext; do
21274         case " $noextensions " in
21275         *" $i "*) echo "Ignoring extension $i." ;;
21276         *) echo "Keeping extension $i.";
21277            keepextensions="$keepextensions $i"
21278            ;;
21279         esac
21280     done
21281     avail_ext="$keepextensions"
21282     ;;
21283 esac
21284
21285 : Now see which nonxs extensions are supported on this system.
21286 : For now assume all are.
21287 nonxs_ext=''
21288 for xxx in $nonxs_extensions ; do
21289         case "$xxx" in
21290         *)      nonxs_ext="$nonxs_ext $xxx"
21291                 ;;
21292         esac
21293 done
21294
21295 set X $nonxs_ext
21296 shift
21297 nonxs_ext="$*"
21298
21299 case $usedl in
21300 $define)
21301         $cat <<EOM
21302 A number of extensions are supplied with $package.  You may choose to
21303 compile these extensions for dynamic loading (the default), compile
21304 them into the $package executable (static loading), or not include
21305 them at all.  Answer "none" to include no extensions.
21306 Note that DynaLoader is always built and need not be mentioned here.
21307
21308 EOM
21309         case "$dynamic_ext" in
21310         '')
21311                 : Exclude those listed in static_ext
21312                 dflt=''
21313                 for xxx in $avail_ext; do
21314                         case " $static_ext " in
21315                         *" $xxx "*) ;;
21316                         *) dflt="$dflt $xxx" ;;
21317                         esac
21318                 done
21319                 set X $dflt
21320                 shift
21321                 dflt="$*"
21322                 ;;
21323         *)      dflt="$dynamic_ext"
21324                 # Perhaps we are reusing an old out-of-date config.sh.
21325                 case "$hint" in
21326                 previous)
21327                         if test X"$dynamic_ext" != X"$avail_ext"; then
21328                                 $cat <<EOM
21329 NOTICE:  Your previous config.sh list may be incorrect.
21330 The extensions now available to you are
21331         ${avail_ext}
21332 but the default list from your previous config.sh is
21333         ${dynamic_ext}
21334
21335 EOM
21336                         fi
21337                         ;;
21338                 esac
21339                 ;;
21340         esac
21341         case "$dflt" in
21342         '')     dflt=none;;
21343         esac
21344         rp="What extensions do you wish to load dynamically?"
21345         . ./myread
21346         case "$ans" in
21347         none) dynamic_ext=' ' ;;
21348         *) dynamic_ext="$ans" ;;
21349         esac
21350
21351         case "$static_ext" in
21352         '')
21353                 : Exclude those already listed in dynamic linking
21354                 dflt=''
21355                 for xxx in $avail_ext; do
21356                         case " $dynamic_ext " in
21357                         *" $xxx "*) ;;
21358                         *) dflt="$dflt $xxx" ;;
21359                         esac
21360                 done
21361                 set X $dflt
21362                 shift
21363                 dflt="$*"
21364                 ;;
21365         *)  dflt="$static_ext"
21366                 ;;
21367         esac
21368
21369         case "$dflt" in
21370         '')     dflt=none;;
21371         esac
21372         rp="What extensions do you wish to load statically?"
21373         . ./myread
21374         case "$ans" in
21375         none) static_ext=' ' ;;
21376         *) static_ext="$ans" ;;
21377         esac
21378         ;;
21379 *)
21380         $cat <<EOM
21381 A number of extensions are supplied with $package.  Answer "none"
21382 to include no extensions.
21383 Note that DynaLoader is always built and need not be mentioned here.
21384
21385 EOM
21386         case "$static_ext" in
21387         '') dflt="$avail_ext" ;;
21388         *)      dflt="$static_ext"
21389                 # Perhaps we are reusing an old out-of-date config.sh.
21390                 case "$hint" in
21391                 previous)
21392                         if test X"$static_ext" != X"$avail_ext"; then
21393                                 $cat <<EOM
21394 NOTICE:  Your previous config.sh list may be incorrect.
21395 The extensions now available to you are
21396         ${avail_ext}
21397 but the default list from your previous config.sh is
21398         ${static_ext}
21399
21400 EOM
21401                         fi
21402                         ;;
21403                 esac
21404                 ;;
21405         esac
21406         : Exclude those that are not xs extensions
21407         case "$dflt" in
21408         '')     dflt=none;;
21409         esac
21410         rp="What extensions do you wish to include?"
21411         . ./myread
21412         case "$ans" in
21413         none) static_ext=' ' ;;
21414         *) static_ext="$ans" ;;
21415         esac
21416         ;;
21417 esac
21418 #
21419 # Encode is a special case.  If we are building Encode as a static
21420 # extension, we need to explicitly list its subextensions as well.
21421 # For other nested extensions, this is handled automatically by
21422 # the appropriate Makefile.PL.
21423 case " $static_ext " in
21424         *" Encode "*) # Add the subextensions of Encode
21425         cd "$rsrc/ext"
21426         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21427                 static_ext="$static_ext Encode/$xxx"
21428         done
21429         cd "$tdir"
21430         ;;
21431 esac
21432
21433 set X $dynamic_ext $static_ext $nonxs_ext
21434 shift
21435 extensions="$*"
21436
21437 # Sanity check:  We require an extension suitable for use with
21438 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21439 # should show up as failures in the test suite, but it's helpful to
21440 # catch them now.) The 'extensions' list is normally sorted
21441 # alphabetically, so we need to accept either
21442 #    DB_File ... Fcntl ... IO  ....
21443 # or something like
21444 #    Fcntl ... NDBM_File ... IO  ....
21445 case " $extensions"  in
21446 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21447 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21448 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21449 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21450    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21451    ;;
21452 esac
21453
21454 : Remove libraries needed only for extensions
21455 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21456 : The exception is SunOS 4.x, which needs them.
21457 case "${osname}X${osvers}" in
21458 sunos*X4*)
21459     perllibs="$libs"
21460     ;;
21461 *) case "$usedl" in
21462     $define|true|[yY]*)
21463             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21464             shift
21465             perllibs="$*"
21466             ;;
21467     *)  perllibs="$libs"
21468             ;;
21469     esac
21470     ;;
21471 esac
21472
21473 : Remove build directory name from cppstdin so it can be used from
21474 : either the present location or the final installed location.
21475 echo " "
21476 : Get out of the UU directory to get correct path name.
21477 cd ..
21478 case "$cppstdin" in
21479 `pwd`/cppstdin)
21480         echo "Stripping down cppstdin path name"
21481         cppstdin=cppstdin
21482         ;;
21483 esac
21484 cd UU
21485
21486 : end of configuration questions
21487 echo " "
21488 echo "End of configuration questions."
21489 echo " "
21490
21491 : back to where it started
21492 if test -d ../UU; then
21493         cd ..
21494 fi
21495
21496 : configuration may be patched via a 'config.arch' file
21497 if $test -f config.arch; then
21498         echo "I see a config.arch file, loading it."
21499         . ./config.arch
21500 fi
21501
21502 : configuration may be patched via a 'config.over' file
21503 if $test -f config.over; then
21504         echo " "
21505         dflt=y
21506         rp='I see a config.over file.  Do you wish to load it?'
21507         . UU/myread
21508         case "$ans" in
21509         n*) echo "OK, I'll ignore it.";;
21510         *)      . ./config.over
21511                 echo "Configuration override changes have been loaded."
21512                 ;;
21513         esac
21514 fi
21515
21516 : in case they want portability, strip down executable paths
21517 case "$d_portable" in
21518 "$define")
21519         echo " "
21520         echo "Stripping down executable paths..." >&4
21521         for file in $loclist $trylist; do
21522                 eval temp=\$$file
21523                 eval $file=`basename $temp`
21524         done
21525         ;;
21526 esac
21527
21528 : create config.sh file
21529 echo " "
21530 echo "Creating config.sh..." >&4
21531 $spitshell <<EOT >config.sh
21532 $startsh
21533 #
21534 # This file was produced by running the Configure script. It holds all the
21535 # definitions figured out by Configure. Should you modify one of these values,
21536 # do not forget to propagate your changes by running "Configure -der". You may
21537 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21538 #
21539
21540 # Package name      : $package
21541 # Source directory  : $src
21542 # Configuration time: $cf_time
21543 # Configured by     : $cf_by
21544 # Target system     : $myuname
21545
21546 Author='$Author'
21547 Date='$Date'
21548 Header='$Header'
21549 Id='$Id'
21550 Locker='$Locker'
21551 Log='$Log'
21552 Mcc='$Mcc'
21553 RCSfile='$RCSfile'
21554 Revision='$Revision'
21555 Source='$Source'
21556 State='$State'
21557 _a='$_a'
21558 _exe='$_exe'
21559 _o='$_o'
21560 afs='$afs'
21561 afsroot='$afsroot'
21562 alignbytes='$alignbytes'
21563 ansi2knr='$ansi2knr'
21564 aphostname='$aphostname'
21565 api_revision='$api_revision'
21566 api_subversion='$api_subversion'
21567 api_version='$api_version'
21568 api_versionstring='$api_versionstring'
21569 ar='$ar'
21570 archlib='$archlib'
21571 archlibexp='$archlibexp'
21572 archname64='$archname64'
21573 archname='$archname'
21574 archobjs='$archobjs'
21575 asctime_r_proto='$asctime_r_proto'
21576 awk='$awk'
21577 baserev='$baserev'
21578 bash='$bash'
21579 bin='$bin'
21580 binexp='$binexp'
21581 bison='$bison'
21582 byacc='$byacc'
21583 byteorder='$byteorder'
21584 c='$c'
21585 castflags='$castflags'
21586 cat='$cat'
21587 cc='$cc'
21588 cccdlflags='$cccdlflags'
21589 ccdlflags='$ccdlflags'
21590 ccflags='$ccflags'
21591 ccflags_uselargefiles='$ccflags_uselargefiles'
21592 ccname='$ccname'
21593 ccsymbols='$ccsymbols'
21594 ccversion='$ccversion'
21595 cf_by='$cf_by'
21596 cf_email='$cf_email'
21597 cf_time='$cf_time'
21598 charsize='$charsize'
21599 chgrp='$chgrp'
21600 chmod='$chmod'
21601 chown='$chown'
21602 clocktype='$clocktype'
21603 comm='$comm'
21604 compress='$compress'
21605 contains='$contains'
21606 cp='$cp'
21607 cpio='$cpio'
21608 cpp='$cpp'
21609 cpp_stuff='$cpp_stuff'
21610 cppccsymbols='$cppccsymbols'
21611 cppflags='$cppflags'
21612 cpplast='$cpplast'
21613 cppminus='$cppminus'
21614 cpprun='$cpprun'
21615 cppstdin='$cppstdin'
21616 cppsymbols='$cppsymbols'
21617 crypt_r_proto='$crypt_r_proto'
21618 cryptlib='$cryptlib'
21619 csh='$csh'
21620 ctermid_r_proto='$ctermid_r_proto'
21621 ctime_r_proto='$ctime_r_proto'
21622 d_Gconvert='$d_Gconvert'
21623 d_PRIEUldbl='$d_PRIEUldbl'
21624 d_PRIFUldbl='$d_PRIFUldbl'
21625 d_PRIGUldbl='$d_PRIGUldbl'
21626 d_PRIXU64='$d_PRIXU64'
21627 d_PRId64='$d_PRId64'
21628 d_PRIeldbl='$d_PRIeldbl'
21629 d_PRIfldbl='$d_PRIfldbl'
21630 d_PRIgldbl='$d_PRIgldbl'
21631 d_PRIi64='$d_PRIi64'
21632 d_PRIo64='$d_PRIo64'
21633 d_PRIu64='$d_PRIu64'
21634 d_PRIx64='$d_PRIx64'
21635 d_SCNfldbl='$d_SCNfldbl'
21636 d__fwalk='$d__fwalk'
21637 d_access='$d_access'
21638 d_accessx='$d_accessx'
21639 d_aintl='$d_aintl'
21640 d_alarm='$d_alarm'
21641 d_archlib='$d_archlib'
21642 d_asctime_r='$d_asctime_r'
21643 d_atolf='$d_atolf'
21644 d_atoll='$d_atoll'
21645 d_attribute_format='$d_attribute_format'
21646 d_attribute_malloc='$d_attribute_malloc'
21647 d_attribute_nonnull='$d_attribute_nonnull'
21648 d_attribute_noreturn='$d_attribute_noreturn'
21649 d_attribute_pure='$d_attribute_pure'
21650 d_attribute_unused='$d_attribute_unused'
21651 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21652 d_bcmp='$d_bcmp'
21653 d_bcopy='$d_bcopy'
21654 d_bsd='$d_bsd'
21655 d_bsdgetpgrp='$d_bsdgetpgrp'
21656 d_bsdsetpgrp='$d_bsdsetpgrp'
21657 d_builtin_choose_expr='$d_builtin_choose_expr'
21658 d_builtin_expect='$d_builtin_expect'
21659 d_bzero='$d_bzero'
21660 d_c99_variadic_macros='$d_c99_variadic_macros'
21661 d_casti32='$d_casti32'
21662 d_castneg='$d_castneg'
21663 d_charvspr='$d_charvspr'
21664 d_chown='$d_chown'
21665 d_chroot='$d_chroot'
21666 d_chsize='$d_chsize'
21667 d_class='$d_class'
21668 d_clearenv='$d_clearenv'
21669 d_closedir='$d_closedir'
21670 d_cmsghdr_s='$d_cmsghdr_s'
21671 d_const='$d_const'
21672 d_copysignl='$d_copysignl'
21673 d_cplusplus='$d_cplusplus'
21674 d_crypt='$d_crypt'
21675 d_crypt_r='$d_crypt_r'
21676 d_csh='$d_csh'
21677 d_ctermid='$d_ctermid'
21678 d_ctermid_r='$d_ctermid_r'
21679 d_ctime_r='$d_ctime_r'
21680 d_cuserid='$d_cuserid'
21681 d_dbl_dig='$d_dbl_dig'
21682 d_dbminitproto='$d_dbminitproto'
21683 d_difftime='$d_difftime'
21684 d_dir_dd_fd='$d_dir_dd_fd'
21685 d_dirfd='$d_dirfd'
21686 d_dirnamlen='$d_dirnamlen'
21687 d_dlerror='$d_dlerror'
21688 d_dlopen='$d_dlopen'
21689 d_dlsymun='$d_dlsymun'
21690 d_dosuid='$d_dosuid'
21691 d_drand48_r='$d_drand48_r'
21692 d_drand48proto='$d_drand48proto'
21693 d_dup2='$d_dup2'
21694 d_eaccess='$d_eaccess'
21695 d_endgrent='$d_endgrent'
21696 d_endgrent_r='$d_endgrent_r'
21697 d_endhent='$d_endhent'
21698 d_endhostent_r='$d_endhostent_r'
21699 d_endnent='$d_endnent'
21700 d_endnetent_r='$d_endnetent_r'
21701 d_endpent='$d_endpent'
21702 d_endprotoent_r='$d_endprotoent_r'
21703 d_endpwent='$d_endpwent'
21704 d_endpwent_r='$d_endpwent_r'
21705 d_endsent='$d_endsent'
21706 d_endservent_r='$d_endservent_r'
21707 d_eofnblk='$d_eofnblk'
21708 d_eunice='$d_eunice'
21709 d_faststdio='$d_faststdio'
21710 d_fchdir='$d_fchdir'
21711 d_fchmod='$d_fchmod'
21712 d_fchown='$d_fchown'
21713 d_fcntl='$d_fcntl'
21714 d_fcntl_can_lock='$d_fcntl_can_lock'
21715 d_fd_macros='$d_fd_macros'
21716 d_fd_set='$d_fd_set'
21717 d_fds_bits='$d_fds_bits'
21718 d_fgetpos='$d_fgetpos'
21719 d_finite='$d_finite'
21720 d_finitel='$d_finitel'
21721 d_flexfnam='$d_flexfnam'
21722 d_flock='$d_flock'
21723 d_flockproto='$d_flockproto'
21724 d_fork='$d_fork'
21725 d_fp_class='$d_fp_class'
21726 d_fpathconf='$d_fpathconf'
21727 d_fpclass='$d_fpclass'
21728 d_fpclassify='$d_fpclassify'
21729 d_fpclassl='$d_fpclassl'
21730 d_fpos64_t='$d_fpos64_t'
21731 d_frexpl='$d_frexpl'
21732 d_fs_data_s='$d_fs_data_s'
21733 d_fseeko='$d_fseeko'
21734 d_fsetpos='$d_fsetpos'
21735 d_fstatfs='$d_fstatfs'
21736 d_fstatvfs='$d_fstatvfs'
21737 d_fsync='$d_fsync'
21738 d_ftello='$d_ftello'
21739 d_ftime='$d_ftime'
21740 d_futimes='$d_futimes'
21741 d_getcwd='$d_getcwd'
21742 d_getespwnam='$d_getespwnam'
21743 d_getfsstat='$d_getfsstat'
21744 d_getgrent='$d_getgrent'
21745 d_getgrent_r='$d_getgrent_r'
21746 d_getgrgid_r='$d_getgrgid_r'
21747 d_getgrnam_r='$d_getgrnam_r'
21748 d_getgrps='$d_getgrps'
21749 d_gethbyaddr='$d_gethbyaddr'
21750 d_gethbyname='$d_gethbyname'
21751 d_gethent='$d_gethent'
21752 d_gethname='$d_gethname'
21753 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21754 d_gethostbyname_r='$d_gethostbyname_r'
21755 d_gethostent_r='$d_gethostent_r'
21756 d_gethostprotos='$d_gethostprotos'
21757 d_getitimer='$d_getitimer'
21758 d_getlogin='$d_getlogin'
21759 d_getlogin_r='$d_getlogin_r'
21760 d_getmnt='$d_getmnt'
21761 d_getmntent='$d_getmntent'
21762 d_getnbyaddr='$d_getnbyaddr'
21763 d_getnbyname='$d_getnbyname'
21764 d_getnent='$d_getnent'
21765 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21766 d_getnetbyname_r='$d_getnetbyname_r'
21767 d_getnetent_r='$d_getnetent_r'
21768 d_getnetprotos='$d_getnetprotos'
21769 d_getpagsz='$d_getpagsz'
21770 d_getpbyname='$d_getpbyname'
21771 d_getpbynumber='$d_getpbynumber'
21772 d_getpent='$d_getpent'
21773 d_getpgid='$d_getpgid'
21774 d_getpgrp2='$d_getpgrp2'
21775 d_getpgrp='$d_getpgrp'
21776 d_getppid='$d_getppid'
21777 d_getprior='$d_getprior'
21778 d_getprotobyname_r='$d_getprotobyname_r'
21779 d_getprotobynumber_r='$d_getprotobynumber_r'
21780 d_getprotoent_r='$d_getprotoent_r'
21781 d_getprotoprotos='$d_getprotoprotos'
21782 d_getprpwnam='$d_getprpwnam'
21783 d_getpwent='$d_getpwent'
21784 d_getpwent_r='$d_getpwent_r'
21785 d_getpwnam_r='$d_getpwnam_r'
21786 d_getpwuid_r='$d_getpwuid_r'
21787 d_getsbyname='$d_getsbyname'
21788 d_getsbyport='$d_getsbyport'
21789 d_getsent='$d_getsent'
21790 d_getservbyname_r='$d_getservbyname_r'
21791 d_getservbyport_r='$d_getservbyport_r'
21792 d_getservent_r='$d_getservent_r'
21793 d_getservprotos='$d_getservprotos'
21794 d_getspnam='$d_getspnam'
21795 d_getspnam_r='$d_getspnam_r'
21796 d_gettimeod='$d_gettimeod'
21797 d_gmtime_r='$d_gmtime_r'
21798 d_gnulibc='$d_gnulibc'
21799 d_grpasswd='$d_grpasswd'
21800 d_hasmntopt='$d_hasmntopt'
21801 d_htonl='$d_htonl'
21802 d_ilogbl='$d_ilogbl'
21803 d_inc_version_list='$d_inc_version_list'
21804 d_index='$d_index'
21805 d_inetaton='$d_inetaton'
21806 d_int64_t='$d_int64_t'
21807 d_isascii='$d_isascii'
21808 d_isfinite='$d_isfinite'
21809 d_isinf='$d_isinf'
21810 d_isnan='$d_isnan'
21811 d_isnanl='$d_isnanl'
21812 d_killpg='$d_killpg'
21813 d_lchown='$d_lchown'
21814 d_ldbl_dig='$d_ldbl_dig'
21815 d_libm_lib_version='$d_libm_lib_version'
21816 d_link='$d_link'
21817 d_localtime_r='$d_localtime_r'
21818 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21819 d_locconv='$d_locconv'
21820 d_lockf='$d_lockf'
21821 d_longdbl='$d_longdbl'
21822 d_longlong='$d_longlong'
21823 d_lseekproto='$d_lseekproto'
21824 d_lstat='$d_lstat'
21825 d_madvise='$d_madvise'
21826 d_malloc_good_size='$d_malloc_good_size'
21827 d_malloc_size='$d_malloc_size'
21828 d_mblen='$d_mblen'
21829 d_mbstowcs='$d_mbstowcs'
21830 d_mbtowc='$d_mbtowc'
21831 d_memchr='$d_memchr'
21832 d_memcmp='$d_memcmp'
21833 d_memcpy='$d_memcpy'
21834 d_memmove='$d_memmove'
21835 d_memset='$d_memset'
21836 d_mkdir='$d_mkdir'
21837 d_mkdtemp='$d_mkdtemp'
21838 d_mkfifo='$d_mkfifo'
21839 d_mkstemp='$d_mkstemp'
21840 d_mkstemps='$d_mkstemps'
21841 d_mktime='$d_mktime'
21842 d_mmap='$d_mmap'
21843 d_modfl='$d_modfl'
21844 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21845 d_modflproto='$d_modflproto'
21846 d_mprotect='$d_mprotect'
21847 d_msg='$d_msg'
21848 d_msg_ctrunc='$d_msg_ctrunc'
21849 d_msg_dontroute='$d_msg_dontroute'
21850 d_msg_oob='$d_msg_oob'
21851 d_msg_peek='$d_msg_peek'
21852 d_msg_proxy='$d_msg_proxy'
21853 d_msgctl='$d_msgctl'
21854 d_msgget='$d_msgget'
21855 d_msghdr_s='$d_msghdr_s'
21856 d_msgrcv='$d_msgrcv'
21857 d_msgsnd='$d_msgsnd'
21858 d_msync='$d_msync'
21859 d_munmap='$d_munmap'
21860 d_mymalloc='$d_mymalloc'
21861 d_nice='$d_nice'
21862 d_nl_langinfo='$d_nl_langinfo'
21863 d_nv_preserves_uv='$d_nv_preserves_uv'
21864 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21865 d_off64_t='$d_off64_t'
21866 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21867 d_oldpthreads='$d_oldpthreads'
21868 d_oldsock='$d_oldsock'
21869 d_open3='$d_open3'
21870 d_pathconf='$d_pathconf'
21871 d_pause='$d_pause'
21872 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21873 d_phostname='$d_phostname'
21874 d_pipe='$d_pipe'
21875 d_poll='$d_poll'
21876 d_portable='$d_portable'
21877 d_printf_format_null='$d_printf_format_null'
21878 d_procselfexe='$d_procselfexe'
21879 d_pseudofork='$d_pseudofork'
21880 d_pthread_atfork='$d_pthread_atfork'
21881 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21882 d_pthread_yield='$d_pthread_yield'
21883 d_pwage='$d_pwage'
21884 d_pwchange='$d_pwchange'
21885 d_pwclass='$d_pwclass'
21886 d_pwcomment='$d_pwcomment'
21887 d_pwexpire='$d_pwexpire'
21888 d_pwgecos='$d_pwgecos'
21889 d_pwpasswd='$d_pwpasswd'
21890 d_pwquota='$d_pwquota'
21891 d_qgcvt='$d_qgcvt'
21892 d_quad='$d_quad'
21893 d_random_r='$d_random_r'
21894 d_readdir64_r='$d_readdir64_r'
21895 d_readdir='$d_readdir'
21896 d_readdir_r='$d_readdir_r'
21897 d_readlink='$d_readlink'
21898 d_readv='$d_readv'
21899 d_recvmsg='$d_recvmsg'
21900 d_rename='$d_rename'
21901 d_rewinddir='$d_rewinddir'
21902 d_rmdir='$d_rmdir'
21903 d_safebcpy='$d_safebcpy'
21904 d_safemcpy='$d_safemcpy'
21905 d_sanemcmp='$d_sanemcmp'
21906 d_sbrkproto='$d_sbrkproto'
21907 d_scalbnl='$d_scalbnl'
21908 d_sched_yield='$d_sched_yield'
21909 d_scm_rights='$d_scm_rights'
21910 d_seekdir='$d_seekdir'
21911 d_select='$d_select'
21912 d_sem='$d_sem'
21913 d_semctl='$d_semctl'
21914 d_semctl_semid_ds='$d_semctl_semid_ds'
21915 d_semctl_semun='$d_semctl_semun'
21916 d_semget='$d_semget'
21917 d_semop='$d_semop'
21918 d_sendmsg='$d_sendmsg'
21919 d_setegid='$d_setegid'
21920 d_seteuid='$d_seteuid'
21921 d_setgrent='$d_setgrent'
21922 d_setgrent_r='$d_setgrent_r'
21923 d_setgrps='$d_setgrps'
21924 d_sethent='$d_sethent'
21925 d_sethostent_r='$d_sethostent_r'
21926 d_setitimer='$d_setitimer'
21927 d_setlinebuf='$d_setlinebuf'
21928 d_setlocale='$d_setlocale'
21929 d_setlocale_r='$d_setlocale_r'
21930 d_setnent='$d_setnent'
21931 d_setnetent_r='$d_setnetent_r'
21932 d_setpent='$d_setpent'
21933 d_setpgid='$d_setpgid'
21934 d_setpgrp2='$d_setpgrp2'
21935 d_setpgrp='$d_setpgrp'
21936 d_setprior='$d_setprior'
21937 d_setproctitle='$d_setproctitle'
21938 d_setprotoent_r='$d_setprotoent_r'
21939 d_setpwent='$d_setpwent'
21940 d_setpwent_r='$d_setpwent_r'
21941 d_setregid='$d_setregid'
21942 d_setresgid='$d_setresgid'
21943 d_setresuid='$d_setresuid'
21944 d_setreuid='$d_setreuid'
21945 d_setrgid='$d_setrgid'
21946 d_setruid='$d_setruid'
21947 d_setsent='$d_setsent'
21948 d_setservent_r='$d_setservent_r'
21949 d_setsid='$d_setsid'
21950 d_setvbuf='$d_setvbuf'
21951 d_sfio='$d_sfio'
21952 d_shm='$d_shm'
21953 d_shmat='$d_shmat'
21954 d_shmatprototype='$d_shmatprototype'
21955 d_shmctl='$d_shmctl'
21956 d_shmdt='$d_shmdt'
21957 d_shmget='$d_shmget'
21958 d_sigaction='$d_sigaction'
21959 d_signbit='$d_signbit'
21960 d_sigprocmask='$d_sigprocmask'
21961 d_sigsetjmp='$d_sigsetjmp'
21962 d_sitearch='$d_sitearch'
21963 d_snprintf='$d_snprintf'
21964 d_sockatmark='$d_sockatmark'
21965 d_sockatmarkproto='$d_sockatmarkproto'
21966 d_socket='$d_socket'
21967 d_socklen_t='$d_socklen_t'
21968 d_sockpair='$d_sockpair'
21969 d_socks5_init='$d_socks5_init'
21970 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21971 d_sqrtl='$d_sqrtl'
21972 d_srand48_r='$d_srand48_r'
21973 d_srandom_r='$d_srandom_r'
21974 d_sresgproto='$d_sresgproto'
21975 d_sresuproto='$d_sresuproto'
21976 d_statblks='$d_statblks'
21977 d_statfs_f_flags='$d_statfs_f_flags'
21978 d_statfs_s='$d_statfs_s'
21979 d_statvfs='$d_statvfs'
21980 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21981 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21982 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21983 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21984 d_stdio_stream_array='$d_stdio_stream_array'
21985 d_stdiobase='$d_stdiobase'
21986 d_stdstdio='$d_stdstdio'
21987 d_strchr='$d_strchr'
21988 d_strcoll='$d_strcoll'
21989 d_strctcpy='$d_strctcpy'
21990 d_strerrm='$d_strerrm'
21991 d_strerror='$d_strerror'
21992 d_strerror_r='$d_strerror_r'
21993 d_strftime='$d_strftime'
21994 d_strlcat='$d_strlcat'
21995 d_strlcpy='$d_strlcpy'
21996 d_strtod='$d_strtod'
21997 d_strtol='$d_strtol'
21998 d_strtold='$d_strtold'
21999 d_strtoll='$d_strtoll'
22000 d_strtoq='$d_strtoq'
22001 d_strtoul='$d_strtoul'
22002 d_strtoull='$d_strtoull'
22003 d_strtouq='$d_strtouq'
22004 d_strxfrm='$d_strxfrm'
22005 d_suidsafe='$d_suidsafe'
22006 d_symlink='$d_symlink'
22007 d_syscall='$d_syscall'
22008 d_syscallproto='$d_syscallproto'
22009 d_sysconf='$d_sysconf'
22010 d_sysernlst='$d_sysernlst'
22011 d_syserrlst='$d_syserrlst'
22012 d_system='$d_system'
22013 d_tcgetpgrp='$d_tcgetpgrp'
22014 d_tcsetpgrp='$d_tcsetpgrp'
22015 d_telldir='$d_telldir'
22016 d_telldirproto='$d_telldirproto'
22017 d_time='$d_time'
22018 d_times='$d_times'
22019 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22020 d_tm_tm_zone='$d_tm_tm_zone'
22021 d_tmpnam_r='$d_tmpnam_r'
22022 d_truncate='$d_truncate'
22023 d_ttyname_r='$d_ttyname_r'
22024 d_tzname='$d_tzname'
22025 d_u32align='$d_u32align'
22026 d_ualarm='$d_ualarm'
22027 d_umask='$d_umask'
22028 d_uname='$d_uname'
22029 d_union_semun='$d_union_semun'
22030 d_unordered='$d_unordered'
22031 d_unsetenv='$d_unsetenv'
22032 d_usleep='$d_usleep'
22033 d_usleepproto='$d_usleepproto'
22034 d_ustat='$d_ustat'
22035 d_vendorarch='$d_vendorarch'
22036 d_vendorbin='$d_vendorbin'
22037 d_vendorlib='$d_vendorlib'
22038 d_vendorscript='$d_vendorscript'
22039 d_vfork='$d_vfork'
22040 d_void_closedir='$d_void_closedir'
22041 d_voidsig='$d_voidsig'
22042 d_voidtty='$d_voidtty'
22043 d_volatile='$d_volatile'
22044 d_vprintf='$d_vprintf'
22045 d_vsnprintf='$d_vsnprintf'
22046 d_wait4='$d_wait4'
22047 d_waitpid='$d_waitpid'
22048 d_wcstombs='$d_wcstombs'
22049 d_wctomb='$d_wctomb'
22050 d_writev='$d_writev'
22051 d_xenix='$d_xenix'
22052 date='$date'
22053 db_hashtype='$db_hashtype'
22054 db_prefixtype='$db_prefixtype'
22055 db_version_major='$db_version_major'
22056 db_version_minor='$db_version_minor'
22057 db_version_patch='$db_version_patch'
22058 defvoidused='$defvoidused'
22059 direntrytype='$direntrytype'
22060 dlext='$dlext'
22061 dlsrc='$dlsrc'
22062 doublesize='$doublesize'
22063 drand01='$drand01'
22064 drand48_r_proto='$drand48_r_proto'
22065 dynamic_ext='$dynamic_ext'
22066 eagain='$eagain'
22067 ebcdic='$ebcdic'
22068 echo='$echo'
22069 egrep='$egrep'
22070 emacs='$emacs'
22071 endgrent_r_proto='$endgrent_r_proto'
22072 endhostent_r_proto='$endhostent_r_proto'
22073 endnetent_r_proto='$endnetent_r_proto'
22074 endprotoent_r_proto='$endprotoent_r_proto'
22075 endpwent_r_proto='$endpwent_r_proto'
22076 endservent_r_proto='$endservent_r_proto'
22077 eunicefix='$eunicefix'
22078 exe_ext='$exe_ext'
22079 expr='$expr'
22080 extensions='$extensions'
22081 extras='$extras'
22082 fflushNULL='$fflushNULL'
22083 fflushall='$fflushall'
22084 find='$find'
22085 firstmakefile='$firstmakefile'
22086 flex='$flex'
22087 fpossize='$fpossize'
22088 fpostype='$fpostype'
22089 freetype='$freetype'
22090 from='$from'
22091 full_ar='$full_ar'
22092 full_csh='$full_csh'
22093 full_sed='$full_sed'
22094 gccansipedantic='$gccansipedantic'
22095 gccosandvers='$gccosandvers'
22096 gccversion='$gccversion'
22097 getgrent_r_proto='$getgrent_r_proto'
22098 getgrgid_r_proto='$getgrgid_r_proto'
22099 getgrnam_r_proto='$getgrnam_r_proto'
22100 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22101 gethostbyname_r_proto='$gethostbyname_r_proto'
22102 gethostent_r_proto='$gethostent_r_proto'
22103 getlogin_r_proto='$getlogin_r_proto'
22104 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22105 getnetbyname_r_proto='$getnetbyname_r_proto'
22106 getnetent_r_proto='$getnetent_r_proto'
22107 getprotobyname_r_proto='$getprotobyname_r_proto'
22108 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22109 getprotoent_r_proto='$getprotoent_r_proto'
22110 getpwent_r_proto='$getpwent_r_proto'
22111 getpwnam_r_proto='$getpwnam_r_proto'
22112 getpwuid_r_proto='$getpwuid_r_proto'
22113 getservbyname_r_proto='$getservbyname_r_proto'
22114 getservbyport_r_proto='$getservbyport_r_proto'
22115 getservent_r_proto='$getservent_r_proto'
22116 getspnam_r_proto='$getspnam_r_proto'
22117 gidformat='$gidformat'
22118 gidsign='$gidsign'
22119 gidsize='$gidsize'
22120 gidtype='$gidtype'
22121 glibpth='$glibpth'
22122 gmake='$gmake'
22123 gmtime_r_proto='$gmtime_r_proto'
22124 gnulibc_version='$gnulibc_version'
22125 grep='$grep'
22126 groupcat='$groupcat'
22127 groupstype='$groupstype'
22128 gzip='$gzip'
22129 h_fcntl='$h_fcntl'
22130 h_sysfile='$h_sysfile'
22131 hint='$hint'
22132 hostcat='$hostcat'
22133 html1dir='$html1dir'
22134 html1direxp='$html1direxp'
22135 html3dir='$html3dir'
22136 html3direxp='$html3direxp'
22137 i16size='$i16size'
22138 i16type='$i16type'
22139 i32size='$i32size'
22140 i32type='$i32type'
22141 i64size='$i64size'
22142 i64type='$i64type'
22143 i8size='$i8size'
22144 i8type='$i8type'
22145 i_arpainet='$i_arpainet'
22146 i_bsdioctl='$i_bsdioctl'
22147 i_crypt='$i_crypt'
22148 i_db='$i_db'
22149 i_dbm='$i_dbm'
22150 i_dirent='$i_dirent'
22151 i_dld='$i_dld'
22152 i_dlfcn='$i_dlfcn'
22153 i_fcntl='$i_fcntl'
22154 i_float='$i_float'
22155 i_fp='$i_fp'
22156 i_fp_class='$i_fp_class'
22157 i_gdbm='$i_gdbm'
22158 i_grp='$i_grp'
22159 i_ieeefp='$i_ieeefp'
22160 i_inttypes='$i_inttypes'
22161 i_langinfo='$i_langinfo'
22162 i_libutil='$i_libutil'
22163 i_limits='$i_limits'
22164 i_locale='$i_locale'
22165 i_machcthr='$i_machcthr'
22166 i_malloc='$i_malloc'
22167 i_math='$i_math'
22168 i_memory='$i_memory'
22169 i_mntent='$i_mntent'
22170 i_ndbm='$i_ndbm'
22171 i_netdb='$i_netdb'
22172 i_neterrno='$i_neterrno'
22173 i_netinettcp='$i_netinettcp'
22174 i_niin='$i_niin'
22175 i_poll='$i_poll'
22176 i_prot='$i_prot'
22177 i_pthread='$i_pthread'
22178 i_pwd='$i_pwd'
22179 i_rpcsvcdbm='$i_rpcsvcdbm'
22180 i_sfio='$i_sfio'
22181 i_sgtty='$i_sgtty'
22182 i_shadow='$i_shadow'
22183 i_socks='$i_socks'
22184 i_stdarg='$i_stdarg'
22185 i_stddef='$i_stddef'
22186 i_stdlib='$i_stdlib'
22187 i_string='$i_string'
22188 i_sunmath='$i_sunmath'
22189 i_sysaccess='$i_sysaccess'
22190 i_sysdir='$i_sysdir'
22191 i_sysfile='$i_sysfile'
22192 i_sysfilio='$i_sysfilio'
22193 i_sysin='$i_sysin'
22194 i_sysioctl='$i_sysioctl'
22195 i_syslog='$i_syslog'
22196 i_sysmman='$i_sysmman'
22197 i_sysmode='$i_sysmode'
22198 i_sysmount='$i_sysmount'
22199 i_sysndir='$i_sysndir'
22200 i_sysparam='$i_sysparam'
22201 i_sysresrc='$i_sysresrc'
22202 i_syssecrt='$i_syssecrt'
22203 i_sysselct='$i_sysselct'
22204 i_syssockio='$i_syssockio'
22205 i_sysstat='$i_sysstat'
22206 i_sysstatfs='$i_sysstatfs'
22207 i_sysstatvfs='$i_sysstatvfs'
22208 i_systime='$i_systime'
22209 i_systimek='$i_systimek'
22210 i_systimes='$i_systimes'
22211 i_systypes='$i_systypes'
22212 i_sysuio='$i_sysuio'
22213 i_sysun='$i_sysun'
22214 i_sysutsname='$i_sysutsname'
22215 i_sysvfs='$i_sysvfs'
22216 i_syswait='$i_syswait'
22217 i_termio='$i_termio'
22218 i_termios='$i_termios'
22219 i_time='$i_time'
22220 i_unistd='$i_unistd'
22221 i_ustat='$i_ustat'
22222 i_utime='$i_utime'
22223 i_values='$i_values'
22224 i_varargs='$i_varargs'
22225 i_varhdr='$i_varhdr'
22226 i_vfork='$i_vfork'
22227 ignore_versioned_solibs='$ignore_versioned_solibs'
22228 inc_version_list='$inc_version_list'
22229 inc_version_list_init='$inc_version_list_init'
22230 incpath='$incpath'
22231 inews='$inews'
22232 initialinstalllocation='$initialinstalllocation'
22233 installarchlib='$installarchlib'
22234 installbin='$installbin'
22235 installhtml1dir='$installhtml1dir'
22236 installhtml3dir='$installhtml3dir'
22237 installman1dir='$installman1dir'
22238 installman3dir='$installman3dir'
22239 installprefix='$installprefix'
22240 installprefixexp='$installprefixexp'
22241 installprivlib='$installprivlib'
22242 installscript='$installscript'
22243 installsitearch='$installsitearch'
22244 installsitebin='$installsitebin'
22245 installsitehtml1dir='$installsitehtml1dir'
22246 installsitehtml3dir='$installsitehtml3dir'
22247 installsitelib='$installsitelib'
22248 installsiteman1dir='$installsiteman1dir'
22249 installsiteman3dir='$installsiteman3dir'
22250 installsitescript='$installsitescript'
22251 installstyle='$installstyle'
22252 installusrbinperl='$installusrbinperl'
22253 installvendorarch='$installvendorarch'
22254 installvendorbin='$installvendorbin'
22255 installvendorhtml1dir='$installvendorhtml1dir'
22256 installvendorhtml3dir='$installvendorhtml3dir'
22257 installvendorlib='$installvendorlib'
22258 installvendorman1dir='$installvendorman1dir'
22259 installvendorman3dir='$installvendorman3dir'
22260 installvendorscript='$installvendorscript'
22261 intsize='$intsize'
22262 issymlink='$issymlink'
22263 ivdformat='$ivdformat'
22264 ivsize='$ivsize'
22265 ivtype='$ivtype'
22266 known_extensions='$known_extensions'
22267 ksh='$ksh'
22268 ld='$ld'
22269 lddlflags='$lddlflags'
22270 ldflags='$ldflags'
22271 ldflags_uselargefiles='$ldflags_uselargefiles'
22272 ldlibpthname='$ldlibpthname'
22273 less='$less'
22274 lib_ext='$lib_ext'
22275 libc='$libc'
22276 libperl='$libperl'
22277 libpth='$libpth'
22278 libs='$libs'
22279 libsdirs='$libsdirs'
22280 libsfiles='$libsfiles'
22281 libsfound='$libsfound'
22282 libspath='$libspath'
22283 libswanted='$libswanted'
22284 libswanted_uselargefiles='$libswanted_uselargefiles'
22285 line='$line'
22286 lint='$lint'
22287 lkflags='$lkflags'
22288 ln='$ln'
22289 lns='$lns'
22290 localtime_r_proto='$localtime_r_proto'
22291 locincpth='$locincpth'
22292 loclibpth='$loclibpth'
22293 longdblsize='$longdblsize'
22294 longlongsize='$longlongsize'
22295 longsize='$longsize'
22296 lp='$lp'
22297 lpr='$lpr'
22298 ls='$ls'
22299 lseeksize='$lseeksize'
22300 lseektype='$lseektype'
22301 mad='$mad'
22302 madlyh='$madlyh'
22303 madlyobj='$madlyobj'
22304 madlysrc='$madlysrc'
22305 mail='$mail'
22306 mailx='$mailx'
22307 make='$make'
22308 make_set_make='$make_set_make'
22309 mallocobj='$mallocobj'
22310 mallocsrc='$mallocsrc'
22311 malloctype='$malloctype'
22312 man1dir='$man1dir'
22313 man1direxp='$man1direxp'
22314 man1ext='$man1ext'
22315 man3dir='$man3dir'
22316 man3direxp='$man3direxp'
22317 man3ext='$man3ext'
22318 mips_type='$mips_type'
22319 mistrustnm='$mistrustnm'
22320 mkdir='$mkdir'
22321 mmaptype='$mmaptype'
22322 modetype='$modetype'
22323 more='$more'
22324 multiarch='$multiarch'
22325 mv='$mv'
22326 myarchname='$myarchname'
22327 mydomain='$mydomain'
22328 myhostname='$myhostname'
22329 myuname='$myuname'
22330 n='$n'
22331 need_va_copy='$need_va_copy'
22332 netdb_hlen_type='$netdb_hlen_type'
22333 netdb_host_type='$netdb_host_type'
22334 netdb_name_type='$netdb_name_type'
22335 netdb_net_type='$netdb_net_type'
22336 nm='$nm'
22337 nm_opt='$nm_opt'
22338 nm_so_opt='$nm_so_opt'
22339 nonxs_ext='$nonxs_ext'
22340 nroff='$nroff'
22341 nvEUformat='$nvEUformat'
22342 nvFUformat='$nvFUformat'
22343 nvGUformat='$nvGUformat'
22344 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22345 nveformat='$nveformat'
22346 nvfformat='$nvfformat'
22347 nvgformat='$nvgformat'
22348 nvsize='$nvsize'
22349 nvtype='$nvtype'
22350 o_nonblock='$o_nonblock'
22351 obj_ext='$obj_ext'
22352 old_pthread_create_joinable='$old_pthread_create_joinable'
22353 optimize='$optimize'
22354 orderlib='$orderlib'
22355 osname='$osname'
22356 osvers='$osvers'
22357 otherlibdirs='$otherlibdirs'
22358 package='$package'
22359 pager='$pager'
22360 passcat='$passcat'
22361 patchlevel='$patchlevel'
22362 path_sep='$path_sep'
22363 perl5='$perl5'
22364 perl='$perl'
22365 perl_patchlevel='$perl_patchlevel'
22366 perladmin='$perladmin'
22367 perllibs='$perllibs'
22368 perlpath='$perlpath'
22369 pg='$pg'
22370 phostname='$phostname'
22371 pidtype='$pidtype'
22372 plibpth='$plibpth'
22373 pmake='$pmake'
22374 pr='$pr'
22375 prefix='$prefix'
22376 prefixexp='$prefixexp'
22377 privlib='$privlib'
22378 privlibexp='$privlibexp'
22379 procselfexe='$procselfexe'
22380 prototype='$prototype'
22381 ptrsize='$ptrsize'
22382 quadkind='$quadkind'
22383 quadtype='$quadtype'
22384 randbits='$randbits'
22385 randfunc='$randfunc'
22386 random_r_proto='$random_r_proto'
22387 randseedtype='$randseedtype'
22388 ranlib='$ranlib'
22389 rd_nodata='$rd_nodata'
22390 readdir64_r_proto='$readdir64_r_proto'
22391 readdir_r_proto='$readdir_r_proto'
22392 revision='$revision'
22393 rm='$rm'
22394 rm_try='$rm_try'
22395 rmail='$rmail'
22396 run='$run'
22397 runnm='$runnm'
22398 sPRIEUldbl='$sPRIEUldbl'
22399 sPRIFUldbl='$sPRIFUldbl'
22400 sPRIGUldbl='$sPRIGUldbl'
22401 sPRIXU64='$sPRIXU64'
22402 sPRId64='$sPRId64'
22403 sPRIeldbl='$sPRIeldbl'
22404 sPRIfldbl='$sPRIfldbl'
22405 sPRIgldbl='$sPRIgldbl'
22406 sPRIi64='$sPRIi64'
22407 sPRIo64='$sPRIo64'
22408 sPRIu64='$sPRIu64'
22409 sPRIx64='$sPRIx64'
22410 sSCNfldbl='$sSCNfldbl'
22411 sched_yield='$sched_yield'
22412 scriptdir='$scriptdir'
22413 scriptdirexp='$scriptdirexp'
22414 sed='$sed'
22415 seedfunc='$seedfunc'
22416 selectminbits='$selectminbits'
22417 selecttype='$selecttype'
22418 sendmail='$sendmail'
22419 setgrent_r_proto='$setgrent_r_proto'
22420 sethostent_r_proto='$sethostent_r_proto'
22421 setlocale_r_proto='$setlocale_r_proto'
22422 setnetent_r_proto='$setnetent_r_proto'
22423 setprotoent_r_proto='$setprotoent_r_proto'
22424 setpwent_r_proto='$setpwent_r_proto'
22425 setservent_r_proto='$setservent_r_proto'
22426 sh='$sh'
22427 shar='$shar'
22428 sharpbang='$sharpbang'
22429 shmattype='$shmattype'
22430 shortsize='$shortsize'
22431 shrpenv='$shrpenv'
22432 shsharp='$shsharp'
22433 sig_count='$sig_count'
22434 sig_name='$sig_name'
22435 sig_name_init='$sig_name_init'
22436 sig_num='$sig_num'
22437 sig_num_init='$sig_num_init'
22438 sig_size='$sig_size'
22439 signal_t='$signal_t'
22440 sitearch='$sitearch'
22441 sitearchexp='$sitearchexp'
22442 sitebin='$sitebin'
22443 sitebinexp='$sitebinexp'
22444 sitehtml1dir='$sitehtml1dir'
22445 sitehtml1direxp='$sitehtml1direxp'
22446 sitehtml3dir='$sitehtml3dir'
22447 sitehtml3direxp='$sitehtml3direxp'
22448 sitelib='$sitelib'
22449 sitelib_stem='$sitelib_stem'
22450 sitelibexp='$sitelibexp'
22451 siteman1dir='$siteman1dir'
22452 siteman1direxp='$siteman1direxp'
22453 siteman3dir='$siteman3dir'
22454 siteman3direxp='$siteman3direxp'
22455 siteprefix='$siteprefix'
22456 siteprefixexp='$siteprefixexp'
22457 sitescript='$sitescript'
22458 sitescriptexp='$sitescriptexp'
22459 sizesize='$sizesize'
22460 sizetype='$sizetype'
22461 sleep='$sleep'
22462 smail='$smail'
22463 so='$so'
22464 sockethdr='$sockethdr'
22465 socketlib='$socketlib'
22466 socksizetype='$socksizetype'
22467 sort='$sort'
22468 spackage='$spackage'
22469 spitshell='$spitshell'
22470 srand48_r_proto='$srand48_r_proto'
22471 srandom_r_proto='$srandom_r_proto'
22472 src='$src'
22473 ssizetype='$ssizetype'
22474 startperl='$startperl'
22475 startsh='$startsh'
22476 static_ext='$static_ext'
22477 stdchar='$stdchar'
22478 stdio_base='$stdio_base'
22479 stdio_bufsiz='$stdio_bufsiz'
22480 stdio_cnt='$stdio_cnt'
22481 stdio_filbuf='$stdio_filbuf'
22482 stdio_ptr='$stdio_ptr'
22483 stdio_stream_array='$stdio_stream_array'
22484 strerror_r_proto='$strerror_r_proto'
22485 strings='$strings'
22486 submit='$submit'
22487 subversion='$subversion'
22488 sysman='$sysman'
22489 tail='$tail'
22490 tar='$tar'
22491 targetarch='$targetarch'
22492 tbl='$tbl'
22493 tee='$tee'
22494 test='$test'
22495 timeincl='$timeincl'
22496 timetype='$timetype'
22497 tmpnam_r_proto='$tmpnam_r_proto'
22498 to='$to'
22499 touch='$touch'
22500 tr='$tr'
22501 trnl='$trnl'
22502 troff='$troff'
22503 ttyname_r_proto='$ttyname_r_proto'
22504 u16size='$u16size'
22505 u16type='$u16type'
22506 u32size='$u32size'
22507 u32type='$u32type'
22508 u64size='$u64size'
22509 u64type='$u64type'
22510 u8size='$u8size'
22511 u8type='$u8type'
22512 uidformat='$uidformat'
22513 uidsign='$uidsign'
22514 uidsize='$uidsize'
22515 uidtype='$uidtype'
22516 uname='$uname'
22517 uniq='$uniq'
22518 uquadtype='$uquadtype'
22519 use5005threads='$use5005threads'
22520 use64bitall='$use64bitall'
22521 use64bitint='$use64bitint'
22522 usecrosscompile='$usecrosscompile'
22523 usedl='$usedl'
22524 usefaststdio='$usefaststdio'
22525 useithreads='$useithreads'
22526 uselargefiles='$uselargefiles'
22527 uselongdouble='$uselongdouble'
22528 usemallocwrap='$usemallocwrap'
22529 usemorebits='$usemorebits'
22530 usemultiplicity='$usemultiplicity'
22531 usemymalloc='$usemymalloc'
22532 usenm='$usenm'
22533 useopcode='$useopcode'
22534 useperlio='$useperlio'
22535 useposix='$useposix'
22536 usereentrant='$usereentrant'
22537 userelocatableinc='$userelocatableinc'
22538 usesfio='$usesfio'
22539 useshrplib='$useshrplib'
22540 usesitecustomize='$usesitecustomize'
22541 usesocks='$usesocks'
22542 usethreads='$usethreads'
22543 usevendorprefix='$usevendorprefix'
22544 usevfork='$usevfork'
22545 usrinc='$usrinc'
22546 uuname='$uuname'
22547 uvXUformat='$uvXUformat'
22548 uvoformat='$uvoformat'
22549 uvsize='$uvsize'
22550 uvtype='$uvtype'
22551 uvuformat='$uvuformat'
22552 uvxformat='$uvxformat'
22553 vendorarch='$vendorarch'
22554 vendorarchexp='$vendorarchexp'
22555 vendorbin='$vendorbin'
22556 vendorbinexp='$vendorbinexp'
22557 vendorhtml1dir='$vendorhtml1dir'
22558 vendorhtml1direxp='$vendorhtml1direxp'
22559 vendorhtml3dir='$vendorhtml3dir'
22560 vendorhtml3direxp='$vendorhtml3direxp'
22561 vendorlib='$vendorlib'
22562 vendorlib_stem='$vendorlib_stem'
22563 vendorlibexp='$vendorlibexp'
22564 vendorman1dir='$vendorman1dir'
22565 vendorman1direxp='$vendorman1direxp'
22566 vendorman3dir='$vendorman3dir'
22567 vendorman3direxp='$vendorman3direxp'
22568 vendorprefix='$vendorprefix'
22569 vendorprefixexp='$vendorprefixexp'
22570 vendorscript='$vendorscript'
22571 vendorscriptexp='$vendorscriptexp'
22572 version='$version'
22573 version_patchlevel_string='$version_patchlevel_string'
22574 versiononly='$versiononly'
22575 vi='$vi'
22576 voidflags='$voidflags'
22577 xlibpth='$xlibpth'
22578 yacc='$yacc'
22579 yaccflags='$yaccflags'
22580 zcat='$zcat'
22581 zip='$zip'
22582 EOT
22583
22584 : Add in command line options if available
22585 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22586
22587 : add special variables
22588 $test -f $src/patchlevel.h && \
22589 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22590 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22591 echo "PERL_CONFIG_SH=true" >>config.sh
22592
22593 : propagate old symbols
22594 if $test -f UU/config.sh; then
22595         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22596         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22597         $sort | $uniq -u >UU/oldsyms
22598         set X `cat UU/oldsyms`
22599         shift
22600         case $# in
22601         0) ;;
22602         *)
22603                 cat <<EOM
22604 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22605 EOM
22606                 echo "# Variables propagated from previous config.sh file." >>config.sh
22607                 for sym in `cat UU/oldsyms`; do
22608                         echo "    Propagating $hint variable "'$'"$sym..."
22609                         eval 'tmp="$'"${sym}"'"'
22610                         echo "$tmp" | \
22611                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22612                 done
22613                 ;;
22614         esac
22615 fi
22616
22617 : Finish up by extracting the .SH files
22618 case "$alldone" in
22619 exit)
22620         $rm -rf UU
22621         echo "Extraction done."
22622         exit 0
22623         ;;
22624 cont)
22625         ;;
22626 '')
22627         dflt=''
22628         nostick=true
22629         $cat <<EOM
22630
22631 If you'd like to make any changes to the config.sh file before I begin
22632 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22633
22634 EOM
22635         rp="Press return or use a shell escape to edit config.sh:"
22636         . UU/myread
22637         nostick=''
22638         case "$ans" in
22639         '') ;;
22640         *) : in case they cannot read
22641                 sh 1>&4 -c "$ans";;
22642         esac
22643         ;;
22644 esac
22645
22646 : if this fails, just run all the .SH files by hand
22647 . ./config.sh
22648
22649 echo " "
22650 exec 1>&4
22651 pwd=`pwd`
22652 . ./UU/extract
22653 cd "$pwd"
22654
22655 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22656         dflt=y
22657         case "$silent" in
22658         true) ;;
22659         *)
22660                 $cat <<EOM
22661
22662 Now you need to generate make dependencies by running "$make depend".
22663 You might prefer to run it in background: "$make depend > makedepend.out &"
22664 It can take a while, so you might not want to run it right now.
22665
22666 EOM
22667                 ;;
22668         esac
22669         rp="Run $make depend now?"
22670         . UU/myread
22671         case "$ans" in
22672         y*)
22673                 $make depend && echo "Now you must run '$make'."
22674                 ;;
22675         *)
22676                 echo "You must run '$make depend' then '$make'."
22677                 ;;
22678         esac
22679 elif test -f [Mm]akefile; then
22680         echo " "
22681         echo "Now you must run a $make."
22682 else
22683         echo "Configure done."
22684 fi
22685
22686 if $test -f Policy.sh; then
22687     $cat <<EOM
22688
22689 If you compile $package on a different machine or from a different object
22690 directory, copy the Policy.sh file from this object directory to the
22691 new one before you run Configure -- this will help you with most of
22692 the policy defaults.
22693
22694 EOM
22695 fi
22696 if $test -f config.msg; then
22697     echo "Hmm.  I also noted the following information while running:"
22698     echo " "
22699     $cat config.msg >&4
22700     $rm -f config.msg
22701 fi
22702 $rm -f kit*isdone ark*isdone
22703 $rm -rf UU
22704
22705 : End of Configure
22706