Re: @{"_<$filename"} is unreasonably tied to use of DB::DB ($^P & 0x2)
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.sourceforge.net/svnroot/dist/trunk/dist
18 #
19 #
20 # Though this script was generated by metaconfig, it is OK to send
21 # patches against it. It's up to the Configure pumpkin to backport
22 # the patch to the metaunits if it is accepted.
23 # See Porting/pumpkin.pod for more information on metaconfig.
24 #
25
26 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
27 #
28 # Generated on Wed Oct 29 09:08:09 CET 2008 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 extern_C=''
211 mistrustnm=''
212 perllibs=''
213 dynamic_ext=''
214 extensions=''
215 known_extensions=''
216 nonxs_ext=''
217 static_ext=''
218 useopcode=''
219 useposix=''
220 extras=''
221 d_bsd=''
222 d_eunice=''
223 d_xenix=''
224 eunicefix=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
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 d_asctime64=''
782 d_ctime64=''
783 d_difftime64=''
784 d_gmtime64=''
785 d_localtime64=''
786 d_mktime64=''
787 d_timegm=''
788 clocktype=''
789 d_times=''
790 d_tmpnam_r=''
791 tmpnam_r_proto=''
792 d_truncate=''
793 d_ttyname_r=''
794 ttyname_r_proto=''
795 d_tzname=''
796 d_u32align=''
797 d_ualarm=''
798 d_umask=''
799 d_semctl_semid_ds=''
800 d_semctl_semun=''
801 d_union_semun=''
802 d_unordered=''
803 d_unsetenv=''
804 d_usleep=''
805 d_usleepproto=''
806 d_ustat=''
807 d_pseudofork=''
808 d_vfork=''
809 usevfork=''
810 d_voidsig=''
811 signal_t=''
812 d_volatile=''
813 d_charvspr=''
814 d_vprintf=''
815 d_wait4=''
816 d_waitpid=''
817 d_wcstombs=''
818 d_wctomb=''
819 d_writev=''
820 dlext=''
821 cccdlflags=''
822 ccdlflags=''
823 dlsrc=''
824 ld=''
825 lddlflags=''
826 usedl=''
827 doublesize=''
828 ebcdic=''
829 fflushNULL=''
830 fflushall=''
831 fpossize=''
832 fpostype=''
833 gccansipedantic=''
834 gccosandvers=''
835 gccversion=''
836 gidformat=''
837 gidsign=''
838 gidsize=''
839 gidtype=''
840 groupstype=''
841 h_fcntl=''
842 h_sysfile=''
843 html1dir=''
844 html1direxp=''
845 installhtml1dir=''
846 html3dir=''
847 html3direxp=''
848 installhtml3dir=''
849 i_arpainet=''
850 i_assert=''
851 i_crypt=''
852 db_hashtype=''
853 db_prefixtype=''
854 db_version_major=''
855 db_version_minor=''
856 db_version_patch=''
857 i_db=''
858 i_dbm=''
859 i_rpcsvcdbm=''
860 d_dirnamlen=''
861 direntrytype=''
862 i_dirent=''
863 i_dld=''
864 i_dlfcn=''
865 i_fcntl=''
866 i_float=''
867 i_fp=''
868 i_fp_class=''
869 i_gdbm=''
870 d_grpasswd=''
871 i_grp=''
872 i_ieeefp=''
873 i_inttypes=''
874 i_langinfo=''
875 i_libutil=''
876 i_limits=''
877 i_locale=''
878 i_machcthr=''
879 i_malloc=''
880 i_mallocmalloc=''
881 i_math=''
882 i_memory=''
883 i_mntent=''
884 d_ndbm=''
885 i_gdbm_ndbm=''
886 i_gdbmndbm=''
887 i_ndbm=''
888 i_netdb=''
889 i_neterrno=''
890 i_netinettcp=''
891 i_niin=''
892 i_sysin=''
893 i_poll=''
894 i_prot=''
895 i_pthread=''
896 d_pwage=''
897 d_pwchange=''
898 d_pwclass=''
899 d_pwcomment=''
900 d_pwexpire=''
901 d_pwgecos=''
902 d_pwpasswd=''
903 d_pwquota=''
904 i_pwd=''
905 i_sfio=''
906 i_shadow=''
907 i_socks=''
908 i_stddef=''
909 i_stdlib=''
910 i_string=''
911 strings=''
912 i_sunmath=''
913 i_sysaccess=''
914 i_sysdir=''
915 i_sysfile=''
916 d_voidtty=''
917 i_bsdioctl=''
918 i_sysfilio=''
919 i_sysioctl=''
920 i_syssockio=''
921 i_syslog=''
922 i_sysmman=''
923 i_sysmode=''
924 i_sysmount=''
925 i_sysndir=''
926 i_sysparam=''
927 i_syspoll=''
928 i_sysresrc=''
929 i_syssecrt=''
930 i_sysselct=''
931 i_sysstat=''
932 i_sysstatfs=''
933 i_sysstatvfs=''
934 i_systimes=''
935 i_systypes=''
936 i_sysuio=''
937 i_sysun=''
938 i_sysutsname=''
939 i_sysvfs=''
940 i_syswait=''
941 i_sgtty=''
942 i_termio=''
943 i_termios=''
944 d_tm_tm_gmtoff=''
945 d_tm_tm_zone=''
946 i_systime=''
947 i_systimek=''
948 i_time=''
949 timeincl=''
950 i_unistd=''
951 i_ustat=''
952 i_utime=''
953 i_values=''
954 i_stdarg=''
955 i_varargs=''
956 i_varhdr=''
957 i_vfork=''
958 d_inc_version_list=''
959 inc_version_list=''
960 inc_version_list_init=''
961 installprefix=''
962 installprefixexp=''
963 installstyle=''
964 installusrbinperl=''
965 intsize=''
966 longsize=''
967 shortsize=''
968 issymlink=''
969 libc=''
970 ldlibpthname=''
971 libperl=''
972 shrpenv=''
973 useshrplib=''
974 glibpth=''
975 libpth=''
976 loclibpth=''
977 plibpth=''
978 xlibpth=''
979 ignore_versioned_solibs=''
980 libs=''
981 libsdirs=''
982 libsfiles=''
983 libsfound=''
984 libspath=''
985 lns=''
986 d_PRIEUldbl=''
987 d_PRIFUldbl=''
988 d_PRIGUldbl=''
989 d_PRIeldbl=''
990 d_PRIfldbl=''
991 d_PRIgldbl=''
992 d_SCNfldbl=''
993 sPRIEUldbl=''
994 sPRIFUldbl=''
995 sPRIGUldbl=''
996 sPRIeldbl=''
997 sPRIfldbl=''
998 sPRIgldbl=''
999 sSCNfldbl=''
1000 lseeksize=''
1001 lseektype=''
1002 mad=''
1003 madlyh=''
1004 madlyobj=''
1005 madlysrc=''
1006 make_set_make=''
1007 d_mymalloc=''
1008 freetype=''
1009 mallocobj=''
1010 mallocsrc=''
1011 malloctype=''
1012 usemallocwrap=''
1013 usemymalloc=''
1014 installman1dir=''
1015 man1dir=''
1016 man1direxp=''
1017 man1ext=''
1018 installman3dir=''
1019 man3dir=''
1020 man3direxp=''
1021 man3ext=''
1022 modetype=''
1023 multiarch=''
1024 mydomain=''
1025 myhostname=''
1026 phostname=''
1027 c=''
1028 n=''
1029 d_eofnblk=''
1030 eagain=''
1031 o_nonblock=''
1032 rd_nodata=''
1033 need_va_copy=''
1034 netdb_hlen_type=''
1035 netdb_host_type=''
1036 netdb_name_type=''
1037 netdb_net_type=''
1038 groupcat=''
1039 hostcat=''
1040 passcat=''
1041 orderlib=''
1042 ranlib=''
1043 d_perl_otherlibdirs=''
1044 otherlibdirs=''
1045 package=''
1046 spackage=''
1047 pager=''
1048 api_revision=''
1049 api_subversion=''
1050 api_version=''
1051 api_versionstring=''
1052 patchlevel=''
1053 perl_patchlevel=''
1054 revision=''
1055 subversion=''
1056 version=''
1057 version_patchlevel_string=''
1058 perl5=''
1059 perladmin=''
1060 perlpath=''
1061 d_nv_preserves_uv=''
1062 d_nv_zero_is_allbits_zero=''
1063 i16size=''
1064 i16type=''
1065 i32size=''
1066 i32type=''
1067 i64size=''
1068 i64type=''
1069 i8size=''
1070 i8type=''
1071 ivsize=''
1072 ivtype=''
1073 nv_overflows_integers_at=''
1074 nv_preserves_uv_bits=''
1075 nvsize=''
1076 nvtype=''
1077 u16size=''
1078 u16type=''
1079 u32size=''
1080 u32type=''
1081 u64size=''
1082 u64type=''
1083 u8size=''
1084 u8type=''
1085 uvsize=''
1086 uvtype=''
1087 ivdformat=''
1088 nvEUformat=''
1089 nvFUformat=''
1090 nvGUformat=''
1091 nveformat=''
1092 nvfformat=''
1093 nvgformat=''
1094 uvXUformat=''
1095 uvoformat=''
1096 uvuformat=''
1097 uvxformat=''
1098 pidtype=''
1099 prefix=''
1100 prefixexp=''
1101 installprivlib=''
1102 privlib=''
1103 privlibexp=''
1104 prototype=''
1105 ptrsize=''
1106 d_PRIXU64=''
1107 d_PRId64=''
1108 d_PRIi64=''
1109 d_PRIo64=''
1110 d_PRIu64=''
1111 d_PRIx64=''
1112 sPRIXU64=''
1113 sPRId64=''
1114 sPRIi64=''
1115 sPRIo64=''
1116 sPRIu64=''
1117 sPRIx64=''
1118 d_quad=''
1119 quadkind=''
1120 quadtype=''
1121 uquadtype=''
1122 drand01=''
1123 randbits=''
1124 randfunc=''
1125 randseedtype=''
1126 seedfunc=''
1127 installscript=''
1128 scriptdir=''
1129 scriptdirexp=''
1130 selectminbits=''
1131 selecttype=''
1132 sh=''
1133 sig_count=''
1134 sig_name=''
1135 sig_name_init=''
1136 sig_num=''
1137 sig_num_init=''
1138 sig_size=''
1139 d_sitearch=''
1140 installsitearch=''
1141 sitearch=''
1142 sitearchexp=''
1143 installsitebin=''
1144 sitebin=''
1145 sitebinexp=''
1146 installsitehtml1dir=''
1147 sitehtml1dir=''
1148 sitehtml1direxp=''
1149 installsitehtml3dir=''
1150 sitehtml3dir=''
1151 sitehtml3direxp=''
1152 installsitelib=''
1153 sitelib=''
1154 sitelib_stem=''
1155 sitelibexp=''
1156 installsiteman1dir=''
1157 siteman1dir=''
1158 siteman1direxp=''
1159 installsiteman3dir=''
1160 siteman3dir=''
1161 siteman3direxp=''
1162 siteprefix=''
1163 siteprefixexp=''
1164 installsitescript=''
1165 sitescript=''
1166 sitescriptexp=''
1167 sizesize=''
1168 sizetype=''
1169 so=''
1170 socksizetype=''
1171 sharpbang=''
1172 shsharp=''
1173 spitshell=''
1174 src=''
1175 ssizetype=''
1176 startperl=''
1177 startsh=''
1178 stdchar=''
1179 d_stdio_stream_array=''
1180 stdio_stream_array=''
1181 sysman=''
1182 sGMTIME_max=''
1183 sGMTIME_min=''
1184 sLOCALTIME_max=''
1185 sLOCALTIME_min=''
1186 trnl=''
1187 uidformat=''
1188 uidsign=''
1189 uidsize=''
1190 uidtype=''
1191 archname64=''
1192 use64bitall=''
1193 use64bitint=''
1194 dtrace=''
1195 usedtrace=''
1196 usefaststdio=''
1197 ccflags_uselargefiles=''
1198 ldflags_uselargefiles=''
1199 libswanted_uselargefiles=''
1200 uselargefiles=''
1201 uselongdouble=''
1202 usemorebits=''
1203 usemultiplicity=''
1204 nm_opt=''
1205 nm_so_opt=''
1206 runnm=''
1207 usenm=''
1208 useperlio=''
1209 usesocks=''
1210 d_oldpthreads=''
1211 use5005threads=''
1212 useithreads=''
1213 usereentrant=''
1214 usethreads=''
1215 incpath=''
1216 mips_type=''
1217 usrinc=''
1218 d_vendorarch=''
1219 installvendorarch=''
1220 vendorarch=''
1221 vendorarchexp=''
1222 d_vendorbin=''
1223 installvendorbin=''
1224 vendorbin=''
1225 vendorbinexp=''
1226 installvendorhtml1dir=''
1227 vendorhtml1dir=''
1228 vendorhtml1direxp=''
1229 installvendorhtml3dir=''
1230 vendorhtml3dir=''
1231 vendorhtml3direxp=''
1232 d_vendorlib=''
1233 installvendorlib=''
1234 vendorlib=''
1235 vendorlib_stem=''
1236 vendorlibexp=''
1237 installvendorman1dir=''
1238 vendorman1dir=''
1239 vendorman1direxp=''
1240 installvendorman3dir=''
1241 vendorman3dir=''
1242 vendorman3direxp=''
1243 usevendorprefix=''
1244 vendorprefix=''
1245 vendorprefixexp=''
1246 d_vendorscript=''
1247 installvendorscript=''
1248 vendorscript=''
1249 vendorscriptexp=''
1250 versiononly=''
1251 defvoidused=''
1252 voidflags=''
1253 yacc=''
1254 yaccflags=''
1255 CONFIG=''
1256
1257 : Detect odd OSs
1258 define='define'
1259 undef='undef'
1260 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1261 rmlist=''
1262
1263 : We must find out about Eunice early
1264 eunicefix=':'
1265 if test -f /etc/unixtovms; then
1266         eunicefix=/etc/unixtovms
1267 fi
1268 if test -f /etc/unixtovms.exe; then
1269         eunicefix=/etc/unixtovms.exe
1270 fi
1271
1272 : Set executable suffix now -- needed before hints available
1273 if test -f "/libs/version.library"; then
1274 : Amiga OS
1275     _exe=""
1276 elif test -f "/system/gnu_library/bin/ar.pm"; then
1277 : Stratus VOS
1278     _exe=".pm"
1279 elif test -n "$DJGPP"; then
1280 : DOS DJGPP
1281     _exe=".exe"
1282 elif test -d c:/. -o -n "$is_os2" ; then
1283 : OS/2 or cygwin
1284     _exe=".exe"
1285 fi
1286
1287 groupstype=''
1288 i_whoami=''
1289 : Trailing extension.  Override this in a hint file, if needed.
1290 : Extra object files, if any, needed on this platform.
1291 archobjs=''
1292 archname=''
1293 libnames=''
1294 : change the next line if compiling for Xenix/286 on Xenix/386
1295 xlibpth='/usr/lib/386 /lib/386'
1296 : Possible local library directories to search.
1297 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1298 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1299
1300 : general looking path for locating libraries
1301 glibpth="/lib /usr/lib $xlibpth"
1302 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1303 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1304 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1305 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1306
1307 : Private path used by Configure to find libraries.  Its value
1308 : is prepended to libpth. This variable takes care of special
1309 : machines, like the mips.  Usually, it should be empty.
1310 plibpth=''
1311
1312 : default library list
1313 libswanted=''
1314 : some systems want to use only the non-versioned libso:s
1315 ignore_versioned_solibs=''
1316 : set usethreads on the Configure command line to enable threads.
1317 usereentrant='undef'
1318 : full support for void wanted by default
1319 defvoidused=15
1320
1321 : Possible local include directories to search.
1322 : Set locincpth to "" in a hint file to defeat local include searches.
1323 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1324 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1325 :
1326 : no include file wanted by default
1327 inclwanted=''
1328
1329 : Enable -DEBUGGING and -DDEBUGGING from the command line
1330 EBUGGING=''
1331 DEBUGGING=old
1332
1333 ccname=''
1334 ccversion=''
1335 perllibs=''
1336 : set useposix=false in your hint file to disable the POSIX extension.
1337 useposix=true
1338 : set useopcode=false in your hint file to disable the Opcode extension.
1339 useopcode=true
1340 archname64=''
1341 ccflags_uselargefiles=''
1342 ldflags_uselargefiles=''
1343 libswanted_uselargefiles=''
1344 : set usemultiplicity on the Configure command line to enable multiplicity.
1345 : set usesocks on the Configure command line to enable socks.
1346 : List of libraries we want.
1347 : If anyone needs extra -lxxx, put those in a hint file.
1348 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1349 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1350 : We probably want to search /usr/shlib before most other libraries.
1351 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1352 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1353 glibpth="/usr/shlib $glibpth"
1354 : Do not use vfork unless overridden by a hint file.
1355 usevfork=false
1356
1357 : Find the basic shell for Bourne shell scripts
1358 case "$sh" in
1359 '')
1360         case "$SYSTYPE" in
1361         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1362         *) xxx='/bin/sh';;
1363         esac
1364         if test -f "$xxx"; then
1365                 sh="$xxx"
1366         else
1367                 : Build up a list and do a single loop so we can 'break' out.
1368                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1369                 for xxx in sh bash ksh pdksh ash; do
1370                         for p in $pth; do
1371                                 try="$try ${p}/${xxx}"
1372                         done
1373                 done
1374                 for xxx in $try; do
1375                         if test -f "$xxx"; then
1376                                 sh="$xxx";
1377                                 break
1378                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1379                                 sh="$xxx";
1380                                 break
1381                         elif test -f "$xxx.exe"; then
1382                                 sh="$xxx";
1383                                 break
1384                         fi
1385                 done
1386         fi
1387         ;;
1388 esac
1389
1390 case "$sh" in
1391 '')     cat >&2 <<EOM
1392 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1393
1394 Usually it's in /bin/sh.  How did you even get this far?
1395 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1396 we'll try to straighten this all out.
1397 EOM
1398         exit 1
1399         ;;
1400 esac
1401
1402 : see if sh knows # comments
1403 if `$sh -c '#' >/dev/null 2>&1`; then
1404         shsharp=true
1405         spitshell=cat
1406         xcat=/bin/cat
1407         test -f $xcat$_exe || xcat=/usr/bin/cat
1408         if test ! -f $xcat$_exe; then
1409                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1410                         if test -f $p/cat$_exe; then
1411                                 xcat=$p/cat
1412                                 break
1413                         fi
1414                 done
1415                 if test ! -f $xcat$_exe; then
1416                         echo "Can't find cat anywhere!"
1417                         exit 1
1418                 fi
1419         fi
1420         echo "#!$xcat" >sharp
1421         $eunicefix sharp
1422         chmod +x sharp
1423         ./sharp > today 2>/dev/null
1424         if test -s today; then
1425                 sharpbang='#!'
1426         else
1427                 echo "#! $xcat" > sharp
1428                 $eunicefix sharp
1429                 chmod +x sharp
1430                 ./sharp > today 2>/dev/null
1431                 if test -s today; then
1432                         sharpbang='#! '
1433                 else
1434                         sharpbang=': use '
1435                 fi
1436         fi
1437 else
1438         echo " "
1439         echo "Your $sh doesn't grok # comments--I will strip them later on."
1440         shsharp=false
1441         cd ..
1442         echo "exec grep -v '^[  ]*#'" >spitshell
1443         chmod +x spitshell
1444         $eunicefix spitshell
1445         spitshell=`pwd`/spitshell
1446         cd UU
1447         echo "I presume that if # doesn't work, #! won't work either!"
1448         sharpbang=': use '
1449 fi
1450 rm -f sharp today
1451
1452 : figure out how to guarantee sh startup
1453 case "$startsh" in
1454 '') startsh=${sharpbang}${sh} ;;
1455 *)
1456 esac
1457 cat >sharp <<EOSS
1458 $startsh
1459 set abc
1460 test "$?abc" != 1
1461 EOSS
1462
1463 chmod +x sharp
1464 $eunicefix sharp
1465 if ./sharp; then
1466         : echo "Yup, it does."
1467 else
1468         echo "Hmm... '$startsh' does not guarantee sh startup..."
1469         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1470 fi
1471 rm -f sharp
1472
1473 : Save command line options in file UU/cmdline.opt for later use in
1474 : generating config.sh.
1475 cat > cmdline.opt <<EOSH
1476 : Configure command line arguments.
1477 config_arg0='$0'
1478 config_args='$*'
1479 config_argc=$#
1480 EOSH
1481 argn=1
1482 args_exp=''
1483 args_sep=''
1484 for arg in "$@"; do
1485         cat >>cmdline.opt <<EOSH
1486 config_arg$argn='$arg'
1487 EOSH
1488         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1489 $arg
1490 EOC
1491         arg_exp=`cat cmdl.opt`
1492         args_exp="$args_exp$args_sep'$arg_exp'"
1493         argn=`expr $argn + 1`
1494         args_sep=' '
1495 done
1496 rm -f cmdl.opt
1497
1498 : produce awk script to parse command line options
1499 cat >options.awk <<'EOF'
1500 BEGIN {
1501         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1502
1503         len = length(optstr);
1504         for (i = 1; i <= len; i++) {
1505                 c = substr(optstr, i, 1);
1506                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1507                 if (a == ":") {
1508                         arg[c] = 1;
1509                         i++;
1510                 }
1511                 opt[c] = 1;
1512         }
1513 }
1514 {
1515         expect = 0;
1516         str = $0;
1517         if (substr(str, 1, 1) != "-") {
1518                 printf("'%s'\n", str);
1519                 next;
1520         }
1521         len = length($0);
1522         for (i = 2; i <= len; i++) {
1523                 c = substr(str, i, 1);
1524                 if (!opt[c]) {
1525                         printf("-%s\n", substr(str, i));
1526                         next;
1527                 }
1528                 printf("-%s\n", c);
1529                 if (arg[c]) {
1530                         if (i < len)
1531                                 printf("'%s'\n", substr(str, i + 1));
1532                         else
1533                                 expect = 1;
1534                         next;
1535                 }
1536         }
1537 }
1538 END {
1539         if (expect)
1540                 print "?";
1541 }
1542 EOF
1543
1544 : process the command line options
1545 set X `for arg in "$@"; do echo "X$arg"; done |
1546         sed -e s/X// | awk -f options.awk`
1547 eval "set $*"
1548 shift
1549 rm -f options.awk
1550
1551 : set up default values
1552 fastread=''
1553 reuseval=false
1554 config_sh=''
1555 alldone=''
1556 error=''
1557 silent=''
1558 extractsh=''
1559 override=''
1560 knowitall=''
1561 rm -f optdef.sh posthint.sh
1562 cat >optdef.sh <<EOS
1563 $startsh
1564 EOS
1565
1566
1567 : option parsing
1568 while test $# -gt 0; do
1569         case "$1" in
1570         -d) shift; fastread=yes;;
1571         -e) shift; alldone=cont;;
1572         -f)
1573                 shift
1574                 cd ..
1575                 if test -r "$1"; then
1576                         config_sh="$1"
1577                 else
1578                         echo "$me: cannot read config file $1." >&2
1579                         error=true
1580                 fi
1581                 cd UU
1582                 shift;;
1583         --help|\
1584         -h) shift; error=true;;
1585         -r) shift; reuseval=true;;
1586         -s) shift; silent=true; realsilent=true;;
1587         -E) shift; alldone=exit;;
1588         -K) shift; knowitall=true;;
1589         -O) shift; override=true;;
1590         -S) shift; silent=true; extractsh=true;;
1591         -D)
1592                 shift
1593                 case "$1" in
1594                 *=)
1595                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1596                         echo "$me: ignoring -D $1" >&2
1597                         ;;
1598                 *=*) echo "$1" | \
1599                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1600                 *) echo "$1='define'" >> optdef.sh;;
1601                 esac
1602                 shift
1603                 ;;
1604         -U)
1605                 shift
1606                 case "$1" in
1607                 *=) echo "$1" >> optdef.sh;;
1608                 *=*)
1609                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1610                         echo "$me: ignoring -U $1" >&2
1611                         ;;
1612                 *) echo "$1='undef'" >> optdef.sh;;
1613                 esac
1614                 shift
1615                 ;;
1616         -A)
1617             shift
1618             xxx=''
1619             yyy="$1"
1620             zzz=''
1621             uuu=undef
1622             case "$yyy" in
1623             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1624                  case "$zzz" in
1625                  *:*) zzz='' ;;
1626                  *)   xxx=append
1627                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1628                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1629                  esac
1630                  ;;
1631             esac
1632             case "$xxx" in
1633             '')  case "$yyy" in
1634                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1635                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1636                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1637                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1638                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1639                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1640                  esac
1641                  ;;
1642             esac
1643             case "$xxx" in
1644             append)
1645                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1646             clear)
1647                 echo "$yyy=''"                  >> posthint.sh ;;
1648             define)
1649                 case "$zzz" in
1650                 '') zzz=define ;;
1651                 esac
1652                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1653             eval)
1654                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1655             prepend)
1656                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1657             undef)
1658                 case "$zzz" in
1659                 '') zzz="$uuu" ;;
1660                 esac
1661                 echo "$yyy=$zzz"                >> posthint.sh ;;
1662             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1663             esac
1664             shift
1665             ;;
1666         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1667             exit 0;;
1668         --) break;;
1669         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1670         *) break;;
1671         esac
1672 done
1673
1674 case "$error" in
1675 true)
1676         cat >&2 <<EOM
1677 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1678                  [-U symbol] [-U symbol=] [-A command:symbol...]
1679   -d : use defaults for all answers.
1680   -e : go on without questioning past the production of config.sh.
1681   -f : specify an alternate default configuration file.
1682   -h : print this help message and exit (with an error status).
1683   -r : reuse C symbols value if possible (skips costly nm extraction).
1684   -s : silent mode, only echoes questions and essential information.
1685   -D : define symbol to have some value:
1686          -D symbol         symbol gets the value 'define'
1687          -D symbol=value   symbol gets the value 'value'
1688        common used examples (see INSTALL for more info):
1689          -Duse64bitint            use 64bit integers
1690          -Duse64bitall            use 64bit integers and pointers
1691          -Dusethreads             use thread support
1692          -Dinc_version_list=none  do not include older perl trees in @INC
1693          -DEBUGGING=none          DEBUGGING options
1694          -Dcc=gcc                 choose your compiler
1695          -Dprefix=/opt/perl5      choose your destination
1696   -E : stop at the end of questions, after having produced config.sh.
1697   -K : do not use unless you know what you are doing.
1698   -O : let -D and -U override definitions from loaded configuration file.
1699   -S : perform variable substitutions on all .SH files (can mix with -f)
1700   -U : undefine symbol:
1701          -U symbol    symbol gets the value 'undef'
1702          -U symbol=   symbol gets completely empty
1703        e.g.:  -Uversiononly
1704   -A : manipulate symbol after the platform specific hints have been applied:
1705          -A append:symbol=value   append value to symbol
1706          -A symbol=value          like append:, but with a separating space
1707          -A define:symbol=value   define symbol to have value
1708          -A clear:symbol          define symbol to be ''
1709          -A define:symbol         define symbol to be 'define'
1710          -A eval:symbol=value     define symbol to be eval of value
1711          -A prepend:symbol=value  prepend value to symbol
1712          -A undef:symbol          define symbol to be 'undef'
1713          -A undef:symbol=         define symbol to be ''
1714        e.g.:  -A prepend:libswanted='cl pthread '
1715               -A ccflags=-DSOME_MACRO
1716   -V : print version number and exit (with a zero status).
1717 EOM
1718         exit 1
1719         ;;
1720 esac
1721
1722 : Sanity checks
1723 case "$fastread$alldone" in
1724 yescont|yesexit) ;;
1725 *)
1726         case "$extractsh" in
1727         true) ;;
1728         *)
1729                 if test ! -t 0; then
1730                         echo "Say 'sh Configure', not 'sh <Configure'"
1731                         exit 1
1732                 fi
1733                 ;;
1734         esac
1735         ;;
1736 esac
1737
1738 exec 4>&1
1739 case "$silent" in
1740 true) exec 1>/dev/null;;
1741 esac
1742
1743 : run the defines and the undefines, if any, but leave the file out there...
1744 touch optdef.sh
1745 . ./optdef.sh
1746 : create the posthint manipulation script and leave the file out there...
1747 touch posthint.sh
1748
1749 : set package name
1750 package='perl5'
1751 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1752 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1753 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1754 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1755 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1756 esac
1757
1758 : Some greps do not return status, grrr.
1759 echo "grimblepritz" >grimble
1760 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1761         contains=contains
1762 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1763         contains=grep
1764 else
1765         contains=contains
1766 fi
1767 rm -f grimble
1768 : the following should work in any shell
1769 case "$contains" in
1770 contains*)
1771         echo " "
1772         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1773         cat >contains <<'EOSS'
1774 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1775 EOSS
1776 chmod +x contains
1777 esac
1778
1779 : Find the path to the source tree
1780 case "$src" in
1781 '') case "$0" in
1782     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1783          case "$src" in
1784          /*)    ;;
1785          .)     ;;
1786          *)     src=`cd ../$src && pwd` ;;
1787          esac
1788          ;;
1789     *)   src='.';;
1790     esac;;
1791 esac
1792 case "$src" in
1793 '')     src=/
1794         rsrc=/
1795         ;;
1796 /*)     rsrc="$src";;
1797 *)      rsrc="../$src";;
1798 esac
1799 if test -f $rsrc/Configure && \
1800         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1801 then
1802    : found it, so we are ok.
1803 else
1804         rsrc=''
1805         for src in . .. ../.. ../../.. ../../../..; do
1806                 if test -f ../$src/Configure && \
1807                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1808                 then
1809                         rsrc=../$src
1810                         break
1811                 fi
1812         done
1813 fi
1814 case "$rsrc" in
1815 '')
1816         cat <<EOM >&4
1817
1818 Sorry, I can't seem to locate the source dir for $package.  Please start
1819 Configure with an explicit path -- i.e. /some/path/Configure.
1820
1821 EOM
1822         exit 1
1823         ;;
1824 ../.)   rsrc='..';;
1825 *)
1826         echo " "
1827         echo "Sources for $package found in \"$src\"." >&4
1828         ;;
1829 esac
1830
1831 : script used to extract .SH files with variable substitutions
1832 cat >extract <<'EOS'
1833 PERL_CONFIG_SH=true
1834 echo "Doing variable substitutions on .SH files..."
1835 if test -f MANIFEST; then
1836         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1837 else
1838         echo "(Looking for .SH files under the source directory.)"
1839         set x `(cd "$src"; find . -name "*.SH" -print)`
1840 fi
1841 shift
1842 case $# in
1843 0) set x `(cd "$src"; echo *.SH)`; shift;;
1844 esac
1845 if test ! -f "$src/$1"; then
1846         shift
1847 fi
1848 mkdir_p='
1849 name=$1;
1850 create="";
1851 while test $name; do
1852         if test ! -d "$name"; then
1853                 create="$name $create";
1854                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1855                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1856         else
1857                 name="";
1858         fi;
1859 done;
1860 for file in $create; do
1861         mkdir $file;
1862 done
1863 '
1864 for file in $*; do
1865         case "$src" in
1866         ".")
1867                 case "$file" in
1868                 */*)
1869                         dir=`expr X$file : 'X\(.*\)/'`
1870                         file=`expr X$file : 'X.*/\(.*\)'`
1871                         (cd "$dir" && . ./$file)
1872                         ;;
1873                 *)
1874                         . ./$file
1875                         ;;
1876                 esac
1877                 ;;
1878         *)
1879                 case "$file" in
1880                 */*)
1881                         dir=`expr X$file : 'X\(.*\)/'`
1882                         file=`expr X$file : 'X.*/\(.*\)'`
1883                         (set x $dir; shift; eval $mkdir_p)
1884                         sh <"$src/$dir/$file"
1885                         ;;
1886                 *)
1887                         sh <"$src/$file"
1888                         ;;
1889                 esac
1890                 ;;
1891         esac
1892 done
1893 if test -f "$src/config_h.SH"; then
1894         if test ! -f config.h; then
1895         : oops, they left it out of MANIFEST, probably, so do it anyway.
1896         . "$src/config_h.SH"
1897         fi
1898 fi
1899 EOS
1900
1901 : extract files and exit if asked to do so
1902 case "$extractsh" in
1903 true)
1904         case "$realsilent" in
1905         true) ;;
1906         *) exec 1>&4;;
1907         esac
1908         case "$config_sh" in
1909         '') config_sh='config.sh';;
1910         esac
1911         echo " "
1912         echo "Fetching answers from $config_sh..."
1913         cd ..
1914         . $config_sh
1915         test "$override" && . ./optdef.sh
1916         echo " "
1917         . UU/extract
1918         rm -rf UU
1919         echo "Extraction done."
1920         exit 0
1921         ;;
1922 esac
1923
1924 : Eunice requires " " instead of "", can you believe it
1925 echo " "
1926 : Here we go...
1927 echo "Beginning of configuration questions for $package."
1928
1929 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1930
1931 : first determine how to suppress newline on echo command
1932 echo " "
1933 echo "Checking echo to see how to suppress newlines..."
1934 (echo "hi there\c" ; echo " ") >.echotmp
1935 if $contains c .echotmp >/dev/null 2>&1 ; then
1936         echo "...using -n."
1937         n='-n'
1938         c=''
1939 else
1940         cat <<'EOM'
1941 ...using \c
1942 EOM
1943         n=''
1944         c='\c'
1945 fi
1946 echo $n "The star should be here-->$c"
1947 echo '*'
1948 rm -f .echotmp
1949
1950 : Now test for existence of everything in MANIFEST
1951 echo " "
1952 if test -f "$rsrc/MANIFEST"; then
1953         echo "First let's make sure your kit is complete.  Checking..." >&4
1954         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1955                 (split -l 50 2>/dev/null || split -50)
1956         rm -f missing
1957         tmppwd=`pwd`
1958         for filelist in x??; do
1959                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1960                         >/dev/null 2>>"$tmppwd/missing")
1961         done
1962         if test -s missing; then
1963                 cat missing >&4
1964                 cat >&4 <<'EOM'
1965
1966 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1967
1968 You have the option of continuing the configuration process, despite the
1969 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1970 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1971 and contact the author (perlbug@perl.org).
1972
1973 EOM
1974                 echo $n "Continue? [n] $c" >&4
1975                 read ans
1976                 case "$ans" in
1977                 y*)
1978                         echo "Continuing..." >&4
1979                         rm -f missing
1980                         ;;
1981                 *)
1982                         echo "ABORTING..." >&4
1983                         kill $$
1984                         ;;
1985                 esac
1986         else
1987                 echo "Looks good..."
1988         fi
1989 else
1990         echo "There is no MANIFEST file.  I hope your kit is complete !"
1991 fi
1992 rm -f missing x??
1993
1994 : Find the appropriate value for a newline for tr
1995 echo " "
1996 if test -n "$DJGPP"; then
1997        trnl='\012'
1998 fi
1999 if test X"$trnl" = X; then
2000         case "`echo foo|tr '\n' x 2>/dev/null`" in
2001         foox) trnl='\n' ;;
2002         esac
2003 fi
2004 if test X"$trnl" = X; then
2005         case "`echo foo|tr '\012' x 2>/dev/null`" in
2006         foox) trnl='\012' ;;
2007         esac
2008 fi
2009 if test X"$trnl" = X; then
2010        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2011        fooxy) trnl='\n\r' ;;
2012        esac
2013 fi
2014 if test X"$trnl" = X; then
2015         cat <<EOM >&2
2016
2017 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2018
2019 EOM
2020         exit 1
2021 fi
2022
2023 : compute the number of columns on the terminal for proper question formatting
2024 case "$COLUMNS" in
2025 '') COLUMNS='80';;
2026 esac
2027
2028 : set up the echo used in my read
2029 myecho="case \"\$xxxm\" in
2030 '') echo $n \"\$rp $c\" >&4;;
2031 *) case \"\$rp\" in
2032         '') echo $n \"[\$xxxm] $c\";;
2033         *)
2034                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2035                         echo \"\$rp\" >&4
2036                         echo $n \"[\$xxxm] $c\" >&4
2037                 else
2038                         echo $n \"\$rp [\$xxxm] $c\" >&4
2039                 fi
2040                 ;;
2041         esac;;
2042 esac"
2043
2044 : now set up to do reads with possible shell escape and default assignment
2045 cat <<EOSC >myread
2046 $startsh
2047 xxxm=\$dflt
2048 $myecho
2049 ans='!'
2050 case "\$fastread" in
2051 yes) case "\$dflt" in
2052         '') ;;
2053         *) ans='';
2054                 case "\$silent-\$rp" in
2055                 true-) ;;
2056                 *) echo " " >&4;;
2057                 esac;;
2058         esac;;
2059 *) case "\$silent" in
2060         true) case "\$rp" in
2061                 '') ans='';;
2062                 esac;;
2063         esac;;
2064 esac
2065 while expr "X\$ans" : "X!" >/dev/null; do
2066         read answ
2067         set x \$xxxm
2068         shift
2069         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2070         case  "\$answ" in
2071         "!")
2072                 sh 1>&4
2073                 echo " "
2074                 $myecho
2075                 ;;
2076         !*)
2077                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2078                 shift
2079                 sh 1>&4 -c "\$*"
2080                 echo " "
2081                 $myecho
2082                 ;;
2083         "\$ans")
2084                 case "\$ans" in
2085                 \\&*)
2086                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2087                         shift
2088                         case "\$1" in
2089                         -d)
2090                                 fastread=yes
2091                                 echo "(OK, I'll run with -d after this question.)" >&4
2092                                 ;;
2093                         -*)
2094                                 echo "*** Sorry, \$1 not supported yet." >&4
2095                                 ;;
2096                         esac
2097                         $myecho
2098                         ans=!
2099                         ;;
2100                 esac;;
2101         *)
2102                 case "\$aok" in
2103                 y)
2104                         echo "*** Substitution done -- please confirm."
2105                         xxxm="\$ans"
2106                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2107                         xxxm="\$ans"
2108                         ans=!
2109                         ;;
2110                 *)
2111                         echo "*** Error -- try again."
2112                         ans=!
2113                         ;;
2114                 esac
2115                 $myecho
2116                 ;;
2117         esac
2118         case "\$ans\$xxxm\$nostick" in
2119         '')
2120                 ans=!
2121                 $myecho
2122                 ;;
2123         esac
2124 done
2125 case "\$ans" in
2126 '') ans="\$xxxm";;
2127 esac
2128 EOSC
2129
2130 : create .config dir to save info across Configure sessions
2131 test -d ../.config || mkdir ../.config
2132 cat >../.config/README <<EOF
2133 This directory created by Configure to save information that should
2134 persist across sessions for $package.
2135
2136 You may safely delete it if you wish.
2137 EOF
2138
2139 : See if we are using a devel version and want that
2140 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2141 case "$usedevel" in
2142 $define|true|[yY]*) ;;
2143 *) case "$xversion" in
2144    *[13579])
2145         cat >&4 <<EOH
2146 *** WHOA THERE!!! ***
2147
2148     This is an UNSTABLE DEVELOPMENT release.
2149     The version of this $package distribution is $xversion, that is, odd,
2150     (as opposed to even) and that signifies a development release.
2151     If you want a maintenance release, you want an even-numbered version.
2152
2153     Do ***NOT*** install this into production use.
2154     Data corruption and crashes are possible.
2155
2156     It is most seriously suggested that you do not continue any further
2157     unless you want to help in developing and debugging Perl.
2158
2159     If you *still* want to build perl, you can answer 'y' now,
2160     or pass -Dusedevel to Configure.
2161
2162 EOH
2163         rp='Do you really want to continue?'
2164         dflt='n'
2165         . ./myread
2166         case "$ans" in
2167         [yY]) echo >&4 "Okay, continuing."
2168               usedevel="$define" ;;
2169         *) echo >&4 "Okay, bye."
2170            exit 1
2171            ;;
2172         esac
2173         ;;
2174     esac
2175     ;;
2176 esac
2177 case "$usedevel" in
2178 $define|true|[yY]*)
2179         case "$versiononly" in
2180         '') versiononly="$define" ;;
2181         esac
2182         case "$installusrbinperl" in
2183         '') installusrbinperl="$undef" ;;
2184         esac
2185         ;;
2186 esac
2187
2188 : general instructions
2189 needman=true
2190 firsttime=true
2191 user=`(logname) 2>/dev/null`
2192 case "$user" in
2193 '') user=`whoami 2>&1`;;
2194 esac
2195 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2196         firsttime=false
2197         echo " "
2198         rp='Would you like to see the instructions?'
2199         dflt=n
2200         . ./myread
2201         case "$ans" in
2202         [yY]*) ;;
2203         *) needman=false;;
2204         esac
2205 fi
2206 if $needman; then
2207         cat <<EOH
2208
2209 This installation shell script will examine your system and ask you questions
2210 to determine how the perl5 package should be installed. If you get
2211 stuck on a question, you may use a ! shell escape to start a subshell or
2212 execute a command.  Many of the questions will have default answers in square
2213 brackets; typing carriage return will give you the default.
2214
2215 On some of the questions which ask for file or directory names you are allowed
2216 to use the ~name construct to specify the login directory belonging to "name",
2217 even if you don't have a shell which knows about that.  Questions where this is
2218 allowed will be marked "(~name ok)".
2219
2220 EOH
2221         rp=''
2222         dflt='Type carriage return to continue'
2223         . ./myread
2224         cat <<'EOH'
2225
2226 The prompter used in this script allows you to use shell variables and
2227 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2228 in the default answer, as if the default line was a set of arguments given to a
2229 script shell.  This means you may also use $* to repeat the whole default line,
2230 so you do not have to re-type everything to add something to the default.
2231
2232 Everytime there is a substitution, you will have to confirm.  If there is an
2233 error (e.g. an unmatched backtick), the default answer will remain unchanged
2234 and you will be prompted again.
2235
2236 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2237 the questions and use the computed defaults (or the previous answers if there
2238 was already a config.sh file). Type 'Configure -h' for a list of options.
2239 You may also start interactively and then answer '& -d' at any prompt to turn
2240 on the non-interactive behaviour for the remainder of the execution.
2241
2242 EOH
2243         . ./myread
2244         cat <<EOH
2245
2246 Much effort has been expended to ensure that this shell script will run on any
2247 Unix system.  If despite that it blows up on yours, your best bet is to edit
2248 Configure and run it again.  If you can't run Configure for some reason,
2249 you'll have to generate a config.sh file by hand.  Whatever problems you
2250 have, let me (perlbug@perl.org) know how I blew it.
2251
2252 This installation script affects things in two ways:
2253
2254 1) it may do direct variable substitutions on some of the files included
2255    in this kit.
2256 2) it builds a config.h file for inclusion in C programs.  You may edit
2257    any of these files as the need arises after running this script.
2258
2259 If you make a mistake on a question, there is no easy way to back up to it
2260 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2261 files.  Configure will offer to let you do this before it runs the SH files.
2262
2263 EOH
2264         dflt='Type carriage return to continue'
2265         . ./myread
2266         case "$firsttime" in
2267         true) echo $user >>../.config/instruct;;
2268         esac
2269 fi
2270
2271 : find out where common programs are
2272 echo " "
2273 echo "Locating common programs..." >&4
2274 cat <<EOSC >loc
2275 $startsh
2276 case \$# in
2277 0) exit 1;;
2278 esac
2279 thing=\$1
2280 shift
2281 dflt=\$1
2282 shift
2283 for dir in \$*; do
2284         case "\$thing" in
2285         .)
2286         if test -d \$dir/\$thing; then
2287                 echo \$dir
2288                 exit 0
2289         fi
2290         ;;
2291         *)
2292         for thisthing in \$dir/\$thing; do
2293                 : just loop through to pick last item
2294         done
2295         if test -f \$thisthing; then
2296                 echo \$thisthing
2297                 exit 0
2298         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2299                 echo \$thisthing
2300                 exit 0
2301         elif test -f \$dir/\$thing.exe; then
2302                 if test -n "$DJGPP"; then
2303                         echo \$dir/\$thing.exe
2304                 elif test "$eunicefix" != ":"; then
2305                         : on Eunice apparently
2306                         echo \$dir/\$thing
2307                 fi
2308                 exit 0
2309         fi
2310         ;;
2311         esac
2312 done
2313 echo \$dflt
2314 exit 1
2315 EOSC
2316 chmod +x loc
2317 $eunicefix loc
2318 loclist="
2319 awk
2320 cat
2321 chmod
2322 comm
2323 cp
2324 echo
2325 expr
2326 grep
2327 ls
2328 mkdir
2329 rm
2330 sed
2331 sort
2332 touch
2333 tr
2334 uniq
2335 "
2336 trylist="
2337 ar
2338 bison
2339 byacc
2340 cpp
2341 csh
2342 date
2343 egrep
2344 gmake
2345 gzip
2346 less
2347 ln
2348 make
2349 more
2350 nm
2351 nroff
2352 pg
2353 test
2354 uname
2355 zip
2356 "
2357 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2358 pth="$pth /lib /usr/lib"
2359 for file in $loclist; do
2360         eval xxx=\$$file
2361         case "$xxx" in
2362         /*|?:[\\/]*)
2363                 if test -f "$xxx"; then
2364                         : ok
2365                 else
2366                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2367                         xxx=`./loc $file $file $pth`
2368                 fi
2369                 ;;
2370         '') xxx=`./loc $file $file $pth`;;
2371         *) xxx=`./loc $xxx $xxx $pth`;;
2372         esac
2373         eval $file=$xxx$_exe
2374         eval _$file=$xxx
2375         case "$xxx" in
2376         /*)
2377                 echo $file is in $xxx.
2378                 ;;
2379         ?:[\\/]*)
2380                 echo $file is in $xxx.
2381                 ;;
2382         *)
2383                 echo "I don't know where '$file' is, and my life depends on it." >&4
2384                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2385                 exit 1
2386                 ;;
2387         esac
2388 done
2389 echo " "
2390 echo "Don't worry if any of the following aren't found..."
2391 say=offhand
2392 for file in $trylist; do
2393         eval xxx=\$$file
2394         case "$xxx" in
2395         /*|?:[\\/]*)
2396                 if test -f "$xxx"; then
2397                         : ok
2398                 else
2399                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2400                         xxx=`./loc $file $file $pth`
2401                 fi
2402                 ;;
2403         '') xxx=`./loc $file $file $pth`;;
2404         *) xxx=`./loc $xxx $xxx $pth`;;
2405         esac
2406         eval $file=$xxx$_exe
2407         eval _$file=$xxx
2408         case "$xxx" in
2409         /*)
2410                 echo $file is in $xxx.
2411                 ;;
2412         ?:[\\/]*)
2413                 echo $file is in $xxx.
2414                 ;;
2415         *)
2416                 echo "I don't see $file out there, $say."
2417                 say=either
2418                 ;;
2419         esac
2420 done
2421 case "$egrep" in
2422 egrep)
2423         echo "Substituting grep for egrep."
2424         egrep=$grep
2425         _egrep=$grep
2426         ;;
2427 esac
2428 case "$ln" in
2429 ln)
2430         echo "Substituting cp for ln."
2431         ln=$cp
2432         _ln=$cp
2433         ;;
2434 esac
2435 case "$make" in
2436 make)
2437         case "$gmake" in
2438         gmake)
2439         echo "I can't find make or gmake, and my life depends on it." >&4
2440         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2441         exit 1
2442         ;;
2443         esac
2444         ;;
2445 esac
2446 case "$gmake" in
2447 gmake)  ;;
2448 *)      # We can't have osname yet.
2449         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2450                 # Assume that gmake, if found, is definitely GNU make
2451                 # and prefer it over the system make.
2452                 echo "Substituting gmake for make."
2453                 make=$gmake
2454                 _make=$gmake
2455         fi
2456         ;;
2457 esac
2458 case "$test" in
2459 test)
2460         echo "Hopefully test is built into your sh."
2461         ;;
2462 *)
2463         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2464                 echo "Using the test built into your sh."
2465                 test=test
2466                 _test=test
2467         fi
2468         ;;
2469 esac
2470 case "$echo" in
2471 echo)
2472         echo "Hopefully echo is built into your sh."
2473         ;;
2474 '') ;;
2475 *)
2476         echo " "
2477 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2478         $echo $n "hi there$c" >foo1
2479         echo $n "hi there$c" >foo2
2480         if cmp foo1 foo2 >/dev/null 2>&1; then
2481                 echo "They are compatible.  In fact, they may be identical."
2482         else
2483                 case "$n" in
2484                 '-n') n='' c='\c';;
2485                 *) n='-n' c='';;
2486                 esac
2487                 cat <<FOO
2488 They are not compatible!  You are probably running ksh on a non-USG system.
2489 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2490 have echo built in and we may have to run some Bourne shell scripts.  That
2491 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2492
2493 FOO
2494                 $echo $n "The star should be here-->$c"
2495                 $echo "*"
2496         fi
2497         $rm -f foo1 foo2
2498         ;;
2499 esac
2500
2501 # This question was auctioned at YAPC::Europe-2007 in Vienna
2502 # I never promised you could answer it. I only auctioned the question.
2503 cat <<FOO
2504 The following message is sponsored by
2505
2506   Dresden.pm<--The stars should be here.
2507
2508 Dear Perl user, system administrator or package
2509 maintainer, the Perl community sends greetings to
2510 you. Do you (emblematical) greet back [Y/n]? n
2511
2512 FOO
2513
2514 : Check what type of C compiler we use
2515 cat <<EOS >trygcc
2516 $startsh
2517 EOS
2518 cat <<'EOSC' >>trygcc
2519 case "$cc" in
2520 '') ;;
2521 *)  $rm -f try try.*
2522     $cat >try.c <<EOM
2523 int main(int argc, char *argv[]) {
2524   return 0;
2525 }
2526 EOM
2527     if $cc -o try $ccflags $ldflags try.c; then
2528        :
2529     else
2530         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2531         despair=yes
2532         trygcc=yes
2533         case "$cc" in
2534         *gcc*) trygcc=no ;;
2535         esac
2536         # Skip this test because it gives a false match on output like:
2537         #    ./trygcc: line 23: cc: command not found
2538         # case "`$cc -v -c try.c 2>&1`" in
2539         # *gcc*) trygcc=no ;;
2540         # esac
2541         if $test X"$trygcc" = Xyes; then
2542             if gcc -o try -c try.c; then
2543                 echo " "
2544                 echo "You seem to have a working gcc, though." >&4
2545                 # Switching compilers may undo the work of hints files.
2546                 # The most common problem is -D_REENTRANT for threads.
2547                 # This heuristic catches that case, but gets false positives
2548                 # if -Dusethreads was not actually specified.  Better to
2549                 # bail out here with a useful message than fail 
2550                 # mysteriously later. Should we perhaps just try to
2551                 # re-invoke Configure -Dcc=gcc config_args ?
2552                 if $test -f usethreads.cbu; then
2553                         $cat >&4 <<EOM 
2554
2555 *** However, any setting of the C compiler flags (e.g. for thread support)
2556 *** will be lost.  It may be necessary for you to restart Configure and
2557 *** add -Dcc=gcc to your Configure command line.
2558
2559 EOM
2560                         rp="Would you like to go ahead and try gcc anyway?"
2561                         dflt=n
2562                 else
2563                         rp="Would you like to use it?"
2564                         dflt=y
2565                 fi
2566                 if $test -f myread; then
2567                     . ./myread
2568                 else
2569                     if $test -f UU/myread; then
2570                         . ./UU/myread
2571                     else
2572                         echo "Cannot find myread, sorry.  Aborting." >&2
2573                         exit 1
2574                     fi
2575                 fi  
2576                 case "$ans" in
2577                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2578                 esac
2579             fi
2580         fi
2581     fi
2582     $rm -f try try.*
2583     ;;
2584 esac
2585 EOSC
2586
2587 cat <<EOS >checkcc
2588 $startsh
2589 EOS
2590 cat <<'EOSC' >>checkcc
2591 case "$cc" in        
2592 '') ;;
2593 *)  $rm -f try try.*              
2594     $cat >try.c <<EOM
2595 int main(int argc, char *argv[]) {
2596   return 0;
2597 }
2598 EOM
2599     if $cc -o try $ccflags $ldflags try.c; then
2600        :
2601     else
2602         if $test X"$despair" = Xyes; then
2603            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2604         fi
2605         $cat >&4 <<EOM         
2606 You need to find a working C compiler.
2607 Either (purchase and) install the C compiler supplied by your OS vendor,
2608 or for a free C compiler try http://gcc.gnu.org/
2609 I cannot continue any further, aborting.
2610 EOM
2611         exit 1
2612     fi
2613     $rm -f try try.*
2614     ;;
2615 esac
2616 EOSC
2617
2618 : determine whether symbolic links are supported
2619 echo " "
2620 $touch blurfl
2621 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2622         echo "Symbolic links are supported." >&4
2623         lns="$ln -s"
2624 else
2625         echo "Symbolic links are NOT supported." >&4
2626         lns="$ln"
2627 fi
2628 $rm -f blurfl sym
2629
2630 : determine whether symbolic links are supported
2631 echo " "
2632 case "$lns" in
2633 *"ln"*" -s")
2634         echo "Checking how to test for symbolic links..." >&4
2635         $lns blurfl sym
2636         if $test "X$issymlink" = X; then
2637                 case "$newsh" in
2638                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2639                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2640                 esac
2641                 if test $? = 0; then
2642                         issymlink="test -h"
2643                 else
2644                         echo "Your builtin 'test -h' may be broken." >&4
2645                         case "$test" in
2646                         /*)     ;;
2647                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2648                                 for p in $pth
2649                                 do
2650                                         if test -f "$p/$test"; then
2651                                                 test="$p/$test"
2652                                                 break
2653                                         fi
2654                                 done
2655                                 ;;
2656                         esac
2657                         case "$test" in
2658                         /*)
2659                                 echo "Trying external '$test -h'." >&4
2660                                 issymlink="$test -h"
2661                                 if $test ! -h sym >/dev/null 2>&1; then
2662                                         echo "External '$test -h' is broken, too." >&4
2663                                         issymlink=''
2664                                 fi
2665                                 ;;
2666                         *)      issymlink='' ;;
2667                         esac
2668                 fi              
2669         fi
2670         if $test "X$issymlink" = X; then
2671                 if $test -L sym 2>/dev/null; then
2672                         issymlink="$test -L"
2673                         echo "The builtin '$test -L' worked." >&4
2674                 fi
2675         fi
2676         if $test "X$issymlink" != X; then
2677                 echo "You can test for symbolic links with '$issymlink'." >&4
2678         else
2679                 echo "I do not know how you can test for symbolic links." >&4
2680         fi
2681         $rm -f blurfl sym
2682         ;;
2683 *)      echo "No symbolic links, so not testing for their testing..." >&4
2684         ;;
2685 esac
2686 echo " "
2687
2688 : Make symlinks util
2689 case "$mksymlinks" in
2690 $define|true|[yY]*)
2691         case "$src" in
2692         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2693                 exit 1
2694                 ;;
2695         *)      case "$lns:$issymlink" in
2696                 *"ln"*" -s:"*"test -"?)
2697                         echo "Creating the symbolic links..." >&4
2698                         echo "(First creating the subdirectories...)" >&4
2699                         cd ..
2700                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2701                                 read directory
2702                                 test -z "$directory" && break
2703                                 mkdir -p $directory
2704                         done
2705                         # Sanity check 1.
2706                         if test ! -d t/base; then
2707                                 echo "Failed to create the subdirectories.  Aborting." >&4
2708                                 exit 1
2709                         fi
2710                         echo "(Then creating the symlinks...)" >&4
2711                         awk '{print $1}' $src/MANIFEST | while true; do
2712                                 read filename
2713                                 test -z "$filename" && break
2714                                 if test -f $filename; then
2715                                         if $issymlink $filename; then
2716                                                 rm -f $filename
2717                                         fi
2718                                 fi
2719                                 if test -f $filename; then
2720                                         echo "$filename already exists, not symlinking."
2721                                 else
2722                                         ln -s $src/$filename $filename
2723                                 fi
2724                         done
2725                         # Sanity check 2.
2726                         if test ! -f t/base/lex.t; then
2727                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2728                                 exit 1
2729                         fi
2730                         cd UU
2731                         ;;
2732                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2733                         ;;
2734                 esac
2735                 ;;
2736         esac
2737         ;;
2738 esac
2739
2740 : Check for Cross-Compilation
2741 case "$usecrosscompile" in
2742 $define|true|[yY]*)
2743         $echo "Cross-compiling..."
2744         croak=''
2745         case "$cc" in
2746         *-*-gcc) # A cross-compiling gcc, probably.
2747             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2748             ar=$targetarch-ar
2749             # leave out ld, choosing it is more complex
2750             nm=$targetarch-nm
2751             ranlib=$targetarch-ranlib
2752             $echo 'extern int foo;' > try.c
2753             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2754             shift
2755             if $test $# -gt 0; then
2756                 incpth="$incpth $*"
2757                 incpth="`$echo $incpth|$sed 's/^ //'`"
2758                 echo "Guessing incpth '$incpth'." >&4
2759                 for i in $*; do
2760                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2761                     if $test -d $j; then
2762                         libpth="$libpth $j"
2763                     fi
2764                 done   
2765                 libpth="`$echo $libpth|$sed 's/^ //'`"
2766                 echo "Guessing libpth '$libpth'." >&4
2767             fi
2768             $rm -f try.c
2769             ;;
2770         esac
2771         case "$targetarch" in
2772         '') echo "Targetarch not defined." >&4; croak=y ;;
2773         *)  echo "Using targetarch $targetarch." >&4 ;;
2774         esac
2775         case "$incpth" in
2776         '') echo "Incpth not defined." >&4; croak=y ;;
2777         *)  echo "Using incpth '$incpth'." >&4 ;;
2778         esac
2779         case "$libpth" in
2780         '') echo "Libpth not defined." >&4; croak=y ;;
2781         *)  echo "Using libpth '$libpth'." >&4 ;;
2782         esac
2783         case "$usrinc" in
2784         '') for i in $incpth; do
2785                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2786                     usrinc=$i
2787                     echo "Guessing usrinc $usrinc." >&4
2788                     break
2789                 fi
2790             done
2791             case "$usrinc" in
2792             '') echo "Usrinc not defined." >&4; croak=y ;;
2793             esac
2794             ;;
2795         *)  echo "Using usrinc $usrinc." >&4 ;;
2796         esac
2797         case "$targethost" in
2798         '') echo "Targethost not defined." >&4; croak=y ;;
2799         *)  echo "Using targethost $targethost." >&4
2800         esac
2801         locincpth=' '
2802         loclibpth=' '
2803         case "$croak" in
2804         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2805         esac
2806         case "$src" in
2807         /*) run=$src/Cross/run
2808             targetmkdir=$src/Cross/mkdir
2809             to=$src/Cross/to
2810             from=$src/Cross/from
2811             ;;
2812         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2813             run=$pwd/Cross/run
2814             targetmkdir=$pwd/Cross/mkdir
2815             to=$pwd/Cross/to
2816             from=$pwd/Cross/from
2817             ;;
2818         esac
2819         case "$targetrun" in
2820         '') targetrun=ssh ;;
2821         esac
2822         case "$targetto" in
2823         '') targetto=scp ;;
2824         esac
2825         case "$targetfrom" in
2826         '') targetfrom=scp ;;
2827         esac
2828         run=$run-$targetrun
2829         to=$to-$targetto
2830         from=$from-$targetfrom
2831         case "$targetdir" in
2832         '')  targetdir=/tmp
2833              echo "Guessing targetdir $targetdir." >&4
2834              ;;
2835         esac
2836         case "$targetuser" in
2837         '')  targetuser=root
2838              echo "Guessing targetuser $targetuser." >&4
2839              ;;
2840         esac
2841         case "$targetfrom" in
2842         scp)    q=-q ;;
2843         *)      q='' ;;
2844         esac
2845         case "$targetrun" in
2846         ssh|rsh)
2847             cat >$run <<EOF
2848 #!/bin/sh
2849 case "\$1" in
2850 -cwd)
2851   shift
2852   cwd=\$1
2853   shift
2854   ;;
2855 esac
2856 case "\$cwd" in
2857 '') cwd=$targetdir ;;
2858 esac
2859 exe=\$1
2860 shift
2861 if $test ! -f \$exe.xok; then
2862   $to \$exe
2863   $touch \$exe.xok
2864 fi
2865 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2866 EOF
2867             ;;
2868         *)  echo "Unknown targetrun '$targetrun'" >&4
2869             exit 1
2870             ;;
2871         esac
2872         case "$targetmkdir" in
2873         */Cross/mkdir)
2874             cat >$targetmkdir <<EOF
2875 #!/bin/sh
2876 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2877 EOF
2878             $chmod a+rx $targetmkdir
2879             ;;
2880         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2881             exit 1
2882             ;;
2883         esac
2884         case "$targetto" in
2885         scp|rcp)
2886             cat >$to <<EOF
2887 #!/bin/sh
2888 for f in \$@
2889 do
2890   case "\$f" in
2891   /*)
2892     $targetmkdir \`dirname \$f\`
2893     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2894     ;;
2895   *)
2896     $targetmkdir $targetdir/\`dirname \$f\`
2897     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2898     ;;
2899   esac
2900 done
2901 exit 0
2902 EOF
2903             ;;
2904         cp) cat >$to <<EOF
2905 #!/bin/sh
2906 for f in \$@
2907 do
2908   case "\$f" in
2909   /*)
2910     $mkdir -p $targetdir/\`dirname \$f\`
2911     $cp \$f $targetdir/\$f || exit 1
2912     ;;
2913   *)
2914     $targetmkdir $targetdir/\`dirname \$f\`
2915     $cp \$f $targetdir/\$f || exit 1
2916     ;;
2917   esac
2918 done
2919 exit 0
2920 EOF
2921             ;;
2922         *)  echo "Unknown targetto '$targetto'" >&4
2923             exit 1
2924             ;;
2925         esac
2926         case "$targetfrom" in
2927         scp|rcp)
2928           cat >$from <<EOF
2929 #!/bin/sh
2930 for f in \$@
2931 do
2932   $rm -f \$f
2933   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2934 done
2935 exit 0
2936 EOF
2937             ;;
2938         cp) cat >$from <<EOF
2939 #!/bin/sh
2940 for f in \$@
2941 do
2942   $rm -f \$f
2943   cp $targetdir/\$f . || exit 1
2944 done
2945 exit 0
2946 EOF
2947             ;;
2948         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2949             exit 1
2950             ;;
2951         esac
2952         if $test ! -f $run; then
2953             echo "Target 'run' script '$run' not found." >&4
2954         else
2955             $chmod a+rx $run
2956         fi
2957         if $test ! -f $to; then
2958             echo "Target 'to' script '$to' not found." >&4
2959         else
2960             $chmod a+rx $to
2961         fi
2962         if $test ! -f $from; then
2963             echo "Target 'from' script '$from' not found." >&4
2964         else
2965             $chmod a+rx $from
2966         fi
2967         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2968             exit 1
2969         fi
2970         cat >&4 <<EOF
2971 Using '$run' for remote execution,
2972 and '$from' and '$to'
2973 for remote file transfer.
2974 EOF
2975         ;;
2976 *)      run=''
2977         to=:
2978         from=:
2979         usecrosscompile='undef'
2980         targetarch=''
2981         ;;
2982 esac
2983
2984 : see whether [:lower:] and [:upper:] are supported character classes
2985 echo " "
2986 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2987 ABYZ)
2988         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2989         up='[:upper:]'
2990         low='[:lower:]'
2991         ;;
2992 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2993         # (0xd9 and 0xe2), therefore that is a nice testing point.
2994         if test "X$up" = X -o "X$low" = X; then
2995             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2996             rs) up='[A-Z]'
2997                 low='[a-z]'
2998                 ;;
2999             esac
3000         fi
3001         if test "X$up" = X -o "X$low" = X; then
3002             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3003             rs) up='A-Z'
3004                 low='a-z'
3005                 ;;
3006             esac
3007         fi
3008         if test "X$up" = X -o "X$low" = X; then
3009             case "`echo RS | od -x 2>/dev/null`" in
3010             *D9E2*|*d9e2*)
3011                 echo "Hey, this might be EBCDIC." >&4
3012                 if test "X$up" = X -o "X$low" = X; then
3013                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3014                     rs) up='[A-IJ-RS-Z]'
3015                         low='[a-ij-rs-z]'
3016                         ;;
3017                     esac
3018                 fi
3019                 if test "X$up" = X -o "X$low" = X; then
3020                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3021                     rs) up='A-IJ-RS-Z'
3022                         low='a-ij-rs-z'
3023                         ;;
3024                     esac
3025                 fi
3026                 ;;
3027             esac
3028         fi
3029 esac
3030 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3031 rs)
3032     echo "Using $up and $low to convert case." >&4
3033     ;;
3034 *)
3035     echo "I don't know how to translate letters from upper to lower case." >&4
3036     echo "Your tr is not acting any way I know of." >&4
3037     exit 1
3038     ;;
3039 esac
3040 : set up the translation script tr, must be called with ./tr of course
3041 cat >tr <<EOSC
3042 $startsh
3043 case "\$1\$2" in
3044 '[A-Z][a-z]') exec $tr '$up' '$low';;
3045 '[a-z][A-Z]') exec $tr '$low' '$up';;
3046 esac
3047 exec $tr "\$@"
3048 EOSC
3049 chmod +x tr
3050 $eunicefix tr
3051
3052 : Try to determine whether config.sh was made on this system
3053 case "$config_sh" in
3054 '')
3055 myuname=`$uname -a 2>/dev/null`
3056 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3057 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3058 # because the A-Z/a-z are not consecutive.
3059 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3060         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3061 newmyuname="$myuname"
3062 dflt=n
3063 case "$knowitall" in
3064 '')
3065         if test -f ../config.sh; then
3066                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3067                         eval "`grep myuname= ../config.sh`"
3068                 fi
3069                 if test "X$myuname" = "X$newmyuname"; then
3070                         dflt=y
3071                 fi
3072         fi
3073         ;;
3074 *) dflt=y;;
3075 esac
3076
3077 : Get old answers from old config file if Configure was run on the
3078 : same system, otherwise use the hints.
3079 hint=default
3080 cd ..
3081 if test -f config.sh; then
3082         echo " "
3083         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3084         . UU/myread
3085         case "$ans" in
3086         n*|N*) echo "OK, I'll ignore it."
3087                 mv config.sh config.sh.old
3088                 myuname="$newmyuname"
3089                 ;;
3090         *)  echo "Fetching default answers from your old config.sh file..." >&4
3091                 tmp_n="$n"
3092                 tmp_c="$c"
3093                 tmp_sh="$sh"
3094                 . ./config.sh
3095                 cp config.sh UU
3096                 n="$tmp_n"
3097                 c="$tmp_c"
3098                 : Older versions did not always set $sh.  Catch re-use of such
3099                 : an old config.sh.
3100                 case "$sh" in
3101                 '') sh="$tmp_sh" ;;
3102                 esac
3103                 hint=previous
3104                 ;;
3105         esac
3106 fi
3107 . ./UU/checkcc
3108 if test ! -f config.sh; then
3109         $cat <<EOM
3110
3111 First time through, eh?  I have some defaults handy for some systems
3112 that need some extra help getting the Configure answers right:
3113
3114 EOM
3115         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3116         dflt=''
3117         : Half the following guesses are probably wrong... If you have better
3118         : tests or hints, please send them to perlbug@perl.org
3119         : The metaconfig authors would also appreciate a copy...
3120         $test -f /irix && osname=irix
3121         $test -f /xenix && osname=sco_xenix
3122         $test -f /dynix && osname=dynix
3123         $test -f /dnix && osname=dnix
3124         $test -f /lynx.os && osname=lynxos
3125         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3126         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3127         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3128         $test -f /bin/mips && /bin/mips && osname=mips
3129         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3130                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3131         $test -d /usr/apollo/bin && osname=apollo
3132         $test -f /etc/saf/_sactab && osname=svr4
3133         $test -d /usr/include/minix && osname=minix
3134         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3135         if $test -d /MachTen -o -d /MachTen_Folder; then
3136                 osname=machten
3137                 if $test -x /sbin/version; then
3138                         osvers=`/sbin/version | $awk '{print $2}' |
3139                         $sed -e 's/[A-Za-z]$//'`
3140                 elif $test -x /usr/etc/version; then
3141                         osvers=`/usr/etc/version | $awk '{print $2}' |
3142                         $sed -e 's/[A-Za-z]$//'`
3143                 else
3144                         osvers="$2.$3"
3145                 fi
3146         fi
3147
3148         $test -f /sys/posix.dll &&
3149                 $test -f /usr/bin/what &&
3150                 set X `/usr/bin/what /sys/posix.dll` &&
3151                 $test "$3" = UWIN &&
3152                 osname=uwin &&
3153                 osvers="$5"
3154
3155         if $test -f $uname; then
3156                 set X $myuname
3157                 shift
3158
3159                 case "$5" in
3160                 fps*) osname=fps ;;
3161                 mips*)
3162                         case "$4" in
3163                         umips) osname=umips ;;
3164                         *) osname=mips ;;
3165                         esac;;
3166                 [23]100) osname=mips ;;
3167                 next*) osname=next ;;
3168                 i386*)
3169                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3170                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3171                                 osname='sco'
3172                                 osvers=$tmp
3173                         elif $test -f /etc/kconfig; then
3174                                 osname=isc
3175                                 if test "$lns" = "$ln -s"; then
3176                                         osvers=4
3177                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3178                                         osvers=3
3179                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3180                                         osvers=2
3181                                 fi
3182                         fi
3183                         tmp=''
3184                         ;;
3185                 pc*)
3186                         if test -n "$DJGPP"; then
3187                                 osname=dos
3188                                 osvers=djgpp
3189                         fi
3190                         ;;
3191                 esac
3192
3193                 case "$1" in
3194                 aix) osname=aix
3195                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3196                         case "$tmp" in
3197                         # oslevel can fail with:
3198                         # oslevel: Unable to acquire lock.
3199                         *not\ found) osvers="$4"."$3" ;;
3200                         '<3240'|'<>3240') osvers=3.2.0 ;;
3201                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3202                         '=3250'|'>3250') osvers=3.2.5 ;;
3203                         *) osvers=$tmp;;
3204                         esac
3205                         ;;
3206                 bsd386) osname=bsd386
3207                         osvers=`$uname -r`
3208                         ;;
3209                 cygwin*) osname=cygwin
3210                         osvers="$3"
3211                         ;;
3212                 *dc.osx) osname=dcosx
3213                         osvers="$3"
3214                         ;;
3215                 dnix) osname=dnix
3216                         osvers="$3"
3217                         ;;
3218                 domainos) osname=apollo
3219                         osvers="$3"
3220                         ;;
3221                 dgux)   osname=dgux
3222                         osvers="$3"
3223                         ;;
3224                 dragonfly) osname=dragonfly
3225                         osvers="$3"
3226                         ;;
3227                 dynixptx*) osname=dynixptx
3228                         osvers=`echo "$4"|sed 's/^v//'`
3229                         ;;
3230                 freebsd) osname=freebsd
3231                         osvers="$3" ;;
3232                 genix)  osname=genix ;;
3233                 gnu)    osname=gnu
3234                         osvers="$3" ;;
3235                 hp*)    osname=hpux
3236                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3237                         ;;
3238                 irix*)  osname=irix
3239                         case "$3" in
3240                         4*) osvers=4 ;;
3241                         5*) osvers=5 ;;
3242                         *)      osvers="$3" ;;
3243                         esac
3244                         ;;
3245                 linux)  osname=linux
3246                         case "$3" in
3247                         *)      osvers="$3" ;;
3248                         esac
3249                         ;;
3250                 MiNT)   osname=mint
3251                         ;;
3252                 netbsd*) osname=netbsd
3253                         osvers="$3"
3254                         ;;
3255                 news-os) osvers="$3"
3256                         case "$3" in
3257                         4*) osname=newsos4 ;;
3258                         *) osname=newsos ;;
3259                         esac
3260                         ;;
3261                 next*) osname=next ;;
3262                 nonstop-ux) osname=nonstopux ;;
3263                 openbsd) osname=openbsd
3264                         osvers="$3"
3265                         ;;
3266                 os2)    osname=os2
3267                         osvers="$4"
3268                         ;;
3269                 POSIX-BC | posix-bc ) osname=posix-bc
3270                         osvers="$3"
3271                         ;;
3272                 powerux | power_ux | powermax_os | powermaxos | \
3273                 powerunix | power_unix) osname=powerux
3274                         osvers="$3"
3275                         ;;
3276                 qnx) osname=qnx
3277                         osvers="$4"
3278                         ;;
3279                 solaris) osname=solaris
3280                         case "$3" in
3281                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3282                         *)      osvers="$3" ;;
3283                         esac
3284                         ;;
3285                 sunos) osname=sunos
3286                         case "$3" in
3287                         5*) osname=solaris
3288                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 titanos) osname=titanos
3293                         case "$3" in
3294                         1*) osvers=1 ;;
3295                         2*) osvers=2 ;;
3296                         3*) osvers=3 ;;
3297                         4*) osvers=4 ;;
3298                         *)      osvers="$3" ;;
3299                         esac
3300                         ;;
3301                 ultrix) osname=ultrix
3302                         osvers="$3"
3303                         ;;
3304                 osf1|mls+)      case "$5" in
3305                                 alpha)
3306                                         osname=dec_osf
3307                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3308                                         case "$osvers" in
3309                                         [1-9].[0-9]*) ;;
3310                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3311                                         esac
3312                                         ;;
3313                         hp*)    osname=hp_osf1  ;;
3314                         mips)   osname=mips_osf1 ;;
3315                         esac
3316                         ;;
3317                 # UnixWare 7.1.2 is known as Open UNIX 8
3318                 openunix|unixware) osname=svr5
3319                         osvers="$4"
3320                         ;;
3321                 uts)    osname=uts
3322                         osvers="$3"
3323                         ;;
3324                 vos) osvers="$3"
3325                         ;;
3326                 $2) case "$osname" in
3327                         *isc*) ;;
3328                         *freebsd*) ;;
3329                         svr*)
3330                                 : svr4.x or possibly later
3331                                 case "svr$3" in
3332                                 ${osname}*)
3333                                         osname=svr$3
3334                                         osvers=$4
3335                                         ;;
3336                                 esac
3337                                 case "$osname" in
3338                                 svr4.0)
3339                                         : Check for ESIX
3340                                         if test -f /stand/boot ; then
3341                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3342                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3343                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3344                                                         if test -n "$isesix"; then
3345                                                                 osname=esix4
3346                                                         fi
3347                                                 fi
3348                                         fi
3349                                         ;;
3350                                 esac
3351                                 ;;
3352                         *)      if test -f /etc/systemid; then
3353                                         osname=sco
3354                                         set `echo $3 | $sed 's/\./ /g'` $4
3355                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3356                                                 osvers=$1.$2.$3
3357                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3358                                                 osvers=$1.$2
3359                                         elif $test -f $src/hints/sco_$1.sh; then
3360                                                 osvers=$1
3361                                         fi
3362                                 else
3363                                         case "$osname" in
3364                                         '') : Still unknown.  Probably a generic Sys V.
3365                                                 osname="sysv"
3366                                                 osvers="$3"
3367                                                 ;;
3368                                         esac
3369                                 fi
3370                                 ;;
3371                         esac
3372                         ;;
3373                 *)      case "$osname" in
3374                         '') : Still unknown.  Probably a generic BSD.
3375                                 osname="$1"
3376                                 osvers="$3"
3377                                 ;;
3378                         esac
3379                         ;;
3380                 esac
3381         else
3382                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3383                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3384                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3385                                 osname=news_os
3386                         fi
3387                         $rm -f UU/kernel.what
3388                 elif test -d c:/. -o -n "$is_os2" ; then
3389                         set X $myuname
3390                         osname=os2
3391                         osvers="$5"
3392                 fi
3393         fi
3394
3395         case "$targetarch" in
3396         '') ;;
3397         *)  hostarch=$osname
3398             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3399             osvers=''
3400             ;;
3401         esac
3402
3403         : Now look for a hint file osname_osvers, unless one has been
3404         : specified already.
3405         case "$hintfile" in
3406         ''|' ')
3407                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3408                 : Also try without trailing minor version numbers.
3409                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3410                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3411                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3412                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3413                 case "$file" in
3414                 '') dflt=none ;;
3415                 *)  case "$osvers" in
3416                         '') dflt=$file
3417                                 ;;
3418                         *)  if $test -f $src/hints/$file.sh ; then
3419                                         dflt=$file
3420                                 elif $test -f $src/hints/$xfile.sh ; then
3421                                         dflt=$xfile
3422                                 elif $test -f $src/hints/$xxfile.sh ; then
3423                                         dflt=$xxfile
3424                                 elif $test -f $src/hints/$xxxfile.sh ; then
3425                                         dflt=$xxxfile
3426                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3427                                         dflt=$xxxxfile
3428                                 elif $test -f "$src/hints/${osname}.sh" ; then
3429                                         dflt="${osname}"
3430                                 else
3431                                         dflt=none
3432                                 fi
3433                                 ;;
3434                         esac
3435                         ;;
3436                 esac
3437                 if $test -f Policy.sh ; then
3438                         case "$dflt" in
3439                         *Policy*) ;;
3440                         none) dflt="Policy" ;;
3441                         *) dflt="Policy $dflt" ;;
3442                         esac
3443                 fi
3444                 ;;
3445         *)
3446                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3447                 ;;
3448         esac
3449
3450         if $test -f Policy.sh ; then
3451                 $cat <<EOM
3452
3453 There's also a Policy hint file available, which should make the
3454 site-specific (policy) questions easier to answer.
3455 EOM
3456
3457         fi
3458
3459         $cat <<EOM
3460
3461 You may give one or more space-separated answers, or "none" if appropriate.
3462 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3463 previous run of Configure, you may specify it as well as or instead of
3464 OS-specific hints.  If hints are provided for your OS, you should use them:
3465 although Perl can probably be built without hints on many platforms, using
3466 hints often improve performance and may enable features that Configure can't
3467 set up on its own. If there are no hints that match your OS, specify "none";
3468 DO NOT give a wrong version or a wrong OS.
3469
3470 EOM
3471
3472         rp="Which of these apply, if any?"
3473         . UU/myread
3474         tans=$ans
3475         for file in $tans; do
3476                 if $test X$file = XPolicy -a -f Policy.sh; then
3477                         . Policy.sh
3478                         $cat Policy.sh >> UU/config.sh
3479                 elif $test -f $src/hints/$file.sh; then
3480                         . $src/hints/$file.sh
3481                         $cat $src/hints/$file.sh >> UU/config.sh
3482                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3483                         : nothing
3484                 else
3485                         : Give one chance to correct a possible typo.
3486                         echo "$file.sh does not exist"
3487                         dflt=$file
3488                         rp="hint to use instead?"
3489                         . UU/myread
3490                         for file in $ans; do
3491                                 if $test -f "$src/hints/$file.sh"; then
3492                                         . $src/hints/$file.sh
3493                                         $cat $src/hints/$file.sh >> UU/config.sh
3494                                 elif $test X$ans = X -o X$ans = Xnone ; then
3495                                         : nothing
3496                                 else
3497                                         echo "$file.sh does not exist -- ignored."
3498                                 fi
3499                         done
3500                 fi
3501         done
3502
3503         hint=recommended
3504         : Remember our hint file for later.
3505         if $test -f "$src/hints/$file.sh" ; then
3506                 hintfile="$file"
3507         else
3508                 hintfile=''
3509         fi
3510 fi
3511 cd UU
3512 ;;
3513 *)
3514         echo " "
3515         echo "Fetching default answers from $config_sh..." >&4
3516         tmp_n="$n"
3517         tmp_c="$c"
3518         cd ..
3519         cp $config_sh config.sh 2>/dev/null
3520         chmod +w config.sh
3521         . ./config.sh
3522         cd UU
3523         cp ../config.sh .
3524         n="$tmp_n"
3525         c="$tmp_c"
3526         hint=previous
3527         ;;
3528 esac
3529 test "$override" && . ./optdef.sh
3530
3531 : Restore computed paths
3532 for file in $loclist $trylist; do
3533         eval $file="\$_$file"
3534 done
3535
3536 cat << EOM
3537
3538 Configure uses the operating system name and version to set some defaults.
3539 The default value is probably right if the name rings a bell. Otherwise,
3540 since spelling matters for me, either accept the default or answer "none"
3541 to leave it blank.
3542
3543 EOM
3544 case "$osname" in
3545         ''|' ')
3546                 case "$hintfile" in
3547                 ''|' '|none) dflt=none ;;
3548                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3549                 esac
3550                 ;;
3551         *) dflt="$osname" ;;
3552 esac
3553 rp="Operating system name?"
3554 . ./myread
3555 case "$ans" in
3556 none)  osname='' ;;
3557 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3558 esac
3559 echo " "
3560 case "$osvers" in
3561         ''|' ')
3562                 case "$hintfile" in
3563                 ''|' '|none) dflt=none ;;
3564                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3565                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3566                         case "$dflt" in
3567                         ''|' ') dflt=none ;;
3568                         esac
3569                         ;;
3570                 esac
3571                 ;;
3572         *) dflt="$osvers" ;;
3573 esac
3574 rp="Operating system version?"
3575 . ./myread
3576 case "$ans" in
3577 none)  osvers='' ;;
3578 *) osvers="$ans" ;;
3579 esac
3580
3581
3582 . ./posthint.sh
3583
3584 : who configured the system
3585 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3586 case "$cf_by" in
3587 "")
3588         cf_by=`(logname) 2>/dev/null`
3589         case "$cf_by" in
3590         "")
3591                 cf_by=`(whoami) 2>/dev/null`
3592                 case "$cf_by" in
3593                 "") cf_by=unknown ;;
3594                 esac ;;
3595         esac ;;
3596 esac
3597
3598 : decide how portable to be.  Allow command line overrides.
3599 case "$d_portable" in
3600 "$undef") ;;
3601 *)      d_portable="$define" ;;
3602 esac
3603
3604 : set up shell script to do ~ expansion
3605 cat >filexp <<EOSS
3606 $startsh
3607 : expand filename
3608 case "\$1" in
3609  \~/*|\~)
3610         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3611         ;;
3612  \~*)
3613         if $test -f /bin/csh; then
3614                 /bin/csh -f -c "glob \$1"
3615                 failed=\$?
3616                 echo ""
3617                 exit \$failed
3618         else
3619                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3620                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3621                 if $test ! -d "\$dir"; then
3622                         me=\`basename \$0\`
3623                         echo "\$me: can't locate home directory for: \$name" >&2
3624                         exit 1
3625                 fi
3626                 case "\$1" in
3627                 */*)
3628                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3629                         ;;
3630                 *)
3631                         echo \$dir
3632                         ;;
3633                 esac
3634         fi
3635         ;;
3636 *)
3637         echo \$1
3638         ;;
3639 esac
3640 EOSS
3641 chmod +x filexp
3642 $eunicefix filexp
3643
3644 : now set up to get a file name
3645 cat <<EOS >getfile
3646 $startsh
3647 EOS
3648 cat <<'EOSC' >>getfile
3649 tilde=''
3650 fullpath=''
3651 already=''
3652 skip=''
3653 none_ok=''
3654 exp_file=''
3655 nopath_ok=''
3656 orig_rp="$rp"
3657 orig_dflt="$dflt"
3658 case "$gfpth" in
3659 '') gfpth='.' ;;
3660 esac
3661
3662 case "$fn" in
3663 *\(*)
3664         : getfile will accept an answer from the comma-separated list
3665         : enclosed in parentheses even if it does not meet other criteria.
3666         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3667         fn=`echo $fn | sed 's/(.*)//'`
3668         ;;
3669 esac
3670
3671 case "$fn" in
3672 *:*)
3673         loc_file=`expr $fn : '.*:\(.*\)'`
3674         fn=`expr $fn : '\(.*\):.*'`
3675         ;;
3676 esac
3677
3678 case "$fn" in
3679 *~*) tilde=true;;
3680 esac
3681 case "$fn" in
3682 */*) fullpath=true;;
3683 esac
3684 case "$fn" in
3685 *+*) skip=true;;
3686 esac
3687 case "$fn" in
3688 *n*) none_ok=true;;
3689 esac
3690 case "$fn" in
3691 *e*) exp_file=true;;
3692 esac
3693 case "$fn" in
3694 *p*) nopath_ok=true;;
3695 esac
3696
3697 case "$fn" in
3698 *f*) type='File';;
3699 *d*) type='Directory';;
3700 *l*) type='Locate';;
3701 esac
3702
3703 what="$type"
3704 case "$what" in
3705 Locate) what='File';;
3706 esac
3707
3708 case "$exp_file" in
3709 '')
3710         case "$d_portable" in
3711         "$define") ;;
3712         *) exp_file=true;;
3713         esac
3714         ;;
3715 esac
3716
3717 cd ..
3718 while test "$type"; do
3719         redo=''
3720         rp="$orig_rp"
3721         dflt="$orig_dflt"
3722         case "$tilde" in
3723         true) rp="$rp (~name ok)";;
3724         esac
3725         . UU/myread
3726         if test -f UU/getfile.ok && \
3727                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3728         then
3729                 value="$ans"
3730                 ansexp="$ans"
3731                 break
3732         fi
3733         case "$ans" in
3734         none)
3735                 value=''
3736                 ansexp=''
3737                 case "$none_ok" in
3738                 true) type='';;
3739                 esac
3740                 ;;
3741         *)
3742                 case "$tilde" in
3743                 '') value="$ans"
3744                         ansexp="$ans";;
3745                 *)
3746                         value=`UU/filexp $ans`
3747                         case $? in
3748                         0)
3749                                 if test "$ans" != "$value"; then
3750                                         echo "(That expands to $value on this system.)"
3751                                 fi
3752                                 ;;
3753                         *) value="$ans";;
3754                         esac
3755                         ansexp="$value"
3756                         case "$exp_file" in
3757                         '') value="$ans";;
3758                         esac
3759                         ;;
3760                 esac
3761                 case "$fullpath" in
3762                 true)
3763                         case "$ansexp" in
3764                         /*) value="$ansexp" ;;
3765                         [a-zA-Z]:/*) value="$ansexp" ;;
3766                         *)
3767                                 redo=true
3768                                 case "$already" in
3769                                 true)
3770                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3771                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3772                                         ;;
3773                                 *)
3774                                 echo "Please give a full path name, starting with slash." >&4
3775                                         case "$tilde" in
3776                                         true)
3777                                 echo "Note that using ~name is ok provided it expands well." >&4
3778                                                 already=true
3779                                                 ;;
3780                                         esac
3781                                 esac
3782                                 ;;
3783                         esac
3784                         ;;
3785                 esac
3786                 case "$redo" in
3787                 '')
3788                         case "$type" in
3789                         File)
3790                                 for fp in $gfpth; do
3791                                         if test "X$fp" = X.; then
3792                                             pf="$ansexp"
3793                                         else    
3794                                             pf="$fp/$ansexp"
3795                                         fi
3796                                         if test -f "$pf"; then
3797                                                 type=''
3798                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3799                                         then
3800                                                 echo "($value is not a plain file, but that's ok.)"
3801                                                 type=''
3802                                         fi
3803                                         if test X"$type" = X; then
3804                                             value="$pf"
3805                                             break
3806                                         fi
3807                                 done
3808                                 ;;
3809                         Directory)
3810                                 for fp in $gfpth; do
3811                                         if test "X$fp" = X.; then
3812                                             dir="$ans"
3813                                             direxp="$ansexp"
3814                                         else    
3815                                             dir="$fp/$ansexp"
3816                                             direxp="$fp/$ansexp"
3817                                         fi
3818                                         if test -d "$direxp"; then
3819                                                 type=''
3820                                                 value="$dir"
3821                                                 break
3822                                         fi
3823                                 done
3824                                 ;;
3825                         Locate)
3826                                 if test -d "$ansexp"; then
3827                                         echo "(Looking for $loc_file in directory $value.)"
3828                                         value="$value/$loc_file"
3829                                         ansexp="$ansexp/$loc_file"
3830                                 fi
3831                                 if test -f "$ansexp"; then
3832                                         type=''
3833                                 fi
3834                                 case "$nopath_ok" in
3835                                 true)   case "$value" in
3836                                         */*) ;;
3837                                         *)      echo "Assuming $value will be in people's path."
3838                                                 type=''
3839                                                 ;;
3840                                         esac
3841                                         ;;
3842                                 esac
3843                                 ;;
3844                         esac
3845
3846                         case "$skip" in
3847                         true) type='';
3848                         esac
3849
3850                         case "$type" in
3851                         '') ;;
3852                         *)
3853                                 if test "$fastread" = yes; then
3854                                         dflt=y
3855                                 else
3856                                         dflt=n
3857                                 fi
3858                                 rp="$what $value doesn't exist.  Use that name anyway?"
3859                                 . UU/myread
3860                                 dflt=''
3861                                 case "$ans" in
3862                                 y*) type='';;
3863                                 *) echo " ";;
3864                                 esac
3865                                 ;;
3866                         esac
3867                         ;;
3868                 esac
3869                 ;;
3870         esac
3871 done
3872 cd UU
3873 ans="$value"
3874 rp="$orig_rp"
3875 dflt="$orig_dflt"
3876 rm -f getfile.ok
3877 test "X$gfpthkeep" != Xy && gfpth=""
3878 EOSC
3879
3880 : determine root of directory hierarchy where package will be installed.
3881 case "$prefix" in
3882 '')
3883         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3884         ;;
3885 *?/)
3886         dflt=`echo "$prefix" | sed 's/.$//'`
3887         ;;
3888 *)
3889         dflt="$prefix"
3890         ;;
3891 esac
3892 $cat <<EOM
3893
3894 By default, $package will be installed in $dflt/bin, manual pages
3895 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3896 installation directories. Typically this is something like /usr/local.
3897 If you wish to have binaries under /usr/bin but other parts of the
3898 installation under /usr/local, that's ok: you will be prompted
3899 separately for each of the installation directories, the prefix being
3900 only used to set the defaults.
3901
3902 EOM
3903 fn=d~
3904 rp='Installation prefix to use?'
3905 . ./getfile
3906 oldprefix=''
3907 case "$prefix" in
3908 '') ;;
3909 *)
3910         case "$ans" in
3911         "$prefix") ;;
3912         *) oldprefix="$prefix";;
3913         esac
3914         ;;
3915 esac
3916 prefix="$ans"
3917 prefixexp="$ansexp"
3918
3919 : allow them to override the AFS root
3920 case "$afsroot" in
3921 '')     afsroot=/afs ;;
3922 *)      afsroot=$afsroot ;;
3923 esac
3924
3925 : is AFS running?
3926 echo " "
3927 case "$afs" in
3928 $define|true)   afs=true ;;
3929 $undef|false)   afs=false ;;
3930 *)      if $test -d $afsroot; then
3931                 afs=true
3932         else
3933                 afs=false
3934         fi
3935         ;;
3936 esac
3937 if $afs; then
3938         echo "AFS may be running... I'll be extra cautious then..." >&4
3939 else
3940         echo "AFS does not seem to be running..." >&4
3941 fi
3942
3943 : determine installation prefix for where package is to be installed.
3944 if $afs; then 
3945 $cat <<EOM
3946
3947 Since you are running AFS, I need to distinguish the directory in which
3948 files will reside from the directory in which they are installed (and from
3949 which they are presumably copied to the former directory by occult means).
3950
3951 EOM
3952         case "$installprefix" in
3953         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3954         *) dflt="$installprefix";;
3955         esac
3956 else
3957 $cat <<EOM
3958
3959 In some special cases, particularly when building $package for distribution,
3960 it is convenient to distinguish the directory in which files should be
3961 installed from the directory ($prefix) in which they will
3962 eventually reside.  For most users, these two directories are the same.
3963
3964 EOM
3965         case "$installprefix" in
3966         '') dflt=$prefix ;;
3967         *) dflt=$installprefix;;
3968         esac
3969 fi
3970 fn=d~
3971 rp='What installation prefix should I use for installing files?'
3972 . ./getfile
3973 installprefix="$ans"
3974 installprefixexp="$ansexp"
3975
3976 : Perform the prefixexp/installprefixexp correction if necessary
3977 cat <<EOS >installprefix
3978 $startsh
3979 EOS
3980 cat <<'EOSC' >>installprefix
3981 : Change installation prefix, if necessary.
3982 if $test X"$prefix" != X"$installprefix"; then
3983     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3984 else
3985     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3986 fi
3987 EOSC
3988 chmod +x installprefix
3989 $eunicefix installprefix
3990
3991 : Set variables such as privlib and privlibexp from the output of ./getfile
3992 : performing the prefixexp/installprefixexp correction if necessary.
3993 cat <<EOS >setprefixvar
3994 $startsh
3995 EOS
3996 cat <<'EOSC' >>setprefixvar
3997 eval "${prefixvar}=\"\$ans\""
3998 eval "${prefixvar}exp=\"\$ansexp\""
3999 . ./installprefix
4000 EOSC
4001 chmod +x setprefixvar
4002 $eunicefix setprefixvar
4003
4004 : set up the script used to warn in case of inconsistency
4005 cat <<EOS >whoa
4006 $startsh
4007 EOS
4008 cat <<'EOSC' >>whoa
4009 dflt=y
4010 case "$hint" in
4011     recommended)
4012         case "$hintfile" in
4013         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4014                 ;;
4015         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4016                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4017                 ;;
4018         esac
4019         ;;
4020     *)  echo " "
4021         echo "*** WHOA THERE!!! ***" >&4
4022         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4023         ;;
4024 esac
4025 rp="    Keep the $hint value?"
4026 . ./myread
4027 case "$ans" in
4028 y) td=$was; tu=$was;;
4029 esac
4030 EOSC
4031
4032 : function used to set '$1' to '$val'
4033 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4034 case "$val$was" in
4035 $define$undef) . ./whoa; eval "$var=\$td";;
4036 $undef$define) . ./whoa; eval "$var=\$tu";;
4037 *) eval "$var=$val";;
4038 esac'
4039
4040 : Check is we will use socks
4041 case "$usesocks" in
4042 $define|true|[yY]*)     dflt='y';;
4043 *) dflt='n';;
4044 esac
4045 cat <<EOM
4046
4047 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4048 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4049 to use the PerlIO abstraction layer, this will be implicitly selected.
4050
4051 If this doesn't make any sense to you, just accept the default '$dflt'.
4052 EOM
4053 rp='Build Perl for SOCKS?'
4054 . ./myread
4055 case "$ans" in
4056 y|Y)    val="$define" ;;
4057 *)      val="$undef" ;;
4058 esac
4059 set usesocks
4060 eval $setvar
4061
4062 case "$usesocks" in
4063 $define|true|[yY]*) useperlio="$define";;
4064 esac
4065
4066 : Check if we want perlio
4067 case "$useperlio" in
4068 $define|true|[yY]*|'')  dflt='y';;
4069 *) dflt='n';;
4070 esac
4071 cat <<EOM
4072
4073 Previous version of $package used the standard IO mechanisms as
4074 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4075 alternate IO mechanisms via the PerlIO abstraction layer, but the
4076 stdio mechanism is still available if needed.  The abstraction layer
4077 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4078 Using PerlIO with sfio may cause problems with some extension modules.
4079
4080 If this doesn't make any sense to you, just accept the default '$dflt'.
4081 EOM
4082 rp='Use the PerlIO abstraction layer?'
4083 . ./myread
4084 case "$ans" in
4085 y|Y)
4086         val="$define"
4087         ;;
4088 *)
4089         echo "Ok, doing things the stdio way."
4090         val="$undef"
4091         ;;
4092 esac
4093 set useperlio
4094 eval $setvar
4095
4096 case "$usesocks" in
4097 $define|true|[yY]*)
4098         case "$useperlio" in
4099         $define|true|[yY]*) ;;
4100         *)      cat >&4 <<EOM
4101
4102 You are using the SOCKS proxy protocol library which means that you
4103 should also use the PerlIO layer.  You may be headed for trouble.
4104
4105 EOM
4106                 ;;
4107         esac
4108         ;;
4109 esac
4110
4111 : get the patchlevel
4112 echo " "
4113 echo "Getting the current patchlevel..." >&4
4114 if $test -r $rsrc/patchlevel.h;then
4115         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4116         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4117         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4118         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4119         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4120         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4121         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4122 else
4123         revision=0
4124         patchlevel=0
4125         subversion=0
4126         api_revision=0
4127         api_version=0
4128         api_subversion=0
4129         perl_patchlevel=0
4130         $echo "(You do not have patchlevel.h.  Eek.)"
4131 fi
4132 if $test -r $rsrc/.patch ; then
4133         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4134                 perl_patchlevel=`cat $rsrc/.patch`
4135         fi
4136 fi
4137 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4138 version_patchlevel_string="version $patchlevel subversion $subversion"
4139 case "$perl_patchlevel" in
4140 0|'') ;;
4141 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4142 esac
4143
4144 $echo "(You have $package $version_patchlevel_string.)"
4145
4146 case "$osname" in
4147 dos|vms)
4148         : XXX Should be a Configure test for double-dots in filenames.
4149         version=`echo $revision $patchlevel $subversion | \
4150                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4151         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4152                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4153         ;;
4154 *)
4155         version=`echo $revision $patchlevel $subversion | \
4156                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4157         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4158                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4159         ;;
4160 esac
4161 : Special case the 5.005_xx maintenance series, which used 5.005
4162 : without any subversion label as a subdirectory in $sitelib
4163 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4164         api_versionstring='5.005'
4165 fi
4166
4167 : Do we want threads support and if so, what type
4168 case "$usethreads" in
4169 $define|true|[yY]*)     dflt='y';;
4170 *)     # Catch case where user specified ithreads or 5005threads but
4171        # forgot -Dusethreads (A.D. 4/2002)
4172        case "$useithreads$use5005threads" in
4173        *$define*)
4174                 case "$useperlio" in
4175                 "$define")      dflt='y' ;;
4176                 *)              dflt='n' ;;
4177                 esac
4178                 ;;
4179        *)       dflt='n';;
4180        esac
4181        ;;
4182 esac
4183 cat <<EOM
4184
4185 Perl can be built to take advantage of threads on some systems.
4186 To do so, Configure can be run with -Dusethreads.
4187
4188 Note that Perl built with threading support runs slightly slower
4189 and uses more memory than plain Perl. The current implementation
4190 is believed to be stable, but it is fairly new, and so should be
4191 treated with caution.
4192
4193 If this doesn't make any sense to you, just accept the default '$dflt'.
4194 EOM
4195 rp='Build a threading Perl?'
4196 . ./myread
4197 case "$ans" in
4198 y|Y)    val="$define" ;;
4199 *)      val="$undef" ;;
4200 esac
4201 set usethreads
4202 eval $setvar
4203
4204 if $test $patchlevel -lt 9; then
4205     case "$usethreads" in
4206     $define)
4207         $cat <<EOM
4208
4209 Since release 5.6, Perl has had two different threading implementations,
4210 the newer interpreter-based version (ithreads) with one interpreter per
4211 thread, and the older 5.005 version (5005threads).
4212 The 5005threads version is effectively unmaintained and will probably be
4213 removed in Perl 5.10, so there should be no need to build a Perl using it
4214 unless needed for backwards compatibility with some existing 5.005threads
4215 code.
4216
4217 EOM
4218         : Default to ithreads unless overridden on command line or with
4219         : old config.sh
4220         dflt='y'
4221         case "$use5005threads" in
4222                 $define|true|[yY]*) dflt='n';;
4223         esac
4224         case "$useithreads" in
4225                 $undef|false|[nN]*) dflt='n';;
4226         esac
4227         rp='Use the newer interpreter-based ithreads?'
4228         . ./myread
4229         case "$ans" in
4230         y|Y)    val="$define" ;;
4231         *)      val="$undef" ;;
4232         esac
4233         set useithreads
4234         eval $setvar
4235         : Now set use5005threads to the opposite value.
4236         case "$useithreads" in
4237         $define) val="$undef" ;;
4238         *) val="$define" ;;
4239         esac
4240         set use5005threads
4241         eval $setvar
4242         ;;
4243     *)
4244         useithreads="$undef"
4245         use5005threads="$undef"
4246         ;;
4247     esac
4248
4249     case "$useithreads$use5005threads" in
4250     "$define$define")
4251         $cat >&4 <<EOM
4252
4253 You cannot have both the ithreads and the 5.005 threads enabled
4254 at the same time.  Disabling the 5.005 threads since they are
4255 much less stable than the ithreads.
4256
4257 EOM
4258         use5005threads="$undef"
4259         ;;
4260     esac
4261
4262 else
4263 : perl-5.9.x and later
4264
4265     if test X"$usethreads" = "X$define"; then
4266         case "$use5005threads" in
4267             $define|true|[yY]*)
4268                 $cat >&4 <<EOM
4269
4270 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4271
4272 EOM
4273             ;;
4274         esac
4275     fi
4276
4277     use5005threads="$undef"
4278     useithreads="$usethreads"
4279 fi
4280
4281 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4282         cat >&4 <<EOF
4283 ***
4284 *** To build with ithreads you must also use the PerlIO layer.
4285 *** Cannot continue, aborting.
4286 ***
4287 EOF
4288         exit 1
4289 fi
4290
4291 case "$d_oldpthreads" in
4292 '')     : Configure tests would be welcome here.  For now, assume undef.
4293         val="$undef" ;;
4294 *)      val="$d_oldpthreads" ;;
4295 esac
4296 set d_oldpthreads
4297 eval $setvar
4298
4299
4300 : Look for a hint-file generated 'call-back-unit'.  If the
4301 : user has specified that a threading perl is to be built,
4302 : we may need to set or change some other defaults.
4303 if $test -f usethreads.cbu; then
4304     echo "Your platform has some specific hints regarding threaded builds, using them..."
4305     . ./usethreads.cbu
4306 else
4307     case "$usethreads" in
4308         "$define"|true|[yY]*)
4309                 $cat <<EOM
4310 (Your platform does not have any specific hints for threaded builds.
4311  Assuming POSIX threads, then.)
4312 EOM
4313         ;;
4314     esac
4315 fi
4316
4317 : Check if multiplicity is required
4318 cat <<EOM
4319
4320 Perl can be built so that multiple Perl interpreters can coexist
4321 within the same Perl executable.
4322 EOM
4323
4324 case "$useithreads" in
4325 $define)
4326         cat <<EOM
4327 This multiple interpreter support is required for interpreter-based threads.
4328 EOM
4329         val="$define"
4330         ;;
4331 *)      case "$usemultiplicity" in
4332         $define|true|[yY]*)     dflt='y';;
4333         *) dflt='n';;
4334         esac
4335         echo " "
4336         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4337         rp='Build Perl for multiplicity?'
4338         . ./myread
4339         case "$ans" in
4340         y|Y)    val="$define" ;;
4341         *)      val="$undef" ;;
4342         esac
4343         ;;
4344 esac
4345 set usemultiplicity
4346 eval $setvar
4347
4348 : Check if morebits is requested
4349 case "$usemorebits" in
4350 "$define"|true|[yY]*)
4351         use64bitint="$define"
4352         uselongdouble="$define"
4353         usemorebits="$define"
4354         ;;
4355 *)      usemorebits="$undef"
4356         ;;
4357 esac
4358
4359 : Determine the C compiler to be used
4360 echo " "
4361 case "$cc" in
4362 '') dflt=cc;;
4363 *) dflt="$cc";;
4364 esac
4365 rp="Use which C compiler?"
4366 . ./myread
4367 cc="$ans"
4368
4369 : See whether they have no cc but they do have gcc
4370 . ./trygcc
4371 if $test -f cc.cbu; then
4372     . ./cc.cbu
4373 fi
4374 . ./checkcc
4375
4376 : make some quick guesses about what we are up against
4377 echo " "
4378 $echo $n "Hmm...  $c"
4379 echo exit 1 >bsd
4380 echo exit 1 >usg
4381 echo exit 1 >v7
4382 echo exit 1 >osf1
4383 echo exit 1 >eunice
4384 echo exit 1 >xenix
4385 echo exit 1 >venix
4386 echo exit 1 >os2
4387 d_bsd="$undef"
4388 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4389 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4390 then
4391         echo "Looks kind of like an OSF/1 system, but we'll see..."
4392         echo exit 0 >osf1
4393 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4394         xxx=`./loc addbib blurfl $pth`
4395         if $test -f $xxx; then
4396         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4397                 echo exit 0 >bsd
4398                 echo exit 0 >usg
4399         else
4400                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4401                         echo "Looks kind of like an extended USG system, but we'll see..."
4402                 else
4403                         echo "Looks kind of like a USG system, but we'll see..."
4404                 fi
4405                 echo exit 0 >usg
4406         fi
4407 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4408         echo "Looks kind of like a BSD system, but we'll see..."
4409         d_bsd="$define"
4410         echo exit 0 >bsd
4411 else
4412         echo "Looks kind of like a Version 7 system, but we'll see..."
4413         echo exit 0 >v7
4414 fi
4415 case "$eunicefix" in
4416 *unixtovms*)
4417         $cat <<'EOI'
4418 There is, however, a strange, musty smell in the air that reminds me of
4419 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4420 EOI
4421         echo exit 0 >eunice
4422         d_eunice="$define"
4423 : it so happens the Eunice I know will not run shell scripts in Unix format
4424         ;;
4425 *)
4426         echo " "
4427         echo "Congratulations.  You aren't running Eunice."
4428         d_eunice="$undef"
4429         ;;
4430 esac
4431 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4432 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4433 : semicolon as a patch separator
4434 case "$p_" in
4435 :) ;;
4436 *)
4437         $cat <<'EOI'
4438 I have the feeling something is not exactly right, however...don't tell me...
4439 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4440 (Or you may be running DOS with DJGPP.)
4441 EOI
4442         echo exit 0 >os2
4443         ;;
4444 esac
4445 if test -f /xenix; then
4446         echo "Actually, this looks more like a XENIX system..."
4447         echo exit 0 >xenix
4448         d_xenix="$define"
4449 else
4450         echo " "
4451         echo "It's not Xenix..."
4452         d_xenix="$undef"
4453 fi
4454 chmod +x xenix
4455 $eunicefix xenix
4456 if test -f /venix; then
4457         echo "Actually, this looks more like a VENIX system..."
4458         echo exit 0 >venix
4459 else
4460         echo " "
4461         if ./xenix; then
4462                 : null
4463         else
4464                 echo "Nor is it Venix..."
4465         fi
4466 fi
4467 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4468 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4469 $rm -f foo
4470
4471 : Check if we are using GNU gcc and what its version is
4472 echo " "
4473 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4474 $cat >try.c <<EOM
4475 #include <stdio.h>
4476 int main() {
4477 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4478 #ifdef __VERSION__
4479         printf("%s\n", __VERSION__);
4480 #else
4481         printf("%s\n", "1");
4482 #endif
4483 #endif
4484         return(0);
4485 }
4486 EOM
4487 if $cc -o try $ccflags $ldflags try.c; then
4488         gccversion=`$run ./try`
4489         case "$gccversion" in
4490         '') echo "You are not using GNU cc." ;;
4491         *)  echo "You are using GNU cc $gccversion."
4492             ccname=gcc
4493             ;;
4494         esac
4495 else
4496         echo " "
4497         echo "*** WHOA THERE!!! ***" >&4
4498         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4499         case "$knowitall" in
4500         '')
4501         echo "    You'd better start hunting for one and let me know about it." >&4
4502                 exit 1
4503                 ;;
4504         esac
4505 fi
4506 $rm -f try try.*
4507 case "$gccversion" in
4508 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4509 esac
4510 case "$gccversion" in
4511 '') gccosandvers='' ;;
4512 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4513    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4514    gccshortvers=''
4515    case "$gccosandvers" in
4516    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4517    $osname$osvers) ;; # looking good
4518    $osname*) cat <<EOM >&4
4519
4520 *** WHOA THERE!!! ***
4521
4522     Your gcc has not been compiled for the exact release of
4523     your operating system ($gccosandvers versus $osname$osvers).
4524
4525     In general it is a good idea to keep gcc synchronized with
4526     the operating system because otherwise serious problems
4527     may ensue when trying to compile software, like Perl.
4528
4529     I'm trying to be optimistic here, though, and will continue.
4530     If later during the configuration and build icky compilation
4531     problems appear (headerfile conflicts being the most common
4532     manifestation), I suggest reinstalling the gcc to match
4533     your operating system release.
4534
4535 EOM
4536       ;;
4537    *) gccosandvers='' ;; # failed to parse, better be silent
4538    esac
4539    ;;
4540 esac
4541 case "$ccname" in
4542 '') ccname="$cc" ;;
4543 esac
4544
4545 # gcc 3.* complain about adding -Idirectories that they already know about,
4546 # so we will take those off from locincpth.
4547 case "$gccversion" in
4548 3*)
4549     echo "main(){}">try.c
4550     for incdir in $locincpth; do
4551        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4552              grep '^c[cp]p*[01]: warning: changing search order '`
4553        if test "X$warn" != X; then
4554            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4555        fi
4556     done
4557     $rm -f try try.*
4558 esac
4559
4560 : What should the include directory be ?
4561 echo " "
4562 $echo $n "Hmm...  $c"
4563 dflt='/usr/include'
4564 incpath=''
4565 mips_type=''
4566 if $test -f /bin/mips && /bin/mips; then
4567         echo "Looks like a MIPS system..."
4568         $cat >usr.c <<'EOCP'
4569 #ifdef SYSTYPE_BSD43
4570 /bsd43
4571 #endif
4572 EOCP
4573         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4574                 dflt='/bsd43/usr/include'
4575                 incpath='/bsd43'
4576                 mips_type='BSD 4.3'
4577         else
4578                 mips_type='System V'
4579         fi
4580         $rm -f usr.c usr.out
4581         echo "and you're compiling with the $mips_type compiler and libraries."
4582         xxx_prompt=y
4583         echo "exit 0" >mips
4584 else
4585         echo "Doesn't look like a MIPS system."
4586         xxx_prompt=n
4587         echo "exit 1" >mips
4588 fi
4589 chmod +x mips
4590 $eunicefix mips
4591 case "$usrinc" in
4592 '') ;;
4593 *) dflt="$usrinc";;
4594 esac
4595 case "$xxx_prompt" in
4596 y)      fn=d/
4597         echo " "
4598         rp='Where are the include files you want to use?'
4599         . ./getfile
4600         usrinc="$ans"
4601         ;;
4602 *)      usrinc="$dflt"
4603         ;;
4604 esac
4605
4606 : see how we invoke the C preprocessor
4607 echo " "
4608 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4609 cat <<'EOT' >testcpp.c
4610 #define ABC abc
4611 #define XYZ xyz
4612 ABC.XYZ
4613 EOT
4614 cd ..
4615 if test ! -f cppstdin; then
4616         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4617                 # AIX cc -E doesn't show the absolute headerfile
4618                 # locations but we'll cheat by using the -M flag.
4619                 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
4620         else
4621                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4622         fi
4623 else
4624         echo "Keeping your $hint cppstdin wrapper."
4625 fi
4626 chmod 755 cppstdin
4627 wrapper=`pwd`/cppstdin
4628 ok='false'
4629 cd UU
4630
4631 if $test "X$cppstdin" != "X" && \
4632         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4633         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4634 then
4635         echo "You used to use $cppstdin $cppminus so we'll use that again."
4636         case "$cpprun" in
4637         '') echo "But let's see if we can live without a wrapper..." ;;
4638         *)
4639                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4640                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4641                 then
4642                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4643                         ok='true'
4644                 else
4645                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4646                 fi
4647                 ;;
4648         esac
4649 else
4650         case "$cppstdin" in
4651         '') ;;
4652         *)
4653                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4654                 ;;
4655         esac
4656 fi
4657
4658 if $ok; then
4659         : nothing
4660 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4661         $cc -E <testcpp.c >testcpp.out 2>&1; \
4662         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4663         echo "Yup, it does."
4664         x_cpp="$cc -E"
4665         x_minus='';
4666 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4667         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4668         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4669         echo "Yup, it does."
4670         x_cpp="$cc -E"
4671         x_minus='-';
4672 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4673         $cc -P <testcpp.c >testcpp.out 2>&1; \
4674         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4675         echo "Yipee, that works!"
4676         x_cpp="$cc -P"
4677         x_minus='';
4678 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4679         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4680         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4681         echo "At long last!"
4682         x_cpp="$cc -P"
4683         x_minus='-';
4684 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4685         $cpp <testcpp.c >testcpp.out 2>&1; \
4686         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4687         echo "It works!"
4688         x_cpp="$cpp"
4689         x_minus='';
4690 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4691         $cpp - <testcpp.c >testcpp.out 2>&1; \
4692         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4693         echo "Hooray, it works!  I was beginning to wonder."
4694         x_cpp="$cpp"
4695         x_minus='-';
4696 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4697         $wrapper <testcpp.c >testcpp.out 2>&1; \
4698         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4699         x_cpp="$wrapper"
4700         x_minus=''
4701         echo "Eureka!"
4702 else
4703         dflt=''
4704         rp="No dice.  I can't find a C preprocessor.  Name one:"
4705         . ./myread
4706         x_cpp="$ans"
4707         x_minus=''
4708         $x_cpp <testcpp.c >testcpp.out 2>&1
4709         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4710                 echo "OK, that will do." >&4
4711         else
4712 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4713                 exit 1
4714         fi
4715 fi
4716
4717 case "$ok" in
4718 false)
4719         cppstdin="$x_cpp"
4720         cppminus="$x_minus"
4721         cpprun="$x_cpp"
4722         cpplast="$x_minus"
4723         set X $x_cpp
4724         shift
4725         case "$1" in
4726         "$cpp")
4727                 echo "Perhaps can we force $cc -E using a wrapper..."
4728                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4729                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4730                 then
4731                         echo "Yup, we can."
4732                         cppstdin="$wrapper"
4733                         cppminus='';
4734                 else
4735                         echo "Nope, we'll have to live without it..."
4736                 fi
4737                 ;;
4738         esac
4739         case "$cpprun" in
4740         "$wrapper")
4741                 cpprun=''
4742                 cpplast=''
4743                 ;;
4744         esac
4745         ;;
4746 esac
4747
4748 case "$cppstdin" in
4749 "$wrapper"|'cppstdin') ;;
4750 *) $rm -f $wrapper;;
4751 esac
4752 $rm -f testcpp.c testcpp.out
4753
4754 : Set private lib path
4755 case "$plibpth" in
4756 '') if ./mips; then
4757                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4758         fi;;
4759 esac
4760 case "$libpth" in
4761 ' ') dlist='';;
4762 '') dlist="$loclibpth $plibpth $glibpth";;
4763 *) dlist="$libpth";;
4764 esac
4765
4766 : Now check and see which directories actually exist, avoiding duplicates
4767 libpth=''
4768 for xxx in $dlist
4769 do
4770     if $test -d $xxx; then
4771                 case " $libpth " in
4772                 *" $xxx "*) ;;
4773                 *) libpth="$libpth $xxx";;
4774                 esac
4775     fi
4776 done
4777 $cat <<'EOM'
4778
4779 Some systems have incompatible or broken versions of libraries.  Among
4780 the directories listed in the question below, please remove any you
4781 know not to be holding relevant libraries, and add any that are needed.
4782 Say "none" for none.
4783
4784 EOM
4785 case "$libpth" in
4786 '') dflt='none';;
4787 *)
4788         set X $libpth
4789         shift
4790         dflt=${1+"$@"}
4791         ;;
4792 esac
4793 rp="Directories to use for library searches?"
4794 . ./myread
4795 case "$ans" in
4796 none) libpth=' ';;
4797 *) libpth="$ans";;
4798 esac
4799
4800 : compute shared library extension
4801 case "$so" in
4802 '')
4803         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4804                 dflt='sl'
4805         else
4806                 dflt='so'
4807         fi
4808         ;;
4809 *) dflt="$so";;
4810 esac
4811 $cat <<EOM
4812
4813 On some systems, shared libraries may be available.  Answer 'none' if
4814 you want to suppress searching of shared libraries for the remainder
4815 of this configuration.
4816
4817 EOM
4818 rp='What is the file extension used for shared libraries?'
4819 . ./myread
4820 so="$ans"
4821
4822 : Define several unixisms.
4823 : Hints files or command line option can be used to override them.
4824 : The convoluted testing is in case hints files set either the old
4825 : or the new name.
4826 case "$_exe" in
4827 '')     case "$exe_ext" in
4828         '')     ;;
4829         *)      _exe="$exe_ext" ;;
4830         esac
4831         ;;
4832 esac
4833 case "$_a" in
4834 '')     case "$lib_ext" in
4835     '') _a='.a';;
4836         *)      _a="$lib_ext" ;;
4837         esac
4838         ;;
4839 esac
4840 case "$_o" in
4841 '') case "$obj_ext" in
4842         '')     _o='.o';;
4843         *)      _o="$obj_ext";;
4844         esac
4845         ;;
4846 esac
4847 case "$p_" in
4848 '') case "$path_sep" in
4849         '')     p_=':';;
4850         *)      p_="$path_sep";;
4851         esac
4852         ;;
4853 esac
4854 exe_ext=$_exe
4855 lib_ext=$_a
4856 obj_ext=$_o
4857 path_sep=$p_
4858
4859 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4860
4861 : Which makefile gets called first.  This is used by make depend.
4862 case "$firstmakefile" in
4863 '') firstmakefile='makefile';;
4864 esac
4865
4866 : Check for uselongdouble support
4867 case "$ccflags" in
4868 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4869 esac
4870
4871 case "$uselongdouble" in
4872 $define|true|[yY]*)     dflt='y';;
4873 *) dflt='n';;
4874 esac
4875 cat <<EOM
4876
4877 Perl can be built to take advantage of long doubles which
4878 (if available) may give more accuracy and range for floating point numbers.
4879
4880 If this doesn't make any sense to you, just accept the default '$dflt'.
4881 EOM
4882 rp='Try to use long doubles if available?'
4883 . ./myread
4884 case "$ans" in
4885 y|Y)    val="$define"   ;;
4886 *)      val="$undef"    ;;
4887 esac
4888 set uselongdouble
4889 eval $setvar
4890
4891 case "$uselongdouble" in
4892 true|[yY]*) uselongdouble="$define" ;;
4893 esac
4894
4895 : Look for a hint-file generated 'call-back-unit'.  If the
4896 : user has specified that long doubles should be used,
4897 : we may need to set or change some other defaults.
4898 if $test -f uselongdouble.cbu; then
4899     echo "Your platform has some specific hints regarding long doubles, using them..."
4900     . ./uselongdouble.cbu
4901 else
4902     case "$uselongdouble" in
4903         $define)
4904                 $cat <<EOM
4905 (Your platform does not have any specific hints for long doubles.)
4906 EOM
4907         ;;
4908     esac
4909 fi
4910
4911 : Looking for optional libraries
4912 echo " "
4913 echo "Checking for optional libraries..." >&4
4914 case "$libs" in
4915 ' '|'') dflt='';;
4916 *) dflt="$libs";;
4917 esac
4918 case "$libswanted" in
4919 '') libswanted='c_s';;
4920 esac
4921 case "$usesocks" in
4922 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4923 esac
4924 libsfound=''
4925 libsfiles=''
4926 libsdirs=''
4927 libspath=''
4928 for thisdir in $libpth $xlibpth; do
4929   test -d $thisdir && libspath="$libspath $thisdir"
4930 done
4931 for thislib in $libswanted; do
4932         for thisdir in $libspath; do
4933             xxx=''
4934             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4935                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=shared
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/lib$thislib.$so
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=shared
4943             fi
4944             if test ! -f "$xxx"; then
4945                 xxx=$thisdir/lib$thislib$_a
4946                 $test -f "$xxx" && eval $libscheck
4947                 $test -f "$xxx" && libstyle=static
4948             fi
4949             if test ! -f "$xxx"; then
4950                 xxx=$thisdir/$thislib$_a
4951                 $test -f "$xxx" && eval $libscheck
4952                 $test -f "$xxx" && libstyle=static
4953             fi
4954             if test ! -f "$xxx"; then
4955                 xxx=$thisdir/lib${thislib}_s$_a
4956                 $test -f "$xxx" && eval $libscheck
4957                 $test -f "$xxx" && libstyle=static
4958                 $test -f "$xxx" && thislib=${thislib}_s
4959             fi
4960             if test ! -f "$xxx"; then
4961                 xxx=$thisdir/Slib$thislib$_a
4962                 $test -f "$xxx" && eval $libscheck
4963                 $test -f "$xxx" && libstyle=static
4964             fi
4965             if $test -f "$xxx"; then
4966                 case "$libstyle" in
4967                 shared) echo "Found -l$thislib (shared)." ;;
4968                 static) echo "Found -l$thislib." ;;
4969                 *)      echo "Found -l$thislib ($libstyle)." ;;
4970                 esac
4971                 case " $dflt " in
4972                 *"-l$thislib "*);;
4973                 *) dflt="$dflt -l$thislib"
4974                    libsfound="$libsfound $xxx"
4975                    yyy=`basename $xxx`
4976                    libsfiles="$libsfiles $yyy"
4977                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4978                    case " $libsdirs " in
4979                    *" $yyy "*) ;;
4980                    *) libsdirs="$libsdirs $yyy" ;;
4981                    esac
4982                    ;;
4983                 esac
4984                 break
4985             fi
4986         done
4987         if $test ! -f "$xxx"; then
4988             echo "No -l$thislib."
4989         fi
4990 done
4991 set X $dflt
4992 shift
4993 dflt="$*"
4994 case "$libs" in
4995 '') dflt="$dflt";;
4996 *) dflt="$libs";;
4997 esac
4998 case "$dflt" in
4999 ' '|'') dflt='none';;
5000 esac
5001
5002 $cat <<EOM
5003
5004 In order to compile $package on your machine, a number of libraries
5005 are usually needed.  Include any other special libraries here as well.
5006 Say "none" for none.  The default list is almost always right.
5007 EOM
5008
5009 echo " "
5010 rp="What libraries to use?"
5011 . ./myread
5012 case "$ans" in
5013 none) libs=' ';;
5014 *) libs="$ans";;
5015 esac
5016
5017 : determine optimization, if desired, or use for debug flag also
5018 case "$optimize" in
5019 ' '|$undef) dflt='none';;
5020 '') dflt='-O';;
5021 *) dflt="$optimize";;
5022 esac
5023 $cat <<EOH
5024
5025 By default, $package compiles with the -O flag to use the optimizer.
5026 Alternately, you might want to use the symbolic debugger, which uses
5027 the -g flag (on traditional Unix systems).  Either flag can be
5028 specified here.  To use neither flag, specify the word "none".
5029
5030 EOH
5031 rp="What optimizer/debugger flag should be used?"
5032 . ./myread
5033 optimize="$ans"
5034 case "$optimize" in
5035 'none') optimize=" ";;
5036 esac
5037
5038 : Check what DEBUGGING is required from the command line
5039 : -DEBUGGING      or -DDEBUGGING or
5040 : -DEBUGGING=both                       = -g + -DDEBUGGING
5041 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5042 : -DEBUGGING=none or -UDEBUGGING        =
5043 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5044 case "$EBUGGING" in
5045 '')     ;;
5046 *)      DEBUGGING=$EBUGGING ;;
5047 esac
5048
5049 case "$DEBUGGING" in
5050 -g|both|$define)
5051     case "$optimize" in
5052         *-g*) ;;
5053         *)    optimize="$optimize -g" ;;
5054     esac ;;
5055 none|$undef)
5056     case "$optimize" in
5057         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5058                 shift
5059                 optimize="$*"
5060                 ;;
5061     esac ;;
5062 esac
5063
5064 dflt=''
5065 case "$DEBUGGING" in
5066 both|$define) dflt='-DDEBUGGING'
5067 esac
5068
5069 : argument order is deliberate, as the flag will start with - which set could
5070 : think is an option
5071 checkccflag='check=$1; flag=$2; callback=$3;
5072 echo " ";
5073 echo "Checking if your compiler accepts $flag" 2>&1;
5074 echo "int main(void) { return 0; }" > gcctest.c;
5075 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5076     echo "Yes, it does." 2>&1;
5077     if $test -s gcctest.out ; then
5078         echo "But your platform does not like it:";
5079         cat gcctest.out;
5080     else
5081         case "$ccflags" in
5082         *$check*)
5083             echo "Leaving current flags $ccflags alone." 2>&1
5084             ;;
5085         *) dflt="$dflt $flag";
5086             eval $callback
5087             ;;
5088         esac
5089     fi
5090 else
5091     echo "Nope, it does not, but that is ok." 2>&1;
5092 fi
5093 '
5094
5095 : We will not override a previous value, but we might want to
5096 : augment a hint file
5097 case "$hint" in
5098 default|recommended)
5099         case "$gccversion" in
5100         1*) dflt="$dflt -fpcc-struct-return" ;;
5101         esac
5102         case "$optimize:$DEBUGGING" in
5103         *-g*:old) dflt="$dflt -DDEBUGGING";;
5104         esac
5105         case "$gccversion" in
5106         2*) if $test -d /etc/conf/kconfig.d &&
5107                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5108                 then
5109                         # Interactive Systems (ISC) POSIX mode.
5110                         dflt="$dflt -posix"
5111                 fi
5112                 ;;
5113         esac
5114         case "$gccversion" in
5115         1*) ;;
5116         2.[0-8]*) ;;
5117         ?*)     set strict-aliasing -fno-strict-aliasing
5118                 eval $checkccflag
5119                 ;;
5120         esac
5121         # For gcc, adding -pipe speeds up compilations for some, but apparently
5122         # some assemblers can't read from stdin.  (It also slows down compilations
5123         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5124         case "$gccversion" in
5125         ?*)     set pipe -pipe
5126                 eval $checkccflag
5127                 ;;
5128         esac
5129
5130         # on x86_64 (at least) we require an extra library (libssp) in the
5131         # link command line. This library is not named, so I infer that it is
5132         # an implementation detail that may change. Hence the safest approach
5133         # is to add the flag to the flags passed to the compiler at link time,
5134         # as that way the compiler can do the right implementation dependant
5135         # thing. (NWC)
5136         case "$gccversion" in
5137         ?*)     set stack-protector -fstack-protector
5138                 eval $checkccflag
5139                 ;;
5140         esac
5141         ;;
5142 esac
5143
5144 case "$mips_type" in
5145 *BSD*|'') inclwanted="$locincpth $usrinc";;
5146 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5147 esac
5148 for thisincl in $inclwanted; do
5149         if $test -d $thisincl; then
5150                 if $test x$thisincl != x$usrinc; then
5151                         case "$dflt" in
5152                         *" -I$thisincl "*);;
5153                         *) dflt="$dflt -I$thisincl ";;
5154                         esac
5155                 fi
5156         fi
5157 done
5158
5159 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5160         xxx=true;
5161 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5162         xxx=true;
5163 else
5164         xxx=false;
5165 fi;
5166 if $xxx; then
5167         case "$dflt" in
5168         *$2*);;
5169         *) dflt="$dflt -D$2";;
5170         esac;
5171 fi'
5172
5173 set signal.h LANGUAGE_C; eval $inctest
5174
5175 case "$usesocks" in
5176 $define)
5177         ccflags="$ccflags -DSOCKS"
5178         ;;
5179 esac
5180
5181 case "$hint" in
5182 default|recommended) dflt="$ccflags $dflt" ;;
5183 *) dflt="$ccflags";;
5184 esac
5185
5186 case "$dflt" in
5187 ''|' ') dflt=none;;
5188 esac
5189
5190 $cat <<EOH
5191
5192 Your C compiler may want other flags.  For this question you should include
5193 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5194 but you should NOT include libraries or ld flags like -lwhatever.  If you
5195 want $package to honor its debug switch, you should include -DDEBUGGING here.
5196 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5197
5198 To use no flags, specify the word "none".
5199
5200 EOH
5201 set X $dflt
5202 shift
5203 dflt=${1+"$@"}
5204 rp="Any additional cc flags?"
5205 . ./myread
5206 case "$ans" in
5207 none) ccflags='';;
5208 *) ccflags="$ans";;
5209 esac
5210
5211 : the following weeds options from ccflags that are of no interest to cpp
5212 case "$cppflags" in
5213 '') cppflags="$ccflags" ;;
5214 *)  cppflags="$cppflags $ccflags" ;;
5215 esac
5216 case "$gccversion" in
5217 1*) cppflags="$cppflags -D__GNUC__"
5218 esac
5219 case "$mips_type" in
5220 '');;
5221 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5222 esac
5223 case "$cppflags" in
5224 '');;
5225 *)
5226         echo " "
5227         echo "Let me guess what the preprocessor flags are..." >&4
5228         set X $cppflags
5229         shift
5230         cppflags=''
5231         $cat >cpp.c <<'EOM'
5232 #define BLURFL foo
5233
5234 BLURFL xx LFRULB
5235 EOM
5236         previous=''
5237         for flag in $*
5238         do
5239                 case "$flag" in
5240                 -*) ftry="$flag";;
5241                 *) ftry="$previous $flag";;
5242                 esac
5243                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5244                         >cpp1.out 2>/dev/null && \
5245                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5246                         >cpp2.out 2>/dev/null && \
5247                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5248                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5249                 then
5250                         cppflags="$cppflags $ftry"
5251                         previous=''
5252                 else
5253                         previous="$flag"
5254                 fi
5255         done
5256         set X $cppflags
5257         shift
5258         cppflags=${1+"$@"}
5259         case "$cppflags" in
5260         *-*)  echo "They appear to be: $cppflags";;
5261         esac
5262         $rm -f cpp.c cpp?.out
5263         ;;
5264 esac
5265
5266 : flags used in final linking phase
5267 case "$ldflags" in
5268 '') if ./venix; then
5269                 dflt='-i -z'
5270         else
5271                 dflt=''
5272         fi
5273         case "$ccflags" in
5274         *-posix*) dflt="$dflt -posix" ;;
5275         esac
5276         ;;
5277 *) dflt="$ldflags";;
5278 esac
5279 # See note above about -fstack-protector
5280 case "$ccflags" in
5281 *-fstack-protector*) 
5282         case "$dflt" in
5283         *-fstack-protector*) ;; # Don't add it again
5284         *) dflt="$dflt -fstack-protector" ;; 
5285         esac
5286         ;;
5287 esac
5288
5289 : Try to guess additional flags to pick up local libraries.
5290 for thislibdir in $libpth; do
5291         case " $loclibpth " in
5292         *" $thislibdir "*)
5293                 case "$dflt " in
5294                 *"-L$thislibdir "*) ;;
5295                 *)  dflt="$dflt -L$thislibdir" ;;
5296                 esac
5297                 ;;
5298         esac
5299 done
5300
5301 case "$dflt" in
5302 '') dflt='none' ;;
5303 esac
5304
5305 $cat <<EOH
5306
5307 Your C linker may need flags.  For this question you should
5308 include -L/whatever and any other flags used by the C linker, but you
5309 should NOT include libraries like -lwhatever.
5310
5311 Make sure you include the appropriate -L/path flags if your C linker
5312 does not normally search all of the directories you specified above,
5313 namely
5314         $libpth
5315 To use no flags, specify the word "none".
5316
5317 EOH
5318
5319 rp="Any additional ld flags (NOT including libraries)?"
5320 . ./myread
5321 case "$ans" in
5322 none) ldflags='';;
5323 *) ldflags="$ans";;
5324 esac
5325 rmlist="$rmlist pdp11"
5326
5327 : coherency check
5328 echo " "
5329 echo "Checking your choice of C compiler and flags for coherency..." >&4
5330 $cat > try.c <<'EOF'
5331 #include <stdio.h>
5332 int main() { printf("Ok\n"); return(0); }
5333 EOF
5334 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5335 shift
5336 $cat >try.msg <<'EOM'
5337 I've tried to compile and run the following simple program:
5338
5339 EOM
5340 $cat try.c >> try.msg
5341
5342 $cat >> try.msg <<EOM
5343
5344 I used the command:
5345
5346         $*
5347         $run ./try
5348
5349 and I got the following output:
5350
5351 EOM
5352 dflt=y
5353 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5354         if $sh -c "$run ./try " >>try.msg 2>&1; then
5355                 xxx=`$run ./try`
5356                 case "$xxx" in
5357                 "Ok") dflt=n ;;
5358                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5359                         case " $libs " in
5360                         *" -lsfio "*)
5361                                 cat >> try.msg <<'EOQS'
5362 If $libs contains -lsfio, and sfio is mis-configured, then it
5363 sometimes (apparently) runs and exits with a 0 status, but with no
5364 output!  It may have to do with sfio's use of _exit vs. exit.
5365
5366 EOQS
5367                                 rp="You have a big problem.  Shall I abort Configure"
5368                                 dflt=y
5369                                 ;;
5370                         esac
5371                         ;;
5372                 esac
5373         else
5374                 echo "The program compiled OK, but exited with status $?." >>try.msg
5375                 rp="You have a problem.  Shall I abort Configure"
5376                 dflt=y
5377         fi
5378 else
5379         echo "I can't compile the test program." >>try.msg
5380         rp="You have a BIG problem.  Shall I abort Configure"
5381         dflt=y
5382 fi
5383 case "$dflt" in
5384 y)
5385         $cat try.msg >&4
5386         case "$knowitall" in
5387         '')
5388                 echo "(The supplied flags or libraries might be incorrect.)"
5389                 ;;
5390         *) dflt=n;;
5391         esac
5392         echo " "
5393         . ./myread
5394         case "$ans" in
5395         n*|N*) ;;
5396         *)      echo "Ok.  Stopping Configure." >&4
5397                 exit 1
5398                 ;;
5399         esac
5400         ;;
5401 n) echo "OK, that should do.";;
5402 esac
5403 $rm_try gcctest gcctest.out
5404
5405 : define a shorthand compile call
5406 compile='
5407 mc_file=$1;
5408 shift;
5409 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5410 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5411 exit 1;
5412 fi;
5413 esac;
5414 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5415 : define a shorthand compile call for compilations that should be ok.
5416 compile_ok='
5417 mc_file=$1;
5418 shift;
5419 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5420
5421 : determine filename position in cpp output
5422 echo " "
5423 echo "Computing filename position in cpp output for #include directives..." >&4
5424 case "$osname" in
5425 vos) testaccess=-e ;;
5426 *)   testaccess=-r ;;
5427 esac
5428 echo '#include <stdio.h>' > foo.c
5429 $cat >fieldn <<EOF
5430 $startsh
5431 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5432 $grep '^[       ]*#.*stdio\.h' | \
5433 while read cline; do
5434         pos=1
5435         set \$cline
5436         while $test \$# -gt 0; do
5437                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5438                         echo "\$pos"
5439                         exit 0
5440                 fi
5441                 shift
5442                 pos=\`expr \$pos + 1\`
5443         done
5444 done
5445 EOF
5446 chmod +x fieldn
5447 fieldn=`./fieldn`
5448 $rm -f foo.c fieldn
5449 case $fieldn in
5450 '') pos='???';;
5451 1) pos=first;;
5452 2) pos=second;;
5453 3) pos=third;;
5454 *) pos="${fieldn}th";;
5455 esac
5456 echo "Your cpp writes the filename in the $pos field of the line."
5457
5458 case "$osname" in
5459 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5460 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5461 *)   cppfilter='' ;;
5462 esac
5463 : locate header file
5464 $cat >findhdr <<EOF
5465 $startsh
5466 wanted=\$1
5467 name=''
5468 for usrincdir in $usrinc
5469 do
5470         if test -f \$usrincdir/\$wanted; then
5471                 echo "\$usrincdir/\$wanted"
5472                 exit 0
5473         fi
5474 done
5475 awkprg='{ print \$$fieldn }'
5476 echo "#include <\$wanted>" > foo\$\$.c
5477 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5478 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5479 while read cline; do
5480         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5481         case "\$name" in
5482         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5483         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5484         *) exit 2;;
5485         esac;
5486 done;
5487 #
5488 # status = 0: grep returned 0 lines, case statement not executed
5489 # status = 1: headerfile found
5490 # status = 2: while loop executed, no headerfile found
5491 #
5492 status=\$?
5493 $rm -f foo\$\$.c;
5494 if test \$status -eq 1; then
5495         exit 0;
5496 fi
5497 exit 1
5498 EOF
5499 chmod +x findhdr
5500
5501 : define an alternate in-header-list? function
5502 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5503 cont=true; xxf="echo \"<\$1> found.\" >&4";
5504 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5505 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5506 esac;
5507 case $# in 4) instead=instead;; *) instead="at last";; esac;
5508 while $test "$cont"; do
5509         xxx=`./findhdr $1`
5510         var=$2; eval "was=\$$2";
5511         if $test "$xxx" && $test -r "$xxx";
5512         then eval $xxf;
5513         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5514                 cont="";
5515         else eval $xxnf;
5516         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5517         set $yyy; shift; shift; yyy=$@;
5518         case $# in 0) cont="";;
5519         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5520                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5521         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5522                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5523         esac;
5524 done;
5525 while $test "$yyy";
5526 do set $yyy; var=$2; eval "was=\$$2";
5527         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5528         set $yyy; shift; shift; yyy=$@;
5529 done'
5530
5531 : see if stdlib is available
5532 set stdlib.h i_stdlib
5533 eval $inhdr
5534
5535 : check for lengths of integral types
5536 echo " "
5537 case "$intsize" in
5538 '')
5539         echo "Checking to see how big your integers are..." >&4
5540         $cat >try.c <<EOCP
5541 #include <stdio.h>
5542 #$i_stdlib I_STDLIB
5543 #ifdef I_STDLIB
5544 #include <stdlib.h>
5545 #endif
5546 int main()
5547 {
5548         printf("intsize=%d;\n", (int)sizeof(int));
5549         printf("longsize=%d;\n", (int)sizeof(long));
5550         printf("shortsize=%d;\n", (int)sizeof(short));
5551         exit(0);
5552 }
5553 EOCP
5554         set try
5555         if eval $compile_ok && $run ./try > /dev/null; then
5556                 eval `$run ./try`
5557                 echo "Your integers are $intsize bytes long."
5558                 echo "Your long integers are $longsize bytes long."
5559                 echo "Your short integers are $shortsize bytes long."
5560         else
5561                 $cat >&4 <<EOM
5562 !
5563 Help! I can't compile and run the intsize test program: please enlighten me!
5564 (This is probably a misconfiguration in your system or libraries, and
5565 you really ought to fix it.  Still, I'll try anyway.)
5566 !
5567 EOM
5568                 dflt=4
5569                 rp="What is the size of an integer (in bytes)?"
5570                 . ./myread
5571                 intsize="$ans"
5572                 dflt=$intsize
5573                 rp="What is the size of a long integer (in bytes)?"
5574                 . ./myread
5575                 longsize="$ans"
5576                 dflt=2
5577                 rp="What is the size of a short integer (in bytes)?"
5578                 . ./myread
5579                 shortsize="$ans"
5580         fi
5581         ;;
5582 esac
5583 $rm_try
5584
5585 : check for long long
5586 echo " "
5587 echo "Checking to see if you have long long..." >&4
5588 echo 'int main() { long long x = 7; return 0; }' > try.c
5589 set try
5590 if eval $compile; then
5591         val="$define"
5592         echo "You have long long."
5593 else
5594         val="$undef"
5595         echo "You do not have long long."
5596 fi
5597 $rm_try
5598 set d_longlong
5599 eval $setvar
5600
5601 : check for length of long long
5602 case "${d_longlong}${longlongsize}" in
5603 $define)
5604         echo " "
5605         echo "Checking to see how big your long longs are..." >&4
5606         $cat >try.c <<'EOCP'
5607 #include <stdio.h>
5608 int main()
5609 {
5610     printf("%d\n", (int)sizeof(long long));
5611     return(0);
5612 }
5613 EOCP
5614         set try
5615         if eval $compile_ok; then
5616                 longlongsize=`$run ./try`
5617                 echo "Your long longs are $longlongsize bytes long."
5618         else
5619                 dflt='8'
5620                 echo " "
5621                 echo "(I can't seem to compile the test program.  Guessing...)"
5622                 rp="What is the size of a long long (in bytes)?"
5623                 . ./myread
5624                 longlongsize="$ans"
5625         fi
5626         if $test "X$longsize" = "X$longlongsize"; then
5627                 echo "(That isn't any different from an ordinary long.)"
5628         fi
5629         ;;
5630 esac
5631 $rm_try
5632
5633 : see if inttypes.h is available
5634 : we want a real compile instead of Inhdr because some systems
5635 : have an inttypes.h which includes non-existent headers
5636 echo " "
5637 $cat >try.c <<EOCP
5638 #include <inttypes.h>
5639 int main() {
5640         static int32_t foo32 = 0x12345678;
5641 }
5642 EOCP
5643 set try
5644 if eval $compile; then
5645         echo "<inttypes.h> found." >&4
5646         val="$define"
5647 else
5648         echo "<inttypes.h> NOT found." >&4
5649         val="$undef"
5650 fi
5651 $rm_try
5652 set i_inttypes
5653 eval $setvar
5654
5655 : check for int64_t
5656 echo " "
5657 echo "Checking to see if you have int64_t..." >&4
5658 $cat >try.c <<EOCP
5659 #include <sys/types.h>
5660 #$i_inttypes I_INTTYPES
5661 #ifdef I_INTTYPES
5662 #include <inttypes.h>
5663 #endif
5664 int main() { int64_t x = 7; }
5665 EOCP
5666 set try
5667 if eval $compile; then
5668         val="$define"
5669         echo "You have int64_t."
5670 else
5671         val="$undef"
5672         echo "You do not have int64_t."
5673 fi
5674 $rm_try
5675 set d_int64_t
5676 eval $setvar
5677
5678 : Check if 64bit ints have a quad type
5679 echo " "
5680 echo "Checking which 64-bit integer type we could use..." >&4
5681
5682 case "$intsize" in
5683 8) val=int
5684    set quadtype
5685    eval $setvar
5686    val='"unsigned int"'
5687    set uquadtype
5688    eval $setvar
5689    quadkind=1
5690    ;;
5691 *) case "$longsize" in
5692    8) val=long
5693       set quadtype
5694       eval $setvar
5695       val='"unsigned long"'
5696       set uquadtype
5697       eval $setvar
5698       quadkind=2
5699       ;;
5700    *) case "$d_longlong:$longlongsize" in
5701       define:8)
5702         val='"long long"'
5703         set quadtype
5704         eval $setvar
5705         val='"unsigned long long"'
5706         set uquadtype
5707         eval $setvar
5708         quadkind=3
5709         ;;
5710       *) case "$d_int64_t" in
5711          define)
5712            val=int64_t
5713            set quadtype
5714            eval $setvar
5715            val=uint64_t
5716            set uquadtype
5717            eval $setvar
5718            quadkind=4
5719            ;;
5720          esac
5721          ;;
5722       esac
5723       ;;
5724    esac
5725    ;;
5726 esac
5727
5728 case "$quadtype" in
5729 '')     echo "Alas, no 64-bit integer types in sight." >&4
5730         d_quad="$undef"
5731         ;;
5732 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5733         d_quad="$define"
5734         ;;
5735 esac
5736
5737 : Do we want 64bit support
5738 case "$uselonglong" in
5739 "$define"|true|[yY]*)
5740         cat <<EOM >&4
5741
5742 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5743 EOM
5744         use64bitint="$define"
5745         ;;
5746 esac
5747 case "$use64bits" in
5748 "$define"|true|[yY]*)
5749         cat <<EOM >&4
5750
5751 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5752 EOM
5753         use64bitint="$define"
5754         ;;
5755 esac
5756 case "$use64bitints" in
5757 "$define"|true|[yY]*)
5758         cat <<EOM >&4
5759
5760 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5761 EOM
5762         use64bitint="$define"
5763         ;;
5764 esac
5765 case "$use64bitsint" in
5766 "$define"|true|[yY]*)
5767         cat <<EOM >&4
5768
5769 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5770 EOM
5771         use64bitint="$define"
5772         ;;
5773 esac
5774 case "$uselonglongs" in
5775 "$define"|true|[yY]*)
5776         cat <<EOM >&4
5777
5778 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5779 EOM
5780         use64bitint="$define"
5781         ;;
5782 esac
5783 case "$use64bitsall" in
5784 "$define"|true|[yY]*)
5785         cat <<EOM >&4
5786
5787 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5788 EOM
5789         use64bitall="$define"
5790         ;;
5791 esac
5792
5793 case "$ccflags" in
5794 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5795 esac
5796 case "$use64bitall" in
5797 "$define"|true|[yY]*) use64bitint="$define" ;;
5798 esac
5799
5800 case "$longsize" in
5801 8) cat <<EOM
5802
5803 You have natively 64-bit long integers.
5804 EOM
5805    val="$define"
5806    ;;
5807 *) case "$use64bitint" in
5808    "$define"|true|[yY]*) dflt='y';;
5809    *) dflt='n';;
5810    esac
5811    case "$d_quad" in
5812    "$define") ;;
5813    *) dflt='n' ;;
5814    esac
5815    cat <<EOM
5816
5817 Perl can be built to take advantage of 64-bit integer types
5818 on some systems.  To do so, Configure can be run with -Duse64bitint.
5819 Choosing this option will most probably introduce binary incompatibilities.
5820
5821 If this doesn't make any sense to you, just accept the default '$dflt'.
5822 (The default has been chosen based on your configuration.)
5823 EOM
5824    rp='Try to use 64-bit integers, if available?'
5825    . ./myread
5826    case "$ans" in
5827    [yY]*) val="$define" ;;
5828    *)     val="$undef"  ;;
5829    esac
5830    ;;
5831 esac
5832 set use64bitint
5833 eval $setvar
5834
5835 case "$use64bitall" in
5836 "$define"|true|[yY]*) dflt='y' ;;
5837 *) case "$longsize" in
5838    8) dflt='y' ;;
5839    *) dflt='n' ;;
5840    esac
5841    ;;
5842 esac
5843 cat <<EOM
5844
5845 You may also choose to try maximal 64-bitness.  It means using as much
5846 64-bitness as possible on the platform.  This in turn means even more
5847 binary incompatibilities.  On the other hand, your platform may not
5848 have any more 64-bitness available than what you already have chosen.
5849
5850 If this doesn't make any sense to you, just accept the default '$dflt'.
5851 (The default has been chosen based on your configuration.)
5852 EOM
5853 rp='Try to use maximal 64-bit support, if available?'
5854 . ./myread
5855 case "$ans" in
5856 [yY]*) val="$define" ;;
5857 *)     val="$undef"  ;;
5858 esac
5859 set use64bitall
5860 eval $setvar
5861 case "$use64bitall" in
5862 "$define")
5863         case "$use64bitint" in
5864         "$undef")
5865                 cat <<EOM
5866
5867 Since you have chosen a maximally 64-bit build, I'm also turning on
5868 the use of 64-bit integers.
5869 EOM
5870                 use64bitint="$define" ;;
5871         esac
5872         ;;
5873 esac
5874
5875 : Look for a hint-file generated 'call-back-unit'.  If the
5876 : user has specified that a 64-bit perl is to be built,
5877 : we may need to set or change some other defaults.
5878 if $test -f use64bitint.cbu; then
5879         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5880         . ./use64bitint.cbu
5881 fi
5882 case "$use64bitint" in
5883 "$define"|true|[yY]*)
5884         case "$longsize" in
5885         4) case "$archname64" in
5886            '') archname64=64int ;;
5887            esac
5888            ;;
5889         esac
5890         ;;
5891 esac
5892
5893 : Look for a hint-file generated 'call-back-unit'.  If the
5894 : user has specified that a maximally 64-bit perl is to be built,
5895 : we may need to set or change some other defaults.
5896 if $test -f use64bitall.cbu; then
5897         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5898         . ./use64bitall.cbu
5899 fi
5900 case "$use64bitall" in
5901 "$define"|true|[yY]*)
5902         case "$longsize" in
5903         4) case "$archname64" in
5904            ''|64int) archname64=64all ;;
5905            esac
5906            ;;
5907         esac
5908         ;;
5909 esac
5910
5911 case "$d_quad:$use64bitint" in
5912 $undef:$define)
5913         cat >&4 <<EOF
5914
5915 *** You have chosen to use 64-bit integers,
5916 *** but none can be found.
5917 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5918 *** Cannot continue, aborting.
5919
5920 EOF
5921         exit 1
5922         ;;
5923 esac
5924
5925 : check for length of double
5926 echo " "
5927 case "$doublesize" in
5928 '')
5929         echo "Checking to see how big your double precision numbers are..." >&4
5930         $cat >try.c <<EOCP
5931 #include <stdio.h>
5932 #$i_stdlib I_STDLIB
5933 #ifdef I_STDLIB
5934 #include <stdlib.h>
5935 #endif
5936 int main()
5937 {
5938     printf("%d\n", (int)sizeof(double));
5939     exit(0);
5940 }
5941 EOCP
5942         set try
5943         if eval $compile_ok; then
5944                 doublesize=`$run ./try`
5945                 echo "Your double is $doublesize bytes long."
5946         else
5947                 dflt='8'
5948                 echo "(I can't seem to compile the test program.  Guessing...)"
5949                 rp="What is the size of a double precision number (in bytes)?"
5950                 . ./myread
5951                 doublesize="$ans"
5952         fi
5953         ;;
5954 esac
5955 $rm_try
5956
5957 : check for long doubles
5958 echo " "
5959 echo "Checking to see if you have long double..." >&4
5960 echo 'int main() { long double x = 7.0; }' > try.c
5961 set try
5962 if eval $compile; then
5963         val="$define"
5964         echo "You have long double."
5965 else
5966         val="$undef"
5967         echo "You do not have long double."
5968 fi
5969 $rm_try
5970 set d_longdbl
5971 eval $setvar
5972
5973 : check for length of long double
5974 case "${d_longdbl}${longdblsize}" in
5975 $define)
5976         echo " "
5977         echo "Checking to see how big your long doubles are..." >&4
5978         $cat >try.c <<'EOCP'
5979 #include <stdio.h>
5980 int main()
5981 {
5982         printf("%d\n", sizeof(long double));
5983 }
5984 EOCP
5985         set try
5986         set try
5987         if eval $compile; then
5988                 longdblsize=`$run ./try`
5989                 echo "Your long doubles are $longdblsize bytes long."
5990         else
5991                 dflt='8'
5992                 echo " "
5993                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5994                 rp="What is the size of a long double (in bytes)?"
5995                 . ./myread
5996                 longdblsize="$ans"
5997         fi
5998         if $test "X$doublesize" = "X$longdblsize"; then
5999                 echo "That isn't any different from an ordinary double."
6000                 echo "I'll keep your setting anyway, but you may see some"
6001                 echo "harmless compilation warnings."
6002         fi
6003         ;;
6004 esac
6005 $rm_try
6006
6007 : determine the architecture name
6008 echo " "
6009 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6010         tarch=`arch`"-$osname"
6011 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6012         if uname -m > tmparch 2>&1 ; then
6013                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6014                         -e 's/$/'"-$osname/" tmparch`
6015         else
6016                 tarch="$osname"
6017         fi
6018         $rm -f tmparch
6019 else
6020         tarch="$osname"
6021 fi
6022 case "$myarchname" in
6023 ''|"$tarch") ;;
6024 *)
6025         echo "(Your architecture name used to be $myarchname.)"
6026         archname=''
6027         ;;
6028 esac
6029 case "$targetarch" in
6030 '') ;;
6031 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6032 esac
6033 myarchname="$tarch"
6034 case "$archname" in
6035 '') dflt="$tarch";;
6036 *) dflt="$archname";;
6037 esac
6038 rp='What is your architecture name'
6039 . ./myread
6040 archname="$ans"
6041 case "$usethreads" in
6042 $define)
6043         echo "Threads selected." >&4
6044         case "$archname" in
6045         *-thread*) echo "...and architecture name already has -thread." >&4
6046                 ;;
6047         *)      archname="$archname-thread"
6048                 echo "...setting architecture name to $archname." >&4
6049                 ;;
6050         esac
6051         ;;
6052 esac
6053 case "$usemultiplicity" in
6054 $define)
6055         echo "Multiplicity selected." >&4
6056         case "$archname" in
6057         *-multi*) echo "...and architecture name already has -multi." >&4
6058                 ;;
6059         *)      archname="$archname-multi"
6060                 echo "...setting architecture name to $archname." >&4
6061                 ;;
6062         esac
6063         ;;
6064 esac
6065 case "$use64bitint$use64bitall" in
6066 *"$define"*)
6067         case "$archname64" in
6068         '')
6069                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6070                 ;;
6071         *)
6072                 case "$use64bitint" in
6073                 "$define") echo "64 bit integers selected." >&4 ;;
6074                 esac
6075                 case "$use64bitall" in
6076                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6077                 esac
6078                 case "$archname" in
6079                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6080                         ;;
6081                 *)      archname="$archname-$archname64"
6082                         echo "...setting architecture name to $archname." >&4
6083                         ;;
6084                 esac
6085                 ;;
6086         esac
6087 esac
6088 case "$uselongdouble" in
6089 $define)
6090         echo "Long doubles selected." >&4
6091         case "$longdblsize" in
6092         $doublesize)
6093                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6094                 ;;
6095         *)
6096                 case "$archname" in
6097                 *-ld*) echo "...and architecture name already has -ld." >&4
6098                         ;;
6099                 *)      archname="$archname-ld"
6100                         echo "...setting architecture name to $archname." >&4
6101                         ;;
6102                 esac
6103                 ;;
6104         esac
6105         ;;
6106 esac
6107 case "$useperlio" in
6108 $define)
6109         echo "Perlio selected." >&4
6110         ;;
6111 *)
6112         echo "Perlio not selected, using stdio." >&4
6113         case "$archname" in
6114         *-stdio*) echo "...and architecture name already has -stdio." >&4
6115                 ;;
6116         *)      archname="$archname-stdio"
6117                 echo "...setting architecture name to $archname." >&4
6118                 ;;
6119         esac
6120         ;;
6121 esac
6122 if $test -f archname.cbu; then
6123         echo "Your platform has some specific hints for architecture name, using them..."
6124         . ./archname.cbu
6125 fi
6126
6127 : set the prefixit variable, to compute a suitable default value
6128 prefixit='case "$3" in
6129 ""|none)
6130         case "$oldprefix" in
6131         "") eval "$1=\"\$$2\"";;
6132         *)
6133                 case "$3" in
6134                 "") eval "$1=";;
6135                 none)
6136                         eval "tp=\"\$$2\"";
6137                         case "$tp" in
6138                         ""|" ") eval "$1=\"\$$2\"";;
6139                         *) eval "$1=";;
6140                         esac;;
6141                 esac;;
6142         esac;;
6143 *)
6144         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6145         case "$tp" in
6146         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6147         /*-$oldprefix/*|\~*-$oldprefix/*)
6148                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6149         *) eval "$1=\"\$$2\"";;
6150         esac;;
6151 esac'
6152
6153 : determine installation style
6154 : For now, try to deduce it from prefix unless it is already set.
6155 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6156 case "$installstyle" in
6157 '')     case "$prefix" in
6158                 *perl*) dflt='lib';;
6159                 *) dflt='lib/perl5' ;;
6160         esac
6161         ;;
6162 *)      dflt="$installstyle" ;;
6163 esac
6164 : Probably not worth prompting for this since we prompt for all
6165 : the directories individually, and the prompt would be too long and
6166 : confusing anyway.
6167 installstyle=$dflt
6168
6169 : determine where public executables go
6170 echo " "
6171 set dflt bin bin
6172 eval $prefixit
6173 fn=d~
6174 rp='Pathname where the public executables will reside?'
6175 . ./getfile
6176 if $test "X$ansexp" != "X$binexp"; then
6177         installbin=''
6178 fi
6179 prefixvar=bin
6180 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6181 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6182 :     this via initialinstalllocation
6183 . ./setprefixvar
6184
6185 case "$userelocatableinc" in
6186 $define|true|[yY]*)     dflt='y' ;;
6187 *)                      dflt='n' ;;
6188 esac
6189 cat <<EOM
6190
6191 Would you like to build Perl so that the installation is relocatable, so that
6192 library paths in @INC are determined relative to the path of the perl binary?
6193 This is not advised for system Perl installs, or if you need to run setid
6194 scripts or scripts under taint mode.
6195
6196 If this doesn't make any sense to you, just accept the default '$dflt'.
6197 EOM
6198 rp='Use relocatable @INC?'
6199 . ./myread
6200 case "$ans" in
6201 y|Y)    val="$define" ;;
6202 *)      val="$undef"  ;;
6203 esac
6204 set userelocatableinc
6205 eval $setvar
6206
6207 initialinstalllocation="$binexp"
6208 : Default prefix is now "up one level from where the binaries are"
6209 case "$userelocatableinc" in
6210 $define|true|[yY]*)
6211     bin=".../"
6212     binexp=".../"
6213     prefix=".../.."
6214     prefixexp=".../.."
6215     installprefixexp=".../.."
6216     ;;
6217 esac
6218
6219 : determine where private library files go
6220 : Usual default is /usr/local/lib/perl5/$version.
6221 : Also allow things like /opt/perl/lib/$version, since
6222 : /opt/perl/lib/perl5... would be redundant.
6223 : The default "style" setting is made in installstyle.U
6224 case "$installstyle" in
6225 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6226 *)       set dflt privlib lib/$version ;;
6227 esac
6228 eval $prefixit
6229 $cat <<EOM
6230
6231 There are some auxiliary files for $package that need to be put into a
6232 private library directory that is accessible by everyone.
6233
6234 EOM
6235 fn=$binexp
6236 fn=d~+
6237 rp='Pathname where the private library files will reside?'
6238 . ./getfile
6239 prefixvar=privlib
6240 . ./setprefixvar
6241
6242 : set the prefixup variable, to restore leading tilda escape
6243 prefixup='case "$prefixexp" in
6244 "$prefix") ;;
6245 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6246 esac'
6247
6248 : determine where public architecture dependent libraries go
6249 set archlib archlib
6250 eval $prefixit
6251 : privlib default is /usr/local/lib/$package/$version
6252 : archlib default is /usr/local/lib/$package/$version/$archname
6253 : privlib may have an optional trailing /share.
6254 tdflt=`echo $privlib | $sed 's,/share$,,'`
6255 tdflt=$tdflt/$archname
6256 case "$archlib" in
6257 '')     dflt=$tdflt
6258         ;;
6259 *)      dflt="$archlib"
6260     ;;
6261 esac
6262 $cat <<EOM
6263
6264 $spackage contains architecture-dependent library files.  If you are
6265 sharing libraries in a heterogeneous environment, you might store
6266 these files in a separate location.  Otherwise, you can just include
6267 them with the rest of the public library files.
6268
6269 EOM
6270 fn=$binexp
6271 fn=d+~
6272 rp='Where do you want to put the public architecture-dependent libraries?'
6273 . ./getfile
6274 prefixvar=archlib
6275 . ./setprefixvar
6276 if $test X"$archlib" = X"$privlib"; then
6277         d_archlib="$undef"
6278 else
6279         d_archlib="$define"
6280 fi
6281
6282 : see if setuid scripts can be secure
6283 $cat <<EOM
6284
6285 Some kernels have a bug that prevents setuid #! scripts from being
6286 secure.  Some sites have disabled setuid #! scripts because of this.
6287
6288 First let's decide if your kernel supports secure setuid #! scripts.
6289 (If setuid #! scripts would be secure but have been disabled anyway,
6290 don't say that they are secure if asked.)
6291
6292 EOM
6293
6294 val="$undef"
6295 if $test -d /dev/fd; then
6296         echo "#!$ls" >reflect
6297         chmod +x,u+s reflect
6298         ./reflect >flect 2>&1
6299         if $contains "/dev/fd" flect >/dev/null; then
6300                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6301                 val="$define"
6302         else
6303                 $cat <<EOM
6304 If you are not sure if they are secure, I can check but I'll need a
6305 username and password different from the one you are using right now.
6306 If you don't have such a username or don't want me to test, simply
6307 enter 'none'.
6308
6309 EOM
6310                 rp='Other username to test security of setuid scripts with?'
6311                 dflt='none'
6312                 . ./myread
6313                 case "$ans" in
6314                 n|none)
6315                         case "$d_suidsafe" in
6316                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6317                                 dflt=n;;
6318                         "$undef")
6319                                 echo "Well, the $hint value is *not* secure." >&4
6320                                 dflt=n;;
6321                         *)      echo "Well, the $hint value *is* secure." >&4
6322                                 dflt=y;;
6323                         esac
6324                         ;;
6325                 *)
6326                         $rm -f reflect flect
6327                         echo "#!$ls" >reflect
6328                         chmod +x,u+s reflect
6329                         echo >flect
6330                         chmod a+w flect
6331                         echo '"su" will (probably) prompt you for '"$ans's password."
6332                         su $ans -c './reflect >flect'
6333                         if $contains "/dev/fd" flect >/dev/null; then
6334                                 echo "Okay, it looks like setuid scripts are secure." >&4
6335                                 dflt=y
6336                         else
6337                                 echo "I don't think setuid scripts are secure." >&4
6338                                 dflt=n
6339                         fi
6340                         ;;
6341                 esac
6342                 rp='Does your kernel have *secure* setuid scripts?'
6343                 . ./myread
6344                 case "$ans" in
6345                 [yY]*)  val="$define";;
6346                 *)      val="$undef";;
6347                 esac
6348         fi
6349 else
6350         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6351         echo "(That's for file descriptors, not floppy disks.)"
6352         val="$undef"
6353 fi
6354 set d_suidsafe
6355 eval $setvar
6356
6357 $rm -f reflect flect
6358
6359 : now see if they want to do setuid emulation
6360 echo " "
6361 val="$undef"
6362 case "$d_suidsafe" in
6363 "$define")
6364         val="$undef"
6365         echo "No need to emulate SUID scripts since they are secure here." >&4
6366         ;;
6367 *)
6368         $cat <<EOM
6369 Some systems have disabled setuid scripts, especially systems where
6370 setuid scripts cannot be secure.  On systems where setuid scripts have
6371 been disabled, the setuid/setgid bits on scripts are currently
6372 useless.  It is possible for $package to detect those bits and emulate
6373 setuid/setgid in a secure fashion.  This emulation will only work if
6374 setuid scripts have been disabled in your kernel.
6375
6376 EOM
6377         case "$d_dosuid" in
6378         "$define") dflt=y ;;
6379         *) dflt=n ;;
6380         esac
6381         rp="Do you want to do setuid/setgid emulation?"
6382         . ./myread
6383         case "$ans" in
6384         [yY]*)  val="$define";;
6385         *)      val="$undef";;
6386         esac
6387         ;;
6388 esac
6389 set d_dosuid
6390 eval $setvar
6391
6392 : Find perl5.005 or later.
6393 echo "Looking for a previously installed perl5.005 or later... "
6394 case "$perl5" in
6395 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6396                 : Check if this perl is recent and can load a simple module
6397                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6398                         perl5=$tdir/perl
6399                         break;
6400                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6401                         perl5=$tdir/perl5
6402                         break;
6403                 fi
6404         done
6405         ;;
6406 *)      perl5="$perl5"
6407         ;;
6408 esac
6409 case "$perl5" in
6410 '')     echo "None found.  That's ok.";;
6411 *)      echo "Using $perl5." ;;
6412 esac
6413
6414 : Set the siteprefix variables
6415 $cat <<EOM
6416
6417 After $package is installed, you may wish to install various
6418 add-on modules and utilities.  Typically, these add-ons will
6419 be installed under $prefix with the rest
6420 of this package.  However, you may wish to install such add-ons
6421 elsewhere under a different prefix.
6422
6423 If you do not wish to put everything under a single prefix, that's
6424 ok.  You will be prompted for the individual locations; this siteprefix
6425 is only used to suggest the defaults.
6426
6427 The default should be fine for most people.
6428
6429 EOM
6430 fn=d~+
6431 rp='Installation prefix to use for add-on modules and utilities?'
6432 : XXX Here might be another good place for an installstyle setting.
6433 case "$siteprefix" in
6434 '') dflt=$prefix ;;
6435 *)  dflt=$siteprefix ;;
6436 esac
6437 . ./getfile
6438 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6439 oldsiteprefix=''
6440 case "$siteprefix" in
6441 '') ;;
6442 *)      case "$ans" in
6443         "$prefix") ;;
6444         *) oldsiteprefix="$prefix";;
6445         esac
6446         ;;
6447 esac
6448 siteprefix="$ans"
6449 siteprefixexp="$ansexp"
6450
6451 : determine where site specific libraries go.
6452 : Usual default is /usr/local/lib/perl5/site_perl/$version
6453 : The default "style" setting is made in installstyle.U
6454 : XXX No longer works with Prefixit stuff.
6455 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6456 case "$sitelib" in
6457 '') case "$installstyle" in
6458         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6459         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6460         esac
6461         ;;
6462 *)      dflt="$sitelib"
6463         ;;
6464 esac
6465 $cat <<EOM
6466
6467 The installation process will create a directory for
6468 site-specific extensions and modules.  Most users find it convenient
6469 to place all site-specific files in this directory rather than in the
6470 main distribution directory.
6471
6472 EOM
6473 fn=d~+
6474 rp='Pathname for the site-specific library files?'
6475 . ./getfile
6476 prefixvar=sitelib
6477 . ./setprefixvar
6478 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6479
6480 : Determine list of previous versions to include in @INC
6481 $cat > getverlist <<EOPL
6482 #!$perl5 -w
6483 use File::Basename;
6484 \$api_versionstring = "$api_versionstring";
6485 \$version = "$version";
6486 \$stem = "$sitelib_stem";
6487 \$archname = "$archname";
6488 EOPL
6489         $cat >> getverlist <<'EOPL'
6490 # The list found is store twice for each entry: the original name, and
6491 # the binary broken down version as pack "sss", so sorting is easy and
6492 # unambiguous. This will work for all versions that have a maximum of
6493 # three digit groups, separate by '.'s or '_'s. Names are extended with
6494 # ".0.0" to ensure at least three elements for the pack.
6495 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6496
6497 # Can't have leading @ because metaconfig interprets it as a command!
6498 ;@inc_version_list=();
6499 # XXX Redo to do opendir/readdir?
6500 if (-d $stem) {
6501     chdir($stem);
6502     ;@candidates = map {
6503         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6504 }
6505 else {
6506     ;@candidates = ();
6507 }
6508
6509 ($pversion, $aversion, $vsn5005) = map {
6510     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6511 foreach $d (@candidates) {
6512     if ($d->[1] lt $pversion) {
6513         if ($d->[1] ge $aversion) {
6514             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6515         }
6516         elsif ($d->[1] ge $vsn5005) {
6517             unshift(@inc_version_list, grep { -d } $d->[0]);
6518         }
6519     }
6520     else {
6521         # Skip newer version.  I.e. don't look in
6522         # 5.7.0 if we're installing 5.6.1.
6523     }
6524 }
6525
6526 if (@inc_version_list) {
6527     print join(' ', @inc_version_list);
6528 }
6529 else {
6530     # Blank space to preserve value for next Configure run.
6531     print " ";
6532 }
6533 EOPL
6534 chmod +x getverlist
6535 case "$inc_version_list" in
6536 '')     if test -x "$perl5$exe_ext"; then
6537                 dflt=`$perl5 getverlist`
6538         else
6539                 dflt='none'
6540         fi
6541         ;;
6542 $undef) dflt='none' ;;
6543 *)  eval dflt=\"$inc_version_list\" ;;
6544 esac
6545 case "$dflt" in
6546 ''|' ') dflt=none ;;
6547 esac
6548 case "$dflt" in
6549 5.005) dflt=none ;;
6550 esac
6551 $cat <<EOM
6552
6553 In order to ease the process of upgrading, this version of perl
6554 can be configured to use modules built and installed with earlier
6555 versions of perl that were installed under $prefix.  Specify here
6556 the list of earlier versions that this version of perl should check.
6557 If Configure detected no earlier versions of perl installed under
6558 $prefix, then the list will be empty.  Answer 'none' to tell perl
6559 to not search earlier versions.
6560
6561 The default should almost always be sensible, so if you're not sure,
6562 just accept the default.
6563 EOM
6564
6565 rp='List of earlier versions to include in @INC?'
6566 . ./myread
6567 case "$ans" in
6568 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6569 *) inc_version_list="$ans" ;;
6570 esac
6571 case "$inc_version_list" in
6572 ''|' ')
6573         inc_version_list_init='0'
6574         d_inc_version_list="$undef"
6575         ;;
6576 *)      inc_version_list_init=`echo $inc_version_list |
6577                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6578         d_inc_version_list="$define"
6579         ;;
6580 esac
6581 $rm -f getverlist
6582
6583 : see if malloc/malloc.h has to be included
6584 set malloc/malloc.h i_mallocmalloc
6585 eval $inhdr
6586
6587 : see if this is a malloc.h system
6588 : we want a real compile instead of Inhdr because some systems have a
6589 : malloc.h that just gives a compile error saying to use stdlib.h instead
6590 echo " "
6591 $cat >try.c <<EOCP
6592 #include <stdlib.h>
6593 #include <malloc.h>
6594 #$i_mallocmalloc I_MALLOCMALLOC
6595 #ifdef I_MALLOCMALLOC
6596 # include <malloc/malloc.h>
6597 #endif
6598
6599 int main () { return 0; }
6600 EOCP
6601 set try
6602 if eval $compile; then
6603     echo "<malloc.h> found." >&4
6604     val="$define"
6605 else
6606     echo "<malloc.h> NOT found." >&4
6607     val="$undef"
6608 fi
6609 $rm_try
6610 set i_malloc
6611 eval $setvar
6612
6613 : check for void type
6614 echo " "
6615 echo "Checking to see how well your C compiler groks the void type..." >&4
6616 case "$voidflags" in
6617 '')
6618         $cat >try.c <<EOCP
6619 #$i_stdlib I_STDLIB
6620 #ifdef I_STDLIB
6621 #include <stdlib.h>
6622 #endif
6623 #if TRY & 1
6624 void sub() {
6625 #else
6626 sub() {
6627 #endif
6628         extern void moo();      /* function returning void */
6629         void (*goo)();          /* ptr to func returning void */
6630 #if TRY & 8
6631         void *hue;              /* generic ptr */
6632 #endif
6633 #if TRY & 2
6634         void (*foo[10])();
6635 #endif
6636
6637 #if TRY & 4
6638         if(goo == moo) {
6639                 exit(0);
6640         }
6641 #endif
6642         exit(0);
6643 }
6644 int main() { sub(); }
6645 EOCP
6646         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6647                 voidflags=$defvoidused
6648         echo "Good.  It appears to support void to the level $package wants.">&4
6649                 if $contains warning .out >/dev/null 2>&1; then
6650                         echo "However, you might get some warnings that look like this:"
6651                         $cat .out
6652                 fi
6653         else
6654 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6655                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6656                         echo "It supports 1..."
6657                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6658                                 echo "It also supports 2..."
6659                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6660                                         voidflags=7
6661                                         echo "And it supports 4 but not 8 definitely."
6662                                 else
6663                                         echo "It doesn't support 4..."
6664                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6665                                                 voidflags=11
6666                                                 echo "But it supports 8."
6667                                         else
6668                                                 voidflags=3
6669                                                 echo "Neither does it support 8."
6670                                         fi
6671                                 fi
6672                         else
6673                                 echo "It does not support 2..."
6674                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6675                                         voidflags=13
6676                                         echo "But it supports 4 and 8."
6677                                 else
6678                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6679                                                 voidflags=5
6680                                                 echo "And it supports 4 but has not heard about 8."
6681                                         else
6682                                                 echo "However it supports 8 but not 4."
6683                                         fi
6684                                 fi
6685                         fi
6686                 else
6687                         echo "There is no support at all for void."
6688                         voidflags=0
6689                 fi
6690         fi
6691 esac
6692 case "$voidflags" in
6693 "$defvoidused") ;;
6694 *)      $cat >&4 <<'EOM'
6695   Support flag bits are:
6696     1: basic void declarations.
6697     2: arrays of pointers to functions returning void.
6698     4: operations between pointers to and addresses of void functions.
6699     8: generic void pointers.
6700 EOM
6701         dflt="$voidflags";
6702         rp="Your void support flags add up to what?"
6703         . ./myread
6704         voidflags="$ans"
6705         ;;
6706 esac
6707 $rm_try
6708
6709 : check for length of pointer
6710 echo " "
6711 case "$ptrsize" in
6712 '')
6713         echo "Checking to see how big your pointers are..." >&4
6714         if test "$voidflags" -gt 7; then
6715                 echo '#define VOID_PTR char *' > try.c
6716         else
6717                 echo '#define VOID_PTR void *' > try.c
6718         fi
6719         $cat >>try.c <<EOCP
6720 #include <stdio.h>
6721 #$i_stdlib I_STDLIB
6722 #ifdef I_STDLIB
6723 #include <stdlib.h>
6724 #endif
6725 int main()
6726 {
6727     printf("%d\n", (int)sizeof(VOID_PTR));
6728     exit(0);
6729 }
6730 EOCP
6731         set try
6732         if eval $compile_ok; then
6733                 ptrsize=`$run ./try`
6734                 echo "Your pointers are $ptrsize bytes long."
6735         else
6736                 dflt='4'
6737                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6738                 rp="What is the size of a pointer (in bytes)?"
6739                 . ./myread
6740                 ptrsize="$ans"
6741         fi
6742         ;;
6743 esac
6744 $rm_try
6745 case "$use64bitall" in
6746 "$define"|true|[yY]*)
6747         case "$ptrsize" in
6748         4)      cat <<EOM >&4
6749
6750 *** You have chosen a maximally 64-bit build,
6751 *** but your pointers are only 4 bytes wide.
6752 *** Please rerun Configure without -Duse64bitall.
6753 EOM
6754                 case "$d_quad" in
6755                 define)
6756                         cat <<EOM >&4
6757 *** Since you have quads, you could possibly try with -Duse64bitint.
6758 EOM
6759                         ;;
6760                 esac
6761                 cat <<EOM >&4
6762 *** Cannot continue, aborting.
6763
6764 EOM
6765
6766                 exit 1
6767                 ;;
6768         esac
6769         ;;
6770 esac
6771
6772
6773 : determine whether to use malloc wrapping
6774 echo " "
6775 case "$usemallocwrap" in
6776 [yY]*|true|$define)     dflt='y' ;;
6777 [nN]*|false|$undef)     dflt='n' ;;
6778 *)      case "$usedevel" in
6779         [yY]*|true|$define)     dflt='y' ;;
6780         *) dflt='n' ;;
6781         esac
6782         ;;
6783 esac
6784 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6785 . ./myread
6786 usemallocwrap="$ans"
6787 case "$ans" in
6788 y*|true)
6789         usemallocwrap="$define" ;;
6790 *)
6791         usemallocwrap="$undef" ;;
6792 esac
6793
6794 : determine which malloc to compile in
6795 echo " "
6796 case "$usemymalloc" in
6797 [yY]*|true|$define)     dflt='y' ;;
6798 [nN]*|false|$undef)     dflt='n' ;;
6799 *)      case "$ptrsize" in
6800         4) dflt='y' ;;
6801         *) dflt='n' ;;
6802         esac
6803         ;;
6804 esac
6805 rp="Do you wish to attempt to use the malloc that comes with $package?"
6806 . ./myread
6807 usemymalloc="$ans"
6808 case "$ans" in
6809 y*|true)
6810         usemymalloc='y'
6811         mallocsrc='malloc.c'
6812         mallocobj="malloc$_o"
6813         d_mymalloc="$define"
6814         case "$libs" in
6815         *-lmalloc*)
6816                 : Remove malloc from list of libraries to use
6817                 echo "Removing unneeded -lmalloc from library list" >&4
6818                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6819                 shift
6820                 libs="$*"
6821                 echo "libs = $libs" >&4
6822                 ;;
6823         esac
6824         ;;
6825 *)
6826         usemymalloc='n'
6827         mallocsrc=''
6828         mallocobj=''
6829         d_mymalloc="$undef"
6830         ;;
6831 esac
6832
6833 : compute the return types of malloc and free
6834 echo " "
6835 $cat >malloc.c <<END
6836 #$i_malloc I_MALLOC
6837 #$i_stdlib I_STDLIB
6838 #include <stdio.h>
6839 #include <sys/types.h>
6840 #ifdef I_MALLOC
6841 #include <malloc.h>
6842 #endif
6843 #ifdef I_STDLIB
6844 #include <stdlib.h>
6845 #endif
6846 #ifdef TRY_MALLOC
6847 void *malloc();
6848 #endif
6849 #ifdef TRY_FREE
6850 void free();
6851 #endif
6852 END
6853 case "$malloctype" in
6854 '')
6855         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6856                 malloctype='void *'
6857         else
6858                 malloctype='char *'
6859         fi
6860         ;;
6861 esac
6862 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6863
6864 case "$freetype" in
6865 '')
6866         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6867                 freetype='void'
6868         else
6869                 freetype='int'
6870         fi
6871         ;;
6872 esac
6873 echo "Your system uses $freetype free(), it would seem." >&4
6874 $rm -f malloc.[co]
6875 : determine where site specific architecture-dependent libraries go.
6876 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6877 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6878 : sitelib may have an optional trailing /share.
6879 case "$sitearch" in
6880 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6881         dflt="$dflt/$archname"
6882         ;;
6883 *)      dflt="$sitearch"
6884         ;;
6885 esac
6886 set sitearch sitearch none
6887 eval $prefixit
6888 $cat <<EOM
6889
6890 The installation process will also create a directory for
6891 architecture-dependent site-specific extensions and modules.
6892
6893 EOM
6894 fn=d~+
6895 rp='Pathname for the site-specific architecture-dependent library files?'
6896 . ./getfile
6897 prefixvar=sitearch
6898 . ./setprefixvar
6899 if $test X"$sitearch" = X"$sitelib"; then
6900         d_sitearch="$undef"
6901 else
6902         d_sitearch="$define"
6903 fi
6904
6905 : Set the vendorprefix variables
6906 $cat <<EOM
6907
6908 The installation process will also create a directory for
6909 vendor-supplied add-ons.  Vendors who supply perl with their system
6910 may find it convenient to place all vendor-supplied files in this
6911 directory rather than in the main distribution directory.  This will
6912 ease upgrades between binary-compatible maintenance versions of perl.
6913
6914 Of course you may also use these directories in whatever way you see
6915 fit.  For example, you might use them to access modules shared over a
6916 company-wide network.
6917
6918 The default answer should be fine for most people.
6919 This causes further questions about vendor add-ons to be skipped
6920 and no vendor-specific directories will be configured for perl.
6921
6922 EOM
6923 rp='Do you want to configure vendor-specific add-on directories?'
6924 case "$usevendorprefix" in
6925 define|true|[yY]*) dflt=y ;;
6926 *)      : User may have set vendorprefix directly on Configure command line.
6927         case "$vendorprefix" in
6928         ''|' ') dflt=n ;;
6929         *)      dflt=y ;;
6930         esac
6931         ;;
6932 esac
6933 . ./myread
6934 case "$ans" in
6935 [yY]*)  fn=d~+
6936         rp='Installation prefix to use for vendor-supplied add-ons?'
6937         case "$vendorprefix" in
6938         '') dflt='' ;;
6939         *)  dflt=$vendorprefix ;;
6940         esac
6941         . ./getfile
6942         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6943         oldvendorprefix=''
6944         case "$vendorprefix" in
6945         '') ;;
6946         *)      case "$ans" in
6947                 "$prefix") ;;
6948                 *) oldvendorprefix="$prefix";;
6949                 esac
6950                 ;;
6951         esac
6952         usevendorprefix="$define"
6953         vendorprefix="$ans"
6954         vendorprefixexp="$ansexp"
6955         ;;
6956 *)      usevendorprefix="$undef"
6957         vendorprefix=''
6958         vendorprefixexp=''
6959         ;;
6960 esac
6961
6962 : Set the vendorlib variables
6963 case "$vendorprefix" in
6964 '')     d_vendorlib="$undef"
6965         vendorlib=''
6966         vendorlibexp=''
6967         ;;
6968 *)      d_vendorlib="$define"
6969         : determine where vendor-supplied modules go.
6970         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6971         case "$vendorlib" in
6972         '')
6973                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6974                 case "$installstyle" in
6975                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6976                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6977                 esac
6978                 ;;
6979         *)      dflt="$vendorlib"
6980                 ;;
6981         esac
6982         fn=d~+
6983         rp='Pathname for the vendor-supplied library files?'
6984         . ./getfile
6985         vendorlib="$ans"
6986         vendorlibexp="$ansexp"
6987         ;;
6988 esac
6989 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6990 prefixvar=vendorlib
6991 . ./installprefix
6992
6993 : Set the vendorarch variables
6994 case "$vendorprefix" in
6995 '')     d_vendorarch="$undef"
6996         vendorarch=''
6997         vendorarchexp=''
6998         ;;
6999 *)      d_vendorarch="$define"
7000         : determine where vendor-supplied architecture-dependent libraries go.
7001         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7002         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7003         : vendorlib may have an optional trailing /share.
7004         case "$vendorarch" in
7005         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7006                 dflt="$dflt/$archname"
7007                 ;;
7008         *)      dflt="$vendorarch" ;;
7009         esac
7010         fn=d~+
7011         rp='Pathname for vendor-supplied architecture-dependent files?'
7012         . ./getfile
7013         vendorarch="$ans"
7014         vendorarchexp="$ansexp"
7015         ;;
7016 esac
7017 prefixvar=vendorarch
7018 . ./installprefix
7019
7020 : Final catch-all directories to search
7021 $cat <<EOM
7022
7023 Lastly, you can have perl look in other directories for extensions and
7024 modules in addition to those already specified.
7025 These directories will be searched after 
7026         $sitearch 
7027         $sitelib 
7028 EOM
7029 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7030 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7031 echo ' '
7032 case "$otherlibdirs" in
7033 ''|' ') dflt='none' ;;
7034 *)      dflt="$otherlibdirs" ;;
7035 esac
7036 $cat <<EOM
7037 Enter a colon-separated set of extra paths to include in perl's @INC
7038 search path, or enter 'none' for no extra paths.
7039
7040 EOM
7041
7042 rp='Colon-separated list of additional directories for perl to search?'
7043 . ./myread
7044 case "$ans" in
7045 ' '|''|none)    otherlibdirs=' ' ;;     
7046 *)      otherlibdirs="$ans" ;;
7047 esac
7048 case "$otherlibdirs" in
7049 ' ') val=$undef ;;
7050 *)      val=$define ;;
7051 esac
7052 set d_perl_otherlibdirs
7053 eval $setvar
7054
7055 : Cruising for prototypes
7056 echo " "
7057 echo "Checking out function prototypes..." >&4
7058 $cat >prototype.c <<EOCP
7059 #$i_stdlib I_STDLIB
7060 #ifdef I_STDLIB
7061 #include <stdlib.h>
7062 #endif
7063 int main(int argc, char *argv[]) {
7064         exit(0);}
7065 EOCP
7066 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7067         echo "Your C compiler appears to support function prototypes."
7068         val="$define"
7069 else
7070         echo "Your C compiler doesn't seem to understand function prototypes."
7071         val="$undef"
7072 fi
7073 set prototype
7074 eval $setvar
7075 $rm -f prototype*
7076
7077 : Check if ansi2knr is required
7078 case "$prototype" in
7079 "$define") ;;
7080 *)      ansi2knr='ansi2knr'
7081         echo " "
7082         cat <<EOM >&4
7083
7084 $me:  FATAL ERROR:
7085 This version of $package can only be compiled by a compiler that 
7086 understands function prototypes.  Unfortunately, your C compiler 
7087         $cc $ccflags
7088 doesn't seem to understand them.  Sorry about that.
7089
7090 If GNU cc is available for your system, perhaps you could try that instead.  
7091
7092 Eventually, we hope to support building Perl with pre-ANSI compilers.
7093 If you would like to help in that effort, please contact <perlbug@perl.org>.
7094
7095 Aborting Configure now.
7096 EOM
7097         exit 2
7098         ;;
7099 esac
7100
7101 : DTrace support
7102 dflt_dtrace='/usr/sbin/dtrace'
7103 cat <<EOM
7104
7105 Perl can be built to support DTrace on platforms that support it.
7106 DTrace is a diagnosis and performance analysis tool from Sun.
7107
7108 If this doesn't make any sense to you, just accept the default '$dflt'.
7109 EOM
7110
7111 while $test 1 ; do
7112         case "$usedtrace" in
7113         $define|true|[yY]*)
7114                 dflt='y'
7115                 ;;
7116         ?*)
7117                 dflt='y'
7118                 dflt_dtrace=$usedtrace
7119                 ;;
7120         *)
7121                 dflt='n'
7122                 ;;
7123         esac
7124
7125         rp='Support DTrace if available?'
7126         . ./myread
7127         case "$ans" in
7128         y|Y)    val="$define" ;;
7129         *)      val="$undef" ;;
7130         esac
7131         set usedtrace
7132         eval $setvar
7133
7134         test "X$usedtrace" != "X$define" && break
7135
7136         echo " "
7137         rp='Where is the dtrace executable?'
7138         dflt=$dflt_dtrace
7139         . ./getfile
7140         val="$ans"
7141         set dtrace
7142         eval $setvar
7143
7144         if $test -f $dtrace
7145         then
7146                 if $dtrace -h -s ../perldtrace.d \
7147                         -o perldtrace.tmp >/dev/null 2>&1 \
7148                         && rm -f perldtrace.tmp
7149                 then
7150                         echo " "
7151                         echo "Good: your $dtrace knows about the -h flag."
7152                 else
7153                         cat >&2 <<EOM
7154
7155 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7156 ***
7157 *** Your installed dtrace doesn't support the -h switch to compile a D
7158 *** program into a C header. Can't continue.
7159
7160 EOM
7161                         exit 1
7162                 fi
7163                 break;
7164         fi
7165
7166         case "$fastread" in
7167         yes)
7168                 cat >&2 <<EOM
7169
7170 *** $me:  Fatal Error:  $dtrace not found.
7171 *** Can't continue.
7172
7173 EOM
7174                 exit 1
7175                 ;;
7176         *)
7177                 echo "*** $dtrace was not found."
7178                 echo " "
7179                 ;;
7180         esac
7181 done
7182
7183 : See if we want extra modules installed
7184 echo " "
7185 case "$extras" in
7186 '') dflt='n';;
7187 *) dflt='y';;
7188 esac
7189 cat <<EOM
7190 Perl can be built with extra modules or bundles of modules which
7191 will be fetched from the CPAN and installed alongside Perl.
7192
7193 Notice that you will need access to the CPAN; either via the Internet,
7194 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7195 be asked later to configure the CPAN.pm module which will in turn do
7196 the installation of the rest of the extra modules or bundles.)
7197
7198 Notice also that if the modules require any external software such as
7199 libraries and headers (the libz library and the zlib.h header for the
7200 Compress::Zlib module, for example) you MUST have any such software
7201 already installed, this configuration process will NOT install such
7202 things for you.
7203
7204 If this doesn't make any sense to you, just accept the default '$dflt'.
7205 EOM
7206 rp='Install any extra modules (y or n)?'
7207 . ./myread
7208 case "$ans" in
7209 y|Y)
7210         cat <<EOM
7211
7212 Please list any extra modules or bundles to be installed from CPAN,
7213 with spaces between the names.  The names can be in any format the
7214 'install' command of CPAN.pm will understand.  (Answer 'none',
7215 without the quotes, to install no extra modules or bundles.)
7216 EOM
7217         rp='Extras?'
7218         dflt="$extras"
7219         . ./myread
7220         extras="$ans"
7221 esac
7222 case "$extras" in
7223 ''|'none')
7224         val=''
7225         $rm -f ../extras.lst
7226         ;;
7227 *)      echo "(Saving the list of extras for later...)"
7228         echo "$extras" > ../extras.lst
7229         val="'$extras'"
7230         ;;
7231 esac
7232 set extras
7233 eval $setvar
7234 echo " "
7235
7236 : determine where html pages for programs go
7237 set html1dir html1dir none
7238 eval $prefixit
7239 $cat <<EOM
7240
7241 If you wish to install html files for programs in $spackage, indicate
7242 the appropriate directory here.  To skip installing html files,
7243 answer "none".
7244 EOM
7245 case "$html1dir" in
7246 ''|none|$undef|' ') dflt=none ;;
7247 *) dflt=$html1dir ;;
7248 esac
7249 fn=dn+~
7250 rp="Directory for the main $spackage html pages?"
7251 . ./getfile
7252 prefixvar=html1dir
7253 . ./setprefixvar
7254 : Use ' ' for none so value is preserved next time through Configure
7255 $test X"$html1dir" = "X" && html1dir=' '
7256
7257 : determine where html pages for libraries and modules go
7258 set html3dir html3dir none
7259 eval $prefixit
7260 $cat <<EOM
7261
7262 If you wish to install html files for modules associated with $spackage,
7263 indicate the appropriate directory here.  To skip installing html files,
7264 answer "none".
7265 EOM
7266 : There is no obvious default.  If they have specified html1dir, then
7267 : try to key off that, possibly changing .../html1 into .../html3.
7268 case "$html3dir" in
7269 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7270 *) dflt=$html3dir ;;
7271 esac
7272 fn=dn+~
7273 rp="Directory for the $spackage module html pages?"
7274 . ./getfile
7275 prefixvar=html3dir
7276 . ./setprefixvar
7277 : Use ' ' for none so value is preserved next time through Configure
7278 $test X"$html3dir" = "X" && html3dir=' '
7279
7280 : determine whether to install perl also as /usr/bin/perl
7281
7282 echo " "
7283 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7284         $cat <<EOM
7285 Many scripts expect perl to be installed as /usr/bin/perl.
7286
7287 If you want to, I can install the perl you are about to compile
7288 as /usr/bin/perl (in addition to $bin/perl).
7289 EOM
7290         if test -f /usr/bin/perl; then
7291             $cat <<EOM
7292
7293 However, please note that because you already have a /usr/bin/perl,
7294 overwriting that with a new Perl would very probably cause problems.
7295 Therefore I'm assuming you don't want to do that (unless you insist).
7296
7297 EOM
7298             case "$installusrbinperl" in
7299             "$define"|[yY]*)    dflt='y';;
7300             *)                  dflt='n';;
7301             esac
7302         else
7303             $cat <<EOM
7304
7305 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7306
7307 EOM
7308             case "$installusrbinperl" in
7309             "$undef"|[nN]*)     dflt='n';;
7310             *)                  dflt='y';;
7311             esac
7312         fi
7313         rp="Do you want to install perl as /usr/bin/perl?"
7314         . ./myread
7315         case "$ans" in
7316         [yY]*)  val="$define";;
7317         *)      val="$undef" ;;
7318         esac
7319 else
7320         val="$undef"
7321 fi
7322 set installusrbinperl
7323 eval $setvar
7324
7325 : Check if we are using the GNU C library
7326 echo " "
7327 echo "Checking for GNU C Library..." >&4
7328 cat >try.c <<'EOCP'
7329 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7330    alone are insufficient to distinguish different versions, such as
7331    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7332    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7333 */
7334 #include <stdio.h>
7335 int main(void)
7336 {
7337 #ifdef __GLIBC__
7338 #   ifdef __GLIBC_MINOR__
7339 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7340 #           include <gnu/libc-version.h>
7341             printf("%s\n",  gnu_get_libc_version());
7342 #       else
7343             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7344 #       endif
7345 #   else
7346         printf("%d\n",  __GLIBC__);
7347 #   endif
7348     return 0;
7349 #else
7350     return 1;
7351 #endif
7352 }
7353 EOCP
7354 set try
7355 if eval $compile_ok && $run ./try > glibc.ver; then
7356         val="$define"
7357         gnulibc_version=`$cat glibc.ver`
7358         echo "You are using the GNU C Library version $gnulibc_version"
7359 else
7360         val="$undef"
7361         gnulibc_version=''
7362         echo "You are not using the GNU C Library"
7363 fi
7364 $rm_try glibc.ver
7365 set d_gnulibc
7366 eval $setvar
7367
7368 : see if nm is to be used to determine whether a symbol is defined or not
7369 case "$usenm" in
7370 '')
7371         dflt=''
7372         case "$d_gnulibc" in
7373         "$define")
7374                 echo " "
7375                 echo "nm probably won't work on the GNU C Library." >&4
7376                 dflt=n
7377                 ;;
7378         esac
7379         case "$dflt" in
7380         '') 
7381                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7382                         echo " "
7383                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7384                         echo "'nm' won't be sufficient on this sytem." >&4
7385                         dflt=n
7386                 fi
7387                 ;;
7388         esac
7389         case "$dflt" in
7390         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7391                 if $test $dflt -gt 20; then
7392                         dflt=y
7393                 else
7394                         dflt=n
7395                 fi
7396                 ;;
7397         esac
7398         ;;
7399 *)
7400         case "$usenm" in
7401         true|$define) dflt=y;;
7402         *) dflt=n;;
7403         esac
7404         ;;
7405 esac
7406 $cat <<EOM
7407
7408 I can use $nm to extract the symbols from your C libraries. This
7409 is a time consuming task which may generate huge output on the disk (up
7410 to 3 megabytes) but that should make the symbols extraction faster. The
7411 alternative is to skip the 'nm' extraction part and to compile a small
7412 test program instead to determine whether each symbol is present. If
7413 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7414 this may be the best solution.
7415
7416 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7417
7418 EOM
7419 rp="Shall I use $nm to extract C symbols from the libraries?"
7420 . ./myread
7421 case "$ans" in
7422 [Nn]*) usenm=false;;
7423 *) usenm=true;;
7424 esac
7425
7426 runnm=$usenm
7427 case "$reuseval" in
7428 true) runnm=false;;
7429 esac
7430
7431 : nm options which may be necessary
7432 case "$nm_opt" in
7433 '') if $test -f /mach_boot; then
7434                 nm_opt=''       # Mach
7435         elif $test -d /usr/ccs/lib; then
7436                 nm_opt='-p'     # Solaris (and SunOS?)
7437         elif $test -f /dgux; then
7438                 nm_opt='-p'     # DG-UX
7439         elif $test -f /lib64/rld; then
7440                 nm_opt='-p'     # 64-bit Irix
7441         else
7442                 nm_opt=''
7443         fi;;
7444 esac
7445
7446 : nm options which may be necessary for shared libraries but illegal
7447 : for archive libraries.  Thank you, Linux.
7448 case "$nm_so_opt" in
7449 '')     case "$myuname" in
7450         *linux*|gnu*)
7451                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7452                         nm_so_opt='--dynamic'
7453                 fi
7454                 ;;
7455         esac
7456         ;;
7457 esac
7458
7459 : Figure out where the libc is located
7460 case "$runnm" in
7461 true)
7462 : get list of predefined functions in a handy place
7463 echo " "
7464 case "$libc" in
7465 '') libc=unknown
7466         case "$libs" in
7467         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7468         esac
7469         ;;
7470 esac
7471 case "$libs" in
7472 '') ;;
7473 *)  for thislib in $libs; do
7474         case "$thislib" in
7475         -lc|-lc_s)
7476                 : Handle C library specially below.
7477                 ;;
7478         -l*)
7479                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7480                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7481                         :
7482                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7483                         :
7484                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7485                         :
7486                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7487                         :
7488                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7489                         :
7490                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7491                         :
7492                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7493                         :
7494                 else
7495                         try=''
7496                 fi
7497                 libnames="$libnames $try"
7498                 ;;
7499         *) libnames="$libnames $thislib" ;;
7500         esac
7501         done
7502         ;;
7503 esac
7504 xxx=normal
7505 case "$libc" in
7506 unknown)
7507         set /lib/libc.$so
7508         for xxx in $libpth; do
7509                 $test -r $1 || set $xxx/libc.$so
7510                 : The messy sed command sorts on library version numbers.
7511                 $test -r $1 || \
7512                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7513                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7514                                 h
7515                                 s/[0-9][0-9]*/0000&/g
7516                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7517                                 G
7518                                 s/\n/ /' | \
7519                          $sort | $sed -e 's/^.* //'`
7520                 eval set \$$#
7521         done
7522         $test -r $1 || set /usr/ccs/lib/libc.$so
7523         $test -r $1 || set /lib/libsys_s$_a
7524         ;;
7525 *)
7526         set blurfl
7527         ;;
7528 esac
7529 if $test -r "$1"; then
7530         echo "Your (shared) C library seems to be in $1."
7531         libc="$1"
7532 elif $test -r /lib/libc && $test -r /lib/clib; then
7533         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7534         xxx=apollo
7535         libc='/lib/clib /lib/libc'
7536         if $test -r /lib/syslib; then
7537                 echo "(Your math library is in /lib/syslib.)"
7538                 libc="$libc /lib/syslib"
7539         fi
7540 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7541         echo "Your C library seems to be in $libc, as you said before."
7542 elif $test -r $incpath/usr/lib/libc$_a; then
7543         libc=$incpath/usr/lib/libc$_a;
7544         echo "Your C library seems to be in $libc.  That's fine."
7545 elif $test -r /lib/libc$_a; then
7546         libc=/lib/libc$_a;
7547         echo "Your C library seems to be in $libc.  You're normal."
7548 else
7549         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7550                 :
7551         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7552                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7553         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7554                 :
7555         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7556                 :
7557         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7558                 :
7559         else
7560                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7561         fi
7562         if $test -r "$tans"; then
7563                 echo "Your C library seems to be in $tans, of all places."
7564                 libc=$tans
7565         else
7566                 libc='blurfl'
7567         fi
7568 fi
7569 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7570         dflt="$libc"
7571         cat <<EOM
7572
7573 If the guess above is wrong (which it might be if you're using a strange
7574 compiler, or your machine supports multiple models), you can override it here.
7575
7576 EOM
7577 else
7578         dflt=''
7579         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7580         cat >&4 <<EOM
7581 I can't seem to find your C library.  I've looked in the following places:
7582
7583 EOM
7584         $sed 's/^/      /' libpath
7585         cat <<EOM
7586
7587 None of these seems to contain your C library. I need to get its name...
7588
7589 EOM
7590 fi
7591 fn=f
7592 rp='Where is your C library?'
7593 . ./getfile
7594 libc="$ans"
7595
7596 echo " "
7597 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7598 set X `cat libnames`
7599 shift
7600 xxx=files
7601 case $# in 1) xxx=file; esac
7602 echo "Extracting names from the following $xxx for later perusal:" >&4
7603 echo " "
7604 $sed 's/^/      /' libnames >&4
7605 echo " "
7606 $echo $n "This may take a while...$c" >&4
7607
7608 for file in $*; do
7609         case $file in
7610         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7611         *) $nm $nm_opt $file 2>/dev/null;;
7612         esac
7613 done >libc.tmp
7614
7615 $echo $n ".$c"
7616 $grep fprintf libc.tmp > libc.ptf
7617 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7618 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7619 xxx='[ADTSIW]'
7620 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7629         eval $xscan;\
7630         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7631                 eval $xrun
7632 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7633         eval $xscan;\
7634         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7635                 eval $xrun
7636 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7637         eval $xscan;\
7638         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7639                 eval $xrun
7640 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7645                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7646         eval $xscan;\
7647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648                 eval $xrun
7649 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7650         eval $xscan;\
7651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652                 eval $xrun
7653 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 else
7678         $nm -p $* 2>/dev/null >libc.tmp
7679         $grep fprintf libc.tmp > libc.ptf
7680         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7681                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7682         then
7683                 nm_opt='-p'
7684                 eval $xrun
7685         else
7686                 echo " "
7687                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7688                 com=''
7689                 if $ar t $libc > libc.tmp && \
7690                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7691                 then
7692                         for thisname in $libnames $libc; do
7693                                 $ar t $thisname >>libc.tmp
7694                         done
7695                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7696                         echo "Ok." >&4
7697                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7698                         for thisname in $libnames $libc; do
7699                                 $ar tv $thisname >>libc.tmp
7700                                 emximp -o tmp.imp $thisname \
7701                                     2>/dev/null && \
7702                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7703                                     < tmp.imp >>libc.tmp
7704                                 $rm -f tmp.imp
7705                         done
7706                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7707                         echo "Ok." >&4
7708                 else
7709                         echo "$ar didn't seem to work right." >&4
7710                         echo "Maybe this is a Cray...trying bld instead..." >&4
7711                         if  bld t $libc | \
7712                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7713                                 $test -s libc.list
7714                         then
7715                                 for thisname in $libnames; do
7716                                         bld t $libnames | \
7717                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7718                                         $ar t $thisname >>libc.tmp
7719                                 done
7720                                 echo "Ok." >&4
7721                         else
7722                                 echo "That didn't work either.  Giving up." >&4
7723                                 exit 1
7724                         fi
7725                 fi
7726         fi
7727 fi
7728 nm_extract="$com"
7729 case "$PASE" in
7730 define)
7731     echo " "
7732     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7733     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7734     ;;
7735 *)  if $test -f /lib/syscalls.exp; then
7736         echo " "
7737         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7738         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7739                 /lib/syscalls.exp >>libc.list
7740     fi
7741     ;;
7742 esac
7743 ;;
7744 esac
7745 $rm -f libnames libpath
7746
7747 : see if dld is available
7748 set dld.h i_dld
7749 eval $inhdr
7750
7751 : Check if we are using C++
7752 echo " "
7753 echo "Checking for C++..." >&4
7754 $cat >try.c <<'EOCP'
7755 #include <stdio.h>
7756 int main(void)
7757 {
7758 #ifdef __cplusplus
7759     return 0;
7760 #else
7761     return 1;
7762 #endif
7763 }
7764 EOCP
7765 set try
7766 if eval $compile_ok && $run ./try; then
7767         val="$define"
7768         echo "You are using a C++ compiler."
7769 else
7770         val="$undef"
7771         echo "You are not using a C++ compiler."
7772 fi
7773 $rm_try cplusplus$$
7774 set d_cplusplus
7775 eval $setvar
7776
7777 : is a C symbol defined?
7778 csym='tlook=$1;
7779 case "$3" in
7780 -v) tf=libc.tmp; tdc="";;
7781 -a) tf=libc.tmp; tdc="[]";;
7782 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7783 esac;
7784 case "$d_cplusplus" in
7785     $define)    extern_C="extern \"C\"" ;;
7786     *)          extern_C="extern"       ;;
7787 esac;
7788 tx=yes;
7789 case "$reuseval-$4" in
7790 true-) ;;
7791 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7792 esac;
7793 case "$tx" in
7794 yes)
7795         tval=false;
7796         if $test "$runnm" = true; then
7797                 if $contains $tlook $tf >/dev/null 2>&1; then
7798                         tval=true;
7799                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7800                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7801                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7802                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7803                         $rm_try;
7804                 fi;
7805         else
7806                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7807                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7808                 $rm_try;
7809         fi;
7810         ;;
7811 *)
7812         case "$tval" in
7813         $define) tval=true;;
7814         *) tval=false;;
7815         esac;
7816         ;;
7817 esac;
7818 eval "$2=$tval"'
7819
7820 : define an is-in-libc? function
7821 inlibc='echo " "; td=$define; tu=$undef;
7822 sym=$1; var=$2; eval "was=\$$2";
7823 tx=yes;
7824 case "$reuseval$was" in
7825 true) ;;
7826 true*) tx=no;;
7827 esac;
7828 case "$tx" in
7829 yes)
7830         set $sym tres -f;
7831         eval $csym;
7832         case "$tres" in
7833         true)
7834                 echo "$sym() found." >&4;
7835                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7836         *)
7837                 echo "$sym() NOT found." >&4;
7838                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7839         esac;;
7840 *)
7841         case "$was" in
7842         $define) echo "$sym() found." >&4;;
7843         *) echo "$sym() NOT found." >&4;;
7844         esac;;
7845 esac'
7846
7847 : see if dlopen exists
7848 xxx_runnm="$runnm"
7849 xxx_ccflags="$ccflags"
7850 runnm=false
7851 : with g++ one needs -shared to get is-in-libc to work for dlopen
7852 case "$gccversion" in
7853 '')     ;;
7854 *)      case "$d_cplusplus" in
7855         "$define") ccflags="$ccflags -shared" ;;
7856         esac
7857         ;;
7858 esac
7859 set dlopen d_dlopen
7860 eval $inlibc
7861 runnm="$xxx_runnm"
7862 ccflags="$xxx_ccflags"
7863
7864 : see if this is a unistd.h system
7865 set unistd.h i_unistd
7866 eval $inhdr
7867
7868 : determine which dynamic loading, if any, to compile in
7869 echo " "
7870 dldir="ext/DynaLoader"
7871 case "$usedl" in
7872 $define|y|true)
7873         dflt='y'
7874         usedl="$define"
7875         ;;
7876 $undef|n|false)
7877         dflt='n'
7878         usedl="$undef"
7879         ;;
7880 *)
7881         dflt='n'
7882         case "$d_dlopen" in
7883             $define) dflt='y' ;;
7884         esac
7885         case "$i_dld" in
7886             $define) dflt='y' ;;
7887         esac
7888         : Does a dl_xxx.xs file exist for this operating system
7889         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7890         ;;
7891 esac
7892 rp="Do you wish to use dynamic loading?"
7893 . ./myread
7894 usedl="$ans"
7895 case "$ans" in
7896 y*) usedl="$define"
7897         case "$dlsrc" in
7898         '')
7899                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7900                         dflt="$dldir/dl_${osname}.xs"
7901                 elif $test "$d_dlopen" = "$define" ; then
7902                         dflt="$dldir/dl_dlopen.xs"
7903                 elif $test "$i_dld" = "$define" ; then
7904                         dflt="$dldir/dl_dld.xs"
7905                 else
7906                         dflt=''
7907                 fi
7908                 ;;
7909         *)      dflt="$dldir/$dlsrc"
7910                 ;;
7911         esac
7912     echo "The following dynamic loading files are available:"
7913         : Can not go over to $dldir because getfile has path hard-coded in.
7914         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7915         rp="Source file to use for dynamic loading"
7916         fn="fne"
7917         gfpth="$src"
7918         . ./getfile
7919         usedl="$define"
7920         : emulate basename
7921         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7922
7923         $cat << EOM
7924
7925 Some systems may require passing special flags to $cc -c to
7926 compile modules that will be used to create a shared library.
7927 To use no flags, say "none".
7928
7929 EOM
7930     case "$cccdlflags" in
7931     '') case "$gccversion" in
7932                 '') case "$osname" in
7933                         hpux)   dflt='+z' ;;
7934                         next)   dflt='none' ;;
7935                         irix*)  dflt='-KPIC' ;;
7936                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7937                         sunos)  dflt='-pic' ;;
7938                         *)      dflt='none' ;;
7939                     esac
7940                         ;;
7941                 *)  case "$osname" in
7942                         darwin) dflt='none' ;;
7943                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7944                         *)      dflt='-fpic' ;;
7945                     esac ;;
7946             esac ;;
7947         ' ') dflt='none' ;;
7948     *)  dflt="$cccdlflags" ;;
7949     esac
7950     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7951     . ./myread
7952     case "$ans" in
7953     none) cccdlflags=' ' ;;
7954     *) cccdlflags="$ans" ;;
7955     esac
7956
7957     cat << EOM
7958
7959 Some systems use ld to create libraries that can be dynamically loaded,
7960 while other systems (such as those using ELF) use $cc.
7961
7962 EOM
7963         case "$ld" in
7964         '')     $cat >try.c <<EOM
7965 /* Test for whether ELF binaries are produced */
7966 #include <fcntl.h>
7967 #$i_stdlib I_STDLIB
7968 #ifdef I_STDLIB
7969 #include <stdlib.h>
7970 #endif
7971 #$i_unistd I_UNISTD
7972 #ifdef I_UNISTD
7973 #include <unistd.h>
7974 #endif
7975 int main() {
7976         char b[4];
7977         int i = open("a.out",O_RDONLY);
7978         if(i == -1)
7979                 exit(1); /* fail */
7980         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7981                 exit(0); /* succeed (yes, it's ELF) */
7982         else
7983                 exit(1); /* fail */
7984 }
7985 EOM
7986                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7987                         cat <<EOM
7988 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7989 EOM
7990                         dflt="$cc"
7991                 else
7992                         echo "I'll use ld to build dynamic libraries."
7993                         dflt='ld'
7994                 fi
7995                 $rm_try
7996                 ;;
7997         *)      dflt="$ld"
7998                 ;;
7999         esac
8000
8001     rp="What command should be used to create dynamic libraries?"
8002     . ./myread
8003         ld="$ans"
8004
8005     cat << EOM
8006
8007 Some systems may require passing special flags to $ld to create a
8008 library that can be dynamically loaded.  If your ld flags include
8009 -L/other/path options to locate libraries outside your loader's normal
8010 search path, you may need to specify those -L options here as well.  To
8011 use no flags, say "none".
8012
8013 EOM
8014     case "$lddlflags" in
8015     '') case "$osname" in
8016                         beos) dflt='-nostart' ;;
8017                         haiku) dflt='-shared' ;;
8018                         hpux) dflt='-b';
8019                               case "$gccversion" in
8020                               '') dflt="$dflt +vnocompatwarnings" ;;
8021                               esac
8022                               ;;
8023                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8024                         next)  dflt='none' ;;
8025                         solaris) dflt='-G' ;;
8026                         sunos) dflt='-assert nodefinitions' ;;
8027                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8028                 *)     dflt='none' ;;
8029                         esac
8030                         ;;
8031     *) dflt="$lddlflags" ;;
8032     esac
8033
8034         : Try to guess additional flags to pick up local libraries.
8035         : Be careful not to append to a plain 'none'
8036         case "$dflt" in
8037         none) dflt='' ;;
8038         esac
8039         for thisflag in $ldflags; do
8040                 case "$thisflag" in
8041                 -L*|-R*|-Wl,-R*)
8042                         case " $dflt " in
8043                         *" $thisflag "*) ;;
8044                         *) dflt="$dflt $thisflag" ;;
8045                         esac
8046                         ;;
8047                 esac
8048         done
8049
8050         case "$dflt" in
8051         ''|' ') dflt='none' ;;
8052         esac
8053
8054         case "$ldflags" in
8055         *-fstack-protector*)
8056             case "$dflt" in
8057                         *-fstack-protector*) ;; # Don't add it again
8058                         *) dflt="$dflt -fstack-protector" ;; 
8059                 esac
8060                 ;;
8061         esac
8062
8063
8064     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8065     . ./myread
8066     case "$ans" in
8067     none) lddlflags=' ' ;;
8068     *) lddlflags="$ans" ;;
8069     esac
8070
8071         cat <<EOM
8072
8073 Some systems may require passing special flags to $cc to indicate that
8074 the resulting executable will use dynamic linking.  To use no flags,
8075 say "none".
8076
8077 EOM
8078     case "$ccdlflags" in
8079     '') case "$osname" in
8080             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8081             next|sunos) dflt='none' ;;
8082             *)          dflt='none' ;;
8083             esac ;;
8084     ' ')  dflt='none' ;;
8085     *)  dflt="$ccdlflags" ;;
8086     esac
8087     rp="Any special flags to pass to $cc to use dynamic linking?"
8088     . ./myread
8089     case "$ans" in
8090     none) ccdlflags=' ' ;;
8091     *) ccdlflags="$ans" ;;
8092     esac
8093     ;;
8094 *)  usedl="$undef"
8095         ld='ld'
8096     dlsrc='dl_none.xs'
8097     lddlflags=''
8098     ccdlflags=''
8099     ;;
8100 esac
8101
8102 : Do we want a shared libperl?
8103 also=''
8104 case "$usedl" in
8105 $undef)
8106         # No dynamic loading being used, so don't bother even to prompt.
8107         useshrplib='false'
8108         ;;
8109 *)      case "$useshrplib" in
8110         '')     case "$osname" in
8111                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8112                         dflt=y
8113                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8114                         ;;
8115                 next*)
8116                         case "$osvers" in
8117                         4*)     dflt=y
8118                                 also='Building a shared libperl is needed for MAB support.'
8119                                 ;;
8120                         *)      dflt=n
8121                                 ;;
8122                         esac
8123                         ;;
8124                 *)      dflt=n
8125                         ;;
8126                 esac
8127                 ;;
8128         $define|true|[Yy]*)
8129                 dflt=y
8130                 ;;
8131         *)      dflt=n
8132                 ;;
8133         esac
8134         $cat << EOM
8135
8136 The perl executable is normally obtained by linking perlmain.c with
8137 libperl${_a}, any static extensions (usually just DynaLoader), and
8138 any other libraries needed on this system (such as -lm, etc.).  Since
8139 your system supports dynamic loading, it is probably possible to build
8140 a shared libperl.$so.  If you will have more than one executable linked
8141 to libperl.$so, this will significantly reduce the size of each
8142 executable, but it may have a noticeable effect on performance.  The
8143 default is probably sensible for your system.
8144 $also
8145
8146 EOM
8147         rp="Build a shared libperl.$so (y/n)"
8148         . ./myread
8149         case "$ans" in
8150         true|$define|[Yy]*)
8151                 useshrplib='true'  ;;
8152         *)      useshrplib='false' ;;
8153         esac
8154         ;;
8155 esac
8156
8157 case "$useshrplib" in
8158 true)
8159         case "$libperl" in
8160         '')
8161                 # Figure out a good name for libperl.so.  Since it gets stored in
8162                 # a version-specific architecture-dependent library, the version
8163                 # number isn't really that important, except for making cc/ld happy.
8164                 #
8165                 # A name such as libperl.so.10.1
8166                 majmin="libperl.$so.$patchlevel.$subversion"
8167                 # A name such as libperl.so.100
8168                 majonly=`echo $patchlevel $subversion |
8169                         $awk '{printf "%d%02d", $1, $2}'`
8170                 majonly=libperl.$so.$majonly
8171                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8172                 # rely on figuring it out from the naming of libc.
8173                 case "${osname}${osvers}" in
8174                 next4*)
8175                         dflt=libperl.5.$so
8176                         # XXX How handle the --version stuff for MAB?
8177                         ;;
8178                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8179                         dflt=libperl.$so
8180                         ;;
8181                 cygwin*) # ld links now against the dll directly
8182                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8183                         majonly=`echo $patchlevel $subversion |
8184                                 $awk '{printf "%03d%03d", $1, $2}'`
8185                         majonly=cygperl5.$majonly.$so
8186                         dflt=$majmin
8187                         ;;
8188                 *)      # Try to guess based on whether libc has major.minor.
8189                         case "$libc" in
8190                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8191                         *libc.$so.[0-9]*) dflt=$majonly ;;
8192                         *)      dflt=libperl.$so ;;
8193                         esac
8194                         ;;
8195                 esac
8196                 ;;
8197         *)      dflt=$libperl
8198                 ;;
8199         esac
8200         cat << EOM
8201
8202 I need to select a good name for the shared libperl.  If your system uses
8203 library names with major and minor numbers, then you might want something
8204 like $majmin.  Alternatively, if your system uses a single version
8205 number for shared libraries, then you might want to use $majonly.
8206 Or, your system might be quite happy with a simple libperl.$so.
8207
8208 Since the shared libperl will get installed into a version-specific
8209 architecture-dependent directory, the version number of the shared perl
8210 library probably isn't important, so the default should be o.k.
8211
8212 EOM
8213         rp='What name do you want to give to the shared libperl?'
8214         . ./myread
8215         libperl=$ans
8216         echo "Ok, I'll use $libperl"
8217         ;;
8218 *)
8219         libperl="libperl${_a}"
8220         ;;
8221 esac
8222
8223 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8224 case "$shrpdir" in
8225 '') ;;
8226 *)      $cat >&4 <<EOM
8227 WARNING:  Use of the shrpdir variable for the installation location of
8228 the shared $libperl is not supported.  It was never documented and
8229 will not work in this version.  Let me (perlbug@perl.org)
8230 know of any problems this may cause.
8231
8232 EOM
8233         case "$shrpdir" in
8234         "$archlibexp/CORE")
8235                 $cat >&4 <<EOM
8236 But your current setting of $shrpdir is
8237 the default anyway, so it's harmless.
8238 EOM
8239                 ;;
8240         *)
8241                 $cat >&4 <<EOM
8242 Further, your current attempted setting of $shrpdir
8243 conflicts with the value of $archlibexp/CORE
8244 that installperl will use.
8245 EOM
8246                 ;;
8247         esac
8248         ;;
8249 esac
8250
8251 # How will the perl executable find the installed shared $libperl?
8252 # Add $xxx to ccdlflags.
8253 # If we can't figure out a command-line option, use $shrpenv to
8254 # set env LD_RUN_PATH.  The main perl makefile uses this.
8255 shrpdir=$archlibexp/CORE
8256 xxx=''
8257 tmp_shrpenv=''
8258 if "$useshrplib"; then
8259     case "$osname" in
8260         aix)
8261                 # We'll set it in Makefile.SH...
8262                 ;;
8263         solaris)
8264                 xxx="-R $shrpdir"
8265                 ;;
8266         freebsd|netbsd|openbsd|interix|dragonfly)
8267                 xxx="-Wl,-R$shrpdir"
8268                 ;;
8269         bsdos|linux|irix*|dec_osf|gnu*)
8270                 xxx="-Wl,-rpath,$shrpdir"
8271                 ;;
8272         next)
8273                 # next doesn't like the default...
8274                 ;;
8275         beos)
8276                 # beos doesn't like the default, either.
8277                 ;;
8278         haiku)
8279                 # Haiku doesn't like the default, either.
8280                 ;;
8281         hpux*)
8282                 # hpux doesn't like the default, either.
8283                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8284                 ;;
8285         cygwin)
8286                 # cygwin needs only ldlibpth
8287                 ;;
8288         *)
8289                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8290                 ;;
8291         esac
8292         case "$xxx" in
8293         '') ;;
8294         *)
8295                 # Only add $xxx if it isn't already in ccdlflags.
8296                 case " $ccdlflags " in
8297                 *" $xxx "*)     ;;
8298                 *)      ccdlflags="$ccdlflags $xxx"
8299                         cat <<EOM >&4
8300
8301 Adding $xxx to the flags
8302 passed to $ld so that the perl executable will find the
8303 installed shared $libperl.
8304
8305 EOM
8306                         ;;
8307                 esac
8308                 ;;
8309         esac
8310 fi
8311 # Fix ccdlflags in AIX for building external extensions.
8312 # (For building Perl itself bare -bE:perl.exp is needed,
8313 #  Makefile.SH takes care of this.)
8314 case "$osname" in
8315 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8316 esac
8317 # Respect a hint or command-line value.
8318 case "$shrpenv" in
8319 '') shrpenv="$tmp_shrpenv" ;;
8320 esac
8321 case "$ldlibpthname" in
8322 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8323 none)   ldlibpthname='' ;;
8324 esac
8325
8326 : determine where manual pages are on this system
8327 echo " "
8328 case "$sysman" in
8329 '') 
8330         syspath='/usr/share/man/man1 /usr/man/man1'
8331         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8332         syspath="$syspath /usr/man/u_man/man1"
8333         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8334         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8335         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8336         sysman=`./loc . /usr/man/man1 $syspath`
8337         ;;
8338 esac
8339 if $test -d "$sysman"; then
8340         echo "System manual is in $sysman." >&4
8341 else
8342         echo "Could not find manual pages in source form." >&4
8343 fi
8344
8345 : determine where manual pages go
8346 set man1dir man1dir none
8347 eval $prefixit
8348 $cat <<EOM
8349
8350 $spackage has manual pages available in source form.
8351 EOM
8352 case "$nroff" in
8353 nroff)
8354         echo "However, you don't have nroff, so they're probably useless to you."
8355         case "$man1dir" in
8356         '') man1dir="none";;
8357         esac;;
8358 esac
8359 echo "If you don't want the manual sources installed, answer 'none'."
8360 case "$man1dir" in
8361 ' ') dflt=none
8362         ;;
8363 '')
8364         lookpath="$prefixexp/share/man/man1"
8365         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8366         lookpath="$lookpath $prefixexp/man/p_man/man1"
8367         lookpath="$lookpath $prefixexp/man/u_man/man1"
8368         lookpath="$lookpath $prefixexp/man/man.1"
8369         case "$sysman" in
8370         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8371         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8372         esac
8373         set dflt
8374         eval $prefixup
8375         ;;
8376 *)  dflt="$man1dir"
8377         ;;
8378 esac
8379 echo " "
8380 fn=dn+~
8381 rp="Where do the main $spackage manual pages (source) go?"
8382 . ./getfile
8383 if $test "X$man1direxp" != "X$ansexp"; then
8384         installman1dir=''
8385 fi
8386 prefixvar=man1dir
8387 . ./setprefixvar
8388
8389 case "$man1dir" in
8390 '')     man1dir=' '
8391         installman1dir='';;
8392 esac
8393
8394 : What suffix to use on installed man pages
8395
8396 case "$man1dir" in
8397 ' ')
8398         man1ext='0'
8399         ;;
8400 *)
8401         rp="What suffix should be used for the main $spackage man pages?"
8402         case "$man1ext" in
8403         '')     case "$man1dir" in
8404                 *1)  dflt=1 ;;
8405                 *1p) dflt=1p ;;
8406                 *1pm) dflt=1pm ;;
8407                 *l) dflt=l;;
8408                 *n) dflt=n;;
8409                 *o) dflt=o;;
8410                 *p) dflt=p;;
8411                 *C) dflt=C;;
8412                 *L) dflt=L;;
8413                 *L1) dflt=L1;;
8414                 *) dflt=1;;
8415                 esac
8416                 ;;
8417         *)      dflt="$man1ext";;
8418         esac
8419         . ./myread
8420         man1ext="$ans"
8421         ;;
8422 esac
8423
8424 : see if we can have long filenames
8425 echo " "
8426 first=123456789abcdef
8427 $rm -f $first
8428 if (echo hi >$first) 2>/dev/null; then
8429         if $test -f 123456789abcde; then
8430                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8431                 val="$undef"
8432         else
8433                 echo 'You can have filenames longer than 14 characters.'>&4
8434                 val="$define"
8435         fi
8436 else
8437         $cat <<'EOM'
8438 You can't have filenames longer than 14 chars.
8439 You can't even think about them!
8440 EOM
8441         val="$undef"
8442 fi
8443 set d_flexfnam
8444 eval $setvar
8445 $rm -rf 123456789abcde*
8446
8447 : determine where library module manual pages go
8448 set man3dir man3dir none
8449 eval $prefixit
8450 $cat <<EOM
8451
8452 $spackage has manual pages for many of the library modules.
8453 EOM
8454
8455 case "$nroff" in
8456 nroff)
8457         $cat <<'EOM'
8458 However, you don't have nroff, so they're probably useless to you.
8459 EOM
8460         case "$man3dir" in
8461         '') man3dir="none";;
8462         esac;;
8463 esac
8464
8465 case "$d_flexfnam" in
8466 undef)
8467         $cat <<'EOM'
8468 However, your system can't handle the long file names like File::Basename.3.
8469 EOM
8470         case "$man3dir" in
8471         '') man3dir="none";;
8472         esac;;
8473 esac
8474
8475 echo "If you don't want the manual sources installed, answer 'none'."
8476 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8477 case "$man3dir" in
8478 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8479         if $test -d "$privlib/man/man3"; then
8480                 cat <<EOM >&4
8481
8482 WARNING:  Previous versions of perl installed man3 pages into
8483 $privlib/man/man3.  This version will suggest a
8484 new default of $dflt.
8485 EOM
8486                 tdflt=$dflt
8487                 dflt='n'
8488                 rp='Do you wish to preserve the old behavior?(y/n)'
8489                 . ./myread
8490                 case "$ans" in
8491                 y*) dflt="$privlib/man/man3" ;;
8492                 *)  dflt=$tdflt ;;
8493                 esac
8494     fi
8495         ;;
8496 *)      dflt="$man3dir" ;;
8497 esac
8498 case "$dflt" in
8499 ' ') dflt=none ;;
8500 esac
8501 echo " "
8502 fn=dn+~
8503 rp="Where do the $package library man pages (source) go?"
8504 . ./getfile
8505 prefixvar=man3dir
8506 . ./setprefixvar
8507
8508 case "$man3dir" in
8509 '')     man3dir=' '
8510         installman3dir='';;
8511 esac
8512
8513 : What suffix to use on installed man pages
8514 case "$man3dir" in
8515 ' ')
8516         man3ext='0'
8517         ;;
8518 *)
8519         rp="What suffix should be used for the $package library man pages?"
8520         case "$man3ext" in
8521         '')     case "$man3dir" in
8522                 *3)  dflt=3 ;;
8523                 *3p) dflt=3p ;;
8524                 *3pm) dflt=3pm ;;
8525                 *l) dflt=l;;
8526                 *n) dflt=n;;
8527                 *o) dflt=o;;
8528                 *p) dflt=p;;
8529                 *C) dflt=C;;
8530                 *L) dflt=L;;
8531                 *L3) dflt=L3;;
8532                 *) dflt=3;;
8533                 esac
8534                 ;;
8535         *)      dflt="$man3ext";;
8536         esac
8537         . ./myread
8538         man3ext="$ans"
8539         ;;
8540 esac
8541
8542 : see if we have to deal with yellow pages, now NIS.
8543 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8544         if $test -f /usr/etc/nibindd; then
8545                 echo " "
8546                 echo "I'm fairly confident you're on a NeXT."
8547                 echo " "
8548                 rp='Do you get the hosts file via NetInfo?'
8549                 dflt=y
8550                 case "$hostcat" in
8551                 nidump*) ;;
8552                 '') ;;
8553                 *) dflt=n;;
8554                 esac
8555                 . ./myread
8556                 case "$ans" in
8557                 y*) hostcat='nidump hosts .';;
8558                 *)      case "$hostcat" in
8559                         nidump*) hostcat='';;
8560                         esac
8561                         ;;
8562                 esac
8563         fi
8564         case "$hostcat" in
8565         nidump*) ;;
8566         *)
8567                 case "$hostcat" in
8568                 *ypcat*) dflt=y;;
8569                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8570                                 dflt=y
8571                         else
8572                                 dflt=n
8573                         fi;;
8574                 *) dflt=n;;
8575                 esac
8576                 echo " "
8577                 rp='Are you getting the hosts file via yellow pages?'
8578                 . ./myread
8579                 case "$ans" in
8580                 y*) hostcat='ypcat hosts';;
8581                 *) hostcat='cat /etc/hosts';;
8582                 esac
8583                 ;;
8584         esac
8585 fi
8586 case "$hostcat" in
8587 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8588 esac
8589 case "$groupcat" in
8590 '') test -f /etc/group && groupcat='cat /etc/group';;
8591 esac
8592 case "$passcat" in
8593 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8594 esac
8595
8596 : now get the host name
8597 echo " "
8598 echo "Figuring out host name..." >&4
8599 case "$myhostname" in
8600 '') cont=true
8601         echo 'Maybe "hostname" will work...'
8602         if tans=`sh -c hostname 2>&1` ; then
8603                 myhostname=$tans
8604                 phostname=hostname
8605                 cont=''
8606         fi
8607         ;;
8608 *) cont='';;
8609 esac
8610 if $test "$cont"; then
8611         if ./xenix; then
8612                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8613                 if tans=`cat /etc/systemid 2>&1` ; then
8614                         myhostname=$tans
8615                         phostname='cat /etc/systemid'
8616                         echo "Whadyaknow.  Xenix always was a bit strange..."
8617                         cont=''
8618                 fi
8619         elif $test -r /etc/systemid; then
8620                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8621         fi
8622 fi
8623 if $test "$cont"; then
8624         echo 'No, maybe "uuname -l" will work...'
8625         if tans=`sh -c 'uuname -l' 2>&1` ; then
8626                 myhostname=$tans
8627                 phostname='uuname -l'
8628         else
8629                 echo 'Strange.  Maybe "uname -n" will work...'
8630                 if tans=`sh -c 'uname -n' 2>&1` ; then
8631                         myhostname=$tans
8632                         phostname='uname -n'
8633                 else
8634                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8635                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8636                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8637                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8638                         else
8639                                 case "$myhostname" in
8640                                 '') echo "Does this machine have an identity crisis or something?"
8641                                         phostname='';;
8642                                 *)
8643                                         echo "Well, you said $myhostname before..."
8644                                         phostname='echo $myhostname';;
8645                                 esac
8646                         fi
8647                 fi
8648         fi
8649 fi
8650 case "$myhostname" in
8651 '') myhostname=noname ;;
8652 esac
8653 : you do not want to know about this
8654 set $myhostname
8655 myhostname=$1
8656
8657 : verify guess
8658 if $test "$myhostname" ; then
8659         dflt=y
8660         rp='Your host name appears to be "'$myhostname'".'" Right?"
8661         . ./myread
8662         case "$ans" in
8663         y*) ;;
8664         *) myhostname='';;
8665         esac
8666 fi
8667
8668 : bad guess or no guess
8669 while $test "X$myhostname" = X ; do
8670         dflt=''
8671         rp="Please type the (one word) name of your host:"
8672         . ./myread
8673         myhostname="$ans"
8674 done
8675
8676 : translate upper to lower if necessary
8677 case "$myhostname" in
8678 *[A-Z]*)
8679         echo "(Normalizing case in your host name)"
8680         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8681         ;;
8682 esac
8683
8684 case "$myhostname" in
8685 *.*)
8686         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8687         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8688         echo "(Trimming domain name from host name--host name is now $myhostname)"
8689         ;;
8690 *) case "$mydomain" in
8691         '')
8692                 {
8693                         test "X$hostcat" = "Xypcat hosts" &&
8694                         ypmatch "$myhostname" hosts 2>/dev/null |\
8695                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8696                         $test -s hosts
8697                 } || {
8698                         test "X$hostcat" != "X" &&
8699                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8700                                         /[       ]$myhostname[  . ]/p" > hosts
8701                 }
8702                 tmp_re="[       . ]"
8703                 if $test -f hosts; then
8704                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8705                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8706                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8707                                 hosts | $sort | $uniq | \
8708                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8709                         case `$echo X$dflt` in
8710                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8711                                 dflt=.
8712                                 ;;
8713                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8714                                 ;;
8715                         esac
8716                 else
8717                         echo "(I cannot locate a hosts database anywhere)"
8718                         dflt=.
8719                 fi
8720                 case "$dflt" in
8721                 .)
8722                         tans=`./loc resolv.conf X /etc /usr/etc`
8723                         if $test -f "$tans"; then
8724                                 echo "(Attempting domain name extraction from $tans)"
8725                                 dflt=.`$sed -n -e 's/   / /g' \
8726                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8727                                   -e 1q 2>/dev/null`
8728                                 case "$dflt" in
8729                                 .) dflt=.`$sed -n -e 's/        / /g' \
8730                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8731                                      -e 1q 2>/dev/null`
8732                                         ;;
8733                                 esac
8734                         fi
8735                         ;;
8736                 esac
8737                 case "$dflt" in
8738                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8739                         dflt=.`sh -c domainname 2>/dev/null`
8740                         case "$dflt" in
8741                         '') dflt='.';;
8742                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8743                         esac
8744                         ;;
8745                 esac
8746                 case "$dflt$osname" in
8747                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8748                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8749                         ;;
8750                 esac
8751                 case "$dflt" in
8752                 .) echo "(Lost all hope -- silly guess then)"
8753                         dflt='.nonet'
8754                         ;;
8755                 esac
8756                 $rm -f hosts
8757                 ;;
8758         *) dflt="$mydomain";;
8759         esac;;
8760 esac
8761 echo " "
8762 rp="What is your domain name?"
8763 . ./myread
8764 tans="$ans"
8765 case "$ans" in
8766 '') ;;
8767 .*) ;;
8768 *) tans=".$tans";;
8769 esac
8770 mydomain="$tans"
8771
8772 : translate upper to lower if necessary
8773 case "$mydomain" in
8774 *[A-Z]*)
8775         echo "(Normalizing case in your domain name)"
8776         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8777         ;;
8778 esac
8779
8780 : a little sanity check here
8781 case "$phostname" in
8782 '') ;;
8783 *)
8784         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8785         $myhostname$mydomain|$myhostname) ;;
8786         *)
8787                 case "$phostname" in
8788                 sed*)
8789                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8790                         ;;
8791                 *)
8792                         echo "(That doesn't agree with your $phostname command, by the way.)"
8793                         ;;
8794                 esac
8795         ;;
8796         esac
8797         ;;
8798 esac
8799
8800 : determine the e-mail address of the user who is running us
8801 $cat <<EOM
8802
8803 I need to get your e-mail address in Internet format if possible, i.e.
8804 something like user@host.domain. Please answer accurately since I have
8805 no easy means to double check it. The default value provided below
8806 is most probably close to reality but may not be valid from outside
8807 your organization...
8808
8809 EOM
8810 cont=x
8811 while test "$cont"; do
8812         case "$cf_email" in
8813         '') dflt="$cf_by@$myhostname$mydomain";;
8814         *) dflt="$cf_email";;
8815         esac
8816         rp='What is your e-mail address?'
8817         . ./myread
8818         cf_email="$ans"
8819         case "$cf_email" in
8820         *@*.*) cont='' ;;
8821         *)
8822                 rp='Address does not look like an Internet one.  Use it anyway?'
8823                 case "$fastread" in
8824                 yes) dflt=y ;;
8825                 *) dflt=n ;;
8826                 esac
8827                 . ./myread
8828                 case "$ans" in
8829                 y*) cont='' ;;
8830                 *) echo " " ;;
8831                 esac
8832                 ;;
8833         esac
8834 done
8835
8836 : Ask e-mail of administrator
8837 $cat <<EOM
8838
8839 If you or somebody else will be maintaining perl at your site, please
8840 fill in the correct e-mail address here so that they may be contacted
8841 if necessary. Currently, the "perlbug" program included with perl
8842 will send mail to this address in addition to perlbug@perl.org. You may
8843 enter "none" for no administrator.
8844
8845 EOM
8846 case "$perladmin" in
8847 '') dflt="$cf_email";;
8848 *) dflt="$perladmin";;
8849 esac
8850 rp='Perl administrator e-mail address'
8851 . ./myread
8852 perladmin="$ans"
8853
8854 : determine whether to only install version-specific parts.
8855 echo " "
8856 $cat <<EOM
8857 Do you want to install only the version-specific parts of the perl
8858 distribution?  Usually you do *not* want to do this.
8859 EOM
8860 case "$versiononly" in
8861 "$define"|[Yy]*|true) dflt='y' ;;
8862 *) dflt='n';
8863 esac
8864 rp="Do you want to install only the version-specific parts of perl?"
8865 . ./myread
8866 case "$ans" in
8867 [yY]*)  val="$define";;
8868 *)      val="$undef" ;;
8869 esac
8870 set versiononly
8871 eval $setvar
8872
8873 case "$versiononly" in
8874 "$define") inc_version_list=''
8875            inc_version_list_init=0
8876            ;;
8877 esac
8878
8879 : figure out how to guarantee perl startup
8880 : XXX Note that this currently takes advantage of the bug that binexp ignores
8881 :     the Configure -Dinstallprefix setting, which in turn means that under
8882 :     relocatable @INC, initialinstalllocation is what binexp started as.
8883 case "$startperl" in
8884 '')
8885         case "$sharpbang" in
8886         *!)
8887                 $cat <<EOH
8888
8889 I can use the #! construct to start perl on your system. This will
8890 make startup of perl scripts faster, but may cause problems if you
8891 want to share those scripts and perl is not in a standard place
8892 ($initialinstalllocation/perl) on all your platforms. The alternative
8893 is to force a shell by starting the script with a single ':' character.
8894
8895 EOH
8896                 case "$versiononly" in
8897                 "$define")      dflt="$initialinstalllocation/perl$version";;
8898                 *)              dflt="$initialinstalllocation/perl";;
8899                 esac
8900                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8901                 . ./myread
8902                 case "$ans" in
8903                 none)   startperl=": # use perl";;
8904                 *)      startperl="#!$ans"
8905                         if $test 30 -lt `echo "$ans" | wc -c`; then
8906                                 $cat >&4 <<EOM
8907
8908 WARNING:  Some systems limit the #! command to 32 characters.
8909 If you experience difficulty running Perl scripts with #!, try
8910 installing Perl in a directory with a shorter pathname.
8911
8912 EOM
8913                         fi ;;
8914                 esac
8915                 ;;
8916         *) startperl=": # use perl"
8917                 ;;
8918         esac
8919         ;;
8920 esac
8921 echo "I'll use $startperl to start perl scripts."
8922
8923 : figure best path for perl in scripts
8924 case "$perlpath" in
8925 '')
8926         case "$versiononly" in
8927         "$define")      perlpath="$initialinstalllocation/perl$version";;
8928         *)              perlpath="$initialinstalllocation/perl";;
8929         esac
8930         case "$startperl" in
8931         *!*) ;;
8932         *)
8933                 $cat <<EOH
8934
8935 I will use the "eval 'exec'" idiom to start Perl on your system.
8936 I can use the full path of your Perl binary for this purpose, but
8937 doing so may cause problems if you want to share those scripts and
8938 Perl is not always in a standard place ($initialinstalllocation/perl).
8939
8940 EOH
8941                 dflt="$initialinstalllocation/perl"
8942                 rp="What path shall I use in \"eval 'exec'\"?"
8943                 . ./myread
8944                 perlpath="$ans"
8945                 ;;
8946         esac
8947         ;;
8948 esac
8949 case "$startperl" in
8950 *!*)    ;;
8951 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8952 esac
8953
8954 : determine where public executable scripts go
8955 set scriptdir scriptdir
8956 eval $prefixit
8957 case "$scriptdir" in
8958 '')
8959         dflt="$bin"
8960         : guess some guesses
8961         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8962         $test -d /usr/share/bin     && dflt=/usr/share/bin
8963         $test -d /usr/local/script  && dflt=/usr/local/script
8964         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8965         $test -d $prefixexp/script  && dflt=$prefixexp/script
8966         set dflt
8967         eval $prefixup
8968         ;;
8969 *)  dflt="$scriptdir"
8970         ;;
8971 esac
8972 $cat <<EOM
8973
8974 Some installations have a separate directory just for executable scripts so
8975 that they can mount it across multiple architectures but keep the scripts in
8976 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8977 Or you might just lump your scripts in with all your other executables.
8978
8979 EOM
8980 fn=d~
8981 rp='Where do you keep publicly executable scripts?'
8982 . ./getfile
8983 if $test "X$ansexp" != "X$scriptdirexp"; then
8984         installscript=''
8985 fi
8986 installscriptdir=''
8987 prefixvar=scriptdir
8988 . ./setprefixvar
8989 : A little fix up for an irregularly named variable.
8990 installscript="$installscriptdir"
8991
8992 : determine where add-on public executables go
8993 case "$sitebin" in
8994 '')     dflt=$siteprefix/bin ;;
8995 *)      dflt=$sitebin ;;
8996 esac
8997 fn=d~
8998 rp='Pathname where the add-on public executables should be installed?'
8999 . ./getfile
9000 prefixvar=sitebin
9001 . ./setprefixvar
9002
9003 : determine where add-on html pages go
9004 : There is no standard location, so try to copy the previously-selected
9005 : directory structure for the core html pages.
9006 case "$sitehtml1dir" in
9007 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9008 *)     dflt=$sitehtml1dir ;;
9009 esac
9010 case "$dflt" in
9011 ''|' ') dflt=none ;;
9012 esac
9013 fn=dn+~
9014 rp='Pathname where the site-specific html pages should be installed?'
9015 . ./getfile
9016 prefixvar=sitehtml1dir
9017 . ./setprefixvar
9018
9019 : determine where add-on library html pages go
9020 : There is no standard location, so try to copy the previously-selected
9021 : directory structure for the core html pages.
9022 case "$sitehtml3dir" in
9023 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9024 *)     dflt=$sitehtml3dir ;;
9025 esac
9026 case "$dflt" in
9027 ''|' ') dflt=none ;;
9028 esac
9029 fn=dn+~
9030 rp='Pathname where the site-specific library html pages should be installed?'
9031 . ./getfile
9032 prefixvar=sitehtml3dir
9033 . ./setprefixvar
9034
9035 : determine where add-on manual pages go
9036 case "$siteman1dir" in
9037 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9038 *)      dflt=$siteman1dir ;;
9039 esac
9040 case "$dflt" in
9041 ''|' ') dflt=none ;;
9042 esac
9043 fn=dn+~
9044 rp='Pathname where the site-specific manual pages should be installed?'
9045 . ./getfile
9046 prefixvar=siteman1dir
9047 . ./setprefixvar
9048
9049 : determine where add-on library man pages go
9050 case "$siteman3dir" in
9051 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9052 *)      dflt=$siteman3dir ;;
9053 esac
9054 case "$dflt" in
9055 ''|' ') dflt=none ;;
9056 esac
9057 fn=dn+~
9058 rp='Pathname where the site-specific library manual pages should be installed?'
9059 . ./getfile
9060 prefixvar=siteman3dir
9061 . ./setprefixvar
9062
9063 : determine where add-on public executable scripts go
9064 case "$sitescript" in
9065 '')     dflt=$siteprefix/script
9066         $test -d $dflt || dflt=$sitebin ;;
9067 *)  dflt="$sitescript" ;;
9068 esac
9069 fn=d~+
9070 rp='Pathname where add-on public executable scripts should be installed?'
9071 . ./getfile
9072 prefixvar=sitescript
9073 . ./setprefixvar
9074
9075 : Check if faststdio is requested and available
9076 case "$usefaststdio" in
9077 $define|true|[yY]*|'')
9078         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9079         case "$xversion" in
9080         [68])   dflt='y' ;;
9081         *)      dflt='n' ;;
9082         esac
9083         ;;
9084 *) dflt='n';;
9085 esac
9086 cat <<EOM
9087
9088 Perl can be built to use 'fast stdio', which means using the stdio
9089 library but also directly manipulating the stdio buffers to enable
9090 faster I/O.  Using stdio is better for backward compatibility (especially
9091 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9092 interface has been preferred instead of stdio.
9093
9094 If this doesn't make any sense to you, just accept the default '$dflt'.
9095 EOM
9096 rp='Use the "fast stdio" if available?'
9097 . ./myread
9098 case "$ans" in
9099 y|Y)    val="$define" ;;
9100 *)      val="$undef" ;;
9101 esac
9102 set usefaststdio
9103 eval $setvar
9104
9105
9106 : define an is-a-typedef? function
9107 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9108 case "$inclist" in
9109 "") inclist="sys/types.h";;
9110 esac;
9111 eval "varval=\$$var";
9112 case "$varval" in
9113 "")
9114         $rm -f temp.c;
9115         for inc in $inclist; do
9116                 echo "#include <$inc>" >>temp.c;
9117         done;
9118         echo "#ifdef $type" >> temp.c;
9119         echo "printf(\"We have $type\");" >> temp.c;
9120         echo "#endif" >> temp.c;
9121         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9122         if $contains $type temp.E >/dev/null 2>&1; then
9123                 eval "$var=\$type";
9124         else
9125                 eval "$var=\$def";
9126         fi;
9127         $rm -f temp.?;;
9128 *) eval "$var=\$varval";;
9129 esac'
9130
9131 : define an is-a-typedef? function that prompts if the type is not available.
9132 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9133 case "$inclist" in
9134 "") inclist="sys/types.h";;
9135 esac;
9136 eval "varval=\$$var";
9137 case "$varval" in
9138 "")
9139         $rm -f temp.c;
9140         for inc in $inclist; do
9141                 echo "#include <$inc>" >>temp.c;
9142         done;
9143         echo "#ifdef $type" >> temp.c;
9144         echo "printf(\"We have $type\");" >> temp.c;
9145         echo "#endif" >> temp.c;
9146         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9147         echo " " ;
9148         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9149         if $contains $type temp.E >/dev/null 2>&1; then
9150                 echo "$type found." >&4;
9151                 eval "$var=\$type";
9152         else
9153                 echo "$type NOT found." >&4;
9154                 dflt="$def";
9155                 . ./myread ;
9156                 eval "$var=\$ans";
9157         fi;
9158         $rm -f temp.?;;
9159 *) eval "$var=\$varval";;
9160 esac'
9161
9162 : see what type lseek is declared as in the kernel
9163 rp="What is the type used for lseek's offset on this system?"
9164 set off_t lseektype long stdio.h sys/types.h
9165 eval $typedef_ask
9166
9167 echo " "
9168 echo "Checking to see how big your file offsets are..." >&4
9169 $cat >try.c <<EOCP
9170 #include <sys/types.h>
9171 #include <stdio.h>
9172 int main()
9173 {
9174     printf("%d\n", (int)sizeof($lseektype));
9175     return(0);
9176 }
9177 EOCP
9178 set try
9179 if eval $compile_ok; then
9180         lseeksize=`$run ./try`
9181         echo "Your file offsets are $lseeksize bytes long."
9182 else
9183         dflt=$longsize
9184         echo " "
9185         echo "(I can't seem to compile the test program.  Guessing...)"
9186         rp="What is the size of your file offsets (in bytes)?"
9187         . ./myread
9188         lseeksize="$ans"
9189 fi
9190 $rm_try
9191
9192 : see what type file positions are declared as in the library
9193 rp="What is the type for file position used by fsetpos()?"
9194 set fpos_t fpostype long stdio.h sys/types.h
9195 eval $typedef_ask
9196
9197 : Check size for Fpos_t
9198 echo " "
9199 case "$fpostype" in
9200 *_t) zzz="$fpostype"    ;;
9201 *)   zzz="fpos_t"       ;;
9202 esac
9203 echo "Checking the size of $zzz..." >&4
9204 cat > try.c <<EOCP
9205 #include <sys/types.h>
9206 #include <stdio.h>
9207 #$i_stdlib I_STDLIB
9208 #ifdef I_STDLIB
9209 #include <stdlib.h>
9210 #endif
9211 int main() {
9212     printf("%d\n", (int)sizeof($fpostype));
9213     exit(0);
9214 }
9215 EOCP
9216 set try
9217 if eval $compile_ok; then
9218         yyy=`$run ./try`
9219         case "$yyy" in
9220         '')     fpossize=4
9221                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9222                 ;;
9223         *)      fpossize=$yyy
9224                 echo "Your $zzz is $fpossize bytes long."
9225                 ;;
9226         esac
9227 else
9228         dflt="$longsize"
9229         echo " " >&4
9230         echo "(I can't compile the test program.  Guessing...)" >&4
9231         rp="What is the size of your file positions (in bytes)?"
9232         . ./myread
9233         fpossize="$ans"
9234 fi
9235
9236 : Check for large file support
9237 # Backward compatibility (uselfs is deprecated).
9238 case "$uselfs" in
9239 "$define"|true|[yY]*)
9240         cat <<EOM >&4
9241
9242 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9243 EOM
9244         uselargefiles="$define"
9245         ;;
9246 esac
9247
9248 case "$lseeksize:$fpossize" in
9249 8:8) cat <<EOM
9250
9251 You can have files larger than 2 gigabytes.
9252 EOM
9253    val="$define" ;;
9254 *)    case "$uselargefiles" in
9255    "$undef"|false|[nN]*) dflt='n' ;;
9256    *)   dflt='y' ;;
9257    esac
9258    cat <<EOM
9259
9260 Perl can be built to understand large files (files larger than 2 gigabytes)
9261 on some systems.  To do so, Configure can be run with -Duselargefiles.
9262
9263 If this doesn't make any sense to you, just accept the default '$dflt'.
9264 EOM
9265    rp='Try to understand large files, if available?'
9266    . ./myread
9267    case "$ans" in
9268    y|Y)         val="$define" ;;
9269    *)           val="$undef"  ;;
9270    esac
9271    ;;
9272 esac
9273 set uselargefiles
9274 eval $setvar
9275 : Look for a hint-file generated 'call-back-unit'.  If the
9276 : user has specified that a large files perl is to be built,
9277 : we may need to set or change some other defaults.
9278 if $test -f uselargefiles.cbu; then
9279         echo "Your platform has some specific hints regarding large file builds, using them..."
9280         . ./uselargefiles.cbu
9281 fi
9282 case "$uselargefiles" in
9283 "$define")
9284         if $test -f uselargefiles.cbu; then
9285                 echo " "
9286                 echo "Rechecking to see how big your file offsets are..." >&4
9287                 $cat >try.c <<EOCP
9288 #include <sys/types.h>
9289 #include <stdio.h>
9290 int main()
9291 {
9292     printf("%d\n", (int)sizeof($lseektype));
9293     return(0);
9294 }
9295 EOCP
9296                 set try
9297                 if eval $compile_ok; then
9298                         lseeksize=`$run ./try`
9299                         $echo "Your file offsets are now $lseeksize bytes long."
9300                 else
9301                         dflt="$lseeksize"
9302                         echo " "
9303                         echo "(I can't seem to compile the test program.  Guessing...)"
9304                         rp="What is the size of your file offsets (in bytes)?"
9305                         . ./myread
9306                         lseeksize="$ans"
9307                 fi
9308                 case "$fpostype" in
9309                 *_t) zzz="$fpostype"    ;;
9310                 *)   zzz="fpos_t"       ;;
9311                 esac
9312                 $echo $n "Rechecking the size of $zzz...$c" >&4
9313                 $cat > try.c <<EOCP
9314 #include <sys/types.h>
9315 #include <stdio.h>
9316 #$i_stdlib I_STDLIB
9317 #ifdef I_STDLIB
9318 #include <stdlib.h>
9319 #endif
9320 int main() {
9321     printf("%d\n", (int)sizeof($fpostype));
9322     return(0);
9323 }
9324 EOCP
9325                 set try
9326                 if eval $compile_ok; then
9327                         yyy=`$run ./try`
9328                         dflt="$lseeksize"
9329                         case "$yyy" in
9330                         '')     echo " "
9331                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9332                                 ;;
9333                         *)      fpossize=$yyy
9334                                 echo " $fpossize bytes." >&4
9335                                 ;;
9336                         esac
9337                 else
9338                         dflt="$fpossize"
9339                         echo " "
9340                         echo "(I can't compile the test program.  Guessing...)" >&4
9341                         rp="What is the size of your file positions (in bytes)?"
9342                         . ./myread
9343                         fpossize="$ans"
9344                 fi
9345                 $rm_try
9346         fi
9347         ;;
9348 esac
9349
9350 : Set the vendorbin variables
9351 case "$vendorprefix" in
9352 '')     d_vendorbin="$undef"
9353         vendorbin=''
9354         vendorbinexp=''
9355         ;;
9356 *)      d_vendorbin="$define"
9357         : determine where vendor-supplied executables go.
9358         case "$vendorbin" in
9359         '') dflt=$vendorprefix/bin ;;
9360         *)      dflt="$vendorbin" ;;
9361         esac
9362         fn=d~+
9363         rp='Pathname for the vendor-supplied executables directory?'
9364         . ./getfile
9365         vendorbin="$ans"
9366         vendorbinexp="$ansexp"
9367         ;;
9368 esac
9369 prefixvar=vendorbin
9370 . ./installprefix
9371
9372 : Set the vendorhtml1dir variables
9373 case "$vendorprefix" in
9374 '')     vendorhtml1dir=''
9375         vendorhtml1direxp=''
9376         ;;
9377 *)      : determine where vendor-supplied html pages go.
9378         : There is no standard location, so try to copy the previously-selected
9379         : directory structure for the core html pages.
9380         : XXX Better default suggestions would be welcome.
9381         case "$vendorhtml1dir" in
9382         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9383         *)      dflt=$vendorhtml1dir ;;
9384         esac
9385         case "$dflt" in
9386         ''|' ') dflt=none ;;
9387         esac
9388         fn=dn+~
9389         rp='Pathname for the vendor-supplied html pages?'
9390         . ./getfile
9391         vendorhtml1dir="$ans"
9392         vendorhtml1direxp="$ansexp"
9393         ;;
9394 esac
9395 : Use ' ' for none so value is preserved next time through Configure
9396 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9397 prefixvar=vendorhtml1dir
9398 . ./installprefix
9399
9400 : Set the vendorhtml3dir variables
9401 case "$vendorprefix" in
9402 '')     vendorhtml3dir=''
9403         vendorhtml3direxp=''
9404         ;;
9405 *)      : determine where vendor-supplied module html pages go.
9406         : There is no standard location, so try to copy the previously-selected
9407         : directory structure for the core html pages.
9408         : XXX Better default suggestions would be welcome.
9409         case "$vendorhtml3dir" in
9410         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9411         *)      dflt=$vendorhtml3dir ;;
9412         esac
9413         case "$dflt" in
9414         ''|' ') dflt=none ;;
9415         esac
9416         fn=dn+~
9417         rp='Pathname for the vendor-supplied html pages?'
9418         . ./getfile
9419         vendorhtml3dir="$ans"
9420         vendorhtml3direxp="$ansexp"
9421         ;;
9422 esac
9423 : Use ' ' for none so value is preserved next time through Configure
9424 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9425 prefixvar=vendorhtml3dir
9426 . ./installprefix
9427
9428 : Set the vendorman1dir variables
9429 case "$vendorprefix" in
9430 '')     vendorman1dir=''
9431         vendorman1direxp=''
9432         ;;
9433 *)      : determine where vendor-supplied manual pages go.
9434         case "$vendorman1dir" in
9435         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9436         *)      dflt=$vendorman1dir ;;
9437         esac
9438         case "$dflt" in
9439         ''|' ') dflt=none ;;
9440         esac
9441         fn=nd~+
9442         rp='Pathname for the vendor-supplied manual section 1 pages?'
9443         . ./getfile
9444         vendorman1dir="$ans"
9445         vendorman1direxp="$ansexp"
9446         ;;
9447 esac
9448 : Use ' ' for none so value is preserved next time through Configure
9449 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9450 prefixvar=vendorman1dir
9451 . ./installprefix
9452
9453 : Set the vendorman3dir variables
9454 case "$vendorprefix" in
9455 '')     vendorman3dir=''
9456         vendorman3direxp=''
9457         ;;
9458 *)      : determine where vendor-supplied module manual pages go.
9459         case "$vendorman3dir" in
9460         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9461         *)      dflt=$vendorman3dir ;;
9462         esac
9463         case "$dflt" in
9464         ''|' ') dflt=none ;;
9465         esac
9466         fn=nd~+
9467         rp='Pathname for the vendor-supplied manual section 3 pages?'
9468         . ./getfile
9469         vendorman3dir="$ans"
9470         vendorman3direxp="$ansexp"
9471         ;;
9472 esac
9473 : Use ' ' for none so value is preserved next time through Configure
9474 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9475 prefixvar=vendorman3dir
9476 . ./installprefix
9477
9478 : Set the vendorscript variables
9479 case "$vendorprefix" in
9480 '')     d_vendorscript="$undef"
9481         vendorscript=''
9482         vendorscriptexp=''
9483         ;;
9484 *)      d_vendorscript="$define"
9485         : determine where vendor-supplied scripts go.
9486         case "$vendorscript" in
9487         '')     dflt=$vendorprefix/script
9488                 $test -d $dflt || dflt=$vendorbin ;;
9489         *)  dflt="$vendorscript" ;;
9490         esac
9491         $cat <<EOM
9492
9493 The installation process will create a directory for
9494 vendor-supplied scripts.
9495
9496 EOM
9497         fn=d~+
9498         rp='Pathname for the vendor-supplied scripts directory?'
9499         . ./getfile
9500         vendorscript="$ans"
9501         vendorscriptexp="$ansexp"
9502         ;;
9503 esac
9504 prefixvar=vendorscript
9505 . ./installprefix
9506
9507 : script used to emit important warnings
9508 cat >warn <<EOS
9509 $startsh
9510 if test \$# -gt 0; then
9511         echo "\$@" >msg
9512 else
9513         cat >msg
9514 fi
9515 echo "*** WARNING:" >&4
9516 sed -e 's/^/*** /' <msg >&4
9517 echo "*** " >&4
9518 cat msg >>config.msg
9519 echo " " >>config.msg
9520 rm -f msg
9521 EOS
9522 chmod +x warn
9523 $eunicefix warn
9524
9525 : see which of string.h or strings.h is needed
9526 echo " "
9527 strings=`./findhdr string.h`
9528 if $test "$strings" && $test -r "$strings"; then
9529         echo "Using <string.h> instead of <strings.h>." >&4
9530         val="$define"
9531 else
9532         val="$undef"
9533         strings=`./findhdr strings.h`
9534         if $test "$strings" && $test -r "$strings"; then
9535                 echo "Using <strings.h> instead of <string.h>." >&4
9536         else
9537                 ./warn "No string header found -- You'll surely have problems."
9538         fi
9539 fi
9540 set i_string
9541 eval $setvar
9542 case "$i_string" in
9543 "$undef") strings=`./findhdr strings.h`;;
9544 *)        strings=`./findhdr string.h`;;
9545 esac
9546
9547 : see if qgcvt exists
9548 set qgcvt d_qgcvt
9549 eval $inlibc
9550
9551 : Check print/scan long double stuff
9552 echo " "
9553
9554 if $test X"$d_longdbl" = X"$define"; then
9555
9556 echo "Checking how to print long doubles..." >&4
9557
9558 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9559         $cat >try.c <<'EOCP'
9560 #include <sys/types.h>
9561 #include <stdio.h>
9562 int main() {
9563   double d = 123.456;
9564   printf("%.3f\n", d);
9565 }
9566 EOCP
9567         set try
9568         if eval $compile; then
9569                 yyy=`$run ./try`
9570                 case "$yyy" in
9571                 123.456)
9572                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9573                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9574                         echo "We will use %f."
9575                         ;;
9576                 esac
9577         fi
9578 fi
9579
9580 if $test X"$sPRIfldbl" = X; then
9581         $cat >try.c <<'EOCP'
9582 #include <sys/types.h>
9583 #include <stdio.h>
9584 int main() {
9585   long double d = 123.456;
9586   printf("%.3Lf\n", d);
9587 }
9588 EOCP
9589         set try
9590         if eval $compile; then
9591                 yyy=`$run ./try`
9592                 case "$yyy" in
9593                 123.456)
9594                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9595                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9596                         echo "We will use %Lf."
9597                         ;;
9598                 esac
9599         fi
9600 fi
9601
9602 if $test X"$sPRIfldbl" = X; then
9603         $cat >try.c <<'EOCP'
9604 #include <sys/types.h>
9605 #include <stdio.h>
9606 int main() {
9607   long double d = 123.456;
9608   printf("%.3llf\n", d);
9609 }
9610 EOCP
9611         set try
9612         if eval $compile; then
9613                 yyy=`$run ./try`
9614                 case "$yyy" in
9615                 123.456)
9616                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9617                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9618                         echo "We will use %llf."
9619                         ;;
9620                 esac
9621         fi
9622 fi
9623
9624 if $test X"$sPRIfldbl" = X; then
9625         $cat >try.c <<'EOCP'
9626 #include <sys/types.h>
9627 #include <stdio.h>
9628 int main() {
9629   long double d = 123.456;
9630   printf("%.3lf\n", d);
9631 }
9632 EOCP
9633         set try
9634         if eval $compile; then
9635                 yyy=`$run ./try`
9636                 case "$yyy" in
9637                 123.456)
9638                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9639                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9640                         echo "We will use %lf."
9641                         ;;
9642                 esac
9643         fi
9644 fi
9645
9646 if $test X"$sPRIfldbl" = X; then
9647         echo "Cannot figure out how to print long doubles." >&4
9648 else
9649         sSCNfldbl=$sPRIfldbl    # expect consistency
9650 fi
9651
9652 $rm_try
9653
9654 fi # d_longdbl
9655
9656 case "$sPRIfldbl" in
9657 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9658         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9659         d_SCNfldbl="$undef";
9660         ;;
9661 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9662         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9663         d_SCNfldbl="$define";
9664         ;;
9665 esac
9666
9667 : Check how to convert floats to strings.
9668
9669 if test "X$d_Gconvert" = X; then
9670
9671 echo " "
9672 echo "Checking for an efficient way to convert floats to strings."
9673 echo " " > try.c
9674 case "$uselongdouble" in
9675 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9676 esac
9677 case "$d_longdbl" in
9678 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9679 esac
9680 case "$d_PRIgldbl" in
9681 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9682 esac
9683 $cat >>try.c <<EOP
9684 #ifdef TRY_gconvert
9685 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9686 char *myname = "gconvert";
9687 #endif
9688 #ifdef TRY_gcvt
9689 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9690 char *myname = "gcvt";
9691 #endif
9692 #ifdef TRY_qgcvt
9693 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9694 char *myname = "qgcvt";
9695 #define DOUBLETYPE long double
9696 #endif
9697 #ifdef TRY_sprintf
9698 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9699 #ifdef HAS_PRIgldbl
9700 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9701 #else
9702 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9703 #endif
9704 #else
9705 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9706 #endif
9707 char *myname = "sprintf";
9708 #endif
9709
9710 #ifndef DOUBLETYPE
9711 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9712 #define DOUBLETYPE long double
9713 #else
9714 #define DOUBLETYPE double
9715 #endif
9716 #endif
9717
9718 #include <stdio.h>
9719
9720 #$i_stdlib I_STDLIB
9721 #ifdef I_STDLIB
9722 #include <stdlib.h>
9723 #endif
9724 #$i_string I_STRING
9725 #ifdef I_STRING
9726 #  include <string.h>
9727 #else
9728 #  include <strings.h>
9729 #endif
9730
9731 int checkit(char *expect, char *got)
9732 {
9733     if (strcmp(expect, got)) {
9734                 printf("%s oddity:  Expected %s, got %s\n",
9735                         myname, expect, got);
9736                 exit(1);
9737         }
9738 }
9739
9740 int main()
9741 {
9742         char buf[64];
9743         buf[63] = '\0';
9744
9745         /* This must be 1st test on (which?) platform */
9746         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9747         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9748         checkit("0.1", buf);
9749
9750         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9751         checkit("0.01", buf);
9752
9753         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9754         checkit("0.001", buf);
9755
9756         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9757         checkit("0.0001", buf);
9758
9759         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9760         if (strlen(buf) > 5)
9761             checkit("9e-005", buf); /* for Microsoft ?? */
9762         else
9763             checkit("9e-05", buf);
9764
9765         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9766         checkit("1", buf);
9767
9768         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9769         checkit("1.1", buf);
9770
9771         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9772         checkit("1.01", buf);
9773
9774         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9775         checkit("1.001", buf);
9776
9777         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9778         checkit("1.0001", buf);
9779
9780         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9781         checkit("1.00001", buf);
9782
9783         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9784         checkit("1.000001", buf);
9785
9786         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9787         checkit("0", buf);
9788
9789         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9790         checkit("-1", buf);
9791
9792         /* Some Linux gcvt's give 1.e+5 here. */
9793         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9794         checkit("100000", buf);
9795
9796         /* Some Linux gcvt's give -1.e+5 here. */
9797         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9798         checkit("-100000", buf);
9799
9800         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9801         checkit("123.456", buf);
9802
9803         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9804         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9805         /* 34 should be enough to scare even long double
9806          * places into using the e notation. */
9807         if (strlen(buf) > 5)
9808             checkit("1e+034", buf); /* for Microsoft */
9809         else
9810             checkit("1e+34", buf);
9811
9812         /* For Perl, if you add additional tests here, also add them to
9813          * t/base/num.t for benefit of platforms not using Configure or
9814          * overriding d_Gconvert */
9815
9816         exit(0);
9817 }
9818 EOP
9819 : first add preferred functions to our list
9820 xxx_list=""
9821 for xxx_convert in $gconvert_preference; do
9822     case $xxx_convert in
9823     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9824     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9825     esac
9826 done
9827 : then add any others
9828 for xxx_convert in gconvert gcvt sprintf; do
9829     case "$xxx_list" in
9830     *$xxx_convert*) ;;
9831     *) xxx_list="$xxx_list $xxx_convert" ;;
9832     esac
9833 done
9834
9835 case "$d_longdbl$uselongdouble" in
9836 "$define$define")
9837     : again, add prefered functions to our list first
9838     xxx_ld_list=""
9839     for xxx_convert in $gconvert_ld_preference; do
9840         case $xxx_convert in
9841         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9842         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9843         esac
9844     done
9845     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9846     for xxx_convert in qgcvt sprintf $xxx_list; do
9847         case "$xxx_ld_list" in
9848         $xxx_convert*|*" $xxx_convert"*) ;;
9849         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9850         esac
9851     done
9852     : if sprintf cannot do long doubles, move it to the end
9853     if test "$d_PRIgldbl" != "$define"; then
9854         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9855     fi
9856     : if no qgcvt, remove it
9857     if test "$d_qgcvt" != "$define"; then
9858         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9859     fi
9860     : use the ld_list
9861     xxx_list="$xxx_ld_list"
9862     ;;
9863 esac
9864
9865 for xxx_convert in $xxx_list; do
9866         echo "Trying $xxx_convert..."
9867         $rm -f try try$_o core
9868         set try -DTRY_$xxx_convert
9869         if eval $compile; then
9870                 echo "$xxx_convert() found." >&4
9871                 if $run ./try; then
9872                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9873                         break;
9874                 else
9875                         echo "...But $xxx_convert didn't work as I expected."
9876                         xxx_convert=''
9877                 fi
9878         else
9879                 echo "$xxx_convert NOT found." >&4
9880         fi
9881 done
9882
9883 if test X$xxx_convert = X; then
9884     echo "*** WHOA THERE!!! ***" >&4
9885     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9886     xxx_convert=sprintf
9887 fi
9888
9889 case "$xxx_convert" in
9890 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9891 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9892 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9893 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9894    "$define$define$define")
9895       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9896    "$define$define$undef")
9897       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9898    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9899    esac
9900    ;;
9901 esac
9902
9903 fi
9904 $rm_try
9905
9906 : see if _fwalk exists
9907 set fwalk d__fwalk
9908 eval $inlibc
9909
9910 : Initialize h_fcntl
9911 h_fcntl=false
9912
9913 : Initialize h_sysfile
9914 h_sysfile=false
9915
9916 : access call always available on UNIX
9917 set access d_access
9918 eval $inlibc
9919
9920 : locate the flags for 'access()'
9921 case "$d_access" in
9922 "$define")
9923         echo " "
9924         $cat >access.c <<EOCP
9925 #include <sys/types.h>
9926 #ifdef I_FCNTL
9927 #include <fcntl.h>
9928 #endif
9929 #ifdef I_SYS_FILE
9930 #include <sys/file.h>
9931 #endif
9932 #ifdef I_UNISTD
9933 #include <unistd.h>
9934 #endif
9935 #$i_stdlib I_STDLIB
9936 #ifdef I_STDLIB
9937 #include <stdlib.h>
9938 #endif
9939 int main() {
9940         exit(R_OK);
9941 }
9942 EOCP
9943         : check sys/file.h first, no particular reason here
9944         if $test `./findhdr sys/file.h` && \
9945                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9946                 h_sysfile=true;
9947                 echo "<sys/file.h> defines the *_OK access constants." >&4
9948         elif $test `./findhdr fcntl.h` && \
9949                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9950                 h_fcntl=true;
9951                 echo "<fcntl.h> defines the *_OK access constants." >&4
9952         elif $test `./findhdr unistd.h` && \
9953                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9954                 echo "<unistd.h> defines the *_OK access constants." >&4
9955         else
9956                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9957         fi
9958         ;;
9959 esac
9960 $rm -f access*
9961
9962 : see if accessx exists
9963 set accessx d_accessx
9964 eval $inlibc
9965
9966 : see if aintl exists
9967 set aintl d_aintl
9968 eval $inlibc
9969
9970 : see if alarm exists
9971 set alarm d_alarm
9972 eval $inlibc
9973
9974 : see if 64bit time functions exists
9975
9976 set ctime64 d_ctime64
9977 eval $inlibc
9978
9979 set localtime64 d_localtime64
9980 eval $inlibc
9981
9982 set gmtime64 d_gmtime64
9983 eval $inlibc
9984
9985 set mktime64 d_mktime64
9986 eval $inlibc
9987
9988 set difftime64 d_difftime64
9989 eval $inlibc
9990
9991 set asctime64 d_asctime64
9992 eval $inlibc
9993
9994 : see if POSIX threads are available
9995 set pthread.h i_pthread
9996 eval $inhdr
9997
9998 : define a fucntion to check prototypes
9999 $cat > protochk <<EOSH
10000 $startsh
10001 cc="$cc"
10002 optimize="$optimize"
10003 ccflags="$ccflags"
10004 prototype="$prototype"
10005 define="$define"
10006 rm_try="$rm_try"
10007 usethreads=$usethreads
10008 i_pthread=$i_pthread
10009 pthread_h_first=$pthread_h_first
10010 EOSH
10011
10012 $cat >> protochk <<'EOSH'
10013
10014 $rm_try
10015 foo="$1"
10016 shift
10017 while test $# -ge 2; do
10018         case "$1" in
10019                 $define) echo "#include <$2>" >> try.c ;;
10020                 literal) echo "$2" >> try.c ;;
10021         esac
10022     # Extra magic for the benefit of systems that need pthread.h
10023     # to be included early to correctly detect threadsafe functions.
10024     # Such functions must guarantee themselves, though, that the usethreads
10025     # and i_pthread have been defined, before calling protochk.
10026     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10027         echo "#include <pthread.h>" >> try.c
10028         pthread_h_done=yes
10029     fi
10030     shift 2
10031 done
10032 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10033 cat >> try.c <<'EOCP'
10034 #ifdef CAN_PROTOTYPE
10035 #define _(args) args
10036 #else
10037 #define _(args) ()
10038 #endif
10039 EOCP
10040 echo "$foo" >> try.c
10041 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10042 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10043 status=$?
10044 $rm_try
10045 exit $status
10046 EOSH
10047 chmod +x protochk
10048 $eunicefix protochk
10049
10050 : Define hasproto macro for Configure internal use
10051 hasproto='varname=$1; func=$2; shift; shift;
10052 while $test $# -ge 2; do
10053         case "$1" in
10054         $define) echo "#include <$2>";;
10055         esac ;
10056     shift 2;
10057 done > try.c;
10058 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10059 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10060         echo "$func() prototype found.";
10061         val="$define";
10062 else
10063         echo "$func() prototype NOT found.";
10064         val="$undef";
10065 fi;
10066 set $varname;
10067 eval $setvar;
10068 $rm_try tryout.c'
10069
10070 : see if sys/types.h has to be included
10071 set sys/types.h i_systypes
10072 eval $inhdr
10073
10074 : see if sys/select.h has to be included
10075 set sys/select.h i_sysselct
10076 eval $inhdr
10077
10078 : Define hasfield macro for Configure internal use
10079 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10080 while $test $# -ge 2; do
10081         case "$1" in
10082         $define) echo "#include <$2>";;
10083         esac ;
10084     shift 2;
10085 done > try.c;
10086 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10087 set try;
10088 if eval $compile; then
10089         val="$define";
10090 else
10091         val="$undef";
10092 fi;
10093 set $varname;
10094 eval $setvar;
10095 $rm_try'
10096
10097 : see if we should include time.h, sys/time.h, or both
10098 echo " "
10099 if test "X$timeincl" = X; then
10100         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10101         $echo $n "I'm now running the test program...$c"
10102         $cat >try.c <<EOCP
10103 #include <sys/types.h>
10104 #ifdef I_TIME
10105 #include <time.h>
10106 #endif
10107 #ifdef I_SYSTIME
10108 #ifdef SYSTIMEKERNEL
10109 #define KERNEL
10110 #endif
10111 #include <sys/time.h>
10112 #endif
10113 #ifdef I_SYSSELECT
10114 #include <sys/select.h>
10115 #endif
10116 #$i_stdlib I_STDLIB
10117 #ifdef I_STDLIB
10118 #include <stdlib.h>
10119 #endif
10120 int main()
10121 {
10122         struct tm foo;
10123 #ifdef S_TIMEVAL
10124         struct timeval bar;
10125 #endif
10126 #ifdef S_TIMEZONE
10127         struct timezone tzp;
10128 #endif
10129         if (foo.tm_sec == foo.tm_sec)
10130                 exit(0);
10131 #ifdef S_TIMEVAL
10132         if (bar.tv_sec == bar.tv_sec)
10133                 exit(0);
10134 #endif
10135         exit(1);
10136 }
10137 EOCP
10138         flags=''
10139         for s_timezone in '-DS_TIMEZONE' ''; do
10140         sysselect=''
10141         for s_timeval in '-DS_TIMEVAL' ''; do
10142         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10143         for i_time in '' '-DI_TIME'; do
10144         for i_systime in '-DI_SYSTIME' ''; do
10145                 case "$flags" in
10146                 '') $echo $n ".$c"
10147                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10148                         if eval $compile; then
10149                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10150                                 shift
10151                                 flags="$*"
10152                                 echo " "
10153                                 $echo $n "Succeeded with $flags$c"
10154                         fi
10155                         ;;
10156                 esac
10157         done
10158         done
10159         done
10160         done
10161         done
10162         timeincl=''
10163         echo " "
10164         case "$flags" in
10165         *SYSTIMEKERNEL*) i_systimek="$define"
10166                 timeincl=`./findhdr sys/time.h`
10167                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10168         *) i_systimek="$undef";;
10169         esac
10170         case "$flags" in
10171         *I_TIME*) i_time="$define"
10172                 timeincl=`./findhdr time.h`" $timeincl"
10173                 echo "We'll include <time.h>." >&4;;
10174         *) i_time="$undef";;
10175         esac
10176         case "$flags" in
10177         *I_SYSTIME*) i_systime="$define"
10178                 timeincl=`./findhdr sys/time.h`" $timeincl"
10179                 echo "We'll include <sys/time.h>." >&4;;
10180         *) i_systime="$undef";;
10181         esac
10182         $rm_try
10183 fi
10184 : see if struct tm knows about tm_zone
10185 case "$i_systime$i_time" in
10186 *$define*)
10187         echo " "
10188         echo "Checking to see if your struct tm has tm_zone field..." >&4
10189         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10190         eval $hasfield
10191         ;;
10192 *)      val="$undef"
10193         set d_tm_tm_zone
10194         eval $setvar
10195         ;;
10196 esac
10197 case "$d_tm_tm_zone" in
10198 "$define")      echo "Yes, it does."   ;;
10199 *)              echo "No, it doesn't." ;;
10200 esac
10201 : see if struct tm knows about tm_gmtoff
10202 case "$i_systime$i_time" in
10203 *$define*)
10204         echo " "
10205         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10206         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10207         eval $hasfield
10208         ;;
10209 *)      val="$undef"
10210         set d_tm_tm_gmtoff
10211         eval $setvar
10212         ;;
10213 esac
10214 case "$d_tm_tm_gmtoff" in
10215 "$define")      echo "Yes, it does."   ;;
10216 *)              echo "No, it doesn't." ;;
10217 esac
10218
10219 : see if asctime_r exists
10220 set asctime_r d_asctime_r
10221 eval $inlibc
10222 case "$d_asctime_r" in
10223 "$define")
10224         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10225         case "$d_asctime_r_proto:$usethreads" in
10226         ":define")      d_asctime_r_proto=define
10227                 set d_asctime_r_proto asctime_r $hdrs
10228                 eval $hasproto ;;
10229         *)      ;;
10230         esac
10231         case "$d_asctime_r_proto" in
10232         define)
10233         case "$asctime_r_proto" in
10234         ''|0) try='char* asctime_r(const struct tm*, char*);'
10235         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10236         esac
10237         case "$asctime_r_proto" in
10238         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10239         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10240         esac
10241         case "$asctime_r_proto" in
10242         ''|0) try='int asctime_r(const struct tm*, char*);'
10243         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10244         esac
10245         case "$asctime_r_proto" in
10246         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10247         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10248         esac
10249         case "$asctime_r_proto" in
10250         ''|0)   d_asctime_r=undef
10251                 asctime_r_proto=0
10252                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10253         * )     case "$asctime_r_proto" in
10254                 REENTRANT_PROTO*) ;;
10255                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10256                 esac
10257                 echo "Prototype: $try" ;;
10258         esac
10259         ;;
10260         *)      case "$usethreads" in
10261                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10262                 esac
10263                 d_asctime_r=undef
10264                 asctime_r_proto=0
10265                 ;;
10266         esac
10267         ;;
10268 *)      asctime_r_proto=0
10269         ;;
10270 esac
10271
10272 : see if atolf exists
10273 set atolf d_atolf
10274 eval $inlibc
10275
10276 : see if atoll exists
10277 set atoll d_atoll
10278 eval $inlibc
10279
10280 : Look for GCC-style attribute format
10281 case "$d_attribute_format" in
10282 '')
10283 echo " "
10284 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10285 $cat >attrib.c <<'EOCP'
10286 #include <stdio.h>
10287 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10288 EOCP
10289 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10290         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10291                 echo "Your C compiler doesn't support __attribute__((format))."
10292                 val="$undef"
10293         else
10294                 echo "Your C compiler supports __attribute__((format))."
10295                 val="$define"
10296         fi
10297 else
10298         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10299         val="$undef"
10300 fi
10301 ;;
10302 *) val="$d_attribute_format" ;;
10303 esac
10304 set d_attribute_format
10305 eval $setvar
10306 $rm -f attrib*
10307
10308 : Look for GCC-style attribute format with null format allowed
10309 case "$d_printf_format_null" in
10310 '') case "$d_attribute_format" in
10311     $define)
10312         echo " "
10313         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10314 $cat >attrib.c <<EOCP
10315 #include <stdio.h>
10316 #$i_stdlib I_STDLIB
10317 #ifdef I_STDLIB
10318 #include <stdlib.h>
10319 #endif
10320 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10321 int null_printf (char* pat,...) { return (int)pat; }
10322 int main () { exit(null_printf(NULL)); }
10323 EOCP
10324         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10325             : run the executable in case it produces a run-time warning
10326             if $run ./attrib >>attrib.out 2>&1; then
10327                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10328                     echo "Your C compiler doesn't allow __printf__ format to be null."
10329                     val="$undef"
10330                 else
10331                     echo "Your C compiler allows __printf__ format to be null."
10332                     val="$define"
10333                 fi
10334             else
10335             echo "Your C compiler executable failed with __printf__ format null."
10336             val="$undef"
10337         fi
10338     else
10339         echo "Your C compiler fails with __printf__ format null."
10340         val="$undef"
10341     fi
10342     ;;
10343     *)  val="$undef" ;;
10344     esac
10345 ;;
10346 *)  val="$d_printf_format_null" ;;
10347 esac
10348 set d_printf_format_null
10349 eval $setvar
10350 $rm -f attrib*
10351
10352 : Look for GCC-style attribute malloc
10353 case "$d_attribute_malloc" in
10354 '')
10355 echo " "
10356 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10357 $cat >attrib.c <<'EOCP'
10358 #include <stdio.h>
10359 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10360 EOCP
10361 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10362         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10363                 echo "Your C compiler doesn't support __attribute__((malloc))."
10364                 val="$undef"
10365         else
10366                 echo "Your C compiler supports __attribute__((malloc))."
10367                 val="$define"
10368         fi
10369 else
10370         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10371         val="$undef"
10372 fi
10373 ;;
10374 *) val="$d_attribute_malloc" ;;
10375 esac
10376 set d_attribute_malloc
10377 eval $setvar
10378 $rm -f attrib*
10379
10380 : Look for GCC-style attribute nonnull
10381 case "$d_attribute_nonnull" in
10382 '')
10383 echo " "
10384 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10385 $cat >attrib.c <<'EOCP'
10386 #include <stdio.h>
10387 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10388 EOCP
10389 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10390         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10391                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10392                 val="$undef"
10393         else
10394                 echo "Your C compiler supports __attribute__((nonnull))."
10395                 val="$define"
10396         fi
10397 else
10398         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10399         val="$undef"
10400 fi
10401 ;;
10402 *) val="$d_attribute_nonnull" ;;
10403 esac
10404 set d_attribute_nonnull
10405 eval $setvar
10406 $rm -f attrib*
10407
10408 : Look for GCC-style attribute noreturn
10409 case "$d_attribute_noreturn" in
10410 '')
10411 echo " "
10412 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10413 $cat >attrib.c <<'EOCP'
10414 #include <stdio.h>
10415 void fall_over_dead( void ) __attribute__((noreturn));
10416 EOCP
10417 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10418         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10419                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10420                 val="$undef"
10421         else
10422                 echo "Your C compiler supports __attribute__((noreturn))."
10423                 val="$define"
10424         fi
10425 else
10426         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10427         val="$undef"
10428 fi
10429 ;;
10430 *) val="$d_attribute_noreturn" ;;
10431 esac
10432 set d_attribute_noreturn
10433 eval $setvar
10434 $rm -f attrib*
10435
10436 : Look for GCC-style attribute pure
10437 case "$d_attribute_pure" in
10438 '')
10439 echo " "
10440 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10441 $cat >attrib.c <<'EOCP'
10442 #include <stdio.h>
10443 int square( int n ) __attribute__((pure));
10444 EOCP
10445 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10446         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10447                 echo "Your C compiler doesn't support __attribute__((pure))."
10448                 val="$undef"
10449         else
10450                 echo "Your C compiler supports __attribute__((pure))."
10451                 val="$define"
10452         fi
10453 else
10454         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10455         val="$undef"
10456 fi
10457 ;;
10458 *) val="$d_attribute_pure" ;;
10459 esac
10460 set d_attribute_pure
10461 eval $setvar
10462 $rm -f attrib*
10463
10464 : Look for GCC-style attribute unused
10465 case "$d_attribute_unused" in
10466 '')
10467 echo " "
10468 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10469 $cat >attrib.c <<'EOCP'
10470 #include <stdio.h>
10471 int do_something( int dummy __attribute__((unused)), int n );
10472 EOCP
10473 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10474         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10475                 echo "Your C compiler doesn't support __attribute__((unused))."
10476                 val="$undef"
10477         else
10478                 echo "Your C compiler supports __attribute__((unused))."
10479                 val="$define"
10480         fi
10481 else
10482         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10483         val="$undef"
10484 fi
10485 ;;
10486 *) val="$d_attribute_unused" ;;
10487 esac
10488 set d_attribute_unused
10489 eval $setvar
10490 $rm -f attrib*
10491
10492 : Look for GCC-style attribute warn_unused_result
10493 case "$d_attribute_warn_unused_result" in
10494 '')
10495 echo " "
10496 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10497 $cat >attrib.c <<'EOCP'
10498 #include <stdio.h>
10499 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10500 EOCP
10501 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10502         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10503                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10504                 val="$undef"
10505         else
10506                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10507                 val="$define"
10508         fi
10509 else
10510         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10511         val="$undef"
10512 fi
10513 ;;
10514 *) val="$d_attribute_warn_unused_result" ;;
10515 esac
10516 set d_attribute_warn_unused_result
10517 eval $setvar
10518 $rm -f attrib*
10519
10520 : see if bcmp exists
10521 set bcmp d_bcmp
10522 eval $inlibc
10523
10524 : see if bcopy exists
10525 set bcopy d_bcopy
10526 eval $inlibc
10527
10528 : see if getpgrp exists
10529 set getpgrp d_getpgrp
10530 eval $inlibc
10531
10532 case "$d_getpgrp" in
10533 "$define")
10534         echo " "
10535         echo "Checking to see which flavor of getpgrp is in use..."
10536         $cat >try.c <<EOP
10537 #$i_unistd I_UNISTD
10538 #include <sys/types.h>
10539 #ifdef I_UNISTD
10540 #  include <unistd.h>
10541 #endif
10542 #$i_stdlib I_STDLIB
10543 #ifdef I_STDLIB
10544 #include <stdlib.h>
10545 #endif
10546 int main()
10547 {
10548         if (getuid() == 0) {
10549                 printf("(I see you are running Configure as super-user...)\n");
10550                 setuid(1);
10551         }
10552 #ifdef TRY_BSD_PGRP
10553         if (getpgrp(1) == 0)
10554                 exit(0);
10555 #else
10556         if (getpgrp() > 0)
10557                 exit(0);
10558 #endif
10559         exit(1);
10560 }
10561 EOP
10562         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10563                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10564                 val="$define"
10565         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10566                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10567                 val="$undef"
10568         else
10569                 echo "I can't seem to compile and run the test program."
10570                 if ./usg; then
10571                         xxx="a USG one, i.e. you use getpgrp()."
10572                 else
10573                         # SVR4 systems can appear rather BSD-ish.
10574                         case "$i_unistd" in
10575                         $undef)
10576                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10577                                 val="$define"
10578                                 ;;
10579                         $define)
10580                                 xxx="probably a USG one, i.e. you use getpgrp()."
10581                                 val="$undef"
10582                                 ;;
10583                         esac
10584                 fi
10585                 echo "Assuming your getpgrp is $xxx" >&4
10586         fi
10587         ;;
10588 *) val="$undef";;
10589 esac
10590 set d_bsdgetpgrp
10591 eval $setvar
10592 $rm_try
10593
10594 : see if setpgrp exists
10595 set setpgrp d_setpgrp
10596 eval $inlibc
10597
10598 case "$d_setpgrp" in
10599 "$define")
10600         echo " "
10601         echo "Checking to see which flavor of setpgrp is in use..."
10602         $cat >try.c <<EOP
10603 #$i_unistd I_UNISTD
10604 #include <sys/types.h>
10605 #ifdef I_UNISTD
10606 #  include <unistd.h>
10607 #endif
10608 #$i_stdlib I_STDLIB
10609 #ifdef I_STDLIB
10610 #include <stdlib.h>
10611 #endif
10612 int main()
10613 {
10614         if (getuid() == 0) {
10615                 printf("(I see you are running Configure as super-user...)\n");
10616                 setuid(1);
10617         }
10618 #ifdef TRY_BSD_PGRP
10619         if (-1 == setpgrp(1, 1))
10620                 exit(0);
10621 #else
10622         if (setpgrp() != -1)
10623                 exit(0);
10624 #endif
10625         exit(1);
10626 }
10627 EOP
10628         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10629                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10630                 val="$define"
10631         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10632                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10633                 val="$undef"
10634         else
10635                 echo "(I can't seem to compile and run the test program.)"
10636                 if ./usg; then
10637                         xxx="a USG one, i.e. you use setpgrp()."
10638                 else
10639                         # SVR4 systems can appear rather BSD-ish.
10640                         case "$i_unistd" in
10641                         $undef)
10642                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10643                                 val="$define"
10644                                 ;;
10645                         $define)
10646                                 xxx="probably a USG one, i.e. you use setpgrp()."
10647                                 val="$undef"
10648                                 ;;
10649                         esac
10650                 fi
10651                 echo "Assuming your setpgrp is $xxx" >&4
10652         fi
10653         ;;
10654 *) val="$undef";;
10655 esac
10656 set d_bsdsetpgrp
10657 eval $setvar
10658 $rm_try
10659
10660 : Look for GCC-style __builtin_choose_expr
10661 case "$d_builtin_choose_expr" in
10662 '')
10663     echo " "
10664     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10665     $cat >try.c <<'EOCP'
10666 #include <assert.h>
10667 #include <stdlib.h>
10668 #include <stdio.h>
10669
10670 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10671
10672 int main(void) {
10673     assert( SYRINX(1) == 2112 );
10674     assert( SYRINX(1) != 5150 );
10675     assert( SYRINX(0) == 5150 );
10676     assert( SYRINX(0) != 2112 );
10677     puts( "All good!" );
10678     exit(0);
10679 }
10680
10681 EOCP
10682     set try
10683     if eval $compile && $run ./try; then
10684         echo "Your C compiler supports __builtin_choose_expr."
10685         val="$define"
10686     else
10687         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10688         val="$undef"
10689     fi
10690 ;;
10691 *) val="$d_builtin_choose_expr" ;;
10692 esac
10693
10694 set d_builtin_choose_expr
10695 eval $setvar
10696 $rm_try
10697
10698 : Look for GCC-style __builtin_expect
10699 case "$d_builtin_expect" in
10700 '')
10701     echo " "
10702     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10703     $cat >try.c <<'EOCP'
10704 int main(void) {
10705     int n = 50;
10706     if ( __builtin_expect(n, 0) ) n = 1;
10707     /* Remember shell exit code truth is 0, C truth is non-zero */
10708     return !(n == 1);
10709 }
10710 EOCP
10711     set try
10712     if eval $compile && $run ./try; then
10713         echo "Your C compiler supports __builtin_expect."
10714         val="$define"
10715     else
10716         echo "Your C compiler doesn't seem to understand __builtin_expect."
10717         val="$undef"
10718     fi
10719     ;;
10720 *) val="$d_builtin_expect" ;;
10721 esac
10722
10723 set d_builtin_expect
10724 eval $setvar
10725 $rm_try
10726
10727 : see if bzero exists
10728 set bzero d_bzero
10729 eval $inlibc
10730
10731 : see if stdarg is available
10732 echo " "
10733 if $test `./findhdr stdarg.h`; then
10734         echo "<stdarg.h> found." >&4
10735         valstd="$define"
10736 else
10737         echo "<stdarg.h> NOT found." >&4
10738         valstd="$undef"
10739 fi
10740
10741 : see if varags is available
10742 echo " "
10743 if $test `./findhdr varargs.h`; then
10744         echo "<varargs.h> found." >&4
10745 else
10746         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10747 fi
10748
10749 : set up the varargs testing programs
10750 $cat > varargs.c <<EOP
10751 #ifdef I_STDARG
10752 #include <stdarg.h>
10753 #endif
10754 #ifdef I_VARARGS
10755 #include <varargs.h>
10756 #endif
10757
10758 #ifdef I_STDARG
10759 int f(char *p, ...)
10760 #else
10761 int f(va_alist)
10762 va_dcl
10763 #endif
10764 {
10765         va_list ap;
10766 #ifndef I_STDARG
10767         char *p;
10768 #endif
10769 #ifdef I_STDARG
10770         va_start(ap,p);
10771 #else
10772         va_start(ap);
10773         p = va_arg(ap, char *);
10774 #endif
10775         va_end(ap);
10776         return 0;
10777 }
10778 EOP
10779 $cat > varargs <<EOP
10780 $startsh
10781 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10782         echo "true"
10783 else
10784         echo "false"
10785 fi
10786 $rm -f varargs$_o
10787 EOP
10788 chmod +x varargs
10789
10790 : now check which varargs header should be included
10791 echo " "
10792 i_varhdr=''
10793 case "$valstd" in
10794 "$define")
10795         if `./varargs I_STDARG`; then
10796                 val='stdarg.h'
10797         elif `./varargs I_VARARGS`; then
10798                 val='varargs.h'
10799         fi
10800         ;;
10801 *)
10802         if `./varargs I_VARARGS`; then
10803                 val='varargs.h'
10804         fi
10805         ;;
10806 esac
10807 case "$val" in
10808 '')
10809 echo "I could not find the definition for va_dcl... You have problems..." >&4
10810         val="$undef"; set i_stdarg; eval $setvar
10811         val="$undef"; set i_varargs; eval $setvar
10812         ;;
10813 *)
10814         set i_varhdr
10815         eval $setvar
10816         case "$i_varhdr" in
10817         stdarg.h)
10818                 val="$define"; set i_stdarg; eval $setvar
10819                 val="$undef"; set i_varargs; eval $setvar
10820                 ;;
10821         varargs.h)
10822                 val="$undef"; set i_stdarg; eval $setvar
10823                 val="$define"; set i_varargs; eval $setvar
10824                 ;;
10825         esac
10826         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10827 esac
10828 $rm -f varargs*
10829
10830 : see if the Compiler supports C99 variadic macros
10831 case "$i_stdarg$i_stdlib" in
10832     "$define$define")
10833     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10834     $cat >try.c <<EOCP
10835 #include <stdio.h>
10836 #include <stdarg.h>
10837
10838 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10839
10840 int main() {
10841   char buf[20];
10842   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10843   puts(buf);
10844   return 0;
10845 }
10846 EOCP
10847     set try
10848     if eval $compile && $run ./try 2>&1 >/dev/null; then
10849         case "`$run ./try`" in
10850             "123 456 789")
10851             echo "You have C99 variadic macros." >&4
10852             d_c99_variadic_macros="$define"
10853             ;;
10854             *)
10855             echo "You don't have functional C99 variadic macros." >&4
10856             d_c99_variadic_macros="$undef"
10857             ;;
10858         esac
10859     else
10860         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10861         d_c99_variadic_macros="$undef"
10862     fi
10863     $rm_try
10864     ;;
10865     *)
10866     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10867     d_c99_variadic_macros="$undef"
10868     ;;
10869 esac
10870
10871 : see if signal is declared as pointer to function returning int or void
10872 echo " "
10873 xxx=`./findhdr signal.h`
10874 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10875 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10876         echo "You have int (*signal())() instead of void." >&4
10877         val="$undef"
10878 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10879         echo "You have void (*signal())()." >&4
10880         val="$define"
10881 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10882         echo "You have int (*signal())() instead of void." >&4
10883         val="$undef"
10884 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10885         echo "You have void (*signal())()." >&4
10886         val="$define"
10887 else
10888         case "$d_voidsig" in
10889         '')
10890         echo "I can't determine whether signal handler returns void or int..." >&4
10891                 dflt=void
10892                 rp="What type does your signal handler return?"
10893                 . ./myread
10894                 case "$ans" in
10895                 v*) val="$define";;
10896                 *) val="$undef";;
10897                 esac;;
10898         "$define")
10899                 echo "As you already told me, signal handler returns void." >&4
10900                 val="$define"
10901                 ;;
10902         *)      echo "As you already told me, signal handler returns int." >&4
10903                 val="$undef"
10904                 ;;
10905         esac
10906 fi
10907 set d_voidsig
10908 eval $setvar
10909 case "$d_voidsig" in
10910 "$define") signal_t="void";;
10911 *) signal_t="int";;
10912 esac
10913 $rm -f $$.tmp
10914
10915 : check for ability to cast large floats to 32-bit ints.
10916 echo " "
10917 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10918 if $test "$intsize" -ge 4; then
10919         xxx=int
10920 else
10921         xxx=long
10922 fi
10923 $cat >try.c <<EOCP
10924 #include <stdio.h>
10925 #$i_stdlib I_STDLIB
10926 #ifdef I_STDLIB
10927 #include <stdlib.h>
10928 #endif
10929 #include <sys/types.h>
10930 #include <signal.h>
10931 $signal_t blech(int s) { exit(3); }
10932 int main()
10933 {
10934         $xxx i32;
10935         double f, g;
10936         int result = 0;
10937         char str[16];
10938         signal(SIGFPE, blech);
10939
10940         /* Don't let compiler optimize the test away.  Store the number
10941            in a writable string for gcc to pass to sscanf under HP/UX.
10942         */
10943         sprintf(str, "2147483647");
10944         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10945         g = 10 * f;
10946         i32  = ($xxx) g;
10947
10948         /* x86 processors will probably give 0x8000 0000, which is a
10949            sign change.  We don't want that.  We want to mimic SPARC
10950            behavior here, which is to preserve the sign and give
10951            back 0x7fff ffff.
10952         */
10953         if (i32 != ($xxx) f)
10954                 result |= 1;
10955         exit(result);
10956 }
10957 EOCP
10958 set try
10959 if eval $compile_ok; then
10960         $run ./try
10961         yyy=$?
10962 else
10963         echo "(I can't seem to compile the test program--assuming it can't)"
10964         yyy=1
10965 fi
10966 case "$yyy" in
10967 0)      val="$define"
10968         echo "Yup, it can."
10969         ;;
10970 *)      val="$undef"
10971         echo "Nope, it can't."
10972         ;;
10973 esac
10974 set d_casti32
10975 eval $setvar
10976 $rm_try
10977
10978 : check for ability to cast negative floats to unsigned
10979 echo " "
10980 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10981 $cat >try.c <<EOCP
10982 #include <stdio.h>
10983 #$i_stdlib I_STDLIB
10984 #ifdef I_STDLIB
10985 #include <stdlib.h>
10986 #endif
10987 #include <sys/types.h>
10988 #include <signal.h>
10989 $signal_t blech(int s) { exit(7); }
10990 $signal_t blech_in_list(int s) { exit(4); }
10991 unsigned long dummy_long(unsigned long p) { return p; }
10992 unsigned int dummy_int(unsigned int p) { return p; }
10993 unsigned short dummy_short(unsigned short p) { return p; }
10994 int main()
10995 {
10996         double f;
10997         unsigned long along;
10998         unsigned int aint;
10999         unsigned short ashort;
11000         int result = 0;
11001         char str[16];
11002
11003         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11004            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11005            optimized the whole file away
11006         */
11007         /* Store the number in a writable string for gcc to pass to
11008            sscanf under HP/UX.
11009         */
11010         sprintf(str, "-123");
11011         sscanf(str, "%lf", &f);  /* f = -123.; */
11012
11013         signal(SIGFPE, blech);
11014         along = (unsigned long)f;
11015         aint = (unsigned int)f;
11016         ashort = (unsigned short)f;
11017         if (along != (unsigned long)-123)
11018                 result |= 1;
11019         if (aint != (unsigned int)-123)
11020                 result |= 1;
11021         if (ashort != (unsigned short)-123)
11022                 result |= 1;
11023         sprintf(str, "1073741824.");
11024         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11025         f = f + f;
11026         along = 0;
11027         along = (unsigned long)f;
11028         if (along != 0x80000000)
11029                 result |= 2;
11030         f -= 1.;
11031         along = 0;
11032         along = (unsigned long)f;
11033         if (along != 0x7fffffff)
11034                 result |= 1;
11035         f += 2.;
11036         along = 0;
11037         along = (unsigned long)f;
11038         if (along != 0x80000001)
11039                 result |= 2;
11040         if (result)
11041                 exit(result);
11042         signal(SIGFPE, blech_in_list);
11043         sprintf(str, "123.");
11044         sscanf(str, "%lf", &f);  /* f = 123.; */
11045         along = dummy_long((unsigned long)f);
11046         aint = dummy_int((unsigned int)f);
11047         ashort = dummy_short((unsigned short)f);
11048         if (along != (unsigned long)123)
11049                 result |= 4;
11050         if (aint != (unsigned int)123)
11051                 result |= 4;
11052         if (ashort != (unsigned short)123)
11053                 result |= 4;
11054         exit(result);
11055
11056 }
11057 EOCP
11058 set try
11059 if eval $compile_ok; then
11060         $run ./try
11061         castflags=$?
11062 else
11063         echo "(I can't seem to compile the test program--assuming it can't)"
11064         castflags=7
11065 fi
11066 case "$castflags" in
11067 0)      val="$define"
11068         echo "Yup, it can."
11069         ;;
11070 *)      val="$undef"
11071         echo "Nope, it can't."
11072         ;;
11073 esac
11074 set d_castneg
11075 eval $setvar
11076 $rm_try
11077
11078 : see if vprintf exists
11079 echo " "
11080 if set vprintf val -f d_vprintf; eval $csym; $val; then
11081         echo 'vprintf() found.' >&4
11082         val="$define"
11083         $cat >try.c <<EOF
11084 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11085 #$i_varargs I_VARARGS
11086
11087 #$i_stdlib I_STDLIB
11088 #$i_unistd I_UNISTD
11089
11090 #ifdef I_STDARG
11091 #  include <stdarg.h>
11092 #else /* I_VARARGS */
11093 #  include <varargs.h>
11094 #endif
11095
11096 #ifdef I_UNISTD
11097 #  include <unistd.h>
11098 #endif
11099
11100 #ifdef I_STDLIB
11101 #  include <stdlib.h>
11102 #endif
11103
11104 #include <stdio.h> /* vsprintf prototype */
11105
11106 #ifdef I_STDARG
11107 void xxx(int n, ...)
11108 {
11109     va_list args;
11110     char buf[10];
11111     va_start(args, n);
11112     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11113 }
11114 int main() { xxx(1, "foo"); }
11115
11116 #else /* I_VARARGS */
11117
11118 xxx(va_alist)
11119 va_dcl
11120 {
11121     va_list args;
11122     char buf[10];
11123     va_start(args);
11124     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11125 }
11126 int main() { xxx("foo"); }
11127
11128 #endif
11129
11130 EOF
11131         set try
11132         if eval $compile_ok; then
11133                 if $run ./try; then
11134                         echo "Your vsprintf() returns (int)." >&4
11135                         val2="$undef"
11136                 else
11137                         echo "Your vsprintf() returns (char*)." >&4
11138                         val2="$define"
11139                 fi
11140         else
11141                 echo 'I am unable to compile the vsprintf() test program.' >&4
11142                 # We shouldn't get here.  If we do, assume the standard signature,
11143                 # not the old BSD one.
11144                 echo 'Guessing that vsprintf() returns (int).' >&4
11145                 val2="$undef"
11146         fi
11147 else
11148         echo 'vprintf() NOT found.' >&4
11149         val="$undef"
11150         val2="$undef"
11151 fi
11152 $rm_try
11153 set d_vprintf
11154 eval $setvar
11155 val=$val2
11156 set d_charvspr
11157 eval $setvar
11158
11159 : see if chown exists
11160 set chown d_chown
11161 eval $inlibc
11162
11163 : see if chroot exists
11164 set chroot d_chroot
11165 eval $inlibc
11166
11167 : see if chsize exists
11168 set chsize d_chsize
11169 eval $inlibc
11170
11171 : see if class exists
11172 set class d_class
11173 eval $inlibc
11174
11175 : see if clearenv exists
11176 set clearenv d_clearenv
11177 eval $inlibc
11178
11179 : Define hasstruct macro for Configure internal use
11180 hasstruct='varname=$1; struct=$2; shift; shift;
11181 while $test $# -ge 2; do
11182         case "$1" in
11183         $define) echo "#include <$2>";;
11184         esac ;
11185     shift 2;
11186 done > try.c;
11187 echo "int main () { struct $struct foo; }" >> try.c;
11188 set try;
11189 if eval $compile; then
11190         val="$define";
11191 else
11192         val="$undef";
11193 fi;
11194 set $varname;
11195 eval $setvar;
11196 $rm_try'
11197
11198 : see whether socket exists
11199 socketlib=''
11200 sockethdr=''
11201 echo " "
11202 $echo $n "Hmm... $c" >&4
11203 if set socket val -f d_socket; eval $csym; $val; then
11204         echo "Looks like you have Berkeley networking support." >&4
11205         d_socket="$define"
11206         if set setsockopt val -f; eval $csym; $val; then
11207                 d_oldsock="$undef"
11208         else
11209                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11210                 d_oldsock="$define"
11211         fi
11212 else
11213         if $contains socklib libc.list >/dev/null 2>&1; then
11214                 echo "Looks like you have Berkeley networking support." >&4
11215                 d_socket="$define"
11216                 : we will have to assume that it supports the 4.2 BSD interface
11217                 d_oldsock="$undef"
11218         else
11219                 echo "You don't have Berkeley networking in libc$_a..." >&4
11220                 if test "X$d_socket" = "X$define"; then
11221                    echo "...but you seem to believe that you have sockets." >&4
11222                 else
11223                         for net in net socket
11224                         do
11225                                 if test -f /usr/lib/lib$net$_a; then
11226                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11227                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11228                                         if $contains socket libc.list >/dev/null 2>&1; then
11229                                                 d_socket="$define"
11230                                                 socketlib="-l$net"
11231                                                 case "$net" in
11232                                                 net)
11233                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11234                                                         sockethdr="-I/usr/netinclude"
11235                                                         ;;
11236                                                 esac
11237                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11238                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11239                                                         d_oldsock="$undef"
11240                                                 else
11241                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11242                                                         d_oldsock="$define"
11243                                                 fi
11244                                                 break
11245                                         fi
11246                                 fi
11247                         done
11248                         if test "X$d_socket" != "X$define"; then
11249                            echo "or anywhere else I see." >&4
11250                            d_socket="$undef"
11251                            d_oldsock="$undef"
11252                         fi
11253                 fi
11254         fi
11255 fi
11256
11257 : see if socketpair exists
11258 set socketpair d_sockpair
11259 eval $inlibc
11260
11261
11262 echo " "
11263 echo "Checking the availability of certain socket constants..." >&4
11264 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11265         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11266         $cat >try.c <<EOF
11267 #include <sys/types.h>
11268 #include <sys/socket.h>
11269 int main() {
11270     int i = $ENUM;
11271 }
11272 EOF
11273         val="$undef"
11274         set try; if eval $compile; then
11275                 val="$define"
11276         fi
11277         set d_${enum}; eval $setvar
11278         $rm_try
11279 done
11280
11281 : see if this is a sys/uio.h system
11282 set sys/uio.h i_sysuio
11283 eval $inhdr
11284
11285 : Check for cmsghdr support
11286 echo " "
11287 echo "Checking to see if your system supports struct cmsghdr..." >&4
11288 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11289 eval $hasstruct
11290 case "$d_cmsghdr_s" in
11291 "$define")      echo "Yes, it does."   ;;
11292 *)              echo "No, it doesn't." ;;
11293 esac
11294
11295
11296 : check for const keyword
11297 echo " "
11298 echo 'Checking to see if your C compiler knows about "const"...' >&4
11299 $cat >const.c <<'EOCP'
11300 typedef struct spug { int drokk; } spug;
11301 int main()
11302 {
11303         const char *foo;
11304         const spug y = { 0 };
11305 }
11306 EOCP
11307 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11308         val="$define"
11309         echo "Yup, it does."
11310 else
11311         val="$undef"
11312         echo "Nope, it doesn't."
11313 fi
11314 set d_const
11315 eval $setvar
11316
11317 : see if copysignl exists
11318 set copysignl d_copysignl
11319 eval $inlibc
11320
11321 : see if crypt exists
11322 echo " "
11323 set crypt d_crypt
11324 eval $inlibc
11325 case "$d_crypt" in
11326 $define) cryptlib='' ;;
11327 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11328                 echo 'crypt() found.' >&4
11329                 val="$define"
11330                 cryptlib=''
11331         else
11332                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11333                 if $test -z "$cryptlib"; then
11334                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11335                 else
11336                         cryptlib=-lcrypt
11337                 fi
11338                 if $test -z "$cryptlib"; then
11339                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11340                 else
11341                         cryptlib=-lcrypt
11342                 fi
11343                 if $test -z "$cryptlib"; then
11344                         cryptlib=`./loc libcrypt$_a "" $libpth`
11345                 else
11346                         cryptlib=-lcrypt
11347                 fi
11348                 if $test -z "$cryptlib"; then
11349                         echo 'crypt() NOT found.' >&4
11350                         val="$undef"
11351                 else
11352                         val="$define"
11353                 fi
11354         fi
11355         set d_crypt
11356         eval $setvar
11357         ;;
11358 esac
11359
11360 : see if this is a crypt.h system
11361 set crypt.h i_crypt
11362 eval $inhdr
11363
11364 : see if crypt_r exists
11365 set crypt_r d_crypt_r
11366 eval $inlibc
11367 case "$d_crypt_r" in
11368 "$define")
11369         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11370         case "$d_crypt_r_proto:$usethreads" in
11371         ":define")      d_crypt_r_proto=define
11372                 set d_crypt_r_proto crypt_r $hdrs
11373                 eval $hasproto ;;
11374         *)      ;;
11375         esac
11376         case "$d_crypt_r_proto" in
11377         define)
11378         case "$crypt_r_proto" in
11379         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11380         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11381         esac
11382         case "$crypt_r_proto" in
11383         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11384         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11385         esac
11386         case "$crypt_r_proto" in
11387         ''|0)   d_crypt_r=undef
11388                 crypt_r_proto=0
11389                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11390         * )     case "$crypt_r_proto" in
11391                 REENTRANT_PROTO*) ;;
11392                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11393                 esac
11394                 echo "Prototype: $try" ;;
11395         esac
11396         ;;
11397         *)      case "$usethreads" in
11398                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11399                 esac
11400                 d_crypt_r=undef
11401                 crypt_r_proto=0
11402                 ;;
11403         esac
11404         ;;
11405 *)      crypt_r_proto=0
11406         ;;
11407 esac
11408
11409 : get csh whereabouts
11410 case "$csh" in
11411 'csh') val="$undef" ;;
11412 *) val="$define" ;;
11413 esac
11414 set d_csh
11415 eval $setvar
11416 : Respect a hint or command line value for full_csh.
11417 case "$full_csh" in
11418 '') full_csh=$csh ;;
11419 esac
11420
11421 : see if ctermid exists
11422 set ctermid d_ctermid
11423 eval $inlibc
11424
11425 : see if ctermid_r exists
11426 set ctermid_r d_ctermid_r
11427 eval $inlibc
11428 case "$d_ctermid_r" in
11429 "$define")
11430         hdrs="$i_systypes sys/types.h define stdio.h "
11431         case "$d_ctermid_r_proto:$usethreads" in
11432         ":define")      d_ctermid_r_proto=define
11433                 set d_ctermid_r_proto ctermid_r $hdrs
11434                 eval $hasproto ;;
11435         *)      ;;
11436         esac
11437         case "$d_ctermid_r_proto" in
11438         define)
11439         case "$ctermid_r_proto" in
11440         ''|0) try='char* ctermid_r(char*);'
11441         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11442         esac
11443         case "$ctermid_r_proto" in
11444         ''|0)   d_ctermid_r=undef
11445                 ctermid_r_proto=0
11446                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11447         * )     case "$ctermid_r_proto" in
11448                 REENTRANT_PROTO*) ;;
11449                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11450                 esac
11451                 echo "Prototype: $try" ;;
11452         esac
11453         ;;
11454         *)      case "$usethreads" in
11455                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11456                 esac
11457                 d_ctermid_r=undef
11458                 ctermid_r_proto=0
11459                 ;;
11460         esac
11461         ;;
11462 *)      ctermid_r_proto=0
11463         ;;
11464 esac
11465
11466 : see if ctime_r exists
11467 set ctime_r d_ctime_r
11468 eval $inlibc
11469 case "$d_ctime_r" in
11470 "$define")
11471         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11472         case "$d_ctime_r_proto:$usethreads" in
11473         ":define")      d_ctime_r_proto=define
11474                 set d_ctime_r_proto ctime_r $hdrs
11475                 eval $hasproto ;;
11476         *)      ;;
11477         esac
11478         case "$d_ctime_r_proto" in
11479         define)
11480         case "$ctime_r_proto" in
11481         ''|0) try='char* ctime_r(const time_t*, char*);'
11482         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11483         esac
11484         case "$ctime_r_proto" in
11485         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11486         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11487         esac
11488         case "$ctime_r_proto" in
11489         ''|0) try='int ctime_r(const time_t*, char*);'
11490         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11491         esac
11492         case "$ctime_r_proto" in
11493         ''|0) try='int ctime_r(const time_t*, char*, int);'
11494         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11495         esac
11496         case "$ctime_r_proto" in
11497         ''|0)   d_ctime_r=undef
11498                 ctime_r_proto=0
11499                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11500         * )     case "$ctime_r_proto" in
11501                 REENTRANT_PROTO*) ;;
11502                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11503                 esac
11504                 echo "Prototype: $try" ;;
11505         esac
11506         ;;
11507         *)      case "$usethreads" in
11508                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11509                 esac
11510                 d_ctime_r=undef
11511                 ctime_r_proto=0
11512                 ;;
11513         esac
11514         ;;
11515 *)      ctime_r_proto=0
11516         ;;
11517 esac
11518
11519 : see if cuserid exists
11520 set cuserid d_cuserid
11521 eval $inlibc
11522
11523 : see if this is a limits.h system
11524 set limits.h i_limits
11525 eval $inhdr
11526
11527 : see if this is a float.h system
11528 set float.h i_float
11529 eval $inhdr
11530
11531 : See if number of significant digits in a double precision number is known
11532 echo " "
11533 $cat >dbl_dig.c <<EOM
11534 #$i_limits I_LIMITS
11535 #$i_float I_FLOAT
11536 #ifdef I_LIMITS
11537 #include <limits.h>
11538 #endif
11539 #ifdef I_FLOAT
11540 #include <float.h>
11541 #endif
11542 #ifdef DBL_DIG
11543 printf("Contains DBL_DIG");
11544 #endif
11545 EOM
11546 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11547 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11548         echo "DBL_DIG found." >&4
11549         val="$define"
11550 else
11551         echo "DBL_DIG NOT found." >&4
11552         val="$undef"
11553 fi
11554 $rm -f dbl_dig.?
11555 set d_dbl_dig
11556 eval $setvar
11557
11558 : see if dbm.h is available
11559 : see if dbmclose exists
11560 set dbmclose d_dbmclose
11561 eval $inlibc
11562
11563 case "$d_dbmclose" in
11564 $define)
11565         set dbm.h i_dbm
11566         eval $inhdr
11567         case "$i_dbm" in
11568         $define)
11569                 val="$undef"
11570                 set i_rpcsvcdbm
11571                 eval $setvar
11572                 ;;
11573         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11574                 eval $inhdr
11575                 ;;
11576         esac
11577         ;;
11578 *)      echo "We won't be including <dbm.h>"
11579         val="$undef"
11580         set i_dbm
11581         eval $setvar
11582         val="$undef"
11583         set i_rpcsvcdbm
11584         eval $setvar
11585         ;;
11586 esac
11587
11588 : see if prototype for dbminit is available
11589 echo " "
11590 set d_dbminitproto dbminit $i_dbm dbm.h
11591 eval $hasproto
11592
11593 : see if difftime exists
11594 set difftime d_difftime
11595 eval $inlibc
11596
11597 : see if this is a dirent system
11598 echo " "
11599 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11600         val="$define"
11601         echo "<dirent.h> found." >&4
11602 else
11603         val="$undef"
11604         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11605                 echo "<sys/dir.h> found." >&4
11606                 echo " "
11607         else
11608                 xinc=`./findhdr sys/ndir.h`
11609         fi
11610         echo "<dirent.h> NOT found." >&4
11611 fi
11612 set i_dirent
11613 eval $setvar
11614
11615 : Look for type of directory structure.
11616 echo " "
11617 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11618
11619 case "$direntrytype" in
11620 ''|' ')
11621         case "$i_dirent" in
11622         $define) guess1='struct dirent' ;;
11623         *) guess1='struct direct'  ;;
11624         esac
11625         ;;
11626 *)      guess1="$direntrytype"
11627         ;;
11628 esac
11629
11630 case "$guess1" in
11631 'struct dirent') guess2='struct direct' ;;
11632 *) guess2='struct dirent' ;;
11633 esac
11634
11635 if $contains "$guess1" try.c >/dev/null 2>&1; then
11636         direntrytype="$guess1"
11637         echo "Your directory entries are $direntrytype." >&4
11638 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11639         direntrytype="$guess2"
11640         echo "Your directory entries seem to be $direntrytype." >&4
11641 else
11642         echo "I don't recognize your system's directory entries." >&4
11643         rp="What type is used for directory entries on this system?"
11644         dflt="$guess1"
11645         . ./myread
11646         direntrytype="$ans"
11647 fi
11648 $rm_try
11649
11650 : see if the directory entry stores field length
11651 echo " "
11652 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11653 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11654         echo "Good, your directory entry keeps length information in d_namlen." >&4
11655         val="$define"
11656 else
11657         echo "Your directory entry does not know about the d_namlen field." >&4
11658         val="$undef"
11659 fi
11660 set d_dirnamlen
11661 eval $setvar
11662 $rm_try
11663
11664 : Look for DIR.dd_fd
11665 case "$i_dirent" in
11666 "$define")
11667     echo "Checking to see if DIR has a dd_fd member variable" >&4
11668     $cat >try.c <<EOCP
11669 #$i_stdlib I_STDLIB
11670 #ifdef I_STDLIB
11671 #include <stdlib.h>
11672 #endif
11673 #include <dirent.h>
11674
11675 int main() {
11676     DIR dir;
11677     dir.dd_fd = 1;
11678     return 0;
11679 }
11680 EOCP
11681     val=$undef
11682     set try
11683     if eval $compile; then
11684         echo "Yes, it does."
11685         val="$define"
11686     else
11687         echo "No, it does not."
11688         val="$undef"
11689     fi
11690     ;;
11691 *)
11692     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11693     val="$undef"
11694     ;;
11695 esac
11696 set d_dir_dd_fd
11697 eval $setvar
11698 $rm_try
11699
11700 : see if this is an sysdir system
11701 set sys/dir.h i_sysdir
11702 eval $inhdr
11703
11704 : see if this is an sysndir system
11705 set sys/ndir.h i_sysndir
11706 eval $inhdr
11707
11708 : Look for dirfd
11709 echo " "
11710 $cat >dirfd.c <<EOM
11711 #include <stdio.h>
11712 #$i_stdlib I_STDLIB
11713 #ifdef I_STDLIB
11714 #include <stdlib.h>
11715 #endif
11716 #$i_dirent I_DIRENT             /**/
11717 #$i_sysdir I_SYS_DIR            /**/
11718 #$i_sysndir I_SYS_NDIR          /**/
11719 #$i_systypes I_SYS_TYPES        /**/
11720 #if defined(I_SYS_TYPES)
11721 #include <sys/types.h>
11722 #endif
11723 #if defined(I_DIRENT)
11724 #include <dirent.h>
11725 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11726 #include <sys/dir.h>
11727 #endif
11728 #else
11729 #ifdef I_SYS_NDIR
11730 #include <sys/ndir.h>
11731 #else
11732 #ifdef I_SYS_DIR
11733 #ifdef hp9000s500
11734 #include <ndir.h>       /* may be wrong in the future */
11735 #else
11736 #include <sys/dir.h>
11737 #endif
11738 #endif
11739 #endif
11740 #endif 
11741 int main() {
11742         DIR *dirp = opendir(".");
11743         if (dirfd(dirp) >= 0)
11744                 exit(0);
11745         else
11746                 exit(1);
11747 }
11748 EOM
11749 val=$undef
11750 set dirfd
11751 if eval $compile; then
11752         val="$define"
11753 fi
11754 case "$val" in
11755 $define)        echo "dirfd() found." >&4       ;;
11756 *)              echo "dirfd() NOT found." >&4   ;;
11757 esac
11758 set d_dirfd
11759 eval $setvar
11760 $rm -f dirfd*
11761
11762 : see if dlerror exists
11763 xxx_runnm="$runnm"
11764 runnm=false
11765 set dlerror d_dlerror
11766 eval $inlibc
11767 runnm="$xxx_runnm"
11768
11769 : see if dlfcn is available
11770 set dlfcn.h i_dlfcn
11771 eval $inhdr
11772
11773 : Check what extension to use for shared libs
11774 case "$usedl" in
11775 $define|y|true)
11776         $cat << EOM
11777
11778 On a few systems, the dynamically loaded modules that perl generates and uses
11779 will need a different extension than shared libs. The default will probably
11780 be appropriate.
11781
11782 EOM
11783         case "$dlext" in
11784         '')     dflt="$so" ;;
11785         *)      dflt="$dlext" ;;
11786         esac
11787         rp='What is the extension of dynamically loaded modules'
11788         . ./myread
11789         dlext="$ans"
11790         ;;
11791 *)
11792         dlext="none"
11793         ;;
11794 esac
11795
11796 : Check if dlsym need a leading underscore
11797 echo " "
11798 val="$undef"
11799
11800 case "$dlsrc" in
11801 dl_dlopen.xs)
11802         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11803         $cat >dyna.c <<'EOM'
11804 fred () { }
11805 EOM
11806
11807 $cat >fred.c<<EOM
11808
11809 #include <stdio.h>
11810 #$i_stdlib I_STDLIB
11811 #ifdef I_STDLIB
11812 #include <stdlib.h>
11813 #endif
11814 #$i_dlfcn I_DLFCN
11815 #ifdef I_DLFCN
11816 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11817 #else
11818 #include <sys/types.h>
11819 #include <nlist.h>
11820 #include <link.h>
11821 #endif
11822
11823 extern int fred() ;
11824
11825 int main()
11826 {
11827     void * handle ;
11828     void * symbol ;
11829 #ifndef RTLD_LAZY
11830     int mode = 1 ;
11831 #else
11832     int mode = RTLD_LAZY ;
11833 #endif
11834     handle = dlopen("./dyna.$dlext", mode) ;
11835     if (handle == NULL) {
11836         printf ("1\n") ;
11837         fflush (stdout) ;
11838         exit(0);
11839     }
11840     symbol = dlsym(handle, "fred") ;
11841     if (symbol == NULL) {
11842         /* try putting a leading underscore */
11843         symbol = dlsym(handle, "_fred") ;
11844         if (symbol == NULL) {
11845             printf ("2\n") ;
11846             fflush (stdout) ;
11847             exit(0);
11848         }
11849         printf ("3\n") ;
11850     }
11851     else
11852         printf ("4\n") ;
11853     fflush (stdout) ;
11854     exit(0);
11855 }
11856 EOM
11857         : Call the object file tmp-dyna.o in case dlext=o.
11858         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11859                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11860                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11861                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11862                 xxx=`$run ./fred`
11863                 case $xxx in
11864                 1)      echo "Test program failed using dlopen." >&4
11865                         echo "Perhaps you should not use dynamic loading." >&4;;
11866                 2)      echo "Test program failed using dlsym." >&4
11867                         echo "Perhaps you should not use dynamic loading." >&4;;
11868                 3)      echo "dlsym needs a leading underscore" >&4
11869                         val="$define" ;;
11870                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11871                 esac
11872         else
11873                 echo "I can't compile and run the test program." >&4
11874                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11875         fi
11876         ;;
11877 esac
11878
11879 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11880
11881 set d_dlsymun
11882 eval $setvar
11883
11884 : see if drand48_r exists
11885 set drand48_r d_drand48_r
11886 eval $inlibc
11887 case "$d_drand48_r" in
11888 "$define")
11889         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11890         case "$d_drand48_r_proto:$usethreads" in
11891         ":define")      d_drand48_r_proto=define
11892                 set d_drand48_r_proto drand48_r $hdrs
11893                 eval $hasproto ;;
11894         *)      ;;
11895         esac
11896         case "$d_drand48_r_proto" in
11897         define)
11898         case "$drand48_r_proto" in
11899         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11900         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11901         esac
11902         case "$drand48_r_proto" in
11903         ''|0)   d_drand48_r=undef
11904                 drand48_r_proto=0
11905                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11906         * )     case "$drand48_r_proto" in
11907                 REENTRANT_PROTO*) ;;
11908                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11909                 esac
11910                 echo "Prototype: $try" ;;
11911         esac
11912         ;;
11913         *)      case "$usethreads" in
11914                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11915                 esac
11916                 d_drand48_r=undef
11917                 drand48_r_proto=0
11918                 ;;
11919         esac
11920         ;;
11921 *)      drand48_r_proto=0
11922         ;;
11923 esac
11924
11925 : see if prototype for drand48 is available
11926 echo " "
11927 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11928 eval $hasproto
11929
11930 : see if dup2 exists
11931 set dup2 d_dup2
11932 eval $inlibc
11933
11934 : see if eaccess exists
11935 set eaccess d_eaccess
11936 eval $inlibc
11937
11938 : see if endgrent exists
11939 set endgrent d_endgrent
11940 eval $inlibc
11941
11942 : see if this is an grp system
11943 set grp.h i_grp
11944 eval $inhdr
11945
11946 case "$i_grp" in
11947 $define)
11948         xxx=`./findhdr grp.h`
11949         $cppstdin $cppflags $cppminus < $xxx >$$.h
11950
11951         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11952                 val="$define"
11953         else
11954                 val="$undef"
11955         fi
11956         set d_grpasswd
11957         eval $setvar
11958
11959         $rm -f $$.h
11960         ;;
11961 *)
11962         val="$undef";
11963         set d_grpasswd; eval $setvar
11964         ;;
11965 esac
11966
11967 : see if endgrent_r exists
11968 set endgrent_r d_endgrent_r
11969 eval $inlibc
11970 case "$d_endgrent_r" in
11971 "$define")
11972         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11973         case "$d_endgrent_r_proto:$usethreads" in
11974         ":define")      d_endgrent_r_proto=define
11975                 set d_endgrent_r_proto endgrent_r $hdrs
11976                 eval $hasproto ;;
11977         *)      ;;
11978         esac
11979         case "$d_endgrent_r_proto" in
11980         define)
11981         case "$endgrent_r_proto" in
11982         ''|0) try='int endgrent_r(FILE**);'
11983         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
11984         esac
11985         case "$endgrent_r_proto" in
11986         ''|0) try='void endgrent_r(FILE**);'
11987         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
11988         esac
11989         case "$endgrent_r_proto" in
11990         ''|0)   d_endgrent_r=undef
11991                 endgrent_r_proto=0
11992                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11993         * )     case "$endgrent_r_proto" in
11994                 REENTRANT_PROTO*) ;;
11995                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11996                 esac
11997                 echo "Prototype: $try" ;;
11998         esac
11999         ;;
12000         *)      case "$usethreads" in
12001                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12002                 esac
12003                 d_endgrent_r=undef
12004                 endgrent_r_proto=0
12005                 ;;
12006         esac
12007         ;;
12008 *)      endgrent_r_proto=0
12009         ;;
12010 esac
12011
12012 : see if endhostent exists
12013 set endhostent d_endhent
12014 eval $inlibc
12015
12016 : see if this is a netdb.h system
12017 set netdb.h i_netdb
12018 eval $inhdr
12019
12020 : see if endhostent_r exists
12021 set endhostent_r d_endhostent_r
12022 eval $inlibc
12023 case "$d_endhostent_r" in
12024 "$define")
12025         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12026         case "$d_endhostent_r_proto:$usethreads" in
12027         ":define")      d_endhostent_r_proto=define
12028                 set d_endhostent_r_proto endhostent_r $hdrs
12029                 eval $hasproto ;;
12030         *)      ;;
12031         esac
12032         case "$d_endhostent_r_proto" in
12033         define)
12034         case "$endhostent_r_proto" in
12035         ''|0) try='int endhostent_r(struct hostent_data*);'
12036         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12037         esac
12038         case "$endhostent_r_proto" in
12039         ''|0) try='void endhostent_r(struct hostent_data*);'
12040         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12041         esac
12042         case "$endhostent_r_proto" in
12043         ''|0)   d_endhostent_r=undef
12044                 endhostent_r_proto=0
12045                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12046         * )     case "$endhostent_r_proto" in
12047                 REENTRANT_PROTO*) ;;
12048                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12049                 esac
12050                 echo "Prototype: $try" ;;
12051         esac
12052         ;;
12053         *)      case "$usethreads" in
12054                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12055                 esac
12056                 d_endhostent_r=undef
12057                 endhostent_r_proto=0
12058                 ;;
12059         esac
12060         ;;
12061 *)      endhostent_r_proto=0
12062         ;;
12063 esac
12064
12065 : see if endnetent exists
12066 set endnetent d_endnent
12067 eval $inlibc
12068
12069 : see if endnetent_r exists
12070 set endnetent_r d_endnetent_r
12071 eval $inlibc
12072 case "$d_endnetent_r" in
12073 "$define")
12074         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12075         case "$d_endnetent_r_proto:$usethreads" in
12076         ":define")      d_endnetent_r_proto=define
12077                 set d_endnetent_r_proto endnetent_r $hdrs
12078                 eval $hasproto ;;
12079         *)      ;;
12080         esac
12081         case "$d_endnetent_r_proto" in
12082         define)
12083         case "$endnetent_r_proto" in
12084         ''|0) try='int endnetent_r(struct netent_data*);'
12085         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12086         esac
12087         case "$endnetent_r_proto" in
12088         ''|0) try='void endnetent_r(struct netent_data*);'
12089         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12090         esac
12091         case "$endnetent_r_proto" in
12092         ''|0)   d_endnetent_r=undef
12093                 endnetent_r_proto=0
12094                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12095         * )     case "$endnetent_r_proto" in
12096                 REENTRANT_PROTO*) ;;
12097                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12098                 esac
12099                 echo "Prototype: $try" ;;
12100         esac
12101         ;;
12102         *)      case "$usethreads" in
12103                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12104                 esac
12105                 d_endnetent_r=undef
12106                 endnetent_r_proto=0
12107                 ;;
12108         esac
12109         ;;
12110 *)      endnetent_r_proto=0
12111         ;;
12112 esac
12113
12114 : see if endprotoent exists
12115 set endprotoent d_endpent
12116 eval $inlibc
12117
12118 : see if endprotoent_r exists
12119 set endprotoent_r d_endprotoent_r
12120 eval $inlibc
12121 case "$d_endprotoent_r" in
12122 "$define")
12123         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12124         case "$d_endprotoent_r_proto:$usethreads" in
12125         ":define")      d_endprotoent_r_proto=define
12126                 set d_endprotoent_r_proto endprotoent_r $hdrs
12127                 eval $hasproto ;;
12128         *)      ;;
12129         esac
12130         case "$d_endprotoent_r_proto" in
12131         define)
12132         case "$endprotoent_r_proto" in
12133         ''|0) try='int endprotoent_r(struct protoent_data*);'
12134         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12135         esac
12136         case "$endprotoent_r_proto" in
12137         ''|0) try='void endprotoent_r(struct protoent_data*);'
12138         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12139         esac
12140         case "$endprotoent_r_proto" in
12141         ''|0)   d_endprotoent_r=undef
12142                 endprotoent_r_proto=0
12143                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12144         * )     case "$endprotoent_r_proto" in
12145                 REENTRANT_PROTO*) ;;
12146                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12147                 esac
12148                 echo "Prototype: $try" ;;
12149         esac
12150         ;;
12151         *)      case "$usethreads" in
12152                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12153                 esac
12154                 d_endprotoent_r=undef
12155                 endprotoent_r_proto=0
12156                 ;;
12157         esac
12158         ;;
12159 *)      endprotoent_r_proto=0
12160         ;;
12161 esac
12162
12163 : see if endpwent exists
12164 set endpwent d_endpwent
12165 eval $inlibc
12166
12167 : see if this is a pwd.h system
12168 set pwd.h i_pwd
12169 eval $inhdr
12170
12171 case "$i_pwd" in
12172 $define)
12173         xxx=`./findhdr pwd.h`
12174         $cppstdin $cppflags $cppminus < $xxx >$$.h
12175
12176         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12177                 val="$define"
12178         else
12179                 val="$undef"
12180         fi
12181         set d_pwquota
12182         eval $setvar
12183
12184         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12185                 val="$define"
12186         else
12187                 val="$undef"
12188         fi
12189         set d_pwage
12190         eval $setvar
12191
12192         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12193                 val="$define"
12194         else
12195                 val="$undef"
12196         fi
12197         set d_pwchange
12198         eval $setvar
12199
12200         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12201                 val="$define"
12202         else
12203                 val="$undef"
12204         fi
12205         set d_pwclass
12206         eval $setvar
12207
12208         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12209                 val="$define"
12210         else
12211                 val="$undef"
12212         fi
12213         set d_pwexpire
12214         eval $setvar
12215
12216         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12217                 val="$define"
12218         else
12219                 val="$undef"
12220         fi
12221         set d_pwcomment
12222         eval $setvar
12223
12224         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12225                 val="$define"
12226         else
12227                 val="$undef"
12228         fi
12229         set d_pwgecos
12230         eval $setvar
12231
12232         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12233                 val="$define"
12234         else
12235                 val="$undef"
12236         fi
12237         set d_pwpasswd
12238         eval $setvar
12239
12240         $rm -f $$.h
12241         ;;
12242 *)
12243         val="$undef"; 
12244         set d_pwquota; eval $setvar
12245         set d_pwage; eval $setvar
12246         set d_pwchange; eval $setvar
12247         set d_pwclass; eval $setvar
12248         set d_pwexpire; eval $setvar
12249         set d_pwcomment; eval $setvar
12250         set d_pwgecos; eval $setvar
12251         set d_pwpasswd; eval $setvar
12252         ;;
12253 esac
12254
12255 : see if endpwent_r exists
12256 set endpwent_r d_endpwent_r
12257 eval $inlibc
12258 case "$d_endpwent_r" in
12259 "$define")
12260         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12261         case "$d_endpwent_r_proto:$usethreads" in
12262         ":define")      d_endpwent_r_proto=define
12263                 set d_endpwent_r_proto endpwent_r $hdrs
12264                 eval $hasproto ;;
12265         *)      ;;
12266         esac
12267         case "$d_endpwent_r_proto" in
12268         define)
12269         case "$endpwent_r_proto" in
12270         ''|0) try='int endpwent_r(FILE**);'
12271         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12272         esac
12273         case "$endpwent_r_proto" in
12274         ''|0) try='void endpwent_r(FILE**);'
12275         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12276         esac
12277         case "$endpwent_r_proto" in
12278         ''|0)   d_endpwent_r=undef
12279                 endpwent_r_proto=0
12280                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12281         * )     case "$endpwent_r_proto" in
12282                 REENTRANT_PROTO*) ;;
12283                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12284                 esac
12285                 echo "Prototype: $try" ;;
12286         esac
12287         ;;
12288         *)      case "$usethreads" in
12289                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12290                 esac
12291                 d_endpwent_r=undef
12292                 endpwent_r_proto=0
12293                 ;;
12294         esac
12295         ;;
12296 *)      endpwent_r_proto=0
12297         ;;
12298 esac
12299
12300 : see if endservent exists
12301 set endservent d_endsent
12302 eval $inlibc
12303
12304 : see if endservent_r exists
12305 set endservent_r d_endservent_r
12306 eval $inlibc
12307 case "$d_endservent_r" in
12308 "$define")
12309         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12310         case "$d_endservent_r_proto:$usethreads" in
12311         ":define")      d_endservent_r_proto=define
12312                 set d_endservent_r_proto endservent_r $hdrs
12313                 eval $hasproto ;;
12314         *)      ;;
12315         esac
12316         case "$d_endservent_r_proto" in
12317         define)
12318         case "$endservent_r_proto" in
12319         ''|0) try='int endservent_r(struct servent_data*);'
12320         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12321         esac
12322         case "$endservent_r_proto" in
12323         ''|0) try='void endservent_r(struct servent_data*);'
12324         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12325         esac
12326         case "$endservent_r_proto" in
12327         ''|0)   d_endservent_r=undef
12328                 endservent_r_proto=0
12329                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12330         * )     case "$endservent_r_proto" in
12331                 REENTRANT_PROTO*) ;;
12332                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12333                 esac
12334                 echo "Prototype: $try" ;;
12335         esac
12336         ;;
12337         *)      case "$usethreads" in
12338                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12339                 esac
12340                 d_endservent_r=undef
12341                 endservent_r_proto=0
12342                 ;;
12343         esac
12344         ;;
12345 *)      endservent_r_proto=0
12346         ;;
12347 esac
12348
12349 : Locate the flags for 'open()'
12350 echo " "
12351 $cat >try.c <<EOCP
12352 #include <sys/types.h>
12353 #ifdef I_FCNTL
12354 #include <fcntl.h>
12355 #endif
12356 #ifdef I_SYS_FILE
12357 #include <sys/file.h>
12358 #endif
12359 #$i_stdlib I_STDLIB
12360 #ifdef I_STDLIB
12361 #include <stdlib.h>
12362 #endif
12363 int main() {
12364         if(O_RDONLY);
12365 #ifdef O_TRUNC
12366         exit(0);
12367 #else
12368         exit(1);
12369 #endif
12370 }
12371 EOCP
12372 : check sys/file.h first to get FREAD on Sun
12373 if $test `./findhdr sys/file.h` && \
12374                 set try -DI_SYS_FILE && eval $compile; then
12375         h_sysfile=true;
12376         echo "<sys/file.h> defines the O_* constants..." >&4
12377         if $run ./try; then
12378                 echo "and you have the 3 argument form of open()." >&4
12379                 val="$define"
12380         else
12381                 echo "but not the 3 argument form of open().  Oh, well." >&4
12382                 val="$undef"
12383         fi
12384 elif $test `./findhdr fcntl.h` && \
12385                 set try -DI_FCNTL && eval $compile; then
12386         h_fcntl=true;
12387         echo "<fcntl.h> defines the O_* constants..." >&4
12388         if $run ./try; then
12389                 echo "and you have the 3 argument form of open()." >&4
12390                 val="$define"
12391         else
12392                 echo "but not the 3 argument form of open().  Oh, well." >&4
12393                 val="$undef"
12394         fi
12395 else
12396         val="$undef"
12397         echo "I can't find the O_* constant definitions!  You got problems." >&4
12398 fi
12399 set d_open3
12400 eval $setvar
12401 $rm_try
12402
12403 : see if this is a sys/file.h system
12404 val=''
12405 set sys/file.h val
12406 eval $inhdr
12407
12408 : do we need to include sys/file.h ?
12409 case "$val" in
12410 "$define")
12411         echo " "
12412         if $h_sysfile; then
12413                 val="$define"
12414                 echo "We'll be including <sys/file.h>." >&4
12415         else
12416                 val="$undef"
12417                 echo "We won't be including <sys/file.h>." >&4
12418         fi
12419         ;;
12420 *)
12421         h_sysfile=false
12422         ;;
12423 esac
12424 set i_sysfile
12425 eval $setvar
12426
12427 : see if fcntl.h is there
12428 val=''
12429 set fcntl.h val
12430 eval $inhdr
12431
12432 : see if we can include fcntl.h
12433 case "$val" in
12434 "$define")
12435         echo " "
12436         if $h_fcntl; then
12437                 val="$define"
12438                 echo "We'll be including <fcntl.h>." >&4
12439         else
12440                 val="$undef"
12441                 if $h_sysfile; then
12442         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12443                 else
12444                         echo "We won't be including <fcntl.h>." >&4
12445                 fi
12446         fi
12447         ;;
12448 *)
12449         h_fcntl=false
12450         val="$undef"
12451         ;;
12452 esac
12453 set i_fcntl
12454 eval $setvar
12455
12456 : see if fork exists
12457 set fork d_fork
12458 eval $inlibc
12459
12460 : see if pipe exists
12461 set pipe d_pipe
12462 eval $inlibc
12463
12464 : check for non-blocking I/O stuff
12465 case "$h_sysfile" in
12466 true) echo "#include <sys/file.h>" > head.c;;
12467 *)
12468        case "$h_fcntl" in
12469        true) echo "#include <fcntl.h>" > head.c;;
12470        *) echo "#include <sys/fcntl.h>" > head.c;;
12471        esac
12472        ;;
12473 esac
12474 echo " "
12475 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12476 case "$o_nonblock" in
12477 '')
12478         $cat head.c > try.c
12479         $cat >>try.c <<EOCP
12480 #include <stdio.h>
12481 #$i_stdlib I_STDLIB
12482 #ifdef I_STDLIB
12483 #include <stdlib.h>
12484 #endif
12485 #$i_fcntl I_FCNTL
12486 #ifdef I_FCNTL
12487 #include <fcntl.h>
12488 #endif
12489 int main() {
12490 #ifdef O_NONBLOCK
12491         printf("O_NONBLOCK\n");
12492         exit(0);
12493 #endif
12494 #ifdef O_NDELAY
12495         printf("O_NDELAY\n");
12496         exit(0);
12497 #endif
12498 #ifdef FNDELAY
12499         printf("FNDELAY\n");
12500         exit(0);
12501 #endif
12502         exit(0);
12503 }
12504 EOCP
12505         set try
12506         if eval $compile_ok; then
12507                 o_nonblock=`$run ./try`
12508                 case "$o_nonblock" in
12509                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12510                 *) echo "Seems like we can use $o_nonblock.";;
12511                 esac
12512         else
12513                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12514         fi
12515         ;;
12516 *) echo "Using $hint value $o_nonblock.";;
12517 esac
12518 $rm_try
12519
12520 echo " "
12521 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12522 case "$eagain" in
12523 '')
12524         case "$d_fork:$d_pipe" in
12525         define:define)
12526         $cat head.c > try.c
12527         $cat >>try.c <<EOCP
12528 #include <errno.h>
12529 #include <sys/types.h>
12530 #include <signal.h>
12531 #include <stdio.h>
12532 #$i_stdlib I_STDLIB
12533 #ifdef I_STDLIB
12534 #include <stdlib.h>
12535 #endif
12536 #$i_fcntl I_FCNTL
12537 #ifdef I_FCNTL
12538 #include <fcntl.h>
12539 #endif
12540 #define MY_O_NONBLOCK $o_nonblock
12541 #ifndef errno  /* XXX need better Configure test */
12542 extern int errno;
12543 #endif
12544 #$i_unistd I_UNISTD
12545 #ifdef I_UNISTD
12546 #include <unistd.h>
12547 #endif
12548 #$i_string I_STRING
12549 #ifdef I_STRING
12550 #include <string.h>
12551 #else
12552 #include <strings.h>
12553 #endif
12554 $signal_t blech(int x) { exit(3); }
12555 EOCP
12556         $cat >> try.c <<'EOCP'
12557 int main()
12558 {
12559         int pd[2];
12560         int pu[2];
12561         char buf[1];
12562         char string[100];
12563
12564         pipe(pd);       /* Down: child -> parent */
12565         pipe(pu);       /* Up: parent -> child */
12566         if (0 != fork()) {
12567                 int ret;
12568                 close(pd[1]);   /* Parent reads from pd[0] */
12569                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12570 #ifdef F_SETFL
12571                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12572                         exit(1);
12573 #else
12574                 exit(4);
12575 #endif
12576                 signal(SIGALRM, blech);
12577                 alarm(5);
12578                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12579                         exit(2);
12580                 sprintf(string, "%d\n", ret);
12581                 write(2, string, strlen(string));
12582                 alarm(0);
12583 #ifdef EAGAIN
12584                 if (errno == EAGAIN) {
12585                         printf("EAGAIN\n");
12586                         goto ok;
12587                 }
12588 #endif
12589 #ifdef EWOULDBLOCK
12590                 if (errno == EWOULDBLOCK)
12591                         printf("EWOULDBLOCK\n");
12592 #endif
12593         ok:
12594                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12595                 sleep(2);                               /* Give it time to close our pipe */
12596                 alarm(5);
12597                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12598                 alarm(0);
12599                 sprintf(string, "%d\n", ret);
12600                 write(4, string, strlen(string));
12601                 exit(0);
12602         }
12603
12604         close(pd[0]);                   /* We write to pd[1] */
12605         close(pu[1]);                   /* We read from pu[0] */
12606         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12607         close(pd[1]);                   /* Pipe pd is now fully closed! */
12608         exit(0);                                /* Bye bye, thank you for playing! */
12609 }
12610 EOCP
12611         set try
12612         if eval $compile_ok; then
12613                 echo "$startsh" >mtry
12614                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12615                 chmod +x mtry
12616                 ./mtry >/dev/null 2>&1
12617                 case $? in
12618                 0) eagain=`$cat try.out`;;
12619                 1) echo "Could not perform non-blocking setting!";;
12620                 2) echo "I did a successful read() for something that was not there!";;
12621                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12622                 4) echo "Could not find F_SETFL!";;
12623                 *) echo "Something terribly wrong happened during testing.";;
12624                 esac
12625                 rd_nodata=`$cat try.ret`
12626                 echo "A read() system call with no data present returns $rd_nodata."
12627                 case "$rd_nodata" in
12628                 0|-1) ;;
12629                 *)
12630                         echo "(That's peculiar, fixing that to be -1.)"
12631                         rd_nodata=-1
12632                         ;;
12633                 esac
12634                 case "$eagain" in
12635                 '')
12636                         echo "Forcing errno EAGAIN on read() with no data available."
12637                         eagain=EAGAIN
12638                         ;;
12639                 *)
12640                         echo "Your read() sets errno to $eagain when no data is available."
12641                         ;;
12642                 esac
12643                 status=`$cat try.err`
12644                 case "$status" in
12645                 0) echo "And it correctly returns 0 to signal EOF.";;
12646                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12647                 *) echo "However, your read() returns '$status' on EOF??";;
12648                 esac
12649                 val="$define"
12650                 if test "$status" = "$rd_nodata"; then
12651                         echo "WARNING: you can't distinguish between EOF and no data!"
12652                         val="$undef"
12653                 fi
12654         else
12655                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12656                 eagain=EAGAIN
12657         fi
12658         ;;
12659         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12660                 eagain=EAGAIN
12661                 val="$define"
12662                 ;;
12663         esac
12664         set d_eofnblk
12665         eval $setvar
12666         ;;
12667 *)
12668         echo "Using $hint value $eagain."
12669         echo "Your read() returns $rd_nodata when no data is present."
12670         case "$d_eofnblk" in
12671         "$define") echo "And you can see EOF because read() returns 0.";;
12672         "$undef") echo "But you can't see EOF status from read() returned value.";;
12673         *)
12674                 echo "(Assuming you can't see EOF status from read anyway.)"
12675                 d_eofnblk=$undef
12676                 ;;
12677         esac
12678         ;;
12679 esac
12680 $rm_try head.c mtry
12681
12682 : see if _ptr and _cnt from stdio act std
12683 echo " "
12684
12685 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12686         echo "(Looks like you have stdio.h from BSD.)"
12687         case "$stdio_ptr" in
12688         '') stdio_ptr='((fp)->_p)'
12689                 ptr_lval=$define
12690                 ;;
12691         *)      ptr_lval=$d_stdio_ptr_lval;;
12692         esac
12693         case "$stdio_cnt" in
12694         '') stdio_cnt='((fp)->_r)'
12695                 cnt_lval=$define
12696                 ;;
12697         *)      cnt_lval=$d_stdio_cnt_lval;;
12698         esac
12699         case "$stdio_base" in
12700         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12701         esac
12702         case "$stdio_bufsiz" in
12703         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12704         esac
12705 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12706         echo "(Looks like you have stdio.h from Linux.)"
12707         case "$stdio_ptr" in
12708         '') stdio_ptr='((fp)->_IO_read_ptr)'
12709                 ptr_lval=$define
12710                 ;;
12711         *)      ptr_lval=$d_stdio_ptr_lval;;
12712         esac
12713         case "$stdio_cnt" in
12714         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12715                 cnt_lval=$undef
12716                 ;;
12717         *)      cnt_lval=$d_stdio_cnt_lval;;
12718         esac
12719         case "$stdio_base" in
12720         '') stdio_base='((fp)->_IO_read_base)';;
12721         esac
12722         case "$stdio_bufsiz" in
12723         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12724         esac
12725 else
12726         case "$stdio_ptr" in
12727         '') stdio_ptr='((fp)->_ptr)'
12728                 ptr_lval=$define
12729                 ;;
12730         *)      ptr_lval=$d_stdio_ptr_lval;;
12731         esac
12732         case "$stdio_cnt" in
12733         '') stdio_cnt='((fp)->_cnt)'
12734                 cnt_lval=$define
12735                 ;;
12736         *)      cnt_lval=$d_stdio_cnt_lval;;
12737         esac
12738         case "$stdio_base" in
12739         '') stdio_base='((fp)->_base)';;
12740         esac
12741         case "$stdio_bufsiz" in
12742         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12743         esac
12744 fi
12745
12746 : test whether _ptr and _cnt really work
12747 echo "Checking how std your stdio is..." >&4
12748 $cat >try.c <<EOP
12749 #include <stdio.h>
12750 #$i_stdlib I_STDLIB
12751 #ifdef I_STDLIB
12752 #include <stdlib.h>
12753 #endif
12754 #define FILE_ptr(fp)    $stdio_ptr
12755 #define FILE_cnt(fp)    $stdio_cnt
12756 int main() {
12757         FILE *fp = fopen("try.c", "r");
12758         char c = getc(fp);
12759         if (
12760                 18 <= FILE_cnt(fp) &&
12761                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12762         )
12763                 exit(0);
12764         exit(1);
12765 }
12766 EOP
12767 val="$undef"
12768 set try
12769 if eval $compile && $to try.c; then
12770         if $run ./try; then
12771                 echo "Your stdio acts pretty std."
12772                 val="$define"
12773         else
12774                 echo "Your stdio isn't very std."
12775         fi
12776 else
12777         echo "Your stdio doesn't appear very std."
12778 fi
12779 $rm_try
12780
12781 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12782 # direct buffer manipulation no longer works.  The Configure tests
12783 # should be changed to correctly detect this, but until then,
12784 # the following check should at least let perl compile and run.
12785 # (This quick fix should be updated before 5.8.1.)
12786 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12787 # A. Dougherty, June 3, 2002.
12788 case "$d_gnulibc" in
12789 $define)
12790         case "$gnulibc_version" in
12791         2.[01]*)  ;;
12792         2.2) ;;
12793         2.2.[0-9]) ;;
12794         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12795                 val="$undef"
12796                 ;;
12797         esac
12798         ;;
12799 esac
12800 set d_stdstdio
12801 eval $setvar
12802
12803 : Can _ptr be used as an lvalue?
12804 case "$d_stdstdio$ptr_lval" in
12805 $define$define) val=$define ;;
12806 *) val=$undef ;;
12807 esac
12808 set d_stdio_ptr_lval
12809 eval $setvar
12810
12811 : Can _cnt be used as an lvalue?
12812 case "$d_stdstdio$cnt_lval" in
12813 $define$define) val=$define ;;
12814 *) val=$undef ;;
12815 esac
12816 set d_stdio_cnt_lval
12817 eval $setvar
12818
12819
12820 : test whether setting _ptr sets _cnt as a side effect
12821 d_stdio_ptr_lval_sets_cnt="$undef"
12822 d_stdio_ptr_lval_nochange_cnt="$undef"
12823 case "$d_stdio_ptr_lval$d_stdstdio" in
12824 $define$define)
12825         echo "Checking to see what happens if we set the stdio ptr..." >&4
12826 $cat >try.c <<EOP
12827 #include <stdio.h>
12828 /* Can we scream? */
12829 /* Eat dust sed :-) */
12830 /* In the buffer space, no one can hear you scream. */
12831 #$i_stdlib I_STDLIB
12832 #ifdef I_STDLIB
12833 #include <stdlib.h>
12834 #endif
12835 #define FILE_ptr(fp)    $stdio_ptr
12836 #define FILE_cnt(fp)    $stdio_cnt
12837 #include <sys/types.h>
12838 int main() {
12839         FILE *fp = fopen("try.c", "r");
12840         int c;
12841         char *ptr;
12842         size_t cnt;
12843         if (!fp) {
12844             puts("Fail even to read");
12845             exit(1);
12846         }
12847         c = getc(fp); /* Read away the first # */
12848         if (c == EOF) {
12849             puts("Fail even to read");
12850             exit(1);
12851         }
12852         if (!(
12853                 18 <= FILE_cnt(fp) &&
12854                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12855         )) {
12856                 puts("Fail even to read");
12857                 exit (1);
12858         }
12859         ptr = (char*) FILE_ptr(fp);
12860         cnt = (size_t)FILE_cnt(fp);
12861
12862         FILE_ptr(fp) += 42;
12863
12864         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12865                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12866                 exit (1);
12867         }
12868         if (FILE_cnt(fp) <= 20) {
12869                 printf ("Fail (<20 chars to test)");
12870                 exit (1);
12871         }
12872         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12873                 puts("Fail compare");
12874                 exit (1);
12875         }
12876         if (cnt == FILE_cnt(fp)) {
12877                 puts("Pass_unchanged");
12878                 exit (0);
12879         }
12880         if (FILE_cnt(fp) == (cnt - 42)) {
12881                 puts("Pass_changed");
12882                 exit (0);
12883         }
12884         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12885         return 1;
12886
12887 }
12888 EOP
12889         set try
12890         if eval $compile && $to try.c; then
12891                 case `$run ./try` in
12892                 Pass_changed)
12893                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12894                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12895                 Pass_unchanged)
12896                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12897                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12898                 Fail*)
12899                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12900                 *)
12901                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12902         esac
12903         else
12904                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12905         fi
12906         $rm_try
12907         ;;
12908 esac
12909
12910 : see if _base is also standard
12911 val="$undef"
12912 case "$d_stdstdio" in
12913 $define)
12914         $cat >try.c <<EOP
12915 #include <stdio.h>
12916 #$i_stdlib I_STDLIB
12917 #ifdef I_STDLIB
12918 #include <stdlib.h>
12919 #endif
12920 #define FILE_base(fp)   $stdio_base
12921 #define FILE_bufsiz(fp) $stdio_bufsiz
12922 int main() {
12923         FILE *fp = fopen("try.c", "r");
12924         char c = getc(fp);
12925         if (
12926                 19 <= FILE_bufsiz(fp) &&
12927                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12928         )
12929                 exit(0);
12930         exit(1);
12931 }
12932 EOP
12933         set try
12934         if eval $compile && $to try.c; then
12935                 if $run ./try; then
12936                         echo "And its _base field acts std."
12937                         val="$define"
12938                 else
12939                         echo "But its _base field isn't std."
12940                 fi
12941         else
12942                 echo "However, it seems to be lacking the _base field."
12943         fi
12944         $rm_try
12945         ;;
12946 esac
12947 set d_stdiobase
12948 eval $setvar
12949
12950 : see if fast_stdio exists
12951 val="$undef"
12952 case "$d_stdstdio:$d_stdio_ptr_lval" in
12953 "$define:$define")
12954         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12955         *$define*)
12956                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12957                 val="$define"
12958                 ;;
12959         esac
12960         ;;
12961 esac
12962 set d_faststdio
12963 eval $setvar
12964
12965
12966
12967 : see if fchdir exists
12968 set fchdir d_fchdir
12969 eval $inlibc
12970
12971 : see if fchmod exists
12972 set fchmod d_fchmod
12973 eval $inlibc
12974
12975 : see if fchown exists
12976 set fchown d_fchown
12977 eval $inlibc
12978
12979 : see if this is an fcntl system
12980 set fcntl d_fcntl
12981 eval $inlibc
12982
12983 : See if fcntl-based locking works.
12984 echo " "
12985 $cat >try.c <<EOCP
12986 #$i_stdlib I_STDLIB
12987 #ifdef I_STDLIB
12988 #include <stdlib.h>
12989 #endif
12990 #include <unistd.h>
12991 #include <fcntl.h>
12992 #include <signal.h>
12993 $signal_t blech(int x) { exit(3); }
12994 int main() {
12995 #if defined(F_SETLK) && defined(F_SETLKW)
12996      struct flock flock;
12997      int retval, fd;
12998      fd = open("try.c", O_RDONLY);
12999      flock.l_type = F_RDLCK;
13000      flock.l_whence = SEEK_SET;
13001      flock.l_start = flock.l_len = 0;
13002      signal(SIGALRM, blech);
13003      alarm(10);
13004      retval = fcntl(fd, F_SETLK, &flock);
13005      close(fd);
13006      (retval < 0 ? exit(2) : exit(0));
13007 #else
13008      exit(2);
13009 #endif
13010 }
13011 EOCP
13012 echo "Checking if fcntl-based file locking works... "
13013 case "$d_fcntl" in
13014 "$define")
13015         set try
13016         if eval $compile_ok; then
13017                 if $run ./try; then
13018                         echo "Yes, it seems to work."
13019                         val="$define"
13020                 else
13021                         echo "Nope, it didn't work."
13022                         val="$undef"
13023                         case "$?" in
13024                         3) $cat >&4 <<EOM
13025 ***
13026 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13027 *** This is (almost) impossible.
13028 *** If your NFS lock daemons are not feeling well, something like
13029 *** this may happen, please investigate.  Cannot continue, aborting.
13030 ***
13031 EOM
13032                                 exit 1
13033                                 ;;
13034                         esac
13035                 fi
13036         else
13037                 echo "I'm unable to compile the test program, so I'll assume not."
13038                 val="$undef"
13039         fi
13040         ;;
13041 *) val="$undef";
13042         echo "Nope, since you don't even have fcntl()."
13043         ;;
13044 esac
13045 set d_fcntl_can_lock
13046 eval $setvar
13047 $rm_try
13048
13049 : check for fd_set items
13050 $cat <<EOM
13051
13052 Checking to see how well your C compiler handles fd_set and friends ...
13053 EOM
13054 $cat >try.c <<EOCP
13055 #$i_stdlib I_STDLIB
13056 #ifdef I_STDLIB
13057 #include <stdlib.h>
13058 #endif
13059 #$i_systime I_SYS_TIME
13060 #$i_sysselct I_SYS_SELECT
13061 #$d_socket HAS_SOCKET
13062 #include <sys/types.h>
13063 #ifdef HAS_SOCKET
13064 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13065 #endif
13066 #ifdef I_SYS_TIME
13067 #include <sys/time.h>
13068 #endif
13069 #ifdef I_SYS_SELECT
13070 #include <sys/select.h>
13071 #endif
13072 int main() {
13073         fd_set fds;
13074
13075 #ifdef TRYBITS
13076         if(fds.fds_bits);
13077 #endif
13078
13079 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13080         exit(0);
13081 #else
13082         exit(1);
13083 #endif
13084 }
13085 EOCP
13086 set try -DTRYBITS
13087 if eval $compile; then
13088         d_fds_bits="$define"
13089         d_fd_set="$define"
13090         echo "Well, your system knows about the normal fd_set typedef..." >&4
13091         if $run ./try; then
13092                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13093                 d_fd_macros="$define"
13094         else
13095                 $cat >&4 <<'EOM'
13096 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13097 EOM
13098                 d_fd_macros="$undef"
13099         fi
13100 else
13101         $cat <<'EOM'
13102 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13103 EOM
13104         set try
13105         if eval $compile; then
13106                 d_fds_bits="$undef"
13107                 d_fd_set="$define"
13108                 echo "Well, your system has some sort of fd_set available..." >&4
13109                 if $run ./try; then
13110                         echo "and you have the normal fd_set macros." >&4
13111                         d_fd_macros="$define"
13112                 else
13113                         $cat <<'EOM'
13114 but not the normal fd_set macros!  Gross!  More work for me...
13115 EOM
13116                         d_fd_macros="$undef"
13117                 fi
13118         else
13119         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13120                 d_fd_set="$undef"
13121                 d_fds_bits="$undef"
13122                 d_fd_macros="$undef"
13123         fi
13124 fi
13125 $rm_try
13126
13127 : see if fgetpos exists
13128 set fgetpos d_fgetpos
13129 eval $inlibc
13130
13131 : see if finite exists
13132 set finite d_finite
13133 eval $inlibc
13134
13135 : see if finitel exists
13136 set finitel d_finitel
13137 eval $inlibc
13138
13139 : see if flock exists
13140 set flock d_flock
13141 eval $inlibc
13142
13143 : see if prototype for flock is available
13144 echo " "
13145 set d_flockproto flock $i_sysfile sys/file.h
13146 eval $hasproto
13147
13148 : see if fp_class exists
13149 set fp_class d_fp_class
13150 eval $inlibc
13151
13152 : see if pathconf exists
13153 set pathconf d_pathconf
13154 eval $inlibc
13155
13156 : see if fpathconf exists
13157 set fpathconf d_fpathconf
13158 eval $inlibc
13159
13160 : see if fpclass exists
13161 set fpclass d_fpclass
13162 eval $inlibc
13163
13164 : see if fpclassify exists
13165 set fpclassify d_fpclassify
13166 eval $inlibc
13167
13168 : see if fpclassl exists
13169 set fpclassl d_fpclassl
13170 eval $inlibc
13171
13172 : check for fpos64_t
13173 echo " "
13174 echo "Checking to see if you have fpos64_t..." >&4
13175 $cat >try.c <<EOCP
13176 #include <stdio.h>
13177 int main() { fpos64_t x = 7; }
13178 EOCP
13179 set try
13180 if eval $compile; then
13181         val="$define"
13182         echo "You have fpos64_t."
13183 else
13184         val="$undef"
13185         echo "You do not have fpos64_t."
13186         case "$fpossize" in
13187         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13188         esac
13189 fi
13190 $rm_try
13191 set d_fpos64_t
13192 eval $setvar
13193
13194 : see if frexpl exists
13195 set frexpl d_frexpl
13196 eval $inlibc
13197
13198 : see if this is a sys/param system
13199 set sys/param.h i_sysparam
13200 eval $inhdr
13201
13202 : see if this is a sys/mount.h system
13203 set sys/mount.h i_sysmount
13204 eval $inhdr
13205
13206 : Check for fs_data_s
13207 echo " "
13208 echo "Checking to see if your system supports struct fs_data..." >&4
13209 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13210 eval $hasstruct
13211 case "$d_fs_data_s" in
13212 "$define")      echo "Yes, it does."   ;;
13213 *)              echo "No, it doesn't." ;;
13214 esac
13215
13216 : see if fseeko exists
13217 set fseeko d_fseeko
13218 eval $inlibc
13219 case "$longsize" in
13220 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13221 esac
13222
13223 : see if fsetpos exists
13224 set fsetpos d_fsetpos
13225 eval $inlibc
13226
13227 : see if fstatfs exists
13228 set fstatfs d_fstatfs
13229 eval $inlibc
13230
13231 : see if statvfs exists
13232 set statvfs d_statvfs
13233 eval $inlibc
13234
13235 : see if fstatvfs exists
13236 set fstatvfs d_fstatvfs
13237 eval $inlibc
13238
13239
13240 : see if fsync exists
13241 set fsync d_fsync
13242 eval $inlibc
13243
13244 : see if ftello exists
13245 set ftello d_ftello
13246 eval $inlibc
13247 case "$longsize" in
13248 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13249 esac
13250
13251 : check for a working futimes
13252 d_futimes="$undef"
13253 echo " "
13254 echo "Checking if you have a working futimes()" >&4
13255 $cat >try.c <<EOCP
13256 #include <stdio.h>
13257 #include <sys/time.h>
13258 #include <errno.h>
13259 #include <fcntl.h>
13260
13261 int main ()
13262 {
13263     int fd, rv;
13264     fd = open ("try.c", O_RDWR);
13265     if (-1 == fd) exit (1);
13266     rv = futimes (fd, NULL);
13267     exit (rv == -1 ? errno : 0);
13268 }
13269 EOCP
13270 set try
13271 if eval $compile; then
13272     `$run ./try`
13273     rc=$?
13274     case "$rc" in
13275         0)  echo "Yes, you have" >&4
13276             d_futimes="$define"
13277             ;;
13278         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13279             ;;
13280     esac
13281 else
13282     echo "No, it does not (probably harmless)" >&4
13283 fi
13284 $rm_try
13285
13286 : see if getcwd exists
13287 set getcwd d_getcwd
13288 eval $inlibc
13289
13290 : see if getespwnam exists
13291 set getespwnam d_getespwnam
13292 eval $inlibc
13293
13294 : see if getfsstat exists
13295 set getfsstat d_getfsstat
13296 eval $inlibc
13297
13298 : see if getgrent exists
13299 set getgrent d_getgrent
13300 eval $inlibc
13301
13302 : see if getgrent_r exists
13303 set getgrent_r d_getgrent_r
13304 eval $inlibc
13305 case "$d_getgrent_r" in
13306 "$define")
13307         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13308         case "$d_getgrent_r_proto:$usethreads" in
13309         ":define")      d_getgrent_r_proto=define
13310                 set d_getgrent_r_proto getgrent_r $hdrs
13311                 eval $hasproto ;;
13312         *)      ;;
13313         esac
13314         case "$d_getgrent_r_proto" in
13315         define)
13316         case "$getgrent_r_proto" in
13317         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13318         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13319         esac
13320         case "$getgrent_r_proto" in
13321         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13322         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13323         esac
13324         case "$getgrent_r_proto" in
13325         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13326         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13327         esac
13328         case "$getgrent_r_proto" in
13329         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13330         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13331         esac
13332         case "$getgrent_r_proto" in
13333         ''|0) try='int getgrent_r(struct group*, char*, int);'
13334         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13335         esac
13336         case "$getgrent_r_proto" in
13337         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13338         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13339         esac
13340         case "$getgrent_r_proto" in
13341         ''|0)   d_getgrent_r=undef
13342                 getgrent_r_proto=0
13343                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13344         * )     case "$getgrent_r_proto" in
13345                 REENTRANT_PROTO*) ;;
13346                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13347                 esac
13348                 echo "Prototype: $try" ;;
13349         esac
13350         ;;
13351         *)      case "$usethreads" in
13352                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13353                 esac
13354                 d_getgrent_r=undef
13355                 getgrent_r_proto=0
13356                 ;;
13357         esac
13358         ;;
13359 *)      getgrent_r_proto=0
13360         ;;
13361 esac
13362
13363 : see if getgrgid_r exists
13364 set getgrgid_r d_getgrgid_r
13365 eval $inlibc
13366 case "$d_getgrgid_r" in
13367 "$define")
13368         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13369         case "$d_getgrgid_r_proto:$usethreads" in
13370         ":define")      d_getgrgid_r_proto=define
13371                 set d_getgrgid_r_proto getgrgid_r $hdrs
13372                 eval $hasproto ;;
13373         *)      ;;
13374         esac
13375         case "$d_getgrgid_r_proto" in
13376         define)
13377         case "$getgrgid_r_proto" in
13378         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13379         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13380         esac
13381         case "$getgrgid_r_proto" in
13382         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13383         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13384         esac
13385         case "$getgrgid_r_proto" in
13386         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13387         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13388         esac
13389         case "$getgrgid_r_proto" in
13390         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13391         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13392         esac
13393         case "$getgrgid_r_proto" in
13394         ''|0)   d_getgrgid_r=undef
13395                 getgrgid_r_proto=0
13396                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13397         * )     case "$getgrgid_r_proto" in
13398                 REENTRANT_PROTO*) ;;
13399                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13400                 esac
13401                 echo "Prototype: $try" ;;
13402         esac
13403         ;;
13404         *)      case "$usethreads" in
13405                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13406                 esac
13407                 d_getgrgid_r=undef
13408                 getgrgid_r_proto=0
13409                 ;;
13410         esac
13411         ;;
13412 *)      getgrgid_r_proto=0
13413         ;;
13414 esac
13415
13416 : see if getgrnam_r exists
13417 set getgrnam_r d_getgrnam_r
13418 eval $inlibc
13419 case "$d_getgrnam_r" in
13420 "$define")
13421         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13422         case "$d_getgrnam_r_proto:$usethreads" in
13423         ":define")      d_getgrnam_r_proto=define
13424                 set d_getgrnam_r_proto getgrnam_r $hdrs
13425                 eval $hasproto ;;
13426         *)      ;;
13427         esac
13428         case "$d_getgrnam_r_proto" in
13429         define)
13430         case "$getgrnam_r_proto" in
13431         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13432         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13433         esac
13434         case "$getgrnam_r_proto" in
13435         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13436         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13437         esac
13438         case "$getgrnam_r_proto" in
13439         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13440         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13441         esac
13442         case "$getgrnam_r_proto" in
13443         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13444         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13445         esac
13446         case "$getgrnam_r_proto" in
13447         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13448         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13449         esac
13450         case "$getgrnam_r_proto" in
13451         ''|0)   d_getgrnam_r=undef
13452                 getgrnam_r_proto=0
13453                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13454         * )     case "$getgrnam_r_proto" in
13455                 REENTRANT_PROTO*) ;;
13456                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13457                 esac
13458                 echo "Prototype: $try" ;;
13459         esac
13460         ;;
13461         *)      case "$usethreads" in
13462                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13463                 esac
13464                 d_getgrnam_r=undef
13465                 getgrnam_r_proto=0
13466                 ;;
13467         esac
13468         ;;
13469 *)      getgrnam_r_proto=0
13470         ;;
13471 esac
13472
13473 : see if gethostbyaddr exists
13474 set gethostbyaddr d_gethbyaddr
13475 eval $inlibc
13476
13477 : see if gethostbyname exists
13478 set gethostbyname d_gethbyname
13479 eval $inlibc
13480
13481 : see if gethostent exists
13482 set gethostent d_gethent
13483 eval $inlibc
13484
13485 : see how we will look up host name
13486 echo " "
13487 call=''
13488 if set gethostname val -f d_gethname; eval $csym; $val; then
13489         echo 'gethostname() found.' >&4
13490         d_gethname="$define"
13491         call=gethostname
13492 fi
13493 if set uname val -f d_uname; eval $csym; $val; then
13494         if ./xenix; then
13495                 $cat <<'EOM'
13496 uname() was found, but you're running xenix, and older versions of xenix
13497 have a broken uname(). If you don't really know whether your xenix is old
13498 enough to have a broken system call, use the default answer.
13499
13500 EOM
13501                 dflt=y
13502                 case "$d_uname" in
13503                 "$define") dflt=n;;
13504                 esac
13505                 rp='Is your uname() broken?'
13506                 . ./myread
13507                 case "$ans" in
13508                 n*) d_uname="$define"; call=uname;;
13509                 esac
13510         else
13511                 echo 'uname() found.' >&4
13512                 d_uname="$define"
13513                 case "$call" in
13514                 '') call=uname ;;
13515                 esac
13516         fi
13517 fi
13518 case "$d_gethname" in
13519 '') d_gethname="$undef";;
13520 esac
13521 case "$d_uname" in
13522 '') d_uname="$undef";;
13523 esac
13524 case "$d_uname$d_gethname" in
13525 *define*)
13526         dflt=n
13527         cat <<EOM
13528
13529 Every now and then someone has a $call() that lies about the hostname
13530 but can't be fixed for political or economic reasons.  If you wish, I can
13531 pretend $call() isn't there and maybe compute hostname at run-time
13532 thanks to the '$phostname' command.
13533
13534 EOM
13535         rp="Shall I ignore $call() from now on?"
13536         . ./myread
13537         case "$ans" in
13538         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13539         esac;;
13540 esac
13541 case "$phostname" in
13542 '') aphostname='';;
13543 *) case "$aphostname" in
13544         /*) ;;
13545         *) set X $phostname
13546                 shift
13547                 file=$1
13548                 shift
13549                 file=`./loc $file $file $pth`
13550                 aphostname=`echo $file $*`
13551                 ;;
13552         esac
13553         ;;
13554 esac
13555 case "$d_uname$d_gethname" in
13556 *define*) ;;
13557 *)
13558         case "$phostname" in
13559         '')
13560                 echo "There will be no way for $package to get your hostname." >&4;;
13561         *)
13562         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13563                 ;;
13564         esac;;
13565 esac
13566 case "$d_phostname" in
13567 '') d_phostname="$undef";;
13568 esac
13569
13570 : see if gethostbyaddr_r exists
13571 set gethostbyaddr_r d_gethostbyaddr_r
13572 eval $inlibc
13573 case "$d_gethostbyaddr_r" in
13574 "$define")
13575         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13576         case "$d_gethostbyaddr_r_proto:$usethreads" in
13577         ":define")      d_gethostbyaddr_r_proto=define
13578                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13579                 eval $hasproto ;;
13580         *)      ;;
13581         esac
13582         case "$d_gethostbyaddr_r_proto" in
13583         define)
13584         case "$gethostbyaddr_r_proto" in
13585         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13586         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13587         esac
13588         case "$gethostbyaddr_r_proto" in
13589         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13590         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13591         esac
13592         case "$gethostbyaddr_r_proto" in
13593         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13594         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13595         esac
13596         case "$gethostbyaddr_r_proto" in
13597         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13598         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13599         esac
13600         case "$gethostbyaddr_r_proto" in
13601         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13602         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13603         esac
13604         case "$gethostbyaddr_r_proto" in
13605         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13606         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13607         esac
13608         case "$gethostbyaddr_r_proto" in
13609         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13610         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13611         esac
13612         case "$gethostbyaddr_r_proto" in
13613         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13614         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13615         esac
13616         case "$gethostbyaddr_r_proto" in
13617         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13618         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13619         esac
13620         case "$gethostbyaddr_r_proto" in
13621         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13622         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13623         esac
13624         case "$gethostbyaddr_r_proto" in
13625         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13626         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13627         esac
13628         case "$gethostbyaddr_r_proto" in
13629         ''|0)   d_gethostbyaddr_r=undef
13630                 gethostbyaddr_r_proto=0
13631                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13632         * )     case "$gethostbyaddr_r_proto" in
13633                 REENTRANT_PROTO*) ;;
13634                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13635                 esac
13636                 echo "Prototype: $try" ;;
13637         esac
13638         ;;
13639         *)      case "$usethreads" in
13640                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13641                 esac
13642                 d_gethostbyaddr_r=undef
13643                 gethostbyaddr_r_proto=0
13644                 ;;
13645         esac
13646         ;;
13647 *)      gethostbyaddr_r_proto=0
13648         ;;
13649 esac
13650
13651 : see if gethostbyname_r exists
13652 set gethostbyname_r d_gethostbyname_r
13653 eval $inlibc
13654 case "$d_gethostbyname_r" in
13655 "$define")
13656         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13657         case "$d_gethostbyname_r_proto:$usethreads" in
13658         ":define")      d_gethostbyname_r_proto=define
13659                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13660                 eval $hasproto ;;
13661         *)      ;;
13662         esac
13663         case "$d_gethostbyname_r_proto" in
13664         define)
13665         case "$gethostbyname_r_proto" in
13666         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13667         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13668         esac
13669         case "$gethostbyname_r_proto" in
13670         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13671         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13672         esac
13673         case "$gethostbyname_r_proto" in
13674         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13675         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13676         esac
13677         case "$gethostbyname_r_proto" in
13678         ''|0)   d_gethostbyname_r=undef
13679                 gethostbyname_r_proto=0
13680                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13681         * )     case "$gethostbyname_r_proto" in
13682                 REENTRANT_PROTO*) ;;
13683                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13684                 esac
13685                 echo "Prototype: $try" ;;
13686         esac
13687         ;;
13688         *)      case "$usethreads" in
13689                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13690                 esac
13691                 d_gethostbyname_r=undef
13692                 gethostbyname_r_proto=0
13693                 ;;
13694         esac
13695         ;;
13696 *)      gethostbyname_r_proto=0
13697         ;;
13698 esac
13699
13700 : see if gethostent_r exists
13701 set gethostent_r d_gethostent_r
13702 eval $inlibc
13703 case "$d_gethostent_r" in
13704 "$define")
13705         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13706         case "$d_gethostent_r_proto:$usethreads" in
13707         ":define")      d_gethostent_r_proto=define
13708                 set d_gethostent_r_proto gethostent_r $hdrs
13709                 eval $hasproto ;;
13710         *)      ;;
13711         esac
13712         case "$d_gethostent_r_proto" in
13713         define)
13714         case "$gethostent_r_proto" in
13715         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13716         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13717         esac
13718         case "$gethostent_r_proto" in
13719         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13720         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13721         esac
13722         case "$gethostent_r_proto" in
13723         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13724         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13725         esac
13726         case "$gethostent_r_proto" in
13727         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13728         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13729         esac
13730         case "$gethostent_r_proto" in
13731         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13732         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13733         esac
13734         case "$gethostent_r_proto" in
13735         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13736         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13737         esac
13738         case "$gethostent_r_proto" in
13739         ''|0)   d_gethostent_r=undef
13740                 gethostent_r_proto=0
13741                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13742         * )     case "$gethostent_r_proto" in
13743                 REENTRANT_PROTO*) ;;
13744                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13745                 esac
13746                 echo "Prototype: $try" ;;
13747         esac
13748         ;;
13749         *)      case "$usethreads" in
13750                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13751                 esac
13752                 d_gethostent_r=undef
13753                 gethostent_r_proto=0
13754                 ;;
13755         esac
13756         ;;
13757 *)      gethostent_r_proto=0
13758         ;;
13759 esac
13760
13761 : see if prototypes for various gethostxxx netdb.h functions are available
13762 echo " "
13763 set d_gethostprotos gethostent $i_netdb netdb.h
13764 eval $hasproto
13765
13766 : see if getitimer exists
13767 set getitimer d_getitimer
13768 eval $inlibc
13769
13770 : see if getlogin exists
13771 set getlogin d_getlogin
13772 eval $inlibc
13773
13774 : see if getlogin_r exists
13775 set getlogin_r d_getlogin_r
13776 eval $inlibc
13777 case "$d_getlogin_r" in
13778 "$define")
13779         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13780         case "$d_getlogin_r_proto:$usethreads" in
13781         ":define")      d_getlogin_r_proto=define
13782                 set d_getlogin_r_proto getlogin_r $hdrs
13783                 eval $hasproto ;;
13784         *)      ;;
13785         esac
13786         case "$d_getlogin_r_proto" in
13787         define)
13788         case "$getlogin_r_proto" in
13789         ''|0) try='int getlogin_r(char*, size_t);'
13790         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13791         esac
13792         case "$getlogin_r_proto" in
13793         ''|0) try='int getlogin_r(char*, int);'
13794         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13795         esac
13796         case "$getlogin_r_proto" in
13797         ''|0) try='char* getlogin_r(char*, size_t);'
13798         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13799         esac
13800         case "$getlogin_r_proto" in
13801         ''|0) try='char* getlogin_r(char*, int);'
13802         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13803         esac
13804         case "$getlogin_r_proto" in
13805         ''|0)   d_getlogin_r=undef
13806                 getlogin_r_proto=0
13807                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13808         * )     case "$getlogin_r_proto" in
13809                 REENTRANT_PROTO*) ;;
13810                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13811                 esac
13812                 echo "Prototype: $try" ;;
13813         esac
13814         ;;
13815         *)      case "$usethreads" in
13816                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13817                 esac
13818                 d_getlogin_r=undef
13819                 getlogin_r_proto=0
13820                 ;;
13821         esac
13822         ;;
13823 *)      getlogin_r_proto=0
13824         ;;
13825 esac
13826
13827 : see if getmnt exists
13828 set getmnt d_getmnt
13829 eval $inlibc
13830
13831 : see if getmntent exists
13832 set getmntent d_getmntent
13833 eval $inlibc
13834
13835 : see if getnetbyaddr exists
13836 set getnetbyaddr d_getnbyaddr
13837 eval $inlibc
13838
13839 : see if getnetbyname exists
13840 set getnetbyname d_getnbyname
13841 eval $inlibc
13842
13843 : see if getnetent exists
13844 set getnetent d_getnent
13845 eval $inlibc
13846
13847 : see if getnetbyaddr_r exists
13848 set getnetbyaddr_r d_getnetbyaddr_r
13849 eval $inlibc
13850 case "$d_getnetbyaddr_r" in
13851 "$define")
13852         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13853         case "$d_getnetbyaddr_r_proto:$usethreads" in
13854         ":define")      d_getnetbyaddr_r_proto=define
13855                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13856                 eval $hasproto ;;
13857         *)      ;;
13858         esac
13859         case "$d_getnetbyaddr_r_proto" in
13860         define)
13861         case "$getnetbyaddr_r_proto" in
13862         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13863         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13864         esac
13865         case "$getnetbyaddr_r_proto" in
13866         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13867         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13868         esac
13869         case "$getnetbyaddr_r_proto" in
13870         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13871         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13872         esac
13873         case "$getnetbyaddr_r_proto" in
13874         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13875         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13876         esac
13877         case "$getnetbyaddr_r_proto" in
13878         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13879         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13880         esac
13881         case "$getnetbyaddr_r_proto" in
13882         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13883         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13884         esac
13885         case "$getnetbyaddr_r_proto" in
13886         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13887         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13888         esac
13889         case "$getnetbyaddr_r_proto" in
13890         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13891         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13892         esac
13893         case "$getnetbyaddr_r_proto" in
13894         ''|0)   d_getnetbyaddr_r=undef
13895                 getnetbyaddr_r_proto=0
13896                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13897         * )     case "$getnetbyaddr_r_proto" in
13898                 REENTRANT_PROTO*) ;;
13899                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13900                 esac
13901                 echo "Prototype: $try" ;;
13902         esac
13903         ;;
13904         *)      case "$usethreads" in
13905                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13906                 esac
13907                 d_getnetbyaddr_r=undef
13908                 getnetbyaddr_r_proto=0
13909                 ;;
13910         esac
13911         ;;
13912 *)      getnetbyaddr_r_proto=0
13913         ;;
13914 esac
13915
13916 : see if getnetbyname_r exists
13917 set getnetbyname_r d_getnetbyname_r
13918 eval $inlibc
13919 case "$d_getnetbyname_r" in
13920 "$define")
13921         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13922         case "$d_getnetbyname_r_proto:$usethreads" in
13923         ":define")      d_getnetbyname_r_proto=define
13924                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13925                 eval $hasproto ;;
13926         *)      ;;
13927         esac
13928         case "$d_getnetbyname_r_proto" in
13929         define)
13930         case "$getnetbyname_r_proto" in
13931         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13932         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13933         esac
13934         case "$getnetbyname_r_proto" in
13935         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13936         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13937         esac
13938         case "$getnetbyname_r_proto" in
13939         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13940         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13941         esac
13942         case "$getnetbyname_r_proto" in
13943         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13944         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13945         esac
13946         case "$getnetbyname_r_proto" in
13947         ''|0)   d_getnetbyname_r=undef
13948                 getnetbyname_r_proto=0
13949                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13950         * )     case "$getnetbyname_r_proto" in
13951                 REENTRANT_PROTO*) ;;
13952                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13953                 esac
13954                 echo "Prototype: $try" ;;
13955         esac
13956         ;;
13957         *)      case "$usethreads" in
13958                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13959                 esac
13960                 d_getnetbyname_r=undef
13961                 getnetbyname_r_proto=0
13962                 ;;
13963         esac
13964         ;;
13965 *)      getnetbyname_r_proto=0
13966         ;;
13967 esac
13968
13969 : see if getnetent_r exists
13970 set getnetent_r d_getnetent_r
13971 eval $inlibc
13972 case "$d_getnetent_r" in
13973 "$define")
13974         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13975         case "$d_getnetent_r_proto:$usethreads" in
13976         ":define")      d_getnetent_r_proto=define
13977                 set d_getnetent_r_proto getnetent_r $hdrs
13978                 eval $hasproto ;;
13979         *)      ;;
13980         esac
13981         case "$d_getnetent_r_proto" in
13982         define)
13983         case "$getnetent_r_proto" in
13984         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13985         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13986         esac
13987         case "$getnetent_r_proto" in
13988         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13989         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13990         esac
13991         case "$getnetent_r_proto" in
13992         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13993         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13994         esac
13995         case "$getnetent_r_proto" in
13996         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13997         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
13998         esac
13999         case "$getnetent_r_proto" in
14000         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14001         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14002         esac
14003         case "$getnetent_r_proto" in
14004         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14005         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14006         esac
14007         case "$getnetent_r_proto" in
14008         ''|0)   d_getnetent_r=undef
14009                 getnetent_r_proto=0
14010                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14011         * )     case "$getnetent_r_proto" in
14012                 REENTRANT_PROTO*) ;;
14013                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14014                 esac
14015                 echo "Prototype: $try" ;;
14016         esac
14017         ;;
14018         *)      case "$usethreads" in
14019                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14020                 esac
14021                 d_getnetent_r=undef
14022                 getnetent_r_proto=0
14023                 ;;
14024         esac
14025         ;;
14026 *)      getnetent_r_proto=0
14027         ;;
14028 esac
14029
14030 : see if prototypes for various getnetxxx netdb.h functions are available
14031 echo " "
14032 set d_getnetprotos getnetent $i_netdb netdb.h
14033 eval $hasproto
14034
14035 : see if getpagesize exists
14036 set getpagesize d_getpagsz
14037 eval $inlibc
14038
14039 : Optional checks for getprotobyname and getprotobynumber
14040
14041 : see if getprotobyname exists
14042 set getprotobyname d_getpbyname
14043 eval $inlibc
14044
14045 : see if getprotobynumber exists
14046 set getprotobynumber d_getpbynumber
14047 eval $inlibc
14048
14049 : see if getprotoent exists
14050 set getprotoent d_getpent
14051 eval $inlibc
14052
14053 : see if getpgid exists
14054 set getpgid d_getpgid
14055 eval $inlibc
14056
14057 : see if getpgrp2 exists
14058 set getpgrp2 d_getpgrp2
14059 eval $inlibc
14060
14061 : see if getppid exists
14062 set getppid d_getppid
14063 eval $inlibc
14064
14065 : see if getpriority exists
14066 set getpriority d_getprior
14067 eval $inlibc
14068
14069 : see if getprotobyname_r exists
14070 set getprotobyname_r d_getprotobyname_r
14071 eval $inlibc
14072 case "$d_getprotobyname_r" in
14073 "$define")
14074         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14075         case "$d_getprotobyname_r_proto:$usethreads" in
14076         ":define")      d_getprotobyname_r_proto=define
14077                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14078                 eval $hasproto ;;
14079         *)      ;;
14080         esac
14081         case "$d_getprotobyname_r_proto" in
14082         define)
14083         case "$getprotobyname_r_proto" in
14084         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14085         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14086         esac
14087         case "$getprotobyname_r_proto" in
14088         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14089         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14090         esac
14091         case "$getprotobyname_r_proto" in
14092         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14093         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14094         esac
14095         case "$getprotobyname_r_proto" in
14096         ''|0)   d_getprotobyname_r=undef
14097                 getprotobyname_r_proto=0
14098                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14099         * )     case "$getprotobyname_r_proto" in
14100                 REENTRANT_PROTO*) ;;
14101                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14102                 esac
14103                 echo "Prototype: $try" ;;
14104         esac
14105         ;;
14106         *)      case "$usethreads" in
14107                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14108                 esac
14109                 d_getprotobyname_r=undef
14110                 getprotobyname_r_proto=0
14111                 ;;
14112         esac
14113         ;;
14114 *)      getprotobyname_r_proto=0
14115         ;;
14116 esac
14117
14118 : see if getprotobynumber_r exists
14119 set getprotobynumber_r d_getprotobynumber_r
14120 eval $inlibc
14121 case "$d_getprotobynumber_r" in
14122 "$define")
14123         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14124         case "$d_getprotobynumber_r_proto:$usethreads" in
14125         ":define")      d_getprotobynumber_r_proto=define
14126                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14127                 eval $hasproto ;;
14128         *)      ;;
14129         esac
14130         case "$d_getprotobynumber_r_proto" in
14131         define)
14132         case "$getprotobynumber_r_proto" in
14133         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14134         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14135         esac
14136         case "$getprotobynumber_r_proto" in
14137         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14138         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14139         esac
14140         case "$getprotobynumber_r_proto" in
14141         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14142         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14143         esac
14144         case "$getprotobynumber_r_proto" in
14145         ''|0)   d_getprotobynumber_r=undef
14146                 getprotobynumber_r_proto=0
14147                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14148         * )     case "$getprotobynumber_r_proto" in
14149                 REENTRANT_PROTO*) ;;
14150                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14151                 esac
14152                 echo "Prototype: $try" ;;
14153         esac
14154         ;;
14155         *)      case "$usethreads" in
14156                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14157                 esac
14158                 d_getprotobynumber_r=undef
14159                 getprotobynumber_r_proto=0
14160                 ;;
14161         esac
14162         ;;
14163 *)      getprotobynumber_r_proto=0
14164         ;;
14165 esac
14166
14167 : see if getprotoent_r exists
14168 set getprotoent_r d_getprotoent_r
14169 eval $inlibc
14170 case "$d_getprotoent_r" in
14171 "$define")
14172         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14173         case "$d_getprotoent_r_proto:$usethreads" in
14174         ":define")      d_getprotoent_r_proto=define
14175                 set d_getprotoent_r_proto getprotoent_r $hdrs
14176                 eval $hasproto ;;
14177         *)      ;;
14178         esac
14179         case "$d_getprotoent_r_proto" in
14180         define)
14181         case "$getprotoent_r_proto" in
14182         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14183         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14184         esac
14185         case "$getprotoent_r_proto" in
14186         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14187         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14188         esac
14189         case "$getprotoent_r_proto" in
14190         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14191         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14192         esac
14193         case "$getprotoent_r_proto" in
14194         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14195         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14196         esac
14197         case "$getprotoent_r_proto" in
14198         ''|0)   d_getprotoent_r=undef
14199                 getprotoent_r_proto=0
14200                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14201         * )     case "$getprotoent_r_proto" in
14202                 REENTRANT_PROTO*) ;;
14203                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14204                 esac
14205                 echo "Prototype: $try" ;;
14206         esac
14207         ;;
14208         *)      case "$usethreads" in
14209                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14210                 esac
14211                 d_getprotoent_r=undef
14212                 getprotoent_r_proto=0
14213                 ;;
14214         esac
14215         ;;
14216 *)      getprotoent_r_proto=0
14217         ;;
14218 esac
14219
14220 : see if prototypes for various getprotoxxx netdb.h functions are available
14221 echo " "
14222 set d_getprotoprotos getprotoent $i_netdb netdb.h
14223 eval $hasproto
14224
14225 : see if getprpwnam exists
14226 set getprpwnam d_getprpwnam
14227 eval $inlibc
14228
14229 : see if getpwent exists
14230 set getpwent d_getpwent
14231 eval $inlibc
14232
14233 : see if getpwent_r exists
14234 set getpwent_r d_getpwent_r
14235 eval $inlibc
14236 case "$d_getpwent_r" in
14237 "$define")
14238         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14239         case "$d_getpwent_r_proto:$usethreads" in
14240         ":define")      d_getpwent_r_proto=define
14241                 set d_getpwent_r_proto getpwent_r $hdrs
14242                 eval $hasproto ;;
14243         *)      ;;
14244         esac
14245         case "$d_getpwent_r_proto" in
14246         define)
14247         case "$getpwent_r_proto" in
14248         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14249         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14250         esac
14251         case "$getpwent_r_proto" in
14252         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14253         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14254         esac
14255         case "$getpwent_r_proto" in
14256         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14257         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14258         esac
14259         case "$getpwent_r_proto" in
14260         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14261         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14262         esac
14263         case "$getpwent_r_proto" in
14264         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14265         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14266         esac
14267         case "$getpwent_r_proto" in
14268         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14269         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14270         esac
14271         case "$getpwent_r_proto" in
14272         ''|0)   d_getpwent_r=undef
14273                 getpwent_r_proto=0
14274                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14275         * )     case "$getpwent_r_proto" in
14276                 REENTRANT_PROTO*) ;;
14277                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14278                 esac
14279                 echo "Prototype: $try" ;;
14280         esac
14281         ;;
14282         *)      case "$usethreads" in
14283                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14284                 esac
14285                 d_getpwent_r=undef
14286                 getpwent_r_proto=0
14287                 ;;
14288         esac
14289         ;;
14290 *)      getpwent_r_proto=0
14291         ;;
14292 esac
14293
14294 : see if getpwnam_r exists
14295 set getpwnam_r d_getpwnam_r
14296 eval $inlibc
14297 case "$d_getpwnam_r" in
14298 "$define")
14299         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14300         case "$d_getpwnam_r_proto:$usethreads" in
14301         ":define")      d_getpwnam_r_proto=define
14302                 set d_getpwnam_r_proto getpwnam_r $hdrs
14303                 eval $hasproto ;;
14304         *)      ;;
14305         esac
14306         case "$d_getpwnam_r_proto" in
14307         define)
14308         case "$getpwnam_r_proto" in
14309         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14310         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14311         esac
14312         case "$getpwnam_r_proto" in
14313         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14314         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14315         esac
14316         case "$getpwnam_r_proto" in
14317         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14318         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14319         esac
14320         case "$getpwnam_r_proto" in
14321         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14322         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14323         esac
14324         case "$getpwnam_r_proto" in
14325         ''|0)   d_getpwnam_r=undef
14326                 getpwnam_r_proto=0
14327                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14328         * )     case "$getpwnam_r_proto" in
14329                 REENTRANT_PROTO*) ;;
14330                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14331                 esac
14332                 echo "Prototype: $try" ;;
14333         esac
14334         ;;
14335         *)      case "$usethreads" in
14336                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14337                 esac
14338                 d_getpwnam_r=undef
14339                 getpwnam_r_proto=0
14340                 ;;
14341         esac
14342         ;;
14343 *)      getpwnam_r_proto=0
14344         ;;
14345 esac
14346
14347 : see if getpwuid_r exists
14348 set getpwuid_r d_getpwuid_r
14349 eval $inlibc
14350 case "$d_getpwuid_r" in
14351 "$define")
14352         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14353         case "$d_getpwuid_r_proto:$usethreads" in
14354         ":define")      d_getpwuid_r_proto=define
14355                 set d_getpwuid_r_proto getpwuid_r $hdrs
14356                 eval $hasproto ;;
14357         *)      ;;
14358         esac
14359         case "$d_getpwuid_r_proto" in
14360         define)
14361         case "$getpwuid_r_proto" in
14362         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14363         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14364         esac
14365         case "$getpwuid_r_proto" in
14366         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14367         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14368         esac
14369         case "$getpwuid_r_proto" in
14370         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14371         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14372         esac
14373         case "$getpwuid_r_proto" in
14374         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14375         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14376         esac
14377         case "$getpwuid_r_proto" in
14378         ''|0)   d_getpwuid_r=undef
14379                 getpwuid_r_proto=0
14380                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14381         * )     case "$getpwuid_r_proto" in
14382                 REENTRANT_PROTO*) ;;
14383                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14384                 esac
14385                 echo "Prototype: $try" ;;
14386         esac
14387         ;;
14388         *)      case "$usethreads" in
14389                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14390                 esac
14391                 d_getpwuid_r=undef
14392                 getpwuid_r_proto=0
14393                 ;;
14394         esac
14395         ;;
14396 *)      getpwuid_r_proto=0
14397         ;;
14398 esac
14399
14400 : Optional checks for getsbyname and getsbyport
14401
14402 : see if getservbyname exists
14403 set getservbyname d_getsbyname
14404 eval $inlibc
14405
14406 : see if getservbyport exists
14407 set getservbyport d_getsbyport
14408 eval $inlibc
14409
14410 : see if getservent exists
14411 set getservent d_getsent
14412 eval $inlibc
14413
14414 : see if getservbyname_r exists
14415 set getservbyname_r d_getservbyname_r
14416 eval $inlibc
14417 case "$d_getservbyname_r" in
14418 "$define")
14419         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14420         case "$d_getservbyname_r_proto:$usethreads" in
14421         ":define")      d_getservbyname_r_proto=define
14422                 set d_getservbyname_r_proto getservbyname_r $hdrs
14423                 eval $hasproto ;;
14424         *)      ;;
14425         esac
14426         case "$d_getservbyname_r_proto" in
14427         define)
14428         case "$getservbyname_r_proto" in
14429         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14430         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14431         esac
14432         case "$getservbyname_r_proto" in
14433         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14434         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14435         esac
14436         case "$getservbyname_r_proto" in
14437         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14438         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14439         esac
14440         case "$getservbyname_r_proto" in
14441         ''|0)   d_getservbyname_r=undef
14442                 getservbyname_r_proto=0
14443                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14444         * )     case "$getservbyname_r_proto" in
14445                 REENTRANT_PROTO*) ;;
14446                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14447                 esac
14448                 echo "Prototype: $try" ;;
14449         esac
14450         ;;
14451         *)      case "$usethreads" in
14452                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14453                 esac
14454                 d_getservbyname_r=undef
14455                 getservbyname_r_proto=0
14456                 ;;
14457         esac
14458         ;;
14459 *)      getservbyname_r_proto=0
14460         ;;
14461 esac
14462
14463 : see if getservbyport_r exists
14464 set getservbyport_r d_getservbyport_r
14465 eval $inlibc
14466 case "$d_getservbyport_r" in
14467 "$define")
14468         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14469         case "$d_getservbyport_r_proto:$usethreads" in
14470         ":define")      d_getservbyport_r_proto=define
14471                 set d_getservbyport_r_proto getservbyport_r $hdrs
14472                 eval $hasproto ;;
14473         *)      ;;
14474         esac
14475         case "$d_getservbyport_r_proto" in
14476         define)
14477         case "$getservbyport_r_proto" in
14478         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14479         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14480         esac
14481         case "$getservbyport_r_proto" in
14482         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14483         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14484         esac
14485         case "$getservbyport_r_proto" in
14486         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14487         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14488         esac
14489         case "$getservbyport_r_proto" in
14490         ''|0)   d_getservbyport_r=undef
14491                 getservbyport_r_proto=0
14492                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14493         * )     case "$getservbyport_r_proto" in
14494                 REENTRANT_PROTO*) ;;
14495                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14496                 esac
14497                 echo "Prototype: $try" ;;
14498         esac
14499         ;;
14500         *)      case "$usethreads" in
14501                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14502                 esac
14503                 d_getservbyport_r=undef
14504                 getservbyport_r_proto=0
14505                 ;;
14506         esac
14507         ;;
14508 *)      getservbyport_r_proto=0
14509         ;;
14510 esac
14511
14512 : see if getservent_r exists
14513 set getservent_r d_getservent_r
14514 eval $inlibc
14515 case "$d_getservent_r" in
14516 "$define")
14517         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14518         case "$d_getservent_r_proto:$usethreads" in
14519         ":define")      d_getservent_r_proto=define
14520                 set d_getservent_r_proto getservent_r $hdrs
14521                 eval $hasproto ;;
14522         *)      ;;
14523         esac
14524         case "$d_getservent_r_proto" in
14525         define)
14526         case "$getservent_r_proto" in
14527         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14528         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14529         esac
14530         case "$getservent_r_proto" in
14531         ''|0) try='int getservent_r(struct servent*, char*, int);'
14532         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14533         esac
14534         case "$getservent_r_proto" in
14535         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14536         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14537         esac
14538         case "$getservent_r_proto" in
14539         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14540         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14541         esac
14542         case "$getservent_r_proto" in
14543         ''|0)   d_getservent_r=undef
14544                 getservent_r_proto=0
14545                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14546         * )     case "$getservent_r_proto" in
14547                 REENTRANT_PROTO*) ;;
14548                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14549                 esac
14550                 echo "Prototype: $try" ;;
14551         esac
14552         ;;
14553         *)      case "$usethreads" in
14554                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14555                 esac
14556                 d_getservent_r=undef
14557                 getservent_r_proto=0
14558                 ;;
14559         esac
14560         ;;
14561 *)      getservent_r_proto=0
14562         ;;
14563 esac
14564
14565 : see if prototypes for various getservxxx netdb.h functions are available
14566 echo " "
14567 set d_getservprotos getservent $i_netdb netdb.h
14568 eval $hasproto
14569
14570 : see if getspnam exists
14571 set getspnam d_getspnam
14572 eval $inlibc
14573
14574 : see if this is a shadow.h system
14575 set shadow.h i_shadow
14576 eval $inhdr
14577
14578 : see if getspnam_r exists
14579 set getspnam_r d_getspnam_r
14580 eval $inlibc
14581 case "$d_getspnam_r" in
14582 "$define")
14583         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14584         case "$d_getspnam_r_proto:$usethreads" in
14585         ":define")      d_getspnam_r_proto=define
14586                 set d_getspnam_r_proto getspnam_r $hdrs
14587                 eval $hasproto ;;
14588         *)      ;;
14589         esac
14590         case "$d_getspnam_r_proto" in
14591         define)
14592         case "$getspnam_r_proto" in
14593         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14594         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14595         esac
14596         case "$getspnam_r_proto" in
14597         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14598         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14599         esac
14600         case "$getspnam_r_proto" in
14601         ''|0)   d_getspnam_r=undef
14602                 getspnam_r_proto=0
14603                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14604         * )     case "$getspnam_r_proto" in
14605                 REENTRANT_PROTO*) ;;
14606                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14607                 esac
14608                 echo "Prototype: $try" ;;
14609         esac
14610         ;;
14611         *)      case "$usethreads" in
14612                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14613                 esac
14614                 d_getspnam_r=undef
14615                 getspnam_r_proto=0
14616                 ;;
14617         esac
14618         ;;
14619 *)      getspnam_r_proto=0
14620         ;;
14621 esac
14622
14623 : see if gettimeofday or ftime exists
14624 set gettimeofday d_gettimeod
14625 eval $inlibc
14626 case "$d_gettimeod" in
14627 "$undef")
14628         set ftime d_ftime 
14629         eval $inlibc
14630         ;;
14631 *)
14632         val="$undef"; set d_ftime; eval $setvar
14633         ;;
14634 esac
14635 case "$d_gettimeod$d_ftime" in
14636 "$undef$undef")
14637         echo " "
14638         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14639         ;;
14640 esac
14641
14642 : see if gmtime_r exists
14643 set gmtime_r d_gmtime_r
14644 eval $inlibc
14645 case "$d_gmtime_r" in
14646 "$define")
14647         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14648         case "$d_gmtime_r_proto:$usethreads" in
14649         ":define")      d_gmtime_r_proto=define
14650                 set d_gmtime_r_proto gmtime_r $hdrs
14651                 eval $hasproto ;;
14652         *)      ;;
14653         esac
14654         case "$d_gmtime_r_proto" in
14655         define)
14656         case "$gmtime_r_proto" in
14657         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14658         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14659         esac
14660         case "$gmtime_r_proto" in
14661         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14662         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14663         esac
14664         case "$gmtime_r_proto" in
14665         ''|0)   d_gmtime_r=undef
14666                 gmtime_r_proto=0
14667                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14668         * )     case "$gmtime_r_proto" in
14669                 REENTRANT_PROTO*) ;;
14670                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14671                 esac
14672                 echo "Prototype: $try" ;;
14673         esac
14674         ;;
14675         *)      case "$usethreads" in
14676                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14677                 esac
14678                 d_gmtime_r=undef
14679                 gmtime_r_proto=0
14680                 ;;
14681         esac
14682         ;;
14683 *)      gmtime_r_proto=0
14684         ;;
14685 esac
14686
14687 : see if hasmntopt exists
14688 set hasmntopt d_hasmntopt
14689 eval $inlibc
14690
14691 : see if this is a netinet/in.h or sys/in.h system
14692 set netinet/in.h i_niin sys/in.h i_sysin
14693 eval $inhdr
14694
14695 : see if arpa/inet.h has to be included
14696 set arpa/inet.h i_arpainet
14697 eval $inhdr
14698
14699 : see if htonl --and friends-- exists
14700 val=''
14701 set htonl val
14702 eval $inlibc
14703
14704 : Maybe they are macros.
14705 case "$val" in
14706 $undef)
14707         $cat >htonl.c <<EOM
14708 #include <stdio.h>
14709 #include <sys/types.h>
14710 #$i_niin I_NETINET_IN
14711 #$i_sysin I_SYS_IN
14712 #$i_arpainet I_ARPA_INET
14713 #ifdef I_NETINET_IN
14714 #include <netinet/in.h>
14715 #endif
14716 #ifdef I_SYS_IN
14717 #include <sys/in.h>
14718 #endif
14719 #ifdef I_ARPA_INET
14720 #include <arpa/inet.h>
14721 #endif
14722 #ifdef htonl
14723 printf("Defined as a macro.");
14724 #endif
14725 EOM
14726         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14727         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14728                 val="$define"
14729                 echo "But it seems to be defined as a macro." >&4
14730         fi
14731         $rm -f htonl.?
14732         ;;
14733 esac
14734 set d_htonl
14735 eval $setvar
14736
14737 : see if ilogbl exists
14738 set ilogbl d_ilogbl
14739 eval $inlibc
14740
14741 : index or strchr
14742 echo " "
14743 if set index val -f; eval $csym; $val; then
14744         if set strchr val -f d_strchr; eval $csym; $val; then
14745                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14746                         val="$define"
14747                         vali="$undef"
14748                         echo "strchr() found." >&4
14749                 else
14750                         val="$undef"
14751                         vali="$define"
14752                         echo "index() found." >&4
14753                 fi
14754         else
14755                 val="$undef"
14756                 vali="$define"
14757                 echo "index() found." >&4
14758         fi
14759 else
14760         if set strchr val -f d_strchr; eval $csym; $val; then
14761                 val="$define"
14762                 vali="$undef"
14763                 echo "strchr() found." >&4
14764         else
14765                 echo "No index() or strchr() found!" >&4
14766                 val="$undef"
14767                 vali="$undef"
14768         fi
14769 fi
14770 set d_strchr; eval $setvar
14771 val="$vali"
14772 set d_index; eval $setvar
14773
14774 : check whether inet_aton exists
14775 set inet_aton d_inetaton
14776 eval $inlibc
14777
14778 : Look for isascii
14779 echo " "
14780 $cat >isascii.c <<EOCP
14781 #include <stdio.h>
14782 #include <ctype.h>
14783 #$i_stdlib I_STDLIB
14784 #ifdef I_STDLIB
14785 #include <stdlib.h>
14786 #endif
14787 int main() {
14788         int c = 'A';
14789         if (isascii(c))
14790                 exit(0);
14791         else
14792                 exit(1);
14793 }
14794 EOCP
14795 set isascii
14796 if eval $compile; then
14797         echo "isascii() found." >&4
14798         val="$define"
14799 else
14800         echo "isascii() NOT found." >&4
14801         val="$undef"
14802 fi
14803 set d_isascii
14804 eval $setvar
14805 $rm -f isascii*
14806
14807 : see if isfinite exists
14808 set isfinite d_isfinite
14809 eval $inlibc
14810
14811 : see if isinf exists
14812 set isinf d_isinf
14813 eval $inlibc
14814
14815 : see if isnan exists
14816 set isnan d_isnan
14817 eval $inlibc
14818
14819 : see if isnanl exists
14820 set isnanl d_isnanl
14821 eval $inlibc
14822
14823 : see if killpg exists
14824 set killpg d_killpg
14825 eval $inlibc
14826
14827 : see if lchown exists
14828 echo " "
14829 $cat > try.c <<'EOCP'
14830 /* System header to define __stub macros and hopefully few prototypes,
14831     which can conflict with char lchown(); below.  */
14832 #include <assert.h>
14833 /* Override any gcc2 internal prototype to avoid an error.  */
14834 /* We use char because int might match the return type of a gcc2
14835    builtin and then its argument prototype would still apply.  */
14836 char lchown();
14837 int main() {
14838     /*  The GNU C library defines this for functions which it implements
14839         to always fail with ENOSYS.  Some functions are actually named
14840         something starting with __ and the normal name is an alias.  */
14841 #if defined (__stub_lchown) || defined (__stub___lchown)
14842 choke me
14843 #else
14844 lchown();
14845 #endif
14846 ; return 0; }
14847 EOCP
14848 set try
14849 if eval $compile; then
14850     $echo "lchown() found." >&4
14851     val="$define"
14852 else
14853     $echo "lchown() NOT found." >&4
14854     val="$undef"
14855 fi
14856 set d_lchown
14857 eval $setvar
14858
14859 : See if number of significant digits in a double precision number is known
14860 echo " "
14861 $cat >ldbl_dig.c <<EOM
14862 #$i_limits I_LIMITS
14863 #$i_float I_FLOAT
14864 #ifdef I_LIMITS
14865 #include <limits.h>
14866 #endif
14867 #ifdef I_FLOAT
14868 #include <float.h>
14869 #endif
14870 #ifdef LDBL_DIG
14871 printf("Contains LDBL_DIG");
14872 #endif
14873 EOM
14874 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14875 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14876         echo "LDBL_DIG found." >&4
14877         val="$define"
14878 else
14879         echo "LDBL_DIG NOT found." >&4
14880         val="$undef"
14881 fi
14882 $rm -f ldbl_dig.?
14883 set d_ldbl_dig
14884 eval $setvar
14885
14886 : see if this is a math.h system
14887 set math.h i_math
14888 eval $inhdr
14889
14890 : check to see if math.h defines _LIB_VERSION
14891 d_libm_lib_version="$undef"
14892 case $i_math in
14893     $define)
14894         echo " "
14895         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14896         $cat >try.c <<EOCP
14897 #include <unistd.h>
14898 #include <math.h>
14899 int main (int argc, char *argv[])
14900 {
14901     printf ("%d\n", _LIB_VERSION);
14902     return (0);
14903     } /* main */
14904 EOCP
14905         set try
14906         if eval $compile; then
14907             foo=`$run ./try`
14908             echo "Yes, it does ($foo)" >&4
14909             d_libm_lib_version="$define"
14910         else
14911             echo "No, it does not (probably harmless)" >&4
14912             fi
14913         $rm_try
14914         ;;
14915
14916     esac
14917
14918 : see if link exists
14919 set link d_link
14920 eval $inlibc
14921
14922 : see if localtime_r exists
14923 set localtime_r d_localtime_r
14924 eval $inlibc
14925 case "$d_localtime_r" in
14926 "$define")
14927         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14928         case "$d_localtime_r_proto:$usethreads" in
14929         ":define")      d_localtime_r_proto=define
14930                 set d_localtime_r_proto localtime_r $hdrs
14931                 eval $hasproto ;;
14932         *)      ;;
14933         esac
14934         case "$d_localtime_r_proto" in
14935         define)
14936         case "$localtime_r_proto" in
14937         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14938         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
14939         esac
14940         case "$localtime_r_proto" in
14941         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14942         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
14943         esac
14944         case "$localtime_r_proto" in
14945         ''|0)   d_localtime_r=undef
14946                 localtime_r_proto=0
14947                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14948         * )     case "$localtime_r_proto" in
14949                 REENTRANT_PROTO*) ;;
14950                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14951                 esac
14952                 echo "Prototype: $try" ;;
14953         esac
14954         ;;
14955         *)      case "$usethreads" in
14956                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14957                 esac
14958                 d_localtime_r=undef
14959                 localtime_r_proto=0
14960                 ;;
14961         esac
14962         ;;
14963 *)      localtime_r_proto=0
14964         ;;
14965 esac
14966
14967 : see if localtime_r calls tzset
14968 case "$localtime_r_proto" in
14969 REENTRANT_PROTO*)
14970         $cat >try.c <<EOCP
14971 /*  Does our libc's localtime_r call tzset ?
14972  *  return 0 if so, 1 otherwise.
14973  */
14974 #$i_systypes    I_SYS_TYPES
14975 #$i_unistd      I_UNISTD
14976 #$i_time        I_TIME
14977 #$i_stdlib      I_STDLIB
14978 #$i_string      I_STRING
14979 #$i_malloc      I_MALLOC
14980 #ifdef I_SYS_TYPES
14981 #  include <sys/types.h>
14982 #endif
14983 #ifdef I_UNISTD
14984 #  include <unistd.h>
14985 #endif
14986 #ifdef I_TIME
14987 #  include <time.h>
14988 #endif
14989 #ifdef I_STDLIB
14990 #include <stdlib.h>
14991 #endif
14992 #ifdef I_STRING
14993 #  include <string.h>
14994 #else
14995 #  include <strings.h>
14996 #endif
14997 #ifdef I_MALLOC
14998 #  include <malloc.h>
14999 #endif
15000 int main()
15001 {
15002     time_t t = time(0L);
15003     char w_tz[]="TZ" "=GMT+5",
15004          e_tz[]="TZ" "=GMT-5",
15005         *tz_e = (char*)malloc(16),
15006         *tz_w = (char*)malloc(16);
15007     struct tm tm_e, tm_w;
15008     memset(&tm_e,'\0',sizeof(struct tm));
15009     memset(&tm_w,'\0',sizeof(struct tm));
15010     strcpy(tz_e,e_tz);
15011     strcpy(tz_w,w_tz);
15012
15013     putenv(tz_e);
15014     localtime_r(&t, &tm_e);
15015
15016     putenv(tz_w);
15017     localtime_r(&t, &tm_w);
15018
15019     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15020         return 1;
15021     return 0;
15022 }
15023 EOCP
15024         set try
15025         if eval $compile; then
15026             if $run ./try; then
15027                 d_localtime_r_needs_tzset=undef;
15028             else
15029                 d_localtime_r_needs_tzset=define;
15030             fi;
15031         else
15032             d_localtime_r_needs_tzset=undef;
15033         fi;
15034      ;;
15035   *)
15036      d_localtime_r_needs_tzset=undef;
15037      ;;
15038 esac
15039 $rm_try
15040
15041 : see if localeconv exists
15042 set localeconv d_locconv
15043 eval $inlibc
15044
15045 : see if lockf exists
15046 set lockf d_lockf
15047 eval $inlibc
15048
15049 : see if prototype for lseek is available
15050 echo " "
15051 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15052 eval $hasproto
15053
15054 : see if lstat exists
15055 set lstat d_lstat
15056 eval $inlibc
15057
15058 : see if madvise exists
15059 set madvise d_madvise
15060 eval $inlibc
15061
15062 : see if malloc_size exists
15063 set malloc_size d_malloc_size
15064 eval $inlibc
15065
15066 : see if malloc_size_good exists
15067 set malloc_good_size d_malloc_good_size
15068 eval $inlibc
15069
15070 : see if mblen exists
15071 set mblen d_mblen
15072 eval $inlibc
15073
15074 : see if mbstowcs exists
15075 set mbstowcs d_mbstowcs
15076 eval $inlibc
15077
15078 : see if mbtowc exists
15079 set mbtowc d_mbtowc
15080 eval $inlibc
15081
15082 : see if memchr exists
15083 set memchr d_memchr
15084 eval $inlibc
15085
15086 : see if memcmp exists
15087 set memcmp d_memcmp
15088 eval $inlibc
15089
15090 : see if memcpy exists
15091 set memcpy d_memcpy
15092 eval $inlibc
15093
15094 : see if memmove exists
15095 set memmove d_memmove
15096 eval $inlibc
15097
15098 : see if memset exists
15099 set memset d_memset
15100 eval $inlibc
15101
15102 : see if mkdir exists
15103 set mkdir d_mkdir
15104 eval $inlibc
15105
15106 : see if mkdtemp exists
15107 set mkdtemp d_mkdtemp
15108 eval $inlibc
15109
15110 : see if mkfifo exists
15111 set mkfifo d_mkfifo
15112 eval $inlibc
15113
15114 : see if mkstemp exists
15115 set mkstemp d_mkstemp
15116 eval $inlibc
15117
15118 : see if mkstemps exists
15119 set mkstemps d_mkstemps
15120 eval $inlibc
15121
15122 : see if mktime exists
15123 set mktime d_mktime
15124 eval $inlibc
15125
15126 : see if this is a sys/mman.h system
15127 set sys/mman.h i_sysmman
15128 eval $inhdr
15129
15130 : see if mmap exists
15131 set mmap d_mmap
15132 eval $inlibc
15133 : see what shmat returns
15134 : default to something harmless
15135 mmaptype='void *'
15136 case "$i_sysmman$d_mmap" in
15137 "$define$define")
15138         $cat >mmap.c <<'END'
15139 #include <sys/mman.h>
15140 void *mmap();
15141 END
15142         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15143                 mmaptype='void *'
15144         else
15145                 mmaptype='caddr_t'
15146         fi
15147         echo "and it returns ($mmaptype)." >&4
15148         ;;
15149 esac
15150
15151
15152
15153 : see if sqrtl exists
15154 set sqrtl d_sqrtl
15155 eval $inlibc
15156
15157 : see if scalbnl exists
15158 set scalbnl d_scalbnl
15159 eval $inlibc
15160
15161 : see if modfl exists
15162 set modfl d_modfl
15163 eval $inlibc
15164
15165 : see if prototype for modfl is available
15166 echo " "
15167 set d_modflproto modfl $i_math math.h
15168 eval $hasproto
15169
15170 d_modfl_pow32_bug="$undef"
15171
15172 case "$d_longdbl$d_modfl" in
15173 $define$define)
15174         $cat <<EOM
15175 Checking to see whether your modfl() is okay for large values...
15176 EOM
15177 $cat >try.c <<EOCP
15178 #include <math.h>
15179 #include <stdio.h>
15180 EOCP
15181 if $test "X$d_modflproto" != "X$define"; then
15182         $cat >>try.c <<EOCP
15183 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15184 long double modfl (long double, long double *);
15185 EOCP
15186 fi
15187 $cat >>try.c <<EOCP
15188 int main() {
15189     long double nv = 4294967303.15;
15190     long double v, w;
15191     v = modfl(nv, &w);
15192 #ifdef __GLIBC__
15193     printf("glibc");
15194 #endif
15195     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15196     return 0;
15197 }
15198 EOCP
15199         case "$osname:$gccversion" in
15200         aix:)   saveccflags="$ccflags"
15201                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15202         esac
15203         set try
15204         if eval $compile; then
15205                 foo=`$run ./try`
15206                 case "$foo" in
15207                 *" 4294967303.150000 1.150000 4294967302.000000")
15208                         echo >&4 "Your modfl() is broken for large values."
15209                         d_modfl_pow32_bug="$define"
15210                         case "$foo" in
15211                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15212                         ;;
15213                         esac
15214                         ;;
15215                 *" 4294967303.150000 0.150000 4294967303.000000")
15216                         echo >&4 "Your modfl() seems okay for large values."
15217                         ;;
15218                 *)      echo >&4 "I don't understand your modfl() at all."
15219                         d_modfl="$undef"
15220                         ;;
15221                 esac
15222                 $rm_try
15223         else
15224                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15225                 d_modfl="$undef"
15226         fi
15227         case "$osname:$gccversion" in
15228         aix:)   ccflags="$saveccflags" ;; # restore
15229         esac
15230         ;;
15231 esac
15232
15233 if $test "$uselongdouble" = "$define"; then
15234     message=""
15235     if $test "$d_sqrtl" != "$define"; then
15236         message="$message sqrtl"
15237     fi
15238     if $test "$d_modfl" != "$define"; then
15239         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15240             echo "You have both aintl and copysignl, so I can emulate modfl."
15241         else
15242             message="$message modfl"
15243         fi
15244     fi
15245     if $test "$d_frexpl" != "$define"; then
15246         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15247             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15248         else
15249             message="$message frexpl"
15250         fi
15251     fi
15252
15253     if $test "$message" != ""; then
15254         $cat <<EOM >&4
15255
15256 *** You requested the use of long doubles but you do not seem to have
15257 *** the following mathematical functions needed for long double support:
15258 ***    $message
15259 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15260 *** Cannot continue, aborting.
15261
15262 EOM
15263
15264         exit 1
15265     fi
15266 fi
15267
15268 : see if mprotect exists
15269 set mprotect d_mprotect
15270 eval $inlibc
15271
15272 : see if msgctl exists
15273 set msgctl d_msgctl
15274 eval $inlibc
15275
15276 : see if msgget exists
15277 set msgget d_msgget
15278 eval $inlibc
15279
15280 : see if msgsnd exists
15281 set msgsnd d_msgsnd
15282 eval $inlibc
15283
15284 : see if msgrcv exists
15285 set msgrcv d_msgrcv
15286 eval $inlibc
15287
15288 : see how much of the 'msg*(2)' library is present.
15289 h_msg=true
15290 echo " "
15291 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15292 *"$undef"*) h_msg=false;;
15293 esac
15294 case "$osname" in
15295 freebsd)
15296     case "`ipcs 2>&1`" in
15297     "SVID messages"*"not configured"*)
15298         echo "Your $osname does not have the msg*(2) configured." >&4
15299         h_msg=false
15300         val="$undef"
15301         set msgctl d_msgctl
15302         eval $setvar
15303         set msgget d_msgget
15304         eval $setvar
15305         set msgsnd d_msgsnd
15306         eval $setvar
15307         set msgrcv d_msgrcv
15308         eval $setvar
15309         ;;
15310     esac
15311     ;;
15312 esac
15313 : we could also check for sys/ipc.h ...
15314 if $h_msg && $test `./findhdr sys/msg.h`; then
15315         echo "You have the full msg*(2) library." >&4
15316         val="$define"
15317 else
15318         echo "You don't have the full msg*(2) library." >&4
15319         val="$undef"
15320 fi
15321 set d_msg
15322 eval $setvar
15323
15324 : Check for msghdr_s
15325 echo " "
15326 echo "Checking to see if your system supports struct msghdr..." >&4
15327 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15328 eval $hasstruct
15329 case "$d_msghdr_s" in
15330 "$define")      echo "Yes, it does."   ;;
15331 *)              echo "No, it doesn't." ;;
15332 esac
15333
15334
15335 : see if msync exists
15336 set msync d_msync
15337 eval $inlibc
15338
15339 : see if munmap exists
15340 set munmap d_munmap
15341 eval $inlibc
15342
15343 : see if nice exists
15344 set nice d_nice
15345 eval $inlibc
15346
15347 : see if this is a langinfo.h system
15348 set langinfo.h i_langinfo
15349 eval $inhdr
15350
15351 : see if nl_langinfo exists
15352 set nl_langinfo d_nl_langinfo
15353 eval $inlibc
15354
15355 : check for volatile keyword
15356 echo " "
15357 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15358 $cat >try.c <<'EOCP'
15359 int main()
15360 {
15361         typedef struct _goo_struct goo_struct;
15362         goo_struct * volatile goo = ((goo_struct *)0);
15363         struct _goo_struct {
15364                 long long_int;
15365                 int reg_int;
15366                 char char_var;
15367         };
15368         typedef unsigned short foo_t;
15369         char *volatile foo;
15370         volatile int bar;
15371         volatile foo_t blech;
15372         foo = foo;
15373 }
15374 EOCP
15375 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15376         val="$define"
15377         echo "Yup, it does."
15378 else
15379         val="$undef"
15380         echo "Nope, it doesn't."
15381 fi
15382 set d_volatile
15383 eval $setvar
15384 $rm_try
15385
15386 : Check basic sizes
15387 echo " "
15388 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15389
15390 case "$use64bitint:$d_quad:$quadtype" in
15391 define:define:?*)
15392         ivtype="$quadtype"
15393         uvtype="$uquadtype"
15394         ivsize=8
15395         uvsize=8
15396         ;;
15397 *)      ivtype="long"
15398         uvtype="unsigned long"
15399         ivsize=$longsize
15400         uvsize=$longsize
15401         ;;
15402 esac
15403
15404 case "$uselongdouble:$d_longdbl" in
15405 define:define)
15406         nvtype="long double"
15407         nvsize=$longdblsize
15408         ;;
15409 *)      nvtype=double
15410         nvsize=$doublesize
15411         ;;
15412 esac
15413
15414 $echo "(IV will be "$ivtype", $ivsize bytes)"
15415 $echo "(UV will be "$uvtype", $uvsize bytes)"
15416 $echo "(NV will be "$nvtype", $nvsize bytes)"
15417
15418 $cat >try.c <<EOCP
15419 #$i_inttypes I_INTTYPES
15420 #ifdef I_INTTYPES
15421 #include <inttypes.h>
15422 #endif
15423 #include <stdio.h>
15424 int main() {
15425 #ifdef INT8
15426    int8_t i =  INT8_MAX;
15427   uint8_t u = UINT8_MAX;
15428   printf("int8_t\n");
15429 #endif
15430 #ifdef INT16
15431    int16_t i =  INT16_MAX;
15432   uint16_t i = UINT16_MAX;
15433   printf("int16_t\n");
15434 #endif
15435 #ifdef INT32
15436    int32_t i =  INT32_MAX;
15437   uint32_t u = UINT32_MAX;
15438   printf("int32_t\n");
15439 #endif
15440 }
15441 EOCP
15442
15443 i8type="signed char"
15444 u8type="unsigned char"
15445 i8size=1
15446 u8size=1
15447
15448 case "$i16type" in
15449 '')     case "$shortsize" in
15450         2)      i16type=short
15451                 u16type="unsigned short"
15452                 i16size=$shortsize
15453                 u16size=$shortsize
15454                 ;;
15455         esac
15456         ;;
15457 esac
15458 case "$i16type" in
15459 '')     set try -DINT16
15460         if eval $compile; then
15461                 case "`$run ./try`" in
15462                 int16_t)
15463                         i16type=int16_t
15464                         u16type=uint16_t
15465                         i16size=2
15466                         u16size=2
15467                         ;;
15468                 esac
15469         fi
15470         ;;
15471 esac
15472 case "$i16type" in
15473 '')     if $test $shortsize -ge 2; then
15474                 i16type=short
15475                 u16type="unsigned short"
15476                 i16size=$shortsize
15477                 u16size=$shortsize
15478         fi
15479         ;;
15480 esac
15481
15482 case "$i32type" in
15483 '')     case "$longsize" in
15484         4)      i32type=long
15485                 u32type="unsigned long"
15486                 i32size=$longsize
15487                 u32size=$longsize
15488                 ;;
15489         *)      case "$intsize" in
15490                 4)      i32type=int
15491                         u32type="unsigned int"
15492                         i32size=$intsize
15493                         u32size=$intsize
15494                         ;;
15495                 esac
15496                 ;;
15497         esac
15498         ;;
15499 esac
15500 case "$i32type" in
15501 '')     set try -DINT32
15502         if eval $compile; then
15503                 case "`$run ./try`" in
15504                 int32_t)
15505                         i32type=int32_t
15506                         u32type=uint32_t
15507                         i32size=4
15508                         u32size=4
15509                         ;;
15510                 esac
15511         fi
15512         ;;
15513 esac
15514 case "$i32type" in
15515 '')     if $test $intsize -ge 4; then
15516                 i32type=int
15517                 u32type="unsigned int"
15518                 i32size=$intsize
15519                 u32size=$intsize
15520         fi
15521         ;;
15522 esac
15523
15524 case "$i64type" in
15525 '')     case "$d_quad:$quadtype" in
15526         define:?*)
15527                 i64type="$quadtype"
15528                 u64type="$uquadtype"
15529                 i64size=8
15530                 u64size=8
15531                 ;;
15532         esac
15533         ;;
15534 esac
15535
15536 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15537 : volatile so that the compiler has to store it out to memory.
15538 if test X"$d_volatile" = X"$define"; then
15539         volatile=volatile
15540 fi
15541 $cat <<EOP >try.c
15542 #include <stdio.h>
15543 #$i_stdlib I_STDLIB
15544 #ifdef I_STDLIB
15545 #include <stdlib.h>
15546 #endif
15547 #include <sys/types.h>
15548 #include <signal.h>
15549 #ifdef SIGFPE
15550 $volatile int bletched = 0;
15551 $signal_t blech(int s) { bletched = 1; }
15552 #endif
15553 int main() {
15554     $uvtype u = 0;
15555     $nvtype d;
15556     int     n = 8 * $uvsize;
15557     int     i;
15558 #ifdef SIGFPE
15559     signal(SIGFPE, blech);
15560 #endif
15561
15562     for (i = 0; i < n; i++) {
15563       u = u << 1 | ($uvtype)1;
15564       d = ($nvtype)u;
15565       if (($uvtype)d != u)
15566         break;
15567       if (d <= 0)
15568         break;
15569       d = ($nvtype)(u - 1);
15570       if (($uvtype)d != (u - 1))
15571         break;
15572 #ifdef SIGFPE
15573       if (bletched)
15574         break;
15575 #endif
15576     }
15577     printf("%d\n", ((i == n) ? -n : i));
15578     exit(0);
15579 }
15580 EOP
15581 set try
15582
15583 d_nv_preserves_uv="$undef"
15584 if eval $compile; then
15585         nv_preserves_uv_bits="`$run ./try`"
15586 fi
15587 case "$nv_preserves_uv_bits" in
15588 \-[1-9]*)
15589         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15590         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15591         d_nv_preserves_uv="$define"
15592         ;;
15593 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15594         d_nv_preserves_uv="$undef" ;;
15595 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15596         nv_preserves_uv_bits="0" ;;
15597 esac
15598 $rm_try
15599
15600 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15601 : volatile so that the compiler has to store it out to memory.
15602 if test X"$d_volatile" = X"$define"; then
15603         volatile=volatile
15604 fi
15605 $cat <<EOP >try.c
15606 #include <stdio.h>
15607
15608 typedef $nvtype NV;
15609
15610 int
15611 main() {
15612   NV value = 2;
15613   int count = 1;
15614
15615   while(count < 256) {
15616     $volatile NV up = value + 1.0;
15617     $volatile NV negated = -value;
15618     $volatile NV down = negated - 1.0;
15619     $volatile NV got_up = up - value;
15620     int up_good = got_up == 1.0;
15621     int got_down = down - negated;
15622     int down_good = got_down == -1.0;
15623
15624     if (down_good != up_good) {
15625       fprintf(stderr,
15626               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15627               up_good, (double) got_up, down_good, (double) got_down,
15628               count, (double) value);
15629       return 1;
15630     }
15631     if (!up_good) {
15632       while (1) {
15633         if (count > 8) {
15634           count -= 8;
15635           fputs("256.0", stdout);
15636         } else {
15637           count--;
15638           fputs("2.0", stdout);
15639         }
15640         if (!count) {
15641           puts("");
15642           return 0;
15643         }
15644         fputs("*", stdout);
15645       }
15646     }
15647     value *= 2;
15648     ++count;
15649   }
15650   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15651           count, (double) value);
15652   return 1;
15653 }
15654 EOP
15655 set try
15656
15657 nv_overflows_integers_at='0'
15658 if eval $compile; then
15659     xxx="`$run ./try`"
15660     case "$?" in
15661         0)
15662             case "$xxx" in
15663                 2*)  cat >&4 <<EOM
15664 The largest integer your NVs can preserve is equal to $xxx
15665 EOM
15666                     nv_overflows_integers_at="$xxx"
15667                     ;;
15668                 *)  cat >&4 <<EOM
15669 Cannot determine the largest integer value your NVs can hold, unexpected output
15670 '$xxx'
15671 EOM
15672                     ;;
15673             esac
15674             ;;
15675         *)  cat >&4 <<EOM
15676 Cannot determine the largest integer value your NVs can hold
15677 EOM
15678             ;;
15679     esac
15680 fi
15681 $rm_try
15682
15683 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15684 : volatile so that the compiler has to store it out to memory.
15685 if test X"$d_volatile" = X"$define"; then
15686         volatile=volatile
15687 fi
15688 $cat <<EOP >try.c
15689 #include <stdio.h>
15690 #$i_stdlib I_STDLIB
15691 #ifdef I_STDLIB
15692 #include <stdlib.h>
15693 #endif
15694 #$i_string I_STRING
15695 #ifdef I_STRING
15696 #  include <string.h>
15697 #else
15698 #  include <strings.h>
15699 #endif
15700 #include <sys/types.h>
15701 #include <signal.h>
15702 #ifdef SIGFPE
15703 $volatile int bletched = 0;
15704 $signal_t blech(int s) { bletched = 1; }
15705 #endif
15706
15707 int checkit($nvtype d, char *where) {
15708     unsigned char *p = (char *)&d;
15709     unsigned char *end = p + sizeof(d);
15710     int fail = 0;
15711
15712     while (p < end)
15713         fail += *p++;
15714
15715     if (!fail)
15716         return 0;
15717
15718     p = (char *)&d;
15719     printf("No - %s: 0x", where);
15720     while (p < end)
15721         printf ("%02X", *p++);
15722     printf("\n");
15723     return 1;
15724 }
15725
15726 int main(int argc, char **argv) {
15727     $nvtype d = 0.0;
15728     int fail = 0;
15729     fail += checkit(d, "0.0");
15730
15731     /* The compiler shouldn't be assuming that bletched is 0  */
15732     d = bletched;
15733
15734     fail += checkit(d, "bleched");
15735
15736 #ifdef SIGFPE
15737     signal(SIGFPE, blech);
15738 #endif
15739
15740     /* Paranoia - the compiler should have no way of knowing that ANSI says
15741        that argv[argc] will always be NULL.  Actually, if it did assume this it
15742        would be buggy, as this is C and main() can be called from elsewhere in
15743        the program.  */
15744     d = argv[argc] ? 1 : 0;
15745
15746     if (d) {
15747         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15748     }
15749
15750     fail += checkit(d, "ternary");
15751
15752     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15753
15754     if (d != 0.0) {
15755         printf("No - memset doesn't give 0.0\n");
15756         /* This might just blow up:  */
15757         printf("(gives %g)\n", d);
15758         return 1;
15759     }
15760
15761 #ifdef SIGFPE
15762     if (bletched) {
15763         printf("No - something bleched\n");
15764         return 1;
15765     }
15766 #endif
15767     if (fail) {
15768       printf("No - %d fail(s)\n", fail);
15769       return 1;
15770     }
15771     printf("Yes\n");
15772     return 0;
15773 }
15774 EOP
15775 set try
15776
15777 d_nv_zero_is_allbits_zero="$undef"
15778 if eval $compile; then
15779     xxx="`$run ./try`"
15780     case "$?" in
15781         0)
15782             case "$xxx" in
15783                 Yes)  cat >&4 <<EOM
15784 0.0 is represented as all bits zero in memory
15785 EOM
15786                     d_nv_zero_is_allbits_zero="$define"
15787                     ;;
15788                 *)  cat >&4 <<EOM
15789 0.0 is not represented as all bits zero in memory
15790 EOM
15791                     d_nv_zero_is_allbits_zero="$undef"
15792                     ;;
15793             esac
15794             ;;
15795         *)  cat >&4 <<EOM
15796 0.0 is not represented as all bits zero in memory
15797 EOM
15798             d_nv_zero_is_allbits_zero="$undef"
15799             ;;
15800     esac
15801 fi
15802 $rm_try
15803
15804 : check for off64_t
15805 echo " "
15806 echo "Checking to see if you have off64_t..." >&4
15807 $cat >try.c <<EOCP
15808 #include <sys/types.h>
15809 #include <unistd.h>
15810 int main() { off64_t x = 7; }
15811 EOCP
15812 set try
15813 if eval $compile; then
15814         val="$define"
15815         echo "You have off64_t."
15816 else
15817         val="$undef"
15818         echo "You do not have off64_t."
15819         case "$lseeksize" in
15820         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15821         esac
15822 fi
15823 $rm_try
15824 set d_off64_t
15825 eval $setvar
15826
15827 : how to create joinable pthreads
15828 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15829         echo " "
15830         echo "Checking what constant to use for creating joinable pthreads..." >&4
15831         $cat >try.c <<'EOCP'
15832 #include <pthread.h>
15833 int main() {
15834     int detachstate = JOINABLE;
15835 }
15836 EOCP
15837         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15838         if eval $compile; then
15839                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15840                 val="$undef" # Yes, undef.
15841                 set d_old_pthread_create_joinable
15842                 eval $setvar
15843                 val=""
15844                 set old_pthread_create_joinable
15845                 eval $setvar
15846         else
15847                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15848                 if eval $compile; then
15849                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15850                         val="$define"
15851                         set d_old_pthread_create_joinable
15852                         eval $setvar
15853                         val=PTHREAD_CREATE_UNDETACHED
15854                         set old_pthread_create_joinable
15855                         eval $setvar
15856                 else
15857                         set try -DJOINABLE=__UNDETACHED
15858                         if eval $compile; then
15859                                 echo "You seem to use __UNDETACHED." >&4
15860                                 val="$define"
15861                                 set d_old_pthread_create_joinable
15862                                 eval $setvar
15863                                 val=__UNDETACHED
15864                                 set old_pthread_create_joinable
15865                                 eval $setvar
15866                         else
15867                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15868                                 val="$define"
15869                                 set d_old_pthread_create_joinable
15870                                 eval $setvar
15871                                 val=0
15872                                 set old_pthread_create_joinable
15873                                 eval $setvar
15874                         fi
15875                 fi
15876         fi
15877         $rm_try
15878 else
15879     d_old_pthread_create_joinable="$undef"
15880     old_pthread_create_joinable=""
15881 fi
15882
15883 : see if pause exists
15884 set pause d_pause
15885 eval $inlibc
15886
15887 : see if poll exists
15888 set poll d_poll
15889 eval $inlibc
15890
15891 : see if readlink exists
15892 set readlink d_readlink
15893 eval $inlibc
15894
15895 : Check if exe is symlink to abs path of executing program
15896 echo " "
15897 procselfexe=''
15898 val="$undef"
15899 case "$d_readlink" in
15900 "$define")
15901         if $issymlink /proc/self/exe ; then
15902                 $ls -l /proc/self/exe > reflect
15903                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15904                         echo "You have Linux-like /proc/self/exe."
15905                         procselfexe='"/proc/self/exe"'
15906                         val="$define"
15907                 fi
15908         fi
15909         if $issymlink /proc/curproc/file ; then
15910                 $ls -l /proc/curproc/file > reflect
15911                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15912                         echo "You have BSD-like /proc/curproc/file."
15913                         procselfexe='"/proc/curproc/file"'
15914                         val="$define"
15915                 fi
15916         fi
15917         ;;
15918 esac
15919 $rm -f reflect
15920 set d_procselfexe
15921 eval $setvar
15922
15923 : backward compatibility for d_hvfork
15924 if test X$d_hvfork != X; then
15925         d_vfork="$d_hvfork"
15926         d_hvfork=''
15927 fi
15928 : see if there is a vfork
15929 val=''
15930 set vfork val
15931 eval $inlibc
15932
15933 d_pseudofork=$undef
15934
15935 : Ok, but do we want to use it. vfork is reportedly unreliable in
15936 : perl on Solaris 2.x, and probably elsewhere.
15937 case "$val" in
15938 $define)
15939         echo " "
15940         case "$usevfork" in
15941         false) dflt='n';;
15942         *) dflt='y';;
15943         esac
15944         cat <<'EOM'
15945
15946 Perl can only use a vfork() that doesn't suffer from strict
15947 restrictions on calling functions or modifying global data in
15948 the child.  For example, glibc-2.1 contains such a vfork()
15949 that is unsuitable.  If your system provides a proper fork()
15950 call, chances are that you do NOT want perl to use vfork().
15951
15952 EOM
15953         rp="Do you still want to use vfork()?"
15954         . ./myread
15955         case "$ans" in
15956         y|Y) ;;
15957         *)
15958                 echo "Ok, we won't use vfork()."
15959                 val="$undef"
15960                 ;;
15961         esac
15962         ;;
15963 esac
15964 set d_vfork
15965 eval $setvar
15966 case "$d_vfork" in
15967 $define) usevfork='true';;
15968 *) usevfork='false';;
15969 esac
15970
15971 : see whether the pthread_atfork exists
15972 $cat >try.c <<EOP
15973 #include <pthread.h>
15974 #include <stdio.h>
15975 int main() {
15976 #ifdef  PTHREAD_ATFORK
15977         pthread_atfork(NULL,NULL,NULL);
15978 #endif
15979 }
15980 EOP
15981
15982 : see if pthread_atfork exists
15983 set try -DPTHREAD_ATFORK
15984 if eval $compile; then
15985     val="$define"
15986 else
15987     val="$undef"
15988 fi
15989 case "$usethreads" in
15990 $define)
15991         case "$val" in
15992         $define) echo 'pthread_atfork found.' >&4        ;;
15993         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15994         esac
15995 esac
15996 set d_pthread_atfork
15997 eval $setvar
15998
15999 : see if pthread_attr_setscope exists
16000 set pthread_attr_setscope d_pthread_attr_setscope
16001 eval $inlibc
16002
16003 : see whether the various POSIXish _yields exist
16004 $cat >try.c <<EOP
16005 #include <pthread.h>
16006 #include <stdio.h>
16007 int main() {
16008 #ifdef SCHED_YIELD
16009         sched_yield();
16010 #else
16011 #ifdef PTHREAD_YIELD
16012         pthread_yield();
16013 #else
16014 #ifdef PTHREAD_YIELD_NULL
16015         pthread_yield(NULL);
16016 #endif
16017 #endif
16018 #endif
16019 }
16020 EOP
16021 : see if sched_yield exists
16022 set try -DSCHED_YIELD
16023 if eval $compile; then
16024     val="$define"
16025     sched_yield='sched_yield()'
16026 else
16027     val="$undef"
16028 fi
16029 case "$usethreads" in
16030 $define)
16031         case "$val" in
16032         $define) echo 'sched_yield() found.' >&4        ;;
16033         *)       echo 'sched_yield() NOT found.' >&4    ;;
16034         esac
16035 esac
16036 set d_sched_yield
16037 eval $setvar
16038
16039 : see if pthread_yield exists
16040 set try -DPTHREAD_YIELD
16041 if eval $compile; then
16042     val="$define"
16043     case "$sched_yield" in
16044     '') sched_yield='pthread_yield()' ;;
16045     esac
16046 else
16047     set try -DPTHREAD_YIELD_NULL
16048     if eval $compile; then
16049         val="$define"
16050         case "$sched_yield" in
16051         '') sched_yield='pthread_yield(NULL)' ;;
16052         esac
16053     else
16054         val="$undef"
16055     fi
16056 fi
16057 case "$usethreads" in
16058 $define)
16059         case "$val" in
16060         $define) echo 'pthread_yield() found.' >&4      ;;
16061         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16062         esac
16063         ;;
16064 esac
16065 set d_pthread_yield
16066 eval $setvar
16067 case "$sched_yield" in
16068 '') sched_yield=undef ;;
16069 esac
16070 $rm_try
16071
16072 : see if random_r exists
16073 set random_r d_random_r
16074 eval $inlibc
16075 case "$d_random_r" in
16076 "$define")
16077         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16078         case "$d_random_r_proto:$usethreads" in
16079         ":define")      d_random_r_proto=define
16080                 set d_random_r_proto random_r $hdrs
16081                 eval $hasproto ;;
16082         *)      ;;
16083         esac
16084         case "$d_random_r_proto" in
16085         define)
16086         case "$random_r_proto" in
16087         ''|0) try='int random_r(int*, struct random_data*);'
16088         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16089         esac
16090         case "$random_r_proto" in
16091         ''|0) try='int random_r(long*, struct random_data*);'
16092         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16093         esac
16094         case "$random_r_proto" in
16095         ''|0) try='int random_r(struct random_data*, int32_t*);'
16096         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16097         esac
16098         case "$random_r_proto" in
16099         ''|0)   d_random_r=undef
16100                 random_r_proto=0
16101                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16102         * )     case "$random_r_proto" in
16103                 REENTRANT_PROTO*) ;;
16104                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16105                 esac
16106                 echo "Prototype: $try" ;;
16107         esac
16108         ;;
16109         *)      case "$usethreads" in
16110                 define) echo "random_r has no prototype, not using it." >&4 ;;
16111                 esac
16112                 d_random_r=undef
16113                 random_r_proto=0
16114                 ;;
16115         esac
16116         ;;
16117 *)      random_r_proto=0
16118         ;;
16119 esac
16120
16121 : see if readdir and friends exist
16122 set readdir d_readdir
16123 eval $inlibc
16124 set seekdir d_seekdir
16125 eval $inlibc
16126 set telldir d_telldir
16127 eval $inlibc
16128 set rewinddir d_rewinddir
16129 eval $inlibc
16130
16131 : see if readdir64_r exists
16132 set readdir64_r d_readdir64_r
16133 eval $inlibc
16134 case "$d_readdir64_r" in
16135 "$define")
16136         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16137         case "$d_readdir64_r_proto:$usethreads" in
16138         ":define")      d_readdir64_r_proto=define
16139                 set d_readdir64_r_proto readdir64_r $hdrs
16140                 eval $hasproto ;;
16141         *)      ;;
16142         esac
16143         case "$d_readdir64_r_proto" in
16144         define)
16145         case "$readdir64_r_proto" in
16146         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16147         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16148         esac
16149         case "$readdir64_r_proto" in
16150         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16151         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16152         esac
16153         case "$readdir64_r_proto" in
16154         ''|0)   d_readdir64_r=undef
16155                 readdir64_r_proto=0
16156                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16157         * )     case "$readdir64_r_proto" in
16158                 REENTRANT_PROTO*) ;;
16159                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16160                 esac
16161                 echo "Prototype: $try" ;;
16162         esac
16163         ;;
16164         *)      case "$usethreads" in
16165                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16166                 esac
16167                 d_readdir64_r=undef
16168                 readdir64_r_proto=0
16169                 ;;
16170         esac
16171         ;;
16172 *)      readdir64_r_proto=0
16173         ;;
16174 esac
16175
16176 : see if readdir_r exists
16177 set readdir_r d_readdir_r
16178 eval $inlibc
16179 case "$d_readdir_r" in
16180 "$define")
16181         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16182         case "$d_readdir_r_proto:$usethreads" in
16183         ":define")      d_readdir_r_proto=define
16184                 set d_readdir_r_proto readdir_r $hdrs
16185                 eval $hasproto ;;
16186         *)      ;;
16187         esac
16188         case "$d_readdir_r_proto" in
16189         define)
16190         case "$readdir_r_proto" in
16191         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16192         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16193         esac
16194         case "$readdir_r_proto" in
16195         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16196         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16197         esac
16198         case "$readdir_r_proto" in
16199         ''|0)   d_readdir_r=undef
16200                 readdir_r_proto=0
16201                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16202         * )     case "$readdir_r_proto" in
16203                 REENTRANT_PROTO*) ;;
16204                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16205                 esac
16206                 echo "Prototype: $try" ;;
16207         esac
16208         ;;
16209         *)      case "$usethreads" in
16210                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16211                 esac
16212                 d_readdir_r=undef
16213                 readdir_r_proto=0
16214                 ;;
16215         esac
16216         ;;
16217 *)      readdir_r_proto=0
16218         ;;
16219 esac
16220
16221 : see if readv exists
16222 set readv d_readv
16223 eval $inlibc
16224
16225 : see if recvmsg exists
16226 set recvmsg d_recvmsg
16227 eval $inlibc
16228
16229 : see if rename exists
16230 set rename d_rename
16231 eval $inlibc
16232
16233 : see if rmdir exists
16234 set rmdir d_rmdir
16235 eval $inlibc
16236
16237 : see if memory.h is available.
16238 val=''
16239 set memory.h val
16240 eval $inhdr
16241
16242 : See if it conflicts with string.h
16243 case "$val" in
16244 $define)
16245         case "$strings" in
16246         '') ;;
16247         *)
16248                 $cppstdin $cppflags $cppminus < $strings > mem.h
16249                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16250                         echo " "
16251                         echo "We won't be including <memory.h>."
16252                         val="$undef"
16253                 fi
16254                 $rm -f mem.h
16255                 ;;
16256         esac
16257 esac
16258 set i_memory
16259 eval $setvar
16260
16261 : can bcopy handle overlapping blocks?
16262 echo " "
16263 val="$undef"
16264 case "$d_memmove" in
16265 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16266 *)      case "$d_bcopy" in
16267         "$define")
16268                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16269                 $cat >try.c <<EOCP
16270 #$i_memory I_MEMORY
16271 #$i_stdlib I_STDLIB
16272 #$i_string I_STRING
16273 #$i_unistd I_UNISTD
16274 EOCP
16275         $cat >>try.c <<'EOCP'
16276 #include <stdio.h>
16277 #ifdef I_MEMORY
16278 #  include <memory.h>
16279 #endif
16280 #ifdef I_STDLIB
16281 #  include <stdlib.h>
16282 #endif
16283 #ifdef I_STRING
16284 #  include <string.h>
16285 #else
16286 #  include <strings.h>
16287 #endif
16288 #ifdef I_UNISTD
16289 #  include <unistd.h>  /* Needed for NetBSD */
16290 #endif
16291 int main()
16292 {
16293 char buf[128], abc[128];
16294 char *b;
16295 int len;
16296 int off;
16297 int align;
16298
16299 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16300    try to store the string in read-only memory. */
16301 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16302
16303 for (align = 7; align >= 0; align--) {
16304         for (len = 36; len; len--) {
16305                 b = buf+align;
16306                 bcopy(abc, b, len);
16307                 for (off = 1; off <= len; off++) {
16308                         bcopy(b, b+off, len);
16309                         bcopy(b+off, b, len);
16310                         if (bcmp(b, abc, len))
16311                                 exit(1);
16312                 }
16313         }
16314 }
16315 exit(0);
16316 }
16317 EOCP
16318                 set try
16319                 if eval $compile_ok; then
16320                         if $run ./try 2>/dev/null; then
16321                                 echo "Yes, it can."
16322                                 val="$define"
16323                         else
16324                                 echo "It can't, sorry."
16325                         fi
16326                 else
16327                         echo "(I can't compile the test program, so we'll assume not...)"
16328                 fi
16329                 ;;
16330         esac
16331         $rm_try
16332         ;;
16333 esac
16334 set d_safebcpy
16335 eval $setvar
16336
16337 : can memcpy handle overlapping blocks?
16338 echo " "
16339 val="$undef"
16340 case "$d_memmove" in
16341 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16342 *)      case "$d_memcpy" in
16343         "$define")
16344                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16345                 $cat >try.c <<EOCP
16346 #$i_memory I_MEMORY
16347 #$i_stdlib I_STDLIB
16348 #$i_string I_STRING
16349 #$i_unistd I_UNISTD
16350 EOCP
16351         $cat >>try.c <<'EOCP'
16352 #include <stdio.h>
16353 #ifdef I_MEMORY
16354 #  include <memory.h>
16355 #endif
16356 #ifdef I_STDLIB
16357 #  include <stdlib.h>
16358 #endif
16359 #ifdef I_STRING
16360 #  include <string.h>
16361 #else
16362 #  include <strings.h>
16363 #endif
16364 #ifdef I_UNISTD
16365 #  include <unistd.h>  /* Needed for NetBSD */
16366 #endif
16367 int main()
16368 {
16369 char buf[128], abc[128];
16370 char *b;
16371 int len;
16372 int off;
16373 int align;
16374
16375 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16376    try to store the string in read-only memory. */
16377 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16378
16379 for (align = 7; align >= 0; align--) {
16380         for (len = 36; len; len--) {
16381                 b = buf+align;
16382                 memcpy(b, abc, len);
16383                 for (off = 1; off <= len; off++) {
16384                         memcpy(b+off, b, len);
16385                         memcpy(b, b+off, len);
16386                         if (memcmp(b, abc, len))
16387                                 exit(1);
16388                 }
16389         }
16390 }
16391 exit(0);
16392 }
16393 EOCP
16394                 set try
16395                 if eval $compile_ok; then
16396                         if $run ./try 2>/dev/null; then
16397                                 echo "Yes, it can."
16398                                 val="$define"
16399                         else
16400                                 echo "It can't, sorry."
16401                         fi
16402                 else
16403                         echo "(I can't compile the test program, so we'll assume not...)"
16404                 fi
16405                 ;;
16406         esac
16407         $rm_try
16408         ;;
16409 esac
16410 set d_safemcpy
16411 eval $setvar
16412
16413 : can memcmp be trusted to compare relative magnitude?
16414 val="$undef"
16415 case "$d_memcmp" in
16416 "$define")
16417         echo " "
16418         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16419         $cat >try.c <<EOCP
16420 #$i_memory I_MEMORY
16421 #$i_stdlib I_STDLIB
16422 #$i_string I_STRING
16423 #$i_unistd I_UNISTD
16424 EOCP
16425         $cat >>try.c <<'EOCP'
16426 #include <stdio.h>
16427 #ifdef I_MEMORY
16428 #  include <memory.h>
16429 #endif
16430 #ifdef I_STDLIB
16431 #  include <stdlib.h>
16432 #endif
16433 #ifdef I_STRING
16434 #  include <string.h>
16435 #else
16436 #  include <strings.h>
16437 #endif
16438 #ifdef I_UNISTD
16439 #  include <unistd.h>  /* Needed for NetBSD */
16440 #endif
16441 int main()
16442 {
16443 char a = -1;
16444 char b = 0;
16445 if ((a < b) && memcmp(&a, &b, 1) < 0)
16446         exit(1);
16447 exit(0);
16448 }
16449 EOCP
16450         set try
16451         if eval $compile_ok; then
16452                 if $run ./try 2>/dev/null; then
16453                         echo "Yes, it can."
16454                         val="$define"
16455                 else
16456                         echo "No, it can't (it uses signed chars)."
16457                 fi
16458         else
16459                 echo "(I can't compile the test program, so we'll assume not...)"
16460         fi
16461         ;;
16462 esac
16463 $rm_try
16464 set d_sanemcmp
16465 eval $setvar
16466
16467 : see if prototype for sbrk is available
16468 echo " "
16469 set d_sbrkproto sbrk $i_unistd unistd.h
16470 eval $hasproto
16471
16472 : see if select exists
16473 set select d_select
16474 eval $inlibc
16475
16476 : see if semctl exists
16477 set semctl d_semctl
16478 eval $inlibc
16479
16480 : see if semget exists
16481 set semget d_semget
16482 eval $inlibc
16483
16484 : see if semop exists
16485 set semop d_semop
16486 eval $inlibc
16487
16488 : see how much of the 'sem*(2)' library is present.
16489 h_sem=true
16490 echo " "
16491 case "$d_semctl$d_semget$d_semop" in
16492 *"$undef"*) h_sem=false;;
16493 esac
16494 case "$osname" in
16495 freebsd)
16496     case "`ipcs 2>&1`" in
16497     "SVID messages"*"not configured"*)
16498         echo "Your $osname does not have the sem*(2) configured." >&4
16499         h_sem=false
16500         val="$undef"
16501         set semctl d_semctl
16502         eval $setvar
16503         set semget d_semget
16504         eval $setvar
16505         set semop d_semop
16506         eval $setvar
16507         ;;
16508     esac
16509     ;;
16510 esac
16511 : we could also check for sys/ipc.h ...
16512 if $h_sem && $test `./findhdr sys/sem.h`; then
16513         echo "You have the full sem*(2) library." >&4
16514         val="$define"
16515 else
16516         echo "You don't have the full sem*(2) library." >&4
16517         val="$undef"
16518 fi
16519 set d_sem
16520 eval $setvar
16521
16522 : see whether sys/sem.h defines union semun
16523 echo " "
16524 $cat > try.c <<'END'
16525 #include <sys/types.h>
16526 #include <sys/ipc.h>
16527 #include <sys/sem.h>
16528 int main () { union semun semun; semun.buf = 0; }
16529 END
16530 set try
16531 if eval $compile; then
16532     echo "You have union semun in <sys/sem.h>." >&4
16533     val="$define"
16534 else
16535     echo "You do not have union semun in <sys/sem.h>." >&4
16536     val="$undef"
16537 fi
16538 $rm_try
16539 set d_union_semun
16540 eval $setvar
16541
16542 : see how to do semctl IPC_STAT
16543 case "$d_sem" in
16544 $define)
16545     echo " "
16546     $cat > tryh.h <<END
16547 #ifndef S_IRUSR
16548 #   ifdef S_IREAD
16549 #       define S_IRUSR S_IREAD
16550 #       define S_IWUSR S_IWRITE
16551 #       define S_IXUSR S_IEXEC
16552 #   else
16553 #       define S_IRUSR 0400
16554 #       define S_IWUSR 0200
16555 #       define S_IXUSR 0100
16556 #   endif
16557 #   define S_IRGRP (S_IRUSR>>3)
16558 #   define S_IWGRP (S_IWUSR>>3)
16559 #   define S_IXGRP (S_IXUSR>>3)
16560 #   define S_IROTH (S_IRUSR>>6)
16561 #   define S_IWOTH (S_IWUSR>>6)
16562 #   define S_IXOTH (S_IXUSR>>6)
16563 #endif
16564 #ifndef S_IRWXU
16565 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16566 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16567 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16568 #endif
16569 END
16570     : see whether semctl IPC_STAT can use union semun
16571     case "$d_semctl_semun" in
16572     '')
16573       val="$undef"
16574       $cat > try.c <<END
16575 #include <sys/types.h>
16576 #include <sys/ipc.h>
16577 #include <sys/sem.h>
16578 #include <sys/stat.h>
16579 #include <stdio.h>
16580 #include <errno.h>
16581 #include "tryh.h"
16582 #ifndef errno
16583 extern int errno;
16584 #endif
16585 #$d_union_semun HAS_UNION_SEMUN
16586 int main() {
16587     union semun
16588 #ifndef HAS_UNION_SEMUN
16589     {
16590         int val;
16591         struct semid_ds *buf;
16592         unsigned short *array;
16593     }
16594 #endif
16595     arg;
16596     int sem, st;
16597
16598 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16599     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16600     if (sem > -1) {
16601         struct semid_ds argbuf;
16602         arg.buf = &argbuf;
16603 #       ifdef IPC_STAT
16604         st = semctl(sem, 0, IPC_STAT, arg);
16605         if (st == 0)
16606             printf("semun\n");
16607         else
16608 #       endif /* IPC_STAT */
16609             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16610 #       ifdef IPC_RMID
16611         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16612 #       endif /* IPC_RMID */
16613             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16614     } else
16615 #endif /* IPC_PRIVATE && ... */
16616         printf("semget failed: errno = %d\n", errno);
16617   return 0;
16618 }
16619 END
16620       set try
16621       if eval $compile; then
16622           xxx=`$run ./try`
16623           case "$xxx" in
16624           semun) val="$define" ;;
16625           esac
16626       fi
16627       $rm_try
16628       set d_semctl_semun
16629       eval $setvar
16630       ;;
16631     esac
16632     case "$d_semctl_semun" in
16633     $define)
16634         echo "You can use union semun for semctl IPC_STAT." >&4
16635         also='also'
16636         ;;
16637     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16638         also=''
16639         ;;
16640     esac
16641
16642     : see whether semctl IPC_STAT can use struct semid_ds pointer
16643     case "$d_semctl_semid_ds" in
16644     '')
16645       val="$undef"
16646       $cat > try.c <<'END'
16647 #include <sys/types.h>
16648 #include <sys/ipc.h>
16649 #include <sys/sem.h>
16650 #include <sys/stat.h>
16651 #include "tryh.h"
16652 #include <stdio.h>
16653 #include <errno.h>
16654 #ifndef errno
16655 extern int errno;
16656 #endif
16657 int main() {
16658     struct semid_ds arg;
16659     int sem, st;
16660
16661 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16662     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16663     if (sem > -1) {
16664 #       ifdef IPC_STAT
16665         st = semctl(sem, 0, IPC_STAT, &arg);
16666         if (st == 0)
16667             printf("semid_ds\n");
16668         else
16669 #       endif /* IPC_STAT */
16670             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16671 #       ifdef IPC_RMID
16672         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16673 #       endif /* IPC_RMID */
16674             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16675     } else
16676 #endif /* IPC_PRIVATE && ... */
16677         printf("semget failed: errno = %d\n", errno);
16678
16679     return 0;
16680 }
16681 END
16682       set try
16683       if eval $compile; then
16684           xxx=`$run ./try`
16685           case "$xxx" in
16686           semid_ds) val="$define" ;;
16687           esac
16688       fi
16689       $rm_try
16690       set d_semctl_semid_ds
16691       eval $setvar
16692       ;;
16693     esac
16694     case "$d_semctl_semid_ds" in
16695     $define)
16696         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16697         ;;
16698     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16699         ;;
16700     esac
16701     ;;
16702 *)  val="$undef"
16703
16704     # We do not have the full sem*(2) library, so assume we can not
16705     # use either.
16706
16707     set d_semctl_semun
16708     eval $setvar
16709
16710     set d_semctl_semid_ds
16711     eval $setvar
16712     ;;
16713 esac
16714 $rm_try tryh.h
16715
16716 : see if sendmsg exists
16717 set sendmsg d_sendmsg
16718 eval $inlibc
16719
16720 : see if setegid exists
16721 set setegid d_setegid
16722 eval $inlibc
16723
16724 : see if seteuid exists
16725 set seteuid d_seteuid
16726 eval $inlibc
16727
16728 : see if setgrent exists
16729 set setgrent d_setgrent
16730 eval $inlibc
16731
16732 : see if setgrent_r exists
16733 set setgrent_r d_setgrent_r
16734 eval $inlibc
16735 case "$d_setgrent_r" in
16736 "$define")
16737         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16738         case "$d_setgrent_r_proto:$usethreads" in
16739         ":define")      d_setgrent_r_proto=define
16740                 set d_setgrent_r_proto setgrent_r $hdrs
16741                 eval $hasproto ;;
16742         *)      ;;
16743         esac
16744         case "$d_setgrent_r_proto" in
16745         define)
16746         case "$setgrent_r_proto" in
16747         ''|0) try='int setgrent_r(FILE**);'
16748         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16749         esac
16750         case "$setgrent_r_proto" in
16751         ''|0) try='void setgrent_r(FILE**);'
16752         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16753         esac
16754         case "$setgrent_r_proto" in
16755         ''|0)   d_setgrent_r=undef
16756                 setgrent_r_proto=0
16757                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16758         * )     case "$setgrent_r_proto" in
16759                 REENTRANT_PROTO*) ;;
16760                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16761                 esac
16762                 echo "Prototype: $try" ;;
16763         esac
16764         ;;
16765         *)      case "$usethreads" in
16766                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16767                 esac
16768                 d_setgrent_r=undef
16769                 setgrent_r_proto=0
16770                 ;;
16771         esac
16772         ;;
16773 *)      setgrent_r_proto=0
16774         ;;
16775 esac
16776
16777 : see if sethostent exists
16778 set sethostent d_sethent
16779 eval $inlibc
16780
16781 : see if sethostent_r exists
16782 set sethostent_r d_sethostent_r
16783 eval $inlibc
16784 case "$d_sethostent_r" in
16785 "$define")
16786         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16787         case "$d_sethostent_r_proto:$usethreads" in
16788         ":define")      d_sethostent_r_proto=define
16789                 set d_sethostent_r_proto sethostent_r $hdrs
16790                 eval $hasproto ;;
16791         *)      ;;
16792         esac
16793         case "$d_sethostent_r_proto" in
16794         define)
16795         case "$sethostent_r_proto" in
16796         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16797         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16798         esac
16799         case "$sethostent_r_proto" in
16800         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16801         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16802         esac
16803         case "$sethostent_r_proto" in
16804         ''|0)   d_sethostent_r=undef
16805                 sethostent_r_proto=0
16806                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16807         * )     case "$sethostent_r_proto" in
16808                 REENTRANT_PROTO*) ;;
16809                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16810                 esac
16811                 echo "Prototype: $try" ;;
16812         esac
16813         ;;
16814         *)      case "$usethreads" in
16815                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16816                 esac
16817                 d_sethostent_r=undef
16818                 sethostent_r_proto=0
16819                 ;;
16820         esac
16821         ;;
16822 *)      sethostent_r_proto=0
16823         ;;
16824 esac
16825
16826 : see if setitimer exists
16827 set setitimer d_setitimer
16828 eval $inlibc
16829
16830 : see if setlinebuf exists
16831 set setlinebuf d_setlinebuf
16832 eval $inlibc
16833
16834 : see if setlocale exists
16835 set setlocale d_setlocale
16836 eval $inlibc
16837
16838 : see if locale.h is available
16839 set locale.h i_locale
16840 eval $inhdr
16841
16842 : see if setlocale_r exists
16843 set setlocale_r d_setlocale_r
16844 eval $inlibc
16845 case "$d_setlocale_r" in
16846 "$define")
16847         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16848         case "$d_setlocale_r_proto:$usethreads" in
16849         ":define")      d_setlocale_r_proto=define
16850                 set d_setlocale_r_proto setlocale_r $hdrs
16851                 eval $hasproto ;;
16852         *)      ;;
16853         esac
16854         case "$d_setlocale_r_proto" in
16855         define)
16856         case "$setlocale_r_proto" in
16857         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16858         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16859         esac
16860         case "$setlocale_r_proto" in
16861         ''|0)   d_setlocale_r=undef
16862                 setlocale_r_proto=0
16863                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16864         * )     case "$setlocale_r_proto" in
16865                 REENTRANT_PROTO*) ;;
16866                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16867                 esac
16868                 echo "Prototype: $try" ;;
16869         esac
16870         ;;
16871         *)      case "$usethreads" in
16872                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16873                 esac
16874                 d_setlocale_r=undef
16875                 setlocale_r_proto=0
16876                 ;;
16877         esac
16878         ;;
16879 *)      setlocale_r_proto=0
16880         ;;
16881 esac
16882
16883 : see if setnetent exists
16884 set setnetent d_setnent
16885 eval $inlibc
16886
16887 : see if setnetent_r exists
16888 set setnetent_r d_setnetent_r
16889 eval $inlibc
16890 case "$d_setnetent_r" in
16891 "$define")
16892         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16893         case "$d_setnetent_r_proto:$usethreads" in
16894         ":define")      d_setnetent_r_proto=define
16895                 set d_setnetent_r_proto setnetent_r $hdrs
16896                 eval $hasproto ;;
16897         *)      ;;
16898         esac
16899         case "$d_setnetent_r_proto" in
16900         define)
16901         case "$setnetent_r_proto" in
16902         ''|0) try='int setnetent_r(int, struct netent_data*);'
16903         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
16904         esac
16905         case "$setnetent_r_proto" in
16906         ''|0) try='void setnetent_r(int, struct netent_data*);'
16907         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
16908         esac
16909         case "$setnetent_r_proto" in
16910         ''|0)   d_setnetent_r=undef
16911                 setnetent_r_proto=0
16912                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16913         * )     case "$setnetent_r_proto" in
16914                 REENTRANT_PROTO*) ;;
16915                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16916                 esac
16917                 echo "Prototype: $try" ;;
16918         esac
16919         ;;
16920         *)      case "$usethreads" in
16921                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16922                 esac
16923                 d_setnetent_r=undef
16924                 setnetent_r_proto=0
16925                 ;;
16926         esac
16927         ;;
16928 *)      setnetent_r_proto=0
16929         ;;
16930 esac
16931
16932 : see if setprotoent exists
16933 set setprotoent d_setpent
16934 eval $inlibc
16935
16936 : see if setpgid exists
16937 set setpgid d_setpgid
16938 eval $inlibc
16939
16940 : see if setpgrp2 exists
16941 set setpgrp2 d_setpgrp2
16942 eval $inlibc
16943
16944 : see if setpriority exists
16945 set setpriority d_setprior
16946 eval $inlibc
16947
16948 : see if setproctitle exists
16949 set setproctitle d_setproctitle
16950 eval $inlibc
16951
16952 : see if setprotoent_r exists
16953 set setprotoent_r d_setprotoent_r
16954 eval $inlibc
16955 case "$d_setprotoent_r" in
16956 "$define")
16957         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16958         case "$d_setprotoent_r_proto:$usethreads" in
16959         ":define")      d_setprotoent_r_proto=define
16960                 set d_setprotoent_r_proto setprotoent_r $hdrs
16961                 eval $hasproto ;;
16962         *)      ;;
16963         esac
16964         case "$d_setprotoent_r_proto" in
16965         define)
16966         case "$setprotoent_r_proto" in
16967         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16968         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
16969         esac
16970         case "$setprotoent_r_proto" in
16971         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16972         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
16973         esac
16974         case "$setprotoent_r_proto" in
16975         ''|0)   d_setprotoent_r=undef
16976                 setprotoent_r_proto=0
16977                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16978         * )     case "$setprotoent_r_proto" in
16979                 REENTRANT_PROTO*) ;;
16980                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16981                 esac
16982                 echo "Prototype: $try" ;;
16983         esac
16984         ;;
16985         *)      case "$usethreads" in
16986                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16987                 esac
16988                 d_setprotoent_r=undef
16989                 setprotoent_r_proto=0
16990                 ;;
16991         esac
16992         ;;
16993 *)      setprotoent_r_proto=0
16994         ;;
16995 esac
16996
16997 : see if setpwent exists
16998 set setpwent d_setpwent
16999 eval $inlibc
17000
17001 : see if setpwent_r exists
17002 set setpwent_r d_setpwent_r
17003 eval $inlibc
17004 case "$d_setpwent_r" in
17005 "$define")
17006         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17007         case "$d_setpwent_r_proto:$usethreads" in
17008         ":define")      d_setpwent_r_proto=define
17009                 set d_setpwent_r_proto setpwent_r $hdrs
17010                 eval $hasproto ;;
17011         *)      ;;
17012         esac
17013         case "$d_setpwent_r_proto" in
17014         define)
17015         case "$setpwent_r_proto" in
17016         ''|0) try='int setpwent_r(FILE**);'
17017         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17018         esac
17019         case "$setpwent_r_proto" in
17020         ''|0) try='void setpwent_r(FILE**);'
17021         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17022         esac
17023         case "$setpwent_r_proto" in
17024         ''|0)   d_setpwent_r=undef
17025                 setpwent_r_proto=0
17026                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17027         * )     case "$setpwent_r_proto" in
17028                 REENTRANT_PROTO*) ;;
17029                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17030                 esac
17031                 echo "Prototype: $try" ;;
17032         esac
17033         ;;
17034         *)      case "$usethreads" in
17035                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17036                 esac
17037                 d_setpwent_r=undef
17038                 setpwent_r_proto=0
17039                 ;;
17040         esac
17041         ;;
17042 *)      setpwent_r_proto=0
17043         ;;
17044 esac
17045
17046 : see if setregid exists
17047 set setregid d_setregid
17048 eval $inlibc
17049 set setresgid d_setresgid
17050 eval $inlibc
17051
17052 : see if setreuid exists
17053 set setreuid d_setreuid
17054 eval $inlibc
17055 set setresuid d_setresuid
17056 eval $inlibc
17057
17058 : see if setrgid exists
17059 set setrgid d_setrgid
17060 eval $inlibc
17061
17062 : see if setruid exists
17063 set setruid d_setruid
17064 eval $inlibc
17065
17066 : see if setservent exists
17067 set setservent d_setsent
17068 eval $inlibc
17069
17070 : see if setservent_r exists
17071 set setservent_r d_setservent_r
17072 eval $inlibc
17073 case "$d_setservent_r" in
17074 "$define")
17075         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17076         case "$d_setservent_r_proto:$usethreads" in
17077         ":define")      d_setservent_r_proto=define
17078                 set d_setservent_r_proto setservent_r $hdrs
17079                 eval $hasproto ;;
17080         *)      ;;
17081         esac
17082         case "$d_setservent_r_proto" in
17083         define)
17084         case "$setservent_r_proto" in
17085         ''|0) try='int setservent_r(int, struct servent_data*);'
17086         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17087         esac
17088         case "$setservent_r_proto" in
17089         ''|0) try='void setservent_r(int, struct servent_data*);'
17090         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17091         esac
17092         case "$setservent_r_proto" in
17093         ''|0)   d_setservent_r=undef
17094                 setservent_r_proto=0
17095                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17096         * )     case "$setservent_r_proto" in
17097                 REENTRANT_PROTO*) ;;
17098                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17099                 esac
17100                 echo "Prototype: $try" ;;
17101         esac
17102         ;;
17103         *)      case "$usethreads" in
17104                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17105                 esac
17106                 d_setservent_r=undef
17107                 setservent_r_proto=0
17108                 ;;
17109         esac
17110         ;;
17111 *)      setservent_r_proto=0
17112         ;;
17113 esac
17114
17115 : see if setsid exists
17116 set setsid d_setsid
17117 eval $inlibc
17118
17119 : see if setvbuf exists
17120 set setvbuf d_setvbuf
17121 eval $inlibc
17122
17123 : see if sfio.h is available
17124 set sfio.h i_sfio
17125 eval $inhdr
17126
17127 : see if sfio library is available
17128 case "$i_sfio" in
17129 $define)
17130         val=''
17131         set sfreserve val
17132         eval $inlibc
17133         ;;
17134 *)
17135         val="$undef"
17136         ;;
17137 esac
17138 : Ok, but do we want to use it.
17139 case "$val" in
17140 $define)
17141         case "$usesfio" in
17142         true|$define|[yY]*) dflt='y';;
17143         *) dflt='n';;
17144         esac
17145         echo "$package can use the sfio library, but it is experimental."
17146         case "$useperlio" in
17147         "$undef")
17148             echo "For sfio also the PerlIO abstraction layer is needed."
17149             echo "Earlier you said you wouldn't want that."
17150             ;;
17151         esac
17152         rp="You seem to have sfio available, do you want to try using it?"
17153         . ./myread
17154         case "$ans" in
17155         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17156                 useperlio="$define"
17157                 val="$define"
17158                 ;;
17159         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17160                 val="$undef"
17161                 ;;
17162         esac
17163         ;;
17164 *)      case "$usesfio" in
17165         true|$define|[yY]*)
17166                 echo "Sorry, cannot find sfio on this machine." >&4
17167                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17168                 val="$undef"
17169                 ;;
17170         esac
17171         ;;
17172 esac
17173 set d_sfio
17174 eval $setvar
17175 case "$d_sfio" in
17176 $define) usesfio='true';;
17177 *) usesfio='false';;
17178 esac
17179 case "$d_sfio" in
17180 $define) ;;
17181 *)      : Remove sfio from list of libraries to use
17182         case "$libs" in
17183         *-lsfio*)
17184                 echo "Removing unneeded -lsfio from library list" >&4
17185                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17186                 shift
17187                 libs="$*"
17188                 echo "libs = $libs" >&4
17189                 ;;
17190         esac
17191 ;;
17192 esac
17193
17194
17195 : see if shmctl exists
17196 set shmctl d_shmctl
17197 eval $inlibc
17198
17199 : see if shmget exists
17200 set shmget d_shmget
17201 eval $inlibc
17202
17203 : see if shmat exists
17204 set shmat d_shmat
17205 eval $inlibc
17206 : see what shmat returns
17207 case "$d_shmat" in
17208 "$define")
17209         $cat >shmat.c <<'END'
17210 #include <sys/shm.h>
17211 void *shmat();
17212 END
17213         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17214                 shmattype='void *'
17215         else
17216                 shmattype='char *'
17217         fi
17218         echo "and it returns ($shmattype)." >&4
17219         : see if a prototype for shmat is available
17220         xxx=`./findhdr sys/shm.h`
17221         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17222         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17223                 val="$define"
17224         else
17225                 val="$undef"
17226         fi
17227         $rm -f shmat.[co]
17228         ;;
17229 *)
17230         val="$undef"
17231         ;;
17232 esac
17233 set d_shmatprototype
17234 eval $setvar
17235
17236 : see if shmdt exists
17237 set shmdt d_shmdt
17238 eval $inlibc
17239
17240 : see how much of the 'shm*(2)' library is present.
17241 h_shm=true
17242 echo " "
17243 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17244 *"$undef"*) h_shm=false;;
17245 esac
17246 case "$osname" in
17247 freebsd)
17248     case "`ipcs 2>&1`" in
17249     "SVID shared memory"*"not configured"*)
17250         echo "Your $osname does not have the shm*(2) configured." >&4
17251         h_shm=false
17252         val="$undef"
17253         set shmctl d_shmctl
17254         evat $setvar
17255         set shmget d_shmget
17256         evat $setvar
17257         set shmat d_shmat
17258         evat $setvar
17259         set shmdt d_shmdt
17260         evat $setvar
17261         ;;
17262     esac
17263     ;;
17264 esac
17265 : we could also check for sys/ipc.h ...
17266 if $h_shm && $test `./findhdr sys/shm.h`; then
17267         echo "You have the full shm*(2) library." >&4
17268         val="$define"
17269 else
17270         echo "You don't have the full shm*(2) library." >&4
17271         val="$undef"
17272 fi
17273 set d_shm
17274 eval $setvar
17275
17276 : see if we have sigaction
17277 echo " "
17278 if set sigaction val -f d_sigaction; eval $csym; $val; then
17279         echo 'sigaction() found.' >&4
17280         $cat > try.c <<EOP
17281 #include <stdio.h>
17282 #include <sys/types.h>
17283 #include <signal.h>
17284 #$i_stdlib I_STDLIB
17285 #ifdef I_STDLIB
17286 #include <stdlib.h>
17287 #endif
17288 int main()
17289 {
17290     struct sigaction act, oact;
17291     act.sa_flags = 0;
17292     oact.sa_handler = 0;
17293     /* so that act and oact are used */
17294     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17295 }
17296 EOP
17297         set try
17298         if eval $compile_ok; then
17299                 val="$define"
17300         else
17301                 echo "But you don't seem to have a useable struct sigaction." >&4
17302                 val="$undef"
17303         fi
17304 else
17305         echo 'sigaction NOT found.' >&4
17306         val="$undef"
17307 fi
17308 set d_sigaction; eval $setvar
17309 $rm_try
17310
17311 : see if this is a sunmath.h system
17312 set sunmath.h i_sunmath
17313 eval $inhdr
17314
17315 : see if signbit exists
17316 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17317 $cat >try.c <<EOCP
17318 #$i_math I_MATH
17319 #$i_sunmath I_SUNMATH
17320 #ifdef I_MATH
17321 #  include <math.h>
17322 #endif
17323 #ifdef I_SUNMATH  /* Solaris special math library */
17324 #  include <sunmath.h>
17325 #endif
17326 #define NV $nvtype
17327 int main(int argc, char **argv)
17328 {
17329     NV x = 0.0;
17330     NV y = -0.0;
17331     if ((signbit(x) == 0) && (signbit(y) != 0))
17332         return 0;
17333     else
17334         return 1;
17335 }
17336 EOCP
17337 val="$undef"
17338 set try
17339 if eval $compile; then
17340     if $run ./try; then
17341         $echo "Yes." >&4
17342         val="$define"
17343     else
17344         $echo "Signbit seems to be available, but doesn't work as I expected."
17345         $echo "I won't use it." >&4
17346         val="$undef"
17347     fi
17348 else
17349     $echo "Nope." >&4
17350     dflt="$undef"
17351 fi
17352 set d_signbit
17353 eval $setvar
17354 $rm_try
17355
17356 : see if sigprocmask exists
17357 set sigprocmask d_sigprocmask
17358 eval $inlibc
17359
17360 : see if sigsetjmp exists
17361 echo " "
17362 case "$d_sigsetjmp" in
17363 '')
17364         $cat >try.c <<EOP
17365 #include <setjmp.h>
17366 #$i_stdlib I_STDLIB
17367 #ifdef I_STDLIB
17368 #include <stdlib.h>
17369 #endif
17370 sigjmp_buf env;
17371 int set = 1;
17372 int main()
17373 {
17374         if (sigsetjmp(env,1))
17375                 exit(set);
17376         set = 0;
17377         siglongjmp(env, 1);
17378         exit(1);
17379 }
17380 EOP
17381         set try
17382         if eval $compile; then
17383                 if $run ./try >/dev/null 2>&1; then
17384                         echo "POSIX sigsetjmp found." >&4
17385                         val="$define"
17386                 else
17387                         $cat >&4 <<EOM
17388 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17389 I'll ignore them.
17390 EOM
17391                         val="$undef"
17392                 fi
17393         else
17394                 echo "sigsetjmp not found." >&4
17395                 val="$undef"
17396         fi
17397         ;;
17398 *) val="$d_sigsetjmp"
17399         case "$d_sigsetjmp" in
17400         $define) echo "POSIX sigsetjmp found." >&4;;
17401         $undef) echo "sigsetjmp not found." >&4;;
17402         esac
17403         ;;
17404 esac
17405 set d_sigsetjmp
17406 eval $setvar
17407 $rm_try
17408
17409 : see if snprintf exists
17410 set snprintf d_snprintf
17411 eval $inlibc
17412
17413 : see if vsnprintf exists
17414 set vsnprintf d_vsnprintf
17415 eval $inlibc
17416
17417 case "$d_snprintf-$d_vsnprintf" in
17418 "$define-$define")
17419     $cat <<EOM
17420 Checking whether your snprintf() and vsnprintf() work okay...
17421 EOM
17422     $cat >try.c <<'EOCP'
17423 /* v?snprintf testing logic courtesy of Russ Allbery.
17424  * According to C99:
17425  * - if the buffer is too short it still must be \0-terminated
17426  * - if the buffer is too short the potentially required length
17427  *   must be returned and not -1
17428  * - if the buffer is NULL the potentially required length
17429  *   must be returned and not -1 or core dump
17430  */
17431 #include <stdio.h>
17432 #include <stdarg.h>
17433
17434 char buf[2];
17435
17436 int test (char *format, ...)
17437 {
17438     va_list args;
17439     int count;
17440
17441     va_start (args, format);
17442     count = vsnprintf (buf, sizeof buf, format, args);
17443     va_end (args);
17444     return count;
17445 }
17446
17447 int main ()
17448 {
17449     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17450              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17451 }
17452 EOCP
17453     set try
17454     if eval $compile; then
17455         `$run ./try`
17456         case "$?" in
17457         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17458         *) cat <<EOM >&4
17459 Your snprintf() and snprintf() don't seem to be working okay.
17460 EOM
17461            d_snprintf="$undef"
17462            d_vsnprintf="$undef"
17463            ;;
17464         esac
17465     else
17466         echo "(I can't seem to compile the test program--assuming they don't)"
17467         d_snprintf="$undef"
17468         d_vsnprintf="$undef"
17469     fi
17470     $rm_try
17471     ;;
17472 esac
17473
17474 : see if sockatmark exists
17475 set sockatmark d_sockatmark
17476 eval $inlibc
17477
17478 : see if prototype for sockatmark is available
17479 echo " "
17480 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17481 eval $hasproto
17482
17483 : see if socks5_init exists
17484 set socks5_init d_socks5_init
17485 eval $inlibc
17486
17487 : see if sprintf returns the length of the string in the buffer as per ANSI
17488 $echo "Checking whether sprintf returns the length of the string..." >&4
17489 $cat <<EOP >try.c
17490 #include <stdio.h>
17491 #$i_stdlib I_STDLIB
17492 #ifdef I_STDLIB
17493 #include <stdlib.h>
17494 #endif
17495 #$i_string I_STRING
17496 #ifdef I_STRING
17497 #  include <string.h>
17498 #else
17499 #  include <strings.h>
17500 #endif
17501 #$i_math I_MATH
17502 #ifdef I_MATH
17503 #include <math.h>
17504 #endif
17505
17506 char buffer[256];
17507
17508 int check (size_t expect, int test) {
17509   size_t got = strlen(buffer);
17510   if (expect == got)
17511     return 0;
17512
17513   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17514        test, buffer);
17515   exit (test);
17516 }
17517
17518 int main(int argc, char **argv) {
17519   int test = 0;
17520
17521   check(sprintf(buffer, ""), ++test);
17522   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17523   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17524
17525   return 0;
17526 }
17527 EOP
17528 set try
17529
17530 if eval $compile; then
17531     xxx="`$run ./try`"
17532     case "$?" in
17533         0) cat >&4 <<EOM
17534 sprintf returns the length of the string (as ANSI says it should)
17535 EOM
17536         d_sprintf_returns_strlen="$define"
17537         ;;
17538         *) cat >&4 <<EOM
17539 sprintf does not return the length of the string (how old is this system?)
17540 EOM
17541         d_sprintf_returns_strlen="$undef"
17542         ;;
17543     esac
17544 else
17545     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17546     d_sprintf_returns_strlen="$undef"
17547 fi
17548 $rm_try
17549
17550 : see if srand48_r exists
17551 set srand48_r d_srand48_r
17552 eval $inlibc
17553 case "$d_srand48_r" in
17554 "$define")
17555         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17556         case "$d_srand48_r_proto:$usethreads" in
17557         ":define")      d_srand48_r_proto=define
17558                 set d_srand48_r_proto srand48_r $hdrs
17559                 eval $hasproto ;;
17560         *)      ;;
17561         esac
17562         case "$d_srand48_r_proto" in
17563         define)
17564         case "$srand48_r_proto" in
17565         ''|0) try='int srand48_r(long, struct drand48_data*);'
17566         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17567         esac
17568         case "$srand48_r_proto" in
17569         ''|0)   d_srand48_r=undef
17570                 srand48_r_proto=0
17571                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17572         * )     case "$srand48_r_proto" in
17573                 REENTRANT_PROTO*) ;;
17574                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17575                 esac
17576                 echo "Prototype: $try" ;;
17577         esac
17578         ;;
17579         *)      case "$usethreads" in
17580                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17581                 esac
17582                 d_srand48_r=undef
17583                 srand48_r_proto=0
17584                 ;;
17585         esac
17586         ;;
17587 *)      srand48_r_proto=0
17588         ;;
17589 esac
17590
17591 : see if srandom_r exists
17592 set srandom_r d_srandom_r
17593 eval $inlibc
17594 case "$d_srandom_r" in
17595 "$define")
17596         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17597         case "$d_srandom_r_proto:$usethreads" in
17598         ":define")      d_srandom_r_proto=define
17599                 set d_srandom_r_proto srandom_r $hdrs
17600                 eval $hasproto ;;
17601         *)      ;;
17602         esac
17603         case "$d_srandom_r_proto" in
17604         define)
17605         case "$srandom_r_proto" in
17606         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17607         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17608         esac
17609         case "$srandom_r_proto" in
17610         ''|0)   d_srandom_r=undef
17611                 srandom_r_proto=0
17612                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17613         * )     case "$srandom_r_proto" in
17614                 REENTRANT_PROTO*) ;;
17615                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17616                 esac
17617                 echo "Prototype: $try" ;;
17618         esac
17619         ;;
17620         *)      case "$usethreads" in
17621                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17622                 esac
17623                 d_srandom_r=undef
17624                 srandom_r_proto=0
17625                 ;;
17626         esac
17627         ;;
17628 *)      srandom_r_proto=0
17629         ;;
17630 esac
17631
17632 : see if prototype for setresgid is available
17633 echo " "
17634 set d_sresgproto setresgid $i_unistd unistd.h
17635 eval $hasproto
17636
17637 : see if prototype for setresuid is available
17638 echo " "
17639 set d_sresuproto setresuid $i_unistd unistd.h
17640 eval $hasproto
17641
17642 : see if sys/stat.h is available
17643 set sys/stat.h i_sysstat
17644 eval $inhdr
17645
17646 : see if stat knows about block sizes
17647 echo " "
17648 echo "Checking to see if your struct stat has st_blocks field..." >&4
17649 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17650 eval $hasfield
17651
17652 : see if this is a sys/vfs.h system
17653 set sys/vfs.h i_sysvfs
17654 eval $inhdr
17655
17656 : see if this is a sys/statfs.h system
17657 set sys/statfs.h i_sysstatfs
17658 eval $inhdr
17659
17660 : Check for statfs_s
17661 echo " "
17662 echo "Checking to see if your system supports struct statfs..." >&4
17663 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
17664 eval $hasstruct
17665 case "$d_statfs_s" in
17666 "$define")      echo "Yes, it does."   ;;
17667 *)              echo "No, it doesn't." ;;
17668 esac
17669
17670
17671 : see if struct statfs knows about f_flags
17672 case "$d_statfs_s" in
17673 define)
17674         echo " "
17675         echo "Checking to see if your struct statfs has f_flags field..." >&4
17676         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
17677         eval $hasfield
17678         ;;
17679 *)      val="$undef"
17680         set d_statfs_f_flags
17681         eval $setvar
17682         ;;
17683 esac
17684 case "$d_statfs_f_flags" in
17685 "$define")      echo "Yes, it does."   ;;
17686 *)              echo "No, it doesn't." ;;
17687 esac
17688
17689 : Check stream access
17690 $cat >&4 <<EOM
17691 Checking how to access stdio streams by file descriptor number...
17692 EOM
17693 case "$stdio_stream_array" in
17694 '')     $cat >try.c <<EOCP
17695 #include <stdio.h>
17696 int main() {
17697   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17698     printf("yes\n");
17699 }
17700 EOCP
17701         for s in _iob __iob __sF
17702         do
17703                 set try -DSTDIO_STREAM_ARRAY=$s
17704                 if eval $compile; then
17705                         case "`$run ./try`" in
17706                         yes)    stdio_stream_array=$s; break ;;
17707                         esac
17708                 fi
17709         done
17710         $rm_try
17711 esac
17712 case "$stdio_stream_array" in
17713 '')     $cat >&4 <<EOM
17714 I can't figure out how to access stdio streams by file descriptor number.
17715 EOM
17716         d_stdio_stream_array="$undef"
17717         ;;
17718 *)      $cat >&4 <<EOM
17719 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17720 EOM
17721         d_stdio_stream_array="$define"
17722         ;;
17723 esac
17724
17725 : see if strcoll exists
17726 set strcoll d_strcoll
17727 eval $inlibc
17728
17729 : check for structure copying
17730 echo " "
17731 echo "Checking to see if your C compiler can copy structs..." >&4
17732 $cat >try.c <<'EOCP'
17733 int main()
17734 {
17735         struct blurfl {
17736                 int dyick;
17737         } foo, bar;
17738
17739         foo = bar;
17740 }
17741 EOCP
17742 if $cc -c try.c >/dev/null 2>&1 ; then
17743         val="$define"
17744         echo "Yup, it can."
17745 else
17746         val="$undef"
17747         echo "Nope, it can't."
17748 fi
17749 set d_strctcpy
17750 eval $setvar
17751 $rm_try
17752
17753 : see if strerror and/or sys_errlist[] exist
17754 echo " "
17755 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17756     if set strerror val -f d_strerror; eval $csym; $val; then
17757                 echo 'strerror() found.' >&4
17758                 d_strerror="$define"
17759                 d_strerrm='strerror(e)'
17760                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17761                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17762                         d_syserrlst="$define"
17763                 else
17764                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17765                         d_syserrlst="$undef"
17766                 fi
17767     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17768                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17769                 echo 'strerror() found in string header.' >&4
17770                 d_strerror="$define"
17771                 d_strerrm='strerror(e)'
17772                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17773                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17774                                 d_syserrlst="$define"
17775                 else
17776                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17777                         d_syserrlst="$undef"
17778                 fi
17779     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17780                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17781                 d_strerror="$undef"
17782                 d_syserrlst="$define"
17783                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17784     else
17785                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17786                 d_strerror="$undef"
17787                 d_syserrlst="$undef"
17788                 d_strerrm='"unknown"'
17789     fi
17790 fi
17791
17792 : see if strerror_r exists
17793 set strerror_r d_strerror_r
17794 eval $inlibc
17795 case "$d_strerror_r" in
17796 "$define")
17797         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17798         case "$d_strerror_r_proto:$usethreads" in
17799         ":define")      d_strerror_r_proto=define
17800                 set d_strerror_r_proto strerror_r $hdrs
17801                 eval $hasproto ;;
17802         *)      ;;
17803         esac
17804         case "$d_strerror_r_proto" in
17805         define)
17806         case "$strerror_r_proto" in
17807         ''|0) try='int strerror_r(int, char*, size_t);'
17808         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17809         esac
17810         case "$strerror_r_proto" in
17811         ''|0) try='int strerror_r(int, char*, int);'
17812         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17813         esac
17814         case "$strerror_r_proto" in
17815         ''|0) try='char* strerror_r(int, char*, size_t);'
17816         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17817         esac
17818         case "$strerror_r_proto" in
17819         ''|0)   d_strerror_r=undef
17820                 strerror_r_proto=0
17821                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17822         * )     case "$strerror_r_proto" in
17823                 REENTRANT_PROTO*) ;;
17824                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17825                 esac
17826                 echo "Prototype: $try" ;;
17827         esac
17828         ;;
17829         *)      case "$usethreads" in
17830                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17831                 esac
17832                 d_strerror_r=undef
17833                 strerror_r_proto=0
17834                 ;;
17835         esac
17836         ;;
17837 *)      strerror_r_proto=0
17838         ;;
17839 esac
17840
17841 : see if strftime exists
17842 set strftime d_strftime
17843 eval $inlibc
17844
17845 : see if strlcat exists
17846 set strlcat d_strlcat
17847 eval $inlibc
17848
17849 : see if strlcpy exists
17850 set strlcpy d_strlcpy
17851 eval $inlibc
17852
17853 : see if strtod exists
17854 set strtod d_strtod
17855 eval $inlibc
17856
17857 : see if strtol exists
17858 set strtol d_strtol
17859 eval $inlibc
17860
17861 : see if strtold exists
17862 set strtold d_strtold
17863 eval $inlibc
17864
17865 : see if strtoll exists
17866 set strtoll d_strtoll
17867 eval $inlibc
17868
17869 case "$d_longlong-$d_strtoll" in
17870 "$define-$define")
17871         $cat <<EOM
17872 Checking whether your strtoll() works okay...
17873 EOM
17874         $cat >try.c <<'EOCP'
17875 #include <errno.h>
17876 #ifdef __hpux
17877 #define strtoll __strtoll
17878 #endif
17879 #ifdef __EMX__
17880 #define strtoll _strtoll
17881 #endif
17882 #include <stdio.h>
17883 extern long long int strtoll(char *s, char **, int);
17884 static int bad = 0;
17885 int check(char *s, long long ell, int een) {
17886         long long gll;
17887         errno = 0;
17888         gll = strtoll(s, 0, 10);
17889         if (!((gll == ell) && (errno == een)))
17890                 bad++;
17891 }
17892 int main() {
17893         check(" 1",                                      1LL, 0);
17894         check(" 0",                                      0LL, 0);
17895         check("-1",                                     -1LL, 0);
17896         check("-9223372036854775808", -9223372036854775808LL, 0);
17897         check("-9223372036854775808", -9223372036854775808LL, 0);
17898         check(" 9223372036854775807",  9223372036854775807LL, 0);
17899         check("-9223372036854775808", -9223372036854775808LL, 0);
17900         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17901         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17902         if (!bad)
17903                 printf("ok\n");
17904 }
17905 EOCP
17906         set try
17907         if eval $compile; then
17908                 yyy=`$run ./try`
17909                 case "$yyy" in
17910                 ok) echo "Your strtoll() seems to be working okay." ;;
17911                 *) cat <<EOM >&4
17912 Your strtoll() doesn't seem to be working okay.
17913 EOM
17914                    d_strtoll="$undef"
17915                    ;;
17916                 esac
17917         else
17918                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17919                 d_strtoll="$undef"
17920         fi
17921         ;;
17922 esac
17923
17924 : see if strtoq exists
17925 set strtoq d_strtoq
17926 eval $inlibc
17927
17928 : see if strtoul exists
17929 set strtoul d_strtoul
17930 eval $inlibc
17931
17932 case "$d_strtoul" in
17933 "$define")
17934         $cat <<EOM
17935 Checking whether your strtoul() works okay...
17936 EOM
17937         $cat >try.c <<'EOCP'
17938 #include <errno.h>
17939 #include <stdio.h>
17940 extern unsigned long int strtoul(char *s, char **, int);
17941 static int bad = 0;
17942 void check(char *s, unsigned long eul, int een) {
17943         unsigned long gul;
17944         errno = 0;
17945         gul = strtoul(s, 0, 10);
17946         if (!((gul == eul) && (errno == een)))
17947                 bad++;
17948 }
17949 int main() {
17950         check(" 1", 1L, 0);
17951         check(" 0", 0L, 0);
17952 EOCP
17953         case "$longsize" in
17954         8)
17955             $cat >>try.c <<'EOCP'
17956         check("18446744073709551615", 18446744073709551615UL, 0);
17957         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17958 #if 0 /* strtoul() for /^-/ strings is undefined. */
17959         check("-1", 18446744073709551615UL, 0);
17960         check("-18446744073709551614", 2, 0);
17961         check("-18446744073709551615", 1, 0);
17962         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17963         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17964 #endif
17965 EOCP
17966                 ;;
17967         4)
17968                     $cat >>try.c <<'EOCP'
17969         check("4294967295", 4294967295UL, 0);
17970         check("4294967296", 4294967295UL, ERANGE);
17971 #if 0 /* strtoul() for /^-/ strings is undefined. */
17972         check("-1", 4294967295UL, 0);
17973         check("-4294967294", 2, 0);
17974         check("-4294967295", 1, 0);
17975         check("-4294967296", 4294967295UL, ERANGE);
17976         check("-4294967297", 4294967295UL, ERANGE);
17977 #endif
17978 EOCP
17979                 ;;
17980         *)
17981 : Should we write these tests to be more portable by sprintf-ing
17982 : ~0 and then manipulating that char string as input for strtol?
17983                 ;;
17984         esac
17985         $cat >>try.c <<'EOCP'
17986         if (!bad)
17987                 printf("ok\n");
17988         return 0;
17989 }
17990 EOCP
17991         set try
17992         if eval $compile; then
17993                 case "`$run ./try`" in
17994                 ok) echo "Your strtoul() seems to be working okay." ;;
17995                 *) cat <<EOM >&4
17996 Your strtoul() doesn't seem to be working okay.
17997 EOM
17998                    d_strtoul="$undef"
17999                    ;;
18000                 esac
18001         else
18002                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18003                 d_strtoul="$undef"
18004         fi
18005         ;;
18006 esac
18007
18008 : see if strtoull exists
18009 set strtoull d_strtoull
18010 eval $inlibc
18011
18012 case "$d_longlong-$d_strtoull" in
18013 "$define-$define")
18014         $cat <<EOM
18015 Checking whether your strtoull() works okay...
18016 EOM
18017         $cat >try.c <<'EOCP'
18018 #include <errno.h>
18019 #ifdef __hpux
18020 #define strtoull __strtoull
18021 #endif
18022 #include <stdio.h>
18023 extern unsigned long long int strtoull(char *s, char **, int);
18024 static int bad = 0;
18025 int check(char *s, long long eull, int een) {
18026         long long gull;
18027         errno = 0;
18028         gull = strtoull(s, 0, 10);
18029         if (!((gull == eull) && (errno == een)))
18030                 bad++;
18031 }
18032 int main() {
18033         check(" 1",                                        1LL, 0);
18034         check(" 0",                                        0LL, 0);
18035         check("18446744073709551615",  18446744073709551615ULL, 0);
18036         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18037 #if 0 /* strtoull() for /^-/ strings is undefined. */
18038         check("-1",                    18446744073709551615ULL, 0);
18039         check("-18446744073709551614",                     2LL, 0);
18040         check("-18446744073709551615",                     1LL, 0);
18041         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18042         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18043 #endif
18044         if (!bad)
18045                 printf("ok\n");
18046 }
18047 EOCP
18048         set try
18049         if eval $compile; then
18050                 case "`$run ./try`" in
18051                 ok) echo "Your strtoull() seems to be working okay." ;;
18052                 *) cat <<EOM >&4
18053 Your strtoull() doesn't seem to be working okay.
18054 EOM
18055                    d_strtoull="$undef"
18056                    ;;
18057                 esac
18058         else
18059                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18060                 d_strtoull="$undef"
18061         fi
18062         ;;
18063 esac
18064
18065 : see if strtouq exists
18066 set strtouq d_strtouq
18067 eval $inlibc
18068
18069 case "$d_strtouq" in
18070 "$define")
18071         $cat <<EOM
18072 Checking whether your strtouq() works okay...
18073 EOM
18074         $cat >try.c <<'EOCP'
18075 #include <errno.h>
18076 #include <stdio.h>
18077 extern unsigned long long int strtouq(char *s, char **, int);
18078 static int bad = 0;
18079 void check(char *s, unsigned long long eull, int een) {
18080         unsigned long long gull;
18081         errno = 0;
18082         gull = strtouq(s, 0, 10);
18083         if (!((gull == eull) && (errno == een)))
18084                 bad++;
18085 }
18086 int main() {
18087         check(" 1",                                        1LL, 0);
18088         check(" 0",                                        0LL, 0);
18089         check("18446744073709551615",  18446744073709551615ULL, 0);
18090         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18091 #if 0 /* strtouq() for /^-/ strings is undefined. */
18092         check("-1",                    18446744073709551615ULL, 0);
18093         check("-18446744073709551614",                     2LL, 0);
18094         check("-18446744073709551615",                     1LL, 0);
18095         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18096         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18097 #endif
18098         if (!bad)
18099                 printf("ok\n");
18100         return 0;
18101 }
18102 EOCP
18103         set try
18104         if eval $compile; then
18105                 case "`$run ./try`" in
18106                 ok) echo "Your strtouq() seems to be working okay." ;;
18107                 *) cat <<EOM >&4
18108 Your strtouq() doesn't seem to be working okay.
18109 EOM
18110                    d_strtouq="$undef"
18111                    ;;
18112                 esac
18113         else
18114                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18115                 d_strtouq="$undef"
18116         fi
18117         ;;
18118 esac
18119
18120 : see if strxfrm exists
18121 set strxfrm d_strxfrm
18122 eval $inlibc
18123
18124 : see if symlink exists
18125 set symlink d_symlink
18126 eval $inlibc
18127
18128 : see if syscall exists
18129 set syscall d_syscall
18130 eval $inlibc
18131
18132 : see if prototype for syscall is available
18133 echo " "
18134 set d_syscallproto syscall $i_unistd unistd.h
18135 eval $hasproto
18136
18137 : see if sysconf exists
18138 set sysconf d_sysconf
18139 eval $inlibc
18140
18141 : see if system exists
18142 set system d_system
18143 eval $inlibc
18144
18145 : see if tcgetpgrp exists
18146 set tcgetpgrp d_tcgetpgrp
18147 eval $inlibc
18148
18149 : see if tcsetpgrp exists
18150 set tcsetpgrp d_tcsetpgrp
18151 eval $inlibc
18152
18153 : see if prototype for telldir is available
18154 echo " "
18155 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18156 eval $hasproto
18157
18158 : see if time exists
18159 echo " "
18160 if test "X$d_time" = X -o X"$timetype" = X; then
18161     if set time val -f d_time; eval $csym; $val; then
18162                 echo 'time() found.' >&4
18163                 val="$define"
18164                 rp="What is the type returned by time() on this system?"
18165                 set time_t timetype long stdio.h sys/types.h
18166                 eval $typedef_ask
18167     else
18168                 echo 'time() not found, hope that will do.' >&4
18169                 val="$undef"
18170                 timetype='int';
18171     fi
18172     set d_time
18173     eval $setvar
18174 fi
18175
18176 : see if timegm exists
18177 set timegm d_timegm
18178 eval $inlibc
18179
18180 : see if this is a sys/times.h system
18181 set sys/times.h i_systimes
18182 eval $inhdr
18183
18184 : see if times exists
18185 echo " "
18186 if set times val -f d_times; eval $csym; $val; then
18187         echo 'times() found.' >&4
18188         d_times="$define"
18189         inc=''
18190         case "$i_systimes" in
18191         "$define") inc='sys/times.h';;
18192         esac
18193         rp="What is the type returned by times() on this system?"
18194         set clock_t clocktype long stdio.h sys/types.h $inc
18195         eval $typedef_ask
18196 else
18197         echo 'times() NOT found, hope that will do.' >&4
18198         d_times="$undef"
18199         clocktype='int'
18200 fi
18201
18202 : see if tmpnam_r exists
18203 set tmpnam_r d_tmpnam_r
18204 eval $inlibc
18205 case "$d_tmpnam_r" in
18206 "$define")
18207         hdrs="$i_systypes sys/types.h define stdio.h "
18208         case "$d_tmpnam_r_proto:$usethreads" in
18209         ":define")      d_tmpnam_r_proto=define
18210                 set d_tmpnam_r_proto tmpnam_r $hdrs
18211                 eval $hasproto ;;
18212         *)      ;;
18213         esac
18214         case "$d_tmpnam_r_proto" in
18215         define)
18216         case "$tmpnam_r_proto" in
18217         ''|0) try='char* tmpnam_r(char*);'
18218         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18219         esac
18220         case "$tmpnam_r_proto" in
18221         ''|0)   d_tmpnam_r=undef
18222                 tmpnam_r_proto=0
18223                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18224         * )     case "$tmpnam_r_proto" in
18225                 REENTRANT_PROTO*) ;;
18226                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18227                 esac
18228                 echo "Prototype: $try" ;;
18229         esac
18230         ;;
18231         *)      case "$usethreads" in
18232                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18233                 esac
18234                 d_tmpnam_r=undef
18235                 tmpnam_r_proto=0
18236                 ;;
18237         esac
18238         ;;
18239 *)      tmpnam_r_proto=0
18240         ;;
18241 esac
18242
18243 : see if truncate exists
18244 set truncate d_truncate
18245 eval $inlibc
18246
18247 : see if ttyname_r exists
18248 set ttyname_r d_ttyname_r
18249 eval $inlibc
18250 case "$d_ttyname_r" in
18251 "$define")
18252         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18253         case "$d_ttyname_r_proto:$usethreads" in
18254         ":define")      d_ttyname_r_proto=define
18255                 set d_ttyname_r_proto ttyname_r $hdrs
18256                 eval $hasproto ;;
18257         *)      ;;
18258         esac
18259         case "$d_ttyname_r_proto" in
18260         define)
18261         case "$ttyname_r_proto" in
18262         ''|0) try='int ttyname_r(int, char*, size_t);'
18263         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18264         esac
18265         case "$ttyname_r_proto" in
18266         ''|0) try='int ttyname_r(int, char*, int);'
18267         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18268         esac
18269         case "$ttyname_r_proto" in
18270         ''|0) try='char* ttyname_r(int, char*, int);'
18271         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18272         esac
18273         case "$ttyname_r_proto" in
18274         ''|0)   d_ttyname_r=undef
18275                 ttyname_r_proto=0
18276                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18277         * )     case "$ttyname_r_proto" in
18278                 REENTRANT_PROTO*) ;;
18279                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18280                 esac
18281                 echo "Prototype: $try" ;;
18282         esac
18283         ;;
18284         *)      case "$usethreads" in
18285                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18286                 esac
18287                 d_ttyname_r=undef
18288                 ttyname_r_proto=0
18289                 ;;
18290         esac
18291         ;;
18292 *)      ttyname_r_proto=0
18293         ;;
18294 esac
18295
18296 : see if tzname[] exists
18297 echo " "
18298 if set tzname val -a d_tzname; eval $csym; $val; then
18299         val="$define"
18300         echo 'tzname[] found.' >&4
18301 else
18302         val="$undef"
18303         echo 'tzname[] NOT found.' >&4
18304 fi
18305 set d_tzname
18306 eval $setvar
18307
18308 : Check if is a multiplatform env
18309 case "$osname" in
18310 next|rhapsody|darwin) multiarch="$define" ;;
18311 esac
18312 case "$multiarch" in
18313 ''|[nN]*) multiarch="$undef" ;;
18314 esac
18315
18316 : check for ordering of bytes in a UV
18317 echo " "
18318 case "$usecrosscompile$multiarch" in
18319 *$define*)
18320         $cat <<EOM
18321 You seem to be either cross-compiling or doing a multiarchitecture build,
18322 skipping the byteorder check.
18323
18324 EOM
18325         byteorder='ffff'
18326         ;;
18327 *)
18328         case "$byteorder" in
18329         '')
18330                 $cat <<'EOM'
18331 In the following, larger digits indicate more significance.  A big-endian
18332 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18333 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18334 machines may have weird orders like 3412.  A Cray will report 87654321,
18335 an Alpha will report 12345678. If the test program works the default is
18336 probably right.
18337 I'm now running the test program...
18338 EOM
18339                 $cat >try.c <<EOCP
18340 #include <stdio.h>
18341 #$i_stdlib I_STDLIB
18342 #ifdef I_STDLIB
18343 #include <stdlib.h>
18344 #endif
18345 #include <sys/types.h>
18346 typedef $uvtype UV;
18347 int main()
18348 {
18349         int i;
18350         union {
18351                 UV l;
18352                 char c[$uvsize];
18353         } u;
18354
18355         if ($uvsize > 4)
18356                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18357         else
18358                 u.l = (UV)0x04030201;
18359         for (i = 0; i < $uvsize; i++)
18360                 printf("%c", u.c[i]+'0');
18361         printf("\n");
18362         exit(0);
18363 }
18364 EOCP
18365                 xxx_prompt=y
18366                 set try
18367                 if eval $compile && $run ./try > /dev/null; then
18368                         dflt=`$run ./try`
18369                         case "$dflt" in
18370                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18371                                 echo "(The test program ran ok.)"
18372                                 echo "byteorder=$dflt"
18373                                 xxx_prompt=n
18374                         ;;
18375                         ????|????????) echo "(The test program ran ok.)" ;;
18376                         *) echo "(The test program didn't run right for some reason.)" ;;
18377                         esac
18378                 else
18379                         dflt='4321'
18380                         cat <<'EOM'
18381 (I can't seem to compile the test program.  Guessing big-endian...)
18382 EOM
18383                 fi
18384                 case "$xxx_prompt" in
18385                 y)
18386                         rp="What is the order of bytes in $uvtype?"
18387                         . ./myread
18388                         byteorder="$ans"
18389                         ;;
18390                 *)      byteorder=$dflt
18391                         ;;
18392                 esac
18393                 ;;
18394         esac
18395         $rm_try
18396         ;;
18397 esac
18398
18399 : Checking 32bit aligndness
18400 $cat <<EOM
18401
18402 Checking to see whether you can access character data unalignedly...
18403 EOM
18404 case "$d_u32align" in
18405 '')   $cat >try.c <<EOCP
18406 #include <stdio.h>
18407 #$i_stdlib I_STDLIB
18408 #ifdef I_STDLIB
18409 #include <stdlib.h>
18410 #endif
18411 #define U32 $u32type
18412 #define BYTEORDER 0x$byteorder
18413 #define U8 $u8type
18414 #include <signal.h>
18415 #ifdef SIGBUS
18416 $signal_t bletch(int s) { exit(4); }
18417 #endif
18418 int main() {
18419 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18420     U8 buf[8];
18421     U32 *up;
18422     int i;
18423
18424     if (sizeof(U32) != 4) {
18425         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18426         exit(1);
18427     }
18428
18429     fflush(stdout);
18430
18431 #ifdef SIGBUS
18432     signal(SIGBUS, bletch);
18433 #endif
18434
18435     buf[0] = 0;
18436     buf[1] = 0;
18437     buf[2] = 0;
18438     buf[3] = 1;
18439     buf[4] = 0;
18440     buf[5] = 0;
18441     buf[6] = 0;
18442     buf[7] = 1;
18443
18444     for (i = 0; i < 4; i++) {
18445         up = (U32*)(buf + i);
18446         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18447                (*up == 1 << (8*(3-i)))  /* little-endian */
18448               )
18449            )
18450         {
18451             printf("read failed (%x)\n", *up);
18452             exit(2);
18453         }
18454     }
18455
18456     /* write test */
18457     for (i = 0; i < 4; i++) {
18458         up = (U32*)(buf + i);
18459         *up = 0xBeef;
18460         if (*up != 0xBeef) {
18461             printf("write failed (%x)\n", *up);
18462             exit(3);
18463         }
18464     }
18465
18466     exit(0);
18467 #else
18468     printf("1\n");
18469     exit(1);
18470 #endif
18471     return 0;
18472 }
18473 EOCP
18474 set try
18475 if eval $compile_ok; then
18476         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18477         $run ./try 2>&1 >/dev/null
18478         case "$?" in
18479         0)      cat >&4 <<EOM
18480 You can access character data pretty unalignedly.
18481 EOM
18482                 d_u32align="$undef"
18483                 ;;
18484         *)      cat >&4 <<EOM
18485 It seems that you must access character data in an aligned manner.
18486 EOM
18487                 d_u32align="$define"
18488                 ;;
18489         esac
18490 else
18491         rp='Can you access character data at unaligned addresses?'
18492         dflt='n'
18493         . ./myread
18494         case "$ans" in
18495         [yY]*)  d_u32align="$undef"  ;;
18496         *)      d_u32align="$define" ;;
18497         esac
18498 fi
18499 $rm_try
18500 ;;
18501 esac
18502
18503 : see if ualarm exists
18504 set ualarm d_ualarm
18505 eval $inlibc
18506
18507 : see if umask exists
18508 set umask d_umask
18509 eval $inlibc
18510
18511 : see if unordered exists
18512 set unordered d_unordered
18513 eval $inlibc
18514
18515 : see if unsetenv exists
18516 set unsetenv d_unsetenv
18517 eval $inlibc
18518
18519 : see if usleep exists
18520 set usleep d_usleep
18521 eval $inlibc
18522
18523 : see if prototype for usleep is available
18524 echo " "
18525 set d_usleepproto usleep $i_unistd unistd.h
18526 eval $hasproto
18527
18528 : see if ustat exists
18529 set ustat d_ustat
18530 eval $inlibc
18531
18532 : see if closedir exists
18533 set closedir d_closedir
18534 eval $inlibc
18535
18536 case "$d_closedir" in
18537 "$define")
18538         echo " "
18539         echo "Checking whether closedir() returns a status..." >&4
18540         cat > try.c <<EOM
18541 #$i_dirent I_DIRENT             /**/
18542 #$i_sysdir I_SYS_DIR            /**/
18543 #$i_sysndir I_SYS_NDIR          /**/
18544 #$i_systypes I_SYS_TYPES        /**/
18545
18546 #if defined(I_SYS_TYPES)
18547 #include <sys/types.h>
18548 #endif
18549 #if defined(I_DIRENT)
18550 #include <dirent.h>
18551 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18552 #include <sys/dir.h>
18553 #endif
18554 #else
18555 #ifdef I_SYS_NDIR
18556 #include <sys/ndir.h>
18557 #else
18558 #ifdef I_SYS_DIR
18559 #ifdef hp9000s500
18560 #include <ndir.h>       /* may be wrong in the future */
18561 #else
18562 #include <sys/dir.h>
18563 #endif
18564 #endif
18565 #endif
18566 #endif
18567 int main() { return closedir(opendir(".")); }
18568 EOM
18569         set try
18570         if eval $compile_ok; then
18571                 if $run ./try > /dev/null 2>&1 ; then
18572                         echo "Yes, it does."
18573                         val="$undef"
18574                 else
18575                         echo "No, it doesn't."
18576                         val="$define"
18577                 fi
18578         else
18579                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18580                 val="$define"
18581         fi
18582         ;;
18583 *)
18584         val="$undef";
18585         ;;
18586 esac
18587 set d_void_closedir
18588 eval $setvar
18589 $rm_try
18590
18591 : see if there is a wait4
18592 set wait4 d_wait4
18593 eval $inlibc
18594
18595 : see if waitpid exists
18596 set waitpid d_waitpid
18597 eval $inlibc
18598
18599 : see if wcstombs exists
18600 set wcstombs d_wcstombs
18601 eval $inlibc
18602
18603 : see if wctomb exists
18604 set wctomb d_wctomb
18605 eval $inlibc
18606
18607 : see if writev exists
18608 set writev d_writev
18609 eval $inlibc
18610
18611 : preserve RCS keywords in files with variable substitution, grrr
18612 Date='$Date'
18613 Id='$Id'
18614 Log='$Log'
18615 RCSfile='$RCSfile'
18616 Revision='$Revision'
18617
18618 : check for alignment requirements
18619 echo " "
18620 case "$usecrosscompile$multiarch" in
18621 *$define*)
18622         $cat <<EOM
18623 You seem to be either cross-compiling or doing a multiarchitecture build,
18624 skipping the memory alignment check.
18625
18626 EOM
18627         case "$alignbytes" in
18628         '') alignbytes=8 ;;
18629         esac
18630         ;;
18631 *)
18632         case "$alignbytes" in
18633         '') echo "Checking alignment constraints..." >&4
18634                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18635                         $cat >try.c <<'EOCP'
18636 typedef long double NV;
18637 EOCP
18638                 else
18639                         $cat >try.c <<'EOCP'
18640 typedef double NV;
18641 EOCP
18642                 fi
18643                 $cat >>try.c <<'EOCP'
18644 #include <stdio.h>
18645 struct foobar {
18646         char foo;
18647         NV bar;
18648 } try_algn;
18649 int main()
18650 {
18651     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18652     return(0);
18653 }
18654 EOCP
18655                 set try
18656                 if eval $compile_ok; then
18657                         dflt=`$run ./try`
18658                 else
18659                         dflt='8'
18660                         echo "(I can't seem to compile the test program...)"
18661                 fi
18662                 ;;
18663         *) dflt="$alignbytes"
18664                 ;;
18665         esac
18666         rp="Doubles must be aligned on a how-many-byte boundary?"
18667         . ./myread
18668         alignbytes="$ans"
18669         $rm_try
18670         ;;
18671 esac
18672
18673
18674 : set the base revision
18675 baserev=5.0
18676
18677 : how do we concatenate cpp tokens here?
18678 echo " "
18679 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18680 $cat >cpp_stuff.c <<'EOCP'
18681 #define RCAT(a,b)a/**/b
18682 #define ACAT(a,b)a ## b
18683 RCAT(Rei,ser)
18684 ACAT(Cir,cus)
18685 EOCP
18686 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18687 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18688         echo "Oh!  Smells like ANSI's been here." >&4
18689         echo "We can catify or stringify, separately or together!"
18690         cpp_stuff=42
18691 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18692         echo "Ah, yes!  The good old days!" >&4
18693         echo "However, in the good old days we don't know how to stringify and"
18694         echo "catify at the same time."
18695         cpp_stuff=1
18696 else
18697         $cat >&4 <<EOM
18698 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18699 You're going to have to edit the values of CAT[2-5] in config.h...
18700 EOM
18701         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18702 fi
18703 $rm -f cpp_stuff.*
18704
18705 : see if this is a db.h system
18706 set db.h i_db
18707 eval $inhdr
18708
18709 case "$i_db" in
18710 $define)
18711         : Check db version.
18712         echo " "
18713         echo "Checking Berkeley DB version ..." >&4
18714         $cat >try.c <<EOCP
18715 #$d_const HASCONST
18716 #ifndef HASCONST
18717 #define const
18718 #endif
18719 #include <sys/types.h>
18720 #include <stdio.h>
18721 #$i_stdlib I_STDLIB
18722 #ifdef I_STDLIB
18723 #include <stdlib.h>
18724 #endif
18725 #include <db.h>
18726 int main(int argc, char *argv[])
18727 {
18728 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18729     int Major, Minor, Patch ;
18730     unsigned long Version ;
18731     (void)db_version(&Major, &Minor, &Patch) ;
18732     if (argc == 2) {
18733         printf("%d %d %d %d %d %d\n",
18734                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18735                Major, Minor, Patch);
18736         exit(0);
18737     }
18738     printf("You have Berkeley DB Version 2 or greater.\n");
18739
18740     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18741                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18742     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18743                 Major, Minor, Patch) ;
18744
18745     /* check that db.h & libdb are compatible */
18746     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18747         printf("db.h and libdb are incompatible.\n") ;
18748         exit(3);
18749     }
18750
18751     printf("db.h and libdb are compatible.\n") ;
18752
18753     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18754                 + DB_VERSION_PATCH ;
18755
18756     /* needs to be >= 2.3.4 */
18757     if (Version < 2003004) {
18758     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18759         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18760         exit(2);
18761     }
18762
18763     exit(0);
18764 #else
18765 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18766     if (argc == 2) {
18767         printf("1 0 0\n");
18768         exit(0);
18769     }
18770     printf("You have Berkeley DB Version 1.\n");
18771     exit(0);    /* DB version < 2: the coast is clear. */
18772 #else
18773     exit(1);    /* <db.h> not Berkeley DB? */
18774 #endif
18775 #endif
18776 }
18777 EOCP
18778         set try
18779         if eval $compile_ok && $run ./try; then
18780                 echo 'Looks OK.' >&4
18781                 set `$run ./try 1`
18782                 db_version_major=$1
18783                 db_version_minor=$2
18784                 db_version_patch=$3
18785         else
18786                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18787                 i_db=$undef
18788                 case " $libs " in
18789                 *"-ldb "*)
18790                         : Remove db from list of libraries to use
18791                         echo "Removing unusable -ldb from library list" >&4
18792                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18793                         shift
18794                         libs="$*"
18795                         echo "libs = $libs" >&4
18796                         ;;
18797                 esac
18798         fi
18799         $rm_try
18800         ;;
18801 esac
18802
18803 case "$i_db" in
18804 define)
18805         : Check the return type needed for hash
18806         echo " "
18807         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18808         $cat >try.c <<EOCP
18809 #$d_const HASCONST
18810 #ifndef HASCONST
18811 #define const
18812 #endif
18813 #include <sys/types.h>
18814 #include <db.h>
18815
18816 #ifndef DB_VERSION_MAJOR
18817 u_int32_t hash_cb (ptr, size)
18818 const void *ptr;
18819 size_t size;
18820 {
18821 }
18822 HASHINFO info;
18823 int main()
18824 {
18825         info.hash = hash_cb;
18826 }
18827 #endif
18828 EOCP
18829         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18830                 if $contains warning try.out >>/dev/null 2>&1 ; then
18831                         db_hashtype='int'
18832                 else
18833                         db_hashtype='u_int32_t'
18834                 fi
18835         else
18836                 : XXX Maybe we should just give up here.
18837                 db_hashtype=u_int32_t
18838                 $cat try.out >&4
18839                 echo "Help:  I can't seem to compile the db test program." >&4
18840                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18841         fi
18842         $rm_try
18843         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18844         ;;
18845 *)      db_hashtype=u_int32_t
18846         ;;
18847 esac
18848 case "$i_db" in
18849 define)
18850         : Check the return type needed for prefix
18851         echo " "
18852         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18853         cat >try.c <<EOCP
18854 #$d_const HASCONST
18855 #ifndef HASCONST
18856 #define const
18857 #endif
18858 #include <sys/types.h>
18859 #include <db.h>
18860
18861 #ifndef DB_VERSION_MAJOR
18862 size_t prefix_cb (key1, key2)
18863 const DBT *key1;
18864 const DBT *key2;
18865 {
18866 }
18867 BTREEINFO info;
18868 int main()
18869 {
18870         info.prefix = prefix_cb;
18871 }
18872 #endif
18873 EOCP
18874         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18875                 if $contains warning try.out >>/dev/null 2>&1 ; then
18876                         db_prefixtype='int'
18877                 else
18878                         db_prefixtype='size_t'
18879                 fi
18880         else
18881                 db_prefixtype='size_t'
18882                 : XXX Maybe we should just give up here.
18883                 $cat try.out >&4
18884                 echo "Help:  I can't seem to compile the db test program." >&4
18885                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18886         fi
18887         $rm_try
18888         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18889         ;;
18890 *)      db_prefixtype='size_t'
18891         ;;
18892 esac
18893
18894 : How can we generate normalized random numbers ?
18895 echo " "
18896 echo "Looking for a random number function..." >&4
18897 case "$randfunc" in
18898 '')
18899         if set drand48 val -f; eval $csym; $val; then
18900                 dflt="drand48"
18901                 echo "Good, found drand48()." >&4
18902         elif set random val -f; eval $csym; $val; then
18903                 dflt="random"
18904                 echo "OK, found random()." >&4
18905         else
18906                 dflt="rand"
18907                 echo "Yick, looks like I have to use rand()." >&4
18908         fi
18909         echo " "
18910         ;;
18911 *)
18912         dflt="$randfunc"
18913         ;;
18914 esac
18915 cont=true
18916
18917 case "$ccflags" in
18918 *-Dmy_rand=*|*-Dmy_srand=*)
18919         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18920         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18921         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18922         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18923         ;;
18924 esac
18925
18926 while $test "$cont"; do
18927         rp="Use which function to generate random numbers?"
18928         . ./myread
18929         if $test "$ans" = "$dflt"; then
18930                 : null
18931         else
18932                 randbits=''
18933         fi
18934         randfunc="$ans"
18935         if set $ans val -f; eval $csym; $val; then
18936                 cont=''
18937         else
18938                 dflt=y
18939                 rp="I cannot find function $ans. Use that name anyway?"
18940                 . ./myread
18941                 dflt=rand
18942                 case "$ans" in
18943                         [yY]*) cont='';;
18944                 esac
18945         fi
18946         case "$cont" in
18947         '')
18948                 case "$randfunc" in
18949                 drand48)
18950                         drand01="drand48()"
18951                         seedfunc="srand48"
18952                         randbits=48
18953                         randseedtype=long
18954                         ;;
18955                 rand|random)
18956                         case "$randbits" in
18957                         '')
18958 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18959                                 $cat >try.c <<EOCP
18960 #$i_unistd I_UNISTD
18961 #$i_stdlib I_STDLIB
18962 #include <stdio.h>
18963 #ifdef I_UNISTD
18964 #  include <unistd.h>
18965 #endif
18966 #ifdef I_STDLIB
18967 #  include <stdlib.h>
18968 #endif
18969 int main()
18970 {
18971         register int i;
18972         register unsigned long tmp;
18973         register unsigned long max = 0L;
18974
18975         for (i = 1000; i; i--) {
18976                 tmp = (unsigned long) $randfunc();
18977                 if (tmp > max) max = tmp;
18978         }
18979         for (i = 0; max; i++)
18980                 max /= 2;
18981         printf("%d\n",i);
18982 }
18983 EOCP
18984                                 set try
18985                                 if eval $compile_ok; then
18986                                         dflt=`try`
18987                                 else
18988                                         dflt='?'
18989                                         echo "(I can't seem to compile the test program...)"
18990                                 fi
18991                                 ;;
18992                         *)
18993                                 dflt="$randbits"
18994                                 ;;
18995                         esac
18996                         rp="How many bits does your $randfunc() function produce?"
18997                         . ./myread
18998                         randbits="$ans"
18999                         $rm_try
19000                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19001                         seedfunc="s$randfunc"
19002                         randseedtype=unsigned
19003                         ;;
19004                 *)
19005                         dflt="31"
19006                         rp="How many bits does your $randfunc() function produce?"
19007                         . ./myread
19008                         randbits="$ans"
19009                         seedfunc="s$randfunc"
19010                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19011                         if set $seedfunc val -f; eval $csym; $val; then
19012                                 echo "(Using $seedfunc() to seed random generator)"
19013                         else
19014                                 echo "(Warning: no $seedfunc() to seed random generator)"
19015                                 seedfunc=rand
19016                         fi
19017                         randseedtype=unsigned
19018                         ;;
19019                 esac
19020                 ;;
19021         esac
19022 done
19023
19024 : Determine if this is an EBCDIC system
19025 echo " "
19026 echo "Determining whether or not we are on an EBCDIC system..." >&4
19027 $cat >try.c <<'EOM'
19028 int main()
19029 {
19030   if ('M'==0xd4) return 0;
19031   return 1;
19032 }
19033 EOM
19034
19035 val=$undef
19036 set try
19037 if eval $compile_ok; then
19038         if $run ./try; then
19039                 echo "You seem to speak EBCDIC." >&4
19040                 val="$define"
19041         else
19042                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19043         fi
19044 else
19045         echo "I'm unable to compile the test program." >&4
19046         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19047 fi
19048 $rm_try
19049 set ebcdic
19050 eval $setvar
19051
19052 : Check how to flush
19053 echo " "
19054 $cat >&4 <<EOM
19055 Checking how to flush all pending stdio output...
19056 EOM
19057 # I only know how to find the first 32 possibly open files on SunOS.
19058 # See also hints/sunos_4_1.sh and util.c  --AD
19059 case "$osname" in
19060 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19061 esac
19062 $cat >>try.c <<EOCP
19063 #include <stdio.h>
19064 #$i_stdlib I_STDLIB
19065 #ifdef I_STDLIB
19066 #include <stdlib.h>
19067 #endif
19068 #$i_unistd I_UNISTD
19069 #ifdef I_UNISTD
19070 # include <unistd.h>
19071 #endif
19072 #$d_sysconf HAS_SYSCONF
19073 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19074 #ifdef HAS_STDIO_STREAM_ARRAY
19075 # define STDIO_STREAM_ARRAY $stdio_stream_array
19076 #endif
19077 int main() {
19078   FILE* p;
19079   unlink("try.out");
19080   p = fopen("try.out", "w");
19081 #ifdef TRY_FPUTC
19082   fputc('x', p);
19083 #else
19084 # ifdef TRY_FPRINTF
19085   fprintf(p, "x");
19086 # endif
19087 #endif
19088 #ifdef TRY_FFLUSH_NULL
19089   fflush(NULL);
19090 #endif
19091 #ifdef TRY_FFLUSH_ALL
19092   {
19093     long open_max = -1;
19094 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19095     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19096 # else
19097 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19098     open_max = sysconf(_SC_OPEN_MAX);
19099 #  else
19100 #   ifdef FOPEN_MAX
19101     open_max = FOPEN_MAX;
19102 #   else
19103 #    ifdef OPEN_MAX
19104     open_max = OPEN_MAX;
19105 #    else
19106 #     ifdef _NFILE
19107     open_max = _NFILE;
19108 #     endif
19109 #    endif
19110 #   endif
19111 #  endif
19112 # endif
19113 # ifdef HAS_STDIO_STREAM_ARRAY
19114     if (open_max > 0) {
19115       long i;
19116       for (i = 0; i < open_max; i++)
19117             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19118                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19119                 STDIO_STREAM_ARRAY[i]._flag)
19120                 fflush(&STDIO_STREAM_ARRAY[i]);
19121     }
19122   }
19123 # endif
19124 #endif
19125   _exit(42);
19126 }
19127 EOCP
19128 : first we have to find out how _not_ to flush
19129 $to try.c
19130 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19131     output=''
19132     set try -DTRY_FPUTC
19133     if eval $compile; then
19134             $run ./try 2>/dev/null
19135             code="$?"
19136             $from try.out
19137             if $test ! -s try.out -a "X$code" = X42; then
19138                 output=-DTRY_FPUTC
19139             fi
19140     fi
19141     case "$output" in
19142     '')
19143             set try -DTRY_FPRINTF
19144             if eval $compile; then
19145                     $run ./try 2>/dev/null
19146                     code="$?"
19147                     $from try.out
19148                     if $test ! -s try.out -a "X$code" = X42; then
19149                         output=-DTRY_FPRINTF
19150                     fi
19151             fi
19152         ;;
19153     esac
19154 fi
19155 : check for fflush NULL behaviour
19156 case "$fflushNULL" in
19157 '')     set try -DTRY_FFLUSH_NULL $output
19158         if eval $compile; then
19159                 $run ./try 2>/dev/null
19160                 code="$?"
19161                 $from try.out
19162                 if $test -s try.out -a "X$code" = X42; then
19163                         fflushNULL="`$cat try.out`"
19164                 else
19165                         if $test "X$code" != X42; then
19166                                 $cat >&4 <<EOM
19167 (If this test failed, don't worry, we'll try another method shortly.)
19168 EOM
19169                         fi
19170                 fi
19171         fi
19172         $rm -f core try.core core.try.*
19173         case "$fflushNULL" in
19174         x)      $cat >&4 <<EOM
19175 Your fflush(NULL) works okay for output streams.
19176 Let's see if it clobbers input pipes...
19177 EOM
19178 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19179 # bug that improperly flushes the input end of pipes.  So we avoid the
19180 # autoflush on fork/system/exec support for now. :-(
19181 $cat >tryp.c <<EOCP
19182 #include <stdio.h>
19183 int
19184 main(int argc, char **argv)
19185 {
19186     char buf[1024];
19187     int i;
19188     char *bp = buf;
19189     while (1) {
19190         while ((i = getc(stdin)) != -1
19191                && (*bp++ = i) != '\n'
19192                && bp < &buf[1024])
19193         /* DO NOTHING */ ;
19194         *bp = '\0';
19195         fprintf(stdout, "%s", buf);
19196         fflush(NULL);
19197         if (i == -1)
19198             return 0;
19199         bp = buf;
19200     }
19201 }
19202 EOCP
19203                 fflushNULL="$define"
19204                 set tryp
19205                 if eval $compile; then
19206                     $rm -f tryp.out
19207                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19208                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19209                        $cat >&4 <<EOM
19210 fflush(NULL) seems to behave okay with input streams.
19211 EOM
19212                         fflushNULL="$define"
19213                     else
19214                         $cat >&4 <<EOM
19215 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19216 EOM
19217                         fflushNULL="$undef"
19218                     fi
19219                 fi
19220                 $rm -f core tryp.c tryp.core core.tryp.*
19221                 ;;
19222         '')     $cat >&4 <<EOM
19223 Your fflush(NULL) isn't working (contrary to ANSI C).
19224 EOM
19225                 fflushNULL="$undef"
19226                 ;;
19227         *)      $cat >&4 <<EOM
19228 Cannot figure out whether your fflush(NULL) works or not.
19229 I'm assuming it doesn't (contrary to ANSI C).
19230 EOM
19231                 fflushNULL="$undef"
19232                 ;;
19233         esac
19234         ;;
19235 $define|true|[yY]*)
19236         fflushNULL="$define"
19237         ;;
19238 *)
19239         fflushNULL="$undef"
19240         ;;
19241 esac
19242 : check explicit looping only if NULL did not work, and if the pipe
19243 : bug does not show up on an explicit flush too
19244 case "$fflushNULL" in
19245 "$undef")
19246         $cat >tryp.c <<EOCP
19247 #include <stdio.h>
19248 int
19249 main(int argc, char **argv)
19250 {
19251     char buf[1024];
19252     int i;
19253     char *bp = buf;
19254     while (1) {
19255         while ((i = getc(stdin)) != -1
19256                && (*bp++ = i) != '\n'
19257                && bp < &buf[1024])
19258         /* DO NOTHING */ ;
19259         *bp = '\0';
19260         fprintf(stdout, "%s", buf);
19261         fflush(stdin);
19262         if (i == -1)
19263             return 0;
19264         bp = buf;
19265     }
19266 }
19267 EOCP
19268         set tryp
19269         if eval $compile; then
19270             $rm -f tryp.out
19271             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19272             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19273                $cat >&4 <<EOM
19274 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19275 EOM
19276                 : now check for fflushall behaviour
19277                 case "$fflushall" in
19278                 '')     set try -DTRY_FFLUSH_ALL $output
19279                         if eval $compile; then
19280                                 $cat >&4 <<EOM
19281 (Now testing the other method--but note that this also may fail.)
19282 EOM
19283                                 $run ./try 2>/dev/null
19284                                 code=$?
19285                                 $from try.out
19286                                 if $test -s try.out -a "X$code" = X42; then
19287                                         fflushall="`$cat try.out`"
19288                                 fi
19289                         fi
19290                         $rm_try
19291                         case "$fflushall" in
19292                         x)      $cat >&4 <<EOM
19293 Whew. Flushing explicitly all the stdio streams works.
19294 EOM
19295                                 fflushall="$define"
19296                                 ;;
19297                         '')     $cat >&4 <<EOM
19298 Sigh. Flushing explicitly all the stdio streams doesn't work.
19299 EOM
19300                                 fflushall="$undef"
19301                                 ;;
19302                         *)      $cat >&4 <<EOM
19303 Cannot figure out whether flushing stdio streams explicitly works or not.
19304 I'm assuming it doesn't.
19305 EOM
19306                                 fflushall="$undef"
19307                                 ;;
19308                         esac
19309                         ;;
19310                 "$define"|true|[yY]*)
19311                         fflushall="$define"
19312                         ;;
19313                 *)
19314                         fflushall="$undef"
19315                         ;;
19316                 esac
19317             else
19318                 $cat >&4 <<EOM
19319 All is futile.  Even fflush(stdin) clobbers input pipes!
19320 EOM
19321                 fflushall="$undef"
19322             fi
19323         else
19324             fflushall="$undef"
19325         fi
19326         $rm -f core tryp.c tryp.core core.tryp.*
19327         ;;
19328 *)      fflushall="$undef"
19329         ;;
19330 esac
19331
19332 case "$fflushNULL$fflushall" in
19333 undefundef)
19334         $cat <<EOM
19335 OK, I give up.  I cannot figure out how to flush pending stdio output.
19336 We won't be flushing handles at all before fork/exec/popen.
19337 EOM
19338         ;;
19339 esac
19340 $rm_try tryp
19341
19342 : Store the full pathname to the ar program for use in the C program
19343 : Respect a hint or command line value for full_ar.
19344 case "$full_ar" in
19345 '') full_ar=$ar ;;
19346 esac
19347
19348 : Store the full pathname to the sed program for use in the C program
19349 full_sed=$sed
19350
19351 : see what type gids are declared as in the kernel
19352 echo " "
19353 echo "Looking for the type for group ids returned by getgid()."
19354 set gid_t gidtype xxx stdio.h sys/types.h
19355 eval $typedef
19356 case "$gidtype" in
19357 xxx)
19358         xxx=`./findhdr sys/user.h`
19359         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19360         case $1 in
19361         unsigned) dflt="$1 $2" ;;
19362         *) dflt="$1" ;;
19363         esac
19364         ;;
19365 *) dflt="$gidtype";;
19366 esac
19367 case "$gidtype" in
19368 gid_t) echo "gid_t found." ;;
19369 *)      rp="What is the type for group ids returned by getgid()?"
19370         . ./myread
19371         gidtype="$ans"
19372         ;;
19373 esac
19374
19375 : Check the size of GID
19376 echo " "
19377 case "$gidtype" in
19378 *_t) zzz="$gidtype"     ;;
19379 *)   zzz="gid"          ;;
19380 esac
19381 echo "Checking the size of $zzz..." >&4
19382 cat > try.c <<EOCP
19383 #include <sys/types.h>
19384 #include <stdio.h>
19385 #$i_stdlib I_STDLIB
19386 #ifdef I_STDLIB
19387 #include <stdlib.h>
19388 #endif
19389 int main() {
19390     printf("%d\n", (int)sizeof($gidtype));
19391     exit(0);
19392 }
19393 EOCP
19394 set try
19395 if eval $compile_ok; then
19396         yyy=`$run ./try`
19397         case "$yyy" in
19398         '')     gidsize=4
19399                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19400                 ;;
19401         *)      gidsize=$yyy
19402                 echo "Your $zzz is $gidsize bytes long."
19403                 ;;
19404         esac
19405 else
19406         gidsize=4
19407         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19408 fi
19409
19410
19411 : Check if GID is signed
19412 echo " "
19413 case "$gidtype" in
19414 *_t) zzz="$gidtype"     ;;
19415 *)   zzz="gid"          ;;
19416 esac
19417 echo "Checking the sign of $zzz..." >&4
19418 cat > try.c <<EOCP
19419 #include <sys/types.h>
19420 #include <stdio.h>
19421 int main() {
19422         $gidtype foo = -1;
19423         if (foo < 0)
19424                 printf("-1\n");
19425         else
19426                 printf("1\n");
19427 }
19428 EOCP
19429 set try
19430 if eval $compile; then
19431         yyy=`$run ./try`
19432         case "$yyy" in
19433         '')     gidsign=1
19434                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19435                 ;;
19436         *)      gidsign=$yyy
19437                 case "$gidsign" in
19438                  1) echo "Your $zzz is unsigned." ;;
19439                 -1) echo "Your $zzz is signed."   ;;
19440                 esac
19441                 ;;
19442         esac
19443 else
19444         gidsign=1
19445         echo "(I can't compile the test program--guessing unsigned.)" >&4
19446 fi
19447
19448
19449 : Check 64bit sizes
19450 echo " "
19451
19452 if $test X"$quadtype" != X; then
19453
19454 echo "Checking how to print 64-bit integers..." >&4
19455
19456 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19457         $cat >try.c <<'EOCP'
19458 #include <sys/types.h>
19459 #include <stdio.h>
19460 int main() {
19461   int q = 12345678901;
19462   printf("%ld\n", q);
19463 }
19464 EOCP
19465         set try
19466         if eval $compile; then
19467                 yyy=`$run ./try`
19468                 case "$yyy" in
19469                 12345678901)
19470                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19471                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19472                         echo "We will use %d."
19473                         ;;
19474                 esac
19475         fi
19476 fi
19477
19478 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19479         $cat >try.c <<'EOCP'
19480 #include <sys/types.h>
19481 #include <stdio.h>
19482 int main() {
19483   long q = 12345678901;
19484   printf("%ld\n", q);
19485 }
19486 EOCP
19487         set try
19488         if eval $compile; then
19489                 yyy=`$run ./try`
19490                 case "$yyy" in
19491                 12345678901)
19492                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19493                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19494                         echo "We will use %ld."
19495                         ;;
19496                 esac
19497         fi
19498 fi
19499
19500 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19501         $cat >try.c <<'EOCP'
19502 #include <sys/types.h>
19503 #include <inttypes.h>
19504 #include <stdio.h>
19505 int main() {
19506   int64_t q = 12345678901;
19507   printf("%" PRId64 "\n", q);
19508 }
19509 EOCP
19510         set try
19511         if eval $compile; then
19512                 yyy=`$run ./try`
19513                 case "$yyy" in
19514                 12345678901)
19515                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19516                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19517                         echo "We will use the C9X style."
19518                         ;;
19519                 esac
19520         fi
19521 fi
19522
19523 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19524         $cat >try.c <<EOCP
19525 #include <sys/types.h>
19526 #include <stdio.h>
19527 int main() {
19528   $quadtype q = 12345678901;
19529   printf("%Ld\n", q);
19530 }
19531 EOCP
19532         set try
19533         if eval $compile; then
19534                 yyy=`$run ./try`
19535                 case "$yyy" in
19536                 12345678901)
19537                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19538                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19539                         echo "We will use %Ld."
19540                         ;;
19541                 esac
19542         fi
19543 fi
19544
19545 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19546         $cat >try.c <<'EOCP'
19547 #include <sys/types.h>
19548 #include <stdio.h>
19549 int main() {
19550   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19551   printf("%lld\n", q);
19552 }
19553 EOCP
19554         set try
19555         if eval $compile; then
19556                 yyy=`$run ./try`
19557                 case "$yyy" in
19558                 12345678901)
19559                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19560                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19561                         echo "We will use the %lld style."
19562                         ;;
19563                 esac
19564         fi
19565 fi
19566
19567 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19568         $cat >try.c <<EOCP
19569 #include <sys/types.h>
19570 #include <stdio.h>
19571 int main() {
19572   $quadtype q = 12345678901;
19573   printf("%qd\n", q);
19574 }
19575 EOCP
19576         set try
19577         if eval $compile; then
19578                 yyy=`$run ./try`
19579                 case "$yyy" in
19580                 12345678901)
19581                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19582                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19583                         echo "We will use %qd."
19584                         ;;
19585                 esac
19586         fi
19587 fi
19588
19589 if $test X"$sPRId64" = X; then
19590         echo "Cannot figure out how to print 64-bit integers." >&4
19591 fi
19592 $rm_try
19593
19594 fi
19595
19596 case "$sPRId64" in
19597 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19598         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19599         ;;
19600 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19601         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19602         ;;
19603 esac
19604
19605 : Check format strings for internal types
19606 echo " "
19607 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19608
19609 if $test X"$ivsize" = X8; then
19610         ivdformat="$sPRId64"
19611         uvuformat="$sPRIu64"
19612         uvoformat="$sPRIo64"
19613         uvxformat="$sPRIx64"
19614         uvXUformat="$sPRIXU64"
19615 else
19616         if $test X"$ivsize" = X"$longsize"; then
19617                 ivdformat='"ld"'
19618                 uvuformat='"lu"'
19619                 uvoformat='"lo"'
19620                 uvxformat='"lx"'
19621                 uvXUformat='"lX"'
19622         else
19623                 if $test X"$ivsize" = X"$intsize"; then
19624                         ivdformat='"d"'
19625                         uvuformat='"u"'
19626                         uvoformat='"o"'
19627                         uvxformat='"x"'
19628                         uvXUformat='"X"'
19629                 else
19630                         : far out
19631                         if $test X"$ivsize" = X"$shortsize"; then
19632                                 ivdformat='"hd"'
19633                                 uvuformat='"hu"'
19634                                 uvoformat='"ho"'
19635                                 uvxformat='"hx"'
19636                                 uvXUformat='"hX"'
19637                         fi
19638                 fi
19639         fi
19640 fi
19641
19642 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19643         nveformat="$sPRIeldbl"
19644         nvfformat="$sPRIfldbl"
19645         nvgformat="$sPRIgldbl"
19646         nvEUformat="$sPRIEUldbl"
19647         nvFUformat="$sPRIFUldbl"
19648         nvGUformat="$sPRIGUldbl"
19649 else
19650         nveformat='"e"'
19651         nvfformat='"f"'
19652         nvgformat='"g"'
19653         nvEUformat='"E"'
19654         nvFUformat='"F"'
19655         nvGUformat='"G"'
19656 fi
19657
19658 case "$ivdformat" in
19659 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19660     exit 1
19661     ;;
19662 esac
19663
19664 : Check format string for GID
19665
19666 echo " "
19667 $echo "Checking the format string to be used for gids..." >&4
19668
19669 case "$gidsign" in
19670 -1)     if $test X"$gidsize" = X"$ivsize"; then
19671                 gidformat="$ivdformat"
19672         else
19673                 if $test X"$gidsize" = X"$longsize"; then
19674                         gidformat='"ld"'
19675                 else
19676                         if $test X"$gidsize" = X"$intsize"; then
19677                                 gidformat='"d"'
19678                         else
19679                                 if $test X"$gidsize" = X"$shortsize"; then
19680                                         gidformat='"hd"'
19681                                 fi
19682                         fi
19683                 fi
19684         fi
19685         ;;
19686 *)      if $test X"$gidsize" = X"$uvsize"; then
19687                 gidformat="$uvuformat"
19688         else
19689                 if $test X"$gidsize" = X"$longsize"; then
19690                         gidformat='"lu"'
19691                 else
19692                         if $test X"$gidsize" = X"$intsize"; then
19693                                 gidformat='"u"'
19694                         else
19695                                 if $test X"$gidsize" = X"$shortsize"; then
19696                                         gidformat='"hu"'
19697                                 fi
19698                         fi
19699                 fi
19700         fi
19701         ;;
19702 esac
19703
19704 : see if getgroups exists
19705 set getgroups d_getgrps
19706 eval $inlibc
19707
19708 : see if setgroups exists
19709 set setgroups d_setgrps
19710 eval $inlibc
19711
19712 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19713 echo " "
19714 case "$d_getgrps$d_setgrps" in
19715 *define*)
19716         case "$groupstype" in
19717         '') dflt="$gidtype" ;;
19718         *)  dflt="$groupstype" ;;
19719         esac
19720         $cat <<EOM
19721 What type of pointer is the second argument to getgroups() and setgroups()?
19722 Usually this is the same as group ids, $gidtype, but not always.
19723
19724 EOM
19725         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19726         . ./myread
19727         groupstype="$ans"
19728         ;;
19729 *)  groupstype="$gidtype";;
19730 esac
19731
19732 : MAD = Misc Attribute Definition
19733
19734 if $test $patchlevel -lt 9; then
19735 : MAD is not available in 5.8.x or earlier.
19736     ans=n;
19737 else
19738     case "$mad" in
19739     $define|true|[yY]*) dflt='y' ;;
19740     *)                  dflt='n' ;;
19741     esac
19742     cat <<EOM
19743
19744 Would you like to build with Misc Attribute Decoration? This is development
19745 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19746 overhead on the interpreter.
19747
19748 If this doesn't make any sense to you, just accept the default '$dflt'.
19749 EOM
19750     rp='Build Perl with MAD?'
19751     . ./myread
19752 fi
19753 case "$ans" in
19754 y|Y)    val="$define"
19755         madlyh='madly.h madly.act madly.tab'
19756         madlysrc='madly.c'
19757         madlyobj="madly$_o" ;;
19758 *)      val="$undef"
19759         madlyh=''
19760         madlysrc=''
19761         madlyobj='' ;;
19762 esac
19763 set mad
19764 eval $setvar
19765
19766 : check whether make sets MAKE
19767 echo " "
19768 echo "Checking if your $make program sets \$(MAKE)..." >&4
19769 case "$make_set_make" in
19770 '')
19771         $sed 's/^X //' > testmake.mak << 'EOF'
19772 Xall:
19773 X       @echo 'maketemp="$(MAKE)"'
19774 EOF
19775         case "`$make -f testmake.mak 2>/dev/null`" in
19776         *maketemp=*) make_set_make='#' ;;
19777         *)      make_set_make="MAKE=$make" ;;
19778         esac
19779         $rm -f testmake.mak
19780         ;;
19781 esac
19782 case "$make_set_make" in
19783 '#') echo "Yup, it does.";;
19784 *) echo "Nope, it doesn't.";;
19785 esac
19786
19787 : see what type is used for mode_t
19788 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19789 set mode_t modetype int stdio.h sys/types.h
19790 eval $typedef_ask
19791
19792 : see if we need va_copy
19793 echo " "
19794 case "$i_stdarg" in
19795 "$define")
19796         $cat >try.c <<EOCP
19797 #include <stdarg.h>
19798 #include <stdio.h>
19799 #$i_stdlib I_STDLIB
19800 #ifdef I_STDLIB
19801 #include <stdlib.h>
19802 #endif
19803 #include <signal.h>
19804
19805 int
19806 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19807 {
19808   return vfprintf(f, fmt, *valp);
19809 }
19810
19811 int
19812 myvfprintf(FILE *f, const  char *fmt, va_list val)
19813 {
19814   return ivfprintf(f, fmt, &val);
19815 }
19816
19817 int
19818 myprintf(char *fmt, ...)
19819 {
19820   va_list val;
19821   va_start(val, fmt);
19822   return myvfprintf(stdout, fmt, val);
19823 }
19824
19825 int
19826 main(int ac, char **av)
19827 {
19828   signal(SIGSEGV, exit);
19829
19830   myprintf("%s%cs all right, then\n", "that", '\'');
19831   exit(0);
19832 }
19833 EOCP
19834         set try
19835         if eval $compile && $run ./try 2>&1 >/dev/null; then
19836                 case "`$run ./try`" in
19837                 "that's all right, then")
19838                         okay=yes
19839                         ;;
19840                 esac
19841         fi
19842         case "$okay" in
19843         yes)    echo "It seems that you don't need va_copy()." >&4
19844                 need_va_copy="$undef"
19845                 ;;
19846         *)      echo "It seems that va_copy() or similar will be needed." >&4
19847                 need_va_copy="$define"
19848                 ;;
19849         esac
19850         $rm_try
19851         ;;
19852 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19853         ;;
19854 esac
19855
19856 : see what type is used for size_t
19857 rp="What is the type used for the length parameter for string functions?"
19858 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19859 eval $typedef_ask
19860
19861 : check for type of arguments to gethostbyaddr. 
19862 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19863         case "$d_gethbyaddr" in
19864         $define)
19865                 $cat <<EOM
19866
19867 Checking to see what type of arguments are accepted by gethostbyaddr().
19868 EOM
19869                 hdrs="$define sys/types.h
19870                         $d_socket sys/socket.h 
19871                         $i_niin netinet/in.h 
19872                         $i_netdb netdb.h
19873                         $i_unistd unistd.h"
19874                 : The first arg can 'char *' or 'void *'
19875                 : The second arg is some of integral type
19876                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19877                         for yyy in size_t long int; do
19878                                 case "$netdb_host_type" in
19879                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
19880                                         if ./protochk "$try" $hdrs; then
19881                                                 echo "Your system accepts $xxx for the first arg."
19882                                                 echo "...and $yyy for the second arg."
19883                                                 netdb_host_type="$xxx"
19884                                                 netdb_hlen_type="$yyy"
19885                                         fi
19886                                         ;;
19887                                 esac
19888                         done
19889                 done
19890                 : In case none of those worked, prompt the user.
19891                 case "$netdb_host_type" in
19892                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19893                         dflt='char *'
19894                         . ./myread
19895                         netdb_host_type=$ans
19896                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19897                         dflt="$sizetype"
19898                         . ./myread
19899                         netdb_hlen_type=$ans
19900                         ;;
19901                 esac
19902                 ;;
19903         *)      : no gethostbyaddr, so pick harmless defaults
19904                 netdb_host_type='char *'
19905                 netdb_hlen_type="$sizetype"
19906                 ;;
19907         esac
19908         # Remove the "const" if needed. -- but then we'll have a 
19909         # prototype clash!
19910         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19911 fi
19912
19913 : check for type of argument to gethostbyname. 
19914 if test "X$netdb_name_type" = X ; then
19915         case "$d_gethbyname" in
19916         $define)
19917                 $cat <<EOM
19918
19919 Checking to see what type of argument is accepted by gethostbyname().
19920 EOM
19921                 hdrs="$define sys/types.h
19922                         $d_socket sys/socket.h 
19923                         $i_niin netinet/in.h 
19924                         $i_netdb netdb.h
19925                         $i_unistd unistd.h"
19926                 for xxx in "const char *" "char *"; do
19927                         case "$netdb_name_type" in
19928                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
19929                                 if ./protochk "$try" $hdrs; then
19930                                         echo "Your system accepts $xxx."
19931                                         netdb_name_type="$xxx"
19932                                 fi
19933                                 ;;
19934                         esac
19935                 done
19936                 : In case none of those worked, prompt the user.
19937                 case "$netdb_name_type" in
19938                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19939                         dflt='char *'
19940                         . ./myread
19941                         netdb_name_type=$ans
19942                         ;;
19943                 esac
19944                 ;;
19945         *)      : no gethostbyname, so pick harmless default
19946                 netdb_name_type='char *'
19947                 ;;
19948         esac
19949 fi
19950
19951 : check for type of 1st argument to getnetbyaddr. 
19952 if test "X$netdb_net_type" = X ; then
19953         case "$d_getnbyaddr" in
19954         $define)
19955                 $cat <<EOM
19956
19957 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19958 EOM
19959                 hdrs="$define sys/types.h
19960                         $d_socket sys/socket.h 
19961                         $i_niin netinet/in.h 
19962                         $i_netdb netdb.h
19963                         $i_unistd unistd.h"
19964                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19965                         case "$netdb_net_type" in
19966                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
19967                                 if ./protochk "$try" $hdrs; then
19968                                         echo "Your system accepts $xxx."
19969                                         netdb_net_type="$xxx"
19970                                 fi
19971                                 ;;
19972                         esac
19973                 done
19974                 : In case none of those worked, prompt the user.
19975                 case "$netdb_net_type" in
19976                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19977                         dflt='long'
19978                         . ./myread
19979                         netdb_net_type=$ans
19980                         ;;
19981                 esac
19982                 ;;
19983         *)      : no getnetbyaddr, so pick harmless default
19984                 netdb_net_type='long'
19985                 ;;
19986         esac
19987 fi
19988 : locate the preferred pager for this system
19989 fn=f/
19990 case "$pager" in
19991 '')
19992         dflt=''
19993         case "$pg" in
19994         /*) dflt=$pg;;
19995         [a-zA-Z]:/*) dflt=$pg;;
19996         esac
19997         case "$more" in
19998         /*) dflt=$more;;
19999         [a-zA-Z]:/*) dflt=$more;;
20000         esac
20001         case "$less" in
20002         /*) dflt=$less;;
20003         [a-zA-Z]:/*) dflt=$less;;
20004         esac
20005         case "$dflt" in
20006         '') dflt=/usr/ucb/more;;
20007         esac
20008         ;;
20009 *)      dflt="$pager"
20010         fn="f/($pager)"
20011         ;;
20012 esac
20013 echo " "
20014 rp='What pager is used on your system?'
20015 . ./getfile
20016 pager="$ans"
20017
20018 : see what type pids are declared as in the kernel
20019 rp="What is the type of process ids on this system?"
20020 set pid_t pidtype int stdio.h sys/types.h
20021 eval $typedef_ask
20022
20023 : see if ar generates random libraries by itself
20024 echo " "
20025 echo "Checking how to generate random libraries on your machine..." >&4
20026 echo 'int bar1() { return bar2(); }' > bar1.c
20027 echo 'int bar2() { return 2; }' > bar2.c
20028 $cat > foo.c <<EOP
20029 #$i_stdlib I_STDLIB
20030 #ifdef I_STDLIB
20031 #include <stdlib.h>
20032 #endif
20033 int main() { printf("%d\n", bar1()); exit(0); }
20034 EOP
20035 $cc $ccflags -c bar1.c >/dev/null 2>&1
20036 $cc $ccflags -c bar2.c >/dev/null 2>&1
20037 $cc $ccflags -c foo.c >/dev/null 2>&1
20038 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20039 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20040         $run ./foobar >/dev/null 2>&1; then
20041         echo "$ar appears to generate random libraries itself."
20042         orderlib=false
20043         if [ "X$ranlib" = "X" ]; then
20044             ranlib=":"
20045         fi
20046 elif $ar s bar$_a >/dev/null 2>&1 &&
20047         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20048         $run ./foobar >/dev/null 2>&1; then
20049                 echo "a table of contents needs to be added with '$ar s'."
20050                 orderlib=false
20051                 ranlib="$ar s"
20052 elif $ar ts bar$_a >/dev/null 2>&1 &&
20053         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20054         $run ./foobar >/dev/null 2>&1; then
20055                 echo "a table of contents needs to be added with '$ar ts'."
20056                 orderlib=false
20057                 ranlib="$ar ts"
20058 else
20059         case "$ranlib" in
20060         :) ranlib='';;
20061         '')
20062                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20063                 $test -f $ranlib || ranlib=''
20064                 ;;
20065         esac
20066         if $test -n "$ranlib"; then
20067                 echo "your system has '$ranlib'; we'll use that."
20068                 orderlib=false
20069         else
20070                 echo "your system doesn't seem to support random libraries"
20071                 echo "so we'll use lorder and tsort to order the libraries."
20072                 orderlib=true
20073                 ranlib=":"
20074         fi
20075 fi
20076 $rm -f foo* bar*
20077
20078 : see if this is a values.h system
20079 set values.h i_values
20080 eval $inhdr
20081
20082 : Check the max offset that gmtime and localtime accept
20083 echo "Checking max offsets that gmtime () accepts"
20084
20085 case $i_values in
20086     define) yyy="#include <values.h>" ;;
20087     *)      yyy="" ;;
20088     esac
20089
20090 case "$sGMTIME_min/$sGMTIME_max" in
20091     0/0|/)
20092         $cat >try.c <<EOCP
20093 #include <sys/types.h>
20094 #include <stdio.h>
20095 #include <time.h>
20096 $yyy
20097
20098 int i;
20099 struct tm *tmp;
20100 time_t pt;
20101
20102 void gm_check (time_t t, int min_year, int max_year)
20103 {
20104     tmp = gmtime (&t);
20105     if ( tmp == NULL ||
20106         /* Check tm_year overflow */
20107          tmp->tm_year < min_year || tmp->tm_year > max_year)
20108         tmp = NULL;
20109     else
20110         pt = t;
20111     } /* gm_check */
20112
20113 int check_max ()
20114 {
20115     tmp = NULL;
20116     pt  = 0;
20117 #ifdef MAXLONG
20118     gm_check (MAXLONG, 69, 0x7fffffff);
20119 #endif
20120     if (tmp == NULL || tmp->tm_year < 0) {
20121         for (i = 63; i >= 0; i--) {
20122             time_t x = pt | ((time_t)1 << i);
20123             if (x < 0 || x < pt) continue;
20124             gm_check (x, 69, 0x7fffffff);
20125             }
20126         }
20127     printf ("sGMTIME_max=%ld\n", pt);
20128     return (0);
20129     } /* check_max */
20130
20131 int check_min ()
20132 {
20133     tmp = NULL;
20134     pt  = 0;
20135 #ifdef MINLONG
20136     gm_check (MINLONG, -1900, 70);
20137 #endif
20138     if (tmp == NULL) {
20139         for (i = 36; i >= 0; i--) {
20140             time_t x = pt - ((time_t)1 << i);
20141             if (x > 0) continue;
20142             gm_check (x, -1900, 70);
20143             }
20144         }
20145     printf ("sGMTIME_min=%ld\n", pt);
20146     return (0);
20147     } /* check_min */
20148
20149 int main (int argc, char *argv[])
20150 {
20151     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20152     check_max ();
20153     check_min ();
20154     return (0);
20155     } /* main */
20156 EOCP
20157         set try
20158         if eval $compile; then
20159             eval `$run ./try`
20160         else
20161             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20162             fi
20163         $rm_try
20164         ;;
20165     esac
20166
20167 echo "Checking max offsets that localtime () accepts"
20168
20169 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20170     0/0|/)
20171         $cat >try.c <<EOCP
20172 #include <sys/types.h>
20173 #include <stdio.h>
20174 #include <time.h>
20175 $yyy
20176
20177 int i;
20178 struct tm *tmp;
20179 time_t pt;
20180
20181 void local_check (time_t t, int min_year, int max_year)
20182 {
20183     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20184         tmp = NULL;
20185     else
20186         tmp = localtime (&t);
20187     if ( tmp == NULL ||
20188         /* Check tm_year overflow */
20189          tmp->tm_year < min_year || tmp->tm_year > max_year)
20190         tmp = NULL;
20191     else
20192         pt = t;
20193     } /* local_check */
20194
20195 int check_max ()
20196 {
20197     tmp = NULL;
20198     pt  = 0;
20199 #ifdef MAXLONG
20200     local_check (MAXLONG, 69, 0x7fffffff);
20201 #endif
20202     if (tmp == NULL || tmp->tm_year < 0) {
20203         for (i = 63; i >= 0; i--) {
20204             time_t x = pt | ((time_t)1 << i);
20205             if (x < 0 || x < pt) continue;
20206             local_check (x, 69, 0x7fffffff);
20207             }
20208         }
20209     printf ("sLOCALTIME_max=%ld\n", pt);
20210     return (0);
20211    } /* check_max */
20212
20213 int check_min ()
20214 {
20215     tmp = NULL;
20216     pt  = 0;
20217 #ifdef MINLONG
20218     local_check (MINLONG, -1900, 70);
20219 #endif
20220     if (tmp == NULL) {
20221         for (i = 36; i >= 0; i--) {
20222             time_t x = pt - ((time_t)1 << i);
20223             if (x > 0) continue;
20224             local_check (x, -1900, 70);
20225             }
20226         }
20227     printf ("sLOCALTIME_min=%ld\n", pt);
20228     return (0);
20229     } /* check_min */
20230
20231 int main (int argc, char *argv[])
20232 {
20233     check_max ();
20234     check_min ();
20235     return (0);
20236     } /* main */
20237 EOCP
20238         set try
20239         if eval $compile; then
20240             eval `$run ./try`
20241         else
20242             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20243             fi
20244         $rm_try
20245         ;;
20246     esac
20247
20248 : check for type of arguments to select.
20249 case "$selecttype" in
20250 '') case "$d_select" in
20251         $define)
20252                 echo " "
20253                 $cat <<EOM
20254 Checking to see what type of arguments are accepted by select().
20255 EOM
20256                 hdrs="$define sys/types.h
20257                         $i_systime sys/time.h
20258                         $i_sysselct sys/select.h
20259                         $d_socket sys/socket.h"
20260                 : The first arg can be int, unsigned, or size_t
20261                 : The last arg may or may not be 'const'
20262                 val=''
20263                 : void pointer has been seen but using that
20264                 : breaks the selectminbits test
20265                 for xxx in 'fd_set *' 'int *'; do
20266                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20267                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20268                                         case "$val" in
20269                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20270                                                 if ./protochk "$try" $hdrs; then
20271                                                         echo "Your system accepts $xxx."
20272                                                         val="$xxx"
20273                                                 fi
20274                                                 ;;
20275                                         esac
20276                                 done
20277                         done
20278                 done
20279                 case "$val" in
20280                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20281                         case "$d_fd_set" in
20282                                 $define) dflt="fd_set *" ;;
20283                                 *)              dflt="int *" ;;
20284                         esac
20285                         . ./myread
20286                         val=$ans
20287                         ;;
20288                 esac
20289                 selecttype="$val"
20290                 ;;
20291         *)      : no select, so pick a harmless default
20292                 selecttype='int *'
20293                 ;;
20294         esac
20295         ;;
20296 esac
20297
20298 : check for the select 'width'
20299 case "$selectminbits" in
20300 '') safebits=`expr $ptrsize \* 8`
20301     case "$d_select" in
20302         $define)
20303                 $cat <<EOM
20304
20305 Checking to see on how many bits at a time your select() operates...
20306 EOM
20307                 $cat >try.c <<EOCP
20308 #include <sys/types.h>
20309 #$i_time I_TIME
20310 #$i_systime I_SYS_TIME
20311 #$i_systimek I_SYS_TIME_KERNEL
20312 #ifdef I_TIME
20313 #   include <time.h>
20314 #endif
20315 #ifdef I_SYS_TIME
20316 #   ifdef I_SYS_TIME_KERNEL
20317 #       define KERNEL
20318 #   endif
20319 #   include <sys/time.h>
20320 #   ifdef I_SYS_TIME_KERNEL
20321 #       undef KERNEL
20322 #   endif
20323 #endif
20324 #$i_sysselct I_SYS_SELECT
20325 #ifdef I_SYS_SELECT
20326 #include <sys/select.h>
20327 #endif
20328 #$d_socket HAS_SOCKET
20329 #ifdef HAS_SOCKET
20330 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20331 #endif
20332 #include <stdio.h>
20333 #$i_stdlib I_STDLIB
20334 #ifdef I_STDLIB
20335 #include <stdlib.h>
20336 #endif
20337 $selecttype b;
20338 #define S sizeof(*(b))
20339 #define MINBITS 64
20340 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20341 #define NBITS  (NBYTES * 8)
20342 int main() {
20343     char *s = (char *)malloc(NBYTES);
20344     struct timeval t;
20345     int i;
20346     FILE* fp;
20347     int fd;
20348
20349     if (!s)
20350         exit(1);
20351     fclose(stdin);
20352     fp = fopen("try.c", "r");
20353     if (fp == 0)
20354       exit(2);
20355     fd = fileno(fp);
20356     if (fd < 0)
20357       exit(3);
20358     b = ($selecttype)s;
20359     for (i = 0; i < NBITS; i++)
20360         FD_SET(i, b);
20361     t.tv_sec  = 0;
20362     t.tv_usec = 0;
20363     select(fd + 1, b, 0, 0, &t);
20364     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20365     free(s);
20366     printf("%d\n", i + 1);
20367     return 0;
20368 }
20369 EOCP
20370                 set try
20371                 if eval $compile_ok; then
20372                         selectminbits=`$run ./try`
20373                         case "$selectminbits" in
20374                         '')     cat >&4 <<EOM
20375 Cannot figure out on how many bits at a time your select() operates.
20376 I'll play safe and guess it is $safebits bits.
20377 EOM
20378                                 selectminbits=$safebits
20379                                 bits="$safebits bits"
20380                                 ;;
20381                         1)      bits="1 bit" ;;
20382                         *)      bits="$selectminbits bits" ;;
20383                         esac
20384                         echo "Your select() operates on $bits at a time." >&4
20385                 else
20386                         rp='What is the minimum number of bits your select() operates on?'
20387                         case "$byteorder" in
20388                         12345678)       dflt=64 ;;
20389                         1234)           dflt=32 ;;
20390                         *)              dflt=1  ;;
20391                         esac
20392                         . ./myread
20393                         val=$ans
20394                         selectminbits="$val"
20395                 fi
20396                 $rm_try
20397                 ;;
20398         *)      : no select, so pick a harmless default
20399                 selectminbits=$safebits
20400                 ;;
20401         esac
20402         ;;
20403 esac
20404
20405 : Trace out the files included by signal.h, then look for SIGxxx names.
20406 if [ "X$fieldn" = X ]; then
20407         : Just make some guesses.  We check them later.
20408         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20409 else
20410         xxx=`echo '#include <signal.h>' |
20411         $cppstdin $cppminus $cppflags 2>/dev/null |
20412         $grep '^[       ]*#.*include' |
20413         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20414                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20415 fi
20416 xxxfiles=''
20417 for xx in $xxx /dev/null ; do
20418         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20419 done
20420 case "$xxxfiles" in
20421 '')     xxxfiles=`./findhdr signal.h` ;;
20422 esac
20423 xxx=`awk '
20424 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20425         print substr($2, 4, 20)
20426 }
20427 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20428         print substr($3, 4, 20)
20429 }' $xxxfiles`
20430 : Append some common names just in case the awk scan failed.
20431 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20432 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20433 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20434 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20435 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20436
20437 : generate a few handy files for later
20438 $cat > signal.c <<EOCP
20439 #include <sys/types.h>
20440 #include <signal.h>
20441 #$i_stdlib I_STDLIB
20442 #ifdef I_STDLIB
20443 #include <stdlib.h>
20444 #endif
20445 #include <stdio.h>
20446 int main() {
20447
20448 /* Strange style to avoid deeply-nested #if/#else/#endif */
20449 #ifndef NSIG
20450 #  ifdef _NSIG
20451 #    define NSIG (_NSIG)
20452 #  endif
20453 #endif
20454
20455 #ifndef NSIG
20456 #  ifdef SIGMAX
20457 #    define NSIG (SIGMAX+1)
20458 #  endif
20459 #endif
20460
20461 #ifndef NSIG
20462 #  ifdef SIG_MAX
20463 #    define NSIG (SIG_MAX+1)
20464 #  endif
20465 #endif
20466
20467 #ifndef NSIG
20468 #  ifdef _SIG_MAX
20469 #    define NSIG (_SIG_MAX+1)
20470 #  endif
20471 #endif
20472
20473 #ifndef NSIG
20474 #  ifdef MAXSIG
20475 #    define NSIG (MAXSIG+1)
20476 #  endif
20477 #endif
20478
20479 #ifndef NSIG
20480 #  ifdef MAX_SIG
20481 #    define NSIG (MAX_SIG+1)
20482 #  endif
20483 #endif
20484
20485 #ifndef NSIG
20486 #  ifdef SIGARRAYSIZE
20487 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20488 #  endif
20489 #endif
20490
20491 #ifndef NSIG
20492 #  ifdef _sys_nsig
20493 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20494 #  endif
20495 #endif
20496
20497 /* Default to some arbitrary number that's big enough to get most
20498    of the common signals.
20499 */
20500 #ifndef NSIG
20501 #    define NSIG 50
20502 #endif
20503
20504 printf("NSIG %d\n", NSIG);
20505
20506 #ifndef JUST_NSIG
20507
20508 EOCP
20509
20510 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20511 {
20512         printf "#ifdef SIG"; printf $1; printf "\n"
20513         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20514         printf $1; printf ");\n"
20515         printf "#endif\n"
20516 }
20517 END {
20518         printf "#endif /* JUST_NSIG */\n";
20519         printf "exit(0);\n}\n";
20520 }
20521 ' >>signal.c
20522 $cat >signal.awk <<'EOP'
20523 BEGIN { ndups = 0 }
20524 $1 ~ /^NSIG$/ { nsig = $2 }
20525 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20526     if ($2 > maxsig) { maxsig = $2 }
20527     if (sig_name[$2]) {
20528         dup_name[ndups] = $1
20529         dup_num[ndups] = $2
20530         ndups++
20531     }
20532     else {
20533         sig_name[$2] = $1
20534         sig_num[$2] = $2
20535     }
20536 }
20537 END {
20538     if (nsig == 0) {
20539         nsig = maxsig + 1
20540     }
20541     printf("NSIG %d\n", nsig);
20542     for (n = 1; n < nsig; n++) {
20543         if (sig_name[n]) {
20544             printf("%s %d\n", sig_name[n], sig_num[n])
20545         }
20546         else {
20547             printf("NUM%d %d\n", n, n)
20548         }
20549     }
20550     for (n = 0; n < ndups; n++) {
20551         printf("%s %d\n", dup_name[n], dup_num[n])
20552     }
20553 }
20554 EOP
20555 $cat >signal_cmd <<EOS
20556 $startsh
20557 if $test -s signal.lst; then
20558     echo "Using your existing signal.lst file"
20559         exit 0
20560 fi
20561 xxx="$xxx"
20562 EOS
20563 $cat >>signal_cmd <<'EOS'
20564
20565 set signal
20566 if eval $compile_ok; then
20567         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20568                 $uniq | $awk -f signal.awk >signal.lst
20569 else
20570         echo "(I can't seem be able to compile the whole test program)" >&4
20571         echo "(I'll try it in little pieces.)" >&4
20572         set signal -DJUST_NSIG
20573         if eval $compile_ok; then
20574                 $run ./signal$_exe > signal.nsg
20575                 $cat signal.nsg
20576         else
20577                 echo "I can't seem to figure out how many signals you have." >&4
20578                 echo "Guessing 50." >&4
20579                 echo 'NSIG 50' > signal.nsg
20580         fi
20581         : Now look at all the signal names, one at a time.
20582         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20583                 $cat > signal.c <<EOCP
20584 #include <sys/types.h>
20585 #include <signal.h>
20586 #include <stdio.h>
20587 int main() {
20588 printf("$xx %d\n", SIG${xx});
20589 return 0;
20590 }
20591 EOCP
20592                 set signal
20593                 if eval $compile; then
20594                         echo "SIG${xx} found."
20595                         $run ./signal$_exe  >> signal.ls1
20596                 else
20597                         echo "SIG${xx} NOT found."
20598                 fi
20599         done
20600         if $test -s signal.ls1; then
20601                 $cat signal.nsg signal.ls1 |
20602                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20603         fi
20604
20605 fi
20606 if $test -s signal.lst; then
20607         :
20608 else
20609         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20610         echo 'kill -l' >signal
20611         set X `csh -f <signal`
20612         $rm -f signal
20613         shift
20614         case $# in
20615         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20616         esac
20617         echo $@ | $tr ' ' $trnl | \
20618             $awk '{ printf "%s %d\n", $1, ++s; }
20619                   END { printf "NSIG %d\n", ++s }' >signal.lst
20620 fi
20621 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20622 EOS
20623 chmod a+x signal_cmd
20624 $eunicefix signal_cmd
20625
20626 : generate list of signal names
20627 echo " "
20628 case "$sig_name_init" in
20629 '') doinit=yes ;;
20630 *)  case "$sig_num_init" in
20631     ''|*,*) doinit=yes ;;
20632     esac ;;
20633 esac
20634 case "$doinit" in
20635 yes)
20636         echo "Generating a list of signal names and numbers..." >&4
20637         . ./signal_cmd
20638         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20639         sig_name=`$awk 'BEGIN { printf "ZERO " }
20640                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20641         sig_num=`$awk  'BEGIN { printf "0 " }
20642                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20643         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20644                              !/^NSIG/   { printf "\"%s\", ", $1 }
20645                              END        { printf "0\n" }' signal.lst`
20646         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20647                              !/^NSIG/   { printf "%d, ", $2}
20648                              END        { printf "0\n"}' signal.lst`
20649         ;;
20650 esac
20651 echo "The following $sig_count signals are available:"
20652 echo " "
20653 echo $sig_name | $awk \
20654 'BEGIN { linelen = 0 }
20655 {
20656         for (i = 1; i <= NF; i++) {
20657                 name = "SIG" $i " "
20658                 linelen = linelen + length(name)
20659                 if (linelen > 70) {
20660                         printf "\n"
20661                         linelen = length(name)
20662                 }
20663                 printf "%s", name
20664         }
20665         printf "\n"
20666 }'
20667 sig_size=`echo $sig_name | awk '{print NF}'`
20668 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20669
20670 : Check size of size
20671 echo " "
20672 case "$sizetype" in
20673 *_t) zzz="$sizetype"    ;;
20674 *)   zzz="filesize"     ;;
20675 esac
20676 echo "Checking the size of $zzz..." >&4
20677 cat > try.c <<EOCP
20678 #include <sys/types.h>
20679 #include <stdio.h>
20680 #$i_stdlib I_STDLIB
20681 #ifdef I_STDLIB
20682 #include <stdlib.h>
20683 #endif
20684 int main() {
20685     printf("%d\n", (int)sizeof($sizetype));
20686     exit(0);
20687 }
20688 EOCP
20689 set try
20690 if eval $compile_ok; then
20691         yyy=`$run ./try`
20692         case "$yyy" in
20693         '')     sizesize=4
20694                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20695                 ;;
20696         *)      sizesize=$yyy
20697                 echo "Your $zzz size is $sizesize bytes."
20698                 ;;
20699         esac
20700 else
20701         sizesize=4
20702         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20703 fi
20704
20705
20706 : check for socklen_t
20707 echo " "
20708 echo "Checking to see if you have socklen_t..." >&4
20709 $cat >try.c <<EOCP
20710 #include <sys/types.h>
20711 #$d_socket HAS_SOCKET
20712 #ifdef HAS_SOCKET
20713 #include <sys/socket.h>
20714 #endif
20715 int main() { socklen_t x = 16; }
20716 EOCP
20717 set try
20718 if eval $compile; then
20719         val="$define"
20720         echo "You have socklen_t."
20721 else
20722         val="$undef"
20723         echo "You do not have socklen_t."
20724         case "$sizetype" in
20725         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20726         esac
20727 fi
20728 $rm_try
20729 set d_socklen_t
20730 eval $setvar
20731
20732 : see if this is a socks.h system
20733 set socks.h i_socks
20734 eval $inhdr
20735
20736 : check for type of the size argument to socket calls
20737 case "$d_socket" in
20738 "$define")
20739         $cat <<EOM
20740
20741 Checking to see what type is the last argument of accept().
20742 EOM
20743         yyy=''
20744         case "$d_socklen_t" in
20745         "$define") yyy="$yyy socklen_t"
20746         esac
20747         yyy="$yyy $sizetype int long unsigned"
20748         for xxx in $yyy; do
20749                 case "$socksizetype" in
20750                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20751                         case "$usesocks" in
20752                         "$define")
20753                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20754                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20755                                         socksizetype="$xxx"
20756                                 fi
20757                                 ;;
20758                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20759                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20760                                         socksizetype="$xxx"
20761                                 fi
20762                                 ;;
20763                         esac
20764                         ;;
20765                 esac
20766         done
20767 : In case none of those worked, prompt the user.
20768         case "$socksizetype" in
20769         '')     rp='What is the type for socket address structure sizes?'
20770                 dflt='int'
20771                 . ./myread
20772                 socksizetype=$ans
20773                 ;;
20774         esac
20775         ;;
20776 *)      : no sockets, so pick relatively harmless default
20777         socksizetype='int'
20778         ;;
20779 esac
20780
20781 : see what type is used for signed size_t
20782 set ssize_t ssizetype int stdio.h sys/types.h
20783 eval $typedef
20784 dflt="$ssizetype"
20785 $cat > try.c <<EOM
20786 #include <stdio.h>
20787 #$i_stdlib I_STDLIB
20788 #ifdef I_STDLIB
20789 #include <stdlib.h>
20790 #endif
20791 #include <sys/types.h>
20792 #define Size_t $sizetype
20793 #define SSize_t $dflt
20794 int main()
20795 {
20796         if (sizeof(Size_t) == sizeof(SSize_t))
20797                 printf("$dflt\n");
20798         else if (sizeof(Size_t) == sizeof(int))
20799                 printf("int\n");
20800         else
20801                 printf("long\n");
20802         exit(0);
20803 }
20804 EOM
20805 echo " "
20806 set try
20807 if eval $compile_ok && $run ./try > /dev/null; then
20808         ssizetype=`$run ./try`
20809         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20810 else
20811         $cat >&4 <<EOM
20812 Help! I can't compile and run the ssize_t test program: please enlighten me!
20813 (This is probably a misconfiguration in your system or libraries, and
20814 you really ought to fix it.  Still, I'll try anyway.)
20815
20816 I need a type that is the same size as $sizetype, but is guaranteed to
20817 be signed.  Common values are ssize_t, int and long.
20818
20819 EOM
20820         rp="What signed type is the same size as $sizetype?"
20821         . ./myread
20822         ssizetype="$ans"
20823 fi
20824 $rm_try
20825
20826 : see what type of char stdio uses.
20827 echo " "
20828 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20829 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20830         echo "Your stdio uses unsigned chars." >&4
20831         stdchar="unsigned char"
20832 else
20833         echo "Your stdio uses signed chars." >&4
20834         stdchar="char"
20835 fi
20836 $rm -f stdioh
20837
20838 : see what type uids are declared as in the kernel
20839 echo " "
20840 echo "Looking for the type for user ids returned by getuid()."
20841 set uid_t uidtype xxx stdio.h sys/types.h
20842 eval $typedef
20843 case "$uidtype" in
20844 xxx)
20845         xxx=`./findhdr sys/user.h`
20846         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20847         case $1 in
20848         unsigned) dflt="$1 $2" ;;
20849         *) dflt="$1" ;;
20850         esac
20851         ;;
20852 *) dflt="$uidtype";;
20853 esac
20854 case "$uidtype" in
20855 uid_t)  echo "uid_t found." ;;
20856 *)      rp="What is the type for user ids returned by getuid()?"
20857         . ./myread
20858         uidtype="$ans"
20859         ;;
20860 esac
20861
20862 : Check size of UID
20863 echo " "
20864 case "$uidtype" in
20865 *_t) zzz="$uidtype"     ;;
20866 *)   zzz="uid"          ;;
20867 esac
20868 echo "Checking the size of $zzz..." >&4
20869 cat > try.c <<EOCP
20870 #include <sys/types.h>
20871 #include <stdio.h>
20872 #$i_stdlib I_STDLIB
20873 #ifdef I_STDLIB
20874 #include <stdlib.h>
20875 #endif
20876 int main() {
20877     printf("%d\n", (int)sizeof($uidtype));
20878     exit(0);
20879 }
20880 EOCP
20881 set try
20882 if eval $compile_ok; then
20883         yyy=`$run ./try`
20884         case "$yyy" in
20885         '')     uidsize=4
20886                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20887                 ;;
20888         *)      uidsize=$yyy
20889                 echo "Your $zzz is $uidsize bytes long."
20890                 ;;
20891         esac
20892 else
20893         uidsize=4
20894         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20895 fi
20896
20897 : Check if UID is signed
20898 echo " "
20899 case "$uidtype" in
20900 *_t) zzz="$uidtype"     ;;
20901 *)   zzz="uid"          ;;
20902 esac
20903 echo "Checking the sign of $zzz..." >&4
20904 cat > try.c <<EOCP
20905 #include <sys/types.h>
20906 #include <stdio.h>
20907 int main() {
20908         $uidtype foo = -1;
20909         if (foo < 0)
20910                 printf("-1\n");
20911         else
20912                 printf("1\n");
20913 }
20914 EOCP
20915 set try
20916 if eval $compile; then
20917         yyy=`$run ./try`
20918         case "$yyy" in
20919         '')     uidsign=1
20920                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20921                 ;;
20922         *)      uidsign=$yyy
20923                 case "$uidsign" in
20924                  1) echo "Your $zzz is unsigned." ;;
20925                 -1) echo "Your $zzz is signed."   ;;
20926                 esac
20927                 ;;
20928         esac
20929 else
20930         uidsign=1
20931         echo "(I can't compile the test program--guessing unsigned.)" >&4
20932 fi
20933
20934
20935 : Check format string for UID
20936 echo " "
20937 $echo "Checking the format string to be used for uids..." >&4
20938
20939 case "$uidsign" in
20940 -1)     if $test X"$uidsize" = X"$ivsize"; then
20941                 uidformat="$ivdformat"
20942         else
20943                 if $test X"$uidsize" = X"$longsize"; then
20944                         uidformat='"ld"'
20945                 else
20946                         if $test X"$uidsize" = X"$intsize"; then
20947                                 uidformat='"d"'
20948                         else
20949                                 if $test X"$uidsize" = X"$shortsize"; then
20950                                         uidformat='"hd"'
20951                                 fi
20952                         fi
20953                 fi
20954         fi
20955         ;;
20956 *)      if $test X"$uidsize" = X"$uvsize"; then
20957                 uidformat="$uvuformat"
20958         else
20959                 if $test X"$uidsize" = X"$longsize"; then
20960                         uidformat='"lu"'
20961                 else
20962                         if $test X"$uidsize" = X"$intsize"; then
20963                                 uidformat='"u"'
20964                         else
20965                                 if $test X"$uidsize" = X"$shortsize"; then
20966                                         uidformat='"hu"'
20967                                 fi
20968                         fi
20969                 fi
20970         fi
20971         ;;
20972 esac
20973
20974 : Check if site customization support was requested
20975 case "$usesitecustomize" in
20976     $define|true|[Yy]*)
20977         usesitecustomize="$define"
20978         ;;
20979     *)
20980         usesitecustomize="$undef"
20981         ;;
20982     esac
20983
20984 : determine compiler compiler
20985 case "$yacc" in
20986 '')
20987         dflt=yacc;;
20988 *)
20989         dflt="$yacc";;
20990 esac
20991 echo " "
20992 comp='yacc'
20993 if $test -f "$byacc$_exe"; then
20994         dflt="$byacc"
20995         comp="byacc or $comp"
20996 fi
20997 if $test -f "$bison$_exe"; then
20998         comp="$comp or bison -y"
20999 fi
21000 rp="Which compiler compiler ($comp) shall I use?"
21001 . ./myread
21002 yacc="$ans"
21003 case "$yacc" in
21004 *bis*)
21005         case "$yacc" in
21006         *-y*) ;;
21007         *)
21008                 yacc="$yacc -y"
21009                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21010                 ;;
21011         esac
21012         ;;
21013 esac
21014
21015 : see if this is a assert.h system
21016 set assert.h i_assert
21017 eval $inhdr
21018
21019 : see if this is a fp.h system
21020 set fp.h i_fp
21021 eval $inhdr
21022
21023 : see if this is a fp_class.h system
21024 set fp_class.h i_fp_class
21025 eval $inhdr
21026
21027 : see if gdbm.h is available
21028 set gdbm.h t_gdbm
21029 eval $inhdr
21030 case "$t_gdbm" in
21031 $define)
21032         : see if gdbm_open exists
21033         set gdbm_open d_gdbm_open
21034         eval $inlibc
21035         case "$d_gdbm_open" in
21036         $undef)
21037                 t_gdbm="$undef"
21038                 echo "We won't be including <gdbm.h>"
21039                 ;;
21040         esac
21041         ;;
21042 esac
21043 val="$t_gdbm"
21044 set i_gdbm
21045 eval $setvar
21046
21047 : see if ndbm.h is available
21048 set ndbm.h i_ndbm
21049 eval $inhdr
21050 : Compatibility location for RedHat 7.1
21051 set gdbm/ndbm.h i_gdbmndbm
21052 eval $inhdr
21053 : Compatibility location for Debian 4.0
21054 set gdbm-ndbm.h i_gdbm_ndbm
21055 eval $inhdr
21056
21057 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
21058         : see if dbm_open exists
21059         set dbm_open d_dbm_open
21060         eval $inlibc
21061         case "$d_dbm_open" in
21062         $undef)
21063                 i_ndbm="$undef"
21064                 i_gdbmndbm="$undef"
21065                 i_gdbm_ndbm="$undef"
21066                 echo "We won't be including <ndbm.h>"
21067             val="$undef"
21068                 ;;
21069         *) val="$define"
21070            ;;
21071         esac
21072 fi
21073 set d_ndbm
21074 eval $setvar
21075
21076 : see if this is a ieeefp.h system
21077 case "$i_ieeefp" in
21078 '' ) set ieeefp.h i_ieeefp
21079      eval $inhdr
21080      ;;
21081 esac
21082
21083 : see if this is a libutil.h system
21084 set libutil.h i_libutil
21085 eval $inhdr
21086
21087 : see if mach cthreads are available
21088 if test "X$usethreads" = "X$define"; then
21089         set mach/cthreads.h i_machcthr
21090         eval $inhdr
21091 else
21092         i_machcthr="$undef"
21093 fi
21094
21095 : see if this is a mntent.h system
21096 set mntent.h i_mntent
21097 eval $inhdr
21098
21099 : see if net/errno.h is available
21100 val=''
21101 set net/errno.h val
21102 eval $inhdr
21103
21104 : Unfortunately, it causes problems on some systems.  Arrgh.
21105 case "$val" in
21106 $define)
21107         cat > try.c <<'EOM'
21108 #include <stdio.h>
21109 #include <errno.h>
21110 #include <net/errno.h>
21111 int func()
21112 {
21113         return ENOTSOCK;
21114 }
21115 EOM
21116         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21117                 echo "We'll be including <net/errno.h>." >&4
21118         else
21119                 echo "We won't be including <net/errno.h>." >&4
21120                 val="$undef"
21121         fi
21122         $rm_try
21123         ;;
21124 esac
21125 set i_neterrno
21126 eval $setvar
21127
21128 : see if netinet/tcp.h is available
21129 set netinet/tcp.h i_netinettcp
21130 eval $inhdr
21131
21132 : see if this is a poll.h system
21133 set poll.h i_poll
21134 eval $inhdr
21135
21136 : see if this is a prot.h system
21137 set prot.h i_prot
21138 eval $inhdr
21139
21140 : Preprocessor symbols
21141 echo " "
21142 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21143 $cat <<'EOSH' > Cppsym.know
21144 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21145 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21146 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21147 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21148 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21149 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21150 bull c cadmus clipper CMU COFF COMPILER_VERSION
21151 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21152 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21153 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21154 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21155 GLIBC GLIBC_MINOR
21156 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21157 H3050R H3050RX hbullx20 hcx host_mips
21158 hp200 hp300 hp700 HP700 hp800 hp9000
21159 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21160 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21161 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21162 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21163 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21164 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21165 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21166 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21167 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21168 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21169 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21170 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21171 MATH_HAS_NO_SIDE_EFFECTS
21172 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21173 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21174 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21175 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21176 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21177 NetBSD news1500 news1700 news1800 news1900 news3700
21178 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21179 ns32016 ns32332 ns32k nsc32000
21180 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21181 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21182 pc532 pdp11 PGC PIC plexus PORTAR posix
21183 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21184 POSIX_C_SOURCE POSIX_SOURCE POWER
21185 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21186 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21187 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21188 sony sony_news sonyrisc sparc sparclite spectrum
21189 stardent stdc STDC_EXT stratos sun sun3 sun386
21190 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21191 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21192 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21193 sysV68 sysV88 Tek4132 Tek4300 titan
21194 TM3200 TM5400 TM5600
21195 tower tower32 tower32_200 tower32_600 tower32_700
21196 tower32_800 tower32_850 tss
21197 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21198 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21199 unix UNIX95 UNIX99 unixpc unos
21200 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21201 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21202 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21203 USGr4 USGr4_2
21204 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21205 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21206 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21207 z8000
21208 EOSH
21209 # Maybe put other stuff here too.
21210 cat <<EOSH >>Cppsym.know
21211 $osname
21212 EOSH
21213 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21214 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21215 $cat Cppsym.know > Cppsym.c
21216 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21217 $rm -f Cppsym.a Cppsym.b Cppsym.c
21218 cat <<EOSH > Cppsym
21219 $startsh
21220 if $test \$# -gt 0; then
21221     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21222     if $test -s Cppsym.got; then
21223         $rm -f Cppsym.got
21224         exit 0
21225     fi
21226     $rm -f Cppsym.got
21227     exit 1
21228 else
21229     $tr " " "$trnl" | ./Cppsym.try
21230     exit 0
21231 fi
21232 EOSH
21233 chmod +x Cppsym
21234 $eunicefix Cppsym
21235 cat <<EOSH > Cppsym.try
21236 $startsh
21237 cat <<'EOCP' > try.c
21238 #include <stdio.h>
21239 #if cpp_stuff == 1
21240 #define STRINGIFY(a)    "a"
21241 #endif
21242 #if cpp_stuff == 42
21243 #define StGiFy(a)  #a
21244 #define STRINGIFY(a)    StGiFy(a)
21245 #endif
21246 #if $cpp_stuff != 1 && $cpp_stuff != 42
21247 #   include "Bletch: How does this C preprocessor stringify macros?"
21248 #endif
21249 int main() {
21250 EOCP
21251 $awk \\
21252 EOSH
21253 cat <<'EOSH' >> Cppsym.try
21254 'length($1) > 0 {
21255     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21256     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21257     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21258     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21259 }'       >> try.c
21260 echo 'return 0;}' >> try.c
21261 EOSH
21262 cat <<EOSH >> Cppsym.try
21263 ccflags="$ccflags"
21264 case "$osname-$gccversion" in
21265 irix-) ccflags="\$ccflags -woff 1178" ;;
21266 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21267 esac
21268 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21269 EOSH
21270 chmod +x Cppsym.try
21271 $eunicefix Cppsym.try
21272 ./Cppsym < Cppsym.know > Cppsym.true
21273 : Add in any linux cpp "predefined macros":
21274 case "$osname::$gccversion" in
21275   *linux*::*.*)
21276     tHdrH=_tmpHdr
21277     rm -f $tHdrH'.h' $tHdrH
21278     touch $tHdrH'.h'
21279     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21280        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21281        if [ -s $tHdrH'_cppsym.real' ]; then
21282           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21283        fi
21284     fi
21285     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21286   ;;
21287 esac
21288 : now check the C compiler for additional symbols
21289 postprocess_cc_v=''
21290 case "$osname" in
21291 aix) postprocess_cc_v="|$tr , ' '" ;;
21292 esac
21293 $cat >ccsym <<EOS
21294 $startsh
21295 $cat >tmp.c <<EOF
21296 extern int foo;
21297 EOF
21298 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21299 do
21300         case "\$i" in
21301         -D*) echo "\$i" | $sed 's/^-D//';;
21302         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21303         esac
21304 done
21305 $rm_try
21306 EOS
21307 postprocess_cc_v=''
21308 chmod +x ccsym
21309 $eunicefix ccsym
21310 ./ccsym > ccsym1.raw
21311 if $test -s ccsym1.raw; then
21312        $sort ccsym1.raw | $uniq >ccsym.raw
21313 else
21314        mv ccsym1.raw ccsym.raw
21315 fi
21316
21317 $awk '/\=/ { print $0; next }
21318         { print $0"=1" }' ccsym.raw >ccsym.list
21319 $comm -13 Cppsym.true ccsym.list >ccsym.own
21320 $comm -12 Cppsym.true ccsym.list >ccsym.com
21321 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21322 also=''
21323 if $test -z ccsym.raw; then
21324         echo "Your C compiler doesn't seem to define any symbols!" >&4
21325         echo " "
21326         echo "However, your C preprocessor defines the following symbols:"
21327         $cat Cppsym.true
21328         ccsymbols=''
21329         cppsymbols=`$cat Cppsym.true`
21330         cppsymbols=`echo $cppsymbols`
21331         cppccsymbols="$cppsymbols"
21332 else
21333         if $test -s ccsym.com; then
21334                 echo "Your C compiler and pre-processor define these symbols:"
21335                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21336                 also='also '
21337                 symbols='ones'
21338                 cppccsymbols=`$cat ccsym.com`
21339                 cppccsymbols=`echo $cppccsymbols`
21340                 $test "$silent" || sleep 1
21341         fi
21342         if $test -s ccsym.cpp; then
21343                 $test "$also" && echo " "
21344                 echo "Your C pre-processor ${also}defines the following symbols:"
21345                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21346                 also='further '
21347                 cppsymbols=`$cat ccsym.cpp`
21348                 cppsymbols=`echo $cppsymbols`
21349                 $test "$silent" || sleep 1
21350         fi
21351         if $test -s ccsym.own; then
21352                 $test "$also" && echo " "
21353                 echo "Your C compiler ${also}defines the following cpp symbols:"
21354                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21355                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21356                 ccsymbols=`$cat ccsym.own`
21357                 ccsymbols=`echo $ccsymbols`
21358                 $test "$silent" || sleep 1
21359         fi
21360 fi
21361
21362 : see if this is a termio system
21363 val="$undef"
21364 val2="$undef"
21365 val3="$undef"
21366 if $test `./findhdr termios.h`; then
21367         set tcsetattr i_termios
21368         eval $inlibc
21369         val3="$i_termios"
21370 fi
21371 echo " "
21372 case "$val3" in
21373 "$define") echo "You have POSIX termios.h... good!" >&4;;
21374 *) if ./Cppsym pyr; then
21375                 case "`/bin/universe`" in
21376                 ucb) if $test `./findhdr sgtty.h`; then
21377                                 val2="$define"
21378                                 echo "<sgtty.h> found." >&4
21379                         else
21380                                 echo "System is pyramid with BSD universe."
21381                                 ./warn "<sgtty.h> not found--you could have problems."
21382                         fi;;
21383                 *) if $test `./findhdr termio.h`; then
21384                                 val="$define"
21385                                 echo "<termio.h> found." >&4
21386                         else
21387                                 echo "System is pyramid with USG universe."
21388                                 ./warn "<termio.h> not found--you could have problems."
21389                         fi;;
21390                 esac
21391         elif ./usg; then
21392                 if $test `./findhdr termio.h`; then
21393                         echo "<termio.h> found." >&4
21394                         val="$define"
21395                 elif $test `./findhdr sgtty.h`; then
21396                         echo "<sgtty.h> found." >&4
21397                         val2="$define"
21398                 else
21399                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21400                 fi
21401         else
21402                 if $test `./findhdr sgtty.h`; then
21403                         echo "<sgtty.h> found." >&4
21404                         val2="$define"
21405                 elif $test `./findhdr termio.h`; then
21406                         echo "<termio.h> found." >&4
21407                         val="$define"
21408                 else
21409                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21410                 fi
21411         fi;;
21412 esac
21413 set i_termio; eval $setvar
21414 val=$val2; set i_sgtty; eval $setvar
21415 val=$val3; set i_termios; eval $setvar
21416
21417 : see if stddef is available
21418 set stddef.h i_stddef
21419 eval $inhdr
21420
21421 : see if sys/access.h is available
21422 set sys/access.h i_sysaccess
21423 eval $inhdr
21424
21425 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21426 set sys/filio.h i_sysfilio
21427 eval $inhdr
21428 echo " "
21429 if $test `./findhdr sys/ioctl.h`; then
21430         val="$define"
21431         echo '<sys/ioctl.h> found.' >&4
21432 else
21433         val="$undef"
21434         if $test $i_sysfilio = "$define"; then
21435             echo '<sys/ioctl.h> NOT found.' >&4
21436         else
21437                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21438                 $test $i_termio = "$define" && xxx="termio.h"
21439                 $test $i_termios = "$define" && xxx="termios.h"
21440 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21441         fi
21442 fi
21443 set i_sysioctl
21444 eval $setvar
21445
21446 : see if socket ioctl defs are in sys/sockio.h
21447 echo " "
21448 xxx=`./findhdr sys/sockio.h`
21449 if $test "$xxx"; then
21450         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21451                 val="$define"
21452                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21453         else
21454                 val="$undef"
21455                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21456         fi
21457 else
21458         val="$undef"
21459         $cat <<EOM
21460 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21461 EOM
21462 fi
21463 set i_syssockio
21464 eval $setvar
21465
21466 : see if this is a syslog.h system
21467 set syslog.h i_syslog
21468 eval $inhdr
21469
21470 : see if this is a sys/mode.h system
21471 set sys/mode.h i_sysmode
21472 eval $inhdr
21473
21474 : see if there is a sys/poll.h file
21475 set sys/poll.h i_syspoll
21476 eval $inhdr
21477
21478 : see if sys/resource.h has to be included
21479 set sys/resource.h i_sysresrc
21480 eval $inhdr
21481
21482 : see if sys/security.h is available
21483 set sys/security.h i_syssecrt
21484 eval $inhdr
21485
21486 : see if this is a sys/statvfs.h system
21487 set sys/statvfs.h i_sysstatvfs
21488 eval $inhdr
21489
21490 : see if this is a sys/un.h system
21491 set sys/un.h i_sysun
21492 eval $inhdr
21493
21494 : see if this is a sys/utsname.h system
21495 set sys/utsname.h i_sysutsname
21496 eval $inhdr
21497
21498 : see if this is a syswait system
21499 set sys/wait.h i_syswait
21500 eval $inhdr
21501
21502 : see if this is a ustat.h system
21503 set ustat.h i_ustat
21504 eval $inhdr
21505
21506 : see if this is an utime system
21507 set utime.h i_utime
21508 eval $inhdr
21509
21510 : see if this is a vfork system
21511 case "$d_vfork" in
21512 "$define")
21513         set vfork.h i_vfork
21514         eval $inhdr
21515         ;;
21516 *)
21517         i_vfork="$undef"
21518         ;;
21519 esac
21520
21521 : Check extensions
21522 echo " "
21523 echo "Looking for extensions..." >&4
21524 : If we are using the old config.sh, known_extensions may contain
21525 : old or inaccurate or duplicate values.
21526 known_extensions=''
21527 nonxs_extensions=''
21528 : We do not use find because it might not be available.
21529 : We do not just use MANIFEST because the user may have dropped
21530 : some additional extensions into the source tree and expect them
21531 : to be built.
21532
21533 : Function to recursively find available extensions, ignoring DynaLoader
21534 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21535 find_extensions='
21536     for xxx in *; do
21537         case "$xxx" in
21538             DynaLoader|dynaload) ;;
21539             *)
21540             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21541                 known_extensions="$known_extensions $1$xxx";
21542             elif $test -f $xxx/Makefile.PL; then
21543                 nonxs_extensions="$nonxs_extensions $1$xxx";
21544             else
21545                 if $test -d $xxx -a $# -lt 10; then
21546                     set $1$xxx/ $*;
21547                     cd "$xxx";
21548                     eval $find_extensions;
21549                     cd ..;
21550                     shift;
21551                 fi;
21552             fi
21553             ;;
21554         esac;
21555     done'
21556 tdir=`pwd`
21557 cd "$rsrc/ext"
21558 set X
21559 shift
21560 eval $find_extensions
21561 # Special case:  Add in modules that nest beyond the first level.
21562 # Currently threads/shared and Hash/Util/FieldHash, since they are
21563 # not picked up by the recursive find above (and adding in general
21564 # recursive finding breaks SDBM_File/sdbm).
21565 # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21566 known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21567 set X $known_extensions
21568 shift
21569 known_extensions="$*"
21570 set X $nonxs_extensions
21571 shift
21572 nonxs_extensions="$*"
21573 cd "$tdir"
21574
21575 : Now see which are supported on this system.
21576 avail_ext=''
21577 for xxx in $known_extensions ; do
21578         case "$xxx" in
21579         DB_File|db_file)
21580                 case "$i_db" in
21581                 $define) avail_ext="$avail_ext $xxx" ;;
21582                 esac
21583                 ;;
21584         GDBM_File|gdbm_fil)
21585                 case "$i_gdbm" in
21586                 $define) avail_ext="$avail_ext $xxx" ;;
21587                 esac
21588                 ;;
21589         I18N/Langinfo|i18n_lan)
21590                 case "$i_langinfo$d_nl_langinfo" in
21591                 $define$define) avail_ext="$avail_ext $xxx" ;;
21592                 esac
21593                 ;;
21594         IPC/SysV|ipc/sysv)
21595                 : XXX Do we need a useipcsysv variable here
21596                 case "${d_msg}${d_sem}${d_shm}" in
21597                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21598                 esac
21599                 ;;
21600         NDBM_File|ndbm_fil)
21601                 case "$i_ndbm" in
21602                 $define)
21603                     case "$osname-$use64bitint" in
21604                     hpux-define)
21605                         case "$libs" in
21606                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21607                         esac
21608                         ;;
21609                     *) avail_ext="$avail_ext $xxx" ;;
21610                     esac
21611                     ;;
21612                 esac
21613                 ;;
21614         ODBM_File|odbm_fil)
21615                 case "${i_dbm}${i_rpcsvcdbm}" in
21616                 *"${define}"*)
21617                     case "$d_cplusplus" in
21618                     define) ;; # delete as a function name will not work
21619                     *)  case "$osname-$use64bitint" in
21620                         hpux-define)
21621                             case "$libs" in
21622                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21623                             esac
21624                             ;;
21625                         *) avail_ext="$avail_ext $xxx" ;;
21626                         esac
21627                         ;;
21628                     esac
21629                     ;;
21630                 esac
21631                 ;;
21632         Opcode|opcode)
21633                 case "$useopcode" in
21634                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21635                 esac
21636                 ;;
21637         POSIX|posix)
21638                 case "$useposix" in
21639                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21640                 esac
21641                 ;;
21642         Socket|socket)
21643                 case "$d_socket" in
21644                 true|$define|y)
21645                     case "$osname" in
21646                     beos) ;; # not unless BONE
21647                     *) avail_ext="$avail_ext $xxx" ;;
21648                     esac
21649                     ;;
21650                 esac
21651                 ;;
21652         Sys/Syslog|sys/syslog)
21653                 : XXX syslog requires socket
21654                 case "$d_socket" in
21655                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21656                 esac
21657                 ;;
21658         Thread|thread)
21659                 case "$usethreads" in
21660                 true|$define|y)
21661                         case "$use5005threads" in
21662                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21663                         esac
21664                 esac
21665                 ;;
21666         threads|threads/shared)
21667                 # threads and threads::shared are special cases.
21668                 # To stop people from asking "Perl 5.8.0 was supposed
21669                 # to have this new fancy threads implementation but my
21670                 # perl doesn't have it" and from people trying to
21671                 # (re)install the threads module using CPAN.pm and
21672                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21673                 # the threads.pm and threads/shared.pm will always be
21674                 # there, croaking informatively ("you need to rebuild
21675                 # all of Perl with threads, sorry") when threads haven't
21676                 # been compiled in.
21677                 # --jhi
21678                 avail_ext="$avail_ext $xxx"
21679                 ;;
21680         Win32*)
21681                 case "$osname" in
21682                 cygwin) avail_ext="$avail_ext $xxx" ;;
21683                 esac
21684                 ;;
21685         XS/APItest|xs/apitest)
21686                 # This is just for testing.  Skip it unless we have dynamic loading.
21687
21688                 case "$usedl" in
21689                 $define) avail_ext="$avail_ext $xxx" ;;
21690                 esac
21691                 ;;
21692         XS/Typemap|xs/typemap)
21693                 # This is just for testing.  Skip it unless we have dynamic loading.
21694                 case "$usedl" in
21695                 $define) avail_ext="$avail_ext $xxx" ;;
21696                 esac
21697                 ;;
21698         *)      avail_ext="$avail_ext $xxx"
21699                 ;;
21700         esac
21701 done
21702
21703 set X $avail_ext
21704 shift
21705 avail_ext="$*"
21706
21707 case "$onlyextensions" in
21708 '') ;;
21709 *)  keepextensions=''
21710     echo "You have requested that only certains extensions be included..." >&4
21711     for i in $onlyextensions; do
21712         case " $avail_ext " in
21713         *" $i "*)
21714             echo "Keeping extension $i."
21715             keepextensions="$keepextensions $i"
21716             ;;
21717         *) echo "Ignoring extension $i." ;;
21718         esac
21719     done
21720     avail_ext="$keepextensions"
21721     ;;
21722 esac
21723
21724 case "$noextensions" in
21725 '') ;;
21726 *)  keepextensions=''
21727     echo "You have requested that certain extensions be ignored..." >&4
21728     for i in $avail_ext; do
21729         case " $noextensions " in
21730         *" $i "*) echo "Ignoring extension $i." ;;
21731         *) echo "Keeping extension $i.";
21732            keepextensions="$keepextensions $i"
21733            ;;
21734         esac
21735     done
21736     avail_ext="$keepextensions"
21737     ;;
21738 esac
21739
21740 : Now see which nonxs extensions are supported on this system.
21741 : For now assume all are.
21742 nonxs_ext=''
21743 for xxx in $nonxs_extensions ; do
21744         case "$xxx" in
21745         *)      nonxs_ext="$nonxs_ext $xxx"
21746                 ;;
21747         esac
21748 done
21749
21750 set X $nonxs_ext
21751 shift
21752 nonxs_ext="$*"
21753
21754 case $usedl in
21755 $define)
21756         $cat <<EOM
21757 A number of extensions are supplied with $package.  You may choose to
21758 compile these extensions for dynamic loading (the default), compile
21759 them into the $package executable (static loading), or not include
21760 them at all.  Answer "none" to include no extensions.
21761 Note that DynaLoader is always built and need not be mentioned here.
21762
21763 EOM
21764         case "$dynamic_ext" in
21765         '')
21766                 : Exclude those listed in static_ext
21767                 dflt=''
21768                 for xxx in $avail_ext; do
21769                         case " $static_ext " in
21770                         *" $xxx "*) ;;
21771                         *) dflt="$dflt $xxx" ;;
21772                         esac
21773                 done
21774                 set X $dflt
21775                 shift
21776                 dflt="$*"
21777                 ;;
21778         *)      dflt="$dynamic_ext"
21779                 # Perhaps we are reusing an old out-of-date config.sh.
21780                 case "$hint" in
21781                 previous)
21782                         if test X"$dynamic_ext" != X"$avail_ext"; then
21783                                 $cat <<EOM
21784 NOTICE:  Your previous config.sh list may be incorrect.
21785 The extensions now available to you are
21786         ${avail_ext}
21787 but the default list from your previous config.sh is
21788         ${dynamic_ext}
21789
21790 EOM
21791                         fi
21792                         ;;
21793                 esac
21794                 ;;
21795         esac
21796         case "$dflt" in
21797         '')     dflt=none;;
21798         esac
21799         rp="What extensions do you wish to load dynamically?"
21800         . ./myread
21801         case "$ans" in
21802         none) dynamic_ext=' ' ;;
21803         *) dynamic_ext="$ans" ;;
21804         esac
21805
21806         case "$static_ext" in
21807         '')
21808                 : Exclude those already listed in dynamic linking
21809                 dflt=''
21810                 for xxx in $avail_ext; do
21811                         case " $dynamic_ext " in
21812                         *" $xxx "*) ;;
21813                         *) dflt="$dflt $xxx" ;;
21814                         esac
21815                 done
21816                 set X $dflt
21817                 shift
21818                 dflt="$*"
21819                 ;;
21820         *)  dflt="$static_ext"
21821                 ;;
21822         esac
21823
21824         case "$dflt" in
21825         '')     dflt=none;;
21826         esac
21827         rp="What extensions do you wish to load statically?"
21828         . ./myread
21829         case "$ans" in
21830         none) static_ext=' ' ;;
21831         *) static_ext="$ans" ;;
21832         esac
21833         ;;
21834 *)
21835         $cat <<EOM
21836 A number of extensions are supplied with $package.  Answer "none"
21837 to include no extensions.
21838 Note that DynaLoader is always built and need not be mentioned here.
21839
21840 EOM
21841         case "$static_ext" in
21842         '') dflt="$avail_ext" ;;
21843         *)      dflt="$static_ext"
21844                 # Perhaps we are reusing an old out-of-date config.sh.
21845                 case "$hint" in
21846                 previous)
21847                         if test X"$static_ext" != X"$avail_ext"; then
21848                                 $cat <<EOM
21849 NOTICE:  Your previous config.sh list may be incorrect.
21850 The extensions now available to you are
21851         ${avail_ext}
21852 but the default list from your previous config.sh is
21853         ${static_ext}
21854
21855 EOM
21856                         fi
21857                         ;;
21858                 esac
21859                 ;;
21860         esac
21861         : Exclude those that are not xs extensions
21862         case "$dflt" in
21863         '')     dflt=none;;
21864         esac
21865         rp="What extensions do you wish to include?"
21866         . ./myread
21867         case "$ans" in
21868         none) static_ext=' ' ;;
21869         *) static_ext="$ans" ;;
21870         esac
21871         ;;
21872 esac
21873 #
21874 # Encode is a special case.  If we are building Encode as a static
21875 # extension, we need to explicitly list its subextensions as well.
21876 # For other nested extensions, this is handled automatically by
21877 # the appropriate Makefile.PL.
21878 case " $static_ext " in
21879         *" Encode "*) # Add the subextensions of Encode
21880         cd "$rsrc/ext"
21881         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21882                 static_ext="$static_ext Encode/$xxx"
21883         done
21884         cd "$tdir"
21885         ;;
21886 esac
21887
21888 set X $dynamic_ext $static_ext $nonxs_ext
21889 shift
21890 extensions="$*"
21891
21892 # Sanity check:  We require an extension suitable for use with
21893 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21894 # should show up as failures in the test suite, but it's helpful to
21895 # catch them now.) The 'extensions' list is normally sorted
21896 # alphabetically, so we need to accept either
21897 #    DB_File ... Fcntl ... IO  ....
21898 # or something like
21899 #    Fcntl ... NDBM_File ... IO  ....
21900 case " $extensions"  in
21901 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21902 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21903 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21904 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21905    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21906    ;;
21907 esac
21908
21909 : Remove libraries needed only for extensions
21910 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21911 : The exception is SunOS 4.x, which needs them.
21912 case "${osname}X${osvers}" in
21913 sunos*X4*)
21914     perllibs="$libs"
21915     ;;
21916 *) case "$usedl" in
21917     $define|true|[yY]*)
21918             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21919             shift
21920             perllibs="$*"
21921             ;;
21922     *)  perllibs="$libs"
21923             ;;
21924     esac
21925     ;;
21926 esac
21927
21928 : Remove build directory name from cppstdin so it can be used from
21929 : either the present location or the final installed location.
21930 echo " "
21931 : Get out of the UU directory to get correct path name.
21932 cd ..
21933 case "$cppstdin" in
21934 `pwd`/cppstdin)
21935         echo "Stripping down cppstdin path name"
21936         cppstdin=cppstdin
21937         ;;
21938 esac
21939 cd UU
21940
21941 : end of configuration questions
21942 echo " "
21943 echo "End of configuration questions."
21944 echo " "
21945
21946 : back to where it started
21947 if test -d ../UU; then
21948         cd ..
21949 fi
21950
21951 : configuration may be unconditionally patched via a 'config.arch' file
21952 if $test -f config.arch; then
21953         echo "I see a config.arch file, loading it." >&4
21954         . ./config.arch
21955 fi
21956
21957 : configuration may be patched via a 'config.over' file
21958 if $test -f config.over; then
21959         echo " "
21960         dflt=y
21961         rp='I see a config.over file.  Do you wish to load it?'
21962         . UU/myread
21963         case "$ans" in
21964         n*) echo "OK, I'll ignore it.";;
21965         *)      . ./config.over
21966                 echo "Configuration override changes have been loaded."
21967                 ;;
21968         esac
21969 fi
21970
21971 : in case they want portability, strip down executable paths
21972 case "$d_portable" in
21973 "$define")
21974         echo " "
21975         echo "Stripping down executable paths..." >&4
21976         for file in $loclist $trylist; do
21977                 eval temp=\$$file
21978                 eval $file=`basename $temp`
21979         done
21980         ;;
21981 esac
21982
21983 : create config.sh file
21984 echo " "
21985 echo "Creating config.sh..." >&4
21986 $spitshell <<EOT >config.sh
21987 $startsh
21988 #
21989 # This file was produced by running the Configure script. It holds all the
21990 # definitions figured out by Configure. Should you modify one of these values,
21991 # do not forget to propagate your changes by running "Configure -der". You may
21992 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21993 #
21994
21995 # Package name      : $package
21996 # Source directory  : $src
21997 # Configuration time: $cf_time
21998 # Configured by     : $cf_by
21999 # Target system     : $myuname
22000
22001 EOT
22002 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22003 $spitshell <<EOT >>config.sh
22004
22005 Author='$Author'
22006 Date='$Date'
22007 Header='$Header'
22008 Id='$Id'
22009 Locker='$Locker'
22010 Log='$Log'
22011 RCSfile='$RCSfile'
22012 Revision='$Revision'
22013 Source='$Source'
22014 State='$State'
22015 _a='$_a'
22016 _exe='$_exe'
22017 _o='$_o'
22018 afs='$afs'
22019 afsroot='$afsroot'
22020 alignbytes='$alignbytes'
22021 ansi2knr='$ansi2knr'
22022 aphostname='$aphostname'
22023 api_revision='$api_revision'
22024 api_subversion='$api_subversion'
22025 api_version='$api_version'
22026 api_versionstring='$api_versionstring'
22027 ar='$ar'
22028 archlib='$archlib'
22029 archlibexp='$archlibexp'
22030 archname64='$archname64'
22031 archname='$archname'
22032 archobjs='$archobjs'
22033 asctime_r_proto='$asctime_r_proto'
22034 awk='$awk'
22035 baserev='$baserev'
22036 bash='$bash'
22037 bin='$bin'
22038 binexp='$binexp'
22039 bison='$bison'
22040 byacc='$byacc'
22041 byteorder='$byteorder'
22042 c='$c'
22043 castflags='$castflags'
22044 cat='$cat'
22045 cc='$cc'
22046 cccdlflags='$cccdlflags'
22047 ccdlflags='$ccdlflags'
22048 ccflags='$ccflags'
22049 ccflags_uselargefiles='$ccflags_uselargefiles'
22050 ccname='$ccname'
22051 ccsymbols='$ccsymbols'
22052 ccversion='$ccversion'
22053 cf_by='$cf_by'
22054 cf_email='$cf_email'
22055 cf_time='$cf_time'
22056 chgrp='$chgrp'
22057 chmod='$chmod'
22058 chown='$chown'
22059 clocktype='$clocktype'
22060 comm='$comm'
22061 compress='$compress'
22062 contains='$contains'
22063 cp='$cp'
22064 cpio='$cpio'
22065 cpp='$cpp'
22066 cpp_stuff='$cpp_stuff'
22067 cppccsymbols='$cppccsymbols'
22068 cppflags='$cppflags'
22069 cpplast='$cpplast'
22070 cppminus='$cppminus'
22071 cpprun='$cpprun'
22072 cppstdin='$cppstdin'
22073 cppsymbols='$cppsymbols'
22074 crypt_r_proto='$crypt_r_proto'
22075 cryptlib='$cryptlib'
22076 csh='$csh'
22077 ctermid_r_proto='$ctermid_r_proto'
22078 ctime_r_proto='$ctime_r_proto'
22079 d_Gconvert='$d_Gconvert'
22080 d_PRIEUldbl='$d_PRIEUldbl'
22081 d_PRIFUldbl='$d_PRIFUldbl'
22082 d_PRIGUldbl='$d_PRIGUldbl'
22083 d_PRIXU64='$d_PRIXU64'
22084 d_PRId64='$d_PRId64'
22085 d_PRIeldbl='$d_PRIeldbl'
22086 d_PRIfldbl='$d_PRIfldbl'
22087 d_PRIgldbl='$d_PRIgldbl'
22088 d_PRIi64='$d_PRIi64'
22089 d_PRIo64='$d_PRIo64'
22090 d_PRIu64='$d_PRIu64'
22091 d_PRIx64='$d_PRIx64'
22092 d_SCNfldbl='$d_SCNfldbl'
22093 d__fwalk='$d__fwalk'
22094 d_access='$d_access'
22095 d_accessx='$d_accessx'
22096 d_aintl='$d_aintl'
22097 d_alarm='$d_alarm'
22098 d_archlib='$d_archlib'
22099 d_asctime64='$d_asctime64'
22100 d_asctime_r='$d_asctime_r'
22101 d_atolf='$d_atolf'
22102 d_atoll='$d_atoll'
22103 d_attribute_format='$d_attribute_format'
22104 d_attribute_malloc='$d_attribute_malloc'
22105 d_attribute_nonnull='$d_attribute_nonnull'
22106 d_attribute_noreturn='$d_attribute_noreturn'
22107 d_attribute_pure='$d_attribute_pure'
22108 d_attribute_unused='$d_attribute_unused'
22109 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22110 d_bcmp='$d_bcmp'
22111 d_bcopy='$d_bcopy'
22112 d_bsd='$d_bsd'
22113 d_bsdgetpgrp='$d_bsdgetpgrp'
22114 d_bsdsetpgrp='$d_bsdsetpgrp'
22115 d_builtin_choose_expr='$d_builtin_choose_expr'
22116 d_builtin_expect='$d_builtin_expect'
22117 d_bzero='$d_bzero'
22118 d_c99_variadic_macros='$d_c99_variadic_macros'
22119 d_casti32='$d_casti32'
22120 d_castneg='$d_castneg'
22121 d_charvspr='$d_charvspr'
22122 d_chown='$d_chown'
22123 d_chroot='$d_chroot'
22124 d_chsize='$d_chsize'
22125 d_class='$d_class'
22126 d_clearenv='$d_clearenv'
22127 d_closedir='$d_closedir'
22128 d_cmsghdr_s='$d_cmsghdr_s'
22129 d_const='$d_const'
22130 d_copysignl='$d_copysignl'
22131 d_cplusplus='$d_cplusplus'
22132 d_crypt='$d_crypt'
22133 d_crypt_r='$d_crypt_r'
22134 d_csh='$d_csh'
22135 d_ctermid='$d_ctermid'
22136 d_ctermid_r='$d_ctermid_r'
22137 d_ctime64='$d_ctime64'
22138 d_ctime_r='$d_ctime_r'
22139 d_cuserid='$d_cuserid'
22140 d_dbl_dig='$d_dbl_dig'
22141 d_dbminitproto='$d_dbminitproto'
22142 d_difftime64='$d_difftime64'
22143 d_difftime='$d_difftime'
22144 d_dir_dd_fd='$d_dir_dd_fd'
22145 d_dirfd='$d_dirfd'
22146 d_dirnamlen='$d_dirnamlen'
22147 d_dlerror='$d_dlerror'
22148 d_dlopen='$d_dlopen'
22149 d_dlsymun='$d_dlsymun'
22150 d_dosuid='$d_dosuid'
22151 d_drand48_r='$d_drand48_r'
22152 d_drand48proto='$d_drand48proto'
22153 d_dup2='$d_dup2'
22154 d_eaccess='$d_eaccess'
22155 d_endgrent='$d_endgrent'
22156 d_endgrent_r='$d_endgrent_r'
22157 d_endhent='$d_endhent'
22158 d_endhostent_r='$d_endhostent_r'
22159 d_endnent='$d_endnent'
22160 d_endnetent_r='$d_endnetent_r'
22161 d_endpent='$d_endpent'
22162 d_endprotoent_r='$d_endprotoent_r'
22163 d_endpwent='$d_endpwent'
22164 d_endpwent_r='$d_endpwent_r'
22165 d_endsent='$d_endsent'
22166 d_endservent_r='$d_endservent_r'
22167 d_eofnblk='$d_eofnblk'
22168 d_eunice='$d_eunice'
22169 d_faststdio='$d_faststdio'
22170 d_fchdir='$d_fchdir'
22171 d_fchmod='$d_fchmod'
22172 d_fchown='$d_fchown'
22173 d_fcntl='$d_fcntl'
22174 d_fcntl_can_lock='$d_fcntl_can_lock'
22175 d_fd_macros='$d_fd_macros'
22176 d_fd_set='$d_fd_set'
22177 d_fds_bits='$d_fds_bits'
22178 d_fgetpos='$d_fgetpos'
22179 d_finite='$d_finite'
22180 d_finitel='$d_finitel'
22181 d_flexfnam='$d_flexfnam'
22182 d_flock='$d_flock'
22183 d_flockproto='$d_flockproto'
22184 d_fork='$d_fork'
22185 d_fp_class='$d_fp_class'
22186 d_fpathconf='$d_fpathconf'
22187 d_fpclass='$d_fpclass'
22188 d_fpclassify='$d_fpclassify'
22189 d_fpclassl='$d_fpclassl'
22190 d_fpos64_t='$d_fpos64_t'
22191 d_frexpl='$d_frexpl'
22192 d_fs_data_s='$d_fs_data_s'
22193 d_fseeko='$d_fseeko'
22194 d_fsetpos='$d_fsetpos'
22195 d_fstatfs='$d_fstatfs'
22196 d_fstatvfs='$d_fstatvfs'
22197 d_fsync='$d_fsync'
22198 d_ftello='$d_ftello'
22199 d_ftime='$d_ftime'
22200 d_futimes='$d_futimes'
22201 d_getcwd='$d_getcwd'
22202 d_getespwnam='$d_getespwnam'
22203 d_getfsstat='$d_getfsstat'
22204 d_getgrent='$d_getgrent'
22205 d_getgrent_r='$d_getgrent_r'
22206 d_getgrgid_r='$d_getgrgid_r'
22207 d_getgrnam_r='$d_getgrnam_r'
22208 d_getgrps='$d_getgrps'
22209 d_gethbyaddr='$d_gethbyaddr'
22210 d_gethbyname='$d_gethbyname'
22211 d_gethent='$d_gethent'
22212 d_gethname='$d_gethname'
22213 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22214 d_gethostbyname_r='$d_gethostbyname_r'
22215 d_gethostent_r='$d_gethostent_r'
22216 d_gethostprotos='$d_gethostprotos'
22217 d_getitimer='$d_getitimer'
22218 d_getlogin='$d_getlogin'
22219 d_getlogin_r='$d_getlogin_r'
22220 d_getmnt='$d_getmnt'
22221 d_getmntent='$d_getmntent'
22222 d_getnbyaddr='$d_getnbyaddr'
22223 d_getnbyname='$d_getnbyname'
22224 d_getnent='$d_getnent'
22225 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22226 d_getnetbyname_r='$d_getnetbyname_r'
22227 d_getnetent_r='$d_getnetent_r'
22228 d_getnetprotos='$d_getnetprotos'
22229 d_getpagsz='$d_getpagsz'
22230 d_getpbyname='$d_getpbyname'
22231 d_getpbynumber='$d_getpbynumber'
22232 d_getpent='$d_getpent'
22233 d_getpgid='$d_getpgid'
22234 d_getpgrp2='$d_getpgrp2'
22235 d_getpgrp='$d_getpgrp'
22236 d_getppid='$d_getppid'
22237 d_getprior='$d_getprior'
22238 d_getprotobyname_r='$d_getprotobyname_r'
22239 d_getprotobynumber_r='$d_getprotobynumber_r'
22240 d_getprotoent_r='$d_getprotoent_r'
22241 d_getprotoprotos='$d_getprotoprotos'
22242 d_getprpwnam='$d_getprpwnam'
22243 d_getpwent='$d_getpwent'
22244 d_getpwent_r='$d_getpwent_r'
22245 d_getpwnam_r='$d_getpwnam_r'
22246 d_getpwuid_r='$d_getpwuid_r'
22247 d_getsbyname='$d_getsbyname'
22248 d_getsbyport='$d_getsbyport'
22249 d_getsent='$d_getsent'
22250 d_getservbyname_r='$d_getservbyname_r'
22251 d_getservbyport_r='$d_getservbyport_r'
22252 d_getservent_r='$d_getservent_r'
22253 d_getservprotos='$d_getservprotos'
22254 d_getspnam='$d_getspnam'
22255 d_getspnam_r='$d_getspnam_r'
22256 d_gettimeod='$d_gettimeod'
22257 d_gmtime64='$d_gmtime64'
22258 d_gmtime_r='$d_gmtime_r'
22259 d_gnulibc='$d_gnulibc'
22260 d_grpasswd='$d_grpasswd'
22261 d_hasmntopt='$d_hasmntopt'
22262 d_htonl='$d_htonl'
22263 d_ilogbl='$d_ilogbl'
22264 d_inc_version_list='$d_inc_version_list'
22265 d_index='$d_index'
22266 d_inetaton='$d_inetaton'
22267 d_int64_t='$d_int64_t'
22268 d_isascii='$d_isascii'
22269 d_isfinite='$d_isfinite'
22270 d_isinf='$d_isinf'
22271 d_isnan='$d_isnan'
22272 d_isnanl='$d_isnanl'
22273 d_killpg='$d_killpg'
22274 d_lchown='$d_lchown'
22275 d_ldbl_dig='$d_ldbl_dig'
22276 d_libm_lib_version='$d_libm_lib_version'
22277 d_link='$d_link'
22278 d_localtime64='$d_localtime64'
22279 d_localtime_r='$d_localtime_r'
22280 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22281 d_locconv='$d_locconv'
22282 d_lockf='$d_lockf'
22283 d_longdbl='$d_longdbl'
22284 d_longlong='$d_longlong'
22285 d_lseekproto='$d_lseekproto'
22286 d_lstat='$d_lstat'
22287 d_madvise='$d_madvise'
22288 d_malloc_good_size='$d_malloc_good_size'
22289 d_malloc_size='$d_malloc_size'
22290 d_mblen='$d_mblen'
22291 d_mbstowcs='$d_mbstowcs'
22292 d_mbtowc='$d_mbtowc'
22293 d_memchr='$d_memchr'
22294 d_memcmp='$d_memcmp'
22295 d_memcpy='$d_memcpy'
22296 d_memmove='$d_memmove'
22297 d_memset='$d_memset'
22298 d_mkdir='$d_mkdir'
22299 d_mkdtemp='$d_mkdtemp'
22300 d_mkfifo='$d_mkfifo'
22301 d_mkstemp='$d_mkstemp'
22302 d_mkstemps='$d_mkstemps'
22303 d_mktime64='$d_mktime64'
22304 d_mktime='$d_mktime'
22305 d_mmap='$d_mmap'
22306 d_modfl='$d_modfl'
22307 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22308 d_modflproto='$d_modflproto'
22309 d_mprotect='$d_mprotect'
22310 d_msg='$d_msg'
22311 d_msg_ctrunc='$d_msg_ctrunc'
22312 d_msg_dontroute='$d_msg_dontroute'
22313 d_msg_oob='$d_msg_oob'
22314 d_msg_peek='$d_msg_peek'
22315 d_msg_proxy='$d_msg_proxy'
22316 d_msgctl='$d_msgctl'
22317 d_msgget='$d_msgget'
22318 d_msghdr_s='$d_msghdr_s'
22319 d_msgrcv='$d_msgrcv'
22320 d_msgsnd='$d_msgsnd'
22321 d_msync='$d_msync'
22322 d_munmap='$d_munmap'
22323 d_mymalloc='$d_mymalloc'
22324 d_ndbm='$d_ndbm'
22325 d_nice='$d_nice'
22326 d_nl_langinfo='$d_nl_langinfo'
22327 d_nv_preserves_uv='$d_nv_preserves_uv'
22328 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22329 d_off64_t='$d_off64_t'
22330 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22331 d_oldpthreads='$d_oldpthreads'
22332 d_oldsock='$d_oldsock'
22333 d_open3='$d_open3'
22334 d_pathconf='$d_pathconf'
22335 d_pause='$d_pause'
22336 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22337 d_phostname='$d_phostname'
22338 d_pipe='$d_pipe'
22339 d_poll='$d_poll'
22340 d_portable='$d_portable'
22341 d_printf_format_null='$d_printf_format_null'
22342 d_procselfexe='$d_procselfexe'
22343 d_pseudofork='$d_pseudofork'
22344 d_pthread_atfork='$d_pthread_atfork'
22345 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22346 d_pthread_yield='$d_pthread_yield'
22347 d_pwage='$d_pwage'
22348 d_pwchange='$d_pwchange'
22349 d_pwclass='$d_pwclass'
22350 d_pwcomment='$d_pwcomment'
22351 d_pwexpire='$d_pwexpire'
22352 d_pwgecos='$d_pwgecos'
22353 d_pwpasswd='$d_pwpasswd'
22354 d_pwquota='$d_pwquota'
22355 d_qgcvt='$d_qgcvt'
22356 d_quad='$d_quad'
22357 d_random_r='$d_random_r'
22358 d_readdir64_r='$d_readdir64_r'
22359 d_readdir='$d_readdir'
22360 d_readdir_r='$d_readdir_r'
22361 d_readlink='$d_readlink'
22362 d_readv='$d_readv'
22363 d_recvmsg='$d_recvmsg'
22364 d_rename='$d_rename'
22365 d_rewinddir='$d_rewinddir'
22366 d_rmdir='$d_rmdir'
22367 d_safebcpy='$d_safebcpy'
22368 d_safemcpy='$d_safemcpy'
22369 d_sanemcmp='$d_sanemcmp'
22370 d_sbrkproto='$d_sbrkproto'
22371 d_scalbnl='$d_scalbnl'
22372 d_sched_yield='$d_sched_yield'
22373 d_scm_rights='$d_scm_rights'
22374 d_seekdir='$d_seekdir'
22375 d_select='$d_select'
22376 d_sem='$d_sem'
22377 d_semctl='$d_semctl'
22378 d_semctl_semid_ds='$d_semctl_semid_ds'
22379 d_semctl_semun='$d_semctl_semun'
22380 d_semget='$d_semget'
22381 d_semop='$d_semop'
22382 d_sendmsg='$d_sendmsg'
22383 d_setegid='$d_setegid'
22384 d_seteuid='$d_seteuid'
22385 d_setgrent='$d_setgrent'
22386 d_setgrent_r='$d_setgrent_r'
22387 d_setgrps='$d_setgrps'
22388 d_sethent='$d_sethent'
22389 d_sethostent_r='$d_sethostent_r'
22390 d_setitimer='$d_setitimer'
22391 d_setlinebuf='$d_setlinebuf'
22392 d_setlocale='$d_setlocale'
22393 d_setlocale_r='$d_setlocale_r'
22394 d_setnent='$d_setnent'
22395 d_setnetent_r='$d_setnetent_r'
22396 d_setpent='$d_setpent'
22397 d_setpgid='$d_setpgid'
22398 d_setpgrp2='$d_setpgrp2'
22399 d_setpgrp='$d_setpgrp'
22400 d_setprior='$d_setprior'
22401 d_setproctitle='$d_setproctitle'
22402 d_setprotoent_r='$d_setprotoent_r'
22403 d_setpwent='$d_setpwent'
22404 d_setpwent_r='$d_setpwent_r'
22405 d_setregid='$d_setregid'
22406 d_setresgid='$d_setresgid'
22407 d_setresuid='$d_setresuid'
22408 d_setreuid='$d_setreuid'
22409 d_setrgid='$d_setrgid'
22410 d_setruid='$d_setruid'
22411 d_setsent='$d_setsent'
22412 d_setservent_r='$d_setservent_r'
22413 d_setsid='$d_setsid'
22414 d_setvbuf='$d_setvbuf'
22415 d_sfio='$d_sfio'
22416 d_shm='$d_shm'
22417 d_shmat='$d_shmat'
22418 d_shmatprototype='$d_shmatprototype'
22419 d_shmctl='$d_shmctl'
22420 d_shmdt='$d_shmdt'
22421 d_shmget='$d_shmget'
22422 d_sigaction='$d_sigaction'
22423 d_signbit='$d_signbit'
22424 d_sigprocmask='$d_sigprocmask'
22425 d_sigsetjmp='$d_sigsetjmp'
22426 d_sitearch='$d_sitearch'
22427 d_snprintf='$d_snprintf'
22428 d_sockatmark='$d_sockatmark'
22429 d_sockatmarkproto='$d_sockatmarkproto'
22430 d_socket='$d_socket'
22431 d_socklen_t='$d_socklen_t'
22432 d_sockpair='$d_sockpair'
22433 d_socks5_init='$d_socks5_init'
22434 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22435 d_sqrtl='$d_sqrtl'
22436 d_srand48_r='$d_srand48_r'
22437 d_srandom_r='$d_srandom_r'
22438 d_sresgproto='$d_sresgproto'
22439 d_sresuproto='$d_sresuproto'
22440 d_statblks='$d_statblks'
22441 d_statfs_f_flags='$d_statfs_f_flags'
22442 d_statfs_s='$d_statfs_s'
22443 d_statvfs='$d_statvfs'
22444 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22445 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22446 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22447 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22448 d_stdio_stream_array='$d_stdio_stream_array'
22449 d_stdiobase='$d_stdiobase'
22450 d_stdstdio='$d_stdstdio'
22451 d_strchr='$d_strchr'
22452 d_strcoll='$d_strcoll'
22453 d_strctcpy='$d_strctcpy'
22454 d_strerrm='$d_strerrm'
22455 d_strerror='$d_strerror'
22456 d_strerror_r='$d_strerror_r'
22457 d_strftime='$d_strftime'
22458 d_strlcat='$d_strlcat'
22459 d_strlcpy='$d_strlcpy'
22460 d_strtod='$d_strtod'
22461 d_strtol='$d_strtol'
22462 d_strtold='$d_strtold'
22463 d_strtoll='$d_strtoll'
22464 d_strtoq='$d_strtoq'
22465 d_strtoul='$d_strtoul'
22466 d_strtoull='$d_strtoull'
22467 d_strtouq='$d_strtouq'
22468 d_strxfrm='$d_strxfrm'
22469 d_suidsafe='$d_suidsafe'
22470 d_symlink='$d_symlink'
22471 d_syscall='$d_syscall'
22472 d_syscallproto='$d_syscallproto'
22473 d_sysconf='$d_sysconf'
22474 d_sysernlst='$d_sysernlst'
22475 d_syserrlst='$d_syserrlst'
22476 d_system='$d_system'
22477 d_tcgetpgrp='$d_tcgetpgrp'
22478 d_tcsetpgrp='$d_tcsetpgrp'
22479 d_telldir='$d_telldir'
22480 d_telldirproto='$d_telldirproto'
22481 d_time='$d_time'
22482 d_timegm='$d_timegm'
22483 d_times='$d_times'
22484 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22485 d_tm_tm_zone='$d_tm_tm_zone'
22486 d_tmpnam_r='$d_tmpnam_r'
22487 d_truncate='$d_truncate'
22488 d_ttyname_r='$d_ttyname_r'
22489 d_tzname='$d_tzname'
22490 d_u32align='$d_u32align'
22491 d_ualarm='$d_ualarm'
22492 d_umask='$d_umask'
22493 d_uname='$d_uname'
22494 d_union_semun='$d_union_semun'
22495 d_unordered='$d_unordered'
22496 d_unsetenv='$d_unsetenv'
22497 d_usleep='$d_usleep'
22498 d_usleepproto='$d_usleepproto'
22499 d_ustat='$d_ustat'
22500 d_vendorarch='$d_vendorarch'
22501 d_vendorbin='$d_vendorbin'
22502 d_vendorlib='$d_vendorlib'
22503 d_vendorscript='$d_vendorscript'
22504 d_vfork='$d_vfork'
22505 d_void_closedir='$d_void_closedir'
22506 d_voidsig='$d_voidsig'
22507 d_voidtty='$d_voidtty'
22508 d_volatile='$d_volatile'
22509 d_vprintf='$d_vprintf'
22510 d_vsnprintf='$d_vsnprintf'
22511 d_wait4='$d_wait4'
22512 d_waitpid='$d_waitpid'
22513 d_wcstombs='$d_wcstombs'
22514 d_wctomb='$d_wctomb'
22515 d_writev='$d_writev'
22516 d_xenix='$d_xenix'
22517 date='$date'
22518 db_hashtype='$db_hashtype'
22519 db_prefixtype='$db_prefixtype'
22520 db_version_major='$db_version_major'
22521 db_version_minor='$db_version_minor'
22522 db_version_patch='$db_version_patch'
22523 defvoidused='$defvoidused'
22524 direntrytype='$direntrytype'
22525 dlext='$dlext'
22526 dlsrc='$dlsrc'
22527 doublesize='$doublesize'
22528 drand01='$drand01'
22529 drand48_r_proto='$drand48_r_proto'
22530 dtrace='$dtrace'
22531 dynamic_ext='$dynamic_ext'
22532 eagain='$eagain'
22533 ebcdic='$ebcdic'
22534 echo='$echo'
22535 egrep='$egrep'
22536 emacs='$emacs'
22537 endgrent_r_proto='$endgrent_r_proto'
22538 endhostent_r_proto='$endhostent_r_proto'
22539 endnetent_r_proto='$endnetent_r_proto'
22540 endprotoent_r_proto='$endprotoent_r_proto'
22541 endpwent_r_proto='$endpwent_r_proto'
22542 endservent_r_proto='$endservent_r_proto'
22543 eunicefix='$eunicefix'
22544 exe_ext='$exe_ext'
22545 expr='$expr'
22546 extensions='$extensions'
22547 extern_C='$extern_C'
22548 extras='$extras'
22549 fflushNULL='$fflushNULL'
22550 fflushall='$fflushall'
22551 find='$find'
22552 firstmakefile='$firstmakefile'
22553 flex='$flex'
22554 fpossize='$fpossize'
22555 fpostype='$fpostype'
22556 freetype='$freetype'
22557 from='$from'
22558 full_ar='$full_ar'
22559 full_csh='$full_csh'
22560 full_sed='$full_sed'
22561 gccansipedantic='$gccansipedantic'
22562 gccosandvers='$gccosandvers'
22563 gccversion='$gccversion'
22564 getgrent_r_proto='$getgrent_r_proto'
22565 getgrgid_r_proto='$getgrgid_r_proto'
22566 getgrnam_r_proto='$getgrnam_r_proto'
22567 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22568 gethostbyname_r_proto='$gethostbyname_r_proto'
22569 gethostent_r_proto='$gethostent_r_proto'
22570 getlogin_r_proto='$getlogin_r_proto'
22571 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22572 getnetbyname_r_proto='$getnetbyname_r_proto'
22573 getnetent_r_proto='$getnetent_r_proto'
22574 getprotobyname_r_proto='$getprotobyname_r_proto'
22575 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22576 getprotoent_r_proto='$getprotoent_r_proto'
22577 getpwent_r_proto='$getpwent_r_proto'
22578 getpwnam_r_proto='$getpwnam_r_proto'
22579 getpwuid_r_proto='$getpwuid_r_proto'
22580 getservbyname_r_proto='$getservbyname_r_proto'
22581 getservbyport_r_proto='$getservbyport_r_proto'
22582 getservent_r_proto='$getservent_r_proto'
22583 getspnam_r_proto='$getspnam_r_proto'
22584 gidformat='$gidformat'
22585 gidsign='$gidsign'
22586 gidsize='$gidsize'
22587 gidtype='$gidtype'
22588 glibpth='$glibpth'
22589 gmake='$gmake'
22590 gmtime_r_proto='$gmtime_r_proto'
22591 gnulibc_version='$gnulibc_version'
22592 grep='$grep'
22593 groupcat='$groupcat'
22594 groupstype='$groupstype'
22595 gzip='$gzip'
22596 h_fcntl='$h_fcntl'
22597 h_sysfile='$h_sysfile'
22598 hint='$hint'
22599 hostcat='$hostcat'
22600 html1dir='$html1dir'
22601 html1direxp='$html1direxp'
22602 html3dir='$html3dir'
22603 html3direxp='$html3direxp'
22604 i16size='$i16size'
22605 i16type='$i16type'
22606 i32size='$i32size'
22607 i32type='$i32type'
22608 i64size='$i64size'
22609 i64type='$i64type'
22610 i8size='$i8size'
22611 i8type='$i8type'
22612 i_arpainet='$i_arpainet'
22613 i_assert='$i_assert'
22614 i_bsdioctl='$i_bsdioctl'
22615 i_crypt='$i_crypt'
22616 i_db='$i_db'
22617 i_dbm='$i_dbm'
22618 i_dirent='$i_dirent'
22619 i_dld='$i_dld'
22620 i_dlfcn='$i_dlfcn'
22621 i_fcntl='$i_fcntl'
22622 i_float='$i_float'
22623 i_fp='$i_fp'
22624 i_fp_class='$i_fp_class'
22625 i_gdbm='$i_gdbm'
22626 i_gdbm_ndbm='$i_gdbm_ndbm'
22627 i_gdbmndbm='$i_gdbmndbm'
22628 i_grp='$i_grp'
22629 i_ieeefp='$i_ieeefp'
22630 i_inttypes='$i_inttypes'
22631 i_langinfo='$i_langinfo'
22632 i_libutil='$i_libutil'
22633 i_limits='$i_limits'
22634 i_locale='$i_locale'
22635 i_machcthr='$i_machcthr'
22636 i_malloc='$i_malloc'
22637 i_mallocmalloc='$i_mallocmalloc'
22638 i_math='$i_math'
22639 i_memory='$i_memory'
22640 i_mntent='$i_mntent'
22641 i_ndbm='$i_ndbm'
22642 i_netdb='$i_netdb'
22643 i_neterrno='$i_neterrno'
22644 i_netinettcp='$i_netinettcp'
22645 i_niin='$i_niin'
22646 i_poll='$i_poll'
22647 i_prot='$i_prot'
22648 i_pthread='$i_pthread'
22649 i_pwd='$i_pwd'
22650 i_rpcsvcdbm='$i_rpcsvcdbm'
22651 i_sfio='$i_sfio'
22652 i_sgtty='$i_sgtty'
22653 i_shadow='$i_shadow'
22654 i_socks='$i_socks'
22655 i_stdarg='$i_stdarg'
22656 i_stddef='$i_stddef'
22657 i_stdlib='$i_stdlib'
22658 i_string='$i_string'
22659 i_sunmath='$i_sunmath'
22660 i_sysaccess='$i_sysaccess'
22661 i_sysdir='$i_sysdir'
22662 i_sysfile='$i_sysfile'
22663 i_sysfilio='$i_sysfilio'
22664 i_sysin='$i_sysin'
22665 i_sysioctl='$i_sysioctl'
22666 i_syslog='$i_syslog'
22667 i_sysmman='$i_sysmman'
22668 i_sysmode='$i_sysmode'
22669 i_sysmount='$i_sysmount'
22670 i_sysndir='$i_sysndir'
22671 i_sysparam='$i_sysparam'
22672 i_syspoll='$i_syspoll'
22673 i_sysresrc='$i_sysresrc'
22674 i_syssecrt='$i_syssecrt'
22675 i_sysselct='$i_sysselct'
22676 i_syssockio='$i_syssockio'
22677 i_sysstat='$i_sysstat'
22678 i_sysstatfs='$i_sysstatfs'
22679 i_sysstatvfs='$i_sysstatvfs'
22680 i_systime='$i_systime'
22681 i_systimek='$i_systimek'
22682 i_systimes='$i_systimes'
22683 i_systypes='$i_systypes'
22684 i_sysuio='$i_sysuio'
22685 i_sysun='$i_sysun'
22686 i_sysutsname='$i_sysutsname'
22687 i_sysvfs='$i_sysvfs'
22688 i_syswait='$i_syswait'
22689 i_termio='$i_termio'
22690 i_termios='$i_termios'
22691 i_time='$i_time'
22692 i_unistd='$i_unistd'
22693 i_ustat='$i_ustat'
22694 i_utime='$i_utime'
22695 i_values='$i_values'
22696 i_varargs='$i_varargs'
22697 i_varhdr='$i_varhdr'
22698 i_vfork='$i_vfork'
22699 ignore_versioned_solibs='$ignore_versioned_solibs'
22700 inc_version_list='$inc_version_list'
22701 inc_version_list_init='$inc_version_list_init'
22702 incpath='$incpath'
22703 inews='$inews'
22704 initialinstalllocation='$initialinstalllocation'
22705 installarchlib='$installarchlib'
22706 installbin='$installbin'
22707 installhtml1dir='$installhtml1dir'
22708 installhtml3dir='$installhtml3dir'
22709 installman1dir='$installman1dir'
22710 installman3dir='$installman3dir'
22711 installprefix='$installprefix'
22712 installprefixexp='$installprefixexp'
22713 installprivlib='$installprivlib'
22714 installscript='$installscript'
22715 installsitearch='$installsitearch'
22716 installsitebin='$installsitebin'
22717 installsitehtml1dir='$installsitehtml1dir'
22718 installsitehtml3dir='$installsitehtml3dir'
22719 installsitelib='$installsitelib'
22720 installsiteman1dir='$installsiteman1dir'
22721 installsiteman3dir='$installsiteman3dir'
22722 installsitescript='$installsitescript'
22723 installstyle='$installstyle'
22724 installusrbinperl='$installusrbinperl'
22725 installvendorarch='$installvendorarch'
22726 installvendorbin='$installvendorbin'
22727 installvendorhtml1dir='$installvendorhtml1dir'
22728 installvendorhtml3dir='$installvendorhtml3dir'
22729 installvendorlib='$installvendorlib'
22730 installvendorman1dir='$installvendorman1dir'
22731 installvendorman3dir='$installvendorman3dir'
22732 installvendorscript='$installvendorscript'
22733 intsize='$intsize'
22734 issymlink='$issymlink'
22735 ivdformat='$ivdformat'
22736 ivsize='$ivsize'
22737 ivtype='$ivtype'
22738 known_extensions='$known_extensions'
22739 ksh='$ksh'
22740 ld='$ld'
22741 lddlflags='$lddlflags'
22742 ldflags='$ldflags'
22743 ldflags_uselargefiles='$ldflags_uselargefiles'
22744 ldlibpthname='$ldlibpthname'
22745 less='$less'
22746 lib_ext='$lib_ext'
22747 libc='$libc'
22748 libperl='$libperl'
22749 libpth='$libpth'
22750 libs='$libs'
22751 libsdirs='$libsdirs'
22752 libsfiles='$libsfiles'
22753 libsfound='$libsfound'
22754 libspath='$libspath'
22755 libswanted='$libswanted'
22756 libswanted_uselargefiles='$libswanted_uselargefiles'
22757 line='$line'
22758 lint='$lint'
22759 lkflags='$lkflags'
22760 ln='$ln'
22761 lns='$lns'
22762 localtime_r_proto='$localtime_r_proto'
22763 locincpth='$locincpth'
22764 loclibpth='$loclibpth'
22765 longdblsize='$longdblsize'
22766 longlongsize='$longlongsize'
22767 longsize='$longsize'
22768 lp='$lp'
22769 lpr='$lpr'
22770 ls='$ls'
22771 lseeksize='$lseeksize'
22772 lseektype='$lseektype'
22773 mad='$mad'
22774 madlyh='$madlyh'
22775 madlyobj='$madlyobj'
22776 madlysrc='$madlysrc'
22777 mail='$mail'
22778 mailx='$mailx'
22779 make='$make'
22780 make_set_make='$make_set_make'
22781 mallocobj='$mallocobj'
22782 mallocsrc='$mallocsrc'
22783 malloctype='$malloctype'
22784 man1dir='$man1dir'
22785 man1direxp='$man1direxp'
22786 man1ext='$man1ext'
22787 man3dir='$man3dir'
22788 man3direxp='$man3direxp'
22789 man3ext='$man3ext'
22790 mips_type='$mips_type'
22791 mistrustnm='$mistrustnm'
22792 mkdir='$mkdir'
22793 mmaptype='$mmaptype'
22794 modetype='$modetype'
22795 more='$more'
22796 multiarch='$multiarch'
22797 mv='$mv'
22798 myarchname='$myarchname'
22799 mydomain='$mydomain'
22800 myhostname='$myhostname'
22801 myuname='$myuname'
22802 n='$n'
22803 need_va_copy='$need_va_copy'
22804 netdb_hlen_type='$netdb_hlen_type'
22805 netdb_host_type='$netdb_host_type'
22806 netdb_name_type='$netdb_name_type'
22807 netdb_net_type='$netdb_net_type'
22808 nm='$nm'
22809 nm_opt='$nm_opt'
22810 nm_so_opt='$nm_so_opt'
22811 nonxs_ext='$nonxs_ext'
22812 nroff='$nroff'
22813 nvEUformat='$nvEUformat'
22814 nvFUformat='$nvFUformat'
22815 nvGUformat='$nvGUformat'
22816 nv_overflows_integers_at='$nv_overflows_integers_at'
22817 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22818 nveformat='$nveformat'
22819 nvfformat='$nvfformat'
22820 nvgformat='$nvgformat'
22821 nvsize='$nvsize'
22822 nvtype='$nvtype'
22823 o_nonblock='$o_nonblock'
22824 obj_ext='$obj_ext'
22825 old_pthread_create_joinable='$old_pthread_create_joinable'
22826 optimize='$optimize'
22827 orderlib='$orderlib'
22828 osname='$osname'
22829 osvers='$osvers'
22830 otherlibdirs='$otherlibdirs'
22831 package='$package'
22832 pager='$pager'
22833 passcat='$passcat'
22834 patchlevel='$patchlevel'
22835 path_sep='$path_sep'
22836 perl5='$perl5'
22837 perl='$perl'
22838 perl_patchlevel='$perl_patchlevel'
22839 perladmin='$perladmin'
22840 perllibs='$perllibs'
22841 perlpath='$perlpath'
22842 pg='$pg'
22843 phostname='$phostname'
22844 pidtype='$pidtype'
22845 plibpth='$plibpth'
22846 pmake='$pmake'
22847 pr='$pr'
22848 prefix='$prefix'
22849 prefixexp='$prefixexp'
22850 privlib='$privlib'
22851 privlibexp='$privlibexp'
22852 procselfexe='$procselfexe'
22853 prototype='$prototype'
22854 ptrsize='$ptrsize'
22855 quadkind='$quadkind'
22856 quadtype='$quadtype'
22857 randbits='$randbits'
22858 randfunc='$randfunc'
22859 random_r_proto='$random_r_proto'
22860 randseedtype='$randseedtype'
22861 ranlib='$ranlib'
22862 rd_nodata='$rd_nodata'
22863 readdir64_r_proto='$readdir64_r_proto'
22864 readdir_r_proto='$readdir_r_proto'
22865 revision='$revision'
22866 rm='$rm'
22867 rm_try='$rm_try'
22868 rmail='$rmail'
22869 run='$run'
22870 runnm='$runnm'
22871 sGMTIME_max='$sGMTIME_max'
22872 sGMTIME_min='$sGMTIME_min'
22873 sLOCALTIME_max='$sLOCALTIME_max'
22874 sLOCALTIME_min='$sLOCALTIME_min'
22875 sPRIEUldbl='$sPRIEUldbl'
22876 sPRIFUldbl='$sPRIFUldbl'
22877 sPRIGUldbl='$sPRIGUldbl'
22878 sPRIXU64='$sPRIXU64'
22879 sPRId64='$sPRId64'
22880 sPRIeldbl='$sPRIeldbl'
22881 sPRIfldbl='$sPRIfldbl'
22882 sPRIgldbl='$sPRIgldbl'
22883 sPRIi64='$sPRIi64'
22884 sPRIo64='$sPRIo64'
22885 sPRIu64='$sPRIu64'
22886 sPRIx64='$sPRIx64'
22887 sSCNfldbl='$sSCNfldbl'
22888 sched_yield='$sched_yield'
22889 scriptdir='$scriptdir'
22890 scriptdirexp='$scriptdirexp'
22891 sed='$sed'
22892 seedfunc='$seedfunc'
22893 selectminbits='$selectminbits'
22894 selecttype='$selecttype'
22895 sendmail='$sendmail'
22896 setgrent_r_proto='$setgrent_r_proto'
22897 sethostent_r_proto='$sethostent_r_proto'
22898 setlocale_r_proto='$setlocale_r_proto'
22899 setnetent_r_proto='$setnetent_r_proto'
22900 setprotoent_r_proto='$setprotoent_r_proto'
22901 setpwent_r_proto='$setpwent_r_proto'
22902 setservent_r_proto='$setservent_r_proto'
22903 sh='$sh'
22904 shar='$shar'
22905 sharpbang='$sharpbang'
22906 shmattype='$shmattype'
22907 shortsize='$shortsize'
22908 shrpenv='$shrpenv'
22909 shsharp='$shsharp'
22910 sig_count='$sig_count'
22911 sig_name='$sig_name'
22912 sig_name_init='$sig_name_init'
22913 sig_num='$sig_num'
22914 sig_num_init='$sig_num_init'
22915 sig_size='$sig_size'
22916 signal_t='$signal_t'
22917 sitearch='$sitearch'
22918 sitearchexp='$sitearchexp'
22919 sitebin='$sitebin'
22920 sitebinexp='$sitebinexp'
22921 sitehtml1dir='$sitehtml1dir'
22922 sitehtml1direxp='$sitehtml1direxp'
22923 sitehtml3dir='$sitehtml3dir'
22924 sitehtml3direxp='$sitehtml3direxp'
22925 sitelib='$sitelib'
22926 sitelib_stem='$sitelib_stem'
22927 sitelibexp='$sitelibexp'
22928 siteman1dir='$siteman1dir'
22929 siteman1direxp='$siteman1direxp'
22930 siteman3dir='$siteman3dir'
22931 siteman3direxp='$siteman3direxp'
22932 siteprefix='$siteprefix'
22933 siteprefixexp='$siteprefixexp'
22934 sitescript='$sitescript'
22935 sitescriptexp='$sitescriptexp'
22936 sizesize='$sizesize'
22937 sizetype='$sizetype'
22938 sleep='$sleep'
22939 smail='$smail'
22940 so='$so'
22941 sockethdr='$sockethdr'
22942 socketlib='$socketlib'
22943 socksizetype='$socksizetype'
22944 sort='$sort'
22945 spackage='$spackage'
22946 spitshell='$spitshell'
22947 srand48_r_proto='$srand48_r_proto'
22948 srandom_r_proto='$srandom_r_proto'
22949 src='$src'
22950 ssizetype='$ssizetype'
22951 startperl='$startperl'
22952 startsh='$startsh'
22953 static_ext='$static_ext'
22954 stdchar='$stdchar'
22955 stdio_base='$stdio_base'
22956 stdio_bufsiz='$stdio_bufsiz'
22957 stdio_cnt='$stdio_cnt'
22958 stdio_filbuf='$stdio_filbuf'
22959 stdio_ptr='$stdio_ptr'
22960 stdio_stream_array='$stdio_stream_array'
22961 strerror_r_proto='$strerror_r_proto'
22962 strings='$strings'
22963 submit='$submit'
22964 subversion='$subversion'
22965 sysman='$sysman'
22966 tail='$tail'
22967 tar='$tar'
22968 targetarch='$targetarch'
22969 tbl='$tbl'
22970 tee='$tee'
22971 test='$test'
22972 timeincl='$timeincl'
22973 timetype='$timetype'
22974 tmpnam_r_proto='$tmpnam_r_proto'
22975 to='$to'
22976 touch='$touch'
22977 tr='$tr'
22978 trnl='$trnl'
22979 troff='$troff'
22980 ttyname_r_proto='$ttyname_r_proto'
22981 u16size='$u16size'
22982 u16type='$u16type'
22983 u32size='$u32size'
22984 u32type='$u32type'
22985 u64size='$u64size'
22986 u64type='$u64type'
22987 u8size='$u8size'
22988 u8type='$u8type'
22989 uidformat='$uidformat'
22990 uidsign='$uidsign'
22991 uidsize='$uidsize'
22992 uidtype='$uidtype'
22993 uname='$uname'
22994 uniq='$uniq'
22995 uquadtype='$uquadtype'
22996 use5005threads='$use5005threads'
22997 use64bitall='$use64bitall'
22998 use64bitint='$use64bitint'
22999 usecrosscompile='$usecrosscompile'
23000 usedl='$usedl'
23001 usedtrace='$usedtrace'
23002 usefaststdio='$usefaststdio'
23003 useithreads='$useithreads'
23004 uselargefiles='$uselargefiles'
23005 uselongdouble='$uselongdouble'
23006 usemallocwrap='$usemallocwrap'
23007 usemorebits='$usemorebits'
23008 usemultiplicity='$usemultiplicity'
23009 usemymalloc='$usemymalloc'
23010 usenm='$usenm'
23011 useopcode='$useopcode'
23012 useperlio='$useperlio'
23013 useposix='$useposix'
23014 usereentrant='$usereentrant'
23015 userelocatableinc='$userelocatableinc'
23016 usesfio='$usesfio'
23017 useshrplib='$useshrplib'
23018 usesitecustomize='$usesitecustomize'
23019 usesocks='$usesocks'
23020 usethreads='$usethreads'
23021 usevendorprefix='$usevendorprefix'
23022 usevfork='$usevfork'
23023 usrinc='$usrinc'
23024 uuname='$uuname'
23025 uvXUformat='$uvXUformat'
23026 uvoformat='$uvoformat'
23027 uvsize='$uvsize'
23028 uvtype='$uvtype'
23029 uvuformat='$uvuformat'
23030 uvxformat='$uvxformat'
23031 vendorarch='$vendorarch'
23032 vendorarchexp='$vendorarchexp'
23033 vendorbin='$vendorbin'
23034 vendorbinexp='$vendorbinexp'
23035 vendorhtml1dir='$vendorhtml1dir'
23036 vendorhtml1direxp='$vendorhtml1direxp'
23037 vendorhtml3dir='$vendorhtml3dir'
23038 vendorhtml3direxp='$vendorhtml3direxp'
23039 vendorlib='$vendorlib'
23040 vendorlib_stem='$vendorlib_stem'
23041 vendorlibexp='$vendorlibexp'
23042 vendorman1dir='$vendorman1dir'
23043 vendorman1direxp='$vendorman1direxp'
23044 vendorman3dir='$vendorman3dir'
23045 vendorman3direxp='$vendorman3direxp'
23046 vendorprefix='$vendorprefix'
23047 vendorprefixexp='$vendorprefixexp'
23048 vendorscript='$vendorscript'
23049 vendorscriptexp='$vendorscriptexp'
23050 version='$version'
23051 version_patchlevel_string='$version_patchlevel_string'
23052 versiononly='$versiononly'
23053 vi='$vi'
23054 voidflags='$voidflags'
23055 xlibpth='$xlibpth'
23056 yacc='$yacc'
23057 yaccflags='$yaccflags'
23058 zcat='$zcat'
23059 zip='$zip'
23060 EOT
23061
23062 : Add in command line options if available
23063 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23064
23065 : add special variables
23066 $test -f $src/patchlevel.h && \
23067 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23068 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
23069 echo "PERL_CONFIG_SH=true" >>config.sh
23070
23071 : propagate old symbols
23072 if $test -f UU/config.sh; then
23073         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23074         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23075                 config.sh config.sh UU/oldconfig.sh |\
23076                 $sort | $uniq -u >UU/oldsyms
23077         set X `cat UU/oldsyms`
23078         shift
23079         case $# in
23080         0) ;;
23081         *)
23082                 cat <<EOM
23083 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23084 EOM
23085                 echo ": Variables propagated from previous config.sh file." >>config.sh
23086                 for sym in `cat UU/oldsyms`; do
23087                         echo "    Propagating $hint variable "'$'"$sym..."
23088                         eval 'tmp="$'"${sym}"'"'
23089                         echo "$tmp" | \
23090                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23091                 done
23092                 ;;
23093         esac
23094 fi
23095
23096 : Finish up by extracting the .SH files
23097 case "$alldone" in
23098 exit)
23099         $rm -rf UU
23100         echo "Extraction done."
23101         exit 0
23102         ;;
23103 cont)
23104         ;;
23105 '')
23106         dflt=''
23107         nostick=true
23108         $cat <<EOM
23109
23110 If you'd like to make any changes to the config.sh file before I begin
23111 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23112
23113 EOM
23114         rp="Press return or use a shell escape to edit config.sh:"
23115         . UU/myread
23116         nostick=''
23117         case "$ans" in
23118         '') ;;
23119         *) : in case they cannot read
23120                 sh 1>&4 -c "$ans";;
23121         esac
23122         ;;
23123 esac
23124
23125 : if this fails, just run all the .SH files by hand
23126 . ./config.sh
23127
23128 echo " "
23129 exec 1>&4
23130 pwd=`pwd`
23131 . ./UU/extract
23132 cd "$pwd"
23133
23134 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23135         dflt=y
23136         case "$silent" in
23137         true) ;;
23138         *)
23139                 $cat <<EOM
23140
23141 Now you need to generate make dependencies by running "$make depend".
23142 You might prefer to run it in background: "$make depend > makedepend.out &"
23143 It can take a while, so you might not want to run it right now.
23144
23145 EOM
23146                 ;;
23147         esac
23148         rp="Run $make depend now?"
23149         . UU/myread
23150         case "$ans" in
23151         y*)
23152                 $make depend && echo "Now you must run '$make'."
23153                 ;;
23154         *)
23155                 echo "You must run '$make depend' then '$make'."
23156                 ;;
23157         esac
23158 elif test -f [Mm]akefile; then
23159         echo " "
23160         echo "Now you must run a $make."
23161 else
23162         echo "Configure done."
23163 fi
23164
23165 if $test -f Policy.sh; then
23166     $cat <<EOM
23167
23168 If you compile $package on a different machine or from a different object
23169 directory, copy the Policy.sh file from this object directory to the
23170 new one before you run Configure -- this will help you with most of
23171 the policy defaults.
23172
23173 EOM
23174 fi
23175 if $test -f config.msg; then
23176     echo "Hmm.  I also noted the following information while running:"
23177     echo " "
23178     $cat config.msg >&4
23179     $rm -f config.msg
23180 fi
23181 $rm -f kit*isdone ark*isdone
23182 $rm -rf UU
23183
23184 : End of Configure
23185