make_ext.pl's automatic Makefile.PL generation can write these five for us.
[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 Mar 25 17:28:24 CET 2009 [metaconfig 3.5 PL0]
29 # (with additional metaconfig patches by perlbug@perl.org)
30
31 cat >c1$$ <<EOF
32 ARGGGHHHH!!!!!
33
34 SCO csh still thinks true is false.  Write to SCO today and tell them that next
35 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
36
37 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
38 we'd have to do is go in and swap the && and || tokens, wherever they are.)
39
40 [End of diatribe. We now return you to your regularly scheduled programming...]
41 EOF
42 cat >c2$$ <<EOF
43
44 OOPS!  You naughty creature!  You didn't run Configure with sh!
45 I will attempt to remedy the situation by running sh for you...
46 EOF
47
48 true || cat c1$$ c2$$
49 true || exec sh $0 $argv:q
50
51 (exit $?0) || cat c2$$
52 (exit $?0) || exec sh $0 $argv:q
53 rm -f c1$$ c2$$
54
55 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
56         cat >&4 <<EOF
57 ***
58 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
59 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
60 *** Please read the README.plan9 for further instructions.
61 *** Cannot continue, aborting.
62 ***
63 EOF
64         exit 1
65 fi
66
67 if test ! -c /dev/null ; then
68         cat >&4 <<EOF
69 ***
70 *** I'm sorry, but /dev/null appears to be a file rather than a device.
71 *** Please consult your operating sytem's notes for making a device
72 *** in /dev.
73 *** Cannot continue, aborting.
74 ***
75 EOF
76         exit 1
77 fi
78
79 : compute my invocation name
80 me=$0
81 case "$0" in
82 */*)
83         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
84         test "$me" || me=$0
85         ;;
86 esac
87
88 : Proper separator for the PATH environment variable
89 p_=:
90 : On OS/2 this directory should exist if this is not floppy only system ":-]"
91 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
92         if test -n "$OS2_SHELL"; then
93                 p_=\;
94                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
95                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
96                 is_os2=yes
97         elif test -n "$DJGPP"; then
98                 case "X${MACHTYPE:-nonesuchmach}" in
99                 *cygwin) ;;
100                 *) p_=\; ;;
101                 esac
102         fi
103 fi
104
105 : Proper PATH setting
106 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
107 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
108 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
109 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
110 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
111 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
112 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
113 paths="$paths /sbin /usr/sbin /usr/libexec"
114 paths="$paths /system/gnu_library/bin"
115
116 for p in $paths
117 do
118         case "$p_$PATH$p_" in
119         *$p_$p$p_*) ;;
120         *) test -d $p && PATH=$PATH$p_$p ;;
121         esac
122 done
123
124 PATH=.$p_$PATH
125 export PATH
126
127 : shall we be using ksh?
128 inksh=''
129 needksh=''
130 avoidksh=''
131 newsh=/bin/ksh
132 changesh=''
133 if (PATH=.; alias -x) >/dev/null 2>&1; then
134                 inksh=true
135 fi
136 if test -f /hp-ux -a -f /bin/ksh; then
137         needksh='to avoid sh bug in "here document" expansion'
138 fi
139 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
140         if test X`/usr/bin/uname -v` = X4; then
141                 avoidksh="to avoid AIX 4's /bin/sh"
142                 newsh=/usr/bin/bsh
143         fi
144 fi
145 if test -f /osf_boot -a -f /usr/sbin/setld; then
146         if test X`/usr/bin/uname -s` = XOSF1; then
147                 avoidksh="to avoid Digital UNIX' ksh"
148                 newsh=/bin/sh
149                 unset BIN_SH
150         fi
151 fi
152 case "$inksh/$needksh" in
153 /[a-z]*)
154                 ENV=''
155                 changesh=true
156                 reason="$needksh"
157         ;;
158 esac
159 case "$inksh/$avoidksh" in
160 true/[a-z]*)
161         changesh=true
162         reason="$avoidksh"
163         ;;
164 esac
165 case "$inksh/$needksh-$avoidksh-" in
166 true/--)
167                 cat <<EOM
168 (I see you are using the Korn shell.  Some ksh's blow up on $me,
169 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
170 EOM
171         ;;
172 esac
173 case "$changesh" in
174 true)
175         export newsh
176         echo "(Feeding myself to $newsh $reason.)"
177         case "$0" in
178         Configure|*/Configure) exec $newsh $0 "$@";;
179         *) exec $newsh Configure "$@";;
180         esac
181         ;;
182 esac
183 test -x "${newsh}" || unset newsh
184
185 : if needed, set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *) CDPATH='' ;;
192         esac
193         ;;
194 esac
195
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 extern_C=''
211 mistrustnm=''
212 usedevel=''
213 perllibs=''
214 dynamic_ext=''
215 extensions=''
216 known_extensions=''
217 nonxs_ext=''
218 static_ext=''
219 useopcode=''
220 useposix=''
221 extras=''
222 d_bsd=''
223 d_eunice=''
224 d_xenix=''
225 eunicefix=''
226 ar=''
227 awk=''
228 bash=''
229 bison=''
230 byacc=''
231 cat=''
232 chgrp=''
233 chmod=''
234 chown=''
235 comm=''
236 compress=''
237 cp=''
238 cpio=''
239 cpp=''
240 csh=''
241 date=''
242 echo=''
243 egrep=''
244 emacs=''
245 expr=''
246 find=''
247 flex=''
248 gmake=''
249 grep=''
250 gzip=''
251 inews=''
252 ksh=''
253 less=''
254 line=''
255 lint=''
256 ln=''
257 lp=''
258 lpr=''
259 ls=''
260 mail=''
261 mailx=''
262 make=''
263 mkdir=''
264 more=''
265 mv=''
266 nm=''
267 nroff=''
268 perl=''
269 pg=''
270 pmake=''
271 pr=''
272 rm=''
273 rmail=''
274 sed=''
275 sendmail=''
276 shar=''
277 sleep=''
278 smail=''
279 sort=''
280 submit=''
281 tail=''
282 tar=''
283 tbl=''
284 tee=''
285 test=''
286 touch=''
287 tr=''
288 troff=''
289 uname=''
290 uniq=''
291 uuname=''
292 vi=''
293 zcat=''
294 zip=''
295 full_ar=''
296 full_sed=''
297 libswanted=''
298 hint=''
299 myuname=''
300 osname=''
301 osvers=''
302 Author=''
303 Date=''
304 Header=''
305 Id=''
306 Locker=''
307 Log=''
308 RCSfile=''
309 Revision=''
310 Source=''
311 State=''
312 _a=''
313 _exe=''
314 _o=''
315 archobjs=''
316 exe_ext=''
317 firstmakefile=''
318 lib_ext=''
319 obj_ext=''
320 path_sep=''
321 rm_try=''
322 afs=''
323 afsroot=''
324 alignbytes=''
325 ansi2knr=''
326 archlib=''
327 archlibexp=''
328 d_archlib=''
329 installarchlib=''
330 archname=''
331 myarchname=''
332 d_atolf=''
333 d_atoll=''
334 baserev=''
335 bin=''
336 binexp=''
337 initialinstalllocation=''
338 installbin=''
339 userelocatableinc=''
340 byteorder=''
341 cc=''
342 ccflags=''
343 cppflags=''
344 ldflags=''
345 lkflags=''
346 locincpth=''
347 optimize=''
348 cf_email=''
349 cf_by=''
350 cf_time=''
351 contains=''
352 cpp_stuff=''
353 cpplast=''
354 cppminus=''
355 cpprun=''
356 cppstdin=''
357 d__fwalk=''
358 d_access=''
359 d_accessx=''
360 d_aintl=''
361 d_alarm=''
362 asctime_r_proto=''
363 d_asctime_r=''
364 d_attribute_deprecated=''
365 d_attribute_format=''
366 d_attribute_malloc=''
367 d_attribute_nonnull=''
368 d_attribute_noreturn=''
369 d_attribute_pure=''
370 d_attribute_unused=''
371 d_attribute_warn_unused_result=''
372 d_printf_format_null=''
373 d_bcmp=''
374 d_bcopy=''
375 d_builtin_choose_expr=''
376 d_builtin_expect=''
377 d_bzero=''
378 d_c99_variadic_macros=''
379 d_casti32=''
380 castflags=''
381 d_castneg=''
382 d_chown=''
383 d_chroot=''
384 d_chsize=''
385 d_class=''
386 d_clearenv=''
387 d_closedir=''
388 d_void_closedir=''
389 d_cmsghdr_s=''
390 d_const=''
391 d_copysignl=''
392 d_cplusplus=''
393 cryptlib=''
394 d_crypt=''
395 crypt_r_proto=''
396 d_crypt_r=''
397 d_csh=''
398 full_csh=''
399 d_ctermid=''
400 ctermid_r_proto=''
401 d_ctermid_r=''
402 ctime_r_proto=''
403 d_ctime_r=''
404 d_cuserid=''
405 d_dbl_dig=''
406 d_dbminitproto=''
407 d_difftime=''
408 d_dir_dd_fd=''
409 d_dirfd=''
410 d_dlerror=''
411 d_dlopen=''
412 d_dlsymun=''
413 d_dosuid=''
414 d_suidsafe=''
415 d_drand48_r=''
416 drand48_r_proto=''
417 d_drand48proto=''
418 d_dup2=''
419 d_eaccess=''
420 d_endgrent=''
421 d_endgrent_r=''
422 endgrent_r_proto=''
423 d_endhent=''
424 d_endhostent_r=''
425 endhostent_r_proto=''
426 d_endnent=''
427 d_endnetent_r=''
428 endnetent_r_proto=''
429 d_endpent=''
430 d_endprotoent_r=''
431 endprotoent_r_proto=''
432 d_endpwent=''
433 d_endpwent_r=''
434 endpwent_r_proto=''
435 d_endsent=''
436 d_endservent_r=''
437 endservent_r_proto=''
438 d_faststdio=''
439 d_fchdir=''
440 d_fchmod=''
441 d_fchown=''
442 d_fcntl=''
443 d_fcntl_can_lock=''
444 d_fd_macros=''
445 d_fd_set=''
446 d_fds_bits=''
447 d_fgetpos=''
448 d_finite=''
449 d_finitel=''
450 d_flexfnam=''
451 d_flock=''
452 d_flockproto=''
453 d_fork=''
454 d_fp_class=''
455 d_fpclass=''
456 d_fpclassify=''
457 d_fpclassl=''
458 d_fpos64_t=''
459 d_frexpl=''
460 d_fs_data_s=''
461 d_fseeko=''
462 d_fsetpos=''
463 d_fstatfs=''
464 d_fsync=''
465 d_ftello=''
466 d_ftime=''
467 d_gettimeod=''
468 d_futimes=''
469 d_Gconvert=''
470 d_getaddrinfo=''
471 d_getcwd=''
472 d_getespwnam=''
473 d_getfsstat=''
474 d_getgrent=''
475 d_getgrent_r=''
476 getgrent_r_proto=''
477 d_getgrgid_r=''
478 getgrgid_r_proto=''
479 d_getgrnam_r=''
480 getgrnam_r_proto=''
481 d_getgrps=''
482 d_gethbyaddr=''
483 d_gethbyname=''
484 d_gethent=''
485 aphostname=''
486 d_gethname=''
487 d_phostname=''
488 d_uname=''
489 d_gethostbyaddr_r=''
490 gethostbyaddr_r_proto=''
491 d_gethostbyname_r=''
492 gethostbyname_r_proto=''
493 d_gethostent_r=''
494 gethostent_r_proto=''
495 d_gethostprotos=''
496 d_getitimer=''
497 d_getlogin=''
498 d_getlogin_r=''
499 getlogin_r_proto=''
500 d_getmnt=''
501 d_getmntent=''
502 d_getnameinfo=''
503 d_getnbyaddr=''
504 d_getnbyname=''
505 d_getnent=''
506 d_getnetbyaddr_r=''
507 getnetbyaddr_r_proto=''
508 d_getnetbyname_r=''
509 getnetbyname_r_proto=''
510 d_getnetent_r=''
511 getnetent_r_proto=''
512 d_getnetprotos=''
513 d_getpagsz=''
514 d_getpent=''
515 d_getpgid=''
516 d_getpgrp2=''
517 d_bsdgetpgrp=''
518 d_getpgrp=''
519 d_getppid=''
520 d_getprior=''
521 d_getpbyname=''
522 d_getpbynumber=''
523 d_getprotobyname_r=''
524 getprotobyname_r_proto=''
525 d_getprotobynumber_r=''
526 getprotobynumber_r_proto=''
527 d_getprotoent_r=''
528 getprotoent_r_proto=''
529 d_getprotoprotos=''
530 d_getprpwnam=''
531 d_getpwent=''
532 d_getpwent_r=''
533 getpwent_r_proto=''
534 d_getpwnam_r=''
535 getpwnam_r_proto=''
536 d_getpwuid_r=''
537 getpwuid_r_proto=''
538 d_getsent=''
539 d_getservbyname_r=''
540 getservbyname_r_proto=''
541 d_getservbyport_r=''
542 getservbyport_r_proto=''
543 d_getservent_r=''
544 getservent_r_proto=''
545 d_getservprotos=''
546 d_getspnam=''
547 d_getspnam_r=''
548 getspnam_r_proto=''
549 d_getsbyname=''
550 d_getsbyport=''
551 d_gmtime_r=''
552 gmtime_r_proto=''
553 d_gnulibc=''
554 gnulibc_version=''
555 d_hasmntopt=''
556 d_htonl=''
557 d_ilogbl=''
558 d_inetaton=''
559 d_inetntop=''
560 d_inetpton=''
561 d_int64_t=''
562 d_isascii=''
563 d_isfinite=''
564 d_isinf=''
565 d_isnan=''
566 d_isnanl=''
567 d_killpg=''
568 d_lchown=''
569 d_ldbl_dig=''
570 d_libm_lib_version=''
571 d_link=''
572 d_localtime_r=''
573 d_localtime_r_needs_tzset=''
574 localtime_r_proto=''
575 d_locconv=''
576 d_lockf=''
577 d_longdbl=''
578 longdblsize=''
579 d_longlong=''
580 longlongsize=''
581 d_lseekproto=''
582 d_lstat=''
583 d_madvise=''
584 d_malloc_good_size=''
585 d_malloc_size=''
586 d_mblen=''
587 d_mbstowcs=''
588 d_mbtowc=''
589 d_memchr=''
590 d_memcmp=''
591 d_memcpy=''
592 d_memmove=''
593 d_memset=''
594 d_mkdir=''
595 d_mkdtemp=''
596 d_mkfifo=''
597 d_mkstemp=''
598 d_mkstemps=''
599 d_mktime=''
600 d_mmap=''
601 mmaptype=''
602 d_modfl=''
603 d_modfl_pow32_bug=''
604 d_modflproto=''
605 d_mprotect=''
606 d_msg=''
607 d_msgctl=''
608 d_msgget=''
609 d_msghdr_s=''
610 d_msgrcv=''
611 d_msgsnd=''
612 d_msync=''
613 d_munmap=''
614 d_nice=''
615 d_nl_langinfo=''
616 d_off64_t=''
617 d_open3=''
618 d_fpathconf=''
619 d_pathconf=''
620 d_pause=''
621 d_pipe=''
622 d_poll=''
623 d_portable=''
624 d_procselfexe=''
625 procselfexe=''
626 d_old_pthread_create_joinable=''
627 old_pthread_create_joinable=''
628 d_pthread_atfork=''
629 d_pthread_attr_setscope=''
630 d_pthread_yield=''
631 d_sched_yield=''
632 sched_yield=''
633 d_qgcvt=''
634 d_random_r=''
635 random_r_proto=''
636 d_readdir64_r=''
637 readdir64_r_proto=''
638 d_readdir=''
639 d_rewinddir=''
640 d_seekdir=''
641 d_telldir=''
642 d_readdir_r=''
643 readdir_r_proto=''
644 d_readlink=''
645 d_readv=''
646 d_recvmsg=''
647 d_rename=''
648 d_rmdir=''
649 d_safebcpy=''
650 d_safemcpy=''
651 d_sanemcmp=''
652 d_sbrkproto=''
653 d_scalbnl=''
654 d_select=''
655 d_sem=''
656 d_semctl=''
657 d_semget=''
658 d_semop=''
659 d_sendmsg=''
660 d_setegid=''
661 d_seteuid=''
662 d_setgrent=''
663 d_setgrent_r=''
664 setgrent_r_proto=''
665 d_setgrps=''
666 d_sethent=''
667 d_sethostent_r=''
668 sethostent_r_proto=''
669 d_setitimer=''
670 d_setlinebuf=''
671 d_setlocale=''
672 d_setlocale_r=''
673 setlocale_r_proto=''
674 d_setnent=''
675 d_setnetent_r=''
676 setnetent_r_proto=''
677 d_setpent=''
678 d_setpgid=''
679 d_setpgrp2=''
680 d_bsdsetpgrp=''
681 d_setpgrp=''
682 d_setprior=''
683 d_setproctitle=''
684 d_setprotoent_r=''
685 setprotoent_r_proto=''
686 d_setpwent=''
687 d_setpwent_r=''
688 setpwent_r_proto=''
689 d_setregid=''
690 d_setresgid=''
691 d_setresuid=''
692 d_setreuid=''
693 d_setrgid=''
694 d_setruid=''
695 d_setsent=''
696 d_setservent_r=''
697 setservent_r_proto=''
698 d_setsid=''
699 d_setvbuf=''
700 d_sfio=''
701 usesfio=''
702 d_shm=''
703 d_shmat=''
704 d_shmatprototype=''
705 shmattype=''
706 d_shmctl=''
707 d_shmdt=''
708 d_shmget=''
709 d_sigaction=''
710 d_signbit=''
711 d_sigprocmask=''
712 d_sigsetjmp=''
713 usesitecustomize=''
714 d_snprintf=''
715 d_vsnprintf=''
716 d_sockatmark=''
717 d_sockatmarkproto=''
718 d_msg_ctrunc=''
719 d_msg_dontroute=''
720 d_msg_oob=''
721 d_msg_peek=''
722 d_msg_proxy=''
723 d_oldsock=''
724 d_scm_rights=''
725 d_socket=''
726 d_sockpair=''
727 sockethdr=''
728 socketlib=''
729 d_socklen_t=''
730 d_socks5_init=''
731 d_sprintf_returns_strlen=''
732 d_sqrtl=''
733 d_srand48_r=''
734 srand48_r_proto=''
735 d_srandom_r=''
736 srandom_r_proto=''
737 d_sresgproto=''
738 d_sresuproto=''
739 d_statblks=''
740 d_statfs_f_flags=''
741 d_statfs_s=''
742 d_fstatvfs=''
743 d_statvfs=''
744 d_stdio_cnt_lval=''
745 d_stdio_ptr_lval=''
746 d_stdio_ptr_lval_nochange_cnt=''
747 d_stdio_ptr_lval_sets_cnt=''
748 d_stdiobase=''
749 d_stdstdio=''
750 stdio_base=''
751 stdio_bufsiz=''
752 stdio_cnt=''
753 stdio_filbuf=''
754 stdio_ptr=''
755 d_index=''
756 d_strchr=''
757 d_strcoll=''
758 d_strctcpy=''
759 d_strerrm=''
760 d_strerror=''
761 d_sysernlst=''
762 d_syserrlst=''
763 d_strerror_r=''
764 strerror_r_proto=''
765 d_strftime=''
766 d_strlcat=''
767 d_strlcpy=''
768 d_strtod=''
769 d_strtol=''
770 d_strtold=''
771 d_strtoll=''
772 d_strtoq=''
773 d_strtoul=''
774 d_strtoull=''
775 d_strtouq=''
776 d_strxfrm=''
777 d_symlink=''
778 d_syscall=''
779 d_syscallproto=''
780 d_sysconf=''
781 d_system=''
782 d_tcgetpgrp=''
783 d_tcsetpgrp=''
784 d_telldirproto=''
785 d_time=''
786 timetype=''
787 d_asctime64=''
788 d_ctime64=''
789 d_difftime64=''
790 d_gmtime64=''
791 d_localtime64=''
792 d_mktime64=''
793 d_timegm=''
794 clocktype=''
795 d_times=''
796 d_tmpnam_r=''
797 tmpnam_r_proto=''
798 d_truncate=''
799 d_ttyname_r=''
800 ttyname_r_proto=''
801 d_tzname=''
802 d_u32align=''
803 d_ualarm=''
804 d_umask=''
805 d_semctl_semid_ds=''
806 d_semctl_semun=''
807 d_union_semun=''
808 d_unordered=''
809 d_unsetenv=''
810 d_usleep=''
811 d_usleepproto=''
812 d_ustat=''
813 d_pseudofork=''
814 d_vfork=''
815 usevfork=''
816 d_voidsig=''
817 signal_t=''
818 d_volatile=''
819 d_charvspr=''
820 d_vprintf=''
821 d_wait4=''
822 d_waitpid=''
823 d_wcstombs=''
824 d_wctomb=''
825 d_writev=''
826 dlext=''
827 cccdlflags=''
828 ccdlflags=''
829 dlsrc=''
830 ld=''
831 lddlflags=''
832 usedl=''
833 doublesize=''
834 ebcdic=''
835 fflushNULL=''
836 fflushall=''
837 fpossize=''
838 fpostype=''
839 gccansipedantic=''
840 gccosandvers=''
841 gccversion=''
842 gidformat=''
843 gidsign=''
844 gidsize=''
845 gidtype=''
846 groupstype=''
847 h_fcntl=''
848 h_sysfile=''
849 html1dir=''
850 html1direxp=''
851 installhtml1dir=''
852 html3dir=''
853 html3direxp=''
854 installhtml3dir=''
855 i_arpainet=''
856 i_assert=''
857 i_crypt=''
858 db_hashtype=''
859 db_prefixtype=''
860 db_version_major=''
861 db_version_minor=''
862 db_version_patch=''
863 i_db=''
864 i_dbm=''
865 i_rpcsvcdbm=''
866 d_dirnamlen=''
867 direntrytype=''
868 i_dirent=''
869 i_dld=''
870 i_dlfcn=''
871 i_fcntl=''
872 i_float=''
873 i_fp=''
874 i_fp_class=''
875 i_gdbm=''
876 d_grpasswd=''
877 i_grp=''
878 i_ieeefp=''
879 i_inttypes=''
880 i_langinfo=''
881 i_libutil=''
882 i_limits=''
883 i_locale=''
884 i_machcthr=''
885 i_malloc=''
886 i_mallocmalloc=''
887 i_math=''
888 i_memory=''
889 i_mntent=''
890 d_gdbm_ndbm_h_uses_prototypes=''
891 d_gdbmndbm_h_uses_prototypes=''
892 d_ndbm=''
893 d_ndbm_h_uses_prototypes=''
894 i_gdbm_ndbm=''
895 i_gdbmndbm=''
896 i_ndbm=''
897 i_netdb=''
898 i_neterrno=''
899 i_netinettcp=''
900 i_niin=''
901 i_sysin=''
902 i_poll=''
903 i_prot=''
904 i_pthread=''
905 d_pwage=''
906 d_pwchange=''
907 d_pwclass=''
908 d_pwcomment=''
909 d_pwexpire=''
910 d_pwgecos=''
911 d_pwpasswd=''
912 d_pwquota=''
913 i_pwd=''
914 i_sfio=''
915 i_shadow=''
916 i_socks=''
917 i_stddef=''
918 i_stdlib=''
919 i_string=''
920 strings=''
921 i_sunmath=''
922 i_sysaccess=''
923 i_sysdir=''
924 i_sysfile=''
925 d_voidtty=''
926 i_bsdioctl=''
927 i_sysfilio=''
928 i_sysioctl=''
929 i_syssockio=''
930 i_syslog=''
931 i_sysmman=''
932 i_sysmode=''
933 i_sysmount=''
934 i_sysndir=''
935 i_sysparam=''
936 i_syspoll=''
937 i_sysresrc=''
938 i_syssecrt=''
939 i_sysselct=''
940 i_sysstat=''
941 i_sysstatfs=''
942 i_sysstatvfs=''
943 i_systimes=''
944 i_systypes=''
945 i_sysuio=''
946 i_sysun=''
947 i_sysutsname=''
948 i_sysvfs=''
949 i_syswait=''
950 i_sgtty=''
951 i_termio=''
952 i_termios=''
953 d_tm_tm_gmtoff=''
954 d_tm_tm_zone=''
955 i_systime=''
956 i_systimek=''
957 i_time=''
958 timeincl=''
959 i_unistd=''
960 i_ustat=''
961 i_utime=''
962 i_values=''
963 i_stdarg=''
964 i_varargs=''
965 i_varhdr=''
966 i_vfork=''
967 d_inc_version_list=''
968 inc_version_list=''
969 inc_version_list_init=''
970 installprefix=''
971 installprefixexp=''
972 installstyle=''
973 installusrbinperl=''
974 intsize=''
975 longsize=''
976 shortsize=''
977 issymlink=''
978 libc=''
979 ldlibpthname=''
980 libperl=''
981 shrpenv=''
982 useshrplib=''
983 glibpth=''
984 libpth=''
985 loclibpth=''
986 plibpth=''
987 xlibpth=''
988 ignore_versioned_solibs=''
989 libs=''
990 libsdirs=''
991 libsfiles=''
992 libsfound=''
993 libspath=''
994 lns=''
995 d_PRIEUldbl=''
996 d_PRIFUldbl=''
997 d_PRIGUldbl=''
998 d_PRIeldbl=''
999 d_PRIfldbl=''
1000 d_PRIgldbl=''
1001 d_SCNfldbl=''
1002 sPRIEUldbl=''
1003 sPRIFUldbl=''
1004 sPRIGUldbl=''
1005 sPRIeldbl=''
1006 sPRIfldbl=''
1007 sPRIgldbl=''
1008 sSCNfldbl=''
1009 lseeksize=''
1010 lseektype=''
1011 mad=''
1012 madlyh=''
1013 madlyobj=''
1014 madlysrc=''
1015 make_set_make=''
1016 d_mymalloc=''
1017 freetype=''
1018 mallocobj=''
1019 mallocsrc=''
1020 malloctype=''
1021 usemallocwrap=''
1022 usemymalloc=''
1023 installman1dir=''
1024 man1dir=''
1025 man1direxp=''
1026 man1ext=''
1027 installman3dir=''
1028 man3dir=''
1029 man3direxp=''
1030 man3ext=''
1031 modetype=''
1032 multiarch=''
1033 mydomain=''
1034 myhostname=''
1035 phostname=''
1036 c=''
1037 n=''
1038 d_eofnblk=''
1039 eagain=''
1040 o_nonblock=''
1041 rd_nodata=''
1042 need_va_copy=''
1043 netdb_hlen_type=''
1044 netdb_host_type=''
1045 netdb_name_type=''
1046 netdb_net_type=''
1047 groupcat=''
1048 hostcat=''
1049 passcat=''
1050 orderlib=''
1051 ranlib=''
1052 d_perl_otherlibdirs=''
1053 otherlibdirs=''
1054 package=''
1055 spackage=''
1056 pager=''
1057 api_revision=''
1058 api_subversion=''
1059 api_version=''
1060 api_versionstring=''
1061 patchlevel=''
1062 perl_patchlevel=''
1063 revision=''
1064 subversion=''
1065 version=''
1066 version_patchlevel_string=''
1067 perl5=''
1068 perladmin=''
1069 perlpath=''
1070 d_nv_preserves_uv=''
1071 d_nv_zero_is_allbits_zero=''
1072 i16size=''
1073 i16type=''
1074 i32size=''
1075 i32type=''
1076 i64size=''
1077 i64type=''
1078 i8size=''
1079 i8type=''
1080 ivsize=''
1081 ivtype=''
1082 nv_overflows_integers_at=''
1083 nv_preserves_uv_bits=''
1084 nvsize=''
1085 nvtype=''
1086 u16size=''
1087 u16type=''
1088 u32size=''
1089 u32type=''
1090 u64size=''
1091 u64type=''
1092 u8size=''
1093 u8type=''
1094 uvsize=''
1095 uvtype=''
1096 ivdformat=''
1097 nvEUformat=''
1098 nvFUformat=''
1099 nvGUformat=''
1100 nveformat=''
1101 nvfformat=''
1102 nvgformat=''
1103 uvXUformat=''
1104 uvoformat=''
1105 uvuformat=''
1106 uvxformat=''
1107 pidtype=''
1108 prefix=''
1109 prefixexp=''
1110 installprivlib=''
1111 privlib=''
1112 privlibexp=''
1113 prototype=''
1114 ptrsize=''
1115 d_PRIXU64=''
1116 d_PRId64=''
1117 d_PRIi64=''
1118 d_PRIo64=''
1119 d_PRIu64=''
1120 d_PRIx64=''
1121 sPRIXU64=''
1122 sPRId64=''
1123 sPRIi64=''
1124 sPRIo64=''
1125 sPRIu64=''
1126 sPRIx64=''
1127 d_quad=''
1128 quadkind=''
1129 quadtype=''
1130 uquadtype=''
1131 drand01=''
1132 randbits=''
1133 randfunc=''
1134 randseedtype=''
1135 seedfunc=''
1136 installscript=''
1137 scriptdir=''
1138 scriptdirexp=''
1139 selectminbits=''
1140 selecttype=''
1141 sh=''
1142 sig_count=''
1143 sig_name=''
1144 sig_name_init=''
1145 sig_num=''
1146 sig_num_init=''
1147 sig_size=''
1148 d_sitearch=''
1149 installsitearch=''
1150 sitearch=''
1151 sitearchexp=''
1152 installsitebin=''
1153 sitebin=''
1154 sitebinexp=''
1155 installsitehtml1dir=''
1156 sitehtml1dir=''
1157 sitehtml1direxp=''
1158 installsitehtml3dir=''
1159 sitehtml3dir=''
1160 sitehtml3direxp=''
1161 installsitelib=''
1162 sitelib=''
1163 sitelib_stem=''
1164 sitelibexp=''
1165 installsiteman1dir=''
1166 siteman1dir=''
1167 siteman1direxp=''
1168 installsiteman3dir=''
1169 siteman3dir=''
1170 siteman3direxp=''
1171 siteprefix=''
1172 siteprefixexp=''
1173 installsitescript=''
1174 sitescript=''
1175 sitescriptexp=''
1176 sizesize=''
1177 sizetype=''
1178 so=''
1179 socksizetype=''
1180 sharpbang=''
1181 shsharp=''
1182 spitshell=''
1183 src=''
1184 ssizetype=''
1185 startperl=''
1186 startsh=''
1187 stdchar=''
1188 d_stdio_stream_array=''
1189 stdio_stream_array=''
1190 sysman=''
1191 sGMTIME_max=''
1192 sGMTIME_min=''
1193 sLOCALTIME_max=''
1194 sLOCALTIME_min=''
1195 trnl=''
1196 uidformat=''
1197 uidsign=''
1198 uidsize=''
1199 uidtype=''
1200 archname64=''
1201 use64bitall=''
1202 use64bitint=''
1203 dtrace=''
1204 usedtrace=''
1205 usefaststdio=''
1206 ccflags_uselargefiles=''
1207 ldflags_uselargefiles=''
1208 libswanted_uselargefiles=''
1209 uselargefiles=''
1210 uselongdouble=''
1211 usemorebits=''
1212 usemultiplicity=''
1213 nm_opt=''
1214 nm_so_opt=''
1215 runnm=''
1216 usenm=''
1217 useperlio=''
1218 usesocks=''
1219 d_oldpthreads=''
1220 use5005threads=''
1221 useithreads=''
1222 usereentrant=''
1223 usethreads=''
1224 incpath=''
1225 mips_type=''
1226 usrinc=''
1227 d_vendorarch=''
1228 installvendorarch=''
1229 vendorarch=''
1230 vendorarchexp=''
1231 d_vendorbin=''
1232 installvendorbin=''
1233 vendorbin=''
1234 vendorbinexp=''
1235 installvendorhtml1dir=''
1236 vendorhtml1dir=''
1237 vendorhtml1direxp=''
1238 installvendorhtml3dir=''
1239 vendorhtml3dir=''
1240 vendorhtml3direxp=''
1241 d_vendorlib=''
1242 installvendorlib=''
1243 vendorlib=''
1244 vendorlib_stem=''
1245 vendorlibexp=''
1246 installvendorman1dir=''
1247 vendorman1dir=''
1248 vendorman1direxp=''
1249 installvendorman3dir=''
1250 vendorman3dir=''
1251 vendorman3direxp=''
1252 usevendorprefix=''
1253 vendorprefix=''
1254 vendorprefixexp=''
1255 d_vendorscript=''
1256 installvendorscript=''
1257 vendorscript=''
1258 vendorscriptexp=''
1259 versiononly=''
1260 defvoidused=''
1261 voidflags=''
1262 yacc=''
1263 yaccflags=''
1264 CONFIG=''
1265
1266 : Detect odd OSs
1267 define='define'
1268 undef='undef'
1269 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1270 rmlist=''
1271
1272 : We must find out about Eunice early
1273 eunicefix=':'
1274 if test -f /etc/unixtovms; then
1275         eunicefix=/etc/unixtovms
1276 fi
1277 if test -f /etc/unixtovms.exe; then
1278         eunicefix=/etc/unixtovms.exe
1279 fi
1280
1281 : Set executable suffix now -- needed before hints available
1282 if test -f "/libs/version.library"; then
1283 : Amiga OS
1284     _exe=""
1285 elif test -f "/system/gnu_library/bin/ar.pm"; then
1286 : Stratus VOS
1287     _exe=".pm"
1288 elif test -n "$DJGPP"; then
1289 : DOS DJGPP
1290     _exe=".exe"
1291 elif test -d c:/. -o -n "$is_os2" ; then
1292 : OS/2 or cygwin
1293     _exe=".exe"
1294 fi
1295
1296 groupstype=''
1297 i_whoami=''
1298 : Trailing extension.  Override this in a hint file, if needed.
1299 : Extra object files, if any, needed on this platform.
1300 archobjs=''
1301 archname=''
1302 libnames=''
1303 : change the next line if compiling for Xenix/286 on Xenix/386
1304 xlibpth='/usr/lib/386 /lib/386'
1305 : Possible local library directories to search.
1306 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1307 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1308
1309 : general looking path for locating libraries
1310 glibpth="/lib /usr/lib $xlibpth"
1311 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1312 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1313 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1314 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1315
1316 : Private path used by Configure to find libraries.  Its value
1317 : is prepended to libpth. This variable takes care of special
1318 : machines, like the mips.  Usually, it should be empty.
1319 plibpth=''
1320
1321 : default library list
1322 libswanted=''
1323 : some systems want to use only the non-versioned libso:s
1324 ignore_versioned_solibs=''
1325 : set usethreads on the Configure command line to enable threads.
1326 usereentrant='undef'
1327 : full support for void wanted by default
1328 defvoidused=15
1329
1330 : Possible local include directories to search.
1331 : Set locincpth to "" in a hint file to defeat local include searches.
1332 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1333 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1334 :
1335 : no include file wanted by default
1336 inclwanted=''
1337
1338 : Enable -DEBUGGING and -DDEBUGGING from the command line
1339 EBUGGING=''
1340 DEBUGGING=old
1341
1342 ccname=''
1343 ccversion=''
1344 perllibs=''
1345 : set useposix=false in your hint file to disable the POSIX extension.
1346 useposix=true
1347 : set useopcode=false in your hint file to disable the Opcode extension.
1348 useopcode=true
1349 archname64=''
1350 ccflags_uselargefiles=''
1351 ldflags_uselargefiles=''
1352 libswanted_uselargefiles=''
1353 : set usemultiplicity on the Configure command line to enable multiplicity.
1354 : set usesocks on the Configure command line to enable socks.
1355 : List of libraries we want.
1356 : If anyone needs extra -lxxx, put those in a hint file.
1357 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1358 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1359 : We probably want to search /usr/shlib before most other libraries.
1360 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1361 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1362 glibpth="/usr/shlib $glibpth"
1363 : Do not use vfork unless overridden by a hint file.
1364 usevfork=false
1365
1366 : Find the basic shell for Bourne shell scripts
1367 case "$sh" in
1368 '')
1369         case "$SYSTYPE" in
1370         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1371         *) xxx='/bin/sh';;
1372         esac
1373         if test -f "$xxx"; then
1374                 sh="$xxx"
1375         else
1376                 : Build up a list and do a single loop so we can 'break' out.
1377                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1378                 for xxx in sh bash ksh pdksh ash; do
1379                         for p in $pth; do
1380                                 try="$try ${p}/${xxx}"
1381                         done
1382                 done
1383                 for xxx in $try; do
1384                         if test -f "$xxx"; then
1385                                 sh="$xxx";
1386                                 break
1387                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1388                                 sh="$xxx";
1389                                 break
1390                         elif test -f "$xxx.exe"; then
1391                                 sh="$xxx";
1392                                 break
1393                         fi
1394                 done
1395         fi
1396         ;;
1397 esac
1398
1399 case "$sh" in
1400 '')     cat >&2 <<EOM
1401 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1402
1403 Usually it's in /bin/sh.  How did you even get this far?
1404 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1405 we'll try to straighten this all out.
1406 EOM
1407         exit 1
1408         ;;
1409 esac
1410
1411 : see if sh knows # comments
1412 if `$sh -c '#' >/dev/null 2>&1`; then
1413         shsharp=true
1414         spitshell=cat
1415         xcat=/bin/cat
1416         test -f $xcat$_exe || xcat=/usr/bin/cat
1417         if test ! -f $xcat$_exe; then
1418                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1419                         if test -f $p/cat$_exe; then
1420                                 xcat=$p/cat
1421                                 break
1422                         fi
1423                 done
1424                 if test ! -f $xcat$_exe; then
1425                         echo "Can't find cat anywhere!"
1426                         exit 1
1427                 fi
1428         fi
1429         echo "#!$xcat" >sharp
1430         $eunicefix sharp
1431         chmod +x sharp
1432         ./sharp > today 2>/dev/null
1433         if test -s today; then
1434                 sharpbang='#!'
1435         else
1436                 echo "#! $xcat" > sharp
1437                 $eunicefix sharp
1438                 chmod +x sharp
1439                 ./sharp > today 2>/dev/null
1440                 if test -s today; then
1441                         sharpbang='#! '
1442                 else
1443                         sharpbang=': use '
1444                 fi
1445         fi
1446 else
1447         echo " "
1448         echo "Your $sh doesn't grok # comments--I will strip them later on."
1449         shsharp=false
1450         cd ..
1451         echo "exec grep -v '^[  ]*#'" >spitshell
1452         chmod +x spitshell
1453         $eunicefix spitshell
1454         spitshell=`pwd`/spitshell
1455         cd UU
1456         echo "I presume that if # doesn't work, #! won't work either!"
1457         sharpbang=': use '
1458 fi
1459 rm -f sharp today
1460
1461 : figure out how to guarantee sh startup
1462 case "$startsh" in
1463 '') startsh=${sharpbang}${sh} ;;
1464 *)
1465 esac
1466 cat >sharp <<EOSS
1467 $startsh
1468 set abc
1469 test "$?abc" != 1
1470 EOSS
1471
1472 chmod +x sharp
1473 $eunicefix sharp
1474 if ./sharp; then
1475         : echo "Yup, it does."
1476 else
1477         echo "Hmm... '$startsh' does not guarantee sh startup..."
1478         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1479 fi
1480 rm -f sharp
1481
1482 : Save command line options in file UU/cmdline.opt for later use in
1483 : generating config.sh.
1484 cat > cmdline.opt <<EOSH
1485 : Configure command line arguments.
1486 config_arg0='$0'
1487 config_args='$*'
1488 config_argc=$#
1489 EOSH
1490 argn=1
1491 args_exp=''
1492 args_sep=''
1493 for arg in "$@"; do
1494         cat >>cmdline.opt <<EOSH
1495 config_arg$argn='$arg'
1496 EOSH
1497         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1498 $arg
1499 EOC
1500         arg_exp=`cat cmdl.opt`
1501         args_exp="$args_exp$args_sep'$arg_exp'"
1502         argn=`expr $argn + 1`
1503         args_sep=' '
1504 done
1505 rm -f cmdl.opt
1506
1507 : produce awk script to parse command line options
1508 cat >options.awk <<'EOF'
1509 BEGIN {
1510         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1511
1512         len = length(optstr);
1513         for (i = 1; i <= len; i++) {
1514                 c = substr(optstr, i, 1);
1515                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1516                 if (a == ":") {
1517                         arg[c] = 1;
1518                         i++;
1519                 }
1520                 opt[c] = 1;
1521         }
1522 }
1523 {
1524         expect = 0;
1525         str = $0;
1526         if (substr(str, 1, 1) != "-") {
1527                 printf("'%s'\n", str);
1528                 next;
1529         }
1530         len = length($0);
1531         for (i = 2; i <= len; i++) {
1532                 c = substr(str, i, 1);
1533                 if (!opt[c]) {
1534                         printf("-%s\n", substr(str, i));
1535                         next;
1536                 }
1537                 printf("-%s\n", c);
1538                 if (arg[c]) {
1539                         if (i < len)
1540                                 printf("'%s'\n", substr(str, i + 1));
1541                         else
1542                                 expect = 1;
1543                         next;
1544                 }
1545         }
1546 }
1547 END {
1548         if (expect)
1549                 print "?";
1550 }
1551 EOF
1552
1553 : process the command line options
1554 set X `for arg in "$@"; do echo "X$arg"; done |
1555         sed -e s/X// | awk -f options.awk`
1556 eval "set $*"
1557 shift
1558 rm -f options.awk
1559
1560 : set up default values
1561 fastread=''
1562 reuseval=false
1563 config_sh=''
1564 alldone=''
1565 error=''
1566 silent=''
1567 extractsh=''
1568 override=''
1569 knowitall=''
1570 rm -f optdef.sh posthint.sh
1571 cat >optdef.sh <<EOS
1572 $startsh
1573 EOS
1574
1575
1576 : option parsing
1577 while test $# -gt 0; do
1578         case "$1" in
1579         -d) shift; fastread=yes;;
1580         -e) shift; alldone=cont;;
1581         -f)
1582                 shift
1583                 cd ..
1584                 if test -r "$1"; then
1585                         config_sh="$1"
1586                 else
1587                         echo "$me: cannot read config file $1." >&2
1588                         error=true
1589                 fi
1590                 cd UU
1591                 shift;;
1592         --help|\
1593         -h) shift; error=true;;
1594         -r) shift; reuseval=true;;
1595         -s) shift; silent=true; realsilent=true;;
1596         -E) shift; alldone=exit;;
1597         -K) shift; knowitall=true;;
1598         -O) shift; override=true;;
1599         -S) shift; silent=true; extractsh=true;;
1600         -D)
1601                 shift
1602                 case "$1" in
1603                 *=)
1604                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1605                         echo "$me: ignoring -D $1" >&2
1606                         ;;
1607                 *=*) echo "$1" | \
1608                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1609                 *) echo "$1='define'" >> optdef.sh;;
1610                 esac
1611                 shift
1612                 ;;
1613         -U)
1614                 shift
1615                 case "$1" in
1616                 *=) echo "$1" >> optdef.sh;;
1617                 *=*)
1618                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1619                         echo "$me: ignoring -U $1" >&2
1620                         ;;
1621                 *) echo "$1='undef'" >> optdef.sh;;
1622                 esac
1623                 shift
1624                 ;;
1625         -A)
1626             shift
1627             xxx=''
1628             yyy="$1"
1629             zzz=''
1630             uuu=undef
1631             case "$yyy" in
1632             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1633                  case "$zzz" in
1634                  *:*) zzz='' ;;
1635                  *)   xxx=append
1636                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1637                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1638                  esac
1639                  ;;
1640             esac
1641             case "$xxx" in
1642             '')  case "$yyy" in
1643                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1644                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1645                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1646                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1647                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1648                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1649                  esac
1650                  ;;
1651             esac
1652             case "$xxx" in
1653             append)
1654                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1655             clear)
1656                 echo "$yyy=''"                  >> posthint.sh ;;
1657             define)
1658                 case "$zzz" in
1659                 '') zzz=define ;;
1660                 esac
1661                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1662             eval)
1663                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1664             prepend)
1665                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1666             undef)
1667                 case "$zzz" in
1668                 '') zzz="$uuu" ;;
1669                 esac
1670                 echo "$yyy=$zzz"                >> posthint.sh ;;
1671             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1672             esac
1673             shift
1674             ;;
1675         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1676             exit 0;;
1677         --) break;;
1678         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1679         *) break;;
1680         esac
1681 done
1682
1683 case "$error" in
1684 true)
1685         cat >&2 <<EOM
1686 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1687                  [-U symbol] [-U symbol=] [-A command:symbol...]
1688   -d : use defaults for all answers.
1689   -e : go on without questioning past the production of config.sh.
1690   -f : specify an alternate default configuration file.
1691   -h : print this help message and exit (with an error status).
1692   -r : reuse C symbols value if possible (skips costly nm extraction).
1693   -s : silent mode, only echoes questions and essential information.
1694   -D : define symbol to have some value:
1695          -D symbol         symbol gets the value 'define'
1696          -D symbol=value   symbol gets the value 'value'
1697        common used examples (see INSTALL for more info):
1698          -Duse64bitint            use 64bit integers
1699          -Duse64bitall            use 64bit integers and pointers
1700          -Dusethreads             use thread support
1701          -Dinc_version_list=none  do not include older perl trees in @INC
1702          -DEBUGGING=none          DEBUGGING options
1703          -Dcc=gcc                 choose your compiler
1704          -Dprefix=/opt/perl5      choose your destination
1705   -E : stop at the end of questions, after having produced config.sh.
1706   -K : do not use unless you know what you are doing.
1707   -O : let -D and -U override definitions from loaded configuration file.
1708   -S : perform variable substitutions on all .SH files (can mix with -f)
1709   -U : undefine symbol:
1710          -U symbol    symbol gets the value 'undef'
1711          -U symbol=   symbol gets completely empty
1712        e.g.:  -Uversiononly
1713   -A : manipulate symbol after the platform specific hints have been applied:
1714          -A append:symbol=value   append value to symbol
1715          -A symbol=value          like append:, but with a separating space
1716          -A define:symbol=value   define symbol to have value
1717          -A clear:symbol          define symbol to be ''
1718          -A define:symbol         define symbol to be 'define'
1719          -A eval:symbol=value     define symbol to be eval of value
1720          -A prepend:symbol=value  prepend value to symbol
1721          -A undef:symbol          define symbol to be 'undef'
1722          -A undef:symbol=         define symbol to be ''
1723        e.g.:  -A prepend:libswanted='cl pthread '
1724               -A ccflags=-DSOME_MACRO
1725   -V : print version number and exit (with a zero status).
1726 EOM
1727         exit 1
1728         ;;
1729 esac
1730
1731 : Sanity checks
1732 case "$fastread$alldone" in
1733 yescont|yesexit) ;;
1734 *)
1735         case "$extractsh" in
1736         true) ;;
1737         *)
1738                 if test ! -t 0; then
1739                         echo "Say 'sh Configure', not 'sh <Configure'"
1740                         exit 1
1741                 fi
1742                 ;;
1743         esac
1744         ;;
1745 esac
1746
1747 exec 4>&1
1748 case "$silent" in
1749 true) exec 1>/dev/null;;
1750 esac
1751
1752 : run the defines and the undefines, if any, but leave the file out there...
1753 touch optdef.sh
1754 . ./optdef.sh
1755 : create the posthint manipulation script and leave the file out there...
1756 touch posthint.sh
1757
1758 : set package name
1759 package='perl5'
1760 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1761 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1762 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1763 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1764 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1765 esac
1766
1767 : Some greps do not return status, grrr.
1768 echo "grimblepritz" >grimble
1769 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1770         contains=contains
1771 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1772         contains=grep
1773 else
1774         contains=contains
1775 fi
1776 rm -f grimble
1777 : the following should work in any shell
1778 case "$contains" in
1779 contains*)
1780         echo " "
1781         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1782         cat >contains <<'EOSS'
1783 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1784 EOSS
1785 chmod +x contains
1786 esac
1787
1788 : Find the path to the source tree
1789 case "$src" in
1790 '') case "$0" in
1791     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1792          case "$src" in
1793          /*)    ;;
1794          .)     ;;
1795          *)     src=`cd ../$src && pwd` ;;
1796          esac
1797          ;;
1798     *)   src='.';;
1799     esac;;
1800 esac
1801 case "$src" in
1802 '')     src=/
1803         rsrc=/
1804         ;;
1805 /*)     rsrc="$src";;
1806 *)      rsrc="../$src";;
1807 esac
1808 if test -f $rsrc/Configure && \
1809         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1810 then
1811    : found it, so we are ok.
1812 else
1813         rsrc=''
1814         for src in . .. ../.. ../../.. ../../../..; do
1815                 if test -f ../$src/Configure && \
1816                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1817                 then
1818                         rsrc=../$src
1819                         break
1820                 fi
1821         done
1822 fi
1823 case "$rsrc" in
1824 '')
1825         cat <<EOM >&4
1826
1827 Sorry, I can't seem to locate the source dir for $package.  Please start
1828 Configure with an explicit path -- i.e. /some/path/Configure.
1829
1830 EOM
1831         exit 1
1832         ;;
1833 ../.)   rsrc='..';;
1834 *)
1835         echo " "
1836         echo "Sources for $package found in \"$src\"." >&4
1837         ;;
1838 esac
1839
1840 : script used to extract .SH files with variable substitutions
1841 cat >extract <<'EOS'
1842 PERL_CONFIG_SH=true
1843 echo "Doing variable substitutions on .SH files..."
1844 if test -f MANIFEST; then
1845         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1846 else
1847         echo "(Looking for .SH files under the source directory.)"
1848         set x `(cd "$src"; find . -name "*.SH" -print)`
1849 fi
1850 shift
1851 case $# in
1852 0) set x `(cd "$src"; echo *.SH)`; shift;;
1853 esac
1854 if test ! -f "$src/$1"; then
1855         shift
1856 fi
1857 mkdir_p='
1858 name=$1;
1859 create="";
1860 while test $name; do
1861         if test ! -d "$name"; then
1862                 create="$name $create";
1863                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1864                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1865         else
1866                 name="";
1867         fi;
1868 done;
1869 for file in $create; do
1870         mkdir $file;
1871 done
1872 '
1873 for file in $*; do
1874         case "$src" in
1875         ".")
1876                 case "$file" in
1877                 */*)
1878                         dir=`expr X$file : 'X\(.*\)/'`
1879                         file=`expr X$file : 'X.*/\(.*\)'`
1880                         (cd "$dir" && . ./$file)
1881                         ;;
1882                 *)
1883                         . ./$file
1884                         ;;
1885                 esac
1886                 ;;
1887         *)
1888                 case "$file" in
1889                 */*)
1890                         dir=`expr X$file : 'X\(.*\)/'`
1891                         file=`expr X$file : 'X.*/\(.*\)'`
1892                         (set x $dir; shift; eval $mkdir_p)
1893                         sh <"$src/$dir/$file"
1894                         ;;
1895                 *)
1896                         sh <"$src/$file"
1897                         ;;
1898                 esac
1899                 ;;
1900         esac
1901 done
1902 if test -f "$src/config_h.SH"; then
1903         if test ! -f config.h; then
1904         : oops, they left it out of MANIFEST, probably, so do it anyway.
1905         . "$src/config_h.SH"
1906         fi
1907 fi
1908 EOS
1909
1910 : extract files and exit if asked to do so
1911 case "$extractsh" in
1912 true)
1913         case "$realsilent" in
1914         true) ;;
1915         *) exec 1>&4;;
1916         esac
1917         case "$config_sh" in
1918         '') config_sh='config.sh';;
1919         esac
1920         echo " "
1921         echo "Fetching answers from $config_sh..."
1922         cd ..
1923         . $config_sh
1924         test "$override" && . ./optdef.sh
1925         echo " "
1926         . UU/extract
1927         rm -rf UU
1928         echo "Extraction done."
1929         exit 0
1930         ;;
1931 esac
1932
1933 : Eunice requires " " instead of "", can you believe it
1934 echo " "
1935 : Here we go...
1936 echo "Beginning of configuration questions for $package."
1937
1938 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1939
1940 : first determine how to suppress newline on echo command
1941 echo " "
1942 echo "Checking echo to see how to suppress newlines..."
1943 (echo "hi there\c" ; echo " ") >.echotmp
1944 if $contains c .echotmp >/dev/null 2>&1 ; then
1945         echo "...using -n."
1946         n='-n'
1947         c=''
1948 else
1949         cat <<'EOM'
1950 ...using \c
1951 EOM
1952         n=''
1953         c='\c'
1954 fi
1955 echo $n "The star should be here-->$c"
1956 echo '*'
1957 rm -f .echotmp
1958
1959 : Now test for existence of everything in MANIFEST
1960 echo " "
1961 if test -f "$rsrc/MANIFEST"; then
1962         echo "First let's make sure your kit is complete.  Checking..." >&4
1963         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1964                 (split -l 50 2>/dev/null || split -50)
1965         rm -f missing
1966         tmppwd=`pwd`
1967         for filelist in x??; do
1968                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1969                         >/dev/null 2>>"$tmppwd/missing")
1970         done
1971         if test -s missing; then
1972                 cat missing >&4
1973                 cat >&4 <<'EOM'
1974
1975 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1976
1977 You have the option of continuing the configuration process, despite the
1978 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1979 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1980 and contact the author (perlbug@perl.org).
1981
1982 EOM
1983                 echo $n "Continue? [n] $c" >&4
1984                 read ans
1985                 case "$ans" in
1986                 y*)
1987                         echo "Continuing..." >&4
1988                         rm -f missing
1989                         ;;
1990                 *)
1991                         echo "ABORTING..." >&4
1992                         kill $$
1993                         ;;
1994                 esac
1995         else
1996                 echo "Looks good..."
1997         fi
1998 else
1999         echo "There is no MANIFEST file.  I hope your kit is complete !"
2000 fi
2001 rm -f missing x??
2002
2003 : Find the appropriate value for a newline for tr
2004 echo " "
2005 if test -n "$DJGPP"; then
2006        trnl='\012'
2007 fi
2008 if test X"$trnl" = X; then
2009         case "`echo foo|tr '\n' x 2>/dev/null`" in
2010         foox) trnl='\n' ;;
2011         esac
2012 fi
2013 if test X"$trnl" = X; then
2014         case "`echo foo|tr '\012' x 2>/dev/null`" in
2015         foox) trnl='\012' ;;
2016         esac
2017 fi
2018 if test X"$trnl" = X; then
2019        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2020        fooxy) trnl='\n\r' ;;
2021        esac
2022 fi
2023 if test X"$trnl" = X; then
2024         cat <<EOM >&2
2025
2026 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2027
2028 EOM
2029         exit 1
2030 fi
2031
2032 : compute the number of columns on the terminal for proper question formatting
2033 case "$COLUMNS" in
2034 '') COLUMNS='80';;
2035 esac
2036
2037 : set up the echo used in my read
2038 myecho="case \"\$xxxm\" in
2039 '') echo $n \"\$rp $c\" >&4;;
2040 *) case \"\$rp\" in
2041         '') echo $n \"[\$xxxm] $c\";;
2042         *)
2043                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2044                         echo \"\$rp\" >&4
2045                         echo $n \"[\$xxxm] $c\" >&4
2046                 else
2047                         echo $n \"\$rp [\$xxxm] $c\" >&4
2048                 fi
2049                 ;;
2050         esac;;
2051 esac"
2052
2053 : now set up to do reads with possible shell escape and default assignment
2054 cat <<EOSC >myread
2055 $startsh
2056 xxxm=\$dflt
2057 $myecho
2058 ans='!'
2059 case "\$fastread" in
2060 yes) case "\$dflt" in
2061         '') ;;
2062         *) ans='';
2063                 case "\$silent-\$rp" in
2064                 true-) ;;
2065                 *) echo " " >&4;;
2066                 esac;;
2067         esac;;
2068 *) case "\$silent" in
2069         true) case "\$rp" in
2070                 '') ans='';;
2071                 esac;;
2072         esac;;
2073 esac
2074 while expr "X\$ans" : "X!" >/dev/null; do
2075         read answ
2076         set x \$xxxm
2077         shift
2078         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2079         case  "\$answ" in
2080         "!")
2081                 sh 1>&4
2082                 echo " "
2083                 $myecho
2084                 ;;
2085         !*)
2086                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2087                 shift
2088                 sh 1>&4 -c "\$*"
2089                 echo " "
2090                 $myecho
2091                 ;;
2092         "\$ans")
2093                 case "\$ans" in
2094                 \\&*)
2095                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2096                         shift
2097                         case "\$1" in
2098                         -d)
2099                                 fastread=yes
2100                                 echo "(OK, I'll run with -d after this question.)" >&4
2101                                 ;;
2102                         -*)
2103                                 echo "*** Sorry, \$1 not supported yet." >&4
2104                                 ;;
2105                         esac
2106                         $myecho
2107                         ans=!
2108                         ;;
2109                 esac;;
2110         *)
2111                 case "\$aok" in
2112                 y)
2113                         echo "*** Substitution done -- please confirm."
2114                         xxxm="\$ans"
2115                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2116                         xxxm="\$ans"
2117                         ans=!
2118                         ;;
2119                 *)
2120                         echo "*** Error -- try again."
2121                         ans=!
2122                         ;;
2123                 esac
2124                 $myecho
2125                 ;;
2126         esac
2127         case "\$ans\$xxxm\$nostick" in
2128         '')
2129                 ans=!
2130                 $myecho
2131                 ;;
2132         esac
2133 done
2134 case "\$ans" in
2135 '') ans="\$xxxm";;
2136 esac
2137 EOSC
2138
2139 : create .config dir to save info across Configure sessions
2140 test -d ../.config || mkdir ../.config
2141 cat >../.config/README <<EOF
2142 This directory created by Configure to save information that should
2143 persist across sessions for $package.
2144
2145 You may safely delete it if you wish.
2146 EOF
2147
2148 : See if we are using a devel version and want that
2149 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2150 case "$usedevel" in
2151 $define|true|[yY]*)
2152     usedevel="$define" ;;
2153 *) case "$xversion" in
2154    *[13579])
2155         cat >&4 <<EOH
2156 *** WHOA THERE!!! ***
2157
2158     This is an UNSTABLE DEVELOPMENT release.
2159     The version of this $package distribution is $xversion, that is, odd,
2160     (as opposed to even) and that signifies a development release.
2161     If you want a maintenance release, you want an even-numbered version.
2162
2163     Do ***NOT*** install this into production use.
2164     Data corruption and crashes are possible.
2165
2166     It is most seriously suggested that you do not continue any further
2167     unless you want to help in developing and debugging Perl.
2168
2169     If you *still* want to build perl, you can answer 'y' now,
2170     or pass -Dusedevel to Configure.
2171
2172 EOH
2173         rp='Do you really want to continue?'
2174         dflt='n'
2175         . ./myread
2176         case "$ans" in
2177         [yY]) echo >&4 "Okay, continuing."
2178               usedevel="$define" ;;
2179         *) echo >&4 "Okay, bye."
2180            exit 1
2181            ;;
2182         esac
2183         ;;
2184     esac
2185     usedevel="$undef"
2186     ;;
2187 esac
2188 case "$usedevel" in
2189 $define|true|[yY]*)
2190         case "$versiononly" in
2191         '') versiononly="$define" ;;
2192         esac
2193         case "$installusrbinperl" in
2194         '') installusrbinperl="$undef" ;;
2195         esac
2196         ;;
2197 esac
2198
2199 : general instructions
2200 needman=true
2201 firsttime=true
2202 user=`(logname) 2>/dev/null`
2203 case "$user" in
2204 '') user=`whoami 2>&1`;;
2205 esac
2206 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2207         firsttime=false
2208         echo " "
2209         rp='Would you like to see the instructions?'
2210         dflt=n
2211         . ./myread
2212         case "$ans" in
2213         [yY]*) ;;
2214         *) needman=false;;
2215         esac
2216 fi
2217 if $needman; then
2218         cat <<EOH
2219
2220 This installation shell script will examine your system and ask you questions
2221 to determine how the perl5 package should be installed. If you get
2222 stuck on a question, you may use a ! shell escape to start a subshell or
2223 execute a command.  Many of the questions will have default answers in square
2224 brackets; typing carriage return will give you the default.
2225
2226 On some of the questions which ask for file or directory names you are allowed
2227 to use the ~name construct to specify the login directory belonging to "name",
2228 even if you don't have a shell which knows about that.  Questions where this is
2229 allowed will be marked "(~name ok)".
2230
2231 EOH
2232         rp=''
2233         dflt='Type carriage return to continue'
2234         . ./myread
2235         cat <<'EOH'
2236
2237 The prompter used in this script allows you to use shell variables and
2238 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2239 in the default answer, as if the default line was a set of arguments given to a
2240 script shell.  This means you may also use $* to repeat the whole default line,
2241 so you do not have to re-type everything to add something to the default.
2242
2243 Everytime there is a substitution, you will have to confirm.  If there is an
2244 error (e.g. an unmatched backtick), the default answer will remain unchanged
2245 and you will be prompted again.
2246
2247 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2248 the questions and use the computed defaults (or the previous answers if there
2249 was already a config.sh file). Type 'Configure -h' for a list of options.
2250 You may also start interactively and then answer '& -d' at any prompt to turn
2251 on the non-interactive behaviour for the remainder of the execution.
2252
2253 EOH
2254         . ./myread
2255         cat <<EOH
2256
2257 Much effort has been expended to ensure that this shell script will run on any
2258 Unix system.  If despite that it blows up on yours, your best bet is to edit
2259 Configure and run it again.  If you can't run Configure for some reason,
2260 you'll have to generate a config.sh file by hand.  Whatever problems you
2261 have, let me (perlbug@perl.org) know how I blew it.
2262
2263 This installation script affects things in two ways:
2264
2265 1) it may do direct variable substitutions on some of the files included
2266    in this kit.
2267 2) it builds a config.h file for inclusion in C programs.  You may edit
2268    any of these files as the need arises after running this script.
2269
2270 If you make a mistake on a question, there is no easy way to back up to it
2271 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2272 files.  Configure will offer to let you do this before it runs the SH files.
2273
2274 EOH
2275         dflt='Type carriage return to continue'
2276         . ./myread
2277         case "$firsttime" in
2278         true) echo $user >>../.config/instruct;;
2279         esac
2280 fi
2281
2282 : find out where common programs are
2283 echo " "
2284 echo "Locating common programs..." >&4
2285 cat <<EOSC >loc
2286 $startsh
2287 case \$# in
2288 0) exit 1;;
2289 esac
2290 thing=\$1
2291 shift
2292 dflt=\$1
2293 shift
2294 for dir in \$*; do
2295         case "\$thing" in
2296         .)
2297         if test -d \$dir/\$thing; then
2298                 echo \$dir
2299                 exit 0
2300         fi
2301         ;;
2302         *)
2303         for thisthing in \$dir/\$thing; do
2304                 : just loop through to pick last item
2305         done
2306         if test -f \$thisthing; then
2307                 echo \$thisthing
2308                 exit 0
2309         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2310                 echo \$thisthing
2311                 exit 0
2312         elif test -f \$dir/\$thing.exe; then
2313                 if test -n "$DJGPP"; then
2314                         echo \$dir/\$thing.exe
2315                 elif test "$eunicefix" != ":"; then
2316                         : on Eunice apparently
2317                         echo \$dir/\$thing
2318                 fi
2319                 exit 0
2320         fi
2321         ;;
2322         esac
2323 done
2324 echo \$dflt
2325 exit 1
2326 EOSC
2327 chmod +x loc
2328 $eunicefix loc
2329 loclist="
2330 awk
2331 cat
2332 chmod
2333 comm
2334 cp
2335 echo
2336 expr
2337 grep
2338 ls
2339 mkdir
2340 rm
2341 sed
2342 sort
2343 touch
2344 tr
2345 uniq
2346 "
2347 trylist="
2348 ar
2349 bison
2350 byacc
2351 cpp
2352 csh
2353 date
2354 egrep
2355 gmake
2356 gzip
2357 less
2358 ln
2359 make
2360 more
2361 nm
2362 nroff
2363 pg
2364 test
2365 uname
2366 zip
2367 "
2368 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2369 pth="$pth /lib /usr/lib"
2370 for file in $loclist; do
2371         eval xxx=\$$file
2372         case "$xxx" in
2373         /*|?:[\\/]*)
2374                 if test -f "$xxx"; then
2375                         : ok
2376                 else
2377                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2378                         xxx=`./loc $file $file $pth`
2379                 fi
2380                 ;;
2381         '') xxx=`./loc $file $file $pth`;;
2382         *) xxx=`./loc $xxx $xxx $pth`;;
2383         esac
2384         eval $file=$xxx$_exe
2385         eval _$file=$xxx
2386         case "$xxx" in
2387         /*)
2388                 echo $file is in $xxx.
2389                 ;;
2390         ?:[\\/]*)
2391                 echo $file is in $xxx.
2392                 ;;
2393         *)
2394                 echo "I don't know where '$file' is, and my life depends on it." >&4
2395                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2396                 exit 1
2397                 ;;
2398         esac
2399 done
2400 echo " "
2401 echo "Don't worry if any of the following aren't found..."
2402 say=offhand
2403 for file in $trylist; do
2404         eval xxx=\$$file
2405         case "$xxx" in
2406         /*|?:[\\/]*)
2407                 if test -f "$xxx"; then
2408                         : ok
2409                 else
2410                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2411                         xxx=`./loc $file $file $pth`
2412                 fi
2413                 ;;
2414         '') xxx=`./loc $file $file $pth`;;
2415         *) xxx=`./loc $xxx $xxx $pth`;;
2416         esac
2417         eval $file=$xxx$_exe
2418         eval _$file=$xxx
2419         case "$xxx" in
2420         /*)
2421                 echo $file is in $xxx.
2422                 ;;
2423         ?:[\\/]*)
2424                 echo $file is in $xxx.
2425                 ;;
2426         *)
2427                 echo "I don't see $file out there, $say."
2428                 say=either
2429                 ;;
2430         esac
2431 done
2432 case "$egrep" in
2433 egrep)
2434         echo "Substituting grep for egrep."
2435         egrep=$grep
2436         _egrep=$grep
2437         ;;
2438 esac
2439 case "$ln" in
2440 ln)
2441         echo "Substituting cp for ln."
2442         ln=$cp
2443         _ln=$cp
2444         ;;
2445 esac
2446 case "$make" in
2447 make)
2448         case "$gmake" in
2449         gmake)
2450         echo "I can't find make or gmake, and my life depends on it." >&4
2451         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2452         exit 1
2453         ;;
2454         esac
2455         ;;
2456 esac
2457 case "$gmake" in
2458 gmake)  ;;
2459 *)      # We can't have osname yet.
2460         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2461                 # Assume that gmake, if found, is definitely GNU make
2462                 # and prefer it over the system make.
2463                 echo "Substituting gmake for make."
2464                 make=$gmake
2465                 _make=$gmake
2466         fi
2467         ;;
2468 esac
2469 case "$test" in
2470 test)
2471         echo "Hopefully test is built into your sh."
2472         ;;
2473 *)
2474         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2475                 echo "Using the test built into your sh."
2476                 test=test
2477                 _test=test
2478         fi
2479         ;;
2480 esac
2481 case "$echo" in
2482 echo)
2483         echo "Hopefully echo is built into your sh."
2484         ;;
2485 '') ;;
2486 *)
2487         echo " "
2488 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2489         $echo $n "hi there$c" >foo1
2490         echo $n "hi there$c" >foo2
2491         if cmp foo1 foo2 >/dev/null 2>&1; then
2492                 echo "They are compatible.  In fact, they may be identical."
2493         else
2494                 case "$n" in
2495                 '-n') n='' c='\c';;
2496                 *) n='-n' c='';;
2497                 esac
2498                 cat <<FOO
2499 They are not compatible!  You are probably running ksh on a non-USG system.
2500 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2501 have echo built in and we may have to run some Bourne shell scripts.  That
2502 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2503
2504 FOO
2505                 $echo $n "The star should be here-->$c"
2506                 $echo "*"
2507         fi
2508         $rm -f foo1 foo2
2509         ;;
2510 esac
2511
2512 # This question was auctioned at YAPC::Europe-2007 in Vienna
2513 # I never promised you could answer it. I only auctioned the question.
2514 cat <<FOO
2515 The following message is sponsored by
2516
2517   Dresden.pm<--The stars should be here.
2518
2519 Dear Perl user, system administrator or package
2520 maintainer, the Perl community sends greetings to
2521 you. Do you (emblematical) greet back [Y/n]? n
2522
2523 FOO
2524
2525 : Check what type of C compiler we use
2526 cat <<EOS >trygcc
2527 $startsh
2528 EOS
2529 cat <<'EOSC' >>trygcc
2530 case "$cc" in
2531 '') ;;
2532 *)  $rm -f try try.*
2533     $cat >try.c <<EOM
2534 int main(int argc, char *argv[]) {
2535   return 0;
2536 }
2537 EOM
2538     if $cc -o try $ccflags $ldflags try.c; then
2539        :
2540     else
2541         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2542         despair=yes
2543         trygcc=yes
2544         case "$cc" in
2545         *gcc*) trygcc=no ;;
2546         esac
2547         # Skip this test because it gives a false match on output like:
2548         #    ./trygcc: line 23: cc: command not found
2549         # case "`$cc -v -c try.c 2>&1`" in
2550         # *gcc*) trygcc=no ;;
2551         # esac
2552         if $test X"$trygcc" = Xyes; then
2553             if gcc -o try -c try.c; then
2554                 echo " "
2555                 echo "You seem to have a working gcc, though." >&4
2556                 # Switching compilers may undo the work of hints files.
2557                 # The most common problem is -D_REENTRANT for threads.
2558                 # This heuristic catches that case, but gets false positives
2559                 # if -Dusethreads was not actually specified.  Better to
2560                 # bail out here with a useful message than fail 
2561                 # mysteriously later. Should we perhaps just try to
2562                 # re-invoke Configure -Dcc=gcc config_args ?
2563                 if $test -f usethreads.cbu; then
2564                         $cat >&4 <<EOM 
2565
2566 *** However, any setting of the C compiler flags (e.g. for thread support)
2567 *** will be lost.  It may be necessary for you to restart Configure and
2568 *** add -Dcc=gcc to your Configure command line.
2569
2570 EOM
2571                         rp="Would you like to go ahead and try gcc anyway?"
2572                         dflt=n
2573                 else
2574                         rp="Would you like to use it?"
2575                         dflt=y
2576                 fi
2577                 if $test -f myread; then
2578                     . ./myread
2579                 else
2580                     if $test -f UU/myread; then
2581                         . ./UU/myread
2582                     else
2583                         echo "Cannot find myread, sorry.  Aborting." >&2
2584                         exit 1
2585                     fi
2586                 fi  
2587                 case "$ans" in
2588                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2589                 esac
2590             fi
2591         fi
2592     fi
2593     $rm -f try try.*
2594     ;;
2595 esac
2596 EOSC
2597
2598 cat <<EOS >checkcc
2599 $startsh
2600 EOS
2601 cat <<'EOSC' >>checkcc
2602 case "$cc" in        
2603 '') ;;
2604 *)  $rm -f try try.*              
2605     $cat >try.c <<EOM
2606 int main(int argc, char *argv[]) {
2607   return 0;
2608 }
2609 EOM
2610     if $cc -o try $ccflags $ldflags try.c; then
2611        :
2612     else
2613         if $test X"$despair" = Xyes; then
2614            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2615         fi
2616         $cat >&4 <<EOM         
2617 You need to find a working C compiler.
2618 Either (purchase and) install the C compiler supplied by your OS vendor,
2619 or for a free C compiler try http://gcc.gnu.org/
2620 I cannot continue any further, aborting.
2621 EOM
2622         exit 1
2623     fi
2624     $rm -f try try.*
2625     ;;
2626 esac
2627 EOSC
2628
2629 : determine whether symbolic links are supported
2630 echo " "
2631 $touch blurfl
2632 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2633         echo "Symbolic links are supported." >&4
2634         lns="$ln -s"
2635 else
2636         echo "Symbolic links are NOT supported." >&4
2637         lns="$ln"
2638 fi
2639 $rm -f blurfl sym
2640
2641 : determine whether symbolic links are supported
2642 echo " "
2643 case "$lns" in
2644 *"ln"*" -s")
2645         echo "Checking how to test for symbolic links..." >&4
2646         $lns blurfl sym
2647         if $test "X$issymlink" = X; then
2648                 case "$newsh" in
2649                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2650                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2651                 esac
2652                 if test $? = 0; then
2653                         issymlink="test -h"
2654                 else
2655                         echo "Your builtin 'test -h' may be broken." >&4
2656                         case "$test" in
2657                         /*)     ;;
2658                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2659                                 for p in $pth
2660                                 do
2661                                         if test -f "$p/$test"; then
2662                                                 test="$p/$test"
2663                                                 break
2664                                         fi
2665                                 done
2666                                 ;;
2667                         esac
2668                         case "$test" in
2669                         /*)
2670                                 echo "Trying external '$test -h'." >&4
2671                                 issymlink="$test -h"
2672                                 if $test ! -h sym >/dev/null 2>&1; then
2673                                         echo "External '$test -h' is broken, too." >&4
2674                                         issymlink=''
2675                                 fi
2676                                 ;;
2677                         *)      issymlink='' ;;
2678                         esac
2679                 fi              
2680         fi
2681         if $test "X$issymlink" = X; then
2682                 if $test -L sym 2>/dev/null; then
2683                         issymlink="$test -L"
2684                         echo "The builtin '$test -L' worked." >&4
2685                 fi
2686         fi
2687         if $test "X$issymlink" != X; then
2688                 echo "You can test for symbolic links with '$issymlink'." >&4
2689         else
2690                 echo "I do not know how you can test for symbolic links." >&4
2691         fi
2692         $rm -f blurfl sym
2693         ;;
2694 *)      echo "No symbolic links, so not testing for their testing..." >&4
2695         ;;
2696 esac
2697 echo " "
2698
2699 : Make symlinks util
2700 case "$mksymlinks" in
2701 $define|true|[yY]*)
2702         case "$src" in
2703         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2704                 exit 1
2705                 ;;
2706         *)      case "$lns:$issymlink" in
2707                 *"ln"*" -s:"*"test -"?)
2708                         echo "Creating the symbolic links..." >&4
2709                         echo "(First creating the subdirectories...)" >&4
2710                         cd ..
2711                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2712                                 read directory
2713                                 test -z "$directory" && break
2714                                 mkdir -p $directory
2715                         done
2716                         # Sanity check 1.
2717                         if test ! -d t/base; then
2718                                 echo "Failed to create the subdirectories.  Aborting." >&4
2719                                 exit 1
2720                         fi
2721                         echo "(Then creating the symlinks...)" >&4
2722                         awk '{print $1}' $src/MANIFEST | while true; do
2723                                 read filename
2724                                 test -z "$filename" && break
2725                                 if test -f $filename; then
2726                                         if $issymlink $filename; then
2727                                                 rm -f $filename
2728                                         fi
2729                                 fi
2730                                 if test -f $filename; then
2731                                         echo "$filename already exists, not symlinking."
2732                                 else
2733                                         ln -s $src/$filename $filename
2734                                 fi
2735                         done
2736                         # Sanity check 2.
2737                         if test ! -f t/base/lex.t; then
2738                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2739                                 exit 1
2740                         fi
2741                         cd UU
2742                         ;;
2743                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2744                         ;;
2745                 esac
2746                 ;;
2747         esac
2748         ;;
2749 esac
2750
2751 : Check for Cross-Compilation
2752 case "$usecrosscompile" in
2753 $define|true|[yY]*)
2754         $echo "Cross-compiling..."
2755         croak=''
2756         case "$cc" in
2757         *-*-gcc) # A cross-compiling gcc, probably.
2758             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2759             ar=$targetarch-ar
2760             # leave out ld, choosing it is more complex
2761             nm=$targetarch-nm
2762             ranlib=$targetarch-ranlib
2763             $echo 'extern int foo;' > try.c
2764             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2765             shift
2766             if $test $# -gt 0; then
2767                 incpth="$incpth $*"
2768                 incpth="`$echo $incpth|$sed 's/^ //'`"
2769                 echo "Guessing incpth '$incpth'." >&4
2770                 for i in $*; do
2771                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2772                     if $test -d $j; then
2773                         libpth="$libpth $j"
2774                     fi
2775                 done   
2776                 libpth="`$echo $libpth|$sed 's/^ //'`"
2777                 echo "Guessing libpth '$libpth'." >&4
2778             fi
2779             $rm -f try.c
2780             ;;
2781         esac
2782         case "$targetarch" in
2783         '') echo "Targetarch not defined." >&4; croak=y ;;
2784         *)  echo "Using targetarch $targetarch." >&4 ;;
2785         esac
2786         case "$incpth" in
2787         '') echo "Incpth not defined." >&4; croak=y ;;
2788         *)  echo "Using incpth '$incpth'." >&4 ;;
2789         esac
2790         case "$libpth" in
2791         '') echo "Libpth not defined." >&4; croak=y ;;
2792         *)  echo "Using libpth '$libpth'." >&4 ;;
2793         esac
2794         case "$usrinc" in
2795         '') for i in $incpth; do
2796                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2797                     usrinc=$i
2798                     echo "Guessing usrinc $usrinc." >&4
2799                     break
2800                 fi
2801             done
2802             case "$usrinc" in
2803             '') echo "Usrinc not defined." >&4; croak=y ;;
2804             esac
2805             ;;
2806         *)  echo "Using usrinc $usrinc." >&4 ;;
2807         esac
2808         case "$targethost" in
2809         '') echo "Targethost not defined." >&4; croak=y ;;
2810         *)  echo "Using targethost $targethost." >&4
2811         esac
2812         locincpth=' '
2813         loclibpth=' '
2814         case "$croak" in
2815         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2816         esac
2817         case "$src" in
2818         /*) run=$src/Cross/run
2819             targetmkdir=$src/Cross/mkdir
2820             to=$src/Cross/to
2821             from=$src/Cross/from
2822             ;;
2823         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2824             run=$pwd/Cross/run
2825             targetmkdir=$pwd/Cross/mkdir
2826             to=$pwd/Cross/to
2827             from=$pwd/Cross/from
2828             ;;
2829         esac
2830         case "$targetrun" in
2831         '') targetrun=ssh ;;
2832         esac
2833         case "$targetto" in
2834         '') targetto=scp ;;
2835         esac
2836         case "$targetfrom" in
2837         '') targetfrom=scp ;;
2838         esac
2839         run=$run-$targetrun
2840         to=$to-$targetto
2841         from=$from-$targetfrom
2842         case "$targetdir" in
2843         '')  targetdir=/tmp
2844              echo "Guessing targetdir $targetdir." >&4
2845              ;;
2846         esac
2847         case "$targetuser" in
2848         '')  targetuser=root
2849              echo "Guessing targetuser $targetuser." >&4
2850              ;;
2851         esac
2852         case "$targetfrom" in
2853         scp)    q=-q ;;
2854         *)      q='' ;;
2855         esac
2856         case "$targetrun" in
2857         ssh|rsh)
2858             cat >$run <<EOF
2859 #!/bin/sh
2860 case "\$1" in
2861 -cwd)
2862   shift
2863   cwd=\$1
2864   shift
2865   ;;
2866 esac
2867 case "\$cwd" in
2868 '') cwd=$targetdir ;;
2869 esac
2870 exe=\$1
2871 shift
2872 if $test ! -f \$exe.xok; then
2873   $to \$exe
2874   $touch \$exe.xok
2875 fi
2876 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2877 EOF
2878             ;;
2879         *)  echo "Unknown targetrun '$targetrun'" >&4
2880             exit 1
2881             ;;
2882         esac
2883         case "$targetmkdir" in
2884         */Cross/mkdir)
2885             cat >$targetmkdir <<EOF
2886 #!/bin/sh
2887 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2888 EOF
2889             $chmod a+rx $targetmkdir
2890             ;;
2891         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2892             exit 1
2893             ;;
2894         esac
2895         case "$targetto" in
2896         scp|rcp)
2897             cat >$to <<EOF
2898 #!/bin/sh
2899 for f in \$@
2900 do
2901   case "\$f" in
2902   /*)
2903     $targetmkdir \`dirname \$f\`
2904     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2905     ;;
2906   *)
2907     $targetmkdir $targetdir/\`dirname \$f\`
2908     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2909     ;;
2910   esac
2911 done
2912 exit 0
2913 EOF
2914             ;;
2915         cp) cat >$to <<EOF
2916 #!/bin/sh
2917 for f in \$@
2918 do
2919   case "\$f" in
2920   /*)
2921     $mkdir -p $targetdir/\`dirname \$f\`
2922     $cp \$f $targetdir/\$f || exit 1
2923     ;;
2924   *)
2925     $targetmkdir $targetdir/\`dirname \$f\`
2926     $cp \$f $targetdir/\$f || exit 1
2927     ;;
2928   esac
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         *)  echo "Unknown targetto '$targetto'" >&4
2934             exit 1
2935             ;;
2936         esac
2937         case "$targetfrom" in
2938         scp|rcp)
2939           cat >$from <<EOF
2940 #!/bin/sh
2941 for f in \$@
2942 do
2943   $rm -f \$f
2944   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2945 done
2946 exit 0
2947 EOF
2948             ;;
2949         cp) cat >$from <<EOF
2950 #!/bin/sh
2951 for f in \$@
2952 do
2953   $rm -f \$f
2954   cp $targetdir/\$f . || exit 1
2955 done
2956 exit 0
2957 EOF
2958             ;;
2959         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2960             exit 1
2961             ;;
2962         esac
2963         if $test ! -f $run; then
2964             echo "Target 'run' script '$run' not found." >&4
2965         else
2966             $chmod a+rx $run
2967         fi
2968         if $test ! -f $to; then
2969             echo "Target 'to' script '$to' not found." >&4
2970         else
2971             $chmod a+rx $to
2972         fi
2973         if $test ! -f $from; then
2974             echo "Target 'from' script '$from' not found." >&4
2975         else
2976             $chmod a+rx $from
2977         fi
2978         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2979             exit 1
2980         fi
2981         cat >&4 <<EOF
2982 Using '$run' for remote execution,
2983 and '$from' and '$to'
2984 for remote file transfer.
2985 EOF
2986         ;;
2987 *)      run=''
2988         to=:
2989         from=:
2990         usecrosscompile='undef'
2991         targetarch=''
2992         ;;
2993 esac
2994
2995 : see whether [:lower:] and [:upper:] are supported character classes
2996 echo " "
2997 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2998 ABYZ)
2999         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3000         up='[:upper:]'
3001         low='[:lower:]'
3002         ;;
3003 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3004         # (0xd9 and 0xe2), therefore that is a nice testing point.
3005         if test "X$up" = X -o "X$low" = X; then
3006             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3007             rs) up='[A-Z]'
3008                 low='[a-z]'
3009                 ;;
3010             esac
3011         fi
3012         if test "X$up" = X -o "X$low" = X; then
3013             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3014             rs) up='A-Z'
3015                 low='a-z'
3016                 ;;
3017             esac
3018         fi
3019         if test "X$up" = X -o "X$low" = X; then
3020             case "`echo RS | od -x 2>/dev/null`" in
3021             *D9E2*|*d9e2*)
3022                 echo "Hey, this might be EBCDIC." >&4
3023                 if test "X$up" = X -o "X$low" = X; then
3024                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3025                     rs) up='[A-IJ-RS-Z]'
3026                         low='[a-ij-rs-z]'
3027                         ;;
3028                     esac
3029                 fi
3030                 if test "X$up" = X -o "X$low" = X; then
3031                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3032                     rs) up='A-IJ-RS-Z'
3033                         low='a-ij-rs-z'
3034                         ;;
3035                     esac
3036                 fi
3037                 ;;
3038             esac
3039         fi
3040 esac
3041 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3042 rs)
3043     echo "Using $up and $low to convert case." >&4
3044     ;;
3045 *)
3046     echo "I don't know how to translate letters from upper to lower case." >&4
3047     echo "Your tr is not acting any way I know of." >&4
3048     exit 1
3049     ;;
3050 esac
3051 : set up the translation script tr, must be called with ./tr of course
3052 cat >tr <<EOSC
3053 $startsh
3054 case "\$1\$2" in
3055 '[A-Z][a-z]') exec $tr '$up' '$low';;
3056 '[a-z][A-Z]') exec $tr '$low' '$up';;
3057 esac
3058 exec $tr "\$@"
3059 EOSC
3060 chmod +x tr
3061 $eunicefix tr
3062
3063 : Try to determine whether config.sh was made on this system
3064 case "$config_sh" in
3065 '')
3066 myuname=`$uname -a 2>/dev/null`
3067 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3068 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3069 # because the A-Z/a-z are not consecutive.
3070 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3071         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3072 newmyuname="$myuname"
3073 dflt=n
3074 case "$knowitall" in
3075 '')
3076         if test -f ../config.sh; then
3077                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3078                         eval "`grep myuname= ../config.sh`"
3079                 fi
3080                 if test "X$myuname" = "X$newmyuname"; then
3081                         dflt=y
3082                 fi
3083         fi
3084         ;;
3085 *) dflt=y;;
3086 esac
3087
3088 : Get old answers from old config file if Configure was run on the
3089 : same system, otherwise use the hints.
3090 hint=default
3091 cd ..
3092 if test -f config.sh; then
3093         echo " "
3094         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3095         . UU/myread
3096         case "$ans" in
3097         n*|N*) echo "OK, I'll ignore it."
3098                 mv config.sh config.sh.old
3099                 myuname="$newmyuname"
3100                 ;;
3101         *)  echo "Fetching default answers from your old config.sh file..." >&4
3102                 tmp_n="$n"
3103                 tmp_c="$c"
3104                 tmp_sh="$sh"
3105                 . ./config.sh
3106                 cp config.sh UU
3107                 n="$tmp_n"
3108                 c="$tmp_c"
3109                 : Older versions did not always set $sh.  Catch re-use of such
3110                 : an old config.sh.
3111                 case "$sh" in
3112                 '') sh="$tmp_sh" ;;
3113                 esac
3114                 hint=previous
3115                 ;;
3116         esac
3117 fi
3118 . ./UU/checkcc
3119 if test ! -f config.sh; then
3120         $cat <<EOM
3121
3122 First time through, eh?  I have some defaults handy for some systems
3123 that need some extra help getting the Configure answers right:
3124
3125 EOM
3126         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3127         dflt=''
3128         : Half the following guesses are probably wrong... If you have better
3129         : tests or hints, please send them to perlbug@perl.org
3130         : The metaconfig authors would also appreciate a copy...
3131         $test -f /irix && osname=irix
3132         $test -f /xenix && osname=sco_xenix
3133         $test -f /dynix && osname=dynix
3134         $test -f /dnix && osname=dnix
3135         $test -f /lynx.os && osname=lynxos
3136         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3137         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3138         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3139         $test -f /bin/mips && /bin/mips && osname=mips
3140         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3141                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3142         $test -d /usr/apollo/bin && osname=apollo
3143         $test -f /etc/saf/_sactab && osname=svr4
3144         $test -d /usr/include/minix && osname=minix
3145         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3146         if $test -d /MachTen -o -d /MachTen_Folder; then
3147                 osname=machten
3148                 if $test -x /sbin/version; then
3149                         osvers=`/sbin/version | $awk '{print $2}' |
3150                         $sed -e 's/[A-Za-z]$//'`
3151                 elif $test -x /usr/etc/version; then
3152                         osvers=`/usr/etc/version | $awk '{print $2}' |
3153                         $sed -e 's/[A-Za-z]$//'`
3154                 else
3155                         osvers="$2.$3"
3156                 fi
3157         fi
3158
3159         $test -f /sys/posix.dll &&
3160                 $test -f /usr/bin/what &&
3161                 set X `/usr/bin/what /sys/posix.dll` &&
3162                 $test "$3" = UWIN &&
3163                 osname=uwin &&
3164                 osvers="$5"
3165
3166         if $test -f $uname; then
3167                 set X $myuname
3168                 shift
3169
3170                 case "$5" in
3171                 fps*) osname=fps ;;
3172                 mips*)
3173                         case "$4" in
3174                         umips) osname=umips ;;
3175                         *) osname=mips ;;
3176                         esac;;
3177                 [23]100) osname=mips ;;
3178                 next*) osname=next ;;
3179                 i386*)
3180                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3181                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3182                                 osname='sco'
3183                                 osvers=$tmp
3184                         elif $test -f /etc/kconfig; then
3185                                 osname=isc
3186                                 if test "$lns" = "$ln -s"; then
3187                                         osvers=4
3188                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3189                                         osvers=3
3190                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3191                                         osvers=2
3192                                 fi
3193                         fi
3194                         tmp=''
3195                         ;;
3196                 pc*)
3197                         if test -n "$DJGPP"; then
3198                                 osname=dos
3199                                 osvers=djgpp
3200                         fi
3201                         ;;
3202                 esac
3203
3204                 case "$1" in
3205                 aix) osname=aix
3206                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3207                         case "$tmp" in
3208                         # oslevel can fail with:
3209                         # oslevel: Unable to acquire lock.
3210                         *not\ found) osvers="$4"."$3" ;;
3211                         '<3240'|'<>3240') osvers=3.2.0 ;;
3212                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3213                         '=3250'|'>3250') osvers=3.2.5 ;;
3214                         *) osvers=$tmp;;
3215                         esac
3216                         ;;
3217                 bsd386) osname=bsd386
3218                         osvers=`$uname -r`
3219                         ;;
3220                 cygwin*) osname=cygwin
3221                         osvers="$3"
3222                         ;;
3223                 *dc.osx) osname=dcosx
3224                         osvers="$3"
3225                         ;;
3226                 dnix) osname=dnix
3227                         osvers="$3"
3228                         ;;
3229                 domainos) osname=apollo
3230                         osvers="$3"
3231                         ;;
3232                 dgux)   osname=dgux
3233                         osvers="$3"
3234                         ;;
3235                 dragonfly) osname=dragonfly
3236                         osvers="$3"
3237                         ;;
3238                 dynixptx*) osname=dynixptx
3239                         osvers=`echo "$4"|sed 's/^v//'`
3240                         ;;
3241                 freebsd) osname=freebsd
3242                         osvers="$3" ;;
3243                 genix)  osname=genix ;;
3244                 gnu)    osname=gnu
3245                         osvers="$3" ;;
3246                 hp*)    osname=hpux
3247                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3248                         ;;
3249                 irix*)  osname=irix
3250                         case "$3" in
3251                         4*) osvers=4 ;;
3252                         5*) osvers=5 ;;
3253                         *)      osvers="$3" ;;
3254                         esac
3255                         ;;
3256                 linux)  osname=linux
3257                         case "$3" in
3258                         *)      osvers="$3" ;;
3259                         esac
3260                         ;;
3261                 MiNT)   osname=mint
3262                         ;;
3263                 netbsd*) osname=netbsd
3264                         osvers="$3"
3265                         ;;
3266                 news-os) osvers="$3"
3267                         case "$3" in
3268                         4*) osname=newsos4 ;;
3269                         *) osname=newsos ;;
3270                         esac
3271                         ;;
3272                 next*) osname=next ;;
3273                 nonstop-ux) osname=nonstopux ;;
3274                 openbsd) osname=openbsd
3275                         osvers="$3"
3276                         ;;
3277                 os2)    osname=os2
3278                         osvers="$4"
3279                         ;;
3280                 POSIX-BC | posix-bc ) osname=posix-bc
3281                         osvers="$3"
3282                         ;;
3283                 powerux | power_ux | powermax_os | powermaxos | \
3284                 powerunix | power_unix) osname=powerux
3285                         osvers="$3"
3286                         ;;
3287                 qnx) osname=qnx
3288                         osvers="$4"
3289                         ;;
3290                 solaris) osname=solaris
3291                         case "$3" in
3292                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3293                         *)      osvers="$3" ;;
3294                         esac
3295                         ;;
3296                 sunos) osname=sunos
3297                         case "$3" in
3298                         5*) osname=solaris
3299                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3300                         *)      osvers="$3" ;;
3301                         esac
3302                         ;;
3303                 titanos) osname=titanos
3304                         case "$3" in
3305                         1*) osvers=1 ;;
3306                         2*) osvers=2 ;;
3307                         3*) osvers=3 ;;
3308                         4*) osvers=4 ;;
3309                         *)      osvers="$3" ;;
3310                         esac
3311                         ;;
3312                 ultrix) osname=ultrix
3313                         osvers="$3"
3314                         ;;
3315                 osf1|mls+)      case "$5" in
3316                                 alpha)
3317                                         osname=dec_osf
3318                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3319                                         case "$osvers" in
3320                                         [1-9].[0-9]*) ;;
3321                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3322                                         esac
3323                                         ;;
3324                         hp*)    osname=hp_osf1  ;;
3325                         mips)   osname=mips_osf1 ;;
3326                         esac
3327                         ;;
3328                 # UnixWare 7.1.2 is known as Open UNIX 8
3329                 openunix|unixware) osname=svr5
3330                         osvers="$4"
3331                         ;;
3332                 uts)    osname=uts
3333                         osvers="$3"
3334                         ;;
3335                 vos) osvers="$3"
3336                         ;;
3337                 $2) case "$osname" in
3338                         *isc*) ;;
3339                         *freebsd*) ;;
3340                         svr*)
3341                                 : svr4.x or possibly later
3342                                 case "svr$3" in
3343                                 ${osname}*)
3344                                         osname=svr$3
3345                                         osvers=$4
3346                                         ;;
3347                                 esac
3348                                 case "$osname" in
3349                                 svr4.0)
3350                                         : Check for ESIX
3351                                         if test -f /stand/boot ; then
3352                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3353                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3354                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3355                                                         if test -n "$isesix"; then
3356                                                                 osname=esix4
3357                                                         fi
3358                                                 fi
3359                                         fi
3360                                         ;;
3361                                 esac
3362                                 ;;
3363                         *)      if test -f /etc/systemid; then
3364                                         osname=sco
3365                                         set `echo $3 | $sed 's/\./ /g'` $4
3366                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3367                                                 osvers=$1.$2.$3
3368                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3369                                                 osvers=$1.$2
3370                                         elif $test -f $src/hints/sco_$1.sh; then
3371                                                 osvers=$1
3372                                         fi
3373                                 else
3374                                         case "$osname" in
3375                                         '') : Still unknown.  Probably a generic Sys V.
3376                                                 osname="sysv"
3377                                                 osvers="$3"
3378                                                 ;;
3379                                         esac
3380                                 fi
3381                                 ;;
3382                         esac
3383                         ;;
3384                 *)      case "$osname" in
3385                         '') : Still unknown.  Probably a generic BSD.
3386                                 osname="$1"
3387                                 osvers="$3"
3388                                 ;;
3389                         esac
3390                         ;;
3391                 esac
3392         else
3393                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3394                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3395                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3396                                 osname=news_os
3397                         fi
3398                         $rm -f UU/kernel.what
3399                 elif test -d c:/. -o -n "$is_os2" ; then
3400                         set X $myuname
3401                         osname=os2
3402                         osvers="$5"
3403                 fi
3404         fi
3405
3406         case "$targetarch" in
3407         '') ;;
3408         *)  hostarch=$osname
3409             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3410             osvers=''
3411             ;;
3412         esac
3413
3414         : Now look for a hint file osname_osvers, unless one has been
3415         : specified already.
3416         case "$hintfile" in
3417         ''|' ')
3418                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3419                 : Also try without trailing minor version numbers.
3420                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3421                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3422                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3423                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3424                 case "$file" in
3425                 '') dflt=none ;;
3426                 *)  case "$osvers" in
3427                         '') dflt=$file
3428                                 ;;
3429                         *)  if $test -f $src/hints/$file.sh ; then
3430                                         dflt=$file
3431                                 elif $test -f $src/hints/$xfile.sh ; then
3432                                         dflt=$xfile
3433                                 elif $test -f $src/hints/$xxfile.sh ; then
3434                                         dflt=$xxfile
3435                                 elif $test -f $src/hints/$xxxfile.sh ; then
3436                                         dflt=$xxxfile
3437                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3438                                         dflt=$xxxxfile
3439                                 elif $test -f "$src/hints/${osname}.sh" ; then
3440                                         dflt="${osname}"
3441                                 else
3442                                         dflt=none
3443                                 fi
3444                                 ;;
3445                         esac
3446                         ;;
3447                 esac
3448                 if $test -f Policy.sh ; then
3449                         case "$dflt" in
3450                         *Policy*) ;;
3451                         none) dflt="Policy" ;;
3452                         *) dflt="Policy $dflt" ;;
3453                         esac
3454                 fi
3455                 ;;
3456         *)
3457                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3458                 ;;
3459         esac
3460
3461         if $test -f Policy.sh ; then
3462                 $cat <<EOM
3463
3464 There's also a Policy hint file available, which should make the
3465 site-specific (policy) questions easier to answer.
3466 EOM
3467
3468         fi
3469
3470         $cat <<EOM
3471
3472 You may give one or more space-separated answers, or "none" if appropriate.
3473 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3474 previous run of Configure, you may specify it as well as or instead of
3475 OS-specific hints.  If hints are provided for your OS, you should use them:
3476 although Perl can probably be built without hints on many platforms, using
3477 hints often improve performance and may enable features that Configure can't
3478 set up on its own. If there are no hints that match your OS, specify "none";
3479 DO NOT give a wrong version or a wrong OS.
3480
3481 EOM
3482
3483         rp="Which of these apply, if any?"
3484         . UU/myread
3485         tans=$ans
3486         for file in $tans; do
3487                 if $test X$file = XPolicy -a -f Policy.sh; then
3488                         . Policy.sh
3489                         $cat Policy.sh >> UU/config.sh
3490                 elif $test -f $src/hints/$file.sh; then
3491                         . $src/hints/$file.sh
3492                         $cat $src/hints/$file.sh >> UU/config.sh
3493                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3494                         : nothing
3495                 else
3496                         : Give one chance to correct a possible typo.
3497                         echo "$file.sh does not exist"
3498                         dflt=$file
3499                         rp="hint to use instead?"
3500                         . UU/myread
3501                         for file in $ans; do
3502                                 if $test -f "$src/hints/$file.sh"; then
3503                                         . $src/hints/$file.sh
3504                                         $cat $src/hints/$file.sh >> UU/config.sh
3505                                 elif $test X$ans = X -o X$ans = Xnone ; then
3506                                         : nothing
3507                                 else
3508                                         echo "$file.sh does not exist -- ignored."
3509                                 fi
3510                         done
3511                 fi
3512         done
3513
3514         hint=recommended
3515         : Remember our hint file for later.
3516         if $test -f "$src/hints/$file.sh" ; then
3517                 hintfile="$file"
3518         else
3519                 hintfile=''
3520         fi
3521 fi
3522 cd UU
3523 ;;
3524 *)
3525         echo " "
3526         echo "Fetching default answers from $config_sh..." >&4
3527         tmp_n="$n"
3528         tmp_c="$c"
3529         cd ..
3530         cp $config_sh config.sh 2>/dev/null
3531         chmod +w config.sh
3532         . ./config.sh
3533         cd UU
3534         cp ../config.sh .
3535         n="$tmp_n"
3536         c="$tmp_c"
3537         hint=previous
3538         ;;
3539 esac
3540 test "$override" && . ./optdef.sh
3541
3542 : Restore computed paths
3543 for file in $loclist $trylist; do
3544         eval $file="\$_$file"
3545 done
3546
3547 cat << EOM
3548
3549 Configure uses the operating system name and version to set some defaults.
3550 The default value is probably right if the name rings a bell. Otherwise,
3551 since spelling matters for me, either accept the default or answer "none"
3552 to leave it blank.
3553
3554 EOM
3555 case "$osname" in
3556         ''|' ')
3557                 case "$hintfile" in
3558                 ''|' '|none) dflt=none ;;
3559                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3560                 esac
3561                 ;;
3562         *) dflt="$osname" ;;
3563 esac
3564 rp="Operating system name?"
3565 . ./myread
3566 case "$ans" in
3567 none)  osname='' ;;
3568 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3569 esac
3570 echo " "
3571 case "$osvers" in
3572         ''|' ')
3573                 case "$hintfile" in
3574                 ''|' '|none) dflt=none ;;
3575                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3576                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3577                         case "$dflt" in
3578                         ''|' ') dflt=none ;;
3579                         esac
3580                         ;;
3581                 esac
3582                 ;;
3583         *) dflt="$osvers" ;;
3584 esac
3585 rp="Operating system version?"
3586 . ./myread
3587 case "$ans" in
3588 none)  osvers='' ;;
3589 *) osvers="$ans" ;;
3590 esac
3591
3592
3593 . ./posthint.sh
3594
3595 : who configured the system
3596 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3597 case "$cf_by" in
3598 "")
3599         cf_by=`(logname) 2>/dev/null`
3600         case "$cf_by" in
3601         "")
3602                 cf_by=`(whoami) 2>/dev/null`
3603                 case "$cf_by" in
3604                 "") cf_by=unknown ;;
3605                 esac ;;
3606         esac ;;
3607 esac
3608
3609 : decide how portable to be.  Allow command line overrides.
3610 case "$d_portable" in
3611 "$undef") ;;
3612 *)      d_portable="$define" ;;
3613 esac
3614
3615 : set up shell script to do ~ expansion
3616 cat >filexp <<EOSS
3617 $startsh
3618 : expand filename
3619 case "\$1" in
3620  \~/*|\~)
3621         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3622         ;;
3623  \~*)
3624         if $test -f /bin/csh; then
3625                 /bin/csh -f -c "glob \$1"
3626                 failed=\$?
3627                 echo ""
3628                 exit \$failed
3629         else
3630                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3631                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3632                 if $test ! -d "\$dir"; then
3633                         me=\`basename \$0\`
3634                         echo "\$me: can't locate home directory for: \$name" >&2
3635                         exit 1
3636                 fi
3637                 case "\$1" in
3638                 */*)
3639                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3640                         ;;
3641                 *)
3642                         echo \$dir
3643                         ;;
3644                 esac
3645         fi
3646         ;;
3647 *)
3648         echo \$1
3649         ;;
3650 esac
3651 EOSS
3652 chmod +x filexp
3653 $eunicefix filexp
3654
3655 : now set up to get a file name
3656 cat <<EOS >getfile
3657 $startsh
3658 EOS
3659 cat <<'EOSC' >>getfile
3660 tilde=''
3661 fullpath=''
3662 already=''
3663 skip=''
3664 none_ok=''
3665 exp_file=''
3666 nopath_ok=''
3667 orig_rp="$rp"
3668 orig_dflt="$dflt"
3669 case "$gfpth" in
3670 '') gfpth='.' ;;
3671 esac
3672
3673 case "$fn" in
3674 *\(*)
3675         : getfile will accept an answer from the comma-separated list
3676         : enclosed in parentheses even if it does not meet other criteria.
3677         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3678         fn=`echo $fn | sed 's/(.*)//'`
3679         ;;
3680 esac
3681
3682 case "$fn" in
3683 *:*)
3684         loc_file=`expr $fn : '.*:\(.*\)'`
3685         fn=`expr $fn : '\(.*\):.*'`
3686         ;;
3687 esac
3688
3689 case "$fn" in
3690 *~*) tilde=true;;
3691 esac
3692 case "$fn" in
3693 */*) fullpath=true;;
3694 esac
3695 case "$fn" in
3696 *+*) skip=true;;
3697 esac
3698 case "$fn" in
3699 *n*) none_ok=true;;
3700 esac
3701 case "$fn" in
3702 *e*) exp_file=true;;
3703 esac
3704 case "$fn" in
3705 *p*) nopath_ok=true;;
3706 esac
3707
3708 case "$fn" in
3709 *f*) type='File';;
3710 *d*) type='Directory';;
3711 *l*) type='Locate';;
3712 esac
3713
3714 what="$type"
3715 case "$what" in
3716 Locate) what='File';;
3717 esac
3718
3719 case "$exp_file" in
3720 '')
3721         case "$d_portable" in
3722         "$define") ;;
3723         *) exp_file=true;;
3724         esac
3725         ;;
3726 esac
3727
3728 cd ..
3729 while test "$type"; do
3730         redo=''
3731         rp="$orig_rp"
3732         dflt="$orig_dflt"
3733         case "$tilde" in
3734         true) rp="$rp (~name ok)";;
3735         esac
3736         . UU/myread
3737         if test -f UU/getfile.ok && \
3738                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3739         then
3740                 value="$ans"
3741                 ansexp="$ans"
3742                 break
3743         fi
3744         case "$ans" in
3745         none)
3746                 value=''
3747                 ansexp=''
3748                 case "$none_ok" in
3749                 true) type='';;
3750                 esac
3751                 ;;
3752         *)
3753                 case "$tilde" in
3754                 '') value="$ans"
3755                         ansexp="$ans";;
3756                 *)
3757                         value=`UU/filexp $ans`
3758                         case $? in
3759                         0)
3760                                 if test "$ans" != "$value"; then
3761                                         echo "(That expands to $value on this system.)"
3762                                 fi
3763                                 ;;
3764                         *) value="$ans";;
3765                         esac
3766                         ansexp="$value"
3767                         case "$exp_file" in
3768                         '') value="$ans";;
3769                         esac
3770                         ;;
3771                 esac
3772                 case "$fullpath" in
3773                 true)
3774                         case "$ansexp" in
3775                         /*) value="$ansexp" ;;
3776                         [a-zA-Z]:/*) value="$ansexp" ;;
3777                         *)
3778                                 redo=true
3779                                 case "$already" in
3780                                 true)
3781                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3782                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3783                                         ;;
3784                                 *)
3785                                 echo "Please give a full path name, starting with slash." >&4
3786                                         case "$tilde" in
3787                                         true)
3788                                 echo "Note that using ~name is ok provided it expands well." >&4
3789                                                 already=true
3790                                                 ;;
3791                                         esac
3792                                 esac
3793                                 ;;
3794                         esac
3795                         ;;
3796                 esac
3797                 case "$redo" in
3798                 '')
3799                         case "$type" in
3800                         File)
3801                                 for fp in $gfpth; do
3802                                         if test "X$fp" = X.; then
3803                                             pf="$ansexp"
3804                                         else    
3805                                             pf="$fp/$ansexp"
3806                                         fi
3807                                         if test -f "$pf"; then
3808                                                 type=''
3809                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3810                                         then
3811                                                 echo "($value is not a plain file, but that's ok.)"
3812                                                 type=''
3813                                         fi
3814                                         if test X"$type" = X; then
3815                                             value="$pf"
3816                                             break
3817                                         fi
3818                                 done
3819                                 ;;
3820                         Directory)
3821                                 for fp in $gfpth; do
3822                                         if test "X$fp" = X.; then
3823                                             dir="$ans"
3824                                             direxp="$ansexp"
3825                                         else    
3826                                             dir="$fp/$ansexp"
3827                                             direxp="$fp/$ansexp"
3828                                         fi
3829                                         if test -d "$direxp"; then
3830                                                 type=''
3831                                                 value="$dir"
3832                                                 break
3833                                         fi
3834                                 done
3835                                 ;;
3836                         Locate)
3837                                 if test -d "$ansexp"; then
3838                                         echo "(Looking for $loc_file in directory $value.)"
3839                                         value="$value/$loc_file"
3840                                         ansexp="$ansexp/$loc_file"
3841                                 fi
3842                                 if test -f "$ansexp"; then
3843                                         type=''
3844                                 fi
3845                                 case "$nopath_ok" in
3846                                 true)   case "$value" in
3847                                         */*) ;;
3848                                         *)      echo "Assuming $value will be in people's path."
3849                                                 type=''
3850                                                 ;;
3851                                         esac
3852                                         ;;
3853                                 esac
3854                                 ;;
3855                         esac
3856
3857                         case "$skip" in
3858                         true) type='';
3859                         esac
3860
3861                         case "$type" in
3862                         '') ;;
3863                         *)
3864                                 if test "$fastread" = yes; then
3865                                         dflt=y
3866                                 else
3867                                         dflt=n
3868                                 fi
3869                                 rp="$what $value doesn't exist.  Use that name anyway?"
3870                                 . UU/myread
3871                                 dflt=''
3872                                 case "$ans" in
3873                                 y*) type='';;
3874                                 *) echo " ";;
3875                                 esac
3876                                 ;;
3877                         esac
3878                         ;;
3879                 esac
3880                 ;;
3881         esac
3882 done
3883 cd UU
3884 ans="$value"
3885 rp="$orig_rp"
3886 dflt="$orig_dflt"
3887 rm -f getfile.ok
3888 test "X$gfpthkeep" != Xy && gfpth=""
3889 EOSC
3890
3891 : determine root of directory hierarchy where package will be installed.
3892 case "$prefix" in
3893 '')
3894         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3895         ;;
3896 *?/)
3897         dflt=`echo "$prefix" | sed 's/.$//'`
3898         ;;
3899 *)
3900         dflt="$prefix"
3901         ;;
3902 esac
3903 $cat <<EOM
3904
3905 By default, $package will be installed in $dflt/bin, manual pages
3906 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3907 installation directories. Typically this is something like /usr/local.
3908 If you wish to have binaries under /usr/bin but other parts of the
3909 installation under /usr/local, that's ok: you will be prompted
3910 separately for each of the installation directories, the prefix being
3911 only used to set the defaults.
3912
3913 EOM
3914 fn=d~
3915 rp='Installation prefix to use?'
3916 . ./getfile
3917 oldprefix=''
3918 case "$prefix" in
3919 '') ;;
3920 *)
3921         case "$ans" in
3922         "$prefix") ;;
3923         *) oldprefix="$prefix";;
3924         esac
3925         ;;
3926 esac
3927 prefix="$ans"
3928 prefixexp="$ansexp"
3929
3930 : allow them to override the AFS root
3931 case "$afsroot" in
3932 '')     afsroot=/afs ;;
3933 *)      afsroot=$afsroot ;;
3934 esac
3935
3936 : is AFS running?
3937 echo " "
3938 case "$afs" in
3939 $define|true)   afs=true ;;
3940 $undef|false)   afs=false ;;
3941 *)      if $test -d $afsroot; then
3942                 afs=true
3943         else
3944                 afs=false
3945         fi
3946         ;;
3947 esac
3948 if $afs; then
3949         echo "AFS may be running... I'll be extra cautious then..." >&4
3950 else
3951         echo "AFS does not seem to be running..." >&4
3952 fi
3953
3954 : determine installation prefix for where package is to be installed.
3955 if $afs; then 
3956 $cat <<EOM
3957
3958 Since you are running AFS, I need to distinguish the directory in which
3959 files will reside from the directory in which they are installed (and from
3960 which they are presumably copied to the former directory by occult means).
3961
3962 EOM
3963         case "$installprefix" in
3964         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3965         *) dflt="$installprefix";;
3966         esac
3967 else
3968 $cat <<EOM
3969
3970 In some special cases, particularly when building $package for distribution,
3971 it is convenient to distinguish the directory in which files should be
3972 installed from the directory ($prefix) in which they will
3973 eventually reside.  For most users, these two directories are the same.
3974
3975 EOM
3976         case "$installprefix" in
3977         '') dflt=$prefix ;;
3978         *) dflt=$installprefix;;
3979         esac
3980 fi
3981 fn=d~
3982 rp='What installation prefix should I use for installing files?'
3983 . ./getfile
3984 installprefix="$ans"
3985 installprefixexp="$ansexp"
3986
3987 : Perform the prefixexp/installprefixexp correction if necessary
3988 cat <<EOS >installprefix
3989 $startsh
3990 EOS
3991 cat <<'EOSC' >>installprefix
3992 : Change installation prefix, if necessary.
3993 if $test X"$prefix" != X"$installprefix"; then
3994     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3995 else
3996     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3997 fi
3998 EOSC
3999 chmod +x installprefix
4000 $eunicefix installprefix
4001
4002 : Set variables such as privlib and privlibexp from the output of ./getfile
4003 : performing the prefixexp/installprefixexp correction if necessary.
4004 cat <<EOS >setprefixvar
4005 $startsh
4006 EOS
4007 cat <<'EOSC' >>setprefixvar
4008 eval "${prefixvar}=\"\$ans\""
4009 eval "${prefixvar}exp=\"\$ansexp\""
4010 . ./installprefix
4011 EOSC
4012 chmod +x setprefixvar
4013 $eunicefix setprefixvar
4014
4015 : set up the script used to warn in case of inconsistency
4016 cat <<EOS >whoa
4017 $startsh
4018 EOS
4019 cat <<'EOSC' >>whoa
4020 dflt=y
4021 case "$hint" in
4022     recommended)
4023         case "$hintfile" in
4024         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4025                 ;;
4026         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4027                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4028                 ;;
4029         esac
4030         ;;
4031     *)  echo " "
4032         echo "*** WHOA THERE!!! ***" >&4
4033         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4034         ;;
4035 esac
4036 rp="    Keep the $hint value?"
4037 . ./myread
4038 case "$ans" in
4039 y) td=$was; tu=$was;;
4040 esac
4041 EOSC
4042
4043 : function used to set '$1' to '$val'
4044 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4045 case "$val$was" in
4046 $define$undef) . ./whoa; eval "$var=\$td";;
4047 $undef$define) . ./whoa; eval "$var=\$tu";;
4048 *) eval "$var=$val";;
4049 esac'
4050
4051 : Check is we will use socks
4052 case "$usesocks" in
4053 $define|true|[yY]*)     dflt='y';;
4054 *) dflt='n';;
4055 esac
4056 cat <<EOM
4057
4058 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4059 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4060 to use the PerlIO abstraction layer, this will be implicitly selected.
4061
4062 If this doesn't make any sense to you, just accept the default '$dflt'.
4063 EOM
4064 rp='Build Perl for SOCKS?'
4065 . ./myread
4066 case "$ans" in
4067 y|Y)    val="$define" ;;
4068 *)      val="$undef" ;;
4069 esac
4070 set usesocks
4071 eval $setvar
4072
4073 case "$usesocks" in
4074 $define|true|[yY]*) useperlio="$define";;
4075 esac
4076
4077 : Check if we want perlio
4078 case "$useperlio" in
4079 $define|true|[yY]*|'')  dflt='y';;
4080 *) dflt='n';;
4081 esac
4082 cat <<EOM
4083
4084 Previous version of $package used the standard IO mechanisms as
4085 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4086 alternate IO mechanisms via the PerlIO abstraction layer, but the
4087 stdio mechanism is still available if needed.  The abstraction layer
4088 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4089 Using PerlIO with sfio may cause problems with some extension modules.
4090
4091 If this doesn't make any sense to you, just accept the default '$dflt'.
4092 EOM
4093 rp='Use the PerlIO abstraction layer?'
4094 . ./myread
4095 case "$ans" in
4096 y|Y)
4097         val="$define"
4098         ;;
4099 *)
4100         echo "Ok, doing things the stdio way."
4101         val="$undef"
4102         ;;
4103 esac
4104 set useperlio
4105 eval $setvar
4106
4107 case "$usesocks" in
4108 $define|true|[yY]*)
4109         case "$useperlio" in
4110         $define|true|[yY]*) ;;
4111         *)      cat >&4 <<EOM
4112
4113 You are using the SOCKS proxy protocol library which means that you
4114 should also use the PerlIO layer.  You may be headed for trouble.
4115
4116 EOM
4117                 ;;
4118         esac
4119         ;;
4120 esac
4121
4122 : get the patchlevel
4123 echo " "
4124 echo "Getting the current patchlevel..." >&4
4125 if $test -r $rsrc/patchlevel.h;then
4126         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4127         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4128         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4129         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4130         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4131         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4132         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4133 else
4134         revision=0
4135         patchlevel=0
4136         subversion=0
4137         api_revision=0
4138         api_version=0
4139         api_subversion=0
4140         perl_patchlevel=0
4141         $echo "(You do not have patchlevel.h.  Eek.)"
4142 fi
4143 if $test -r $rsrc/.patch ; then
4144         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4145                 perl_patchlevel=`cat $rsrc/.patch`
4146         fi
4147 fi
4148 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4149 version_patchlevel_string="version $patchlevel subversion $subversion"
4150 case "$perl_patchlevel" in
4151 0|'') ;;
4152 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4153     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4154     ;;
4155 esac
4156
4157 $echo "(You have $package $version_patchlevel_string.)"
4158
4159 case "$osname" in
4160 dos|vms)
4161         : XXX Should be a Configure test for double-dots in filenames.
4162         version=`echo $revision $patchlevel $subversion | \
4163                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4164         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4165                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4166         ;;
4167 *)
4168         version=`echo $revision $patchlevel $subversion | \
4169                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4170         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4171                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4172         ;;
4173 esac
4174 : Special case the 5.005_xx maintenance series, which used 5.005
4175 : without any subversion label as a subdirectory in $sitelib
4176 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4177         api_versionstring='5.005'
4178 fi
4179
4180 : Do we want threads support and if so, what type
4181 case "$usethreads" in
4182 $define|true|[yY]*)     dflt='y';;
4183 *)     # Catch case where user specified ithreads or 5005threads but
4184        # forgot -Dusethreads (A.D. 4/2002)
4185        case "$useithreads$use5005threads" in
4186        *$define*)
4187                 case "$useperlio" in
4188                 "$define")      dflt='y' ;;
4189                 *)              dflt='n' ;;
4190                 esac
4191                 ;;
4192        *)       dflt='n';;
4193        esac
4194        ;;
4195 esac
4196 cat <<EOM
4197
4198 Perl can be built to take advantage of threads on some systems.
4199 To do so, Configure can be run with -Dusethreads.
4200
4201 Note that Perl built with threading support runs slightly slower
4202 and uses more memory than plain Perl. The current implementation
4203 is believed to be stable, but it is fairly new, and so should be
4204 treated with caution.
4205
4206 If this doesn't make any sense to you, just accept the default '$dflt'.
4207 EOM
4208 rp='Build a threading Perl?'
4209 . ./myread
4210 case "$ans" in
4211 y|Y)    val="$define" ;;
4212 *)      val="$undef" ;;
4213 esac
4214 set usethreads
4215 eval $setvar
4216
4217 if $test $patchlevel -lt 9; then
4218     case "$usethreads" in
4219     $define)
4220         $cat <<EOM
4221
4222 Since release 5.6, Perl has had two different threading implementations,
4223 the newer interpreter-based version (ithreads) with one interpreter per
4224 thread, and the older 5.005 version (5005threads).
4225 The 5005threads version is effectively unmaintained and will probably be
4226 removed in Perl 5.10, so there should be no need to build a Perl using it
4227 unless needed for backwards compatibility with some existing 5.005threads
4228 code.
4229
4230 EOM
4231         : Default to ithreads unless overridden on command line or with
4232         : old config.sh
4233         dflt='y'
4234         case "$use5005threads" in
4235                 $define|true|[yY]*) dflt='n';;
4236         esac
4237         case "$useithreads" in
4238                 $undef|false|[nN]*) dflt='n';;
4239         esac
4240         rp='Use the newer interpreter-based ithreads?'
4241         . ./myread
4242         case "$ans" in
4243         y|Y)    val="$define" ;;
4244         *)      val="$undef" ;;
4245         esac
4246         set useithreads
4247         eval $setvar
4248         : Now set use5005threads to the opposite value.
4249         case "$useithreads" in
4250         $define) val="$undef" ;;
4251         *) val="$define" ;;
4252         esac
4253         set use5005threads
4254         eval $setvar
4255         ;;
4256     *)
4257         useithreads="$undef"
4258         use5005threads="$undef"
4259         ;;
4260     esac
4261
4262     case "$useithreads$use5005threads" in
4263     "$define$define")
4264         $cat >&4 <<EOM
4265
4266 You cannot have both the ithreads and the 5.005 threads enabled
4267 at the same time.  Disabling the 5.005 threads since they are
4268 much less stable than the ithreads.
4269
4270 EOM
4271         use5005threads="$undef"
4272         ;;
4273     esac
4274
4275 else
4276 : perl-5.9.x and later
4277
4278     if test X"$usethreads" = "X$define"; then
4279         case "$use5005threads" in
4280             $define|true|[yY]*)
4281                 $cat >&4 <<EOM
4282
4283 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4284
4285 EOM
4286             ;;
4287         esac
4288     fi
4289
4290     use5005threads="$undef"
4291     useithreads="$usethreads"
4292 fi
4293
4294 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4295         cat >&4 <<EOF
4296 ***
4297 *** To build with ithreads you must also use the PerlIO layer.
4298 *** Cannot continue, aborting.
4299 ***
4300 EOF
4301         exit 1
4302 fi
4303
4304 case "$d_oldpthreads" in
4305 '')     : Configure tests would be welcome here.  For now, assume undef.
4306         val="$undef" ;;
4307 *)      val="$d_oldpthreads" ;;
4308 esac
4309 set d_oldpthreads
4310 eval $setvar
4311
4312
4313 : Look for a hint-file generated 'call-back-unit'.  If the
4314 : user has specified that a threading perl is to be built,
4315 : we may need to set or change some other defaults.
4316 if $test -f usethreads.cbu; then
4317     echo "Your platform has some specific hints regarding threaded builds, using them..."
4318     . ./usethreads.cbu
4319 else
4320     case "$usethreads" in
4321         "$define"|true|[yY]*)
4322                 $cat <<EOM
4323 (Your platform does not have any specific hints for threaded builds.
4324  Assuming POSIX threads, then.)
4325 EOM
4326         ;;
4327     esac
4328 fi
4329
4330 : Check if multiplicity is required
4331 cat <<EOM
4332
4333 Perl can be built so that multiple Perl interpreters can coexist
4334 within the same Perl executable.
4335 EOM
4336
4337 case "$useithreads" in
4338 $define)
4339         cat <<EOM
4340 This multiple interpreter support is required for interpreter-based threads.
4341 EOM
4342         val="$define"
4343         ;;
4344 *)      case "$usemultiplicity" in
4345         $define|true|[yY]*)     dflt='y';;
4346         *) dflt='n';;
4347         esac
4348         echo " "
4349         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4350         rp='Build Perl for multiplicity?'
4351         . ./myread
4352         case "$ans" in
4353         y|Y)    val="$define" ;;
4354         *)      val="$undef" ;;
4355         esac
4356         ;;
4357 esac
4358 set usemultiplicity
4359 eval $setvar
4360
4361 : Check if morebits is requested
4362 case "$usemorebits" in
4363 "$define"|true|[yY]*)
4364         use64bitint="$define"
4365         uselongdouble="$define"
4366         usemorebits="$define"
4367         ;;
4368 *)      usemorebits="$undef"
4369         ;;
4370 esac
4371
4372 : Determine the C compiler to be used
4373 echo " "
4374 case "$cc" in
4375 '') dflt=cc;;
4376 *) dflt="$cc";;
4377 esac
4378 rp="Use which C compiler?"
4379 . ./myread
4380 cc="$ans"
4381
4382 : See whether they have no cc but they do have gcc
4383 . ./trygcc
4384 if $test -f cc.cbu; then
4385     . ./cc.cbu
4386 fi
4387 . ./checkcc
4388
4389 : make some quick guesses about what we are up against
4390 echo " "
4391 $echo $n "Hmm...  $c"
4392 echo exit 1 >bsd
4393 echo exit 1 >usg
4394 echo exit 1 >v7
4395 echo exit 1 >osf1
4396 echo exit 1 >eunice
4397 echo exit 1 >xenix
4398 echo exit 1 >venix
4399 echo exit 1 >os2
4400 d_bsd="$undef"
4401 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4402 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4403 then
4404         echo "Looks kind of like an OSF/1 system, but we'll see..."
4405         echo exit 0 >osf1
4406 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4407         xxx=`./loc addbib blurfl $pth`
4408         if $test -f $xxx; then
4409         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4410                 echo exit 0 >bsd
4411                 echo exit 0 >usg
4412         else
4413                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4414                         echo "Looks kind of like an extended USG system, but we'll see..."
4415                 else
4416                         echo "Looks kind of like a USG system, but we'll see..."
4417                 fi
4418                 echo exit 0 >usg
4419         fi
4420 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4421         echo "Looks kind of like a BSD system, but we'll see..."
4422         d_bsd="$define"
4423         echo exit 0 >bsd
4424 else
4425         echo "Looks kind of like a Version 7 system, but we'll see..."
4426         echo exit 0 >v7
4427 fi
4428 case "$eunicefix" in
4429 *unixtovms*)
4430         $cat <<'EOI'
4431 There is, however, a strange, musty smell in the air that reminds me of
4432 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4433 EOI
4434         echo exit 0 >eunice
4435         d_eunice="$define"
4436 : it so happens the Eunice I know will not run shell scripts in Unix format
4437         ;;
4438 *)
4439         echo " "
4440         echo "Congratulations.  You aren't running Eunice."
4441         d_eunice="$undef"
4442         ;;
4443 esac
4444 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4445 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4446 : semicolon as a patch separator
4447 case "$p_" in
4448 :) ;;
4449 *)
4450         $cat <<'EOI'
4451 I have the feeling something is not exactly right, however...don't tell me...
4452 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4453 (Or you may be running DOS with DJGPP.)
4454 EOI
4455         echo exit 0 >os2
4456         ;;
4457 esac
4458 if test -f /xenix; then
4459         echo "Actually, this looks more like a XENIX system..."
4460         echo exit 0 >xenix
4461         d_xenix="$define"
4462 else
4463         echo " "
4464         echo "It's not Xenix..."
4465         d_xenix="$undef"
4466 fi
4467 chmod +x xenix
4468 $eunicefix xenix
4469 if test -f /venix; then
4470         echo "Actually, this looks more like a VENIX system..."
4471         echo exit 0 >venix
4472 else
4473         echo " "
4474         if ./xenix; then
4475                 : null
4476         else
4477                 echo "Nor is it Venix..."
4478         fi
4479 fi
4480 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4481 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4482 $rm -f foo
4483
4484 : Check if we are using GNU gcc and what its version is
4485 echo " "
4486 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4487 $cat >try.c <<EOM
4488 #include <stdio.h>
4489 int main() {
4490 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4491 #ifdef __VERSION__
4492         printf("%s\n", __VERSION__);
4493 #else
4494         printf("%s\n", "1");
4495 #endif
4496 #endif
4497         return(0);
4498 }
4499 EOM
4500 if $cc -o try $ccflags $ldflags try.c; then
4501         gccversion=`$run ./try`
4502         case "$gccversion" in
4503         '') echo "You are not using GNU cc." ;;
4504         *)  echo "You are using GNU cc $gccversion."
4505             ccname=gcc
4506             ;;
4507         esac
4508 else
4509         echo " "
4510         echo "*** WHOA THERE!!! ***" >&4
4511         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4512         case "$knowitall" in
4513         '')
4514         echo "    You'd better start hunting for one and let me know about it." >&4
4515                 exit 1
4516                 ;;
4517         esac
4518 fi
4519 $rm -f try try.*
4520 case "$gccversion" in
4521 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4522 esac
4523 case "$gccversion" in
4524 '') gccosandvers='' ;;
4525 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4526    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4527    gccshortvers=''
4528    case "$gccosandvers" in
4529    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4530    $osname$osvers) ;; # looking good
4531    $osname*) cat <<EOM >&4
4532
4533 *** WHOA THERE!!! ***
4534
4535     Your gcc has not been compiled for the exact release of
4536     your operating system ($gccosandvers versus $osname$osvers).
4537
4538     In general it is a good idea to keep gcc synchronized with
4539     the operating system because otherwise serious problems
4540     may ensue when trying to compile software, like Perl.
4541
4542     I'm trying to be optimistic here, though, and will continue.
4543     If later during the configuration and build icky compilation
4544     problems appear (headerfile conflicts being the most common
4545     manifestation), I suggest reinstalling the gcc to match
4546     your operating system release.
4547
4548 EOM
4549       ;;
4550    *) gccosandvers='' ;; # failed to parse, better be silent
4551    esac
4552    ;;
4553 esac
4554 case "$ccname" in
4555 '') ccname="$cc" ;;
4556 esac
4557
4558 # gcc 3.* complain about adding -Idirectories that they already know about,
4559 # so we will take those off from locincpth.
4560 case "$gccversion" in
4561 3*)
4562     echo "main(){}">try.c
4563     for incdir in $locincpth; do
4564        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4565              grep '^c[cp]p*[01]: warning: changing search order '`
4566        if test "X$warn" != X; then
4567            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4568        fi
4569     done
4570     $rm -f try try.*
4571 esac
4572
4573 : What should the include directory be ?
4574 echo " "
4575 $echo $n "Hmm...  $c"
4576 dflt='/usr/include'
4577 incpath=''
4578 mips_type=''
4579 if $test -f /bin/mips && /bin/mips; then
4580         echo "Looks like a MIPS system..."
4581         $cat >usr.c <<'EOCP'
4582 #ifdef SYSTYPE_BSD43
4583 /bsd43
4584 #endif
4585 EOCP
4586         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4587                 dflt='/bsd43/usr/include'
4588                 incpath='/bsd43'
4589                 mips_type='BSD 4.3'
4590         else
4591                 mips_type='System V'
4592         fi
4593         $rm -f usr.c usr.out
4594         echo "and you're compiling with the $mips_type compiler and libraries."
4595         xxx_prompt=y
4596         echo "exit 0" >mips
4597 else
4598         echo "Doesn't look like a MIPS system."
4599         xxx_prompt=n
4600         echo "exit 1" >mips
4601 fi
4602 chmod +x mips
4603 $eunicefix mips
4604 case "$usrinc" in
4605 '') ;;
4606 *) dflt="$usrinc";;
4607 esac
4608 case "$xxx_prompt" in
4609 y)      fn=d/
4610         echo " "
4611         rp='Where are the include files you want to use?'
4612         . ./getfile
4613         usrinc="$ans"
4614         ;;
4615 *)      usrinc="$dflt"
4616         ;;
4617 esac
4618
4619 : see how we invoke the C preprocessor
4620 echo " "
4621 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4622 cat <<'EOT' >testcpp.c
4623 #define ABC abc
4624 #define XYZ xyz
4625 ABC.XYZ
4626 EOT
4627 cd ..
4628 if test ! -f cppstdin; then
4629         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4630                 # AIX cc -E doesn't show the absolute headerfile
4631                 # locations but we'll cheat by using the -M flag.
4632                 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
4633         else
4634                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4635         fi
4636 else
4637         echo "Keeping your $hint cppstdin wrapper."
4638 fi
4639 chmod 755 cppstdin
4640 wrapper=`pwd`/cppstdin
4641 ok='false'
4642 cd UU
4643
4644 if $test "X$cppstdin" != "X" && \
4645         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4646         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4647 then
4648         echo "You used to use $cppstdin $cppminus so we'll use that again."
4649         case "$cpprun" in
4650         '') echo "But let's see if we can live without a wrapper..." ;;
4651         *)
4652                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4653                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4654                 then
4655                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4656                         ok='true'
4657                 else
4658                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4659                 fi
4660                 ;;
4661         esac
4662 else
4663         case "$cppstdin" in
4664         '') ;;
4665         *)
4666                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4667                 ;;
4668         esac
4669 fi
4670
4671 if $ok; then
4672         : nothing
4673 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4674         $cc -E <testcpp.c >testcpp.out 2>&1; \
4675         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4676         echo "Yup, it does."
4677         x_cpp="$cc -E"
4678         x_minus='';
4679 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4680         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4681         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4682         echo "Yup, it does."
4683         x_cpp="$cc -E"
4684         x_minus='-';
4685 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4686         $cc -P <testcpp.c >testcpp.out 2>&1; \
4687         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4688         echo "Yipee, that works!"
4689         x_cpp="$cc -P"
4690         x_minus='';
4691 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4692         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4693         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694         echo "At long last!"
4695         x_cpp="$cc -P"
4696         x_minus='-';
4697 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4698         $cpp <testcpp.c >testcpp.out 2>&1; \
4699         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700         echo "It works!"
4701         x_cpp="$cpp"
4702         x_minus='';
4703 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4704         $cpp - <testcpp.c >testcpp.out 2>&1; \
4705         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706         echo "Hooray, it works!  I was beginning to wonder."
4707         x_cpp="$cpp"
4708         x_minus='-';
4709 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4710         $wrapper <testcpp.c >testcpp.out 2>&1; \
4711         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712         x_cpp="$wrapper"
4713         x_minus=''
4714         echo "Eureka!"
4715 else
4716         dflt=''
4717         rp="No dice.  I can't find a C preprocessor.  Name one:"
4718         . ./myread
4719         x_cpp="$ans"
4720         x_minus=''
4721         $x_cpp <testcpp.c >testcpp.out 2>&1
4722         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4723                 echo "OK, that will do." >&4
4724         else
4725 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4726                 exit 1
4727         fi
4728 fi
4729
4730 case "$ok" in
4731 false)
4732         cppstdin="$x_cpp"
4733         cppminus="$x_minus"
4734         cpprun="$x_cpp"
4735         cpplast="$x_minus"
4736         set X $x_cpp
4737         shift
4738         case "$1" in
4739         "$cpp")
4740                 echo "Perhaps can we force $cc -E using a wrapper..."
4741                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4742                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4743                 then
4744                         echo "Yup, we can."
4745                         cppstdin="$wrapper"
4746                         cppminus='';
4747                 else
4748                         echo "Nope, we'll have to live without it..."
4749                 fi
4750                 ;;
4751         esac
4752         case "$cpprun" in
4753         "$wrapper")
4754                 cpprun=''
4755                 cpplast=''
4756                 ;;
4757         esac
4758         ;;
4759 esac
4760
4761 case "$cppstdin" in
4762 "$wrapper"|'cppstdin') ;;
4763 *) $rm -f $wrapper;;
4764 esac
4765 $rm -f testcpp.c testcpp.out
4766
4767 : Set private lib path
4768 case "$plibpth" in
4769 '') if ./mips; then
4770                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4771         fi;;
4772 esac
4773 case "$libpth" in
4774 ' ') dlist='';;
4775 '') dlist="$loclibpth $plibpth $glibpth";;
4776 *) dlist="$libpth";;
4777 esac
4778
4779 : Now check and see which directories actually exist, avoiding duplicates
4780 libpth=''
4781 for xxx in $dlist
4782 do
4783     if $test -d $xxx; then
4784                 case " $libpth " in
4785                 *" $xxx "*) ;;
4786                 *) libpth="$libpth $xxx";;
4787                 esac
4788     fi
4789 done
4790 $cat <<'EOM'
4791
4792 Some systems have incompatible or broken versions of libraries.  Among
4793 the directories listed in the question below, please remove any you
4794 know not to be holding relevant libraries, and add any that are needed.
4795 Say "none" for none.
4796
4797 EOM
4798 case "$libpth" in
4799 '') dflt='none';;
4800 *)
4801         set X $libpth
4802         shift
4803         dflt=${1+"$@"}
4804         ;;
4805 esac
4806 rp="Directories to use for library searches?"
4807 . ./myread
4808 case "$ans" in
4809 none) libpth=' ';;
4810 *) libpth="$ans";;
4811 esac
4812
4813 : compute shared library extension
4814 case "$so" in
4815 '')
4816         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4817                 dflt='sl'
4818         else
4819                 dflt='so'
4820         fi
4821         ;;
4822 *) dflt="$so";;
4823 esac
4824 $cat <<EOM
4825
4826 On some systems, shared libraries may be available.  Answer 'none' if
4827 you want to suppress searching of shared libraries for the remainder
4828 of this configuration.
4829
4830 EOM
4831 rp='What is the file extension used for shared libraries?'
4832 . ./myread
4833 so="$ans"
4834
4835 : Define several unixisms.
4836 : Hints files or command line option can be used to override them.
4837 : The convoluted testing is in case hints files set either the old
4838 : or the new name.
4839 case "$_exe" in
4840 '')     case "$exe_ext" in
4841         '')     ;;
4842         *)      _exe="$exe_ext" ;;
4843         esac
4844         ;;
4845 esac
4846 case "$_a" in
4847 '')     case "$lib_ext" in
4848     '') _a='.a';;
4849         *)      _a="$lib_ext" ;;
4850         esac
4851         ;;
4852 esac
4853 case "$_o" in
4854 '') case "$obj_ext" in
4855         '')     _o='.o';;
4856         *)      _o="$obj_ext";;
4857         esac
4858         ;;
4859 esac
4860 case "$p_" in
4861 '') case "$path_sep" in
4862         '')     p_=':';;
4863         *)      p_="$path_sep";;
4864         esac
4865         ;;
4866 esac
4867 exe_ext=$_exe
4868 lib_ext=$_a
4869 obj_ext=$_o
4870 path_sep=$p_
4871
4872 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4873
4874 : Which makefile gets called first.  This is used by make depend.
4875 case "$firstmakefile" in
4876 '') firstmakefile='makefile';;
4877 esac
4878
4879 : Check for uselongdouble support
4880 case "$ccflags" in
4881 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4882 esac
4883
4884 case "$uselongdouble" in
4885 $define|true|[yY]*)     dflt='y';;
4886 *) dflt='n';;
4887 esac
4888 cat <<EOM
4889
4890 Perl can be built to take advantage of long doubles which
4891 (if available) may give more accuracy and range for floating point numbers.
4892
4893 If this doesn't make any sense to you, just accept the default '$dflt'.
4894 EOM
4895 rp='Try to use long doubles if available?'
4896 . ./myread
4897 case "$ans" in
4898 y|Y)    val="$define"   ;;
4899 *)      val="$undef"    ;;
4900 esac
4901 set uselongdouble
4902 eval $setvar
4903
4904 case "$uselongdouble" in
4905 true|[yY]*) uselongdouble="$define" ;;
4906 esac
4907
4908 : Look for a hint-file generated 'call-back-unit'.  If the
4909 : user has specified that long doubles should be used,
4910 : we may need to set or change some other defaults.
4911 if $test -f uselongdouble.cbu; then
4912     echo "Your platform has some specific hints regarding long doubles, using them..."
4913     . ./uselongdouble.cbu
4914 else
4915     case "$uselongdouble" in
4916         $define)
4917                 $cat <<EOM
4918 (Your platform does not have any specific hints for long doubles.)
4919 EOM
4920         ;;
4921     esac
4922 fi
4923
4924 : Looking for optional libraries
4925 echo " "
4926 echo "Checking for optional libraries..." >&4
4927 case "$libs" in
4928 ' '|'') dflt='';;
4929 *) dflt="$libs";;
4930 esac
4931 case "$libswanted" in
4932 '') libswanted='c_s';;
4933 esac
4934 case "$usesocks" in
4935 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4936 esac
4937 libsfound=''
4938 libsfiles=''
4939 libsdirs=''
4940 libspath=''
4941 for thisdir in $libpth $xlibpth; do
4942   test -d $thisdir && libspath="$libspath $thisdir"
4943 done
4944 for thislib in $libswanted; do
4945         for thisdir in $libspath; do
4946             xxx=''
4947             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4948                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4949                 $test -f "$xxx" && eval $libscheck
4950                 $test -f "$xxx" && libstyle=shared
4951             fi
4952             if test ! -f "$xxx"; then
4953                 xxx=$thisdir/lib$thislib.$so
4954                 $test -f "$xxx" && eval $libscheck
4955                 $test -f "$xxx" && libstyle=shared
4956             fi
4957             if test ! -f "$xxx"; then
4958                 xxx=$thisdir/lib$thislib$_a
4959                 $test -f "$xxx" && eval $libscheck
4960                 $test -f "$xxx" && libstyle=static
4961             fi
4962             if test ! -f "$xxx"; then
4963                 xxx=$thisdir/$thislib$_a
4964                 $test -f "$xxx" && eval $libscheck
4965                 $test -f "$xxx" && libstyle=static
4966             fi
4967             if test ! -f "$xxx"; then
4968                 xxx=$thisdir/lib${thislib}_s$_a
4969                 $test -f "$xxx" && eval $libscheck
4970                 $test -f "$xxx" && libstyle=static
4971                 $test -f "$xxx" && thislib=${thislib}_s
4972             fi
4973             if test ! -f "$xxx"; then
4974                 xxx=$thisdir/Slib$thislib$_a
4975                 $test -f "$xxx" && eval $libscheck
4976                 $test -f "$xxx" && libstyle=static
4977             fi
4978             if $test -f "$xxx"; then
4979                 case "$libstyle" in
4980                 shared) echo "Found -l$thislib (shared)." ;;
4981                 static) echo "Found -l$thislib." ;;
4982                 *)      echo "Found -l$thislib ($libstyle)." ;;
4983                 esac
4984                 case " $dflt " in
4985                 *"-l$thislib "*);;
4986                 *) dflt="$dflt -l$thislib"
4987                    libsfound="$libsfound $xxx"
4988                    yyy=`basename $xxx`
4989                    libsfiles="$libsfiles $yyy"
4990                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4991                    case " $libsdirs " in
4992                    *" $yyy "*) ;;
4993                    *) libsdirs="$libsdirs $yyy" ;;
4994                    esac
4995                    ;;
4996                 esac
4997                 break
4998             fi
4999         done
5000         if $test ! -f "$xxx"; then
5001             echo "No -l$thislib."
5002         fi
5003 done
5004 set X $dflt
5005 shift
5006 dflt="$*"
5007 case "$libs" in
5008 '') dflt="$dflt";;
5009 *) dflt="$libs";;
5010 esac
5011 case "$dflt" in
5012 ' '|'') dflt='none';;
5013 esac
5014
5015 $cat <<EOM
5016
5017 In order to compile $package on your machine, a number of libraries
5018 are usually needed.  Include any other special libraries here as well.
5019 Say "none" for none.  The default list is almost always right.
5020 EOM
5021
5022 echo " "
5023 rp="What libraries to use?"
5024 . ./myread
5025 case "$ans" in
5026 none) libs=' ';;
5027 *) libs="$ans";;
5028 esac
5029
5030 : determine optimization, if desired, or use for debug flag also
5031 case "$optimize" in
5032 ' '|$undef) dflt='none';;
5033 '') dflt='-O';;
5034 *) dflt="$optimize";;
5035 esac
5036 $cat <<EOH
5037
5038 By default, $package compiles with the -O flag to use the optimizer.
5039 Alternately, you might want to use the symbolic debugger, which uses
5040 the -g flag (on traditional Unix systems).  Either flag can be
5041 specified here.  To use neither flag, specify the word "none".
5042
5043 EOH
5044 rp="What optimizer/debugger flag should be used?"
5045 . ./myread
5046 optimize="$ans"
5047 case "$optimize" in
5048 'none') optimize=" ";;
5049 esac
5050
5051 : Check what DEBUGGING is required from the command line
5052 : -DEBUGGING      or -DDEBUGGING or
5053 : -DEBUGGING=both                       = -g + -DDEBUGGING
5054 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5055 : -DEBUGGING=none or -UDEBUGGING        =
5056 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5057 case "$EBUGGING" in
5058 '')     ;;
5059 *)      DEBUGGING=$EBUGGING ;;
5060 esac
5061
5062 case "$DEBUGGING" in
5063 -g|both|$define)
5064     case "$optimize" in
5065         *-g*) ;;
5066         *)    optimize="$optimize -g" ;;
5067     esac ;;
5068 none|$undef)
5069     case "$optimize" in
5070         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5071                 shift
5072                 optimize="$*"
5073                 ;;
5074     esac ;;
5075 esac
5076
5077 dflt=''
5078 case "$DEBUGGING" in
5079 both|$define) dflt='-DDEBUGGING'
5080 esac
5081
5082 : argument order is deliberate, as the flag will start with - which set could
5083 : think is an option
5084 checkccflag='check=$1; flag=$2; callback=$3;
5085 echo " ";
5086 echo "Checking if your compiler accepts $flag" 2>&1;
5087 echo "int main(void) { return 0; }" > gcctest.c;
5088 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5089     echo "Yes, it does." 2>&1;
5090     if $test -s gcctest.out ; then
5091         echo "But your platform does not like it:";
5092         cat gcctest.out;
5093     else
5094         case "$ccflags" in
5095         *$check*)
5096             echo "Leaving current flags $ccflags alone." 2>&1
5097             ;;
5098         *) dflt="$dflt $flag";
5099             eval $callback
5100             ;;
5101         esac
5102     fi
5103 else
5104     echo "Nope, it does not, but that is ok." 2>&1;
5105 fi
5106 '
5107
5108 : We will not override a previous value, but we might want to
5109 : augment a hint file
5110 case "$hint" in
5111 default|recommended)
5112         case "$gccversion" in
5113         1*) dflt="$dflt -fpcc-struct-return" ;;
5114         esac
5115         case "$optimize:$DEBUGGING" in
5116         *-g*:old) dflt="$dflt -DDEBUGGING";;
5117         esac
5118         case "$gccversion" in
5119         2*) if $test -d /etc/conf/kconfig.d &&
5120                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5121                 then
5122                         # Interactive Systems (ISC) POSIX mode.
5123                         dflt="$dflt -posix"
5124                 fi
5125                 ;;
5126         esac
5127         case "$gccversion" in
5128         1*) ;;
5129         2.[0-8]*) ;;
5130         ?*)     set strict-aliasing -fno-strict-aliasing
5131                 eval $checkccflag
5132                 ;;
5133         esac
5134         # For gcc, adding -pipe speeds up compilations for some, but apparently
5135         # some assemblers can't read from stdin.  (It also slows down compilations
5136         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5137         case "$gccversion" in
5138         ?*)     set pipe -pipe
5139                 eval $checkccflag
5140                 ;;
5141         esac
5142
5143         # on x86_64 (at least) we require an extra library (libssp) in the
5144         # link command line. This library is not named, so I infer that it is
5145         # an implementation detail that may change. Hence the safest approach
5146         # is to add the flag to the flags passed to the compiler at link time,
5147         # as that way the compiler can do the right implementation dependant
5148         # thing. (NWC)
5149         case "$gccversion" in
5150         ?*)     set stack-protector -fstack-protector
5151                 eval $checkccflag
5152                 ;;
5153         esac
5154         ;;
5155 esac
5156
5157 case "$mips_type" in
5158 *BSD*|'') inclwanted="$locincpth $usrinc";;
5159 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5160 esac
5161 for thisincl in $inclwanted; do
5162         if $test -d $thisincl; then
5163                 if $test x$thisincl != x$usrinc; then
5164                         case "$dflt" in
5165                         *" -I$thisincl "*);;
5166                         *) dflt="$dflt -I$thisincl ";;
5167                         esac
5168                 fi
5169         fi
5170 done
5171
5172 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5173         xxx=true;
5174 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5175         xxx=true;
5176 else
5177         xxx=false;
5178 fi;
5179 if $xxx; then
5180         case "$dflt" in
5181         *$2*);;
5182         *) dflt="$dflt -D$2";;
5183         esac;
5184 fi'
5185
5186 set signal.h LANGUAGE_C; eval $inctest
5187
5188 case "$usesocks" in
5189 $define)
5190         ccflags="$ccflags -DSOCKS"
5191         ;;
5192 esac
5193
5194 case "$hint" in
5195 default|recommended) dflt="$ccflags $dflt" ;;
5196 *) dflt="$ccflags";;
5197 esac
5198
5199 case "$dflt" in
5200 ''|' ') dflt=none;;
5201 esac
5202
5203 $cat <<EOH
5204
5205 Your C compiler may want other flags.  For this question you should include
5206 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5207 but you should NOT include libraries or ld flags like -lwhatever.  If you
5208 want $package to honor its debug switch, you should include -DDEBUGGING here.
5209 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5210
5211 To use no flags, specify the word "none".
5212
5213 EOH
5214 set X $dflt
5215 shift
5216 dflt=${1+"$@"}
5217 rp="Any additional cc flags?"
5218 . ./myread
5219 case "$ans" in
5220 none) ccflags='';;
5221 *) ccflags="$ans";;
5222 esac
5223
5224 : the following weeds options from ccflags that are of no interest to cpp
5225 case "$cppflags" in
5226 '') cppflags="$ccflags" ;;
5227 *)  cppflags="$cppflags $ccflags" ;;
5228 esac
5229 case "$gccversion" in
5230 1*) cppflags="$cppflags -D__GNUC__"
5231 esac
5232 case "$mips_type" in
5233 '');;
5234 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5235 esac
5236 case "$cppflags" in
5237 '');;
5238 *)
5239         echo " "
5240         echo "Let me guess what the preprocessor flags are..." >&4
5241         set X $cppflags
5242         shift
5243         cppflags=''
5244         $cat >cpp.c <<'EOM'
5245 #define BLURFL foo
5246
5247 BLURFL xx LFRULB
5248 EOM
5249         previous=''
5250         for flag in $*
5251         do
5252                 case "$flag" in
5253                 -*) ftry="$flag";;
5254                 *) ftry="$previous $flag";;
5255                 esac
5256                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5257                         >cpp1.out 2>/dev/null && \
5258                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5259                         >cpp2.out 2>/dev/null && \
5260                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5261                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5262                 then
5263                         cppflags="$cppflags $ftry"
5264                         previous=''
5265                 else
5266                         previous="$flag"
5267                 fi
5268         done
5269         set X $cppflags
5270         shift
5271         cppflags=${1+"$@"}
5272         case "$cppflags" in
5273         *-*)  echo "They appear to be: $cppflags";;
5274         esac
5275         $rm -f cpp.c cpp?.out
5276         ;;
5277 esac
5278
5279 : flags used in final linking phase
5280 case "$ldflags" in
5281 '') if ./venix; then
5282                 dflt='-i -z'
5283         else
5284                 dflt=''
5285         fi
5286         case "$ccflags" in
5287         *-posix*) dflt="$dflt -posix" ;;
5288         esac
5289         ;;
5290 *) dflt="$ldflags";;
5291 esac
5292 # See note above about -fstack-protector
5293 case "$ccflags" in
5294 *-fstack-protector*) 
5295         case "$dflt" in
5296         *-fstack-protector*) ;; # Don't add it again
5297         *) dflt="$dflt -fstack-protector" ;; 
5298         esac
5299         ;;
5300 esac
5301
5302 : Try to guess additional flags to pick up local libraries.
5303 for thislibdir in $libpth; do
5304         case " $loclibpth " in
5305         *" $thislibdir "*)
5306                 case "$dflt " in
5307                 *"-L$thislibdir "*) ;;
5308                 *)  dflt="$dflt -L$thislibdir" ;;
5309                 esac
5310                 ;;
5311         esac
5312 done
5313
5314 case "$dflt" in
5315 '') dflt='none' ;;
5316 esac
5317
5318 $cat <<EOH
5319
5320 Your C linker may need flags.  For this question you should
5321 include -L/whatever and any other flags used by the C linker, but you
5322 should NOT include libraries like -lwhatever.
5323
5324 Make sure you include the appropriate -L/path flags if your C linker
5325 does not normally search all of the directories you specified above,
5326 namely
5327         $libpth
5328 To use no flags, specify the word "none".
5329
5330 EOH
5331
5332 rp="Any additional ld flags (NOT including libraries)?"
5333 . ./myread
5334 case "$ans" in
5335 none) ldflags='';;
5336 *) ldflags="$ans";;
5337 esac
5338 rmlist="$rmlist pdp11"
5339
5340 : coherency check
5341 echo " "
5342 echo "Checking your choice of C compiler and flags for coherency..." >&4
5343 $cat > try.c <<'EOF'
5344 #include <stdio.h>
5345 int main() { printf("Ok\n"); return(0); }
5346 EOF
5347 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5348 shift
5349 $cat >try.msg <<'EOM'
5350 I've tried to compile and run the following simple program:
5351
5352 EOM
5353 $cat try.c >> try.msg
5354
5355 $cat >> try.msg <<EOM
5356
5357 I used the command:
5358
5359         $*
5360         $run ./try
5361
5362 and I got the following output:
5363
5364 EOM
5365 dflt=y
5366 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5367         if $sh -c "$run ./try " >>try.msg 2>&1; then
5368                 xxx=`$run ./try`
5369                 case "$xxx" in
5370                 "Ok") dflt=n ;;
5371                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5372                         case " $libs " in
5373                         *" -lsfio "*)
5374                                 cat >> try.msg <<'EOQS'
5375 If $libs contains -lsfio, and sfio is mis-configured, then it
5376 sometimes (apparently) runs and exits with a 0 status, but with no
5377 output!  It may have to do with sfio's use of _exit vs. exit.
5378
5379 EOQS
5380                                 rp="You have a big problem.  Shall I abort Configure"
5381                                 dflt=y
5382                                 ;;
5383                         esac
5384                         ;;
5385                 esac
5386         else
5387                 echo "The program compiled OK, but exited with status $?." >>try.msg
5388                 rp="You have a problem.  Shall I abort Configure"
5389                 dflt=y
5390         fi
5391 else
5392         echo "I can't compile the test program." >>try.msg
5393         rp="You have a BIG problem.  Shall I abort Configure"
5394         dflt=y
5395 fi
5396 case "$dflt" in
5397 y)
5398         $cat try.msg >&4
5399         case "$knowitall" in
5400         '')
5401                 echo "(The supplied flags or libraries might be incorrect.)"
5402                 ;;
5403         *) dflt=n;;
5404         esac
5405         echo " "
5406         . ./myread
5407         case "$ans" in
5408         n*|N*) ;;
5409         *)      echo "Ok.  Stopping Configure." >&4
5410                 exit 1
5411                 ;;
5412         esac
5413         ;;
5414 n) echo "OK, that should do.";;
5415 esac
5416 $rm_try gcctest gcctest.out
5417
5418 : define a shorthand compile call
5419 compile='
5420 mc_file=$1;
5421 shift;
5422 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5423 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5424 exit 1;
5425 fi;
5426 esac;
5427 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5428 : define a shorthand compile call for compilations that should be ok.
5429 compile_ok='
5430 mc_file=$1;
5431 shift;
5432 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5433
5434 : determine filename position in cpp output
5435 echo " "
5436 echo "Computing filename position in cpp output for #include directives..." >&4
5437 case "$osname" in
5438 vos) testaccess=-e ;;
5439 *)   testaccess=-r ;;
5440 esac
5441 echo '#include <stdio.h>' > foo.c
5442 $cat >fieldn <<EOF
5443 $startsh
5444 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5445 $grep '^[       ]*#.*stdio\.h' | \
5446 while read cline; do
5447         pos=1
5448         set \$cline
5449         while $test \$# -gt 0; do
5450                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5451                         echo "\$pos"
5452                         exit 0
5453                 fi
5454                 shift
5455                 pos=\`expr \$pos + 1\`
5456         done
5457 done
5458 EOF
5459 chmod +x fieldn
5460 fieldn=`./fieldn`
5461 $rm -f foo.c fieldn
5462 case $fieldn in
5463 '') pos='???';;
5464 1) pos=first;;
5465 2) pos=second;;
5466 3) pos=third;;
5467 *) pos="${fieldn}th";;
5468 esac
5469 echo "Your cpp writes the filename in the $pos field of the line."
5470
5471 case "$osname" in
5472 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5473 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5474 *)   cppfilter='' ;;
5475 esac
5476 : locate header file
5477 $cat >findhdr <<EOF
5478 $startsh
5479 wanted=\$1
5480 name=''
5481 for usrincdir in $usrinc
5482 do
5483         if test -f \$usrincdir/\$wanted; then
5484                 echo "\$usrincdir/\$wanted"
5485                 exit 0
5486         fi
5487 done
5488 awkprg='{ print \$$fieldn }'
5489 echo "#include <\$wanted>" > foo\$\$.c
5490 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5491 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5492 while read cline; do
5493         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5494         case "\$name" in
5495         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5496         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5497         *) exit 2;;
5498         esac;
5499 done;
5500 #
5501 # status = 0: grep returned 0 lines, case statement not executed
5502 # status = 1: headerfile found
5503 # status = 2: while loop executed, no headerfile found
5504 #
5505 status=\$?
5506 $rm -f foo\$\$.c;
5507 if test \$status -eq 1; then
5508         exit 0;
5509 fi
5510 exit 1
5511 EOF
5512 chmod +x findhdr
5513
5514 : define an alternate in-header-list? function
5515 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5516 cont=true; xxf="echo \"<\$1> found.\" >&4";
5517 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5518 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5519 esac;
5520 case $# in 4) instead=instead;; *) instead="at last";; esac;
5521 while $test "$cont"; do
5522         xxx=`./findhdr $1`
5523         var=$2; eval "was=\$$2";
5524         if $test "$xxx" && $test -r "$xxx";
5525         then eval $xxf;
5526         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5527                 cont="";
5528         else eval $xxnf;
5529         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5530         set $yyy; shift; shift; yyy=$@;
5531         case $# in 0) cont="";;
5532         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5533                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5534         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5535                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5536         esac;
5537 done;
5538 while $test "$yyy";
5539 do set $yyy; var=$2; eval "was=\$$2";
5540         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5541         set $yyy; shift; shift; yyy=$@;
5542 done'
5543
5544 : see if stdlib is available
5545 set stdlib.h i_stdlib
5546 eval $inhdr
5547
5548 : check for lengths of integral types
5549 echo " "
5550 case "$intsize" in
5551 '')
5552         echo "Checking to see how big your integers are..." >&4
5553         $cat >try.c <<EOCP
5554 #include <stdio.h>
5555 #$i_stdlib I_STDLIB
5556 #ifdef I_STDLIB
5557 #include <stdlib.h>
5558 #endif
5559 int main()
5560 {
5561         printf("intsize=%d;\n", (int)sizeof(int));
5562         printf("longsize=%d;\n", (int)sizeof(long));
5563         printf("shortsize=%d;\n", (int)sizeof(short));
5564         exit(0);
5565 }
5566 EOCP
5567         set try
5568         if eval $compile_ok && $run ./try > /dev/null; then
5569                 eval `$run ./try`
5570                 echo "Your integers are $intsize bytes long."
5571                 echo "Your long integers are $longsize bytes long."
5572                 echo "Your short integers are $shortsize bytes long."
5573         else
5574                 $cat >&4 <<EOM
5575 !
5576 Help! I can't compile and run the intsize test program: please enlighten me!
5577 (This is probably a misconfiguration in your system or libraries, and
5578 you really ought to fix it.  Still, I'll try anyway.)
5579 !
5580 EOM
5581                 dflt=4
5582                 rp="What is the size of an integer (in bytes)?"
5583                 . ./myread
5584                 intsize="$ans"
5585                 dflt=$intsize
5586                 rp="What is the size of a long integer (in bytes)?"
5587                 . ./myread
5588                 longsize="$ans"
5589                 dflt=2
5590                 rp="What is the size of a short integer (in bytes)?"
5591                 . ./myread
5592                 shortsize="$ans"
5593         fi
5594         ;;
5595 esac
5596 $rm_try
5597
5598 : check for long long
5599 echo " "
5600 echo "Checking to see if you have long long..." >&4
5601 echo 'int main() { long long x = 7; return 0; }' > try.c
5602 set try
5603 if eval $compile; then
5604         val="$define"
5605         echo "You have long long."
5606 else
5607         val="$undef"
5608         echo "You do not have long long."
5609 fi
5610 $rm_try
5611 set d_longlong
5612 eval $setvar
5613
5614 : check for length of long long
5615 case "${d_longlong}${longlongsize}" in
5616 $define)
5617         echo " "
5618         echo "Checking to see how big your long longs are..." >&4
5619         $cat >try.c <<'EOCP'
5620 #include <stdio.h>
5621 int main()
5622 {
5623     printf("%d\n", (int)sizeof(long long));
5624     return(0);
5625 }
5626 EOCP
5627         set try
5628         if eval $compile_ok; then
5629                 longlongsize=`$run ./try`
5630                 echo "Your long longs are $longlongsize bytes long."
5631         else
5632                 dflt='8'
5633                 echo " "
5634                 echo "(I can't seem to compile the test program.  Guessing...)"
5635                 rp="What is the size of a long long (in bytes)?"
5636                 . ./myread
5637                 longlongsize="$ans"
5638         fi
5639         if $test "X$longsize" = "X$longlongsize"; then
5640                 echo "(That isn't any different from an ordinary long.)"
5641         fi
5642         ;;
5643 esac
5644 $rm_try
5645
5646 : see if inttypes.h is available
5647 : we want a real compile instead of Inhdr because some systems
5648 : have an inttypes.h which includes non-existent headers
5649 echo " "
5650 $cat >try.c <<EOCP
5651 #include <inttypes.h>
5652 int main() {
5653         static int32_t foo32 = 0x12345678;
5654 }
5655 EOCP
5656 set try
5657 if eval $compile; then
5658         echo "<inttypes.h> found." >&4
5659         val="$define"
5660 else
5661         echo "<inttypes.h> NOT found." >&4
5662         val="$undef"
5663 fi
5664 $rm_try
5665 set i_inttypes
5666 eval $setvar
5667
5668 : check for int64_t
5669 echo " "
5670 echo "Checking to see if you have int64_t..." >&4
5671 $cat >try.c <<EOCP
5672 #include <sys/types.h>
5673 #$i_inttypes I_INTTYPES
5674 #ifdef I_INTTYPES
5675 #include <inttypes.h>
5676 #endif
5677 int main() { int64_t x = 7; }
5678 EOCP
5679 set try
5680 if eval $compile; then
5681         val="$define"
5682         echo "You have int64_t."
5683 else
5684         val="$undef"
5685         echo "You do not have int64_t."
5686 fi
5687 $rm_try
5688 set d_int64_t
5689 eval $setvar
5690
5691 : Check if 64bit ints have a quad type
5692 echo " "
5693 echo "Checking which 64-bit integer type we could use..." >&4
5694
5695 case "$intsize" in
5696 8) val=int
5697    set quadtype
5698    eval $setvar
5699    val='"unsigned int"'
5700    set uquadtype
5701    eval $setvar
5702    quadkind=1
5703    ;;
5704 *) case "$longsize" in
5705    8) val=long
5706       set quadtype
5707       eval $setvar
5708       val='"unsigned long"'
5709       set uquadtype
5710       eval $setvar
5711       quadkind=2
5712       ;;
5713    *) case "$d_longlong:$longlongsize" in
5714       define:8)
5715         val='"long long"'
5716         set quadtype
5717         eval $setvar
5718         val='"unsigned long long"'
5719         set uquadtype
5720         eval $setvar
5721         quadkind=3
5722         ;;
5723       *) case "$d_int64_t" in
5724          define)
5725            val=int64_t
5726            set quadtype
5727            eval $setvar
5728            val=uint64_t
5729            set uquadtype
5730            eval $setvar
5731            quadkind=4
5732            ;;
5733          esac
5734          ;;
5735       esac
5736       ;;
5737    esac
5738    ;;
5739 esac
5740
5741 case "$quadtype" in
5742 '')     echo "Alas, no 64-bit integer types in sight." >&4
5743         d_quad="$undef"
5744         ;;
5745 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5746         d_quad="$define"
5747         ;;
5748 esac
5749
5750 : Do we want 64bit support
5751 case "$uselonglong" in
5752 "$define"|true|[yY]*)
5753         cat <<EOM >&4
5754
5755 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5756 EOM
5757         use64bitint="$define"
5758         ;;
5759 esac
5760 case "$use64bits" in
5761 "$define"|true|[yY]*)
5762         cat <<EOM >&4
5763
5764 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5765 EOM
5766         use64bitint="$define"
5767         ;;
5768 esac
5769 case "$use64bitints" in
5770 "$define"|true|[yY]*)
5771         cat <<EOM >&4
5772
5773 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5774 EOM
5775         use64bitint="$define"
5776         ;;
5777 esac
5778 case "$use64bitsint" in
5779 "$define"|true|[yY]*)
5780         cat <<EOM >&4
5781
5782 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5783 EOM
5784         use64bitint="$define"
5785         ;;
5786 esac
5787 case "$uselonglongs" in
5788 "$define"|true|[yY]*)
5789         cat <<EOM >&4
5790
5791 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5792 EOM
5793         use64bitint="$define"
5794         ;;
5795 esac
5796 case "$use64bitsall" in
5797 "$define"|true|[yY]*)
5798         cat <<EOM >&4
5799
5800 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5801 EOM
5802         use64bitall="$define"
5803         ;;
5804 esac
5805
5806 case "$ccflags" in
5807 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5808 esac
5809 case "$use64bitall" in
5810 "$define"|true|[yY]*) use64bitint="$define" ;;
5811 esac
5812
5813 case "$longsize" in
5814 8) cat <<EOM
5815
5816 You have natively 64-bit long integers.
5817 EOM
5818    val="$define"
5819    ;;
5820 *) case "$use64bitint" in
5821    "$define"|true|[yY]*) dflt='y';;
5822    *) dflt='n';;
5823    esac
5824    case "$d_quad" in
5825    "$define") ;;
5826    *) dflt='n' ;;
5827    esac
5828    cat <<EOM
5829
5830 Perl can be built to take advantage of 64-bit integer types
5831 on some systems.  To do so, Configure can be run with -Duse64bitint.
5832 Choosing this option will most probably introduce binary incompatibilities.
5833
5834 If this doesn't make any sense to you, just accept the default '$dflt'.
5835 (The default has been chosen based on your configuration.)
5836 EOM
5837    rp='Try to use 64-bit integers, if available?'
5838    . ./myread
5839    case "$ans" in
5840    [yY]*) val="$define" ;;
5841    *)     val="$undef"  ;;
5842    esac
5843    ;;
5844 esac
5845 set use64bitint
5846 eval $setvar
5847
5848 case "$use64bitall" in
5849 "$define"|true|[yY]*) dflt='y' ;;
5850 *) case "$longsize" in
5851    8) dflt='y' ;;
5852    *) dflt='n' ;;
5853    esac
5854    ;;
5855 esac
5856 cat <<EOM
5857
5858 You may also choose to try maximal 64-bitness.  It means using as much
5859 64-bitness as possible on the platform.  This in turn means even more
5860 binary incompatibilities.  On the other hand, your platform may not
5861 have any more 64-bitness available than what you already have chosen.
5862
5863 If this doesn't make any sense to you, just accept the default '$dflt'.
5864 (The default has been chosen based on your configuration.)
5865 EOM
5866 rp='Try to use maximal 64-bit support, if available?'
5867 . ./myread
5868 case "$ans" in
5869 [yY]*) val="$define" ;;
5870 *)     val="$undef"  ;;
5871 esac
5872 set use64bitall
5873 eval $setvar
5874 case "$use64bitall" in
5875 "$define")
5876         case "$use64bitint" in
5877         "$undef")
5878                 cat <<EOM
5879
5880 Since you have chosen a maximally 64-bit build, I'm also turning on
5881 the use of 64-bit integers.
5882 EOM
5883                 use64bitint="$define" ;;
5884         esac
5885         ;;
5886 esac
5887
5888 : Look for a hint-file generated 'call-back-unit'.  If the
5889 : user has specified that a 64-bit perl is to be built,
5890 : we may need to set or change some other defaults.
5891 if $test -f use64bitint.cbu; then
5892         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5893         . ./use64bitint.cbu
5894 fi
5895 case "$use64bitint" in
5896 "$define"|true|[yY]*)
5897         case "$longsize" in
5898         4) case "$archname64" in
5899            '') archname64=64int ;;
5900            esac
5901            ;;
5902         esac
5903         ;;
5904 esac
5905
5906 : Look for a hint-file generated 'call-back-unit'.  If the
5907 : user has specified that a maximally 64-bit perl is to be built,
5908 : we may need to set or change some other defaults.
5909 if $test -f use64bitall.cbu; then
5910         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5911         . ./use64bitall.cbu
5912 fi
5913 case "$use64bitall" in
5914 "$define"|true|[yY]*)
5915         case "$longsize" in
5916         4) case "$archname64" in
5917            ''|64int) archname64=64all ;;
5918            esac
5919            ;;
5920         esac
5921         ;;
5922 esac
5923
5924 case "$d_quad:$use64bitint" in
5925 $undef:$define)
5926         cat >&4 <<EOF
5927
5928 *** You have chosen to use 64-bit integers,
5929 *** but none can be found.
5930 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5931 *** Cannot continue, aborting.
5932
5933 EOF
5934         exit 1
5935         ;;
5936 esac
5937
5938 : check for length of double
5939 echo " "
5940 case "$doublesize" in
5941 '')
5942         echo "Checking to see how big your double precision numbers are..." >&4
5943         $cat >try.c <<EOCP
5944 #include <stdio.h>
5945 #$i_stdlib I_STDLIB
5946 #ifdef I_STDLIB
5947 #include <stdlib.h>
5948 #endif
5949 int main()
5950 {
5951     printf("%d\n", (int)sizeof(double));
5952     exit(0);
5953 }
5954 EOCP
5955         set try
5956         if eval $compile_ok; then
5957                 doublesize=`$run ./try`
5958                 echo "Your double is $doublesize bytes long."
5959         else
5960                 dflt='8'
5961                 echo "(I can't seem to compile the test program.  Guessing...)"
5962                 rp="What is the size of a double precision number (in bytes)?"
5963                 . ./myread
5964                 doublesize="$ans"
5965         fi
5966         ;;
5967 esac
5968 $rm_try
5969
5970 : check for long doubles
5971 echo " "
5972 echo "Checking to see if you have long double..." >&4
5973 echo 'int main() { long double x = 7.0; }' > try.c
5974 set try
5975 if eval $compile; then
5976         val="$define"
5977         echo "You have long double."
5978 else
5979         val="$undef"
5980         echo "You do not have long double."
5981 fi
5982 $rm_try
5983 set d_longdbl
5984 eval $setvar
5985
5986 : check for length of long double
5987 case "${d_longdbl}${longdblsize}" in
5988 $define)
5989         echo " "
5990         echo "Checking to see how big your long doubles are..." >&4
5991         $cat >try.c <<'EOCP'
5992 #include <stdio.h>
5993 int main()
5994 {
5995         printf("%d\n", sizeof(long double));
5996 }
5997 EOCP
5998         set try
5999         set try
6000         if eval $compile; then
6001                 longdblsize=`$run ./try`
6002                 echo "Your long doubles are $longdblsize bytes long."
6003         else
6004                 dflt='8'
6005                 echo " "
6006                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6007                 rp="What is the size of a long double (in bytes)?"
6008                 . ./myread
6009                 longdblsize="$ans"
6010         fi
6011         if $test "X$doublesize" = "X$longdblsize"; then
6012                 echo "That isn't any different from an ordinary double."
6013                 echo "I'll keep your setting anyway, but you may see some"
6014                 echo "harmless compilation warnings."
6015         fi
6016         ;;
6017 esac
6018 $rm_try
6019
6020 : determine the architecture name
6021 echo " "
6022 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6023         tarch=`arch`"-$osname"
6024 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6025         if uname -m > tmparch 2>&1 ; then
6026                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6027                         -e 's/$/'"-$osname/" tmparch`
6028         else
6029                 tarch="$osname"
6030         fi
6031         $rm -f tmparch
6032 else
6033         tarch="$osname"
6034 fi
6035 case "$myarchname" in
6036 ''|"$tarch") ;;
6037 *)
6038         echo "(Your architecture name used to be $myarchname.)"
6039         archname=''
6040         ;;
6041 esac
6042 case "$targetarch" in
6043 '') ;;
6044 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6045 esac
6046 myarchname="$tarch"
6047 case "$archname" in
6048 '') dflt="$tarch";;
6049 *) dflt="$archname";;
6050 esac
6051 rp='What is your architecture name'
6052 . ./myread
6053 archname="$ans"
6054 case "$usethreads" in
6055 $define)
6056         echo "Threads selected." >&4
6057         case "$archname" in
6058         *-thread*) echo "...and architecture name already has -thread." >&4
6059                 ;;
6060         *)      archname="$archname-thread"
6061                 echo "...setting architecture name to $archname." >&4
6062                 ;;
6063         esac
6064         ;;
6065 esac
6066 case "$usemultiplicity" in
6067 $define)
6068         echo "Multiplicity selected." >&4
6069         case "$archname" in
6070         *-multi*) echo "...and architecture name already has -multi." >&4
6071                 ;;
6072         *)      archname="$archname-multi"
6073                 echo "...setting architecture name to $archname." >&4
6074                 ;;
6075         esac
6076         ;;
6077 esac
6078 case "$use64bitint$use64bitall" in
6079 *"$define"*)
6080         case "$archname64" in
6081         '')
6082                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6083                 ;;
6084         *)
6085                 case "$use64bitint" in
6086                 "$define") echo "64 bit integers selected." >&4 ;;
6087                 esac
6088                 case "$use64bitall" in
6089                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6090                 esac
6091                 case "$archname" in
6092                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6093                         ;;
6094                 *)      archname="$archname-$archname64"
6095                         echo "...setting architecture name to $archname." >&4
6096                         ;;
6097                 esac
6098                 ;;
6099         esac
6100 esac
6101 case "$uselongdouble" in
6102 $define)
6103         echo "Long doubles selected." >&4
6104         case "$longdblsize" in
6105         $doublesize)
6106                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6107                 ;;
6108         *)
6109                 case "$archname" in
6110                 *-ld*) echo "...and architecture name already has -ld." >&4
6111                         ;;
6112                 *)      archname="$archname-ld"
6113                         echo "...setting architecture name to $archname." >&4
6114                         ;;
6115                 esac
6116                 ;;
6117         esac
6118         ;;
6119 esac
6120 case "$useperlio" in
6121 $define)
6122         echo "Perlio selected." >&4
6123         ;;
6124 *)
6125         echo "Perlio not selected, using stdio." >&4
6126         case "$archname" in
6127         *-stdio*) echo "...and architecture name already has -stdio." >&4
6128                 ;;
6129         *)      archname="$archname-stdio"
6130                 echo "...setting architecture name to $archname." >&4
6131                 ;;
6132         esac
6133         ;;
6134 esac
6135 if $test -f archname.cbu; then
6136         echo "Your platform has some specific hints for architecture name, using them..."
6137         . ./archname.cbu
6138 fi
6139
6140 : set the prefixit variable, to compute a suitable default value
6141 prefixit='case "$3" in
6142 ""|none)
6143         case "$oldprefix" in
6144         "") eval "$1=\"\$$2\"";;
6145         *)
6146                 case "$3" in
6147                 "") eval "$1=";;
6148                 none)
6149                         eval "tp=\"\$$2\"";
6150                         case "$tp" in
6151                         ""|" ") eval "$1=\"\$$2\"";;
6152                         *) eval "$1=";;
6153                         esac;;
6154                 esac;;
6155         esac;;
6156 *)
6157         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6158         case "$tp" in
6159         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6160         /*-$oldprefix/*|\~*-$oldprefix/*)
6161                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6162         *) eval "$1=\"\$$2\"";;
6163         esac;;
6164 esac'
6165
6166 : determine installation style
6167 : For now, try to deduce it from prefix unless it is already set.
6168 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6169 case "$installstyle" in
6170 '')     case "$prefix" in
6171                 *perl*) dflt='lib';;
6172                 *) dflt='lib/perl5' ;;
6173         esac
6174         ;;
6175 *)      dflt="$installstyle" ;;
6176 esac
6177 : Probably not worth prompting for this since we prompt for all
6178 : the directories individually, and the prompt would be too long and
6179 : confusing anyway.
6180 installstyle=$dflt
6181
6182 : determine where public executables go
6183 echo " "
6184 set dflt bin bin
6185 eval $prefixit
6186 fn=d~
6187 rp='Pathname where the public executables will reside?'
6188 . ./getfile
6189 if $test "X$ansexp" != "X$binexp"; then
6190         installbin=''
6191 fi
6192 prefixvar=bin
6193 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6194 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6195 :     this via initialinstalllocation
6196 . ./setprefixvar
6197
6198 case "$userelocatableinc" in
6199 $define|true|[yY]*)     dflt='y' ;;
6200 *)                      dflt='n' ;;
6201 esac
6202 cat <<EOM
6203
6204 Would you like to build Perl so that the installation is relocatable, so that
6205 library paths in @INC are determined relative to the path of the perl binary?
6206 This is not advised for system Perl installs, or if you need to run setid
6207 scripts or scripts under taint mode.
6208
6209 If this doesn't make any sense to you, just accept the default '$dflt'.
6210 EOM
6211 rp='Use relocatable @INC?'
6212 . ./myread
6213 case "$ans" in
6214 y|Y)    val="$define" ;;
6215 *)      val="$undef"  ;;
6216 esac
6217 set userelocatableinc
6218 eval $setvar
6219
6220 initialinstalllocation="$binexp"
6221 : Default prefix is now "up one level from where the binaries are"
6222 case "$userelocatableinc" in
6223 $define|true|[yY]*)
6224     bin=".../"
6225     binexp=".../"
6226     prefix=".../.."
6227     prefixexp=".../.."
6228     installprefixexp=".../.."
6229     ;;
6230 esac
6231
6232 : determine where private library files go
6233 : Usual default is /usr/local/lib/perl5/$version.
6234 : Also allow things like /opt/perl/lib/$version, since
6235 : /opt/perl/lib/perl5... would be redundant.
6236 : The default "style" setting is made in installstyle.U
6237 case "$installstyle" in
6238 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6239 *)       set dflt privlib lib/$version ;;
6240 esac
6241 eval $prefixit
6242 $cat <<EOM
6243
6244 There are some auxiliary files for $package that need to be put into a
6245 private library directory that is accessible by everyone.
6246
6247 EOM
6248 fn=$binexp
6249 fn=d~+
6250 rp='Pathname where the private library files will reside?'
6251 . ./getfile
6252 prefixvar=privlib
6253 . ./setprefixvar
6254
6255 : set the prefixup variable, to restore leading tilda escape
6256 prefixup='case "$prefixexp" in
6257 "$prefix") ;;
6258 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6259 esac'
6260
6261 : determine where public architecture dependent libraries go
6262 set archlib archlib
6263 eval $prefixit
6264 : privlib default is /usr/local/lib/$package/$version
6265 : archlib default is /usr/local/lib/$package/$version/$archname
6266 : privlib may have an optional trailing /share.
6267 tdflt=`echo $privlib | $sed 's,/share$,,'`
6268 tdflt=$tdflt/$archname
6269 case "$archlib" in
6270 '')     dflt=$tdflt
6271         ;;
6272 *)      dflt="$archlib"
6273     ;;
6274 esac
6275 $cat <<EOM
6276
6277 $spackage contains architecture-dependent library files.  If you are
6278 sharing libraries in a heterogeneous environment, you might store
6279 these files in a separate location.  Otherwise, you can just include
6280 them with the rest of the public library files.
6281
6282 EOM
6283 fn=$binexp
6284 fn=d+~
6285 rp='Where do you want to put the public architecture-dependent libraries?'
6286 . ./getfile
6287 prefixvar=archlib
6288 . ./setprefixvar
6289 if $test X"$archlib" = X"$privlib"; then
6290         d_archlib="$undef"
6291 else
6292         d_archlib="$define"
6293 fi
6294
6295 : see if setuid scripts can be secure
6296 $cat <<EOM
6297
6298 Some kernels have a bug that prevents setuid #! scripts from being
6299 secure.  Some sites have disabled setuid #! scripts because of this.
6300
6301 First let's decide if your kernel supports secure setuid #! scripts.
6302 (If setuid #! scripts would be secure but have been disabled anyway,
6303 don't say that they are secure if asked.)
6304
6305 EOM
6306
6307 val="$undef"
6308 if $test -d /dev/fd; then
6309         echo "#!$ls" >reflect
6310         chmod +x,u+s reflect
6311         ./reflect >flect 2>&1
6312         if $contains "/dev/fd" flect >/dev/null; then
6313                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6314                 val="$define"
6315         else
6316                 $cat <<EOM
6317 If you are not sure if they are secure, I can check but I'll need a
6318 username and password different from the one you are using right now.
6319 If you don't have such a username or don't want me to test, simply
6320 enter 'none'.
6321
6322 EOM
6323                 rp='Other username to test security of setuid scripts with?'
6324                 dflt='none'
6325                 . ./myread
6326                 case "$ans" in
6327                 n|none)
6328                         case "$d_suidsafe" in
6329                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6330                                 dflt=n;;
6331                         "$undef")
6332                                 echo "Well, the $hint value is *not* secure." >&4
6333                                 dflt=n;;
6334                         *)      echo "Well, the $hint value *is* secure." >&4
6335                                 dflt=y;;
6336                         esac
6337                         ;;
6338                 *)
6339                         $rm -f reflect flect
6340                         echo "#!$ls" >reflect
6341                         chmod +x,u+s reflect
6342                         echo >flect
6343                         chmod a+w flect
6344                         echo '"su" will (probably) prompt you for '"$ans's password."
6345                         su $ans -c './reflect >flect'
6346                         if $contains "/dev/fd" flect >/dev/null; then
6347                                 echo "Okay, it looks like setuid scripts are secure." >&4
6348                                 dflt=y
6349                         else
6350                                 echo "I don't think setuid scripts are secure." >&4
6351                                 dflt=n
6352                         fi
6353                         ;;
6354                 esac
6355                 rp='Does your kernel have *secure* setuid scripts?'
6356                 . ./myread
6357                 case "$ans" in
6358                 [yY]*)  val="$define";;
6359                 *)      val="$undef";;
6360                 esac
6361         fi
6362 else
6363         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6364         echo "(That's for file descriptors, not floppy disks.)"
6365         val="$undef"
6366 fi
6367 set d_suidsafe
6368 eval $setvar
6369
6370 $rm -f reflect flect
6371
6372 : now see if they want to do setuid emulation
6373 if $test $patchlevel -lt 11; then
6374 echo " "
6375 val="$undef"
6376 case "$d_suidsafe" in
6377 "$define")
6378         val="$undef"
6379         echo "No need to emulate SUID scripts since they are secure here." >&4
6380         ;;
6381 *)
6382         $cat <<EOM
6383 Some systems have disabled setuid scripts, especially systems where
6384 setuid scripts cannot be secure.  On systems where setuid scripts have
6385 been disabled, the setuid/setgid bits on scripts are currently
6386 useless.  It is possible for $package to detect those bits and emulate
6387 setuid/setgid in a secure fashion.  This emulation will only work if
6388 setuid scripts have been disabled in your kernel.
6389
6390 EOM
6391         case "$d_dosuid" in
6392         "$define") dflt=y ;;
6393         *) dflt=n ;;
6394         esac
6395         rp="Do you want to do setuid/setgid emulation?"
6396         . ./myread
6397         case "$ans" in
6398         [yY]*)  val="$define";;
6399         *)      val="$undef";;
6400         esac
6401         ;;
6402 esac
6403 set d_dosuid
6404 eval $setvar
6405 else
6406     case "$d_dosuid" in
6407         "$define")
6408         cat >&4 <<EOH
6409
6410 SUID emulation has been removed for 5.12
6411 Please re-run Configure without -Dd_dosuid
6412
6413 EOH
6414         exit 1;
6415         ;;
6416     esac
6417     d_dosuid=undef
6418 fi
6419
6420 : Find perl5.005 or later.
6421 echo "Looking for a previously installed perl5.005 or later... "
6422 case "$perl5" in
6423 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6424                 : Check if this perl is recent and can load a simple module
6425                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6426                         perl5=$tdir/perl
6427                         break;
6428                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6429                         perl5=$tdir/perl5
6430                         break;
6431                 fi
6432         done
6433         ;;
6434 *)      perl5="$perl5"
6435         ;;
6436 esac
6437 case "$perl5" in
6438 '')     echo "None found.  That's ok.";;
6439 *)      echo "Using $perl5." ;;
6440 esac
6441
6442 : Set the siteprefix variables
6443 $cat <<EOM
6444
6445 After $package is installed, you may wish to install various
6446 add-on modules and utilities.  Typically, these add-ons will
6447 be installed under $prefix with the rest
6448 of this package.  However, you may wish to install such add-ons
6449 elsewhere under a different prefix.
6450
6451 If you do not wish to put everything under a single prefix, that's
6452 ok.  You will be prompted for the individual locations; this siteprefix
6453 is only used to suggest the defaults.
6454
6455 The default should be fine for most people.
6456
6457 EOM
6458 fn=d~+
6459 rp='Installation prefix to use for add-on modules and utilities?'
6460 : XXX Here might be another good place for an installstyle setting.
6461 case "$siteprefix" in
6462 '') dflt=$prefix ;;
6463 *)  dflt=$siteprefix ;;
6464 esac
6465 . ./getfile
6466 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6467 oldsiteprefix=''
6468 case "$siteprefix" in
6469 '') ;;
6470 *)      case "$ans" in
6471         "$prefix") ;;
6472         *) oldsiteprefix="$prefix";;
6473         esac
6474         ;;
6475 esac
6476 siteprefix="$ans"
6477 siteprefixexp="$ansexp"
6478
6479 : determine where site specific libraries go.
6480 : Usual default is /usr/local/lib/perl5/site_perl/$version
6481 : The default "style" setting is made in installstyle.U
6482 : XXX No longer works with Prefixit stuff.
6483 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6484 case "$sitelib" in
6485 '') case "$installstyle" in
6486         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6487         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6488         esac
6489         ;;
6490 *)      dflt="$sitelib"
6491         ;;
6492 esac
6493 $cat <<EOM
6494
6495 The installation process will create a directory for
6496 site-specific extensions and modules.  Most users find it convenient
6497 to place all site-specific files in this directory rather than in the
6498 main distribution directory.
6499
6500 EOM
6501 fn=d~+
6502 rp='Pathname for the site-specific library files?'
6503 . ./getfile
6504 prefixvar=sitelib
6505 . ./setprefixvar
6506 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6507
6508 : Determine list of previous versions to include in @INC
6509 $cat > getverlist <<EOPL
6510 #!$perl5 -w
6511 use File::Basename;
6512 \$api_versionstring = "$api_versionstring";
6513 \$version = "$version";
6514 \$stem = "$sitelib_stem";
6515 \$archname = "$archname";
6516 EOPL
6517         $cat >> getverlist <<'EOPL'
6518 # The list found is store twice for each entry: the original name, and
6519 # the binary broken down version as pack "sss", so sorting is easy and
6520 # unambiguous. This will work for all versions that have a maximum of
6521 # three digit groups, separate by '.'s or '_'s. Names are extended with
6522 # ".0.0" to ensure at least three elements for the pack.
6523 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6524
6525 # Can't have leading @ because metaconfig interprets it as a command!
6526 ;@inc_version_list=();
6527 # XXX Redo to do opendir/readdir?
6528 if (-d $stem) {
6529     chdir($stem);
6530     ;@candidates = map {
6531         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6532 }
6533 else {
6534     ;@candidates = ();
6535 }
6536
6537 ($pversion, $aversion, $vsn5005) = map {
6538     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6539 foreach $d (@candidates) {
6540     if ($d->[1] lt $pversion) {
6541         if ($d->[1] ge $aversion) {
6542             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6543         }
6544         elsif ($d->[1] ge $vsn5005) {
6545             unshift(@inc_version_list, grep { -d } $d->[0]);
6546         }
6547     }
6548     else {
6549         # Skip newer version.  I.e. don't look in
6550         # 5.7.0 if we're installing 5.6.1.
6551     }
6552 }
6553
6554 if (@inc_version_list) {
6555     print join(' ', @inc_version_list);
6556 }
6557 else {
6558     # Blank space to preserve value for next Configure run.
6559     print " ";
6560 }
6561 EOPL
6562 chmod +x getverlist
6563 case "$inc_version_list" in
6564 '')     if test -x "$perl5$exe_ext"; then
6565                 dflt=`$perl5 getverlist`
6566         else
6567                 dflt='none'
6568         fi
6569         ;;
6570 $undef) dflt='none' ;;
6571 *)  eval dflt=\"$inc_version_list\" ;;
6572 esac
6573 case "$dflt" in
6574 ''|' ') dflt=none ;;
6575 esac
6576 case "$dflt" in
6577 5.005) dflt=none ;;
6578 esac
6579 $cat <<EOM
6580
6581 In order to ease the process of upgrading, this version of perl
6582 can be configured to use modules built and installed with earlier
6583 versions of perl that were installed under $prefix.  Specify here
6584 the list of earlier versions that this version of perl should check.
6585 If Configure detected no earlier versions of perl installed under
6586 $prefix, then the list will be empty.  Answer 'none' to tell perl
6587 to not search earlier versions.
6588
6589 The default should almost always be sensible, so if you're not sure,
6590 just accept the default.
6591 EOM
6592
6593 rp='List of earlier versions to include in @INC?'
6594 . ./myread
6595 case "$ans" in
6596 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6597 *) inc_version_list="$ans" ;;
6598 esac
6599 case "$inc_version_list" in
6600 ''|' ')
6601         inc_version_list_init='0'
6602         d_inc_version_list="$undef"
6603         ;;
6604 *)      inc_version_list_init=`echo $inc_version_list |
6605                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6606         d_inc_version_list="$define"
6607         ;;
6608 esac
6609 $rm -f getverlist
6610
6611 : see if malloc/malloc.h has to be included
6612 set malloc/malloc.h i_mallocmalloc
6613 eval $inhdr
6614
6615 : see if this is a malloc.h system
6616 : we want a real compile instead of Inhdr because some systems have a
6617 : malloc.h that just gives a compile error saying to use stdlib.h instead
6618 echo " "
6619 $cat >try.c <<EOCP
6620 #include <stdlib.h>
6621 #include <malloc.h>
6622 #$i_mallocmalloc I_MALLOCMALLOC
6623 #ifdef I_MALLOCMALLOC
6624 # include <malloc/malloc.h>
6625 #endif
6626
6627 int main () { return 0; }
6628 EOCP
6629 set try
6630 if eval $compile; then
6631     echo "<malloc.h> found." >&4
6632     val="$define"
6633 else
6634     echo "<malloc.h> NOT found." >&4
6635     val="$undef"
6636 fi
6637 $rm_try
6638 set i_malloc
6639 eval $setvar
6640
6641 : check for void type
6642 echo " "
6643 echo "Checking to see how well your C compiler groks the void type..." >&4
6644 case "$voidflags" in
6645 '')
6646         $cat >try.c <<EOCP
6647 #$i_stdlib I_STDLIB
6648 #ifdef I_STDLIB
6649 #include <stdlib.h>
6650 #endif
6651 #if TRY & 1
6652 void sub() {
6653 #else
6654 sub() {
6655 #endif
6656         extern void moo();      /* function returning void */
6657         void (*goo)();          /* ptr to func returning void */
6658 #if TRY & 8
6659         void *hue;              /* generic ptr */
6660 #endif
6661 #if TRY & 2
6662         void (*foo[10])();
6663 #endif
6664
6665 #if TRY & 4
6666         if(goo == moo) {
6667                 exit(0);
6668         }
6669 #endif
6670         exit(0);
6671 }
6672 int main() { sub(); }
6673 EOCP
6674         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6675                 voidflags=$defvoidused
6676         echo "Good.  It appears to support void to the level $package wants.">&4
6677                 if $contains warning .out >/dev/null 2>&1; then
6678                         echo "However, you might get some warnings that look like this:"
6679                         $cat .out
6680                 fi
6681         else
6682 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6683                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6684                         echo "It supports 1..."
6685                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6686                                 echo "It also supports 2..."
6687                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6688                                         voidflags=7
6689                                         echo "And it supports 4 but not 8 definitely."
6690                                 else
6691                                         echo "It doesn't support 4..."
6692                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6693                                                 voidflags=11
6694                                                 echo "But it supports 8."
6695                                         else
6696                                                 voidflags=3
6697                                                 echo "Neither does it support 8."
6698                                         fi
6699                                 fi
6700                         else
6701                                 echo "It does not support 2..."
6702                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6703                                         voidflags=13
6704                                         echo "But it supports 4 and 8."
6705                                 else
6706                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6707                                                 voidflags=5
6708                                                 echo "And it supports 4 but has not heard about 8."
6709                                         else
6710                                                 echo "However it supports 8 but not 4."
6711                                         fi
6712                                 fi
6713                         fi
6714                 else
6715                         echo "There is no support at all for void."
6716                         voidflags=0
6717                 fi
6718         fi
6719 esac
6720 case "$voidflags" in
6721 "$defvoidused") ;;
6722 *)      $cat >&4 <<'EOM'
6723   Support flag bits are:
6724     1: basic void declarations.
6725     2: arrays of pointers to functions returning void.
6726     4: operations between pointers to and addresses of void functions.
6727     8: generic void pointers.
6728 EOM
6729         dflt="$voidflags";
6730         rp="Your void support flags add up to what?"
6731         . ./myread
6732         voidflags="$ans"
6733         ;;
6734 esac
6735 $rm_try
6736
6737 : check for length of pointer
6738 echo " "
6739 case "$ptrsize" in
6740 '')
6741         echo "Checking to see how big your pointers are..." >&4
6742         if test "$voidflags" -gt 7; then
6743                 echo '#define VOID_PTR char *' > try.c
6744         else
6745                 echo '#define VOID_PTR void *' > try.c
6746         fi
6747         $cat >>try.c <<EOCP
6748 #include <stdio.h>
6749 #$i_stdlib I_STDLIB
6750 #ifdef I_STDLIB
6751 #include <stdlib.h>
6752 #endif
6753 int main()
6754 {
6755     printf("%d\n", (int)sizeof(VOID_PTR));
6756     exit(0);
6757 }
6758 EOCP
6759         set try
6760         if eval $compile_ok; then
6761                 ptrsize=`$run ./try`
6762                 echo "Your pointers are $ptrsize bytes long."
6763         else
6764                 dflt='4'
6765                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6766                 rp="What is the size of a pointer (in bytes)?"
6767                 . ./myread
6768                 ptrsize="$ans"
6769         fi
6770         ;;
6771 esac
6772 $rm_try
6773 case "$use64bitall" in
6774 "$define"|true|[yY]*)
6775         case "$ptrsize" in
6776         4)      cat <<EOM >&4
6777
6778 *** You have chosen a maximally 64-bit build,
6779 *** but your pointers are only 4 bytes wide.
6780 *** Please rerun Configure without -Duse64bitall.
6781 EOM
6782                 case "$d_quad" in
6783                 define)
6784                         cat <<EOM >&4
6785 *** Since you have quads, you could possibly try with -Duse64bitint.
6786 EOM
6787                         ;;
6788                 esac
6789                 cat <<EOM >&4
6790 *** Cannot continue, aborting.
6791
6792 EOM
6793
6794                 exit 1
6795                 ;;
6796         esac
6797         ;;
6798 esac
6799
6800
6801 : determine whether to use malloc wrapping
6802 echo " "
6803 case "$usemallocwrap" in
6804 [yY]*|true|$define)     dflt='y' ;;
6805 [nN]*|false|$undef)     dflt='n' ;;
6806 *)      case "$usedevel" in
6807         [yY]*|true|$define)     dflt='y' ;;
6808         *) dflt='n' ;;
6809         esac
6810         ;;
6811 esac
6812 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6813 . ./myread
6814 usemallocwrap="$ans"
6815 case "$ans" in
6816 y*|true)
6817         usemallocwrap="$define" ;;
6818 *)
6819         usemallocwrap="$undef" ;;
6820 esac
6821
6822 : determine which malloc to compile in
6823 echo " "
6824 case "$usemymalloc" in
6825 [yY]*|true|$define)     dflt='y' ;;
6826 [nN]*|false|$undef)     dflt='n' ;;
6827 *)      case "$ptrsize" in
6828         4) dflt='y' ;;
6829         *) dflt='n' ;;
6830         esac
6831         ;;
6832 esac
6833 rp="Do you wish to attempt to use the malloc that comes with $package?"
6834 . ./myread
6835 usemymalloc="$ans"
6836 case "$ans" in
6837 y*|true)
6838         usemymalloc='y'
6839         mallocsrc='malloc.c'
6840         mallocobj="malloc$_o"
6841         d_mymalloc="$define"
6842         case "$libs" in
6843         *-lmalloc*)
6844                 : Remove malloc from list of libraries to use
6845                 echo "Removing unneeded -lmalloc from library list" >&4
6846                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6847                 shift
6848                 libs="$*"
6849                 echo "libs = $libs" >&4
6850                 ;;
6851         esac
6852         ;;
6853 *)
6854         usemymalloc='n'
6855         mallocsrc=''
6856         mallocobj=''
6857         d_mymalloc="$undef"
6858         ;;
6859 esac
6860
6861 : compute the return types of malloc and free
6862 echo " "
6863 $cat >malloc.c <<END
6864 #$i_malloc I_MALLOC
6865 #$i_stdlib I_STDLIB
6866 #include <stdio.h>
6867 #include <sys/types.h>
6868 #ifdef I_MALLOC
6869 #include <malloc.h>
6870 #endif
6871 #ifdef I_STDLIB
6872 #include <stdlib.h>
6873 #endif
6874 #ifdef TRY_MALLOC
6875 void *malloc();
6876 #endif
6877 #ifdef TRY_FREE
6878 void free();
6879 #endif
6880 END
6881 case "$malloctype" in
6882 '')
6883         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6884                 malloctype='void *'
6885         else
6886                 malloctype='char *'
6887         fi
6888         ;;
6889 esac
6890 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6891
6892 case "$freetype" in
6893 '')
6894         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6895                 freetype='void'
6896         else
6897                 freetype='int'
6898         fi
6899         ;;
6900 esac
6901 echo "Your system uses $freetype free(), it would seem." >&4
6902 $rm -f malloc.[co]
6903 : determine where site specific architecture-dependent libraries go.
6904 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6905 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6906 : sitelib may have an optional trailing /share.
6907 case "$sitearch" in
6908 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6909         dflt="$dflt/$archname"
6910         ;;
6911 *)      dflt="$sitearch"
6912         ;;
6913 esac
6914 set sitearch sitearch none
6915 eval $prefixit
6916 $cat <<EOM
6917
6918 The installation process will also create a directory for
6919 architecture-dependent site-specific extensions and modules.
6920
6921 EOM
6922 fn=d~+
6923 rp='Pathname for the site-specific architecture-dependent library files?'
6924 . ./getfile
6925 prefixvar=sitearch
6926 . ./setprefixvar
6927 if $test X"$sitearch" = X"$sitelib"; then
6928         d_sitearch="$undef"
6929 else
6930         d_sitearch="$define"
6931 fi
6932
6933 : Set the vendorprefix variables
6934 $cat <<EOM
6935
6936 The installation process will also create a directory for
6937 vendor-supplied add-ons.  Vendors who supply perl with their system
6938 may find it convenient to place all vendor-supplied files in this
6939 directory rather than in the main distribution directory.  This will
6940 ease upgrades between binary-compatible maintenance versions of perl.
6941
6942 Of course you may also use these directories in whatever way you see
6943 fit.  For example, you might use them to access modules shared over a
6944 company-wide network.
6945
6946 The default answer should be fine for most people.
6947 This causes further questions about vendor add-ons to be skipped
6948 and no vendor-specific directories will be configured for perl.
6949
6950 EOM
6951 rp='Do you want to configure vendor-specific add-on directories?'
6952 case "$usevendorprefix" in
6953 define|true|[yY]*) dflt=y ;;
6954 *)      : User may have set vendorprefix directly on Configure command line.
6955         case "$vendorprefix" in
6956         ''|' ') dflt=n ;;
6957         *)      dflt=y ;;
6958         esac
6959         ;;
6960 esac
6961 . ./myread
6962 case "$ans" in
6963 [yY]*)  fn=d~+
6964         rp='Installation prefix to use for vendor-supplied add-ons?'
6965         case "$vendorprefix" in
6966         '') dflt='' ;;
6967         *)  dflt=$vendorprefix ;;
6968         esac
6969         . ./getfile
6970         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6971         oldvendorprefix=''
6972         case "$vendorprefix" in
6973         '') ;;
6974         *)      case "$ans" in
6975                 "$prefix") ;;
6976                 *) oldvendorprefix="$prefix";;
6977                 esac
6978                 ;;
6979         esac
6980         usevendorprefix="$define"
6981         vendorprefix="$ans"
6982         vendorprefixexp="$ansexp"
6983         ;;
6984 *)      usevendorprefix="$undef"
6985         vendorprefix=''
6986         vendorprefixexp=''
6987         ;;
6988 esac
6989
6990 : Set the vendorlib variables
6991 case "$vendorprefix" in
6992 '')     d_vendorlib="$undef"
6993         vendorlib=''
6994         vendorlibexp=''
6995         ;;
6996 *)      d_vendorlib="$define"
6997         : determine where vendor-supplied modules go.
6998         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6999         case "$vendorlib" in
7000         '')
7001                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7002                 case "$installstyle" in
7003                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7004                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7005                 esac
7006                 ;;
7007         *)      dflt="$vendorlib"
7008                 ;;
7009         esac
7010         fn=d~+
7011         rp='Pathname for the vendor-supplied library files?'
7012         . ./getfile
7013         vendorlib="$ans"
7014         vendorlibexp="$ansexp"
7015         ;;
7016 esac
7017 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7018 prefixvar=vendorlib
7019 . ./installprefix
7020
7021 : Set the vendorarch variables
7022 case "$vendorprefix" in
7023 '')     d_vendorarch="$undef"
7024         vendorarch=''
7025         vendorarchexp=''
7026         ;;
7027 *)      d_vendorarch="$define"
7028         : determine where vendor-supplied architecture-dependent libraries go.
7029         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7030         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7031         : vendorlib may have an optional trailing /share.
7032         case "$vendorarch" in
7033         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7034                 dflt="$dflt/$archname"
7035                 ;;
7036         *)      dflt="$vendorarch" ;;
7037         esac
7038         fn=d~+
7039         rp='Pathname for vendor-supplied architecture-dependent files?'
7040         . ./getfile
7041         vendorarch="$ans"
7042         vendorarchexp="$ansexp"
7043         ;;
7044 esac
7045 prefixvar=vendorarch
7046 . ./installprefix
7047 if $test X"$vendorarch" = X"$vendorlib"; then
7048         d_vendorarch="$undef"
7049 else
7050         d_vendorarch="$define"
7051 fi
7052
7053 : Final catch-all directories to search
7054 $cat <<EOM
7055
7056 Lastly, you can have perl look in other directories for extensions and
7057 modules in addition to those already specified.
7058 These directories will be searched after 
7059         $sitearch 
7060         $sitelib 
7061 EOM
7062 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7063 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7064 echo ' '
7065 case "$otherlibdirs" in
7066 ''|' ') dflt='none' ;;
7067 *)      dflt="$otherlibdirs" ;;
7068 esac
7069 $cat <<EOM
7070 Enter a colon-separated set of extra paths to include in perl's @INC
7071 search path, or enter 'none' for no extra paths.
7072
7073 EOM
7074
7075 rp='Colon-separated list of additional directories for perl to search?'
7076 . ./myread
7077 case "$ans" in
7078 ' '|''|none)    otherlibdirs=' ' ;;     
7079 *)      otherlibdirs="$ans" ;;
7080 esac
7081 case "$otherlibdirs" in
7082 ' ') val=$undef ;;
7083 *)      val=$define ;;
7084 esac
7085 set d_perl_otherlibdirs
7086 eval $setvar
7087
7088 : Cruising for prototypes
7089 echo " "
7090 echo "Checking out function prototypes..." >&4
7091 $cat >prototype.c <<EOCP
7092 #$i_stdlib I_STDLIB
7093 #ifdef I_STDLIB
7094 #include <stdlib.h>
7095 #endif
7096 int main(int argc, char *argv[]) {
7097         exit(0);}
7098 EOCP
7099 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7100         echo "Your C compiler appears to support function prototypes."
7101         val="$define"
7102 else
7103         echo "Your C compiler doesn't seem to understand function prototypes."
7104         val="$undef"
7105 fi
7106 set prototype
7107 eval $setvar
7108 $rm -f prototype*
7109
7110 : Check if ansi2knr is required
7111 case "$prototype" in
7112 "$define") ;;
7113 *)      ansi2knr='ansi2knr'
7114         echo " "
7115         cat <<EOM >&4
7116
7117 $me:  FATAL ERROR:
7118 This version of $package can only be compiled by a compiler that 
7119 understands function prototypes.  Unfortunately, your C compiler 
7120         $cc $ccflags
7121 doesn't seem to understand them.  Sorry about that.
7122
7123 If GNU cc is available for your system, perhaps you could try that instead.  
7124
7125 Eventually, we hope to support building Perl with pre-ANSI compilers.
7126 If you would like to help in that effort, please contact <perlbug@perl.org>.
7127
7128 Aborting Configure now.
7129 EOM
7130         exit 2
7131         ;;
7132 esac
7133
7134 : DTrace support
7135 dflt_dtrace='/usr/sbin/dtrace'
7136 cat <<EOM
7137
7138 Perl can be built to support DTrace on platforms that support it.
7139 DTrace is a diagnosis and performance analysis tool from Sun.
7140
7141 If this doesn't make any sense to you, just accept the default '$dflt'.
7142 EOM
7143
7144 while $test 1 ; do
7145         case "$usedtrace" in
7146         $define|true|[yY]*)
7147                 dflt='y'
7148                 ;;
7149         ?*)
7150                 dflt='y'
7151                 dflt_dtrace=$usedtrace
7152                 ;;
7153         *)
7154                 dflt='n'
7155                 ;;
7156         esac
7157
7158         rp='Support DTrace if available?'
7159         . ./myread
7160         case "$ans" in
7161         y|Y)    val="$define" ;;
7162         *)      val="$undef" ;;
7163         esac
7164         set usedtrace
7165         eval $setvar
7166
7167         test "X$usedtrace" != "X$define" && break
7168
7169         echo " "
7170         rp='Where is the dtrace executable?'
7171         dflt=$dflt_dtrace
7172         . ./getfile
7173         val="$ans"
7174         set dtrace
7175         eval $setvar
7176
7177         if $test -f $dtrace
7178         then
7179                 if $dtrace -h -s ../perldtrace.d \
7180                         -o perldtrace.tmp >/dev/null 2>&1 \
7181                         && rm -f perldtrace.tmp
7182                 then
7183                         echo " "
7184                         echo "Good: your $dtrace knows about the -h flag."
7185                 else
7186                         cat >&2 <<EOM
7187
7188 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7189 ***
7190 *** Your installed dtrace doesn't support the -h switch to compile a D
7191 *** program into a C header. Can't continue.
7192
7193 EOM
7194                         exit 1
7195                 fi
7196                 break;
7197         fi
7198
7199         case "$fastread" in
7200         yes)
7201                 cat >&2 <<EOM
7202
7203 *** $me:  Fatal Error:  $dtrace not found.
7204 *** Can't continue.
7205
7206 EOM
7207                 exit 1
7208                 ;;
7209         *)
7210                 echo "*** $dtrace was not found."
7211                 echo " "
7212                 ;;
7213         esac
7214 done
7215
7216 : See if we want extra modules installed
7217 echo " "
7218 case "$extras" in
7219 '') dflt='n';;
7220 *) dflt='y';;
7221 esac
7222 cat <<EOM
7223 Perl can be built with extra modules or bundles of modules which
7224 will be fetched from the CPAN and installed alongside Perl.
7225
7226 Notice that you will need access to the CPAN; either via the Internet,
7227 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7228 be asked later to configure the CPAN.pm module which will in turn do
7229 the installation of the rest of the extra modules or bundles.)
7230
7231 Notice also that if the modules require any external software such as
7232 libraries and headers (the libz library and the zlib.h header for the
7233 Compress::Zlib module, for example) you MUST have any such software
7234 already installed, this configuration process will NOT install such
7235 things for you.
7236
7237 If this doesn't make any sense to you, just accept the default '$dflt'.
7238 EOM
7239 rp='Install any extra modules (y or n)?'
7240 . ./myread
7241 case "$ans" in
7242 y|Y)
7243         cat <<EOM
7244
7245 Please list any extra modules or bundles to be installed from CPAN,
7246 with spaces between the names.  The names can be in any format the
7247 'install' command of CPAN.pm will understand.  (Answer 'none',
7248 without the quotes, to install no extra modules or bundles.)
7249 EOM
7250         rp='Extras?'
7251         dflt="$extras"
7252         . ./myread
7253         extras="$ans"
7254 esac
7255 case "$extras" in
7256 ''|'none')
7257         val=''
7258         $rm -f ../extras.lst
7259         ;;
7260 *)      echo "(Saving the list of extras for later...)"
7261         echo "$extras" > ../extras.lst
7262         val="'$extras'"
7263         ;;
7264 esac
7265 set extras
7266 eval $setvar
7267 echo " "
7268
7269 : determine where html pages for programs go
7270 set html1dir html1dir none
7271 eval $prefixit
7272 $cat <<EOM
7273
7274 If you wish to install html files for programs in $spackage, indicate
7275 the appropriate directory here.  To skip installing html files,
7276 answer "none".
7277 EOM
7278 case "$html1dir" in
7279 ''|none|$undef|' ') dflt=none ;;
7280 *) dflt=$html1dir ;;
7281 esac
7282 fn=dn+~
7283 rp="Directory for the main $spackage html pages?"
7284 . ./getfile
7285 prefixvar=html1dir
7286 . ./setprefixvar
7287 : Use ' ' for none so value is preserved next time through Configure
7288 $test X"$html1dir" = "X" && html1dir=' '
7289
7290 : determine where html pages for libraries and modules go
7291 set html3dir html3dir none
7292 eval $prefixit
7293 $cat <<EOM
7294
7295 If you wish to install html files for modules associated with $spackage,
7296 indicate the appropriate directory here.  To skip installing html files,
7297 answer "none".
7298 EOM
7299 : There is no obvious default.  If they have specified html1dir, then
7300 : try to key off that, possibly changing .../html1 into .../html3.
7301 case "$html3dir" in
7302 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7303 *) dflt=$html3dir ;;
7304 esac
7305 fn=dn+~
7306 rp="Directory for the $spackage module html pages?"
7307 . ./getfile
7308 prefixvar=html3dir
7309 . ./setprefixvar
7310 : Use ' ' for none so value is preserved next time through Configure
7311 $test X"$html3dir" = "X" && html3dir=' '
7312
7313 : determine whether to install perl also as /usr/bin/perl
7314
7315 echo " "
7316 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7317         $cat <<EOM
7318 Many scripts expect perl to be installed as /usr/bin/perl.
7319
7320 If you want to, I can install the perl you are about to compile
7321 as /usr/bin/perl (in addition to $bin/perl).
7322 EOM
7323         if test -f /usr/bin/perl; then
7324             $cat <<EOM
7325
7326 However, please note that because you already have a /usr/bin/perl,
7327 overwriting that with a new Perl would very probably cause problems.
7328 Therefore I'm assuming you don't want to do that (unless you insist).
7329
7330 EOM
7331             case "$installusrbinperl" in
7332             "$define"|[yY]*)    dflt='y';;
7333             *)                  dflt='n';;
7334             esac
7335         else
7336             $cat <<EOM
7337
7338 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7339
7340 EOM
7341             case "$installusrbinperl" in
7342             "$undef"|[nN]*)     dflt='n';;
7343             *)                  dflt='y';;
7344             esac
7345         fi
7346         rp="Do you want to install perl as /usr/bin/perl?"
7347         . ./myread
7348         case "$ans" in
7349         [yY]*)  val="$define";;
7350         *)      val="$undef" ;;
7351         esac
7352 else
7353         val="$undef"
7354 fi
7355 set installusrbinperl
7356 eval $setvar
7357
7358 : Check if we are using the GNU C library
7359 echo " "
7360 echo "Checking for GNU C Library..." >&4
7361 cat >try.c <<'EOCP'
7362 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7363    alone are insufficient to distinguish different versions, such as
7364    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7365    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7366 */
7367 #include <stdio.h>
7368 int main(void)
7369 {
7370 #ifdef __GLIBC__
7371 #   ifdef __GLIBC_MINOR__
7372 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7373 #           include <gnu/libc-version.h>
7374             printf("%s\n",  gnu_get_libc_version());
7375 #       else
7376             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7377 #       endif
7378 #   else
7379         printf("%d\n",  __GLIBC__);
7380 #   endif
7381     return 0;
7382 #else
7383     return 1;
7384 #endif
7385 }
7386 EOCP
7387 set try
7388 if eval $compile_ok && $run ./try > glibc.ver; then
7389         val="$define"
7390         gnulibc_version=`$cat glibc.ver`
7391         echo "You are using the GNU C Library version $gnulibc_version"
7392 else
7393         val="$undef"
7394         gnulibc_version=''
7395         echo "You are not using the GNU C Library"
7396 fi
7397 $rm_try glibc.ver
7398 set d_gnulibc
7399 eval $setvar
7400
7401 : see if nm is to be used to determine whether a symbol is defined or not
7402 case "$usenm" in
7403 '')
7404         dflt=''
7405         case "$d_gnulibc" in
7406         "$define")
7407                 echo " "
7408                 echo "nm probably won't work on the GNU C Library." >&4
7409                 dflt=n
7410                 ;;
7411         esac
7412         case "$dflt" in
7413         '') 
7414                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7415                         echo " "
7416                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7417                         echo "'nm' won't be sufficient on this sytem." >&4
7418                         dflt=n
7419                 fi
7420                 ;;
7421         esac
7422         case "$dflt" in
7423         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7424                 if $test $dflt -gt 20; then
7425                         dflt=y
7426                 else
7427                         dflt=n
7428                 fi
7429                 ;;
7430         esac
7431         ;;
7432 *)
7433         case "$usenm" in
7434         true|$define) dflt=y;;
7435         *) dflt=n;;
7436         esac
7437         ;;
7438 esac
7439 $cat <<EOM
7440
7441 I can use $nm to extract the symbols from your C libraries. This
7442 is a time consuming task which may generate huge output on the disk (up
7443 to 3 megabytes) but that should make the symbols extraction faster. The
7444 alternative is to skip the 'nm' extraction part and to compile a small
7445 test program instead to determine whether each symbol is present. If
7446 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7447 this may be the best solution.
7448
7449 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7450
7451 EOM
7452 rp="Shall I use $nm to extract C symbols from the libraries?"
7453 . ./myread
7454 case "$ans" in
7455 [Nn]*) usenm=false;;
7456 *) usenm=true;;
7457 esac
7458
7459 runnm=$usenm
7460 case "$reuseval" in
7461 true) runnm=false;;
7462 esac
7463
7464 : nm options which may be necessary
7465 case "$nm_opt" in
7466 '') if $test -f /mach_boot; then
7467                 nm_opt=''       # Mach
7468         elif $test -d /usr/ccs/lib; then
7469                 nm_opt='-p'     # Solaris (and SunOS?)
7470         elif $test -f /dgux; then
7471                 nm_opt='-p'     # DG-UX
7472         elif $test -f /lib64/rld; then
7473                 nm_opt='-p'     # 64-bit Irix
7474         else
7475                 nm_opt=''
7476         fi;;
7477 esac
7478
7479 : nm options which may be necessary for shared libraries but illegal
7480 : for archive libraries.  Thank you, Linux.
7481 case "$nm_so_opt" in
7482 '')     case "$myuname" in
7483         *linux*|gnu*)
7484                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7485                         nm_so_opt='--dynamic'
7486                 fi
7487                 ;;
7488         esac
7489         ;;
7490 esac
7491
7492 : Figure out where the libc is located
7493 case "$runnm" in
7494 true)
7495 : get list of predefined functions in a handy place
7496 echo " "
7497 case "$libc" in
7498 '') libc=unknown
7499         case "$libs" in
7500         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7501         esac
7502         ;;
7503 esac
7504 case "$libs" in
7505 '') ;;
7506 *)  for thislib in $libs; do
7507         case "$thislib" in
7508         -lc|-lc_s)
7509                 : Handle C library specially below.
7510                 ;;
7511         -l*)
7512                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7513                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7514                         :
7515                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7516                         :
7517                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7518                         :
7519                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7520                         :
7521                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7522                         :
7523                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7524                         :
7525                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7526                         :
7527                 else
7528                         try=''
7529                 fi
7530                 libnames="$libnames $try"
7531                 ;;
7532         *) libnames="$libnames $thislib" ;;
7533         esac
7534         done
7535         ;;
7536 esac
7537 xxx=normal
7538 case "$libc" in
7539 unknown)
7540         set /lib/libc.$so
7541         for xxx in $libpth; do
7542                 $test -r $1 || set $xxx/libc.$so
7543                 : The messy sed command sorts on library version numbers.
7544                 $test -r $1 || \
7545                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7546                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7547                                 h
7548                                 s/[0-9][0-9]*/0000&/g
7549                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7550                                 G
7551                                 s/\n/ /' | \
7552                          $sort | $sed -e 's/^.* //'`
7553                 eval set \$$#
7554         done
7555         $test -r $1 || set /usr/ccs/lib/libc.$so
7556         $test -r $1 || set /lib/libsys_s$_a
7557         ;;
7558 *)
7559         set blurfl
7560         ;;
7561 esac
7562 if $test -r "$1"; then
7563         echo "Your (shared) C library seems to be in $1."
7564         libc="$1"
7565 elif $test -r /lib/libc && $test -r /lib/clib; then
7566         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7567         xxx=apollo
7568         libc='/lib/clib /lib/libc'
7569         if $test -r /lib/syslib; then
7570                 echo "(Your math library is in /lib/syslib.)"
7571                 libc="$libc /lib/syslib"
7572         fi
7573 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7574         echo "Your C library seems to be in $libc, as you said before."
7575 elif $test -r $incpath/usr/lib/libc$_a; then
7576         libc=$incpath/usr/lib/libc$_a;
7577         echo "Your C library seems to be in $libc.  That's fine."
7578 elif $test -r /lib/libc$_a; then
7579         libc=/lib/libc$_a;
7580         echo "Your C library seems to be in $libc.  You're normal."
7581 else
7582         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7583                 :
7584         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7585                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7586         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7587                 :
7588         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7589                 :
7590         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7591                 :
7592         else
7593                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7594         fi
7595         if $test -r "$tans"; then
7596                 echo "Your C library seems to be in $tans, of all places."
7597                 libc=$tans
7598         else
7599                 libc='blurfl'
7600         fi
7601 fi
7602 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7603         dflt="$libc"
7604         cat <<EOM
7605
7606 If the guess above is wrong (which it might be if you're using a strange
7607 compiler, or your machine supports multiple models), you can override it here.
7608
7609 EOM
7610 else
7611         dflt=''
7612         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7613         cat >&4 <<EOM
7614 I can't seem to find your C library.  I've looked in the following places:
7615
7616 EOM
7617         $sed 's/^/      /' libpath
7618         cat <<EOM
7619
7620 None of these seems to contain your C library. I need to get its name...
7621
7622 EOM
7623 fi
7624 fn=f
7625 rp='Where is your C library?'
7626 . ./getfile
7627 libc="$ans"
7628
7629 echo " "
7630 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7631 set X `cat libnames`
7632 shift
7633 xxx=files
7634 case $# in 1) xxx=file; esac
7635 echo "Extracting names from the following $xxx for later perusal:" >&4
7636 echo " "
7637 $sed 's/^/      /' libnames >&4
7638 echo " "
7639 $echo $n "This may take a while...$c" >&4
7640
7641 for file in $*; do
7642         case $file in
7643         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7644         *) $nm $nm_opt $file 2>/dev/null;;
7645         esac
7646 done >libc.tmp
7647
7648 $echo $n ".$c"
7649 $grep fprintf libc.tmp > libc.ptf
7650 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7651 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7652 xxx='[ADTSIW]'
7653 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7662         eval $xscan;\
7663         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7664                 eval $xrun
7665 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7678                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7679         eval $xscan;\
7680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681                 eval $xrun
7682 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7683         eval $xscan;\
7684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685                 eval $xrun
7686 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7687         eval $xscan;\
7688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689                 eval $xrun
7690 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7691         eval $xscan;\
7692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693                 eval $xrun
7694 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7695         eval $xscan;\
7696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697                 eval $xrun
7698 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7699         eval $xscan;\
7700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701                 eval $xrun
7702 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7703         eval $xscan;\
7704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7705                 eval $xrun
7706 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7707         eval $xscan;\
7708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7709                 eval $xrun
7710 else
7711         $nm -p $* 2>/dev/null >libc.tmp
7712         $grep fprintf libc.tmp > libc.ptf
7713         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7714                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7715         then
7716                 nm_opt='-p'
7717                 eval $xrun
7718         else
7719                 echo " "
7720                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7721                 com=''
7722                 if $ar t $libc > libc.tmp && \
7723                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7724                 then
7725                         for thisname in $libnames $libc; do
7726                                 $ar t $thisname >>libc.tmp
7727                         done
7728                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7729                         echo "Ok." >&4
7730                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7731                         for thisname in $libnames $libc; do
7732                                 $ar tv $thisname >>libc.tmp
7733                                 emximp -o tmp.imp $thisname \
7734                                     2>/dev/null && \
7735                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7736                                     < tmp.imp >>libc.tmp
7737                                 $rm -f tmp.imp
7738                         done
7739                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7740                         echo "Ok." >&4
7741                 else
7742                         echo "$ar didn't seem to work right." >&4
7743                         echo "Maybe this is a Cray...trying bld instead..." >&4
7744                         if  bld t $libc | \
7745                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7746                                 $test -s libc.list
7747                         then
7748                                 for thisname in $libnames; do
7749                                         bld t $libnames | \
7750                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7751                                         $ar t $thisname >>libc.tmp
7752                                 done
7753                                 echo "Ok." >&4
7754                         else
7755                                 echo "That didn't work either.  Giving up." >&4
7756                                 exit 1
7757                         fi
7758                 fi
7759         fi
7760 fi
7761 nm_extract="$com"
7762 case "$PASE" in
7763 define)
7764     echo " "
7765     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7766     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7767     ;;
7768 *)  if $test -f /lib/syscalls.exp; then
7769         echo " "
7770         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7771         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7772                 /lib/syscalls.exp >>libc.list
7773     fi
7774     ;;
7775 esac
7776 ;;
7777 esac
7778 $rm -f libnames libpath
7779
7780 : see if dld is available
7781 set dld.h i_dld
7782 eval $inhdr
7783
7784 : Check if we are using C++
7785 echo " "
7786 echo "Checking for C++..." >&4
7787 $cat >try.c <<'EOCP'
7788 #include <stdio.h>
7789 int main(void)
7790 {
7791 #ifdef __cplusplus
7792     return 0;
7793 #else
7794     return 1;
7795 #endif
7796 }
7797 EOCP
7798 set try
7799 if eval $compile_ok && $run ./try; then
7800         val="$define"
7801         echo "You are using a C++ compiler."
7802 else
7803         val="$undef"
7804         echo "You are not using a C++ compiler."
7805 fi
7806 $rm_try cplusplus$$
7807 set d_cplusplus
7808 eval $setvar
7809
7810 : is a C symbol defined?
7811 csym='tlook=$1;
7812 case "$3" in
7813 -v) tf=libc.tmp; tdc="";;
7814 -a) tf=libc.tmp; tdc="[]";;
7815 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7816 esac;
7817 case "$d_cplusplus" in
7818     $define)    extern_C="extern \"C\"" ;;
7819     *)          extern_C="extern"       ;;
7820 esac;
7821 tx=yes;
7822 case "$reuseval-$4" in
7823 true-) ;;
7824 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7825 esac;
7826 case "$tx" in
7827 yes)
7828         tval=false;
7829         if $test "$runnm" = true; then
7830                 if $contains $tlook $tf >/dev/null 2>&1; then
7831                         tval=true;
7832                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7833                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7834                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7835                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7836                         $rm_try;
7837                 fi;
7838         else
7839                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7840                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7841                 $rm_try;
7842         fi;
7843         ;;
7844 *)
7845         case "$tval" in
7846         $define) tval=true;;
7847         *) tval=false;;
7848         esac;
7849         ;;
7850 esac;
7851 eval "$2=$tval"'
7852
7853 : define an is-in-libc? function
7854 inlibc='echo " "; td=$define; tu=$undef;
7855 sym=$1; var=$2; eval "was=\$$2";
7856 tx=yes;
7857 case "$reuseval$was" in
7858 true) ;;
7859 true*) tx=no;;
7860 esac;
7861 case "$tx" in
7862 yes)
7863         set $sym tres -f;
7864         eval $csym;
7865         case "$tres" in
7866         true)
7867                 echo "$sym() found." >&4;
7868                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7869         *)
7870                 echo "$sym() NOT found." >&4;
7871                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7872         esac;;
7873 *)
7874         case "$was" in
7875         $define) echo "$sym() found." >&4;;
7876         *) echo "$sym() NOT found." >&4;;
7877         esac;;
7878 esac'
7879
7880 : see if dlopen exists
7881 xxx_runnm="$runnm"
7882 xxx_ccflags="$ccflags"
7883 runnm=false
7884 : with g++ one needs -shared to get is-in-libc to work for dlopen
7885 case "$gccversion" in
7886 '')     ;;
7887 *)      case "$d_cplusplus" in
7888         "$define") ccflags="$ccflags -shared" ;;
7889         esac
7890         ;;
7891 esac
7892 set dlopen d_dlopen
7893 eval $inlibc
7894 runnm="$xxx_runnm"
7895 ccflags="$xxx_ccflags"
7896
7897 : see if this is a unistd.h system
7898 set unistd.h i_unistd
7899 eval $inhdr
7900
7901 : determine which dynamic loading, if any, to compile in
7902 echo " "
7903 dldir="ext/DynaLoader"
7904 case "$usedl" in
7905 $define|y|true)
7906         dflt='y'
7907         usedl="$define"
7908         ;;
7909 $undef|n|false)
7910         dflt='n'
7911         usedl="$undef"
7912         ;;
7913 *)
7914         dflt='n'
7915         case "$d_dlopen" in
7916             $define) dflt='y' ;;
7917         esac
7918         case "$i_dld" in
7919             $define) dflt='y' ;;
7920         esac
7921         : Does a dl_xxx.xs file exist for this operating system
7922         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7923         ;;
7924 esac
7925 rp="Do you wish to use dynamic loading?"
7926 . ./myread
7927 usedl="$ans"
7928 case "$ans" in
7929 y*) usedl="$define"
7930         case "$dlsrc" in
7931         '')
7932                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7933                         dflt="$dldir/dl_${osname}.xs"
7934                 elif $test "$d_dlopen" = "$define" ; then
7935                         dflt="$dldir/dl_dlopen.xs"
7936                 elif $test "$i_dld" = "$define" ; then
7937                         dflt="$dldir/dl_dld.xs"
7938                 else
7939                         dflt=''
7940                 fi
7941                 ;;
7942         *)      dflt="$dldir/$dlsrc"
7943                 ;;
7944         esac
7945     echo "The following dynamic loading files are available:"
7946         : Can not go over to $dldir because getfile has path hard-coded in.
7947         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7948         rp="Source file to use for dynamic loading"
7949         fn="fne"
7950         gfpth="$src"
7951         . ./getfile
7952         usedl="$define"
7953         : emulate basename
7954         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7955
7956         $cat << EOM
7957
7958 Some systems may require passing special flags to $cc -c to
7959 compile modules that will be used to create a shared library.
7960 To use no flags, say "none".
7961
7962 EOM
7963     case "$cccdlflags" in
7964     '') case "$gccversion" in
7965                 '') case "$osname" in
7966                         hpux)   dflt='+z' ;;
7967                         next)   dflt='none' ;;
7968                         irix*)  dflt='-KPIC' ;;
7969                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7970                         sunos)  dflt='-pic' ;;
7971                         *)      dflt='none' ;;
7972                     esac
7973                         ;;
7974                 *)  case "$osname" in
7975                         darwin) dflt='none' ;;
7976                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7977                         *)      dflt='-fpic' ;;
7978                     esac ;;
7979             esac ;;
7980         ' ') dflt='none' ;;
7981     *)  dflt="$cccdlflags" ;;
7982     esac
7983     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7984     . ./myread
7985     case "$ans" in
7986     none) cccdlflags=' ' ;;
7987     *) cccdlflags="$ans" ;;
7988     esac
7989
7990     cat << EOM
7991
7992 Some systems use ld to create libraries that can be dynamically loaded,
7993 while other systems (such as those using ELF) use $cc.
7994
7995 EOM
7996         case "$ld" in
7997         '')     $cat >try.c <<EOM
7998 /* Test for whether ELF binaries are produced */
7999 #include <fcntl.h>
8000 #$i_stdlib I_STDLIB
8001 #ifdef I_STDLIB
8002 #include <stdlib.h>
8003 #endif
8004 #$i_unistd I_UNISTD
8005 #ifdef I_UNISTD
8006 #include <unistd.h>
8007 #endif
8008 int main() {
8009         char b[4];
8010         int i = open("a.out",O_RDONLY);
8011         if(i == -1)
8012                 exit(1); /* fail */
8013         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8014                 exit(0); /* succeed (yes, it's ELF) */
8015         else
8016                 exit(1); /* fail */
8017 }
8018 EOM
8019                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8020                         cat <<EOM
8021 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8022 EOM
8023                         dflt="$cc"
8024                 else
8025                         echo "I'll use ld to build dynamic libraries."
8026                         dflt='ld'
8027                 fi
8028                 $rm_try
8029                 ;;
8030         *)      dflt="$ld"
8031                 ;;
8032         esac
8033
8034     rp="What command should be used to create dynamic libraries?"
8035     . ./myread
8036         ld="$ans"
8037
8038     cat << EOM
8039
8040 Some systems may require passing special flags to $ld to create a
8041 library that can be dynamically loaded.  If your ld flags include
8042 -L/other/path options to locate libraries outside your loader's normal
8043 search path, you may need to specify those -L options here as well.  To
8044 use no flags, say "none".
8045
8046 EOM
8047     case "$lddlflags" in
8048     '') case "$osname" in
8049                         beos) dflt='-nostart' ;;
8050                         haiku) dflt='-shared' ;;
8051                         hpux) dflt='-b';
8052                               case "$gccversion" in
8053                               '') dflt="$dflt +vnocompatwarnings" ;;
8054                               esac
8055                               ;;
8056                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8057                         next)  dflt='none' ;;
8058                         solaris) dflt='-G' ;;
8059                         sunos) dflt='-assert nodefinitions' ;;
8060                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8061                 *)     dflt='none' ;;
8062                         esac
8063                         ;;
8064     *) dflt="$lddlflags" ;;
8065     esac
8066
8067         : Try to guess additional flags to pick up local libraries.
8068         : Be careful not to append to a plain 'none'
8069         case "$dflt" in
8070         none) dflt='' ;;
8071         esac
8072         for thisflag in $ldflags; do
8073                 case "$thisflag" in
8074                 -L*|-R*|-Wl,-R*)
8075                         case " $dflt " in
8076                         *" $thisflag "*) ;;
8077                         *) dflt="$dflt $thisflag" ;;
8078                         esac
8079                         ;;
8080                 esac
8081         done
8082
8083         case "$dflt" in
8084         ''|' ') dflt='none' ;;
8085         esac
8086
8087         case "$ldflags" in
8088         *-fstack-protector*)
8089             case "$dflt" in
8090                         *-fstack-protector*) ;; # Don't add it again
8091                         *) dflt="$dflt -fstack-protector" ;; 
8092                 esac
8093                 ;;
8094         esac
8095
8096
8097     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8098     . ./myread
8099     case "$ans" in
8100     none) lddlflags=' ' ;;
8101     *) lddlflags="$ans" ;;
8102     esac
8103
8104         cat <<EOM
8105
8106 Some systems may require passing special flags to $cc to indicate that
8107 the resulting executable will use dynamic linking.  To use no flags,
8108 say "none".
8109
8110 EOM
8111     case "$ccdlflags" in
8112     '') case "$osname" in
8113             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8114             next|sunos) dflt='none' ;;
8115             *)          dflt='none' ;;
8116             esac ;;
8117     ' ')  dflt='none' ;;
8118     *)  dflt="$ccdlflags" ;;
8119     esac
8120     rp="Any special flags to pass to $cc to use dynamic linking?"
8121     . ./myread
8122     case "$ans" in
8123     none) ccdlflags=' ' ;;
8124     *) ccdlflags="$ans" ;;
8125     esac
8126     ;;
8127 *)  usedl="$undef"
8128         ld='ld'
8129     dlsrc='dl_none.xs'
8130     lddlflags=''
8131     ccdlflags=''
8132     ;;
8133 esac
8134
8135 : Do we want a shared libperl?
8136 also=''
8137 case "$usedl" in
8138 $undef)
8139         # No dynamic loading being used, so don't bother even to prompt.
8140         useshrplib='false'
8141         ;;
8142 *)      case "$useshrplib" in
8143         '')     case "$osname" in
8144                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8145                         dflt=y
8146                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8147                         ;;
8148                 next*)
8149                         case "$osvers" in
8150                         4*)     dflt=y
8151                                 also='Building a shared libperl is needed for MAB support.'
8152                                 ;;
8153                         *)      dflt=n
8154                                 ;;
8155                         esac
8156                         ;;
8157                 *)      dflt=n
8158                         ;;
8159                 esac
8160                 ;;
8161         $define|true|[Yy]*)
8162                 dflt=y
8163                 ;;
8164         *)      dflt=n
8165                 ;;
8166         esac
8167         $cat << EOM
8168
8169 The perl executable is normally obtained by linking perlmain.c with
8170 libperl${_a}, any static extensions (usually just DynaLoader), and
8171 any other libraries needed on this system (such as -lm, etc.).  Since
8172 your system supports dynamic loading, it is probably possible to build
8173 a shared libperl.$so.  If you will have more than one executable linked
8174 to libperl.$so, this will significantly reduce the size of each
8175 executable, but it may have a noticeable effect on performance.  The
8176 default is probably sensible for your system.
8177 $also
8178
8179 EOM
8180         rp="Build a shared libperl.$so (y/n)"
8181         . ./myread
8182         case "$ans" in
8183         true|$define|[Yy]*)
8184                 useshrplib='true'  ;;
8185         *)      useshrplib='false' ;;
8186         esac
8187         ;;
8188 esac
8189
8190 case "$useshrplib" in
8191 true)
8192         case "$libperl" in
8193         '')
8194                 # Figure out a good name for libperl.so.  Since it gets stored in
8195                 # a version-specific architecture-dependent library, the version
8196                 # number isn't really that important, except for making cc/ld happy.
8197                 #
8198                 # A name such as libperl.so.10.1
8199                 majmin="libperl.$so.$patchlevel.$subversion"
8200                 # A name such as libperl.so.100
8201                 majonly=`echo $patchlevel $subversion |
8202                         $awk '{printf "%d%02d", $1, $2}'`
8203                 majonly=libperl.$so.$majonly
8204                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8205                 # rely on figuring it out from the naming of libc.
8206                 case "${osname}${osvers}" in
8207                 next4*)
8208                         dflt=libperl.5.$so
8209                         # XXX How handle the --version stuff for MAB?
8210                         ;;
8211                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8212                         dflt=libperl.$so
8213                         ;;
8214                 cygwin*) # ld links now against the dll directly
8215                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8216                         majonly=`echo $patchlevel $subversion |
8217                                 $awk '{printf "%03d%03d", $1, $2}'`
8218                         majonly=cygperl5.$majonly.$so
8219                         dflt=$majmin
8220                         ;;
8221                 *)      # Try to guess based on whether libc has major.minor.
8222                         case "$libc" in
8223                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8224                         *libc.$so.[0-9]*) dflt=$majonly ;;
8225                         *)      dflt=libperl.$so ;;
8226                         esac
8227                         ;;
8228                 esac
8229                 ;;
8230         *)      dflt=$libperl
8231                 ;;
8232         esac
8233         cat << EOM
8234
8235 I need to select a good name for the shared libperl.  If your system uses
8236 library names with major and minor numbers, then you might want something
8237 like $majmin.  Alternatively, if your system uses a single version
8238 number for shared libraries, then you might want to use $majonly.
8239 Or, your system might be quite happy with a simple libperl.$so.
8240
8241 Since the shared libperl will get installed into a version-specific
8242 architecture-dependent directory, the version number of the shared perl
8243 library probably isn't important, so the default should be o.k.
8244
8245 EOM
8246         rp='What name do you want to give to the shared libperl?'
8247         . ./myread
8248         libperl=$ans
8249         echo "Ok, I'll use $libperl"
8250         ;;
8251 *)
8252         libperl="libperl${_a}"
8253         ;;
8254 esac
8255
8256 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8257 case "$shrpdir" in
8258 '') ;;
8259 *)      $cat >&4 <<EOM
8260 WARNING:  Use of the shrpdir variable for the installation location of
8261 the shared $libperl is not supported.  It was never documented and
8262 will not work in this version.  Let me (perlbug@perl.org)
8263 know of any problems this may cause.
8264
8265 EOM
8266         case "$shrpdir" in
8267         "$archlibexp/CORE")
8268                 $cat >&4 <<EOM
8269 But your current setting of $shrpdir is
8270 the default anyway, so it's harmless.
8271 EOM
8272                 ;;
8273         *)
8274                 $cat >&4 <<EOM
8275 Further, your current attempted setting of $shrpdir
8276 conflicts with the value of $archlibexp/CORE
8277 that installperl will use.
8278 EOM
8279                 ;;
8280         esac
8281         ;;
8282 esac
8283
8284 # How will the perl executable find the installed shared $libperl?
8285 # Add $xxx to ccdlflags.
8286 # If we can't figure out a command-line option, use $shrpenv to
8287 # set env LD_RUN_PATH.  The main perl makefile uses this.
8288 shrpdir=$archlibexp/CORE
8289 xxx=''
8290 tmp_shrpenv=''
8291 if "$useshrplib"; then
8292     case "$osname" in
8293         aix)
8294                 # We'll set it in Makefile.SH...
8295                 ;;
8296         solaris)
8297                 xxx="-R $shrpdir"
8298                 ;;
8299         freebsd|netbsd|openbsd|interix|dragonfly)
8300                 xxx="-Wl,-R$shrpdir"
8301                 ;;
8302         bsdos|linux|irix*|dec_osf|gnu*)
8303                 xxx="-Wl,-rpath,$shrpdir"
8304                 ;;
8305         next)
8306                 # next doesn't like the default...
8307                 ;;
8308         beos)
8309                 # beos doesn't like the default, either.
8310                 ;;
8311         haiku)
8312                 # Haiku doesn't like the default, either.
8313                 ;;
8314         hpux*)
8315                 # hpux doesn't like the default, either.
8316                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8317                 ;;
8318         cygwin)
8319                 # cygwin needs only ldlibpth
8320                 ;;
8321         *)
8322                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8323                 ;;
8324         esac
8325         case "$xxx" in
8326         '') ;;
8327         *)
8328                 # Only add $xxx if it isn't already in ccdlflags.
8329                 case " $ccdlflags " in
8330                 *" $xxx "*)     ;;
8331                 *)      ccdlflags="$ccdlflags $xxx"
8332                         cat <<EOM >&4
8333
8334 Adding $xxx to the flags
8335 passed to $ld so that the perl executable will find the
8336 installed shared $libperl.
8337
8338 EOM
8339                         ;;
8340                 esac
8341                 ;;
8342         esac
8343 fi
8344 # Fix ccdlflags in AIX for building external extensions.
8345 # (For building Perl itself bare -bE:perl.exp is needed,
8346 #  Makefile.SH takes care of this.)
8347 case "$osname" in
8348 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8349 esac
8350 # Respect a hint or command-line value.
8351 case "$shrpenv" in
8352 '') shrpenv="$tmp_shrpenv" ;;
8353 esac
8354 case "$ldlibpthname" in
8355 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8356 none)   ldlibpthname='' ;;
8357 esac
8358
8359 : determine where manual pages are on this system
8360 echo " "
8361 case "$sysman" in
8362 '') 
8363         syspath='/usr/share/man/man1 /usr/man/man1'
8364         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8365         syspath="$syspath /usr/man/u_man/man1"
8366         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8367         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8368         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8369         sysman=`./loc . /usr/man/man1 $syspath`
8370         ;;
8371 esac
8372 if $test -d "$sysman"; then
8373         echo "System manual is in $sysman." >&4
8374 else
8375         echo "Could not find manual pages in source form." >&4
8376 fi
8377
8378 : determine where manual pages go
8379 set man1dir man1dir none
8380 eval $prefixit
8381 $cat <<EOM
8382
8383 $spackage has manual pages available in source form.
8384 EOM
8385 case "$nroff" in
8386 nroff)
8387         echo "However, you don't have nroff, so they're probably useless to you."
8388         case "$man1dir" in
8389         '') man1dir="none";;
8390         esac;;
8391 esac
8392 echo "If you don't want the manual sources installed, answer 'none'."
8393 case "$man1dir" in
8394 ' ') dflt=none
8395         ;;
8396 '')
8397         lookpath="$prefixexp/share/man/man1"
8398         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8399         lookpath="$lookpath $prefixexp/man/p_man/man1"
8400         lookpath="$lookpath $prefixexp/man/u_man/man1"
8401         lookpath="$lookpath $prefixexp/man/man.1"
8402         case "$sysman" in
8403         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8404         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8405         esac
8406         set dflt
8407         eval $prefixup
8408         ;;
8409 *)  dflt="$man1dir"
8410         ;;
8411 esac
8412 echo " "
8413 fn=dn+~
8414 rp="Where do the main $spackage manual pages (source) go?"
8415 . ./getfile
8416 if $test "X$man1direxp" != "X$ansexp"; then
8417         installman1dir=''
8418 fi
8419 prefixvar=man1dir
8420 . ./setprefixvar
8421
8422 case "$man1dir" in
8423 '')     man1dir=' '
8424         installman1dir='';;
8425 esac
8426
8427 : What suffix to use on installed man pages
8428
8429 case "$man1dir" in
8430 ' ')
8431         man1ext='0'
8432         ;;
8433 *)
8434         rp="What suffix should be used for the main $spackage man pages?"
8435         case "$man1ext" in
8436         '')     case "$man1dir" in
8437                 *1)  dflt=1 ;;
8438                 *1p) dflt=1p ;;
8439                 *1pm) dflt=1pm ;;
8440                 *l) dflt=l;;
8441                 *n) dflt=n;;
8442                 *o) dflt=o;;
8443                 *p) dflt=p;;
8444                 *C) dflt=C;;
8445                 *L) dflt=L;;
8446                 *L1) dflt=L1;;
8447                 *) dflt=1;;
8448                 esac
8449                 ;;
8450         *)      dflt="$man1ext";;
8451         esac
8452         . ./myread
8453         man1ext="$ans"
8454         ;;
8455 esac
8456
8457 : see if we can have long filenames
8458 echo " "
8459 first=123456789abcdef
8460 $rm -f $first
8461 if (echo hi >$first) 2>/dev/null; then
8462         if $test -f 123456789abcde; then
8463                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8464                 val="$undef"
8465         else
8466                 echo 'You can have filenames longer than 14 characters.'>&4
8467                 val="$define"
8468         fi
8469 else
8470         $cat <<'EOM'
8471 You can't have filenames longer than 14 chars.
8472 You can't even think about them!
8473 EOM
8474         val="$undef"
8475 fi
8476 set d_flexfnam
8477 eval $setvar
8478 $rm -rf 123456789abcde*
8479
8480 : determine where library module manual pages go
8481 set man3dir man3dir none
8482 eval $prefixit
8483 $cat <<EOM
8484
8485 $spackage has manual pages for many of the library modules.
8486 EOM
8487
8488 case "$nroff" in
8489 nroff)
8490         $cat <<'EOM'
8491 However, you don't have nroff, so they're probably useless to you.
8492 EOM
8493         case "$man3dir" in
8494         '') man3dir="none";;
8495         esac;;
8496 esac
8497
8498 case "$d_flexfnam" in
8499 undef)
8500         $cat <<'EOM'
8501 However, your system can't handle the long file names like File::Basename.3.
8502 EOM
8503         case "$man3dir" in
8504         '') man3dir="none";;
8505         esac;;
8506 esac
8507
8508 echo "If you don't want the manual sources installed, answer 'none'."
8509 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8510 case "$man3dir" in
8511 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8512         if $test -d "$privlib/man/man3"; then
8513                 cat <<EOM >&4
8514
8515 WARNING:  Previous versions of perl installed man3 pages into
8516 $privlib/man/man3.  This version will suggest a
8517 new default of $dflt.
8518 EOM
8519                 tdflt=$dflt
8520                 dflt='n'
8521                 rp='Do you wish to preserve the old behavior?(y/n)'
8522                 . ./myread
8523                 case "$ans" in
8524                 y*) dflt="$privlib/man/man3" ;;
8525                 *)  dflt=$tdflt ;;
8526                 esac
8527     fi
8528         ;;
8529 *)      dflt="$man3dir" ;;
8530 esac
8531 case "$dflt" in
8532 ' ') dflt=none ;;
8533 esac
8534 echo " "
8535 fn=dn+~
8536 rp="Where do the $package library man pages (source) go?"
8537 . ./getfile
8538 prefixvar=man3dir
8539 . ./setprefixvar
8540
8541 case "$man3dir" in
8542 '')     man3dir=' '
8543         installman3dir='';;
8544 esac
8545
8546 : What suffix to use on installed man pages
8547 case "$man3dir" in
8548 ' ')
8549         man3ext='0'
8550         ;;
8551 *)
8552         rp="What suffix should be used for the $package library man pages?"
8553         case "$man3ext" in
8554         '')     case "$man3dir" in
8555                 *3)  dflt=3 ;;
8556                 *3p) dflt=3p ;;
8557                 *3pm) dflt=3pm ;;
8558                 *l) dflt=l;;
8559                 *n) dflt=n;;
8560                 *o) dflt=o;;
8561                 *p) dflt=p;;
8562                 *C) dflt=C;;
8563                 *L) dflt=L;;
8564                 *L3) dflt=L3;;
8565                 *) dflt=3;;
8566                 esac
8567                 ;;
8568         *)      dflt="$man3ext";;
8569         esac
8570         . ./myread
8571         man3ext="$ans"
8572         ;;
8573 esac
8574
8575 : see if we have to deal with yellow pages, now NIS.
8576 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8577         if $test -f /usr/etc/nibindd; then
8578                 echo " "
8579                 echo "I'm fairly confident you're on a NeXT."
8580                 echo " "
8581                 rp='Do you get the hosts file via NetInfo?'
8582                 dflt=y
8583                 case "$hostcat" in
8584                 nidump*) ;;
8585                 '') ;;
8586                 *) dflt=n;;
8587                 esac
8588                 . ./myread
8589                 case "$ans" in
8590                 y*) hostcat='nidump hosts .';;
8591                 *)      case "$hostcat" in
8592                         nidump*) hostcat='';;
8593                         esac
8594                         ;;
8595                 esac
8596         fi
8597         case "$hostcat" in
8598         nidump*) ;;
8599         *)
8600                 case "$hostcat" in
8601                 *ypcat*) dflt=y;;
8602                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8603                                 dflt=y
8604                         else
8605                                 dflt=n
8606                         fi;;
8607                 *) dflt=n;;
8608                 esac
8609                 echo " "
8610                 rp='Are you getting the hosts file via yellow pages?'
8611                 . ./myread
8612                 case "$ans" in
8613                 y*) hostcat='ypcat hosts';;
8614                 *) hostcat='cat /etc/hosts';;
8615                 esac
8616                 ;;
8617         esac
8618 fi
8619 case "$hostcat" in
8620 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8621 esac
8622 case "$groupcat" in
8623 '') test -f /etc/group && groupcat='cat /etc/group';;
8624 esac
8625 case "$passcat" in
8626 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8627 esac
8628
8629 : now get the host name
8630 echo " "
8631 echo "Figuring out host name..." >&4
8632 case "$myhostname" in
8633 '') cont=true
8634         echo 'Maybe "hostname" will work...'
8635         if tans=`sh -c hostname 2>&1` ; then
8636                 myhostname=$tans
8637                 phostname=hostname
8638                 cont=''
8639         fi
8640         ;;
8641 *) cont='';;
8642 esac
8643 if $test "$cont"; then
8644         if ./xenix; then
8645                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8646                 if tans=`cat /etc/systemid 2>&1` ; then
8647                         myhostname=$tans
8648                         phostname='cat /etc/systemid'
8649                         echo "Whadyaknow.  Xenix always was a bit strange..."
8650                         cont=''
8651                 fi
8652         elif $test -r /etc/systemid; then
8653                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8654         fi
8655 fi
8656 if $test "$cont"; then
8657         echo 'No, maybe "uuname -l" will work...'
8658         if tans=`sh -c 'uuname -l' 2>&1` ; then
8659                 myhostname=$tans
8660                 phostname='uuname -l'
8661         else
8662                 echo 'Strange.  Maybe "uname -n" will work...'
8663                 if tans=`sh -c 'uname -n' 2>&1` ; then
8664                         myhostname=$tans
8665                         phostname='uname -n'
8666                 else
8667                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8668                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8669                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8670                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8671                         else
8672                                 case "$myhostname" in
8673                                 '') echo "Does this machine have an identity crisis or something?"
8674                                         phostname='';;
8675                                 *)
8676                                         echo "Well, you said $myhostname before..."
8677                                         phostname='echo $myhostname';;
8678                                 esac
8679                         fi
8680                 fi
8681         fi
8682 fi
8683 case "$myhostname" in
8684 '') myhostname=noname ;;
8685 esac
8686 : you do not want to know about this
8687 set $myhostname
8688 myhostname=$1
8689
8690 : verify guess
8691 if $test "$myhostname" ; then
8692         dflt=y
8693         rp='Your host name appears to be "'$myhostname'".'" Right?"
8694         . ./myread
8695         case "$ans" in
8696         y*) ;;
8697         *) myhostname='';;
8698         esac
8699 fi
8700
8701 : bad guess or no guess
8702 while $test "X$myhostname" = X ; do
8703         dflt=''
8704         rp="Please type the (one word) name of your host:"
8705         . ./myread
8706         myhostname="$ans"
8707 done
8708
8709 : translate upper to lower if necessary
8710 case "$myhostname" in
8711 *[A-Z]*)
8712         echo "(Normalizing case in your host name)"
8713         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8714         ;;
8715 esac
8716
8717 case "$myhostname" in
8718 *.*)
8719         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8720         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8721         echo "(Trimming domain name from host name--host name is now $myhostname)"
8722         ;;
8723 *) case "$mydomain" in
8724         '')
8725                 {
8726                         test "X$hostcat" = "Xypcat hosts" &&
8727                         ypmatch "$myhostname" hosts 2>/dev/null |\
8728                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8729                         $test -s hosts
8730                 } || {
8731                         test "X$hostcat" != "X" &&
8732                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8733                                         /[       ]$myhostname[  . ]/p" > hosts
8734                 }
8735                 tmp_re="[       . ]"
8736                 if $test -f hosts; then
8737                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8738                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8739                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8740                                 hosts | $sort | $uniq | \
8741                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8742                         case `$echo X$dflt` in
8743                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8744                                 dflt=.
8745                                 ;;
8746                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8747                                 ;;
8748                         esac
8749                 else
8750                         echo "(I cannot locate a hosts database anywhere)"
8751                         dflt=.
8752                 fi
8753                 case "$dflt" in
8754                 .)
8755                         tans=`./loc resolv.conf X /etc /usr/etc`
8756                         if $test -f "$tans"; then
8757                                 echo "(Attempting domain name extraction from $tans)"
8758                                 dflt=.`$sed -n -e 's/   / /g' \
8759                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8760                                   -e 1q 2>/dev/null`
8761                                 case "$dflt" in
8762                                 .) dflt=.`$sed -n -e 's/        / /g' \
8763                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8764                                      -e 1q 2>/dev/null`
8765                                         ;;
8766                                 esac
8767                         fi
8768                         ;;
8769                 esac
8770                 case "$dflt" in
8771                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8772                         dflt=.`sh -c domainname 2>/dev/null`
8773                         case "$dflt" in
8774                         '') dflt='.';;
8775                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8776                         esac
8777                         ;;
8778                 esac
8779                 case "$dflt$osname" in
8780                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8781                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8782                         ;;
8783                 esac
8784                 case "$dflt" in
8785                 .) echo "(Lost all hope -- silly guess then)"
8786                         dflt='.nonet'
8787                         ;;
8788                 esac
8789                 $rm -f hosts
8790                 ;;
8791         *) dflt="$mydomain";;
8792         esac;;
8793 esac
8794 echo " "
8795 rp="What is your domain name?"
8796 . ./myread
8797 tans="$ans"
8798 case "$ans" in
8799 '') ;;
8800 .*) ;;
8801 *) tans=".$tans";;
8802 esac
8803 mydomain="$tans"
8804
8805 : translate upper to lower if necessary
8806 case "$mydomain" in
8807 *[A-Z]*)
8808         echo "(Normalizing case in your domain name)"
8809         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8810         ;;
8811 esac
8812
8813 : a little sanity check here
8814 case "$phostname" in
8815 '') ;;
8816 *)
8817         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8818         $myhostname$mydomain|$myhostname) ;;
8819         *)
8820                 case "$phostname" in
8821                 sed*)
8822                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8823                         ;;
8824                 *)
8825                         echo "(That doesn't agree with your $phostname command, by the way.)"
8826                         ;;
8827                 esac
8828         ;;
8829         esac
8830         ;;
8831 esac
8832
8833 : determine the e-mail address of the user who is running us
8834 $cat <<EOM
8835
8836 I need to get your e-mail address in Internet format if possible, i.e.
8837 something like user@host.domain. Please answer accurately since I have
8838 no easy means to double check it. The default value provided below
8839 is most probably close to reality but may not be valid from outside
8840 your organization...
8841
8842 EOM
8843 cont=x
8844 while test "$cont"; do
8845         case "$cf_email" in
8846         '') dflt="$cf_by@$myhostname$mydomain";;
8847         *) dflt="$cf_email";;
8848         esac
8849         rp='What is your e-mail address?'
8850         . ./myread
8851         cf_email="$ans"
8852         case "$cf_email" in
8853         *@*.*) cont='' ;;
8854         *)
8855                 rp='Address does not look like an Internet one.  Use it anyway?'
8856                 case "$fastread" in
8857                 yes) dflt=y ;;
8858                 *) dflt=n ;;
8859                 esac
8860                 . ./myread
8861                 case "$ans" in
8862                 y*) cont='' ;;
8863                 *) echo " " ;;
8864                 esac
8865                 ;;
8866         esac
8867 done
8868
8869 : Ask e-mail of administrator
8870 $cat <<EOM
8871
8872 If you or somebody else will be maintaining perl at your site, please
8873 fill in the correct e-mail address here so that they may be contacted
8874 if necessary. Currently, the "perlbug" program included with perl
8875 will send mail to this address in addition to perlbug@perl.org. You may
8876 enter "none" for no administrator.
8877
8878 EOM
8879 case "$perladmin" in
8880 '') dflt="$cf_email";;
8881 *) dflt="$perladmin";;
8882 esac
8883 rp='Perl administrator e-mail address'
8884 . ./myread
8885 perladmin="$ans"
8886
8887 : determine whether to only install version-specific parts.
8888 echo " "
8889 $cat <<EOM
8890 Do you want to install only the version-specific parts of the perl
8891 distribution?  Usually you do *not* want to do this.
8892 EOM
8893 case "$versiononly" in
8894 "$define"|[Yy]*|true) dflt='y' ;;
8895 *) dflt='n';
8896 esac
8897 rp="Do you want to install only the version-specific parts of perl?"
8898 . ./myread
8899 case "$ans" in
8900 [yY]*)  val="$define";;
8901 *)      val="$undef" ;;
8902 esac
8903 set versiononly
8904 eval $setvar
8905
8906 case "$versiononly" in
8907 "$define") inc_version_list=''
8908            inc_version_list_init=0
8909            ;;
8910 esac
8911
8912 : figure out how to guarantee perl startup
8913 : XXX Note that this currently takes advantage of the bug that binexp ignores
8914 :     the Configure -Dinstallprefix setting, which in turn means that under
8915 :     relocatable @INC, initialinstalllocation is what binexp started as.
8916 case "$startperl" in
8917 '')
8918         case "$sharpbang" in
8919         *!)
8920                 $cat <<EOH
8921
8922 I can use the #! construct to start perl on your system. This will
8923 make startup of perl scripts faster, but may cause problems if you
8924 want to share those scripts and perl is not in a standard place
8925 ($initialinstalllocation/perl) on all your platforms. The alternative
8926 is to force a shell by starting the script with a single ':' character.
8927
8928 EOH
8929                 case "$versiononly" in
8930                 "$define")      dflt="$initialinstalllocation/perl$version";;
8931                 *)              dflt="$initialinstalllocation/perl";;
8932                 esac
8933                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8934                 . ./myread
8935                 case "$ans" in
8936                 none)   startperl=": # use perl";;
8937                 *)      startperl="#!$ans"
8938                         if $test 30 -lt `echo "$ans" | wc -c`; then
8939                                 $cat >&4 <<EOM
8940
8941 WARNING:  Some systems limit the #! command to 32 characters.
8942 If you experience difficulty running Perl scripts with #!, try
8943 installing Perl in a directory with a shorter pathname.
8944
8945 EOM
8946                         fi ;;
8947                 esac
8948                 ;;
8949         *) startperl=": # use perl"
8950                 ;;
8951         esac
8952         ;;
8953 esac
8954 echo "I'll use $startperl to start perl scripts."
8955
8956 : figure best path for perl in scripts
8957 case "$perlpath" in
8958 '')
8959         case "$versiononly" in
8960         "$define")      perlpath="$initialinstalllocation/perl$version";;
8961         *)              perlpath="$initialinstalllocation/perl";;
8962         esac
8963         case "$startperl" in
8964         *!*) ;;
8965         *)
8966                 $cat <<EOH
8967
8968 I will use the "eval 'exec'" idiom to start Perl on your system.
8969 I can use the full path of your Perl binary for this purpose, but
8970 doing so may cause problems if you want to share those scripts and
8971 Perl is not always in a standard place ($initialinstalllocation/perl).
8972
8973 EOH
8974                 dflt="$initialinstalllocation/perl"
8975                 rp="What path shall I use in \"eval 'exec'\"?"
8976                 . ./myread
8977                 perlpath="$ans"
8978                 ;;
8979         esac
8980         ;;
8981 esac
8982 case "$startperl" in
8983 *!*)    ;;
8984 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8985 esac
8986
8987 : determine where public executable scripts go
8988 set scriptdir scriptdir
8989 eval $prefixit
8990 case "$scriptdir" in
8991 '')
8992         dflt="$bin"
8993         : guess some guesses
8994         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8995         $test -d /usr/share/bin     && dflt=/usr/share/bin
8996         $test -d /usr/local/script  && dflt=/usr/local/script
8997         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8998         $test -d $prefixexp/script  && dflt=$prefixexp/script
8999         set dflt
9000         eval $prefixup
9001         ;;
9002 *)  dflt="$scriptdir"
9003         ;;
9004 esac
9005 $cat <<EOM
9006
9007 Some installations have a separate directory just for executable scripts so
9008 that they can mount it across multiple architectures but keep the scripts in
9009 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9010 Or you might just lump your scripts in with all your other executables.
9011
9012 EOM
9013 fn=d~
9014 rp='Where do you keep publicly executable scripts?'
9015 . ./getfile
9016 if $test "X$ansexp" != "X$scriptdirexp"; then
9017         installscript=''
9018 fi
9019 installscriptdir=''
9020 prefixvar=scriptdir
9021 . ./setprefixvar
9022 : A little fix up for an irregularly named variable.
9023 installscript="$installscriptdir"
9024
9025 : determine where add-on public executables go
9026 case "$sitebin" in
9027 '')     dflt=$siteprefix/bin ;;
9028 *)      dflt=$sitebin ;;
9029 esac
9030 fn=d~
9031 rp='Pathname where the add-on public executables should be installed?'
9032 . ./getfile
9033 prefixvar=sitebin
9034 . ./setprefixvar
9035
9036 : determine where add-on html pages go
9037 : There is no standard location, so try to copy the previously-selected
9038 : directory structure for the core html pages.
9039 case "$sitehtml1dir" in
9040 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9041 *)     dflt=$sitehtml1dir ;;
9042 esac
9043 case "$dflt" in
9044 ''|' ') dflt=none ;;
9045 esac
9046 fn=dn+~
9047 rp='Pathname where the site-specific html pages should be installed?'
9048 . ./getfile
9049 prefixvar=sitehtml1dir
9050 . ./setprefixvar
9051
9052 : determine where add-on library html pages go
9053 : There is no standard location, so try to copy the previously-selected
9054 : directory structure for the core html pages.
9055 case "$sitehtml3dir" in
9056 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9057 *)     dflt=$sitehtml3dir ;;
9058 esac
9059 case "$dflt" in
9060 ''|' ') dflt=none ;;
9061 esac
9062 fn=dn+~
9063 rp='Pathname where the site-specific library html pages should be installed?'
9064 . ./getfile
9065 prefixvar=sitehtml3dir
9066 . ./setprefixvar
9067
9068 : determine where add-on manual pages go
9069 case "$siteman1dir" in
9070 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9071 *)      dflt=$siteman1dir ;;
9072 esac
9073 case "$dflt" in
9074 ''|' ') dflt=none ;;
9075 esac
9076 fn=dn+~
9077 rp='Pathname where the site-specific manual pages should be installed?'
9078 . ./getfile
9079 prefixvar=siteman1dir
9080 . ./setprefixvar
9081
9082 : determine where add-on library man pages go
9083 case "$siteman3dir" in
9084 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9085 *)      dflt=$siteman3dir ;;
9086 esac
9087 case "$dflt" in
9088 ''|' ') dflt=none ;;
9089 esac
9090 fn=dn+~
9091 rp='Pathname where the site-specific library manual pages should be installed?'
9092 . ./getfile
9093 prefixvar=siteman3dir
9094 . ./setprefixvar
9095
9096 : determine where add-on public executable scripts go
9097 case "$sitescript" in
9098 '')     dflt=$siteprefix/script
9099         $test -d $dflt || dflt=$sitebin ;;
9100 *)  dflt="$sitescript" ;;
9101 esac
9102 fn=d~+
9103 rp='Pathname where add-on public executable scripts should be installed?'
9104 . ./getfile
9105 prefixvar=sitescript
9106 . ./setprefixvar
9107
9108 : Check if faststdio is requested and available
9109 case "$usefaststdio" in
9110 $define|true|[yY]*|'')
9111         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9112         case "$xversion" in
9113         [68])   dflt='y' ;;
9114         *)      dflt='n' ;;
9115         esac
9116         ;;
9117 *) dflt='n';;
9118 esac
9119 cat <<EOM
9120
9121 Perl can be built to use 'fast stdio', which means using the stdio
9122 library but also directly manipulating the stdio buffers to enable
9123 faster I/O.  Using stdio is better for backward compatibility (especially
9124 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9125 interface has been preferred instead of stdio.
9126
9127 If this doesn't make any sense to you, just accept the default '$dflt'.
9128 EOM
9129 rp='Use the "fast stdio" if available?'
9130 . ./myread
9131 case "$ans" in
9132 y|Y)    val="$define" ;;
9133 *)      val="$undef" ;;
9134 esac
9135 set usefaststdio
9136 eval $setvar
9137
9138
9139 : define an is-a-typedef? function
9140 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9141 case "$inclist" in
9142 "") inclist="sys/types.h";;
9143 esac;
9144 eval "varval=\$$var";
9145 case "$varval" in
9146 "")
9147         $rm -f temp.c;
9148         for inc in $inclist; do
9149                 echo "#include <$inc>" >>temp.c;
9150         done;
9151         echo "#ifdef $type" >> temp.c;
9152         echo "printf(\"We have $type\");" >> temp.c;
9153         echo "#endif" >> temp.c;
9154         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9155         if $contains $type temp.E >/dev/null 2>&1; then
9156                 eval "$var=\$type";
9157         else
9158                 eval "$var=\$def";
9159         fi;
9160         $rm -f temp.?;;
9161 *) eval "$var=\$varval";;
9162 esac'
9163
9164 : define an is-a-typedef? function that prompts if the type is not available.
9165 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9166 case "$inclist" in
9167 "") inclist="sys/types.h";;
9168 esac;
9169 eval "varval=\$$var";
9170 case "$varval" in
9171 "")
9172         $rm -f temp.c;
9173         for inc in $inclist; do
9174                 echo "#include <$inc>" >>temp.c;
9175         done;
9176         echo "#ifdef $type" >> temp.c;
9177         echo "printf(\"We have $type\");" >> temp.c;
9178         echo "#endif" >> temp.c;
9179         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9180         echo " " ;
9181         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9182         if $contains $type temp.E >/dev/null 2>&1; then
9183                 echo "$type found." >&4;
9184                 eval "$var=\$type";
9185         else
9186                 echo "$type NOT found." >&4;
9187                 dflt="$def";
9188                 . ./myread ;
9189                 eval "$var=\$ans";
9190         fi;
9191         $rm -f temp.?;;
9192 *) eval "$var=\$varval";;
9193 esac'
9194
9195 : see what type lseek is declared as in the kernel
9196 rp="What is the type used for lseek's offset on this system?"
9197 set off_t lseektype long stdio.h sys/types.h
9198 eval $typedef_ask
9199
9200 echo " "
9201 echo "Checking to see how big your file offsets are..." >&4
9202 $cat >try.c <<EOCP
9203 #include <sys/types.h>
9204 #include <stdio.h>
9205 int main()
9206 {
9207     printf("%d\n", (int)sizeof($lseektype));
9208     return(0);
9209 }
9210 EOCP
9211 set try
9212 if eval $compile_ok; then
9213         lseeksize=`$run ./try`
9214         echo "Your file offsets are $lseeksize bytes long."
9215 else
9216         dflt=$longsize
9217         echo " "
9218         echo "(I can't seem to compile the test program.  Guessing...)"
9219         rp="What is the size of your file offsets (in bytes)?"
9220         . ./myread
9221         lseeksize="$ans"
9222 fi
9223 $rm_try
9224
9225 : see what type file positions are declared as in the library
9226 rp="What is the type for file position used by fsetpos()?"
9227 set fpos_t fpostype long stdio.h sys/types.h
9228 eval $typedef_ask
9229
9230 : Check size for Fpos_t
9231 echo " "
9232 case "$fpostype" in
9233 *_t) zzz="$fpostype"    ;;
9234 *)   zzz="fpos_t"       ;;
9235 esac
9236 echo "Checking the size of $zzz..." >&4
9237 cat > try.c <<EOCP
9238 #include <sys/types.h>
9239 #include <stdio.h>
9240 #$i_stdlib I_STDLIB
9241 #ifdef I_STDLIB
9242 #include <stdlib.h>
9243 #endif
9244 int main() {
9245     printf("%d\n", (int)sizeof($fpostype));
9246     exit(0);
9247 }
9248 EOCP
9249 set try
9250 if eval $compile_ok; then
9251         yyy=`$run ./try`
9252         case "$yyy" in
9253         '')     fpossize=4
9254                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9255                 ;;
9256         *)      fpossize=$yyy
9257                 echo "Your $zzz is $fpossize bytes long."
9258                 ;;
9259         esac
9260 else
9261         dflt="$longsize"
9262         echo " " >&4
9263         echo "(I can't compile the test program.  Guessing...)" >&4
9264         rp="What is the size of your file positions (in bytes)?"
9265         . ./myread
9266         fpossize="$ans"
9267 fi
9268
9269 : Check for large file support
9270 # Backward compatibility (uselfs is deprecated).
9271 case "$uselfs" in
9272 "$define"|true|[yY]*)
9273         cat <<EOM >&4
9274
9275 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9276 EOM
9277         uselargefiles="$define"
9278         ;;
9279 esac
9280
9281 case "$lseeksize:$fpossize" in
9282 8:8) cat <<EOM
9283
9284 You can have files larger than 2 gigabytes.
9285 EOM
9286    val="$define" ;;
9287 *)    case "$uselargefiles" in
9288    "$undef"|false|[nN]*) dflt='n' ;;
9289    *)   dflt='y' ;;
9290    esac
9291    cat <<EOM
9292
9293 Perl can be built to understand large files (files larger than 2 gigabytes)
9294 on some systems.  To do so, Configure can be run with -Duselargefiles.
9295
9296 If this doesn't make any sense to you, just accept the default '$dflt'.
9297 EOM
9298    rp='Try to understand large files, if available?'
9299    . ./myread
9300    case "$ans" in
9301    y|Y)         val="$define" ;;
9302    *)           val="$undef"  ;;
9303    esac
9304    ;;
9305 esac
9306 set uselargefiles
9307 eval $setvar
9308 : Look for a hint-file generated 'call-back-unit'.  If the
9309 : user has specified that a large files perl is to be built,
9310 : we may need to set or change some other defaults.
9311 if $test -f uselargefiles.cbu; then
9312         echo "Your platform has some specific hints regarding large file builds, using them..."
9313         . ./uselargefiles.cbu
9314 fi
9315 case "$uselargefiles" in
9316 "$define")
9317         if $test -f uselargefiles.cbu; then
9318                 echo " "
9319                 echo "Rechecking to see how big your file offsets are..." >&4
9320                 $cat >try.c <<EOCP
9321 #include <sys/types.h>
9322 #include <stdio.h>
9323 int main()
9324 {
9325     printf("%d\n", (int)sizeof($lseektype));
9326     return(0);
9327 }
9328 EOCP
9329                 set try
9330                 if eval $compile_ok; then
9331                         lseeksize=`$run ./try`
9332                         $echo "Your file offsets are now $lseeksize bytes long."
9333                 else
9334                         dflt="$lseeksize"
9335                         echo " "
9336                         echo "(I can't seem to compile the test program.  Guessing...)"
9337                         rp="What is the size of your file offsets (in bytes)?"
9338                         . ./myread
9339                         lseeksize="$ans"
9340                 fi
9341                 case "$fpostype" in
9342                 *_t) zzz="$fpostype"    ;;
9343                 *)   zzz="fpos_t"       ;;
9344                 esac
9345                 $echo $n "Rechecking the size of $zzz...$c" >&4
9346                 $cat > try.c <<EOCP
9347 #include <sys/types.h>
9348 #include <stdio.h>
9349 #$i_stdlib I_STDLIB
9350 #ifdef I_STDLIB
9351 #include <stdlib.h>
9352 #endif
9353 int main() {
9354     printf("%d\n", (int)sizeof($fpostype));
9355     return(0);
9356 }
9357 EOCP
9358                 set try
9359                 if eval $compile_ok; then
9360                         yyy=`$run ./try`
9361                         dflt="$lseeksize"
9362                         case "$yyy" in
9363                         '')     echo " "
9364                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9365                                 ;;
9366                         *)      fpossize=$yyy
9367                                 echo " $fpossize bytes." >&4
9368                                 ;;
9369                         esac
9370                 else
9371                         dflt="$fpossize"
9372                         echo " "
9373                         echo "(I can't compile the test program.  Guessing...)" >&4
9374                         rp="What is the size of your file positions (in bytes)?"
9375                         . ./myread
9376                         fpossize="$ans"
9377                 fi
9378                 $rm_try
9379         fi
9380         ;;
9381 esac
9382
9383 : Set the vendorbin variables
9384 case "$vendorprefix" in
9385 '')     d_vendorbin="$undef"
9386         vendorbin=''
9387         vendorbinexp=''
9388         ;;
9389 *)      d_vendorbin="$define"
9390         : determine where vendor-supplied executables go.
9391         case "$vendorbin" in
9392         '') dflt=$vendorprefix/bin ;;
9393         *)      dflt="$vendorbin" ;;
9394         esac
9395         fn=d~+
9396         rp='Pathname for the vendor-supplied executables directory?'
9397         . ./getfile
9398         vendorbin="$ans"
9399         vendorbinexp="$ansexp"
9400         ;;
9401 esac
9402 prefixvar=vendorbin
9403 . ./installprefix
9404
9405 : Set the vendorhtml1dir variables
9406 case "$vendorprefix" in
9407 '')     vendorhtml1dir=''
9408         vendorhtml1direxp=''
9409         ;;
9410 *)      : determine where vendor-supplied html pages go.
9411         : There is no standard location, so try to copy the previously-selected
9412         : directory structure for the core html pages.
9413         : XXX Better default suggestions would be welcome.
9414         case "$vendorhtml1dir" in
9415         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9416         *)      dflt=$vendorhtml1dir ;;
9417         esac
9418         case "$dflt" in
9419         ''|' ') dflt=none ;;
9420         esac
9421         fn=dn+~
9422         rp='Pathname for the vendor-supplied html pages?'
9423         . ./getfile
9424         vendorhtml1dir="$ans"
9425         vendorhtml1direxp="$ansexp"
9426         ;;
9427 esac
9428 : Use ' ' for none so value is preserved next time through Configure
9429 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9430 prefixvar=vendorhtml1dir
9431 . ./installprefix
9432
9433 : Set the vendorhtml3dir variables
9434 case "$vendorprefix" in
9435 '')     vendorhtml3dir=''
9436         vendorhtml3direxp=''
9437         ;;
9438 *)      : determine where vendor-supplied module html pages go.
9439         : There is no standard location, so try to copy the previously-selected
9440         : directory structure for the core html pages.
9441         : XXX Better default suggestions would be welcome.
9442         case "$vendorhtml3dir" in
9443         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9444         *)      dflt=$vendorhtml3dir ;;
9445         esac
9446         case "$dflt" in
9447         ''|' ') dflt=none ;;
9448         esac
9449         fn=dn+~
9450         rp='Pathname for the vendor-supplied html pages?'
9451         . ./getfile
9452         vendorhtml3dir="$ans"
9453         vendorhtml3direxp="$ansexp"
9454         ;;
9455 esac
9456 : Use ' ' for none so value is preserved next time through Configure
9457 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9458 prefixvar=vendorhtml3dir
9459 . ./installprefix
9460
9461 : Set the vendorman1dir variables
9462 case "$vendorprefix" in
9463 '')     vendorman1dir=''
9464         vendorman1direxp=''
9465         ;;
9466 *)      : determine where vendor-supplied manual pages go.
9467         case "$vendorman1dir" in
9468         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9469         *)      dflt=$vendorman1dir ;;
9470         esac
9471         case "$dflt" in
9472         ''|' ') dflt=none ;;
9473         esac
9474         fn=nd~+
9475         rp='Pathname for the vendor-supplied manual section 1 pages?'
9476         . ./getfile
9477         vendorman1dir="$ans"
9478         vendorman1direxp="$ansexp"
9479         ;;
9480 esac
9481 : Use ' ' for none so value is preserved next time through Configure
9482 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9483 prefixvar=vendorman1dir
9484 . ./installprefix
9485
9486 : Set the vendorman3dir variables
9487 case "$vendorprefix" in
9488 '')     vendorman3dir=''
9489         vendorman3direxp=''
9490         ;;
9491 *)      : determine where vendor-supplied module manual pages go.
9492         case "$vendorman3dir" in
9493         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9494         *)      dflt=$vendorman3dir ;;
9495         esac
9496         case "$dflt" in
9497         ''|' ') dflt=none ;;
9498         esac
9499         fn=nd~+
9500         rp='Pathname for the vendor-supplied manual section 3 pages?'
9501         . ./getfile
9502         vendorman3dir="$ans"
9503         vendorman3direxp="$ansexp"
9504         ;;
9505 esac
9506 : Use ' ' for none so value is preserved next time through Configure
9507 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9508 prefixvar=vendorman3dir
9509 . ./installprefix
9510
9511 : Set the vendorscript variables
9512 case "$vendorprefix" in
9513 '')     d_vendorscript="$undef"
9514         vendorscript=''
9515         vendorscriptexp=''
9516         ;;
9517 *)      d_vendorscript="$define"
9518         : determine where vendor-supplied scripts go.
9519         case "$vendorscript" in
9520         '')     dflt=$vendorprefix/script
9521                 $test -d $dflt || dflt=$vendorbin ;;
9522         *)  dflt="$vendorscript" ;;
9523         esac
9524         $cat <<EOM
9525
9526 The installation process will create a directory for
9527 vendor-supplied scripts.
9528
9529 EOM
9530         fn=d~+
9531         rp='Pathname for the vendor-supplied scripts directory?'
9532         . ./getfile
9533         vendorscript="$ans"
9534         vendorscriptexp="$ansexp"
9535         ;;
9536 esac
9537 prefixvar=vendorscript
9538 . ./installprefix
9539
9540 : script used to emit important warnings
9541 cat >warn <<EOS
9542 $startsh
9543 if test \$# -gt 0; then
9544         echo "\$@" >msg
9545 else
9546         cat >msg
9547 fi
9548 echo "*** WARNING:" >&4
9549 sed -e 's/^/*** /' <msg >&4
9550 echo "*** " >&4
9551 cat msg >>config.msg
9552 echo " " >>config.msg
9553 rm -f msg
9554 EOS
9555 chmod +x warn
9556 $eunicefix warn
9557
9558 : see which of string.h or strings.h is needed
9559 echo " "
9560 strings=`./findhdr string.h`
9561 if $test "$strings" && $test -r "$strings"; then
9562         echo "Using <string.h> instead of <strings.h>." >&4
9563         val="$define"
9564 else
9565         val="$undef"
9566         strings=`./findhdr strings.h`
9567         if $test "$strings" && $test -r "$strings"; then
9568                 echo "Using <strings.h> instead of <string.h>." >&4
9569         else
9570                 ./warn "No string header found -- You'll surely have problems."
9571         fi
9572 fi
9573 set i_string
9574 eval $setvar
9575 case "$i_string" in
9576 "$undef") strings=`./findhdr strings.h`;;
9577 *)        strings=`./findhdr string.h`;;
9578 esac
9579
9580 : see if qgcvt exists
9581 set qgcvt d_qgcvt
9582 eval $inlibc
9583
9584 : Check print/scan long double stuff
9585 echo " "
9586
9587 if $test X"$d_longdbl" = X"$define"; then
9588
9589 echo "Checking how to print long doubles..." >&4
9590
9591 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9592         $cat >try.c <<'EOCP'
9593 #include <sys/types.h>
9594 #include <stdio.h>
9595 int main() {
9596   double d = 123.456;
9597   printf("%.3f\n", d);
9598 }
9599 EOCP
9600         set try
9601         if eval $compile; then
9602                 yyy=`$run ./try`
9603                 case "$yyy" in
9604                 123.456)
9605                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9606                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9607                         echo "We will use %f."
9608                         ;;
9609                 esac
9610         fi
9611 fi
9612
9613 if $test X"$sPRIfldbl" = X; then
9614         $cat >try.c <<'EOCP'
9615 #include <sys/types.h>
9616 #include <stdio.h>
9617 int main() {
9618   long double d = 123.456;
9619   printf("%.3Lf\n", d);
9620 }
9621 EOCP
9622         set try
9623         if eval $compile; then
9624                 yyy=`$run ./try`
9625                 case "$yyy" in
9626                 123.456)
9627                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9628                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9629                         echo "We will use %Lf."
9630                         ;;
9631                 esac
9632         fi
9633 fi
9634
9635 if $test X"$sPRIfldbl" = X; then
9636         $cat >try.c <<'EOCP'
9637 #include <sys/types.h>
9638 #include <stdio.h>
9639 int main() {
9640   long double d = 123.456;
9641   printf("%.3llf\n", d);
9642 }
9643 EOCP
9644         set try
9645         if eval $compile; then
9646                 yyy=`$run ./try`
9647                 case "$yyy" in
9648                 123.456)
9649                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9650                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9651                         echo "We will use %llf."
9652                         ;;
9653                 esac
9654         fi
9655 fi
9656
9657 if $test X"$sPRIfldbl" = X; then
9658         $cat >try.c <<'EOCP'
9659 #include <sys/types.h>
9660 #include <stdio.h>
9661 int main() {
9662   long double d = 123.456;
9663   printf("%.3lf\n", d);
9664 }
9665 EOCP
9666         set try
9667         if eval $compile; then
9668                 yyy=`$run ./try`
9669                 case "$yyy" in
9670                 123.456)
9671                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9672                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9673                         echo "We will use %lf."
9674                         ;;
9675                 esac
9676         fi
9677 fi
9678
9679 if $test X"$sPRIfldbl" = X; then
9680         echo "Cannot figure out how to print long doubles." >&4
9681 else
9682         sSCNfldbl=$sPRIfldbl    # expect consistency
9683 fi
9684
9685 $rm_try
9686
9687 fi # d_longdbl
9688
9689 case "$sPRIfldbl" in
9690 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9691         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9692         d_SCNfldbl="$undef";
9693         ;;
9694 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9695         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9696         d_SCNfldbl="$define";
9697         ;;
9698 esac
9699
9700 : Check how to convert floats to strings.
9701
9702 if test "X$d_Gconvert" = X; then
9703
9704 echo " "
9705 echo "Checking for an efficient way to convert floats to strings."
9706 echo " " > try.c
9707 case "$uselongdouble" in
9708 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9709 esac
9710 case "$d_longdbl" in
9711 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9712 esac
9713 case "$d_PRIgldbl" in
9714 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9715 esac
9716 $cat >>try.c <<EOP
9717 #ifdef TRY_gconvert
9718 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9719 char *myname = "gconvert";
9720 #endif
9721 #ifdef TRY_gcvt
9722 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9723 char *myname = "gcvt";
9724 #endif
9725 #ifdef TRY_qgcvt
9726 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9727 char *myname = "qgcvt";
9728 #define DOUBLETYPE long double
9729 #endif
9730 #ifdef TRY_sprintf
9731 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9732 #ifdef HAS_PRIgldbl
9733 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9734 #else
9735 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9736 #endif
9737 #else
9738 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9739 #endif
9740 char *myname = "sprintf";
9741 #endif
9742
9743 #ifndef DOUBLETYPE
9744 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9745 #define DOUBLETYPE long double
9746 #else
9747 #define DOUBLETYPE double
9748 #endif
9749 #endif
9750
9751 #include <stdio.h>
9752
9753 #$i_stdlib I_STDLIB
9754 #ifdef I_STDLIB
9755 #include <stdlib.h>
9756 #endif
9757 #$i_string I_STRING
9758 #ifdef I_STRING
9759 #  include <string.h>
9760 #else
9761 #  include <strings.h>
9762 #endif
9763
9764 int checkit(char *expect, char *got)
9765 {
9766     if (strcmp(expect, got)) {
9767                 printf("%s oddity:  Expected %s, got %s\n",
9768                         myname, expect, got);
9769                 exit(1);
9770         }
9771 }
9772
9773 int main()
9774 {
9775         char buf[64];
9776         buf[63] = '\0';
9777
9778         /* This must be 1st test on (which?) platform */
9779         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9780         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9781         checkit("0.1", buf);
9782
9783         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9784         checkit("0.01", buf);
9785
9786         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9787         checkit("0.001", buf);
9788
9789         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9790         checkit("0.0001", buf);
9791
9792         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9793         if (strlen(buf) > 5)
9794             checkit("9e-005", buf); /* for Microsoft ?? */
9795         else
9796             checkit("9e-05", buf);
9797
9798         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9799         checkit("1", buf);
9800
9801         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9802         checkit("1.1", buf);
9803
9804         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9805         checkit("1.01", buf);
9806
9807         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9808         checkit("1.001", buf);
9809
9810         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9811         checkit("1.0001", buf);
9812
9813         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9814         checkit("1.00001", buf);
9815
9816         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9817         checkit("1.000001", buf);
9818
9819         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9820         checkit("0", buf);
9821
9822         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9823         checkit("-1", buf);
9824
9825         /* Some Linux gcvt's give 1.e+5 here. */
9826         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9827         checkit("100000", buf);
9828
9829         /* Some Linux gcvt's give -1.e+5 here. */
9830         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9831         checkit("-100000", buf);
9832
9833         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9834         checkit("123.456", buf);
9835
9836         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9837         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9838         /* 34 should be enough to scare even long double
9839          * places into using the e notation. */
9840         if (strlen(buf) > 5)
9841             checkit("1e+034", buf); /* for Microsoft */
9842         else
9843             checkit("1e+34", buf);
9844
9845         /* For Perl, if you add additional tests here, also add them to
9846          * t/base/num.t for benefit of platforms not using Configure or
9847          * overriding d_Gconvert */
9848
9849         exit(0);
9850 }
9851 EOP
9852 : first add preferred functions to our list
9853 xxx_list=""
9854 for xxx_convert in $gconvert_preference; do
9855     case $xxx_convert in
9856     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9857     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9858     esac
9859 done
9860 : then add any others
9861 for xxx_convert in gconvert gcvt sprintf; do
9862     case "$xxx_list" in
9863     *$xxx_convert*) ;;
9864     *) xxx_list="$xxx_list $xxx_convert" ;;
9865     esac
9866 done
9867
9868 case "$d_longdbl$uselongdouble" in
9869 "$define$define")
9870     : again, add prefered functions to our list first
9871     xxx_ld_list=""
9872     for xxx_convert in $gconvert_ld_preference; do
9873         case $xxx_convert in
9874         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9875         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9876         esac
9877     done
9878     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9879     for xxx_convert in qgcvt sprintf $xxx_list; do
9880         case "$xxx_ld_list" in
9881         $xxx_convert*|*" $xxx_convert"*) ;;
9882         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9883         esac
9884     done
9885     : if sprintf cannot do long doubles, move it to the end
9886     if test "$d_PRIgldbl" != "$define"; then
9887         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9888     fi
9889     : if no qgcvt, remove it
9890     if test "$d_qgcvt" != "$define"; then
9891         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9892     fi
9893     : use the ld_list
9894     xxx_list="$xxx_ld_list"
9895     ;;
9896 esac
9897
9898 for xxx_convert in $xxx_list; do
9899         echo "Trying $xxx_convert..."
9900         $rm -f try try$_o core
9901         set try -DTRY_$xxx_convert
9902         if eval $compile; then
9903                 echo "$xxx_convert() found." >&4
9904                 if $run ./try; then
9905                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9906                         break;
9907                 else
9908                         echo "...But $xxx_convert didn't work as I expected."
9909                         xxx_convert=''
9910                 fi
9911         else
9912                 echo "$xxx_convert NOT found." >&4
9913         fi
9914 done
9915
9916 if test X$xxx_convert = X; then
9917     echo "*** WHOA THERE!!! ***" >&4
9918     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9919     xxx_convert=sprintf
9920 fi
9921
9922 case "$xxx_convert" in
9923 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9924 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9925 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9926 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9927    "$define$define$define")
9928       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9929    "$define$define$undef")
9930       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9931    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9932    esac
9933    ;;
9934 esac
9935
9936 fi
9937 $rm_try
9938
9939 : see if _fwalk exists
9940 set fwalk d__fwalk
9941 eval $inlibc
9942
9943 : Initialize h_fcntl
9944 h_fcntl=false
9945
9946 : Initialize h_sysfile
9947 h_sysfile=false
9948
9949 : access call always available on UNIX
9950 set access d_access
9951 eval $inlibc
9952
9953 : locate the flags for 'access()'
9954 case "$d_access" in
9955 "$define")
9956         echo " "
9957         $cat >access.c <<EOCP
9958 #include <sys/types.h>
9959 #ifdef I_FCNTL
9960 #include <fcntl.h>
9961 #endif
9962 #ifdef I_SYS_FILE
9963 #include <sys/file.h>
9964 #endif
9965 #ifdef I_UNISTD
9966 #include <unistd.h>
9967 #endif
9968 #$i_stdlib I_STDLIB
9969 #ifdef I_STDLIB
9970 #include <stdlib.h>
9971 #endif
9972 int main() {
9973         exit(R_OK);
9974 }
9975 EOCP
9976         : check sys/file.h first, no particular reason here
9977         if $test `./findhdr sys/file.h` && \
9978                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9979                 h_sysfile=true;
9980                 echo "<sys/file.h> defines the *_OK access constants." >&4
9981         elif $test `./findhdr fcntl.h` && \
9982                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9983                 h_fcntl=true;
9984                 echo "<fcntl.h> defines the *_OK access constants." >&4
9985         elif $test `./findhdr unistd.h` && \
9986                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9987                 echo "<unistd.h> defines the *_OK access constants." >&4
9988         else
9989                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9990         fi
9991         ;;
9992 esac
9993 $rm -f access*
9994
9995 : see if accessx exists
9996 set accessx d_accessx
9997 eval $inlibc
9998
9999 : see if aintl exists
10000 set aintl d_aintl
10001 eval $inlibc
10002
10003 : see if alarm exists
10004 set alarm d_alarm
10005 eval $inlibc
10006
10007 : see if 64bit time functions exists
10008
10009 set ctime64 d_ctime64
10010 eval $inlibc
10011
10012 set localtime64 d_localtime64
10013 eval $inlibc
10014
10015 set gmtime64 d_gmtime64
10016 eval $inlibc
10017
10018 set mktime64 d_mktime64
10019 eval $inlibc
10020
10021 set difftime64 d_difftime64
10022 eval $inlibc
10023
10024 set asctime64 d_asctime64
10025 eval $inlibc
10026
10027 : see if POSIX threads are available
10028 set pthread.h i_pthread
10029 eval $inhdr
10030
10031 : define a fucntion to check prototypes
10032 $cat > protochk <<EOSH
10033 $startsh
10034 cc="$cc"
10035 optimize="$optimize"
10036 ccflags="$ccflags"
10037 prototype="$prototype"
10038 define="$define"
10039 rm_try="$rm_try"
10040 usethreads=$usethreads
10041 i_pthread=$i_pthread
10042 pthread_h_first=$pthread_h_first
10043 EOSH
10044
10045 $cat >> protochk <<'EOSH'
10046
10047 $rm_try
10048 foo="$1"
10049 shift
10050 while test $# -ge 2; do
10051         case "$1" in
10052                 $define) echo "#include <$2>" >> try.c ;;
10053                 literal) echo "$2" >> try.c ;;
10054         esac
10055     # Extra magic for the benefit of systems that need pthread.h
10056     # to be included early to correctly detect threadsafe functions.
10057     # Such functions must guarantee themselves, though, that the usethreads
10058     # and i_pthread have been defined, before calling protochk.
10059     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10060         echo "#include <pthread.h>" >> try.c
10061         pthread_h_done=yes
10062     fi
10063     shift 2
10064 done
10065 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10066 cat >> try.c <<'EOCP'
10067 #ifdef CAN_PROTOTYPE
10068 #define _(args) args
10069 #else
10070 #define _(args) ()
10071 #endif
10072 EOCP
10073 echo "$foo" >> try.c
10074 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10075 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10076 status=$?
10077 $rm_try
10078 exit $status
10079 EOSH
10080 chmod +x protochk
10081 $eunicefix protochk
10082
10083 : Define hasproto macro for Configure internal use
10084 hasproto='varname=$1; func=$2; shift; shift;
10085 while $test $# -ge 2; do
10086         case "$1" in
10087         $define) echo "#include <$2>";;
10088         esac ;
10089     shift 2;
10090 done > try.c;
10091 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10092 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10093         echo "$func() prototype found.";
10094         val="$define";
10095 else
10096         echo "$func() prototype NOT found.";
10097         val="$undef";
10098 fi;
10099 set $varname;
10100 eval $setvar;
10101 $rm_try tryout.c'
10102
10103 : see if sys/types.h has to be included
10104 set sys/types.h i_systypes
10105 eval $inhdr
10106
10107 : see if sys/select.h has to be included
10108 set sys/select.h i_sysselct
10109 eval $inhdr
10110
10111 : Define hasfield macro for Configure internal use
10112 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10113 while $test $# -ge 2; do
10114         case "$1" in
10115         $define) echo "#include <$2>";;
10116         esac ;
10117     shift 2;
10118 done > try.c;
10119 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10120 set try;
10121 if eval $compile; then
10122         val="$define";
10123 else
10124         val="$undef";
10125 fi;
10126 set $varname;
10127 eval $setvar;
10128 $rm_try'
10129
10130 : see if we should include time.h, sys/time.h, or both
10131 echo " "
10132 if test "X$timeincl" = X; then
10133         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10134         $echo $n "I'm now running the test program...$c"
10135         $cat >try.c <<EOCP
10136 #include <sys/types.h>
10137 #ifdef I_TIME
10138 #include <time.h>
10139 #endif
10140 #ifdef I_SYSTIME
10141 #ifdef SYSTIMEKERNEL
10142 #define KERNEL
10143 #endif
10144 #include <sys/time.h>
10145 #endif
10146 #ifdef I_SYSSELECT
10147 #include <sys/select.h>
10148 #endif
10149 #$i_stdlib I_STDLIB
10150 #ifdef I_STDLIB
10151 #include <stdlib.h>
10152 #endif
10153 int main()
10154 {
10155         struct tm foo;
10156 #ifdef S_TIMEVAL
10157         struct timeval bar;
10158 #endif
10159 #ifdef S_TIMEZONE
10160         struct timezone tzp;
10161 #endif
10162         if (foo.tm_sec == foo.tm_sec)
10163                 exit(0);
10164 #ifdef S_TIMEVAL
10165         if (bar.tv_sec == bar.tv_sec)
10166                 exit(0);
10167 #endif
10168         exit(1);
10169 }
10170 EOCP
10171         flags=''
10172         for s_timezone in '-DS_TIMEZONE' ''; do
10173         sysselect=''
10174         for s_timeval in '-DS_TIMEVAL' ''; do
10175         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10176         for i_time in '' '-DI_TIME'; do
10177         for i_systime in '-DI_SYSTIME' ''; do
10178                 case "$flags" in
10179                 '') $echo $n ".$c"
10180                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10181                         if eval $compile; then
10182                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10183                                 shift
10184                                 flags="$*"
10185                                 echo " "
10186                                 $echo $n "Succeeded with $flags$c"
10187                         fi
10188                         ;;
10189                 esac
10190         done
10191         done
10192         done
10193         done
10194         done
10195         timeincl=''
10196         echo " "
10197         case "$flags" in
10198         *SYSTIMEKERNEL*) i_systimek="$define"
10199                 timeincl=`./findhdr sys/time.h`
10200                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10201         *) i_systimek="$undef";;
10202         esac
10203         case "$flags" in
10204         *I_TIME*) i_time="$define"
10205                 timeincl=`./findhdr time.h`" $timeincl"
10206                 echo "We'll include <time.h>." >&4;;
10207         *) i_time="$undef";;
10208         esac
10209         case "$flags" in
10210         *I_SYSTIME*) i_systime="$define"
10211                 timeincl=`./findhdr sys/time.h`" $timeincl"
10212                 echo "We'll include <sys/time.h>." >&4;;
10213         *) i_systime="$undef";;
10214         esac
10215         $rm_try
10216 fi
10217 : see if struct tm knows about tm_zone
10218 case "$i_systime$i_time" in
10219 *$define*)
10220         echo " "
10221         echo "Checking to see if your struct tm has tm_zone field..." >&4
10222         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10223         eval $hasfield
10224         ;;
10225 *)      val="$undef"
10226         set d_tm_tm_zone
10227         eval $setvar
10228         ;;
10229 esac
10230 case "$d_tm_tm_zone" in
10231 "$define")      echo "Yes, it does."   ;;
10232 *)              echo "No, it doesn't." ;;
10233 esac
10234 : see if struct tm knows about tm_gmtoff
10235 case "$i_systime$i_time" in
10236 *$define*)
10237         echo " "
10238         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10239         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10240         eval $hasfield
10241         ;;
10242 *)      val="$undef"
10243         set d_tm_tm_gmtoff
10244         eval $setvar
10245         ;;
10246 esac
10247 case "$d_tm_tm_gmtoff" in
10248 "$define")      echo "Yes, it does."   ;;
10249 *)              echo "No, it doesn't." ;;
10250 esac
10251
10252 : see if asctime_r exists
10253 set asctime_r d_asctime_r
10254 eval $inlibc
10255 case "$d_asctime_r" in
10256 "$define")
10257         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10258         case "$d_asctime_r_proto:$usethreads" in
10259         ":define")      d_asctime_r_proto=define
10260                 set d_asctime_r_proto asctime_r $hdrs
10261                 eval $hasproto ;;
10262         *)      ;;
10263         esac
10264         case "$d_asctime_r_proto" in
10265         define)
10266         case "$asctime_r_proto" in
10267         ''|0) try='char* asctime_r(const struct tm*, char*);'
10268         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10269         esac
10270         case "$asctime_r_proto" in
10271         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10272         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10273         esac
10274         case "$asctime_r_proto" in
10275         ''|0) try='int asctime_r(const struct tm*, char*);'
10276         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10277         esac
10278         case "$asctime_r_proto" in
10279         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10280         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10281         esac
10282         case "$asctime_r_proto" in
10283         ''|0)   d_asctime_r=undef
10284                 asctime_r_proto=0
10285                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10286         * )     case "$asctime_r_proto" in
10287                 REENTRANT_PROTO*) ;;
10288                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10289                 esac
10290                 echo "Prototype: $try" ;;
10291         esac
10292         ;;
10293         *)      case "$usethreads" in
10294                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10295                 esac
10296                 d_asctime_r=undef
10297                 asctime_r_proto=0
10298                 ;;
10299         esac
10300         ;;
10301 *)      asctime_r_proto=0
10302         ;;
10303 esac
10304
10305 : see if atolf exists
10306 set atolf d_atolf
10307 eval $inlibc
10308
10309 : see if atoll exists
10310 set atoll d_atoll
10311 eval $inlibc
10312
10313 : Look for GCC-style attribute format
10314 case "$d_attribute_format" in
10315 '')
10316 echo " "
10317 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10318 $cat >attrib.c <<'EOCP'
10319 #include <stdio.h>
10320 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10321 EOCP
10322 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10323         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10324                 echo "Your C compiler doesn't support __attribute__((format))."
10325                 val="$undef"
10326         else
10327                 echo "Your C compiler supports __attribute__((format))."
10328                 val="$define"
10329         fi
10330 else
10331         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10332         val="$undef"
10333 fi
10334 ;;
10335 *) val="$d_attribute_format" ;;
10336 esac
10337 set d_attribute_format
10338 eval $setvar
10339 $rm -f attrib*
10340
10341 : Look for GCC-style attribute format with null format allowed
10342 case "$d_printf_format_null" in
10343 '') case "$d_attribute_format" in
10344     $define)
10345         echo " "
10346         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10347 $cat >attrib.c <<EOCP
10348 #include <stdio.h>
10349 #$i_stdlib I_STDLIB
10350 #ifdef I_STDLIB
10351 #include <stdlib.h>
10352 #endif
10353 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10354 int null_printf (char* pat,...) { return (int)pat; }
10355 int main () { exit(null_printf(NULL)); }
10356 EOCP
10357         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10358             : run the executable in case it produces a run-time warning
10359             if $run ./attrib >>attrib.out 2>&1; then
10360                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10361                     echo "Your C compiler doesn't allow __printf__ format to be null."
10362                     val="$undef"
10363                 else
10364                     echo "Your C compiler allows __printf__ format to be null."
10365                     val="$define"
10366                 fi
10367             else
10368             echo "Your C compiler executable failed with __printf__ format null."
10369             val="$undef"
10370         fi
10371     else
10372         echo "Your C compiler fails with __printf__ format null."
10373         val="$undef"
10374     fi
10375     ;;
10376     *)  val="$undef" ;;
10377     esac
10378 ;;
10379 *)  val="$d_printf_format_null" ;;
10380 esac
10381 set d_printf_format_null
10382 eval $setvar
10383 $rm -f attrib*
10384
10385 : Look for GCC-style attribute malloc
10386 case "$d_attribute_malloc" in
10387 '')
10388 echo " "
10389 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10390 $cat >attrib.c <<'EOCP'
10391 #include <stdio.h>
10392 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10393 EOCP
10394 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10395         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10396                 echo "Your C compiler doesn't support __attribute__((malloc))."
10397                 val="$undef"
10398         else
10399                 echo "Your C compiler supports __attribute__((malloc))."
10400                 val="$define"
10401         fi
10402 else
10403         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10404         val="$undef"
10405 fi
10406 ;;
10407 *) val="$d_attribute_malloc" ;;
10408 esac
10409 set d_attribute_malloc
10410 eval $setvar
10411 $rm -f attrib*
10412
10413 : Look for GCC-style attribute nonnull
10414 case "$d_attribute_nonnull" in
10415 '')
10416 echo " "
10417 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10418 $cat >attrib.c <<'EOCP'
10419 #include <stdio.h>
10420 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10421 EOCP
10422 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10423         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10424                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10425                 val="$undef"
10426         else
10427                 echo "Your C compiler supports __attribute__((nonnull))."
10428                 val="$define"
10429         fi
10430 else
10431         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10432         val="$undef"
10433 fi
10434 ;;
10435 *) val="$d_attribute_nonnull" ;;
10436 esac
10437 set d_attribute_nonnull
10438 eval $setvar
10439 $rm -f attrib*
10440
10441 : Look for GCC-style attribute noreturn
10442 case "$d_attribute_noreturn" in
10443 '')
10444 echo " "
10445 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10446 $cat >attrib.c <<'EOCP'
10447 #include <stdio.h>
10448 void fall_over_dead( void ) __attribute__((noreturn));
10449 EOCP
10450 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10451         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10452                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10453                 val="$undef"
10454         else
10455                 echo "Your C compiler supports __attribute__((noreturn))."
10456                 val="$define"
10457         fi
10458 else
10459         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10460         val="$undef"
10461 fi
10462 ;;
10463 *) val="$d_attribute_noreturn" ;;
10464 esac
10465 set d_attribute_noreturn
10466 eval $setvar
10467 $rm -f attrib*
10468
10469 : Look for GCC-style attribute pure
10470 case "$d_attribute_pure" in
10471 '')
10472 echo " "
10473 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10474 $cat >attrib.c <<'EOCP'
10475 #include <stdio.h>
10476 int square( int n ) __attribute__((pure));
10477 EOCP
10478 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10479         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10480                 echo "Your C compiler doesn't support __attribute__((pure))."
10481                 val="$undef"
10482         else
10483                 echo "Your C compiler supports __attribute__((pure))."
10484                 val="$define"
10485         fi
10486 else
10487         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10488         val="$undef"
10489 fi
10490 ;;
10491 *) val="$d_attribute_pure" ;;
10492 esac
10493 set d_attribute_pure
10494 eval $setvar
10495 $rm -f attrib*
10496
10497 : Look for GCC-style attribute unused
10498 case "$d_attribute_unused" in
10499 '')
10500 echo " "
10501 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10502 $cat >attrib.c <<'EOCP'
10503 #include <stdio.h>
10504 int do_something( int dummy __attribute__((unused)), int n );
10505 EOCP
10506 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10507         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10508                 echo "Your C compiler doesn't support __attribute__((unused))."
10509                 val="$undef"
10510         else
10511                 echo "Your C compiler supports __attribute__((unused))."
10512                 val="$define"
10513         fi
10514 else
10515         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10516         val="$undef"
10517 fi
10518 ;;
10519 *) val="$d_attribute_unused" ;;
10520 esac
10521 set d_attribute_unused
10522 eval $setvar
10523 $rm -f attrib*
10524
10525 : Look for GCC-style attribute deprecated
10526 case "$d_attribute_deprecated" in
10527 '')
10528 echo " "
10529 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10530 $cat >attrib.c <<'EOCP'
10531 #include <stdio.h>
10532 int I_am_deprecated(void) __attribute__((deprecated));
10533 EOCP
10534 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10535         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10536                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10537                 val="$undef"
10538         else
10539                 echo "Your C compiler supports __attribute__((deprecated))."
10540                 val="$define"
10541         fi
10542 else
10543         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10544         val="$undef"
10545 fi
10546 ;;
10547 *) val="$d_attribute_deprecated" ;;
10548 esac
10549 set d_attribute_deprecated
10550 eval $setvar
10551 $rm -f attrib*
10552
10553 : Look for GCC-style attribute warn_unused_result
10554 case "$d_attribute_warn_unused_result" in
10555 '')
10556 echo " "
10557 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10558 $cat >attrib.c <<'EOCP'
10559 #include <stdio.h>
10560 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10561 EOCP
10562 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10563         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10564                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10565                 val="$undef"
10566         else
10567                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10568                 val="$define"
10569         fi
10570 else
10571         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10572         val="$undef"
10573 fi
10574 ;;
10575 *) val="$d_attribute_warn_unused_result" ;;
10576 esac
10577 set d_attribute_warn_unused_result
10578 eval $setvar
10579 $rm -f attrib*
10580
10581 : see if bcmp exists
10582 set bcmp d_bcmp
10583 eval $inlibc
10584
10585 : see if bcopy exists
10586 set bcopy d_bcopy
10587 eval $inlibc
10588
10589 : see if getpgrp exists
10590 set getpgrp d_getpgrp
10591 eval $inlibc
10592
10593 case "$d_getpgrp" in
10594 "$define")
10595         echo " "
10596         echo "Checking to see which flavor of getpgrp is in use..."
10597         $cat >try.c <<EOP
10598 #$i_unistd I_UNISTD
10599 #include <sys/types.h>
10600 #ifdef I_UNISTD
10601 #  include <unistd.h>
10602 #endif
10603 #$i_stdlib I_STDLIB
10604 #ifdef I_STDLIB
10605 #include <stdlib.h>
10606 #endif
10607 int main()
10608 {
10609         if (getuid() == 0) {
10610                 printf("(I see you are running Configure as super-user...)\n");
10611                 setuid(1);
10612         }
10613 #ifdef TRY_BSD_PGRP
10614         if (getpgrp(1) == 0)
10615                 exit(0);
10616 #else
10617         if (getpgrp() > 0)
10618                 exit(0);
10619 #endif
10620         exit(1);
10621 }
10622 EOP
10623         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10624                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10625                 val="$define"
10626         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10627                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10628                 val="$undef"
10629         else
10630                 echo "I can't seem to compile and run the test program."
10631                 if ./usg; then
10632                         xxx="a USG one, i.e. you use getpgrp()."
10633                 else
10634                         # SVR4 systems can appear rather BSD-ish.
10635                         case "$i_unistd" in
10636                         $undef)
10637                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10638                                 val="$define"
10639                                 ;;
10640                         $define)
10641                                 xxx="probably a USG one, i.e. you use getpgrp()."
10642                                 val="$undef"
10643                                 ;;
10644                         esac
10645                 fi
10646                 echo "Assuming your getpgrp is $xxx" >&4
10647         fi
10648         ;;
10649 *) val="$undef";;
10650 esac
10651 set d_bsdgetpgrp
10652 eval $setvar
10653 $rm_try
10654
10655 : see if setpgrp exists
10656 set setpgrp d_setpgrp
10657 eval $inlibc
10658
10659 case "$d_setpgrp" in
10660 "$define")
10661         echo " "
10662         echo "Checking to see which flavor of setpgrp is in use..."
10663         $cat >try.c <<EOP
10664 #$i_unistd I_UNISTD
10665 #include <sys/types.h>
10666 #ifdef I_UNISTD
10667 #  include <unistd.h>
10668 #endif
10669 #$i_stdlib I_STDLIB
10670 #ifdef I_STDLIB
10671 #include <stdlib.h>
10672 #endif
10673 int main()
10674 {
10675         if (getuid() == 0) {
10676                 printf("(I see you are running Configure as super-user...)\n");
10677                 setuid(1);
10678         }
10679 #ifdef TRY_BSD_PGRP
10680         if (-1 == setpgrp(1, 1))
10681                 exit(0);
10682 #else
10683         if (setpgrp() != -1)
10684                 exit(0);
10685 #endif
10686         exit(1);
10687 }
10688 EOP
10689         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10690                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10691                 val="$define"
10692         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10693                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10694                 val="$undef"
10695         else
10696                 echo "(I can't seem to compile and run the test program.)"
10697                 if ./usg; then
10698                         xxx="a USG one, i.e. you use setpgrp()."
10699                 else
10700                         # SVR4 systems can appear rather BSD-ish.
10701                         case "$i_unistd" in
10702                         $undef)
10703                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10704                                 val="$define"
10705                                 ;;
10706                         $define)
10707                                 xxx="probably a USG one, i.e. you use setpgrp()."
10708                                 val="$undef"
10709                                 ;;
10710                         esac
10711                 fi
10712                 echo "Assuming your setpgrp is $xxx" >&4
10713         fi
10714         ;;
10715 *) val="$undef";;
10716 esac
10717 set d_bsdsetpgrp
10718 eval $setvar
10719 $rm_try
10720
10721 : Look for GCC-style __builtin_choose_expr
10722 case "$d_builtin_choose_expr" in
10723 '')
10724     echo " "
10725     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10726     $cat >try.c <<'EOCP'
10727 #include <assert.h>
10728 #include <stdlib.h>
10729 #include <stdio.h>
10730
10731 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10732
10733 int main(void) {
10734     assert( SYRINX(1) == 2112 );
10735     assert( SYRINX(1) != 5150 );
10736     assert( SYRINX(0) == 5150 );
10737     assert( SYRINX(0) != 2112 );
10738     puts( "All good!" );
10739     exit(0);
10740 }
10741
10742 EOCP
10743     set try
10744     if eval $compile && $run ./try; then
10745         echo "Your C compiler supports __builtin_choose_expr."
10746         val="$define"
10747     else
10748         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10749         val="$undef"
10750     fi
10751 ;;
10752 *) val="$d_builtin_choose_expr" ;;
10753 esac
10754
10755 set d_builtin_choose_expr
10756 eval $setvar
10757 $rm_try
10758
10759 : Look for GCC-style __builtin_expect
10760 case "$d_builtin_expect" in
10761 '')
10762     echo " "
10763     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10764     $cat >try.c <<'EOCP'
10765 int main(void) {
10766     int n = 50;
10767     if ( __builtin_expect(n, 0) ) n = 1;
10768     /* Remember shell exit code truth is 0, C truth is non-zero */
10769     return !(n == 1);
10770 }
10771 EOCP
10772     set try
10773     if eval $compile && $run ./try; then
10774         echo "Your C compiler supports __builtin_expect."
10775         val="$define"
10776     else
10777         echo "Your C compiler doesn't seem to understand __builtin_expect."
10778         val="$undef"
10779     fi
10780     ;;
10781 *) val="$d_builtin_expect" ;;
10782 esac
10783
10784 set d_builtin_expect
10785 eval $setvar
10786 $rm_try
10787
10788 : see if bzero exists
10789 set bzero d_bzero
10790 eval $inlibc
10791
10792 : see if stdarg is available
10793 echo " "
10794 if $test `./findhdr stdarg.h`; then
10795         echo "<stdarg.h> found." >&4
10796         valstd="$define"
10797 else
10798         echo "<stdarg.h> NOT found." >&4
10799         valstd="$undef"
10800 fi
10801
10802 : see if varags is available
10803 echo " "
10804 if $test `./findhdr varargs.h`; then
10805         echo "<varargs.h> found." >&4
10806 else
10807         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10808 fi
10809
10810 : set up the varargs testing programs
10811 $cat > varargs.c <<EOP
10812 #ifdef I_STDARG
10813 #include <stdarg.h>
10814 #endif
10815 #ifdef I_VARARGS
10816 #include <varargs.h>
10817 #endif
10818
10819 #ifdef I_STDARG
10820 int f(char *p, ...)
10821 #else
10822 int f(va_alist)
10823 va_dcl
10824 #endif
10825 {
10826         va_list ap;
10827 #ifndef I_STDARG
10828         char *p;
10829 #endif
10830 #ifdef I_STDARG
10831         va_start(ap,p);
10832 #else
10833         va_start(ap);
10834         p = va_arg(ap, char *);
10835 #endif
10836         va_end(ap);
10837         return 0;
10838 }
10839 EOP
10840 $cat > varargs <<EOP
10841 $startsh
10842 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10843         echo "true"
10844 else
10845         echo "false"
10846 fi
10847 $rm -f varargs$_o
10848 EOP
10849 chmod +x varargs
10850
10851 : now check which varargs header should be included
10852 echo " "
10853 i_varhdr=''
10854 case "$valstd" in
10855 "$define")
10856         if `./varargs I_STDARG`; then
10857                 val='stdarg.h'
10858         elif `./varargs I_VARARGS`; then
10859                 val='varargs.h'
10860         fi
10861         ;;
10862 *)
10863         if `./varargs I_VARARGS`; then
10864                 val='varargs.h'
10865         fi
10866         ;;
10867 esac
10868 case "$val" in
10869 '')
10870 echo "I could not find the definition for va_dcl... You have problems..." >&4
10871         val="$undef"; set i_stdarg; eval $setvar
10872         val="$undef"; set i_varargs; eval $setvar
10873         ;;
10874 *)
10875         set i_varhdr
10876         eval $setvar
10877         case "$i_varhdr" in
10878         stdarg.h)
10879                 val="$define"; set i_stdarg; eval $setvar
10880                 val="$undef"; set i_varargs; eval $setvar
10881                 ;;
10882         varargs.h)
10883                 val="$undef"; set i_stdarg; eval $setvar
10884                 val="$define"; set i_varargs; eval $setvar
10885                 ;;
10886         esac
10887         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10888 esac
10889 $rm -f varargs*
10890
10891 : see if the Compiler supports C99 variadic macros
10892 case "$i_stdarg$i_stdlib" in
10893     "$define$define")
10894     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10895     $cat >try.c <<EOCP
10896 #include <stdio.h>
10897 #include <stdarg.h>
10898
10899 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10900
10901 int main() {
10902   char buf[20];
10903   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10904   puts(buf);
10905   return 0;
10906 }
10907 EOCP
10908     set try
10909     if eval $compile && $run ./try 2>&1 >/dev/null; then
10910         case "`$run ./try`" in
10911             "123 456 789")
10912             echo "You have C99 variadic macros." >&4
10913             d_c99_variadic_macros="$define"
10914             ;;
10915             *)
10916             echo "You don't have functional C99 variadic macros." >&4
10917             d_c99_variadic_macros="$undef"
10918             ;;
10919         esac
10920     else
10921         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10922         d_c99_variadic_macros="$undef"
10923     fi
10924     $rm_try
10925     ;;
10926     *)
10927     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10928     d_c99_variadic_macros="$undef"
10929     ;;
10930 esac
10931
10932 : see if signal is declared as pointer to function returning int or void
10933 echo " "
10934 xxx=`./findhdr signal.h`
10935 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10936 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10937         echo "You have int (*signal())() instead of void." >&4
10938         val="$undef"
10939 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10940         echo "You have void (*signal())()." >&4
10941         val="$define"
10942 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10943         echo "You have int (*signal())() instead of void." >&4
10944         val="$undef"
10945 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10946         echo "You have void (*signal())()." >&4
10947         val="$define"
10948 else
10949         case "$d_voidsig" in
10950         '')
10951         echo "I can't determine whether signal handler returns void or int..." >&4
10952                 dflt=void
10953                 rp="What type does your signal handler return?"
10954                 . ./myread
10955                 case "$ans" in
10956                 v*) val="$define";;
10957                 *) val="$undef";;
10958                 esac;;
10959         "$define")
10960                 echo "As you already told me, signal handler returns void." >&4
10961                 val="$define"
10962                 ;;
10963         *)      echo "As you already told me, signal handler returns int." >&4
10964                 val="$undef"
10965                 ;;
10966         esac
10967 fi
10968 set d_voidsig
10969 eval $setvar
10970 case "$d_voidsig" in
10971 "$define") signal_t="void";;
10972 *) signal_t="int";;
10973 esac
10974 $rm -f $$.tmp
10975
10976 : check for ability to cast large floats to 32-bit ints.
10977 echo " "
10978 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10979 if $test "$intsize" -ge 4; then
10980         xxx=int
10981 else
10982         xxx=long
10983 fi
10984 $cat >try.c <<EOCP
10985 #include <stdio.h>
10986 #$i_stdlib I_STDLIB
10987 #ifdef I_STDLIB
10988 #include <stdlib.h>
10989 #endif
10990 #include <sys/types.h>
10991 #include <signal.h>
10992 $signal_t blech(int s) { exit(3); }
10993 int main()
10994 {
10995         $xxx i32;
10996         double f, g;
10997         int result = 0;
10998         char str[16];
10999         signal(SIGFPE, blech);
11000
11001         /* Don't let compiler optimize the test away.  Store the number
11002            in a writable string for gcc to pass to sscanf under HP/UX.
11003         */
11004         sprintf(str, "2147483647");
11005         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11006         g = 10 * f;
11007         i32  = ($xxx) g;
11008
11009         /* x86 processors will probably give 0x8000 0000, which is a
11010            sign change.  We don't want that.  We want to mimic SPARC
11011            behavior here, which is to preserve the sign and give
11012            back 0x7fff ffff.
11013         */
11014         if (i32 != ($xxx) f)
11015                 result |= 1;
11016         exit(result);
11017 }
11018 EOCP
11019 set try
11020 if eval $compile_ok; then
11021         $run ./try
11022         yyy=$?
11023 else
11024         echo "(I can't seem to compile the test program--assuming it can't)"
11025         yyy=1
11026 fi
11027 case "$yyy" in
11028 0)      val="$define"
11029         echo "Yup, it can."
11030         ;;
11031 *)      val="$undef"
11032         echo "Nope, it can't."
11033         ;;
11034 esac
11035 set d_casti32
11036 eval $setvar
11037 $rm_try
11038
11039 : check for ability to cast negative floats to unsigned
11040 echo " "
11041 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11042 $cat >try.c <<EOCP
11043 #include <stdio.h>
11044 #$i_stdlib I_STDLIB
11045 #ifdef I_STDLIB
11046 #include <stdlib.h>
11047 #endif
11048 #include <sys/types.h>
11049 #include <signal.h>
11050 $signal_t blech(int s) { exit(7); }
11051 $signal_t blech_in_list(int s) { exit(4); }
11052 unsigned long dummy_long(unsigned long p) { return p; }
11053 unsigned int dummy_int(unsigned int p) { return p; }
11054 unsigned short dummy_short(unsigned short p) { return p; }
11055 int main()
11056 {
11057         double f;
11058         unsigned long along;
11059         unsigned int aint;
11060         unsigned short ashort;
11061         int result = 0;
11062         char str[16];
11063
11064         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11065            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11066            optimized the whole file away
11067         */
11068         /* Store the number in a writable string for gcc to pass to
11069            sscanf under HP/UX.
11070         */
11071         sprintf(str, "-123");
11072         sscanf(str, "%lf", &f);  /* f = -123.; */
11073
11074         signal(SIGFPE, blech);
11075         along = (unsigned long)f;
11076         aint = (unsigned int)f;
11077         ashort = (unsigned short)f;
11078         if (along != (unsigned long)-123)
11079                 result |= 1;
11080         if (aint != (unsigned int)-123)
11081                 result |= 1;
11082         if (ashort != (unsigned short)-123)
11083                 result |= 1;
11084         sprintf(str, "1073741824.");
11085         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11086         f = f + f;
11087         along = 0;
11088         along = (unsigned long)f;
11089         if (along != 0x80000000)
11090                 result |= 2;
11091         f -= 1.;
11092         along = 0;
11093         along = (unsigned long)f;
11094         if (along != 0x7fffffff)
11095                 result |= 1;
11096         f += 2.;
11097         along = 0;
11098         along = (unsigned long)f;
11099         if (along != 0x80000001)
11100                 result |= 2;
11101         if (result)
11102                 exit(result);
11103         signal(SIGFPE, blech_in_list);
11104         sprintf(str, "123.");
11105         sscanf(str, "%lf", &f);  /* f = 123.; */
11106         along = dummy_long((unsigned long)f);
11107         aint = dummy_int((unsigned int)f);
11108         ashort = dummy_short((unsigned short)f);
11109         if (along != (unsigned long)123)
11110                 result |= 4;
11111         if (aint != (unsigned int)123)
11112                 result |= 4;
11113         if (ashort != (unsigned short)123)
11114                 result |= 4;
11115         exit(result);
11116
11117 }
11118 EOCP
11119 set try
11120 if eval $compile_ok; then
11121         $run ./try
11122         castflags=$?
11123 else
11124         echo "(I can't seem to compile the test program--assuming it can't)"
11125         castflags=7
11126 fi
11127 case "$castflags" in
11128 0)      val="$define"
11129         echo "Yup, it can."
11130         ;;
11131 *)      val="$undef"
11132         echo "Nope, it can't."
11133         ;;
11134 esac
11135 set d_castneg
11136 eval $setvar
11137 $rm_try
11138
11139 : see if vprintf exists
11140 echo " "
11141 if set vprintf val -f d_vprintf; eval $csym; $val; then
11142         echo 'vprintf() found.' >&4
11143         val="$define"
11144         $cat >try.c <<EOF
11145 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11146 #$i_varargs I_VARARGS
11147
11148 #$i_stdlib I_STDLIB
11149 #$i_unistd I_UNISTD
11150
11151 #ifdef I_STDARG
11152 #  include <stdarg.h>
11153 #else /* I_VARARGS */
11154 #  include <varargs.h>
11155 #endif
11156
11157 #ifdef I_UNISTD
11158 #  include <unistd.h>
11159 #endif
11160
11161 #ifdef I_STDLIB
11162 #  include <stdlib.h>
11163 #endif
11164
11165 #include <stdio.h> /* vsprintf prototype */
11166
11167 #ifdef I_STDARG
11168 void xxx(int n, ...)
11169 {
11170     va_list args;
11171     char buf[10];
11172     va_start(args, n);
11173     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11174 }
11175 int main() { xxx(1, "foo"); }
11176
11177 #else /* I_VARARGS */
11178
11179 xxx(va_alist)
11180 va_dcl
11181 {
11182     va_list args;
11183     char buf[10];
11184     va_start(args);
11185     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11186 }
11187 int main() { xxx("foo"); }
11188
11189 #endif
11190
11191 EOF
11192         set try
11193         if eval $compile_ok; then
11194                 if $run ./try; then
11195                         echo "Your vsprintf() returns (int)." >&4
11196                         val2="$undef"
11197                 else
11198                         echo "Your vsprintf() returns (char*)." >&4
11199                         val2="$define"
11200                 fi
11201         else
11202                 echo 'I am unable to compile the vsprintf() test program.' >&4
11203                 # We shouldn't get here.  If we do, assume the standard signature,
11204                 # not the old BSD one.
11205                 echo 'Guessing that vsprintf() returns (int).' >&4
11206                 val2="$undef"
11207         fi
11208 else
11209         echo 'vprintf() NOT found.' >&4
11210         val="$undef"
11211         val2="$undef"
11212 fi
11213 $rm_try
11214 set d_vprintf
11215 eval $setvar
11216 val=$val2
11217 set d_charvspr
11218 eval $setvar
11219
11220 : see if chown exists
11221 set chown d_chown
11222 eval $inlibc
11223
11224 : see if chroot exists
11225 set chroot d_chroot
11226 eval $inlibc
11227
11228 : see if chsize exists
11229 set chsize d_chsize
11230 eval $inlibc
11231
11232 : see if class exists
11233 set class d_class
11234 eval $inlibc
11235
11236 : see if clearenv exists
11237 set clearenv d_clearenv
11238 eval $inlibc
11239
11240 : Define hasstruct macro for Configure internal use
11241 hasstruct='varname=$1; struct=$2; shift; shift;
11242 while $test $# -ge 2; do
11243         case "$1" in
11244         $define) echo "#include <$2>";;
11245         esac ;
11246     shift 2;
11247 done > try.c;
11248 echo "int main () { struct $struct foo; }" >> try.c;
11249 set try;
11250 if eval $compile; then
11251         val="$define";
11252 else
11253         val="$undef";
11254 fi;
11255 set $varname;
11256 eval $setvar;
11257 $rm_try'
11258
11259 : see whether socket exists
11260 socketlib=''
11261 sockethdr=''
11262 echo " "
11263 $echo $n "Hmm... $c" >&4
11264 if set socket val -f d_socket; eval $csym; $val; then
11265         echo "Looks like you have Berkeley networking support." >&4
11266         d_socket="$define"
11267         if set setsockopt val -f; eval $csym; $val; then
11268                 d_oldsock="$undef"
11269         else
11270                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11271                 d_oldsock="$define"
11272         fi
11273 else
11274         if $contains socklib libc.list >/dev/null 2>&1; then
11275                 echo "Looks like you have Berkeley networking support." >&4
11276                 d_socket="$define"
11277                 : we will have to assume that it supports the 4.2 BSD interface
11278                 d_oldsock="$undef"
11279         else
11280                 echo "You don't have Berkeley networking in libc$_a..." >&4
11281                 if test "X$d_socket" = "X$define"; then
11282                    echo "...but you seem to believe that you have sockets." >&4
11283                 else
11284                         for net in net socket
11285                         do
11286                                 if test -f /usr/lib/lib$net$_a; then
11287                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11288                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11289                                         if $contains socket libc.list >/dev/null 2>&1; then
11290                                                 d_socket="$define"
11291                                                 socketlib="-l$net"
11292                                                 case "$net" in
11293                                                 net)
11294                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11295                                                         sockethdr="-I/usr/netinclude"
11296                                                         ;;
11297                                                 esac
11298                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11299                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11300                                                         d_oldsock="$undef"
11301                                                 else
11302                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11303                                                         d_oldsock="$define"
11304                                                 fi
11305                                                 break
11306                                         fi
11307                                 fi
11308                         done
11309                         if test "X$d_socket" != "X$define"; then
11310                            echo "or anywhere else I see." >&4
11311                            d_socket="$undef"
11312                            d_oldsock="$undef"
11313                         fi
11314                 fi
11315         fi
11316 fi
11317
11318 : see if socketpair exists
11319 set socketpair d_sockpair
11320 eval $inlibc
11321
11322
11323 echo " "
11324 echo "Checking the availability of certain socket constants..." >&4
11325 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11326         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11327         $cat >try.c <<EOF
11328 #include <sys/types.h>
11329 #include <sys/socket.h>
11330 int main() {
11331     int i = $ENUM;
11332 }
11333 EOF
11334         val="$undef"
11335         set try; if eval $compile; then
11336                 val="$define"
11337         fi
11338         set d_${enum}; eval $setvar
11339         $rm_try
11340 done
11341
11342 : see if this is a sys/uio.h system
11343 set sys/uio.h i_sysuio
11344 eval $inhdr
11345
11346 : Check for cmsghdr support
11347 echo " "
11348 echo "Checking to see if your system supports struct cmsghdr..." >&4
11349 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11350 eval $hasstruct
11351 case "$d_cmsghdr_s" in
11352 "$define")      echo "Yes, it does."   ;;
11353 *)              echo "No, it doesn't." ;;
11354 esac
11355
11356
11357 : check for const keyword
11358 echo " "
11359 echo 'Checking to see if your C compiler knows about "const"...' >&4
11360 $cat >const.c <<'EOCP'
11361 typedef struct spug { int drokk; } spug;
11362 int main()
11363 {
11364         const char *foo;
11365         const spug y = { 0 };
11366 }
11367 EOCP
11368 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11369         val="$define"
11370         echo "Yup, it does."
11371 else
11372         val="$undef"
11373         echo "Nope, it doesn't."
11374 fi
11375 set d_const
11376 eval $setvar
11377
11378 : see if copysignl exists
11379 set copysignl d_copysignl
11380 eval $inlibc
11381
11382 : see if crypt exists
11383 echo " "
11384 set crypt d_crypt
11385 eval $inlibc
11386 case "$d_crypt" in
11387 $define) cryptlib='' ;;
11388 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11389                 echo 'crypt() found.' >&4
11390                 val="$define"
11391                 cryptlib=''
11392         else
11393                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11394                 if $test -z "$cryptlib"; then
11395                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11396                 else
11397                         cryptlib=-lcrypt
11398                 fi
11399                 if $test -z "$cryptlib"; then
11400                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11401                 else
11402                         cryptlib=-lcrypt
11403                 fi
11404                 if $test -z "$cryptlib"; then
11405                         cryptlib=`./loc libcrypt$_a "" $libpth`
11406                 else
11407                         cryptlib=-lcrypt
11408                 fi
11409                 if $test -z "$cryptlib"; then
11410                         echo 'crypt() NOT found.' >&4
11411                         val="$undef"
11412                 else
11413                         val="$define"
11414                 fi
11415         fi
11416         set d_crypt
11417         eval $setvar
11418         ;;
11419 esac
11420
11421 : see if this is a crypt.h system
11422 set crypt.h i_crypt
11423 eval $inhdr
11424
11425 : see if crypt_r exists
11426 set crypt_r d_crypt_r
11427 eval $inlibc
11428 case "$d_crypt_r" in
11429 "$define")
11430         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11431         case "$d_crypt_r_proto:$usethreads" in
11432         ":define")      d_crypt_r_proto=define
11433                 set d_crypt_r_proto crypt_r $hdrs
11434                 eval $hasproto ;;
11435         *)      ;;
11436         esac
11437         case "$d_crypt_r_proto" in
11438         define)
11439         case "$crypt_r_proto" in
11440         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11441         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11442         esac
11443         case "$crypt_r_proto" in
11444         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11445         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11446         esac
11447         case "$crypt_r_proto" in
11448         ''|0)   d_crypt_r=undef
11449                 crypt_r_proto=0
11450                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11451         * )     case "$crypt_r_proto" in
11452                 REENTRANT_PROTO*) ;;
11453                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11454                 esac
11455                 echo "Prototype: $try" ;;
11456         esac
11457         ;;
11458         *)      case "$usethreads" in
11459                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11460                 esac
11461                 d_crypt_r=undef
11462                 crypt_r_proto=0
11463                 ;;
11464         esac
11465         ;;
11466 *)      crypt_r_proto=0
11467         ;;
11468 esac
11469
11470 : get csh whereabouts
11471 case "$csh" in
11472 'csh') val="$undef" ;;
11473 *) val="$define" ;;
11474 esac
11475 set d_csh
11476 eval $setvar
11477 : Respect a hint or command line value for full_csh.
11478 case "$full_csh" in
11479 '') full_csh=$csh ;;
11480 esac
11481
11482 : see if ctermid exists
11483 set ctermid d_ctermid
11484 eval $inlibc
11485
11486 : see if ctermid_r exists
11487 set ctermid_r d_ctermid_r
11488 eval $inlibc
11489 case "$d_ctermid_r" in
11490 "$define")
11491         hdrs="$i_systypes sys/types.h define stdio.h "
11492         case "$d_ctermid_r_proto:$usethreads" in
11493         ":define")      d_ctermid_r_proto=define
11494                 set d_ctermid_r_proto ctermid_r $hdrs
11495                 eval $hasproto ;;
11496         *)      ;;
11497         esac
11498         case "$d_ctermid_r_proto" in
11499         define)
11500         case "$ctermid_r_proto" in
11501         ''|0) try='char* ctermid_r(char*);'
11502         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11503         esac
11504         case "$ctermid_r_proto" in
11505         ''|0)   d_ctermid_r=undef
11506                 ctermid_r_proto=0
11507                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11508         * )     case "$ctermid_r_proto" in
11509                 REENTRANT_PROTO*) ;;
11510                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11511                 esac
11512                 echo "Prototype: $try" ;;
11513         esac
11514         ;;
11515         *)      case "$usethreads" in
11516                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11517                 esac
11518                 d_ctermid_r=undef
11519                 ctermid_r_proto=0
11520                 ;;
11521         esac
11522         ;;
11523 *)      ctermid_r_proto=0
11524         ;;
11525 esac
11526
11527 : see if ctime_r exists
11528 set ctime_r d_ctime_r
11529 eval $inlibc
11530 case "$d_ctime_r" in
11531 "$define")
11532         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11533         case "$d_ctime_r_proto:$usethreads" in
11534         ":define")      d_ctime_r_proto=define
11535                 set d_ctime_r_proto ctime_r $hdrs
11536                 eval $hasproto ;;
11537         *)      ;;
11538         esac
11539         case "$d_ctime_r_proto" in
11540         define)
11541         case "$ctime_r_proto" in
11542         ''|0) try='char* ctime_r(const time_t*, char*);'
11543         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11544         esac
11545         case "$ctime_r_proto" in
11546         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11547         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11548         esac
11549         case "$ctime_r_proto" in
11550         ''|0) try='int ctime_r(const time_t*, char*);'
11551         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11552         esac
11553         case "$ctime_r_proto" in
11554         ''|0) try='int ctime_r(const time_t*, char*, int);'
11555         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11556         esac
11557         case "$ctime_r_proto" in
11558         ''|0)   d_ctime_r=undef
11559                 ctime_r_proto=0
11560                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11561         * )     case "$ctime_r_proto" in
11562                 REENTRANT_PROTO*) ;;
11563                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11564                 esac
11565                 echo "Prototype: $try" ;;
11566         esac
11567         ;;
11568         *)      case "$usethreads" in
11569                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11570                 esac
11571                 d_ctime_r=undef
11572                 ctime_r_proto=0
11573                 ;;
11574         esac
11575         ;;
11576 *)      ctime_r_proto=0
11577         ;;
11578 esac
11579
11580 : see if cuserid exists
11581 set cuserid d_cuserid
11582 eval $inlibc
11583
11584 : see if this is a limits.h system
11585 set limits.h i_limits
11586 eval $inhdr
11587
11588 : see if this is a float.h system
11589 set float.h i_float
11590 eval $inhdr
11591
11592 : See if number of significant digits in a double precision number is known
11593 echo " "
11594 $cat >dbl_dig.c <<EOM
11595 #$i_limits I_LIMITS
11596 #$i_float I_FLOAT
11597 #ifdef I_LIMITS
11598 #include <limits.h>
11599 #endif
11600 #ifdef I_FLOAT
11601 #include <float.h>
11602 #endif
11603 #ifdef DBL_DIG
11604 printf("Contains DBL_DIG");
11605 #endif
11606 EOM
11607 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11608 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11609         echo "DBL_DIG found." >&4
11610         val="$define"
11611 else
11612         echo "DBL_DIG NOT found." >&4
11613         val="$undef"
11614 fi
11615 $rm -f dbl_dig.?
11616 set d_dbl_dig
11617 eval $setvar
11618
11619 : see if dbm.h is available
11620 : see if dbmclose exists
11621 set dbmclose d_dbmclose
11622 eval $inlibc
11623
11624 case "$d_dbmclose" in
11625 $define)
11626         set dbm.h i_dbm
11627         eval $inhdr
11628         case "$i_dbm" in
11629         $define)
11630                 val="$undef"
11631                 set i_rpcsvcdbm
11632                 eval $setvar
11633                 ;;
11634         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11635                 eval $inhdr
11636                 ;;
11637         esac
11638         ;;
11639 *)      echo "We won't be including <dbm.h>"
11640         val="$undef"
11641         set i_dbm
11642         eval $setvar
11643         val="$undef"
11644         set i_rpcsvcdbm
11645         eval $setvar
11646         ;;
11647 esac
11648
11649 : see if prototype for dbminit is available
11650 echo " "
11651 set d_dbminitproto dbminit $i_dbm dbm.h
11652 eval $hasproto
11653
11654 : see if difftime exists
11655 set difftime d_difftime
11656 eval $inlibc
11657
11658 : see if this is a dirent system
11659 echo " "
11660 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11661         val="$define"
11662         echo "<dirent.h> found." >&4
11663 else
11664         val="$undef"
11665         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11666                 echo "<sys/dir.h> found." >&4
11667                 echo " "
11668         else
11669                 xinc=`./findhdr sys/ndir.h`
11670         fi
11671         echo "<dirent.h> NOT found." >&4
11672 fi
11673 set i_dirent
11674 eval $setvar
11675
11676 : Look for type of directory structure.
11677 echo " "
11678 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11679
11680 case "$direntrytype" in
11681 ''|' ')
11682         case "$i_dirent" in
11683         $define) guess1='struct dirent' ;;
11684         *) guess1='struct direct'  ;;
11685         esac
11686         ;;
11687 *)      guess1="$direntrytype"
11688         ;;
11689 esac
11690
11691 case "$guess1" in
11692 'struct dirent') guess2='struct direct' ;;
11693 *) guess2='struct dirent' ;;
11694 esac
11695
11696 if $contains "$guess1" try.c >/dev/null 2>&1; then
11697         direntrytype="$guess1"
11698         echo "Your directory entries are $direntrytype." >&4
11699 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11700         direntrytype="$guess2"
11701         echo "Your directory entries seem to be $direntrytype." >&4
11702 else
11703         echo "I don't recognize your system's directory entries." >&4
11704         rp="What type is used for directory entries on this system?"
11705         dflt="$guess1"
11706         . ./myread
11707         direntrytype="$ans"
11708 fi
11709 $rm_try
11710
11711 : see if the directory entry stores field length
11712 echo " "
11713 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11714 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11715         echo "Good, your directory entry keeps length information in d_namlen." >&4
11716         val="$define"
11717 else
11718         echo "Your directory entry does not know about the d_namlen field." >&4
11719         val="$undef"
11720 fi
11721 set d_dirnamlen
11722 eval $setvar
11723 $rm_try
11724
11725 : Look for DIR.dd_fd
11726 case "$i_dirent" in
11727 "$define")
11728     echo "Checking to see if DIR has a dd_fd member variable" >&4
11729     $cat >try.c <<EOCP
11730 #$i_stdlib I_STDLIB
11731 #ifdef I_STDLIB
11732 #include <stdlib.h>
11733 #endif
11734 #include <dirent.h>
11735
11736 int main() {
11737     DIR dir;
11738     dir.dd_fd = 1;
11739     return 0;
11740 }
11741 EOCP
11742     val=$undef
11743     set try
11744     if eval $compile; then
11745         echo "Yes, it does."
11746         val="$define"
11747     else
11748         echo "No, it does not."
11749         val="$undef"
11750     fi
11751     ;;
11752 *)
11753     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11754     val="$undef"
11755     ;;
11756 esac
11757 set d_dir_dd_fd
11758 eval $setvar
11759 $rm_try
11760
11761 : see if this is an sysdir system
11762 set sys/dir.h i_sysdir
11763 eval $inhdr
11764
11765 : see if this is an sysndir system
11766 set sys/ndir.h i_sysndir
11767 eval $inhdr
11768
11769 : Look for dirfd
11770 echo " "
11771 $cat >dirfd.c <<EOM
11772 #include <stdio.h>
11773 #$i_stdlib I_STDLIB
11774 #ifdef I_STDLIB
11775 #include <stdlib.h>
11776 #endif
11777 #$i_dirent I_DIRENT             /**/
11778 #$i_sysdir I_SYS_DIR            /**/
11779 #$i_sysndir I_SYS_NDIR          /**/
11780 #$i_systypes I_SYS_TYPES        /**/
11781 #if defined(I_SYS_TYPES)
11782 #include <sys/types.h>
11783 #endif
11784 #if defined(I_DIRENT)
11785 #include <dirent.h>
11786 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11787 #include <sys/dir.h>
11788 #endif
11789 #else
11790 #ifdef I_SYS_NDIR
11791 #include <sys/ndir.h>
11792 #else
11793 #ifdef I_SYS_DIR
11794 #ifdef hp9000s500
11795 #include <ndir.h>       /* may be wrong in the future */
11796 #else
11797 #include <sys/dir.h>
11798 #endif
11799 #endif
11800 #endif
11801 #endif 
11802 int main() {
11803         DIR *dirp = opendir(".");
11804         if (dirfd(dirp) >= 0)
11805                 exit(0);
11806         else
11807                 exit(1);
11808 }
11809 EOM
11810 val=$undef
11811 set dirfd
11812 if eval $compile; then
11813         val="$define"
11814 fi
11815 case "$val" in
11816 $define)        echo "dirfd() found." >&4       ;;
11817 *)              echo "dirfd() NOT found." >&4   ;;
11818 esac
11819 set d_dirfd
11820 eval $setvar
11821 $rm -f dirfd*
11822
11823 : see if dlerror exists
11824 xxx_runnm="$runnm"
11825 runnm=false
11826 set dlerror d_dlerror
11827 eval $inlibc
11828 runnm="$xxx_runnm"
11829
11830 : see if dlfcn is available
11831 set dlfcn.h i_dlfcn
11832 eval $inhdr
11833
11834 : Check what extension to use for shared libs
11835 case "$usedl" in
11836 $define|y|true)
11837         $cat << EOM
11838
11839 On a few systems, the dynamically loaded modules that perl generates and uses
11840 will need a different extension than shared libs. The default will probably
11841 be appropriate.
11842
11843 EOM
11844         case "$dlext" in
11845         '')     dflt="$so" ;;
11846         *)      dflt="$dlext" ;;
11847         esac
11848         rp='What is the extension of dynamically loaded modules'
11849         . ./myread
11850         dlext="$ans"
11851         ;;
11852 *)
11853         dlext="none"
11854         ;;
11855 esac
11856
11857 : Check if dlsym need a leading underscore
11858 echo " "
11859 val="$undef"
11860
11861 case "$dlsrc" in
11862 dl_dlopen.xs)
11863         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11864         $cat >dyna.c <<'EOM'
11865 fred () { }
11866 EOM
11867
11868 $cat >fred.c<<EOM
11869
11870 #include <stdio.h>
11871 #$i_stdlib I_STDLIB
11872 #ifdef I_STDLIB
11873 #include <stdlib.h>
11874 #endif
11875 #$i_dlfcn I_DLFCN
11876 #ifdef I_DLFCN
11877 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11878 #else
11879 #include <sys/types.h>
11880 #include <nlist.h>
11881 #include <link.h>
11882 #endif
11883
11884 extern int fred() ;
11885
11886 int main()
11887 {
11888     void * handle ;
11889     void * symbol ;
11890 #ifndef RTLD_LAZY
11891     int mode = 1 ;
11892 #else
11893     int mode = RTLD_LAZY ;
11894 #endif
11895     handle = dlopen("./dyna.$dlext", mode) ;
11896     if (handle == NULL) {
11897         printf ("1\n") ;
11898         fflush (stdout) ;
11899         exit(0);
11900     }
11901     symbol = dlsym(handle, "fred") ;
11902     if (symbol == NULL) {
11903         /* try putting a leading underscore */
11904         symbol = dlsym(handle, "_fred") ;
11905         if (symbol == NULL) {
11906             printf ("2\n") ;
11907             fflush (stdout) ;
11908             exit(0);
11909         }
11910         printf ("3\n") ;
11911     }
11912     else
11913         printf ("4\n") ;
11914     fflush (stdout) ;
11915     exit(0);
11916 }
11917 EOM
11918         : Call the object file tmp-dyna.o in case dlext=o.
11919         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11920                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11921                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11922                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11923                 xxx=`$run ./fred`
11924                 case $xxx in
11925                 1)      echo "Test program failed using dlopen." >&4
11926                         echo "Perhaps you should not use dynamic loading." >&4;;
11927                 2)      echo "Test program failed using dlsym." >&4
11928                         echo "Perhaps you should not use dynamic loading." >&4;;
11929                 3)      echo "dlsym needs a leading underscore" >&4
11930                         val="$define" ;;
11931                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11932                 esac
11933         else
11934                 echo "I can't compile and run the test program." >&4
11935                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11936         fi
11937         ;;
11938 esac
11939
11940 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11941
11942 set d_dlsymun
11943 eval $setvar
11944
11945 : see if drand48_r exists
11946 set drand48_r d_drand48_r
11947 eval $inlibc
11948 case "$d_drand48_r" in
11949 "$define")
11950         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11951         case "$d_drand48_r_proto:$usethreads" in
11952         ":define")      d_drand48_r_proto=define
11953                 set d_drand48_r_proto drand48_r $hdrs
11954                 eval $hasproto ;;
11955         *)      ;;
11956         esac
11957         case "$d_drand48_r_proto" in
11958         define)
11959         case "$drand48_r_proto" in
11960         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11961         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11962         esac
11963         case "$drand48_r_proto" in
11964         ''|0)   d_drand48_r=undef
11965                 drand48_r_proto=0
11966                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11967         * )     case "$drand48_r_proto" in
11968                 REENTRANT_PROTO*) ;;
11969                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11970                 esac
11971                 echo "Prototype: $try" ;;
11972         esac
11973         ;;
11974         *)      case "$usethreads" in
11975                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11976                 esac
11977                 d_drand48_r=undef
11978                 drand48_r_proto=0
11979                 ;;
11980         esac
11981         ;;
11982 *)      drand48_r_proto=0
11983         ;;
11984 esac
11985
11986 : see if prototype for drand48 is available
11987 echo " "
11988 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11989 eval $hasproto
11990
11991 : see if dup2 exists
11992 set dup2 d_dup2
11993 eval $inlibc
11994
11995 : see if eaccess exists
11996 set eaccess d_eaccess
11997 eval $inlibc
11998
11999 : see if endgrent exists
12000 set endgrent d_endgrent
12001 eval $inlibc
12002
12003 : see if this is an grp system
12004 set grp.h i_grp
12005 eval $inhdr
12006
12007 case "$i_grp" in
12008 $define)
12009         xxx=`./findhdr grp.h`
12010         $cppstdin $cppflags $cppminus < $xxx >$$.h
12011
12012         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12013                 val="$define"
12014         else
12015                 val="$undef"
12016         fi
12017         set d_grpasswd
12018         eval $setvar
12019
12020         $rm -f $$.h
12021         ;;
12022 *)
12023         val="$undef";
12024         set d_grpasswd; eval $setvar
12025         ;;
12026 esac
12027
12028 : see if endgrent_r exists
12029 set endgrent_r d_endgrent_r
12030 eval $inlibc
12031 case "$d_endgrent_r" in
12032 "$define")
12033         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12034         case "$d_endgrent_r_proto:$usethreads" in
12035         ":define")      d_endgrent_r_proto=define
12036                 set d_endgrent_r_proto endgrent_r $hdrs
12037                 eval $hasproto ;;
12038         *)      ;;
12039         esac
12040         case "$d_endgrent_r_proto" in
12041         define)
12042         case "$endgrent_r_proto" in
12043         ''|0) try='int endgrent_r(FILE**);'
12044         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12045         esac
12046         case "$endgrent_r_proto" in
12047         ''|0) try='void endgrent_r(FILE**);'
12048         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12049         esac
12050         case "$endgrent_r_proto" in
12051         ''|0)   d_endgrent_r=undef
12052                 endgrent_r_proto=0
12053                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12054         * )     case "$endgrent_r_proto" in
12055                 REENTRANT_PROTO*) ;;
12056                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12057                 esac
12058                 echo "Prototype: $try" ;;
12059         esac
12060         ;;
12061         *)      case "$usethreads" in
12062                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12063                 esac
12064                 d_endgrent_r=undef
12065                 endgrent_r_proto=0
12066                 ;;
12067         esac
12068         ;;
12069 *)      endgrent_r_proto=0
12070         ;;
12071 esac
12072
12073 : see if endhostent exists
12074 set endhostent d_endhent
12075 eval $inlibc
12076
12077 : see if this is a netdb.h system
12078 set netdb.h i_netdb
12079 eval $inhdr
12080
12081 : see if endhostent_r exists
12082 set endhostent_r d_endhostent_r
12083 eval $inlibc
12084 case "$d_endhostent_r" in
12085 "$define")
12086         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12087         case "$d_endhostent_r_proto:$usethreads" in
12088         ":define")      d_endhostent_r_proto=define
12089                 set d_endhostent_r_proto endhostent_r $hdrs
12090                 eval $hasproto ;;
12091         *)      ;;
12092         esac
12093         case "$d_endhostent_r_proto" in
12094         define)
12095         case "$endhostent_r_proto" in
12096         ''|0) try='int endhostent_r(struct hostent_data*);'
12097         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12098         esac
12099         case "$endhostent_r_proto" in
12100         ''|0) try='void endhostent_r(struct hostent_data*);'
12101         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12102         esac
12103         case "$endhostent_r_proto" in
12104         ''|0)   d_endhostent_r=undef
12105                 endhostent_r_proto=0
12106                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12107         * )     case "$endhostent_r_proto" in
12108                 REENTRANT_PROTO*) ;;
12109                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12110                 esac
12111                 echo "Prototype: $try" ;;
12112         esac
12113         ;;
12114         *)      case "$usethreads" in
12115                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12116                 esac
12117                 d_endhostent_r=undef
12118                 endhostent_r_proto=0
12119                 ;;
12120         esac
12121         ;;
12122 *)      endhostent_r_proto=0
12123         ;;
12124 esac
12125
12126 : see if endnetent exists
12127 set endnetent d_endnent
12128 eval $inlibc
12129
12130 : see if endnetent_r exists
12131 set endnetent_r d_endnetent_r
12132 eval $inlibc
12133 case "$d_endnetent_r" in
12134 "$define")
12135         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12136         case "$d_endnetent_r_proto:$usethreads" in
12137         ":define")      d_endnetent_r_proto=define
12138                 set d_endnetent_r_proto endnetent_r $hdrs
12139                 eval $hasproto ;;
12140         *)      ;;
12141         esac
12142         case "$d_endnetent_r_proto" in
12143         define)
12144         case "$endnetent_r_proto" in
12145         ''|0) try='int endnetent_r(struct netent_data*);'
12146         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12147         esac
12148         case "$endnetent_r_proto" in
12149         ''|0) try='void endnetent_r(struct netent_data*);'
12150         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12151         esac
12152         case "$endnetent_r_proto" in
12153         ''|0)   d_endnetent_r=undef
12154                 endnetent_r_proto=0
12155                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12156         * )     case "$endnetent_r_proto" in
12157                 REENTRANT_PROTO*) ;;
12158                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12159                 esac
12160                 echo "Prototype: $try" ;;
12161         esac
12162         ;;
12163         *)      case "$usethreads" in
12164                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12165                 esac
12166                 d_endnetent_r=undef
12167                 endnetent_r_proto=0
12168                 ;;
12169         esac
12170         ;;
12171 *)      endnetent_r_proto=0
12172         ;;
12173 esac
12174
12175 : see if endprotoent exists
12176 set endprotoent d_endpent
12177 eval $inlibc
12178
12179 : see if endprotoent_r exists
12180 set endprotoent_r d_endprotoent_r
12181 eval $inlibc
12182 case "$d_endprotoent_r" in
12183 "$define")
12184         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12185         case "$d_endprotoent_r_proto:$usethreads" in
12186         ":define")      d_endprotoent_r_proto=define
12187                 set d_endprotoent_r_proto endprotoent_r $hdrs
12188                 eval $hasproto ;;
12189         *)      ;;
12190         esac
12191         case "$d_endprotoent_r_proto" in
12192         define)
12193         case "$endprotoent_r_proto" in
12194         ''|0) try='int endprotoent_r(struct protoent_data*);'
12195         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12196         esac
12197         case "$endprotoent_r_proto" in
12198         ''|0) try='void endprotoent_r(struct protoent_data*);'
12199         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12200         esac
12201         case "$endprotoent_r_proto" in
12202         ''|0)   d_endprotoent_r=undef
12203                 endprotoent_r_proto=0
12204                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12205         * )     case "$endprotoent_r_proto" in
12206                 REENTRANT_PROTO*) ;;
12207                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12208                 esac
12209                 echo "Prototype: $try" ;;
12210         esac
12211         ;;
12212         *)      case "$usethreads" in
12213                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12214                 esac
12215                 d_endprotoent_r=undef
12216                 endprotoent_r_proto=0
12217                 ;;
12218         esac
12219         ;;
12220 *)      endprotoent_r_proto=0
12221         ;;
12222 esac
12223
12224 : see if endpwent exists
12225 set endpwent d_endpwent
12226 eval $inlibc
12227
12228 : see if this is a pwd.h system
12229 set pwd.h i_pwd
12230 eval $inhdr
12231
12232 case "$i_pwd" in
12233 $define)
12234         xxx=`./findhdr pwd.h`
12235         $cppstdin $cppflags $cppminus < $xxx >$$.h
12236
12237         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12238                 val="$define"
12239         else
12240                 val="$undef"
12241         fi
12242         set d_pwquota
12243         eval $setvar
12244
12245         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12246                 val="$define"
12247         else
12248                 val="$undef"
12249         fi
12250         set d_pwage
12251         eval $setvar
12252
12253         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12254                 val="$define"
12255         else
12256                 val="$undef"
12257         fi
12258         set d_pwchange
12259         eval $setvar
12260
12261         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12262                 val="$define"
12263         else
12264                 val="$undef"
12265         fi
12266         set d_pwclass
12267         eval $setvar
12268
12269         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12270                 val="$define"
12271         else
12272                 val="$undef"
12273         fi
12274         set d_pwexpire
12275         eval $setvar
12276
12277         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12278                 val="$define"
12279         else
12280                 val="$undef"
12281         fi
12282         set d_pwcomment
12283         eval $setvar
12284
12285         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12286                 val="$define"
12287         else
12288                 val="$undef"
12289         fi
12290         set d_pwgecos
12291         eval $setvar
12292
12293         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12294                 val="$define"
12295         else
12296                 val="$undef"
12297         fi
12298         set d_pwpasswd
12299         eval $setvar
12300
12301         $rm -f $$.h
12302         ;;
12303 *)
12304         val="$undef"; 
12305         set d_pwquota; eval $setvar
12306         set d_pwage; eval $setvar
12307         set d_pwchange; eval $setvar
12308         set d_pwclass; eval $setvar
12309         set d_pwexpire; eval $setvar
12310         set d_pwcomment; eval $setvar
12311         set d_pwgecos; eval $setvar
12312         set d_pwpasswd; eval $setvar
12313         ;;
12314 esac
12315
12316 : see if endpwent_r exists
12317 set endpwent_r d_endpwent_r
12318 eval $inlibc
12319 case "$d_endpwent_r" in
12320 "$define")
12321         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12322         case "$d_endpwent_r_proto:$usethreads" in
12323         ":define")      d_endpwent_r_proto=define
12324                 set d_endpwent_r_proto endpwent_r $hdrs
12325                 eval $hasproto ;;
12326         *)      ;;
12327         esac
12328         case "$d_endpwent_r_proto" in
12329         define)
12330         case "$endpwent_r_proto" in
12331         ''|0) try='int endpwent_r(FILE**);'
12332         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12333         esac
12334         case "$endpwent_r_proto" in
12335         ''|0) try='void endpwent_r(FILE**);'
12336         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12337         esac
12338         case "$endpwent_r_proto" in
12339         ''|0)   d_endpwent_r=undef
12340                 endpwent_r_proto=0
12341                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12342         * )     case "$endpwent_r_proto" in
12343                 REENTRANT_PROTO*) ;;
12344                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12345                 esac
12346                 echo "Prototype: $try" ;;
12347         esac
12348         ;;
12349         *)      case "$usethreads" in
12350                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12351                 esac
12352                 d_endpwent_r=undef
12353                 endpwent_r_proto=0
12354                 ;;
12355         esac
12356         ;;
12357 *)      endpwent_r_proto=0
12358         ;;
12359 esac
12360
12361 : see if endservent exists
12362 set endservent d_endsent
12363 eval $inlibc
12364
12365 : see if endservent_r exists
12366 set endservent_r d_endservent_r
12367 eval $inlibc
12368 case "$d_endservent_r" in
12369 "$define")
12370         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12371         case "$d_endservent_r_proto:$usethreads" in
12372         ":define")      d_endservent_r_proto=define
12373                 set d_endservent_r_proto endservent_r $hdrs
12374                 eval $hasproto ;;
12375         *)      ;;
12376         esac
12377         case "$d_endservent_r_proto" in
12378         define)
12379         case "$endservent_r_proto" in
12380         ''|0) try='int endservent_r(struct servent_data*);'
12381         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12382         esac
12383         case "$endservent_r_proto" in
12384         ''|0) try='void endservent_r(struct servent_data*);'
12385         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12386         esac
12387         case "$endservent_r_proto" in
12388         ''|0)   d_endservent_r=undef
12389                 endservent_r_proto=0
12390                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12391         * )     case "$endservent_r_proto" in
12392                 REENTRANT_PROTO*) ;;
12393                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12394                 esac
12395                 echo "Prototype: $try" ;;
12396         esac
12397         ;;
12398         *)      case "$usethreads" in
12399                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12400                 esac
12401                 d_endservent_r=undef
12402                 endservent_r_proto=0
12403                 ;;
12404         esac
12405         ;;
12406 *)      endservent_r_proto=0
12407         ;;
12408 esac
12409
12410 : Locate the flags for 'open()'
12411 echo " "
12412 $cat >try.c <<EOCP
12413 #include <sys/types.h>
12414 #ifdef I_FCNTL
12415 #include <fcntl.h>
12416 #endif
12417 #ifdef I_SYS_FILE
12418 #include <sys/file.h>
12419 #endif
12420 #$i_stdlib I_STDLIB
12421 #ifdef I_STDLIB
12422 #include <stdlib.h>
12423 #endif
12424 int main() {
12425         if(O_RDONLY);
12426 #ifdef O_TRUNC
12427         exit(0);
12428 #else
12429         exit(1);
12430 #endif
12431 }
12432 EOCP
12433 : check sys/file.h first to get FREAD on Sun
12434 if $test `./findhdr sys/file.h` && \
12435                 set try -DI_SYS_FILE && eval $compile; then
12436         h_sysfile=true;
12437         echo "<sys/file.h> defines the O_* constants..." >&4
12438         if $run ./try; then
12439                 echo "and you have the 3 argument form of open()." >&4
12440                 val="$define"
12441         else
12442                 echo "but not the 3 argument form of open().  Oh, well." >&4
12443                 val="$undef"
12444         fi
12445 elif $test `./findhdr fcntl.h` && \
12446                 set try -DI_FCNTL && eval $compile; then
12447         h_fcntl=true;
12448         echo "<fcntl.h> defines the O_* constants..." >&4
12449         if $run ./try; then
12450                 echo "and you have the 3 argument form of open()." >&4
12451                 val="$define"
12452         else
12453                 echo "but not the 3 argument form of open().  Oh, well." >&4
12454                 val="$undef"
12455         fi
12456 else
12457         val="$undef"
12458         echo "I can't find the O_* constant definitions!  You got problems." >&4
12459 fi
12460 set d_open3
12461 eval $setvar
12462 $rm_try
12463
12464 : see if this is a sys/file.h system
12465 val=''
12466 set sys/file.h val
12467 eval $inhdr
12468
12469 : do we need to include sys/file.h ?
12470 case "$val" in
12471 "$define")
12472         echo " "
12473         if $h_sysfile; then
12474                 val="$define"
12475                 echo "We'll be including <sys/file.h>." >&4
12476         else
12477                 val="$undef"
12478                 echo "We won't be including <sys/file.h>." >&4
12479         fi
12480         ;;
12481 *)
12482         h_sysfile=false
12483         ;;
12484 esac
12485 set i_sysfile
12486 eval $setvar
12487
12488 : see if fcntl.h is there
12489 val=''
12490 set fcntl.h val
12491 eval $inhdr
12492
12493 : see if we can include fcntl.h
12494 case "$val" in
12495 "$define")
12496         echo " "
12497         if $h_fcntl; then
12498                 val="$define"
12499                 echo "We'll be including <fcntl.h>." >&4
12500         else
12501                 val="$undef"
12502                 if $h_sysfile; then
12503         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12504                 else
12505                         echo "We won't be including <fcntl.h>." >&4
12506                 fi
12507         fi
12508         ;;
12509 *)
12510         h_fcntl=false
12511         val="$undef"
12512         ;;
12513 esac
12514 set i_fcntl
12515 eval $setvar
12516
12517 : see if fork exists
12518 set fork d_fork
12519 eval $inlibc
12520
12521 : see if pipe exists
12522 set pipe d_pipe
12523 eval $inlibc
12524
12525 : check for non-blocking I/O stuff
12526 case "$h_sysfile" in
12527 true) echo "#include <sys/file.h>" > head.c;;
12528 *)
12529        case "$h_fcntl" in
12530        true) echo "#include <fcntl.h>" > head.c;;
12531        *) echo "#include <sys/fcntl.h>" > head.c;;
12532        esac
12533        ;;
12534 esac
12535 echo " "
12536 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12537 case "$o_nonblock" in
12538 '')
12539         $cat head.c > try.c
12540         $cat >>try.c <<EOCP
12541 #include <stdio.h>
12542 #$i_stdlib I_STDLIB
12543 #ifdef I_STDLIB
12544 #include <stdlib.h>
12545 #endif
12546 #$i_fcntl I_FCNTL
12547 #ifdef I_FCNTL
12548 #include <fcntl.h>
12549 #endif
12550 int main() {
12551 #ifdef O_NONBLOCK
12552         printf("O_NONBLOCK\n");
12553         exit(0);
12554 #endif
12555 #ifdef O_NDELAY
12556         printf("O_NDELAY\n");
12557         exit(0);
12558 #endif
12559 #ifdef FNDELAY
12560         printf("FNDELAY\n");
12561         exit(0);
12562 #endif
12563         exit(0);
12564 }
12565 EOCP
12566         set try
12567         if eval $compile_ok; then
12568                 o_nonblock=`$run ./try`
12569                 case "$o_nonblock" in
12570                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12571                 *) echo "Seems like we can use $o_nonblock.";;
12572                 esac
12573         else
12574                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12575         fi
12576         ;;
12577 *) echo "Using $hint value $o_nonblock.";;
12578 esac
12579 $rm_try
12580
12581 echo " "
12582 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12583 case "$eagain" in
12584 '')
12585         case "$d_fork:$d_pipe" in
12586         define:define)
12587         $cat head.c > try.c
12588         $cat >>try.c <<EOCP
12589 #include <errno.h>
12590 #include <sys/types.h>
12591 #include <signal.h>
12592 #include <stdio.h>
12593 #$i_stdlib I_STDLIB
12594 #ifdef I_STDLIB
12595 #include <stdlib.h>
12596 #endif
12597 #$i_fcntl I_FCNTL
12598 #ifdef I_FCNTL
12599 #include <fcntl.h>
12600 #endif
12601 #define MY_O_NONBLOCK $o_nonblock
12602 #ifndef errno  /* XXX need better Configure test */
12603 extern int errno;
12604 #endif
12605 #$i_unistd I_UNISTD
12606 #ifdef I_UNISTD
12607 #include <unistd.h>
12608 #endif
12609 #$i_string I_STRING
12610 #ifdef I_STRING
12611 #include <string.h>
12612 #else
12613 #include <strings.h>
12614 #endif
12615 $signal_t blech(int x) { exit(3); }
12616 EOCP
12617         $cat >> try.c <<'EOCP'
12618 int main()
12619 {
12620         int pd[2];
12621         int pu[2];
12622         char buf[1];
12623         char string[100];
12624
12625         pipe(pd);       /* Down: child -> parent */
12626         pipe(pu);       /* Up: parent -> child */
12627         if (0 != fork()) {
12628                 int ret;
12629                 close(pd[1]);   /* Parent reads from pd[0] */
12630                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12631 #ifdef F_SETFL
12632                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12633                         exit(1);
12634 #else
12635                 exit(4);
12636 #endif
12637                 signal(SIGALRM, blech);
12638                 alarm(5);
12639                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12640                         exit(2);
12641                 sprintf(string, "%d\n", ret);
12642                 write(2, string, strlen(string));
12643                 alarm(0);
12644 #ifdef EAGAIN
12645                 if (errno == EAGAIN) {
12646                         printf("EAGAIN\n");
12647                         goto ok;
12648                 }
12649 #endif
12650 #ifdef EWOULDBLOCK
12651                 if (errno == EWOULDBLOCK)
12652                         printf("EWOULDBLOCK\n");
12653 #endif
12654         ok:
12655                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12656                 sleep(2);                               /* Give it time to close our pipe */
12657                 alarm(5);
12658                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12659                 alarm(0);
12660                 sprintf(string, "%d\n", ret);
12661                 write(4, string, strlen(string));
12662                 exit(0);
12663         }
12664
12665         close(pd[0]);                   /* We write to pd[1] */
12666         close(pu[1]);                   /* We read from pu[0] */
12667         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12668         close(pd[1]);                   /* Pipe pd is now fully closed! */
12669         exit(0);                                /* Bye bye, thank you for playing! */
12670 }
12671 EOCP
12672         set try
12673         if eval $compile_ok; then
12674                 echo "$startsh" >mtry
12675                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12676                 chmod +x mtry
12677                 ./mtry >/dev/null 2>&1
12678                 case $? in
12679                 0) eagain=`$cat try.out`;;
12680                 1) echo "Could not perform non-blocking setting!";;
12681                 2) echo "I did a successful read() for something that was not there!";;
12682                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12683                 4) echo "Could not find F_SETFL!";;
12684                 *) echo "Something terribly wrong happened during testing.";;
12685                 esac
12686                 rd_nodata=`$cat try.ret`
12687                 echo "A read() system call with no data present returns $rd_nodata."
12688                 case "$rd_nodata" in
12689                 0|-1) ;;
12690                 *)
12691                         echo "(That's peculiar, fixing that to be -1.)"
12692                         rd_nodata=-1
12693                         ;;
12694                 esac
12695                 case "$eagain" in
12696                 '')
12697                         echo "Forcing errno EAGAIN on read() with no data available."
12698                         eagain=EAGAIN
12699                         ;;
12700                 *)
12701                         echo "Your read() sets errno to $eagain when no data is available."
12702                         ;;
12703                 esac
12704                 status=`$cat try.err`
12705                 case "$status" in
12706                 0) echo "And it correctly returns 0 to signal EOF.";;
12707                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12708                 *) echo "However, your read() returns '$status' on EOF??";;
12709                 esac
12710                 val="$define"
12711                 if test "$status" = "$rd_nodata"; then
12712                         echo "WARNING: you can't distinguish between EOF and no data!"
12713                         val="$undef"
12714                 fi
12715         else
12716                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12717                 eagain=EAGAIN
12718         fi
12719         ;;
12720         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12721                 eagain=EAGAIN
12722                 val="$define"
12723                 ;;
12724         esac
12725         set d_eofnblk
12726         eval $setvar
12727         ;;
12728 *)
12729         echo "Using $hint value $eagain."
12730         echo "Your read() returns $rd_nodata when no data is present."
12731         case "$d_eofnblk" in
12732         "$define") echo "And you can see EOF because read() returns 0.";;
12733         "$undef") echo "But you can't see EOF status from read() returned value.";;
12734         *)
12735                 echo "(Assuming you can't see EOF status from read anyway.)"
12736                 d_eofnblk=$undef
12737                 ;;
12738         esac
12739         ;;
12740 esac
12741 $rm_try head.c mtry
12742
12743 : see if _ptr and _cnt from stdio act std
12744 echo " "
12745
12746 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12747         echo "(Looks like you have stdio.h from BSD.)"
12748         case "$stdio_ptr" in
12749         '') stdio_ptr='((fp)->_p)'
12750                 ptr_lval=$define
12751                 ;;
12752         *)      ptr_lval=$d_stdio_ptr_lval;;
12753         esac
12754         case "$stdio_cnt" in
12755         '') stdio_cnt='((fp)->_r)'
12756                 cnt_lval=$define
12757                 ;;
12758         *)      cnt_lval=$d_stdio_cnt_lval;;
12759         esac
12760         case "$stdio_base" in
12761         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12762         esac
12763         case "$stdio_bufsiz" in
12764         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12765         esac
12766 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12767         echo "(Looks like you have stdio.h from Linux.)"
12768         case "$stdio_ptr" in
12769         '') stdio_ptr='((fp)->_IO_read_ptr)'
12770                 ptr_lval=$define
12771                 ;;
12772         *)      ptr_lval=$d_stdio_ptr_lval;;
12773         esac
12774         case "$stdio_cnt" in
12775         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12776                 cnt_lval=$undef
12777                 ;;
12778         *)      cnt_lval=$d_stdio_cnt_lval;;
12779         esac
12780         case "$stdio_base" in
12781         '') stdio_base='((fp)->_IO_read_base)';;
12782         esac
12783         case "$stdio_bufsiz" in
12784         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12785         esac
12786 else
12787         case "$stdio_ptr" in
12788         '') stdio_ptr='((fp)->_ptr)'
12789                 ptr_lval=$define
12790                 ;;
12791         *)      ptr_lval=$d_stdio_ptr_lval;;
12792         esac
12793         case "$stdio_cnt" in
12794         '') stdio_cnt='((fp)->_cnt)'
12795                 cnt_lval=$define
12796                 ;;
12797         *)      cnt_lval=$d_stdio_cnt_lval;;
12798         esac
12799         case "$stdio_base" in
12800         '') stdio_base='((fp)->_base)';;
12801         esac
12802         case "$stdio_bufsiz" in
12803         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12804         esac
12805 fi
12806
12807 : test whether _ptr and _cnt really work
12808 echo "Checking how std your stdio is..." >&4
12809 $cat >try.c <<EOP
12810 #include <stdio.h>
12811 #$i_stdlib I_STDLIB
12812 #ifdef I_STDLIB
12813 #include <stdlib.h>
12814 #endif
12815 #define FILE_ptr(fp)    $stdio_ptr
12816 #define FILE_cnt(fp)    $stdio_cnt
12817 int main() {
12818         FILE *fp = fopen("try.c", "r");
12819         char c = getc(fp);
12820         if (
12821                 18 <= FILE_cnt(fp) &&
12822                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12823         )
12824                 exit(0);
12825         exit(1);
12826 }
12827 EOP
12828 val="$undef"
12829 set try
12830 if eval $compile && $to try.c; then
12831         if $run ./try; then
12832                 echo "Your stdio acts pretty std."
12833                 val="$define"
12834         else
12835                 echo "Your stdio isn't very std."
12836         fi
12837 else
12838         echo "Your stdio doesn't appear very std."
12839 fi
12840 $rm_try
12841
12842 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12843 # direct buffer manipulation no longer works.  The Configure tests
12844 # should be changed to correctly detect this, but until then,
12845 # the following check should at least let perl compile and run.
12846 # (This quick fix should be updated before 5.8.1.)
12847 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12848 # A. Dougherty, June 3, 2002.
12849 case "$d_gnulibc" in
12850 $define)
12851         case "$gnulibc_version" in
12852         2.[01]*)  ;;
12853         2.2) ;;
12854         2.2.[0-9]) ;;
12855         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12856                 val="$undef"
12857                 ;;
12858         esac
12859         ;;
12860 esac
12861 set d_stdstdio
12862 eval $setvar
12863
12864 : Can _ptr be used as an lvalue?
12865 case "$d_stdstdio$ptr_lval" in
12866 $define$define) val=$define ;;
12867 *) val=$undef ;;
12868 esac
12869 set d_stdio_ptr_lval
12870 eval $setvar
12871
12872 : Can _cnt be used as an lvalue?
12873 case "$d_stdstdio$cnt_lval" in
12874 $define$define) val=$define ;;
12875 *) val=$undef ;;
12876 esac
12877 set d_stdio_cnt_lval
12878 eval $setvar
12879
12880
12881 : test whether setting _ptr sets _cnt as a side effect
12882 d_stdio_ptr_lval_sets_cnt="$undef"
12883 d_stdio_ptr_lval_nochange_cnt="$undef"
12884 case "$d_stdio_ptr_lval$d_stdstdio" in
12885 $define$define)
12886         echo "Checking to see what happens if we set the stdio ptr..." >&4
12887 $cat >try.c <<EOP
12888 #include <stdio.h>
12889 /* Can we scream? */
12890 /* Eat dust sed :-) */
12891 /* In the buffer space, no one can hear you scream. */
12892 #$i_stdlib I_STDLIB
12893 #ifdef I_STDLIB
12894 #include <stdlib.h>
12895 #endif
12896 #define FILE_ptr(fp)    $stdio_ptr
12897 #define FILE_cnt(fp)    $stdio_cnt
12898 #include <sys/types.h>
12899 int main() {
12900         FILE *fp = fopen("try.c", "r");
12901         int c;
12902         char *ptr;
12903         size_t cnt;
12904         if (!fp) {
12905             puts("Fail even to read");
12906             exit(1);
12907         }
12908         c = getc(fp); /* Read away the first # */
12909         if (c == EOF) {
12910             puts("Fail even to read");
12911             exit(1);
12912         }
12913         if (!(
12914                 18 <= FILE_cnt(fp) &&
12915                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12916         )) {
12917                 puts("Fail even to read");
12918                 exit (1);
12919         }
12920         ptr = (char*) FILE_ptr(fp);
12921         cnt = (size_t)FILE_cnt(fp);
12922
12923         FILE_ptr(fp) += 42;
12924
12925         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12926                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12927                 exit (1);
12928         }
12929         if (FILE_cnt(fp) <= 20) {
12930                 printf ("Fail (<20 chars to test)");
12931                 exit (1);
12932         }
12933         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12934                 puts("Fail compare");
12935                 exit (1);
12936         }
12937         if (cnt == FILE_cnt(fp)) {
12938                 puts("Pass_unchanged");
12939                 exit (0);
12940         }
12941         if (FILE_cnt(fp) == (cnt - 42)) {
12942                 puts("Pass_changed");
12943                 exit (0);
12944         }
12945         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12946         return 1;
12947
12948 }
12949 EOP
12950         set try
12951         if eval $compile && $to try.c; then
12952                 case `$run ./try` in
12953                 Pass_changed)
12954                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12955                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12956                 Pass_unchanged)
12957                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12958                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12959                 Fail*)
12960                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12961                 *)
12962                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12963         esac
12964         else
12965                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12966         fi
12967         $rm_try
12968         ;;
12969 esac
12970
12971 : see if _base is also standard
12972 val="$undef"
12973 case "$d_stdstdio" in
12974 $define)
12975         $cat >try.c <<EOP
12976 #include <stdio.h>
12977 #$i_stdlib I_STDLIB
12978 #ifdef I_STDLIB
12979 #include <stdlib.h>
12980 #endif
12981 #define FILE_base(fp)   $stdio_base
12982 #define FILE_bufsiz(fp) $stdio_bufsiz
12983 int main() {
12984         FILE *fp = fopen("try.c", "r");
12985         char c = getc(fp);
12986         if (
12987                 19 <= FILE_bufsiz(fp) &&
12988                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12989         )
12990                 exit(0);
12991         exit(1);
12992 }
12993 EOP
12994         set try
12995         if eval $compile && $to try.c; then
12996                 if $run ./try; then
12997                         echo "And its _base field acts std."
12998                         val="$define"
12999                 else
13000                         echo "But its _base field isn't std."
13001                 fi
13002         else
13003                 echo "However, it seems to be lacking the _base field."
13004         fi
13005         $rm_try
13006         ;;
13007 esac
13008 set d_stdiobase
13009 eval $setvar
13010
13011 : see if fast_stdio exists
13012 val="$undef"
13013 case "$d_stdstdio:$d_stdio_ptr_lval" in
13014 "$define:$define")
13015         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13016         *$define*)
13017                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13018                 val="$define"
13019                 ;;
13020         esac
13021         ;;
13022 esac
13023 set d_faststdio
13024 eval $setvar
13025
13026
13027
13028 : see if fchdir exists
13029 set fchdir d_fchdir
13030 eval $inlibc
13031
13032 : see if fchmod exists
13033 set fchmod d_fchmod
13034 eval $inlibc
13035
13036 : see if fchown exists
13037 set fchown d_fchown
13038 eval $inlibc
13039
13040 : see if this is an fcntl system
13041 set fcntl d_fcntl
13042 eval $inlibc
13043
13044 : See if fcntl-based locking works.
13045 echo " "
13046 $cat >try.c <<EOCP
13047 #$i_stdlib I_STDLIB
13048 #ifdef I_STDLIB
13049 #include <stdlib.h>
13050 #endif
13051 #include <unistd.h>
13052 #include <fcntl.h>
13053 #include <signal.h>
13054 $signal_t blech(int x) { exit(3); }
13055 int main() {
13056 #if defined(F_SETLK) && defined(F_SETLKW)
13057      struct flock flock;
13058      int retval, fd;
13059      fd = open("try.c", O_RDONLY);
13060      flock.l_type = F_RDLCK;
13061      flock.l_whence = SEEK_SET;
13062      flock.l_start = flock.l_len = 0;
13063      signal(SIGALRM, blech);
13064      alarm(10);
13065      retval = fcntl(fd, F_SETLK, &flock);
13066      close(fd);
13067      (retval < 0 ? exit(2) : exit(0));
13068 #else
13069      exit(2);
13070 #endif
13071 }
13072 EOCP
13073 echo "Checking if fcntl-based file locking works... "
13074 case "$d_fcntl" in
13075 "$define")
13076         set try
13077         if eval $compile_ok; then
13078                 if $run ./try; then
13079                         echo "Yes, it seems to work."
13080                         val="$define"
13081                 else
13082                         echo "Nope, it didn't work."
13083                         val="$undef"
13084                         case "$?" in
13085                         3) $cat >&4 <<EOM
13086 ***
13087 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13088 *** This is (almost) impossible.
13089 *** If your NFS lock daemons are not feeling well, something like
13090 *** this may happen, please investigate.  Cannot continue, aborting.
13091 ***
13092 EOM
13093                                 exit 1
13094                                 ;;
13095                         esac
13096                 fi
13097         else
13098                 echo "I'm unable to compile the test program, so I'll assume not."
13099                 val="$undef"
13100         fi
13101         ;;
13102 *) val="$undef";
13103         echo "Nope, since you don't even have fcntl()."
13104         ;;
13105 esac
13106 set d_fcntl_can_lock
13107 eval $setvar
13108 $rm_try
13109
13110 : check for fd_set items
13111 $cat <<EOM
13112
13113 Checking to see how well your C compiler handles fd_set and friends ...
13114 EOM
13115 $cat >try.c <<EOCP
13116 #$i_stdlib I_STDLIB
13117 #ifdef I_STDLIB
13118 #include <stdlib.h>
13119 #endif
13120 #$i_systime I_SYS_TIME
13121 #$i_sysselct I_SYS_SELECT
13122 #$d_socket HAS_SOCKET
13123 #include <sys/types.h>
13124 #ifdef HAS_SOCKET
13125 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13126 #endif
13127 #ifdef I_SYS_TIME
13128 #include <sys/time.h>
13129 #endif
13130 #ifdef I_SYS_SELECT
13131 #include <sys/select.h>
13132 #endif
13133 int main() {
13134         fd_set fds;
13135
13136 #ifdef TRYBITS
13137         if(fds.fds_bits);
13138 #endif
13139
13140 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13141         exit(0);
13142 #else
13143         exit(1);
13144 #endif
13145 }
13146 EOCP
13147 set try -DTRYBITS
13148 if eval $compile; then
13149         d_fds_bits="$define"
13150         d_fd_set="$define"
13151         echo "Well, your system knows about the normal fd_set typedef..." >&4
13152         if $run ./try; then
13153                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13154                 d_fd_macros="$define"
13155         else
13156                 $cat >&4 <<'EOM'
13157 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13158 EOM
13159                 d_fd_macros="$undef"
13160         fi
13161 else
13162         $cat <<'EOM'
13163 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13164 EOM
13165         set try
13166         if eval $compile; then
13167                 d_fds_bits="$undef"
13168                 d_fd_set="$define"
13169                 echo "Well, your system has some sort of fd_set available..." >&4
13170                 if $run ./try; then
13171                         echo "and you have the normal fd_set macros." >&4
13172                         d_fd_macros="$define"
13173                 else
13174                         $cat <<'EOM'
13175 but not the normal fd_set macros!  Gross!  More work for me...
13176 EOM
13177                         d_fd_macros="$undef"
13178                 fi
13179         else
13180         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13181                 d_fd_set="$undef"
13182                 d_fds_bits="$undef"
13183                 d_fd_macros="$undef"
13184         fi
13185 fi
13186 $rm_try
13187
13188 : see if fgetpos exists
13189 set fgetpos d_fgetpos
13190 eval $inlibc
13191
13192 : see if finite exists
13193 set finite d_finite
13194 eval $inlibc
13195
13196 : see if finitel exists
13197 set finitel d_finitel
13198 eval $inlibc
13199
13200 : see if flock exists
13201 set flock d_flock
13202 eval $inlibc
13203
13204 : see if prototype for flock is available
13205 echo " "
13206 set d_flockproto flock $i_sysfile sys/file.h
13207 eval $hasproto
13208
13209 : see if fp_class exists
13210 set fp_class d_fp_class
13211 eval $inlibc
13212
13213 : see if pathconf exists
13214 set pathconf d_pathconf
13215 eval $inlibc
13216
13217 : see if fpathconf exists
13218 set fpathconf d_fpathconf
13219 eval $inlibc
13220
13221 : see if fpclass exists
13222 set fpclass d_fpclass
13223 eval $inlibc
13224
13225 : see if fpclassify exists
13226 set fpclassify d_fpclassify
13227 eval $inlibc
13228
13229 : see if fpclassl exists
13230 set fpclassl d_fpclassl
13231 eval $inlibc
13232
13233 : check for fpos64_t
13234 echo " "
13235 echo "Checking to see if you have fpos64_t..." >&4
13236 $cat >try.c <<EOCP
13237 #include <stdio.h>
13238 int main() { fpos64_t x = 7; }
13239 EOCP
13240 set try
13241 if eval $compile; then
13242         val="$define"
13243         echo "You have fpos64_t."
13244 else
13245         val="$undef"
13246         echo "You do not have fpos64_t."
13247         case "$fpossize" in
13248         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13249         esac
13250 fi
13251 $rm_try
13252 set d_fpos64_t
13253 eval $setvar
13254
13255 : see if frexpl exists
13256 set frexpl d_frexpl
13257 eval $inlibc
13258
13259 : see if this is a sys/param system
13260 set sys/param.h i_sysparam
13261 eval $inhdr
13262
13263 : see if this is a sys/mount.h system
13264 set sys/mount.h i_sysmount
13265 eval $inhdr
13266
13267 : Check for fs_data_s
13268 echo " "
13269 echo "Checking to see if your system supports struct fs_data..." >&4
13270 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13271 eval $hasstruct
13272 case "$d_fs_data_s" in
13273 "$define")      echo "Yes, it does."   ;;
13274 *)              echo "No, it doesn't." ;;
13275 esac
13276
13277 : see if fseeko exists
13278 set fseeko d_fseeko
13279 eval $inlibc
13280 case "$longsize" in
13281 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13282 esac
13283
13284 : see if fsetpos exists
13285 set fsetpos d_fsetpos
13286 eval $inlibc
13287
13288 : see if fstatfs exists
13289 set fstatfs d_fstatfs
13290 eval $inlibc
13291
13292 : see if statvfs exists
13293 set statvfs d_statvfs
13294 eval $inlibc
13295
13296 : see if fstatvfs exists
13297 set fstatvfs d_fstatvfs
13298 eval $inlibc
13299
13300
13301 : see if fsync exists
13302 set fsync d_fsync
13303 eval $inlibc
13304
13305 : see if ftello exists
13306 set ftello d_ftello
13307 eval $inlibc
13308 case "$longsize" in
13309 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13310 esac
13311
13312 : check for a working futimes
13313 d_futimes="$undef"
13314 echo " "
13315 echo "Checking if you have a working futimes()" >&4
13316 $cat >try.c <<EOCP
13317 #include <stdio.h>
13318 #include <sys/time.h>
13319 #include <errno.h>
13320 #include <fcntl.h>
13321
13322 int main ()
13323 {
13324     int fd, rv;
13325     fd = open ("try.c", O_RDWR);
13326     if (-1 == fd) exit (1);
13327     rv = futimes (fd, NULL);
13328     exit (rv == -1 ? errno : 0);
13329 }
13330 EOCP
13331 set try
13332 if eval $compile; then
13333     `$run ./try`
13334     rc=$?
13335     case "$rc" in
13336         0)  echo "Yes, you have" >&4
13337             d_futimes="$define"
13338             ;;
13339         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13340             ;;
13341     esac
13342 else
13343     echo "No, it does not (probably harmless)" >&4
13344 fi
13345 $rm_try
13346
13347 : see if ndbm.h is available
13348 set ndbm.h i_ndbm
13349 eval $inhdr
13350 : Compatibility location for RedHat 7.1
13351 set gdbm/ndbm.h i_gdbmndbm
13352 eval $inhdr
13353 : Compatibility location for Debian 4.0
13354 set gdbm-ndbm.h i_gdbm_ndbm
13355 eval $inhdr
13356
13357 val="$undef"
13358 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13359         : see if dbm_open exists
13360         set dbm_open d_dbm_open
13361         eval $inlibc
13362         case "$d_dbm_open" in
13363         $undef)
13364                 i_ndbm="$undef"
13365                 i_gdbmndbm="$undef"
13366                 i_gdbm_ndbm="$undef"
13367                 echo "We won't be including <ndbm.h>"
13368                 val="$undef"
13369                 ;;
13370         *) val="$define"
13371            ;;
13372         esac
13373 fi
13374 set d_ndbm
13375 eval $setvar
13376
13377 ndbm_hdr_protochk='name=$1; hdr=$2;
13378 eval "ihdr=\$""i_$name";
13379 val="$undef";
13380 if $test "$ihdr" = "$define"; then
13381         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13382         case "$d_cplusplus" in
13383         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13384         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13385         esac;
13386         case "$val" in
13387         $define) $echo "Your <$hdr> seems to have prototypes";;
13388         *) $echo "Your <$hdr> does not seem to have prototypes";;
13389         esac;
13390 fi;
13391 set "d_${name}_h_uses_prototypes";
13392 eval $setvar'
13393
13394 set ndbm ndbm.h
13395 eval $ndbm_hdr_protochk
13396 set gdbmndbm gdbm/ndbm.h
13397 eval $ndbm_hdr_protochk
13398 set gdbm_ndbm gdbm-ndbm.h
13399 eval $ndbm_hdr_protochk
13400
13401 : see if getaddrinfo exists
13402 set getaddrinfo d_getaddrinfo
13403 eval $inlibc
13404
13405 : see if getcwd exists
13406 set getcwd d_getcwd
13407 eval $inlibc
13408
13409 : see if getespwnam exists
13410 set getespwnam d_getespwnam
13411 eval $inlibc
13412
13413 : see if getfsstat exists
13414 set getfsstat d_getfsstat
13415 eval $inlibc
13416
13417 : see if getgrent exists
13418 set getgrent d_getgrent
13419 eval $inlibc
13420
13421 : see if getgrent_r exists
13422 set getgrent_r d_getgrent_r
13423 eval $inlibc
13424 case "$d_getgrent_r" in
13425 "$define")
13426         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13427         case "$d_getgrent_r_proto:$usethreads" in
13428         ":define")      d_getgrent_r_proto=define
13429                 set d_getgrent_r_proto getgrent_r $hdrs
13430                 eval $hasproto ;;
13431         *)      ;;
13432         esac
13433         case "$d_getgrent_r_proto" in
13434         define)
13435         case "$getgrent_r_proto" in
13436         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13437         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13438         esac
13439         case "$getgrent_r_proto" in
13440         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13441         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13442         esac
13443         case "$getgrent_r_proto" in
13444         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13445         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13446         esac
13447         case "$getgrent_r_proto" in
13448         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13449         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13450         esac
13451         case "$getgrent_r_proto" in
13452         ''|0) try='int getgrent_r(struct group*, char*, int);'
13453         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13454         esac
13455         case "$getgrent_r_proto" in
13456         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13457         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13458         esac
13459         case "$getgrent_r_proto" in
13460         ''|0)   d_getgrent_r=undef
13461                 getgrent_r_proto=0
13462                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13463         * )     case "$getgrent_r_proto" in
13464                 REENTRANT_PROTO*) ;;
13465                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13466                 esac
13467                 echo "Prototype: $try" ;;
13468         esac
13469         ;;
13470         *)      case "$usethreads" in
13471                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13472                 esac
13473                 d_getgrent_r=undef
13474                 getgrent_r_proto=0
13475                 ;;
13476         esac
13477         ;;
13478 *)      getgrent_r_proto=0
13479         ;;
13480 esac
13481
13482 : see if getgrgid_r exists
13483 set getgrgid_r d_getgrgid_r
13484 eval $inlibc
13485 case "$d_getgrgid_r" in
13486 "$define")
13487         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13488         case "$d_getgrgid_r_proto:$usethreads" in
13489         ":define")      d_getgrgid_r_proto=define
13490                 set d_getgrgid_r_proto getgrgid_r $hdrs
13491                 eval $hasproto ;;
13492         *)      ;;
13493         esac
13494         case "$d_getgrgid_r_proto" in
13495         define)
13496         case "$getgrgid_r_proto" in
13497         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13498         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13499         esac
13500         case "$getgrgid_r_proto" in
13501         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13502         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13503         esac
13504         case "$getgrgid_r_proto" in
13505         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13506         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13507         esac
13508         case "$getgrgid_r_proto" in
13509         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13510         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13511         esac
13512         case "$getgrgid_r_proto" in
13513         ''|0)   d_getgrgid_r=undef
13514                 getgrgid_r_proto=0
13515                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13516         * )     case "$getgrgid_r_proto" in
13517                 REENTRANT_PROTO*) ;;
13518                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13519                 esac
13520                 echo "Prototype: $try" ;;
13521         esac
13522         ;;
13523         *)      case "$usethreads" in
13524                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13525                 esac
13526                 d_getgrgid_r=undef
13527                 getgrgid_r_proto=0
13528                 ;;
13529         esac
13530         ;;
13531 *)      getgrgid_r_proto=0
13532         ;;
13533 esac
13534
13535 : see if getgrnam_r exists
13536 set getgrnam_r d_getgrnam_r
13537 eval $inlibc
13538 case "$d_getgrnam_r" in
13539 "$define")
13540         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13541         case "$d_getgrnam_r_proto:$usethreads" in
13542         ":define")      d_getgrnam_r_proto=define
13543                 set d_getgrnam_r_proto getgrnam_r $hdrs
13544                 eval $hasproto ;;
13545         *)      ;;
13546         esac
13547         case "$d_getgrnam_r_proto" in
13548         define)
13549         case "$getgrnam_r_proto" in
13550         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13551         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13552         esac
13553         case "$getgrnam_r_proto" in
13554         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13555         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13556         esac
13557         case "$getgrnam_r_proto" in
13558         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13559         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13560         esac
13561         case "$getgrnam_r_proto" in
13562         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13563         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13564         esac
13565         case "$getgrnam_r_proto" in
13566         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13567         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13568         esac
13569         case "$getgrnam_r_proto" in
13570         ''|0)   d_getgrnam_r=undef
13571                 getgrnam_r_proto=0
13572                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13573         * )     case "$getgrnam_r_proto" in
13574                 REENTRANT_PROTO*) ;;
13575                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13576                 esac
13577                 echo "Prototype: $try" ;;
13578         esac
13579         ;;
13580         *)      case "$usethreads" in
13581                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13582                 esac
13583                 d_getgrnam_r=undef
13584                 getgrnam_r_proto=0
13585                 ;;
13586         esac
13587         ;;
13588 *)      getgrnam_r_proto=0
13589         ;;
13590 esac
13591
13592 : see if gethostbyaddr exists
13593 set gethostbyaddr d_gethbyaddr
13594 eval $inlibc
13595
13596 : see if gethostbyname exists
13597 set gethostbyname d_gethbyname
13598 eval $inlibc
13599
13600 : see if gethostent exists
13601 set gethostent d_gethent
13602 eval $inlibc
13603
13604 : see how we will look up host name
13605 echo " "
13606 call=''
13607 if set gethostname val -f d_gethname; eval $csym; $val; then
13608         echo 'gethostname() found.' >&4
13609         d_gethname="$define"
13610         call=gethostname
13611 fi
13612 if set uname val -f d_uname; eval $csym; $val; then
13613         if ./xenix; then
13614                 $cat <<'EOM'
13615 uname() was found, but you're running xenix, and older versions of xenix
13616 have a broken uname(). If you don't really know whether your xenix is old
13617 enough to have a broken system call, use the default answer.
13618
13619 EOM
13620                 dflt=y
13621                 case "$d_uname" in
13622                 "$define") dflt=n;;
13623                 esac
13624                 rp='Is your uname() broken?'
13625                 . ./myread
13626                 case "$ans" in
13627                 n*) d_uname="$define"; call=uname;;
13628                 esac
13629         else
13630                 echo 'uname() found.' >&4
13631                 d_uname="$define"
13632                 case "$call" in
13633                 '') call=uname ;;
13634                 esac
13635         fi
13636 fi
13637 case "$d_gethname" in
13638 '') d_gethname="$undef";;
13639 esac
13640 case "$d_uname" in
13641 '') d_uname="$undef";;
13642 esac
13643 case "$d_uname$d_gethname" in
13644 *define*)
13645         dflt=n
13646         cat <<EOM
13647
13648 Every now and then someone has a $call() that lies about the hostname
13649 but can't be fixed for political or economic reasons.  If you wish, I can
13650 pretend $call() isn't there and maybe compute hostname at run-time
13651 thanks to the '$phostname' command.
13652
13653 EOM
13654         rp="Shall I ignore $call() from now on?"
13655         . ./myread
13656         case "$ans" in
13657         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13658         esac;;
13659 esac
13660 case "$phostname" in
13661 '') aphostname='';;
13662 *) case "$aphostname" in
13663         /*) ;;
13664         *) set X $phostname
13665                 shift
13666                 file=$1
13667                 shift
13668                 file=`./loc $file $file $pth`
13669                 aphostname=`echo $file $*`
13670                 ;;
13671         esac
13672         ;;
13673 esac
13674 case "$d_uname$d_gethname" in
13675 *define*) ;;
13676 *)
13677         case "$phostname" in
13678         '')
13679                 echo "There will be no way for $package to get your hostname." >&4;;
13680         *)
13681         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13682                 ;;
13683         esac;;
13684 esac
13685 case "$d_phostname" in
13686 '') d_phostname="$undef";;
13687 esac
13688
13689 : see if gethostbyaddr_r exists
13690 set gethostbyaddr_r d_gethostbyaddr_r
13691 eval $inlibc
13692 case "$d_gethostbyaddr_r" in
13693 "$define")
13694         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13695         case "$d_gethostbyaddr_r_proto:$usethreads" in
13696         ":define")      d_gethostbyaddr_r_proto=define
13697                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13698                 eval $hasproto ;;
13699         *)      ;;
13700         esac
13701         case "$d_gethostbyaddr_r_proto" in
13702         define)
13703         case "$gethostbyaddr_r_proto" in
13704         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13705         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13706         esac
13707         case "$gethostbyaddr_r_proto" in
13708         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13709         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13710         esac
13711         case "$gethostbyaddr_r_proto" in
13712         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13713         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13714         esac
13715         case "$gethostbyaddr_r_proto" in
13716         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13717         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13718         esac
13719         case "$gethostbyaddr_r_proto" in
13720         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13721         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13722         esac
13723         case "$gethostbyaddr_r_proto" in
13724         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13725         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13726         esac
13727         case "$gethostbyaddr_r_proto" in
13728         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13729         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13730         esac
13731         case "$gethostbyaddr_r_proto" in
13732         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13733         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13734         esac
13735         case "$gethostbyaddr_r_proto" in
13736         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13738         esac
13739         case "$gethostbyaddr_r_proto" in
13740         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13741         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13742         esac
13743         case "$gethostbyaddr_r_proto" in
13744         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13745         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13746         esac
13747         case "$gethostbyaddr_r_proto" in
13748         ''|0)   d_gethostbyaddr_r=undef
13749                 gethostbyaddr_r_proto=0
13750                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13751         * )     case "$gethostbyaddr_r_proto" in
13752                 REENTRANT_PROTO*) ;;
13753                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13754                 esac
13755                 echo "Prototype: $try" ;;
13756         esac
13757         ;;
13758         *)      case "$usethreads" in
13759                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13760                 esac
13761                 d_gethostbyaddr_r=undef
13762                 gethostbyaddr_r_proto=0
13763                 ;;
13764         esac
13765         ;;
13766 *)      gethostbyaddr_r_proto=0
13767         ;;
13768 esac
13769
13770 : see if gethostbyname_r exists
13771 set gethostbyname_r d_gethostbyname_r
13772 eval $inlibc
13773 case "$d_gethostbyname_r" in
13774 "$define")
13775         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13776         case "$d_gethostbyname_r_proto:$usethreads" in
13777         ":define")      d_gethostbyname_r_proto=define
13778                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13779                 eval $hasproto ;;
13780         *)      ;;
13781         esac
13782         case "$d_gethostbyname_r_proto" in
13783         define)
13784         case "$gethostbyname_r_proto" in
13785         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13786         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13787         esac
13788         case "$gethostbyname_r_proto" in
13789         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13790         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13791         esac
13792         case "$gethostbyname_r_proto" in
13793         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13794         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13795         esac
13796         case "$gethostbyname_r_proto" in
13797         ''|0)   d_gethostbyname_r=undef
13798                 gethostbyname_r_proto=0
13799                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13800         * )     case "$gethostbyname_r_proto" in
13801                 REENTRANT_PROTO*) ;;
13802                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13803                 esac
13804                 echo "Prototype: $try" ;;
13805         esac
13806         ;;
13807         *)      case "$usethreads" in
13808                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13809                 esac
13810                 d_gethostbyname_r=undef
13811                 gethostbyname_r_proto=0
13812                 ;;
13813         esac
13814         ;;
13815 *)      gethostbyname_r_proto=0
13816         ;;
13817 esac
13818
13819 : see if gethostent_r exists
13820 set gethostent_r d_gethostent_r
13821 eval $inlibc
13822 case "$d_gethostent_r" in
13823 "$define")
13824         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13825         case "$d_gethostent_r_proto:$usethreads" in
13826         ":define")      d_gethostent_r_proto=define
13827                 set d_gethostent_r_proto gethostent_r $hdrs
13828                 eval $hasproto ;;
13829         *)      ;;
13830         esac
13831         case "$d_gethostent_r_proto" in
13832         define)
13833         case "$gethostent_r_proto" in
13834         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13835         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13836         esac
13837         case "$gethostent_r_proto" in
13838         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13839         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13840         esac
13841         case "$gethostent_r_proto" in
13842         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13843         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13844         esac
13845         case "$gethostent_r_proto" in
13846         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13847         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13848         esac
13849         case "$gethostent_r_proto" in
13850         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13851         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13852         esac
13853         case "$gethostent_r_proto" in
13854         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13855         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13856         esac
13857         case "$gethostent_r_proto" in
13858         ''|0)   d_gethostent_r=undef
13859                 gethostent_r_proto=0
13860                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13861         * )     case "$gethostent_r_proto" in
13862                 REENTRANT_PROTO*) ;;
13863                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13864                 esac
13865                 echo "Prototype: $try" ;;
13866         esac
13867         ;;
13868         *)      case "$usethreads" in
13869                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13870                 esac
13871                 d_gethostent_r=undef
13872                 gethostent_r_proto=0
13873                 ;;
13874         esac
13875         ;;
13876 *)      gethostent_r_proto=0
13877         ;;
13878 esac
13879
13880 : see if prototypes for various gethostxxx netdb.h functions are available
13881 echo " "
13882 set d_gethostprotos gethostent $i_netdb netdb.h
13883 eval $hasproto
13884
13885 : see if getitimer exists
13886 set getitimer d_getitimer
13887 eval $inlibc
13888
13889 : see if getlogin exists
13890 set getlogin d_getlogin
13891 eval $inlibc
13892
13893 : see if getlogin_r exists
13894 set getlogin_r d_getlogin_r
13895 eval $inlibc
13896 case "$d_getlogin_r" in
13897 "$define")
13898         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13899         case "$d_getlogin_r_proto:$usethreads" in
13900         ":define")      d_getlogin_r_proto=define
13901                 set d_getlogin_r_proto getlogin_r $hdrs
13902                 eval $hasproto ;;
13903         *)      ;;
13904         esac
13905         case "$d_getlogin_r_proto" in
13906         define)
13907         case "$getlogin_r_proto" in
13908         ''|0) try='int getlogin_r(char*, size_t);'
13909         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13910         esac
13911         case "$getlogin_r_proto" in
13912         ''|0) try='int getlogin_r(char*, int);'
13913         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13914         esac
13915         case "$getlogin_r_proto" in
13916         ''|0) try='char* getlogin_r(char*, size_t);'
13917         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13918         esac
13919         case "$getlogin_r_proto" in
13920         ''|0) try='char* getlogin_r(char*, int);'
13921         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13922         esac
13923         case "$getlogin_r_proto" in
13924         ''|0)   d_getlogin_r=undef
13925                 getlogin_r_proto=0
13926                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13927         * )     case "$getlogin_r_proto" in
13928                 REENTRANT_PROTO*) ;;
13929                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13930                 esac
13931                 echo "Prototype: $try" ;;
13932         esac
13933         ;;
13934         *)      case "$usethreads" in
13935                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13936                 esac
13937                 d_getlogin_r=undef
13938                 getlogin_r_proto=0
13939                 ;;
13940         esac
13941         ;;
13942 *)      getlogin_r_proto=0
13943         ;;
13944 esac
13945
13946 : see if getmnt exists
13947 set getmnt d_getmnt
13948 eval $inlibc
13949
13950 : see if getmntent exists
13951 set getmntent d_getmntent
13952 eval $inlibc
13953
13954 : see if getnameinfo exists
13955 set getnameinfo d_getnameinfo
13956 eval $inlibc
13957
13958 : see if getnetbyaddr exists
13959 set getnetbyaddr d_getnbyaddr
13960 eval $inlibc
13961
13962 : see if getnetbyname exists
13963 set getnetbyname d_getnbyname
13964 eval $inlibc
13965
13966 : see if getnetent exists
13967 set getnetent d_getnent
13968 eval $inlibc
13969
13970 : see if getnetbyaddr_r exists
13971 set getnetbyaddr_r d_getnetbyaddr_r
13972 eval $inlibc
13973 case "$d_getnetbyaddr_r" in
13974 "$define")
13975         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13976         case "$d_getnetbyaddr_r_proto:$usethreads" in
13977         ":define")      d_getnetbyaddr_r_proto=define
13978                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13979                 eval $hasproto ;;
13980         *)      ;;
13981         esac
13982         case "$d_getnetbyaddr_r_proto" in
13983         define)
13984         case "$getnetbyaddr_r_proto" in
13985         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13986         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13987         esac
13988         case "$getnetbyaddr_r_proto" in
13989         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13990         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13991         esac
13992         case "$getnetbyaddr_r_proto" in
13993         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13994         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13995         esac
13996         case "$getnetbyaddr_r_proto" in
13997         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13998         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13999         esac
14000         case "$getnetbyaddr_r_proto" in
14001         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14002         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14003         esac
14004         case "$getnetbyaddr_r_proto" in
14005         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14006         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14007         esac
14008         case "$getnetbyaddr_r_proto" in
14009         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14010         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14011         esac
14012         case "$getnetbyaddr_r_proto" in
14013         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14014         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14015         esac
14016         case "$getnetbyaddr_r_proto" in
14017         ''|0)   d_getnetbyaddr_r=undef
14018                 getnetbyaddr_r_proto=0
14019                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14020         * )     case "$getnetbyaddr_r_proto" in
14021                 REENTRANT_PROTO*) ;;
14022                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14023                 esac
14024                 echo "Prototype: $try" ;;
14025         esac
14026         ;;
14027         *)      case "$usethreads" in
14028                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14029                 esac
14030                 d_getnetbyaddr_r=undef
14031                 getnetbyaddr_r_proto=0
14032                 ;;
14033         esac
14034         ;;
14035 *)      getnetbyaddr_r_proto=0
14036         ;;
14037 esac
14038
14039 : see if getnetbyname_r exists
14040 set getnetbyname_r d_getnetbyname_r
14041 eval $inlibc
14042 case "$d_getnetbyname_r" in
14043 "$define")
14044         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14045         case "$d_getnetbyname_r_proto:$usethreads" in
14046         ":define")      d_getnetbyname_r_proto=define
14047                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14048                 eval $hasproto ;;
14049         *)      ;;
14050         esac
14051         case "$d_getnetbyname_r_proto" in
14052         define)
14053         case "$getnetbyname_r_proto" in
14054         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14055         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14056         esac
14057         case "$getnetbyname_r_proto" in
14058         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14059         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14060         esac
14061         case "$getnetbyname_r_proto" in
14062         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14063         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14064         esac
14065         case "$getnetbyname_r_proto" in
14066         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14067         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14068         esac
14069         case "$getnetbyname_r_proto" in
14070         ''|0)   d_getnetbyname_r=undef
14071                 getnetbyname_r_proto=0
14072                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14073         * )     case "$getnetbyname_r_proto" in
14074                 REENTRANT_PROTO*) ;;
14075                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14076                 esac
14077                 echo "Prototype: $try" ;;
14078         esac
14079         ;;
14080         *)      case "$usethreads" in
14081                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14082                 esac
14083                 d_getnetbyname_r=undef
14084                 getnetbyname_r_proto=0
14085                 ;;
14086         esac
14087         ;;
14088 *)      getnetbyname_r_proto=0
14089         ;;
14090 esac
14091
14092 : see if getnetent_r exists
14093 set getnetent_r d_getnetent_r
14094 eval $inlibc
14095 case "$d_getnetent_r" in
14096 "$define")
14097         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14098         case "$d_getnetent_r_proto:$usethreads" in
14099         ":define")      d_getnetent_r_proto=define
14100                 set d_getnetent_r_proto getnetent_r $hdrs
14101                 eval $hasproto ;;
14102         *)      ;;
14103         esac
14104         case "$d_getnetent_r_proto" in
14105         define)
14106         case "$getnetent_r_proto" in
14107         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14108         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14109         esac
14110         case "$getnetent_r_proto" in
14111         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14112         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14113         esac
14114         case "$getnetent_r_proto" in
14115         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14116         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14117         esac
14118         case "$getnetent_r_proto" in
14119         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14120         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14121         esac
14122         case "$getnetent_r_proto" in
14123         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14124         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14125         esac
14126         case "$getnetent_r_proto" in
14127         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14128         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14129         esac
14130         case "$getnetent_r_proto" in
14131         ''|0)   d_getnetent_r=undef
14132                 getnetent_r_proto=0
14133                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14134         * )     case "$getnetent_r_proto" in
14135                 REENTRANT_PROTO*) ;;
14136                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14137                 esac
14138                 echo "Prototype: $try" ;;
14139         esac
14140         ;;
14141         *)      case "$usethreads" in
14142                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14143                 esac
14144                 d_getnetent_r=undef
14145                 getnetent_r_proto=0
14146                 ;;
14147         esac
14148         ;;
14149 *)      getnetent_r_proto=0
14150         ;;
14151 esac
14152
14153 : see if prototypes for various getnetxxx netdb.h functions are available
14154 echo " "
14155 set d_getnetprotos getnetent $i_netdb netdb.h
14156 eval $hasproto
14157
14158 : see if getpagesize exists
14159 set getpagesize d_getpagsz
14160 eval $inlibc
14161
14162 : Optional checks for getprotobyname and getprotobynumber
14163
14164 : see if getprotobyname exists
14165 set getprotobyname d_getpbyname
14166 eval $inlibc
14167
14168 : see if getprotobynumber exists
14169 set getprotobynumber d_getpbynumber
14170 eval $inlibc
14171
14172 : see if getprotoent exists
14173 set getprotoent d_getpent
14174 eval $inlibc
14175
14176 : see if getpgid exists
14177 set getpgid d_getpgid
14178 eval $inlibc
14179
14180 : see if getpgrp2 exists
14181 set getpgrp2 d_getpgrp2
14182 eval $inlibc
14183
14184 : see if getppid exists
14185 set getppid d_getppid
14186 eval $inlibc
14187
14188 : see if getpriority exists
14189 set getpriority d_getprior
14190 eval $inlibc
14191
14192 : see if getprotobyname_r exists
14193 set getprotobyname_r d_getprotobyname_r
14194 eval $inlibc
14195 case "$d_getprotobyname_r" in
14196 "$define")
14197         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14198         case "$d_getprotobyname_r_proto:$usethreads" in
14199         ":define")      d_getprotobyname_r_proto=define
14200                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14201                 eval $hasproto ;;
14202         *)      ;;
14203         esac
14204         case "$d_getprotobyname_r_proto" in
14205         define)
14206         case "$getprotobyname_r_proto" in
14207         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14208         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14209         esac
14210         case "$getprotobyname_r_proto" in
14211         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14212         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14213         esac
14214         case "$getprotobyname_r_proto" in
14215         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14216         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14217         esac
14218         case "$getprotobyname_r_proto" in
14219         ''|0)   d_getprotobyname_r=undef
14220                 getprotobyname_r_proto=0
14221                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14222         * )     case "$getprotobyname_r_proto" in
14223                 REENTRANT_PROTO*) ;;
14224                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14225                 esac
14226                 echo "Prototype: $try" ;;
14227         esac
14228         ;;
14229         *)      case "$usethreads" in
14230                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14231                 esac
14232                 d_getprotobyname_r=undef
14233                 getprotobyname_r_proto=0
14234                 ;;
14235         esac
14236         ;;
14237 *)      getprotobyname_r_proto=0
14238         ;;
14239 esac
14240
14241 : see if getprotobynumber_r exists
14242 set getprotobynumber_r d_getprotobynumber_r
14243 eval $inlibc
14244 case "$d_getprotobynumber_r" in
14245 "$define")
14246         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14247         case "$d_getprotobynumber_r_proto:$usethreads" in
14248         ":define")      d_getprotobynumber_r_proto=define
14249                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14250                 eval $hasproto ;;
14251         *)      ;;
14252         esac
14253         case "$d_getprotobynumber_r_proto" in
14254         define)
14255         case "$getprotobynumber_r_proto" in
14256         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14257         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14258         esac
14259         case "$getprotobynumber_r_proto" in
14260         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14261         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14262         esac
14263         case "$getprotobynumber_r_proto" in
14264         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14265         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14266         esac
14267         case "$getprotobynumber_r_proto" in
14268         ''|0)   d_getprotobynumber_r=undef
14269                 getprotobynumber_r_proto=0
14270                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14271         * )     case "$getprotobynumber_r_proto" in
14272                 REENTRANT_PROTO*) ;;
14273                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14274                 esac
14275                 echo "Prototype: $try" ;;
14276         esac
14277         ;;
14278         *)      case "$usethreads" in
14279                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14280                 esac
14281                 d_getprotobynumber_r=undef
14282                 getprotobynumber_r_proto=0
14283                 ;;
14284         esac
14285         ;;
14286 *)      getprotobynumber_r_proto=0
14287         ;;
14288 esac
14289
14290 : see if getprotoent_r exists
14291 set getprotoent_r d_getprotoent_r
14292 eval $inlibc
14293 case "$d_getprotoent_r" in
14294 "$define")
14295         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14296         case "$d_getprotoent_r_proto:$usethreads" in
14297         ":define")      d_getprotoent_r_proto=define
14298                 set d_getprotoent_r_proto getprotoent_r $hdrs
14299                 eval $hasproto ;;
14300         *)      ;;
14301         esac
14302         case "$d_getprotoent_r_proto" in
14303         define)
14304         case "$getprotoent_r_proto" in
14305         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14306         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14307         esac
14308         case "$getprotoent_r_proto" in
14309         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14310         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14311         esac
14312         case "$getprotoent_r_proto" in
14313         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14314         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14315         esac
14316         case "$getprotoent_r_proto" in
14317         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14318         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14319         esac
14320         case "$getprotoent_r_proto" in
14321         ''|0)   d_getprotoent_r=undef
14322                 getprotoent_r_proto=0
14323                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14324         * )     case "$getprotoent_r_proto" in
14325                 REENTRANT_PROTO*) ;;
14326                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14327                 esac
14328                 echo "Prototype: $try" ;;
14329         esac
14330         ;;
14331         *)      case "$usethreads" in
14332                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14333                 esac
14334                 d_getprotoent_r=undef
14335                 getprotoent_r_proto=0
14336                 ;;
14337         esac
14338         ;;
14339 *)      getprotoent_r_proto=0
14340         ;;
14341 esac
14342
14343 : see if prototypes for various getprotoxxx netdb.h functions are available
14344 echo " "
14345 set d_getprotoprotos getprotoent $i_netdb netdb.h
14346 eval $hasproto
14347
14348 : see if getprpwnam exists
14349 set getprpwnam d_getprpwnam
14350 eval $inlibc
14351
14352 : see if getpwent exists
14353 set getpwent d_getpwent
14354 eval $inlibc
14355
14356 : see if getpwent_r exists
14357 set getpwent_r d_getpwent_r
14358 eval $inlibc
14359 case "$d_getpwent_r" in
14360 "$define")
14361         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14362         case "$d_getpwent_r_proto:$usethreads" in
14363         ":define")      d_getpwent_r_proto=define
14364                 set d_getpwent_r_proto getpwent_r $hdrs
14365                 eval $hasproto ;;
14366         *)      ;;
14367         esac
14368         case "$d_getpwent_r_proto" in
14369         define)
14370         case "$getpwent_r_proto" in
14371         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14372         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14373         esac
14374         case "$getpwent_r_proto" in
14375         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14376         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14377         esac
14378         case "$getpwent_r_proto" in
14379         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14380         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14381         esac
14382         case "$getpwent_r_proto" in
14383         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14384         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14385         esac
14386         case "$getpwent_r_proto" in
14387         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14388         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14389         esac
14390         case "$getpwent_r_proto" in
14391         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14392         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14393         esac
14394         case "$getpwent_r_proto" in
14395         ''|0)   d_getpwent_r=undef
14396                 getpwent_r_proto=0
14397                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14398         * )     case "$getpwent_r_proto" in
14399                 REENTRANT_PROTO*) ;;
14400                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14401                 esac
14402                 echo "Prototype: $try" ;;
14403         esac
14404         ;;
14405         *)      case "$usethreads" in
14406                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14407                 esac
14408                 d_getpwent_r=undef
14409                 getpwent_r_proto=0
14410                 ;;
14411         esac
14412         ;;
14413 *)      getpwent_r_proto=0
14414         ;;
14415 esac
14416
14417 : see if getpwnam_r exists
14418 set getpwnam_r d_getpwnam_r
14419 eval $inlibc
14420 case "$d_getpwnam_r" in
14421 "$define")
14422         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14423         case "$d_getpwnam_r_proto:$usethreads" in
14424         ":define")      d_getpwnam_r_proto=define
14425                 set d_getpwnam_r_proto getpwnam_r $hdrs
14426                 eval $hasproto ;;
14427         *)      ;;
14428         esac
14429         case "$d_getpwnam_r_proto" in
14430         define)
14431         case "$getpwnam_r_proto" in
14432         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14433         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14434         esac
14435         case "$getpwnam_r_proto" in
14436         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14437         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14438         esac
14439         case "$getpwnam_r_proto" in
14440         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14441         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14442         esac
14443         case "$getpwnam_r_proto" in
14444         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14445         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14446         esac
14447         case "$getpwnam_r_proto" in
14448         ''|0)   d_getpwnam_r=undef
14449                 getpwnam_r_proto=0
14450                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14451         * )     case "$getpwnam_r_proto" in
14452                 REENTRANT_PROTO*) ;;
14453                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14454                 esac
14455                 echo "Prototype: $try" ;;
14456         esac
14457         ;;
14458         *)      case "$usethreads" in
14459                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14460                 esac
14461                 d_getpwnam_r=undef
14462                 getpwnam_r_proto=0
14463                 ;;
14464         esac
14465         ;;
14466 *)      getpwnam_r_proto=0
14467         ;;
14468 esac
14469
14470 : see if getpwuid_r exists
14471 set getpwuid_r d_getpwuid_r
14472 eval $inlibc
14473 case "$d_getpwuid_r" in
14474 "$define")
14475         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14476         case "$d_getpwuid_r_proto:$usethreads" in
14477         ":define")      d_getpwuid_r_proto=define
14478                 set d_getpwuid_r_proto getpwuid_r $hdrs
14479                 eval $hasproto ;;
14480         *)      ;;
14481         esac
14482         case "$d_getpwuid_r_proto" in
14483         define)
14484         case "$getpwuid_r_proto" in
14485         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14486         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14487         esac
14488         case "$getpwuid_r_proto" in
14489         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14490         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14491         esac
14492         case "$getpwuid_r_proto" in
14493         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14494         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14495         esac
14496         case "$getpwuid_r_proto" in
14497         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14498         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14499         esac
14500         case "$getpwuid_r_proto" in
14501         ''|0)   d_getpwuid_r=undef
14502                 getpwuid_r_proto=0
14503                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14504         * )     case "$getpwuid_r_proto" in
14505                 REENTRANT_PROTO*) ;;
14506                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14507                 esac
14508                 echo "Prototype: $try" ;;
14509         esac
14510         ;;
14511         *)      case "$usethreads" in
14512                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14513                 esac
14514                 d_getpwuid_r=undef
14515                 getpwuid_r_proto=0
14516                 ;;
14517         esac
14518         ;;
14519 *)      getpwuid_r_proto=0
14520         ;;
14521 esac
14522
14523 : Optional checks for getsbyname and getsbyport
14524
14525 : see if getservbyname exists
14526 set getservbyname d_getsbyname
14527 eval $inlibc
14528
14529 : see if getservbyport exists
14530 set getservbyport d_getsbyport
14531 eval $inlibc
14532
14533 : see if getservent exists
14534 set getservent d_getsent
14535 eval $inlibc
14536
14537 : see if getservbyname_r exists
14538 set getservbyname_r d_getservbyname_r
14539 eval $inlibc
14540 case "$d_getservbyname_r" in
14541 "$define")
14542         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14543         case "$d_getservbyname_r_proto:$usethreads" in
14544         ":define")      d_getservbyname_r_proto=define
14545                 set d_getservbyname_r_proto getservbyname_r $hdrs
14546                 eval $hasproto ;;
14547         *)      ;;
14548         esac
14549         case "$d_getservbyname_r_proto" in
14550         define)
14551         case "$getservbyname_r_proto" in
14552         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14553         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14554         esac
14555         case "$getservbyname_r_proto" in
14556         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14557         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14558         esac
14559         case "$getservbyname_r_proto" in
14560         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14561         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14562         esac
14563         case "$getservbyname_r_proto" in
14564         ''|0)   d_getservbyname_r=undef
14565                 getservbyname_r_proto=0
14566                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14567         * )     case "$getservbyname_r_proto" in
14568                 REENTRANT_PROTO*) ;;
14569                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14570                 esac
14571                 echo "Prototype: $try" ;;
14572         esac
14573         ;;
14574         *)      case "$usethreads" in
14575                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14576                 esac
14577                 d_getservbyname_r=undef
14578                 getservbyname_r_proto=0
14579                 ;;
14580         esac
14581         ;;
14582 *)      getservbyname_r_proto=0
14583         ;;
14584 esac
14585
14586 : see if getservbyport_r exists
14587 set getservbyport_r d_getservbyport_r
14588 eval $inlibc
14589 case "$d_getservbyport_r" in
14590 "$define")
14591         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14592         case "$d_getservbyport_r_proto:$usethreads" in
14593         ":define")      d_getservbyport_r_proto=define
14594                 set d_getservbyport_r_proto getservbyport_r $hdrs
14595                 eval $hasproto ;;
14596         *)      ;;
14597         esac
14598         case "$d_getservbyport_r_proto" in
14599         define)
14600         case "$getservbyport_r_proto" in
14601         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14602         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14603         esac
14604         case "$getservbyport_r_proto" in
14605         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14606         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14607         esac
14608         case "$getservbyport_r_proto" in
14609         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14610         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14611         esac
14612         case "$getservbyport_r_proto" in
14613         ''|0)   d_getservbyport_r=undef
14614                 getservbyport_r_proto=0
14615                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14616         * )     case "$getservbyport_r_proto" in
14617                 REENTRANT_PROTO*) ;;
14618                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14619                 esac
14620                 echo "Prototype: $try" ;;
14621         esac
14622         ;;
14623         *)      case "$usethreads" in
14624                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14625                 esac
14626                 d_getservbyport_r=undef
14627                 getservbyport_r_proto=0
14628                 ;;
14629         esac
14630         ;;
14631 *)      getservbyport_r_proto=0
14632         ;;
14633 esac
14634
14635 : see if getservent_r exists
14636 set getservent_r d_getservent_r
14637 eval $inlibc
14638 case "$d_getservent_r" in
14639 "$define")
14640         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14641         case "$d_getservent_r_proto:$usethreads" in
14642         ":define")      d_getservent_r_proto=define
14643                 set d_getservent_r_proto getservent_r $hdrs
14644                 eval $hasproto ;;
14645         *)      ;;
14646         esac
14647         case "$d_getservent_r_proto" in
14648         define)
14649         case "$getservent_r_proto" in
14650         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14651         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14652         esac
14653         case "$getservent_r_proto" in
14654         ''|0) try='int getservent_r(struct servent*, char*, int);'
14655         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14656         esac
14657         case "$getservent_r_proto" in
14658         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14659         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14660         esac
14661         case "$getservent_r_proto" in
14662         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14663         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14664         esac
14665         case "$getservent_r_proto" in
14666         ''|0)   d_getservent_r=undef
14667                 getservent_r_proto=0
14668                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14669         * )     case "$getservent_r_proto" in
14670                 REENTRANT_PROTO*) ;;
14671                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14672                 esac
14673                 echo "Prototype: $try" ;;
14674         esac
14675         ;;
14676         *)      case "$usethreads" in
14677                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14678                 esac
14679                 d_getservent_r=undef
14680                 getservent_r_proto=0
14681                 ;;
14682         esac
14683         ;;
14684 *)      getservent_r_proto=0
14685         ;;
14686 esac
14687
14688 : see if prototypes for various getservxxx netdb.h functions are available
14689 echo " "
14690 set d_getservprotos getservent $i_netdb netdb.h
14691 eval $hasproto
14692
14693 : see if getspnam exists
14694 set getspnam d_getspnam
14695 eval $inlibc
14696
14697 : see if this is a shadow.h system
14698 set shadow.h i_shadow
14699 eval $inhdr
14700
14701 : see if getspnam_r exists
14702 set getspnam_r d_getspnam_r
14703 eval $inlibc
14704 case "$d_getspnam_r" in
14705 "$define")
14706         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14707         case "$d_getspnam_r_proto:$usethreads" in
14708         ":define")      d_getspnam_r_proto=define
14709                 set d_getspnam_r_proto getspnam_r $hdrs
14710                 eval $hasproto ;;
14711         *)      ;;
14712         esac
14713         case "$d_getspnam_r_proto" in
14714         define)
14715         case "$getspnam_r_proto" in
14716         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14717         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14718         esac
14719         case "$getspnam_r_proto" in
14720         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14721         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14722         esac
14723         case "$getspnam_r_proto" in
14724         ''|0)   d_getspnam_r=undef
14725                 getspnam_r_proto=0
14726                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14727         * )     case "$getspnam_r_proto" in
14728                 REENTRANT_PROTO*) ;;
14729                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14730                 esac
14731                 echo "Prototype: $try" ;;
14732         esac
14733         ;;
14734         *)      case "$usethreads" in
14735                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14736                 esac
14737                 d_getspnam_r=undef
14738                 getspnam_r_proto=0
14739                 ;;
14740         esac
14741         ;;
14742 *)      getspnam_r_proto=0
14743         ;;
14744 esac
14745
14746 : see if gettimeofday or ftime exists
14747 set gettimeofday d_gettimeod
14748 eval $inlibc
14749 case "$d_gettimeod" in
14750 "$undef")
14751         set ftime d_ftime 
14752         eval $inlibc
14753         ;;
14754 *)
14755         val="$undef"; set d_ftime; eval $setvar
14756         ;;
14757 esac
14758 case "$d_gettimeod$d_ftime" in
14759 "$undef$undef")
14760         echo " "
14761         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14762         ;;
14763 esac
14764
14765 : see if gmtime_r exists
14766 set gmtime_r d_gmtime_r
14767 eval $inlibc
14768 case "$d_gmtime_r" in
14769 "$define")
14770         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14771         case "$d_gmtime_r_proto:$usethreads" in
14772         ":define")      d_gmtime_r_proto=define
14773                 set d_gmtime_r_proto gmtime_r $hdrs
14774                 eval $hasproto ;;
14775         *)      ;;
14776         esac
14777         case "$d_gmtime_r_proto" in
14778         define)
14779         case "$gmtime_r_proto" in
14780         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14781         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14782         esac
14783         case "$gmtime_r_proto" in
14784         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14785         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14786         esac
14787         case "$gmtime_r_proto" in
14788         ''|0)   d_gmtime_r=undef
14789                 gmtime_r_proto=0
14790                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14791         * )     case "$gmtime_r_proto" in
14792                 REENTRANT_PROTO*) ;;
14793                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14794                 esac
14795                 echo "Prototype: $try" ;;
14796         esac
14797         ;;
14798         *)      case "$usethreads" in
14799                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14800                 esac
14801                 d_gmtime_r=undef
14802                 gmtime_r_proto=0
14803                 ;;
14804         esac
14805         ;;
14806 *)      gmtime_r_proto=0
14807         ;;
14808 esac
14809
14810 : see if hasmntopt exists
14811 set hasmntopt d_hasmntopt
14812 eval $inlibc
14813
14814 : see if this is a netinet/in.h or sys/in.h system
14815 set netinet/in.h i_niin sys/in.h i_sysin
14816 eval $inhdr
14817
14818 : see if arpa/inet.h has to be included
14819 set arpa/inet.h i_arpainet
14820 eval $inhdr
14821
14822 : see if htonl --and friends-- exists
14823 val=''
14824 set htonl val
14825 eval $inlibc
14826
14827 : Maybe they are macros.
14828 case "$val" in
14829 $undef)
14830         $cat >htonl.c <<EOM
14831 #include <stdio.h>
14832 #include <sys/types.h>
14833 #$i_niin I_NETINET_IN
14834 #$i_sysin I_SYS_IN
14835 #$i_arpainet I_ARPA_INET
14836 #ifdef I_NETINET_IN
14837 #include <netinet/in.h>
14838 #endif
14839 #ifdef I_SYS_IN
14840 #include <sys/in.h>
14841 #endif
14842 #ifdef I_ARPA_INET
14843 #include <arpa/inet.h>
14844 #endif
14845 #ifdef htonl
14846 printf("Defined as a macro.");
14847 #endif
14848 EOM
14849         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14850         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14851                 val="$define"
14852                 echo "But it seems to be defined as a macro." >&4
14853         fi
14854         $rm -f htonl.?
14855         ;;
14856 esac
14857 set d_htonl
14858 eval $setvar
14859
14860 : see if ilogbl exists
14861 set ilogbl d_ilogbl
14862 eval $inlibc
14863
14864 : index or strchr
14865 echo " "
14866 if set index val -f; eval $csym; $val; then
14867         if set strchr val -f d_strchr; eval $csym; $val; then
14868                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14869                         val="$define"
14870                         vali="$undef"
14871                         echo "strchr() found." >&4
14872                 else
14873                         val="$undef"
14874                         vali="$define"
14875                         echo "index() found." >&4
14876                 fi
14877         else
14878                 val="$undef"
14879                 vali="$define"
14880                 echo "index() found." >&4
14881         fi
14882 else
14883         if set strchr val -f d_strchr; eval $csym; $val; then
14884                 val="$define"
14885                 vali="$undef"
14886                 echo "strchr() found." >&4
14887         else
14888                 echo "No index() or strchr() found!" >&4
14889                 val="$undef"
14890                 vali="$undef"
14891         fi
14892 fi
14893 set d_strchr; eval $setvar
14894 val="$vali"
14895 set d_index; eval $setvar
14896
14897 : check whether inet_aton exists
14898 set inet_aton d_inetaton
14899 eval $inlibc
14900
14901 : see if inet_ntop exists
14902 set inet_ntop d_inetntop
14903 eval $inlibc
14904
14905 : see if inet_pton exists
14906 set inet_pton d_inetpton
14907 eval $inlibc
14908
14909 : Look for isascii
14910 echo " "
14911 $cat >isascii.c <<EOCP
14912 #include <stdio.h>
14913 #include <ctype.h>
14914 #$i_stdlib I_STDLIB
14915 #ifdef I_STDLIB
14916 #include <stdlib.h>
14917 #endif
14918 int main() {
14919         int c = 'A';
14920         if (isascii(c))
14921                 exit(0);
14922         else
14923                 exit(1);
14924 }
14925 EOCP
14926 set isascii
14927 if eval $compile; then
14928         echo "isascii() found." >&4
14929         val="$define"
14930 else
14931         echo "isascii() NOT found." >&4
14932         val="$undef"
14933 fi
14934 set d_isascii
14935 eval $setvar
14936 $rm -f isascii*
14937
14938 : see if isfinite exists
14939 set isfinite d_isfinite
14940 eval $inlibc
14941
14942 : see if isinf exists
14943 set isinf d_isinf
14944 eval $inlibc
14945
14946 : see if isnan exists
14947 set isnan d_isnan
14948 eval $inlibc
14949
14950 : see if isnanl exists
14951 set isnanl d_isnanl
14952 eval $inlibc
14953
14954 : see if killpg exists
14955 set killpg d_killpg
14956 eval $inlibc
14957
14958 : see if lchown exists
14959 echo " "
14960 $cat > try.c <<'EOCP'
14961 /* System header to define __stub macros and hopefully few prototypes,
14962     which can conflict with char lchown(); below.  */
14963 #include <assert.h>
14964 /* Override any gcc2 internal prototype to avoid an error.  */
14965 /* We use char because int might match the return type of a gcc2
14966    builtin and then its argument prototype would still apply.  */
14967 char lchown();
14968 int main() {
14969     /*  The GNU C library defines this for functions which it implements
14970         to always fail with ENOSYS.  Some functions are actually named
14971         something starting with __ and the normal name is an alias.  */
14972 #if defined (__stub_lchown) || defined (__stub___lchown)
14973 choke me
14974 #else
14975 lchown();
14976 #endif
14977 ; return 0; }
14978 EOCP
14979 set try
14980 if eval $compile; then
14981     $echo "lchown() found." >&4
14982     val="$define"
14983 else
14984     $echo "lchown() NOT found." >&4
14985     val="$undef"
14986 fi
14987 set d_lchown
14988 eval $setvar
14989
14990 : See if number of significant digits in a double precision number is known
14991 echo " "
14992 $cat >ldbl_dig.c <<EOM
14993 #$i_limits I_LIMITS
14994 #$i_float I_FLOAT
14995 #ifdef I_LIMITS
14996 #include <limits.h>
14997 #endif
14998 #ifdef I_FLOAT
14999 #include <float.h>
15000 #endif
15001 #ifdef LDBL_DIG
15002 printf("Contains LDBL_DIG");
15003 #endif
15004 EOM
15005 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15006 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15007         echo "LDBL_DIG found." >&4
15008         val="$define"
15009 else
15010         echo "LDBL_DIG NOT found." >&4
15011         val="$undef"
15012 fi
15013 $rm -f ldbl_dig.?
15014 set d_ldbl_dig
15015 eval $setvar
15016
15017 : see if this is a math.h system
15018 set math.h i_math
15019 eval $inhdr
15020
15021 : check to see if math.h defines _LIB_VERSION
15022 d_libm_lib_version="$undef"
15023 case $i_math in
15024     $define)
15025         echo " "
15026         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15027         $cat >try.c <<EOCP
15028 #include <unistd.h>
15029 #include <math.h>
15030 int main (int argc, char *argv[])
15031 {
15032     printf ("%d\n", _LIB_VERSION);
15033     return (0);
15034     } /* main */
15035 EOCP
15036         set try
15037         if eval $compile; then
15038             foo=`$run ./try`
15039             echo "Yes, it does ($foo)" >&4
15040             d_libm_lib_version="$define"
15041         else
15042             echo "No, it does not (probably harmless)" >&4
15043             fi
15044         $rm_try
15045         ;;
15046
15047     esac
15048
15049 : see if link exists
15050 set link d_link
15051 eval $inlibc
15052
15053 : see if localtime_r exists
15054 set localtime_r d_localtime_r
15055 eval $inlibc
15056 case "$d_localtime_r" in
15057 "$define")
15058         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15059         case "$d_localtime_r_proto:$usethreads" in
15060         ":define")      d_localtime_r_proto=define
15061                 set d_localtime_r_proto localtime_r $hdrs
15062                 eval $hasproto ;;
15063         *)      ;;
15064         esac
15065         case "$d_localtime_r_proto" in
15066         define)
15067         case "$localtime_r_proto" in
15068         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15069         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15070         esac
15071         case "$localtime_r_proto" in
15072         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15073         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15074         esac
15075         case "$localtime_r_proto" in
15076         ''|0)   d_localtime_r=undef
15077                 localtime_r_proto=0
15078                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15079         * )     case "$localtime_r_proto" in
15080                 REENTRANT_PROTO*) ;;
15081                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15082                 esac
15083                 echo "Prototype: $try" ;;
15084         esac
15085         ;;
15086         *)      case "$usethreads" in
15087                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15088                 esac
15089                 d_localtime_r=undef
15090                 localtime_r_proto=0
15091                 ;;
15092         esac
15093         ;;
15094 *)      localtime_r_proto=0
15095         ;;
15096 esac
15097
15098 : see if localtime_r calls tzset
15099 case "$localtime_r_proto" in
15100 REENTRANT_PROTO*)
15101         $cat >try.c <<EOCP
15102 /*  Does our libc's localtime_r call tzset ?
15103  *  return 0 if so, 1 otherwise.
15104  */
15105 #$i_systypes    I_SYS_TYPES
15106 #$i_unistd      I_UNISTD
15107 #$i_time        I_TIME
15108 #$i_stdlib      I_STDLIB
15109 #$i_string      I_STRING
15110 #$i_malloc      I_MALLOC
15111 #ifdef I_SYS_TYPES
15112 #  include <sys/types.h>
15113 #endif
15114 #ifdef I_UNISTD
15115 #  include <unistd.h>
15116 #endif
15117 #ifdef I_TIME
15118 #  include <time.h>
15119 #endif
15120 #ifdef I_STDLIB
15121 #include <stdlib.h>
15122 #endif
15123 #ifdef I_STRING
15124 #  include <string.h>
15125 #else
15126 #  include <strings.h>
15127 #endif
15128 #ifdef I_MALLOC
15129 #  include <malloc.h>
15130 #endif
15131 int main()
15132 {
15133     time_t t = time(0L);
15134     char w_tz[]="TZ" "=GMT+5",
15135          e_tz[]="TZ" "=GMT-5",
15136         *tz_e = (char*)malloc(16),
15137         *tz_w = (char*)malloc(16);
15138     struct tm tm_e, tm_w;
15139     memset(&tm_e,'\0',sizeof(struct tm));
15140     memset(&tm_w,'\0',sizeof(struct tm));
15141     strcpy(tz_e,e_tz);
15142     strcpy(tz_w,w_tz);
15143
15144     putenv(tz_e);
15145     localtime_r(&t, &tm_e);
15146
15147     putenv(tz_w);
15148     localtime_r(&t, &tm_w);
15149
15150     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15151         return 1;
15152     return 0;
15153 }
15154 EOCP
15155         set try
15156         if eval $compile; then
15157             if $run ./try; then
15158                 d_localtime_r_needs_tzset=undef;
15159             else
15160                 d_localtime_r_needs_tzset=define;
15161             fi;
15162         else
15163             d_localtime_r_needs_tzset=undef;
15164         fi;
15165      ;;
15166   *)
15167      d_localtime_r_needs_tzset=undef;
15168      ;;
15169 esac
15170 $rm_try
15171
15172 : see if localeconv exists
15173 set localeconv d_locconv
15174 eval $inlibc
15175
15176 : see if lockf exists
15177 set lockf d_lockf
15178 eval $inlibc
15179
15180 : see if prototype for lseek is available
15181 echo " "
15182 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15183 eval $hasproto
15184
15185 : see if lstat exists
15186 set lstat d_lstat
15187 eval $inlibc
15188
15189 : see if madvise exists
15190 set madvise d_madvise
15191 eval $inlibc
15192
15193 : see if malloc_size exists
15194 set malloc_size d_malloc_size
15195 eval $inlibc
15196
15197 : see if malloc_size_good exists
15198 set malloc_good_size d_malloc_good_size
15199 eval $inlibc
15200
15201 : see if mblen exists
15202 set mblen d_mblen
15203 eval $inlibc
15204
15205 : see if mbstowcs exists
15206 set mbstowcs d_mbstowcs
15207 eval $inlibc
15208
15209 : see if mbtowc exists
15210 set mbtowc d_mbtowc
15211 eval $inlibc
15212
15213 : see if memchr exists
15214 set memchr d_memchr
15215 eval $inlibc
15216
15217 : see if memcmp exists
15218 set memcmp d_memcmp
15219 eval $inlibc
15220
15221 : see if memcpy exists
15222 set memcpy d_memcpy
15223 eval $inlibc
15224
15225 : see if memmove exists
15226 set memmove d_memmove
15227 eval $inlibc
15228
15229 : see if memset exists
15230 set memset d_memset
15231 eval $inlibc
15232
15233 : see if mkdir exists
15234 set mkdir d_mkdir
15235 eval $inlibc
15236
15237 : see if mkdtemp exists
15238 set mkdtemp d_mkdtemp
15239 eval $inlibc
15240
15241 : see if mkfifo exists
15242 set mkfifo d_mkfifo
15243 eval $inlibc
15244
15245 : see if mkstemp exists
15246 set mkstemp d_mkstemp
15247 eval $inlibc
15248
15249 : see if mkstemps exists
15250 set mkstemps d_mkstemps
15251 eval $inlibc
15252
15253 : see if mktime exists
15254 set mktime d_mktime
15255 eval $inlibc
15256
15257 : see if this is a sys/mman.h system
15258 set sys/mman.h i_sysmman
15259 eval $inhdr
15260
15261 : see if mmap exists
15262 set mmap d_mmap
15263 eval $inlibc
15264 : see what shmat returns
15265 : default to something harmless
15266 mmaptype='void *'
15267 case "$i_sysmman$d_mmap" in
15268 "$define$define")
15269         $cat >mmap.c <<'END'
15270 #include <sys/mman.h>
15271 void *mmap();
15272 END
15273         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15274                 mmaptype='void *'
15275         else
15276                 mmaptype='caddr_t'
15277         fi
15278         echo "and it returns ($mmaptype)." >&4
15279         ;;
15280 esac
15281
15282
15283
15284 : see if sqrtl exists
15285 set sqrtl d_sqrtl
15286 eval $inlibc
15287
15288 : see if scalbnl exists
15289 set scalbnl d_scalbnl
15290 eval $inlibc
15291
15292 : see if modfl exists
15293 set modfl d_modfl
15294 eval $inlibc
15295
15296 : see if prototype for modfl is available
15297 echo " "
15298 set d_modflproto modfl $i_math math.h
15299 eval $hasproto
15300
15301 d_modfl_pow32_bug="$undef"
15302
15303 case "$d_longdbl$d_modfl" in
15304 $define$define)
15305         $cat <<EOM
15306 Checking to see whether your modfl() is okay for large values...
15307 EOM
15308 $cat >try.c <<EOCP
15309 #include <math.h>
15310 #include <stdio.h>
15311 EOCP
15312 if $test "X$d_modflproto" != "X$define"; then
15313         $cat >>try.c <<EOCP
15314 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15315 long double modfl (long double, long double *);
15316 EOCP
15317 fi
15318 $cat >>try.c <<EOCP
15319 int main() {
15320     long double nv = 4294967303.15;
15321     long double v, w;
15322     v = modfl(nv, &w);
15323 #ifdef __GLIBC__
15324     printf("glibc");
15325 #endif
15326     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15327     return 0;
15328 }
15329 EOCP
15330         case "$osname:$gccversion" in
15331         aix:)   saveccflags="$ccflags"
15332                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15333         esac
15334         set try
15335         if eval $compile; then
15336                 foo=`$run ./try`
15337                 case "$foo" in
15338                 *" 4294967303.150000 1.150000 4294967302.000000")
15339                         echo >&4 "Your modfl() is broken for large values."
15340                         d_modfl_pow32_bug="$define"
15341                         case "$foo" in
15342                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15343                         ;;
15344                         esac
15345                         ;;
15346                 *" 4294967303.150000 0.150000 4294967303.000000")
15347                         echo >&4 "Your modfl() seems okay for large values."
15348                         ;;
15349                 *)      echo >&4 "I don't understand your modfl() at all."
15350                         d_modfl="$undef"
15351                         ;;
15352                 esac
15353                 $rm_try
15354         else
15355                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15356                 d_modfl="$undef"
15357         fi
15358         case "$osname:$gccversion" in
15359         aix:)   ccflags="$saveccflags" ;; # restore
15360         esac
15361         ;;
15362 esac
15363
15364 if $test "$uselongdouble" = "$define"; then
15365     message=""
15366     if $test "$d_sqrtl" != "$define"; then
15367         message="$message sqrtl"
15368     fi
15369     if $test "$d_modfl" != "$define"; then
15370         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15371             echo "You have both aintl and copysignl, so I can emulate modfl."
15372         else
15373             message="$message modfl"
15374         fi
15375     fi
15376     if $test "$d_frexpl" != "$define"; then
15377         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15378             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15379         else
15380             message="$message frexpl"
15381         fi
15382     fi
15383
15384     if $test "$message" != ""; then
15385         $cat <<EOM >&4
15386
15387 *** You requested the use of long doubles but you do not seem to have
15388 *** the following mathematical functions needed for long double support:
15389 ***    $message
15390 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15391 *** Cannot continue, aborting.
15392
15393 EOM
15394
15395         exit 1
15396     fi
15397 fi
15398
15399 : see if mprotect exists
15400 set mprotect d_mprotect
15401 eval $inlibc
15402
15403 : see if msgctl exists
15404 set msgctl d_msgctl
15405 eval $inlibc
15406
15407 : see if msgget exists
15408 set msgget d_msgget
15409 eval $inlibc
15410
15411 : see if msgsnd exists
15412 set msgsnd d_msgsnd
15413 eval $inlibc
15414
15415 : see if msgrcv exists
15416 set msgrcv d_msgrcv
15417 eval $inlibc
15418
15419 : see how much of the 'msg*(2)' library is present.
15420 h_msg=true
15421 echo " "
15422 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15423 *"$undef"*) h_msg=false;;
15424 esac
15425 case "$osname" in
15426 freebsd)
15427     case "`ipcs 2>&1`" in
15428     "SVID messages"*"not configured"*)
15429         echo "Your $osname does not have the msg*(2) configured." >&4
15430         h_msg=false
15431         val="$undef"
15432         set msgctl d_msgctl
15433         eval $setvar
15434         set msgget d_msgget
15435         eval $setvar
15436         set msgsnd d_msgsnd
15437         eval $setvar
15438         set msgrcv d_msgrcv
15439         eval $setvar
15440         ;;
15441     esac
15442     ;;
15443 esac
15444 : we could also check for sys/ipc.h ...
15445 if $h_msg && $test `./findhdr sys/msg.h`; then
15446         echo "You have the full msg*(2) library." >&4
15447         val="$define"
15448 else
15449         echo "You don't have the full msg*(2) library." >&4
15450         val="$undef"
15451 fi
15452 set d_msg
15453 eval $setvar
15454
15455 : Check for msghdr_s
15456 echo " "
15457 echo "Checking to see if your system supports struct msghdr..." >&4
15458 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15459 eval $hasstruct
15460 case "$d_msghdr_s" in
15461 "$define")      echo "Yes, it does."   ;;
15462 *)              echo "No, it doesn't." ;;
15463 esac
15464
15465
15466 : see if msync exists
15467 set msync d_msync
15468 eval $inlibc
15469
15470 : see if munmap exists
15471 set munmap d_munmap
15472 eval $inlibc
15473
15474 : see if nice exists
15475 set nice d_nice
15476 eval $inlibc
15477
15478 : see if this is a langinfo.h system
15479 set langinfo.h i_langinfo
15480 eval $inhdr
15481
15482 : see if nl_langinfo exists
15483 set nl_langinfo d_nl_langinfo
15484 eval $inlibc
15485
15486 : check for volatile keyword
15487 echo " "
15488 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15489 $cat >try.c <<'EOCP'
15490 int main()
15491 {
15492         typedef struct _goo_struct goo_struct;
15493         goo_struct * volatile goo = ((goo_struct *)0);
15494         struct _goo_struct {
15495                 long long_int;
15496                 int reg_int;
15497                 char char_var;
15498         };
15499         typedef unsigned short foo_t;
15500         char *volatile foo;
15501         volatile int bar;
15502         volatile foo_t blech;
15503         foo = foo;
15504 }
15505 EOCP
15506 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15507         val="$define"
15508         echo "Yup, it does."
15509 else
15510         val="$undef"
15511         echo "Nope, it doesn't."
15512 fi
15513 set d_volatile
15514 eval $setvar
15515 $rm_try
15516
15517 : Check basic sizes
15518 echo " "
15519 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15520
15521 case "$use64bitint:$d_quad:$quadtype" in
15522 define:define:?*)
15523         ivtype="$quadtype"
15524         uvtype="$uquadtype"
15525         ivsize=8
15526         uvsize=8
15527         ;;
15528 *)      ivtype="long"
15529         uvtype="unsigned long"
15530         ivsize=$longsize
15531         uvsize=$longsize
15532         ;;
15533 esac
15534
15535 case "$uselongdouble:$d_longdbl" in
15536 define:define)
15537         nvtype="long double"
15538         nvsize=$longdblsize
15539         ;;
15540 *)      nvtype=double
15541         nvsize=$doublesize
15542         ;;
15543 esac
15544
15545 $echo "(IV will be "$ivtype", $ivsize bytes)"
15546 $echo "(UV will be "$uvtype", $uvsize bytes)"
15547 $echo "(NV will be "$nvtype", $nvsize bytes)"
15548
15549 $cat >try.c <<EOCP
15550 #$i_inttypes I_INTTYPES
15551 #ifdef I_INTTYPES
15552 #include <inttypes.h>
15553 #endif
15554 #include <stdio.h>
15555 int main() {
15556 #ifdef INT8
15557    int8_t i =  INT8_MAX;
15558   uint8_t u = UINT8_MAX;
15559   printf("int8_t\n");
15560 #endif
15561 #ifdef INT16
15562    int16_t i =  INT16_MAX;
15563   uint16_t i = UINT16_MAX;
15564   printf("int16_t\n");
15565 #endif
15566 #ifdef INT32
15567    int32_t i =  INT32_MAX;
15568   uint32_t u = UINT32_MAX;
15569   printf("int32_t\n");
15570 #endif
15571 }
15572 EOCP
15573
15574 i8type="signed char"
15575 u8type="unsigned char"
15576 i8size=1
15577 u8size=1
15578
15579 case "$i16type" in
15580 '')     case "$shortsize" in
15581         2)      i16type=short
15582                 u16type="unsigned short"
15583                 i16size=$shortsize
15584                 u16size=$shortsize
15585                 ;;
15586         esac
15587         ;;
15588 esac
15589 case "$i16type" in
15590 '')     set try -DINT16
15591         if eval $compile; then
15592                 case "`$run ./try`" in
15593                 int16_t)
15594                         i16type=int16_t
15595                         u16type=uint16_t
15596                         i16size=2
15597                         u16size=2
15598                         ;;
15599                 esac
15600         fi
15601         ;;
15602 esac
15603 case "$i16type" in
15604 '')     if $test $shortsize -ge 2; then
15605                 i16type=short
15606                 u16type="unsigned short"
15607                 i16size=$shortsize
15608                 u16size=$shortsize
15609         fi
15610         ;;
15611 esac
15612
15613 case "$i32type" in
15614 '')     case "$longsize" in
15615         4)      i32type=long
15616                 u32type="unsigned long"
15617                 i32size=$longsize
15618                 u32size=$longsize
15619                 ;;
15620         *)      case "$intsize" in
15621                 4)      i32type=int
15622                         u32type="unsigned int"
15623                         i32size=$intsize
15624                         u32size=$intsize
15625                         ;;
15626                 esac
15627                 ;;
15628         esac
15629         ;;
15630 esac
15631 case "$i32type" in
15632 '')     set try -DINT32
15633         if eval $compile; then
15634                 case "`$run ./try`" in
15635                 int32_t)
15636                         i32type=int32_t
15637                         u32type=uint32_t
15638                         i32size=4
15639                         u32size=4
15640                         ;;
15641                 esac
15642         fi
15643         ;;
15644 esac
15645 case "$i32type" in
15646 '')     if $test $intsize -ge 4; then
15647                 i32type=int
15648                 u32type="unsigned int"
15649                 i32size=$intsize
15650                 u32size=$intsize
15651         fi
15652         ;;
15653 esac
15654
15655 case "$i64type" in
15656 '')     case "$d_quad:$quadtype" in
15657         define:?*)
15658                 i64type="$quadtype"
15659                 u64type="$uquadtype"
15660                 i64size=8
15661                 u64size=8
15662                 ;;
15663         esac
15664         ;;
15665 esac
15666
15667 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15668 : volatile so that the compiler has to store it out to memory.
15669 if test X"$d_volatile" = X"$define"; then
15670         volatile=volatile
15671 fi
15672 $cat <<EOP >try.c
15673 #include <stdio.h>
15674 #$i_stdlib I_STDLIB
15675 #ifdef I_STDLIB
15676 #include <stdlib.h>
15677 #endif
15678 #include <sys/types.h>
15679 #include <signal.h>
15680 #ifdef SIGFPE
15681 $volatile int bletched = 0;
15682 $signal_t blech(int s) { bletched = 1; }
15683 #endif
15684 int main() {
15685     $uvtype u = 0;
15686     $nvtype d;
15687     int     n = 8 * $uvsize;
15688     int     i;
15689 #ifdef SIGFPE
15690     signal(SIGFPE, blech);
15691 #endif
15692
15693     for (i = 0; i < n; i++) {
15694       u = u << 1 | ($uvtype)1;
15695       d = ($nvtype)u;
15696       if (($uvtype)d != u)
15697         break;
15698       if (d <= 0)
15699         break;
15700       d = ($nvtype)(u - 1);
15701       if (($uvtype)d != (u - 1))
15702         break;
15703 #ifdef SIGFPE
15704       if (bletched)
15705         break;
15706 #endif
15707     }
15708     printf("%d\n", ((i == n) ? -n : i));
15709     exit(0);
15710 }
15711 EOP
15712 set try
15713
15714 d_nv_preserves_uv="$undef"
15715 if eval $compile; then
15716         nv_preserves_uv_bits="`$run ./try`"
15717 fi
15718 case "$nv_preserves_uv_bits" in
15719 \-[1-9]*)
15720         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15721         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15722         d_nv_preserves_uv="$define"
15723         ;;
15724 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15725         d_nv_preserves_uv="$undef" ;;
15726 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15727         nv_preserves_uv_bits="0" ;;
15728 esac
15729 $rm_try
15730
15731 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15732 : volatile so that the compiler has to store it out to memory.
15733 if test X"$d_volatile" = X"$define"; then
15734         volatile=volatile
15735 fi
15736 $cat <<EOP >try.c
15737 #include <stdio.h>
15738
15739 typedef $nvtype NV;
15740
15741 int
15742 main() {
15743   NV value = 2;
15744   int count = 1;
15745
15746   while(count < 256) {
15747     $volatile NV up = value + 1.0;
15748     $volatile NV negated = -value;
15749     $volatile NV down = negated - 1.0;
15750     $volatile NV got_up = up - value;
15751     int up_good = got_up == 1.0;
15752     int got_down = down - negated;
15753     int down_good = got_down == -1.0;
15754
15755     if (down_good != up_good) {
15756       fprintf(stderr,
15757               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15758               up_good, (double) got_up, down_good, (double) got_down,
15759               count, (double) value);
15760       return 1;
15761     }
15762     if (!up_good) {
15763       while (1) {
15764         if (count > 8) {
15765           count -= 8;
15766           fputs("256.0", stdout);
15767         } else {
15768           count--;
15769           fputs("2.0", stdout);
15770         }
15771         if (!count) {
15772           puts("");
15773           return 0;
15774         }
15775         fputs("*", stdout);
15776       }
15777     }
15778     value *= 2;
15779     ++count;
15780   }
15781   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15782           count, (double) value);
15783   return 1;
15784 }
15785 EOP
15786 set try
15787
15788 nv_overflows_integers_at='0'
15789 if eval $compile; then
15790     xxx="`$run ./try`"
15791     case "$?" in
15792         0)
15793             case "$xxx" in
15794                 2*)  cat >&4 <<EOM
15795 The largest integer your NVs can preserve is equal to $xxx
15796 EOM
15797                     nv_overflows_integers_at="$xxx"
15798                     ;;
15799                 *)  cat >&4 <<EOM
15800 Cannot determine the largest integer value your NVs can hold, unexpected output
15801 '$xxx'
15802 EOM
15803                     ;;
15804             esac
15805             ;;
15806         *)  cat >&4 <<EOM
15807 Cannot determine the largest integer value your NVs can hold
15808 EOM
15809             ;;
15810     esac
15811 fi
15812 $rm_try
15813
15814 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15815 : volatile so that the compiler has to store it out to memory.
15816 if test X"$d_volatile" = X"$define"; then
15817         volatile=volatile
15818 fi
15819 $cat <<EOP >try.c
15820 #include <stdio.h>
15821 #$i_stdlib I_STDLIB
15822 #ifdef I_STDLIB
15823 #include <stdlib.h>
15824 #endif
15825 #$i_string I_STRING
15826 #ifdef I_STRING
15827 #  include <string.h>
15828 #else
15829 #  include <strings.h>
15830 #endif
15831 #include <sys/types.h>
15832 #include <signal.h>
15833 #ifdef SIGFPE
15834 $volatile int bletched = 0;
15835 $signal_t blech(int s) { bletched = 1; }
15836 #endif
15837
15838 int checkit($nvtype d, char *where) {
15839     unsigned char *p = (char *)&d;
15840     unsigned char *end = p + sizeof(d);
15841     int fail = 0;
15842
15843     while (p < end)
15844         fail += *p++;
15845
15846     if (!fail)
15847         return 0;
15848
15849     p = (char *)&d;
15850     printf("No - %s: 0x", where);
15851     while (p < end)
15852         printf ("%02X", *p++);
15853     printf("\n");
15854     return 1;
15855 }
15856
15857 int main(int argc, char **argv) {
15858     $nvtype d = 0.0;
15859     int fail = 0;
15860     fail += checkit(d, "0.0");
15861
15862     /* The compiler shouldn't be assuming that bletched is 0  */
15863     d = bletched;
15864
15865     fail += checkit(d, "bleched");
15866
15867 #ifdef SIGFPE
15868     signal(SIGFPE, blech);
15869 #endif
15870
15871     /* Paranoia - the compiler should have no way of knowing that ANSI says
15872        that argv[argc] will always be NULL.  Actually, if it did assume this it
15873        would be buggy, as this is C and main() can be called from elsewhere in
15874        the program.  */
15875     d = argv[argc] ? 1 : 0;
15876
15877     if (d) {
15878         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15879     }
15880
15881     fail += checkit(d, "ternary");
15882
15883     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15884
15885     if (d != 0.0) {
15886         printf("No - memset doesn't give 0.0\n");
15887         /* This might just blow up:  */
15888         printf("(gives %g)\n", d);
15889         return 1;
15890     }
15891
15892 #ifdef SIGFPE
15893     if (bletched) {
15894         printf("No - something bleched\n");
15895         return 1;
15896     }
15897 #endif
15898     if (fail) {
15899       printf("No - %d fail(s)\n", fail);
15900       return 1;
15901     }
15902     printf("Yes\n");
15903     return 0;
15904 }
15905 EOP
15906 set try
15907
15908 d_nv_zero_is_allbits_zero="$undef"
15909 if eval $compile; then
15910     xxx="`$run ./try`"
15911     case "$?" in
15912         0)
15913             case "$xxx" in
15914                 Yes)  cat >&4 <<EOM
15915 0.0 is represented as all bits zero in memory
15916 EOM
15917                     d_nv_zero_is_allbits_zero="$define"
15918                     ;;
15919                 *)  cat >&4 <<EOM
15920 0.0 is not represented as all bits zero in memory
15921 EOM
15922                     d_nv_zero_is_allbits_zero="$undef"
15923                     ;;
15924             esac
15925             ;;
15926         *)  cat >&4 <<EOM
15927 0.0 is not represented as all bits zero in memory
15928 EOM
15929             d_nv_zero_is_allbits_zero="$undef"
15930             ;;
15931     esac
15932 fi
15933 $rm_try
15934
15935 : check for off64_t
15936 echo " "
15937 echo "Checking to see if you have off64_t..." >&4
15938 $cat >try.c <<EOCP
15939 #include <sys/types.h>
15940 #include <unistd.h>
15941 int main() { off64_t x = 7; }
15942 EOCP
15943 set try
15944 if eval $compile; then
15945         val="$define"
15946         echo "You have off64_t."
15947 else
15948         val="$undef"
15949         echo "You do not have off64_t."
15950         case "$lseeksize" in
15951         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15952         esac
15953 fi
15954 $rm_try
15955 set d_off64_t
15956 eval $setvar
15957
15958 : how to create joinable pthreads
15959 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15960         echo " "
15961         echo "Checking what constant to use for creating joinable pthreads..." >&4
15962         $cat >try.c <<'EOCP'
15963 #include <pthread.h>
15964 int main() {
15965     int detachstate = JOINABLE;
15966 }
15967 EOCP
15968         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15969         if eval $compile; then
15970                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15971                 val="$undef" # Yes, undef.
15972                 set d_old_pthread_create_joinable
15973                 eval $setvar
15974                 val=""
15975                 set old_pthread_create_joinable
15976                 eval $setvar
15977         else
15978                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15979                 if eval $compile; then
15980                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15981                         val="$define"
15982                         set d_old_pthread_create_joinable
15983                         eval $setvar
15984                         val=PTHREAD_CREATE_UNDETACHED
15985                         set old_pthread_create_joinable
15986                         eval $setvar
15987                 else
15988                         set try -DJOINABLE=__UNDETACHED
15989                         if eval $compile; then
15990                                 echo "You seem to use __UNDETACHED." >&4
15991                                 val="$define"
15992                                 set d_old_pthread_create_joinable
15993                                 eval $setvar
15994                                 val=__UNDETACHED
15995                                 set old_pthread_create_joinable
15996                                 eval $setvar
15997                         else
15998                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15999                                 val="$define"
16000                                 set d_old_pthread_create_joinable
16001                                 eval $setvar
16002                                 val=0
16003                                 set old_pthread_create_joinable
16004                                 eval $setvar
16005                         fi
16006                 fi
16007         fi
16008         $rm_try
16009 else
16010     d_old_pthread_create_joinable="$undef"
16011     old_pthread_create_joinable=""
16012 fi
16013
16014 : see if pause exists
16015 set pause d_pause
16016 eval $inlibc
16017
16018 : see if poll exists
16019 set poll d_poll
16020 eval $inlibc
16021
16022 : see if readlink exists
16023 set readlink d_readlink
16024 eval $inlibc
16025
16026 : Check if exe is symlink to abs path of executing program
16027 echo " "
16028 procselfexe=''
16029 val="$undef"
16030 case "$d_readlink" in
16031 "$define")
16032         if $issymlink /proc/self/exe ; then
16033                 $ls -l /proc/self/exe > reflect
16034                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16035                         echo "You have Linux-like /proc/self/exe."
16036                         procselfexe='"/proc/self/exe"'
16037                         val="$define"
16038                 fi
16039         fi
16040         if $issymlink /proc/curproc/file ; then
16041                 $ls -l /proc/curproc/file > reflect
16042                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16043                         echo "You have BSD-like /proc/curproc/file."
16044                         procselfexe='"/proc/curproc/file"'
16045                         val="$define"
16046                 fi
16047         fi
16048         ;;
16049 esac
16050 $rm -f reflect
16051 set d_procselfexe
16052 eval $setvar
16053
16054 : backward compatibility for d_hvfork
16055 if test X$d_hvfork != X; then
16056         d_vfork="$d_hvfork"
16057         d_hvfork=''
16058 fi
16059 : see if there is a vfork
16060 val=''
16061 set vfork val
16062 eval $inlibc
16063
16064 d_pseudofork=$undef
16065
16066 : Ok, but do we want to use it. vfork is reportedly unreliable in
16067 : perl on Solaris 2.x, and probably elsewhere.
16068 case "$val" in
16069 $define)
16070         echo " "
16071         case "$usevfork" in
16072         false) dflt='n';;
16073         *) dflt='y';;
16074         esac
16075         cat <<'EOM'
16076
16077 Perl can only use a vfork() that doesn't suffer from strict
16078 restrictions on calling functions or modifying global data in
16079 the child.  For example, glibc-2.1 contains such a vfork()
16080 that is unsuitable.  If your system provides a proper fork()
16081 call, chances are that you do NOT want perl to use vfork().
16082
16083 EOM
16084         rp="Do you still want to use vfork()?"
16085         . ./myread
16086         case "$ans" in
16087         y|Y) ;;
16088         *)
16089                 echo "Ok, we won't use vfork()."
16090                 val="$undef"
16091                 ;;
16092         esac
16093         ;;
16094 esac
16095 set d_vfork
16096 eval $setvar
16097 case "$d_vfork" in
16098 $define) usevfork='true';;
16099 *) usevfork='false';;
16100 esac
16101
16102 : see whether the pthread_atfork exists
16103 $cat >try.c <<EOP
16104 #include <pthread.h>
16105 #include <stdio.h>
16106 int main() {
16107 #ifdef  PTHREAD_ATFORK
16108         pthread_atfork(NULL,NULL,NULL);
16109 #endif
16110 }
16111 EOP
16112
16113 : see if pthread_atfork exists
16114 set try -DPTHREAD_ATFORK
16115 if eval $compile; then
16116     val="$define"
16117 else
16118     val="$undef"
16119 fi
16120 case "$usethreads" in
16121 $define)
16122         case "$val" in
16123         $define) echo 'pthread_atfork found.' >&4        ;;
16124         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16125         esac
16126 esac
16127 set d_pthread_atfork
16128 eval $setvar
16129
16130 : see if pthread_attr_setscope exists
16131 set pthread_attr_setscope d_pthread_attr_setscope
16132 eval $inlibc
16133
16134 : see whether the various POSIXish _yields exist
16135 $cat >try.c <<EOP
16136 #include <pthread.h>
16137 #include <stdio.h>
16138 int main() {
16139 #ifdef SCHED_YIELD
16140         sched_yield();
16141 #else
16142 #ifdef PTHREAD_YIELD
16143         pthread_yield();
16144 #else
16145 #ifdef PTHREAD_YIELD_NULL
16146         pthread_yield(NULL);
16147 #endif
16148 #endif
16149 #endif
16150 }
16151 EOP
16152 : see if sched_yield exists
16153 set try -DSCHED_YIELD
16154 if eval $compile; then
16155     val="$define"
16156     sched_yield='sched_yield()'
16157 else
16158     val="$undef"
16159 fi
16160 case "$usethreads" in
16161 $define)
16162         case "$val" in
16163         $define) echo 'sched_yield() found.' >&4        ;;
16164         *)       echo 'sched_yield() NOT found.' >&4    ;;
16165         esac
16166 esac
16167 set d_sched_yield
16168 eval $setvar
16169
16170 : see if pthread_yield exists
16171 set try -DPTHREAD_YIELD
16172 if eval $compile; then
16173     val="$define"
16174     case "$sched_yield" in
16175     '') sched_yield='pthread_yield()' ;;
16176     esac
16177 else
16178     set try -DPTHREAD_YIELD_NULL
16179     if eval $compile; then
16180         val="$define"
16181         case "$sched_yield" in
16182         '') sched_yield='pthread_yield(NULL)' ;;
16183         esac
16184     else
16185         val="$undef"
16186     fi
16187 fi
16188 case "$usethreads" in
16189 $define)
16190         case "$val" in
16191         $define) echo 'pthread_yield() found.' >&4      ;;
16192         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16193         esac
16194         ;;
16195 esac
16196 set d_pthread_yield
16197 eval $setvar
16198 case "$sched_yield" in
16199 '') sched_yield=undef ;;
16200 esac
16201 $rm_try
16202
16203 : see if random_r exists
16204 set random_r d_random_r
16205 eval $inlibc
16206 case "$d_random_r" in
16207 "$define")
16208         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16209         case "$d_random_r_proto:$usethreads" in
16210         ":define")      d_random_r_proto=define
16211                 set d_random_r_proto random_r $hdrs
16212                 eval $hasproto ;;
16213         *)      ;;
16214         esac
16215         case "$d_random_r_proto" in
16216         define)
16217         case "$random_r_proto" in
16218         ''|0) try='int random_r(int*, struct random_data*);'
16219         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16220         esac
16221         case "$random_r_proto" in
16222         ''|0) try='int random_r(long*, struct random_data*);'
16223         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16224         esac
16225         case "$random_r_proto" in
16226         ''|0) try='int random_r(struct random_data*, int32_t*);'
16227         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16228         esac
16229         case "$random_r_proto" in
16230         ''|0)   d_random_r=undef
16231                 random_r_proto=0
16232                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16233         * )     case "$random_r_proto" in
16234                 REENTRANT_PROTO*) ;;
16235                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16236                 esac
16237                 echo "Prototype: $try" ;;
16238         esac
16239         ;;
16240         *)      case "$usethreads" in
16241                 define) echo "random_r has no prototype, not using it." >&4 ;;
16242                 esac
16243                 d_random_r=undef
16244                 random_r_proto=0
16245                 ;;
16246         esac
16247         ;;
16248 *)      random_r_proto=0
16249         ;;
16250 esac
16251
16252 : see if readdir and friends exist
16253 set readdir d_readdir
16254 eval $inlibc
16255 set seekdir d_seekdir
16256 eval $inlibc
16257 set telldir d_telldir
16258 eval $inlibc
16259 set rewinddir d_rewinddir
16260 eval $inlibc
16261
16262 : see if readdir64_r exists
16263 set readdir64_r d_readdir64_r
16264 eval $inlibc
16265 case "$d_readdir64_r" in
16266 "$define")
16267         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16268         case "$d_readdir64_r_proto:$usethreads" in
16269         ":define")      d_readdir64_r_proto=define
16270                 set d_readdir64_r_proto readdir64_r $hdrs
16271                 eval $hasproto ;;
16272         *)      ;;
16273         esac
16274         case "$d_readdir64_r_proto" in
16275         define)
16276         case "$readdir64_r_proto" in
16277         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16278         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16279         esac
16280         case "$readdir64_r_proto" in
16281         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16282         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16283         esac
16284         case "$readdir64_r_proto" in
16285         ''|0)   d_readdir64_r=undef
16286                 readdir64_r_proto=0
16287                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16288         * )     case "$readdir64_r_proto" in
16289                 REENTRANT_PROTO*) ;;
16290                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16291                 esac
16292                 echo "Prototype: $try" ;;
16293         esac
16294         ;;
16295         *)      case "$usethreads" in
16296                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16297                 esac
16298                 d_readdir64_r=undef
16299                 readdir64_r_proto=0
16300                 ;;
16301         esac
16302         ;;
16303 *)      readdir64_r_proto=0
16304         ;;
16305 esac
16306
16307 : see if readdir_r exists
16308 set readdir_r d_readdir_r
16309 eval $inlibc
16310 case "$d_readdir_r" in
16311 "$define")
16312         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16313         case "$d_readdir_r_proto:$usethreads" in
16314         ":define")      d_readdir_r_proto=define
16315                 set d_readdir_r_proto readdir_r $hdrs
16316                 eval $hasproto ;;
16317         *)      ;;
16318         esac
16319         case "$d_readdir_r_proto" in
16320         define)
16321         case "$readdir_r_proto" in
16322         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16323         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16324         esac
16325         case "$readdir_r_proto" in
16326         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16327         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16328         esac
16329         case "$readdir_r_proto" in
16330         ''|0)   d_readdir_r=undef
16331                 readdir_r_proto=0
16332                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16333         * )     case "$readdir_r_proto" in
16334                 REENTRANT_PROTO*) ;;
16335                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16336                 esac
16337                 echo "Prototype: $try" ;;
16338         esac
16339         ;;
16340         *)      case "$usethreads" in
16341                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16342                 esac
16343                 d_readdir_r=undef
16344                 readdir_r_proto=0
16345                 ;;
16346         esac
16347         ;;
16348 *)      readdir_r_proto=0
16349         ;;
16350 esac
16351
16352 : see if readv exists
16353 set readv d_readv
16354 eval $inlibc
16355
16356 : see if recvmsg exists
16357 set recvmsg d_recvmsg
16358 eval $inlibc
16359
16360 : see if rename exists
16361 set rename d_rename
16362 eval $inlibc
16363
16364 : see if rmdir exists
16365 set rmdir d_rmdir
16366 eval $inlibc
16367
16368 : see if memory.h is available.
16369 val=''
16370 set memory.h val
16371 eval $inhdr
16372
16373 : See if it conflicts with string.h
16374 case "$val" in
16375 $define)
16376         case "$strings" in
16377         '') ;;
16378         *)
16379                 $cppstdin $cppflags $cppminus < $strings > mem.h
16380                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16381                         echo " "
16382                         echo "We won't be including <memory.h>."
16383                         val="$undef"
16384                 fi
16385                 $rm -f mem.h
16386                 ;;
16387         esac
16388 esac
16389 set i_memory
16390 eval $setvar
16391
16392 : can bcopy handle overlapping blocks?
16393 echo " "
16394 val="$undef"
16395 case "$d_memmove" in
16396 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16397 *)      case "$d_bcopy" in
16398         "$define")
16399                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16400                 $cat >try.c <<EOCP
16401 #$i_memory I_MEMORY
16402 #$i_stdlib I_STDLIB
16403 #$i_string I_STRING
16404 #$i_unistd I_UNISTD
16405 EOCP
16406         $cat >>try.c <<'EOCP'
16407 #include <stdio.h>
16408 #ifdef I_MEMORY
16409 #  include <memory.h>
16410 #endif
16411 #ifdef I_STDLIB
16412 #  include <stdlib.h>
16413 #endif
16414 #ifdef I_STRING
16415 #  include <string.h>
16416 #else
16417 #  include <strings.h>
16418 #endif
16419 #ifdef I_UNISTD
16420 #  include <unistd.h>  /* Needed for NetBSD */
16421 #endif
16422 int main()
16423 {
16424 char buf[128], abc[128];
16425 char *b;
16426 int len;
16427 int off;
16428 int align;
16429
16430 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16431    try to store the string in read-only memory. */
16432 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16433
16434 for (align = 7; align >= 0; align--) {
16435         for (len = 36; len; len--) {
16436                 b = buf+align;
16437                 bcopy(abc, b, len);
16438                 for (off = 1; off <= len; off++) {
16439                         bcopy(b, b+off, len);
16440                         bcopy(b+off, b, len);
16441                         if (bcmp(b, abc, len))
16442                                 exit(1);
16443                 }
16444         }
16445 }
16446 exit(0);
16447 }
16448 EOCP
16449                 set try
16450                 if eval $compile_ok; then
16451                         if $run ./try 2>/dev/null; then
16452                                 echo "Yes, it can."
16453                                 val="$define"
16454                         else
16455                                 echo "It can't, sorry."
16456                         fi
16457                 else
16458                         echo "(I can't compile the test program, so we'll assume not...)"
16459                 fi
16460                 ;;
16461         esac
16462         $rm_try
16463         ;;
16464 esac
16465 set d_safebcpy
16466 eval $setvar
16467
16468 : can memcpy handle overlapping blocks?
16469 echo " "
16470 val="$undef"
16471 case "$d_memmove" in
16472 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16473 *)      case "$d_memcpy" in
16474         "$define")
16475                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16476                 $cat >try.c <<EOCP
16477 #$i_memory I_MEMORY
16478 #$i_stdlib I_STDLIB
16479 #$i_string I_STRING
16480 #$i_unistd I_UNISTD
16481 EOCP
16482         $cat >>try.c <<'EOCP'
16483 #include <stdio.h>
16484 #ifdef I_MEMORY
16485 #  include <memory.h>
16486 #endif
16487 #ifdef I_STDLIB
16488 #  include <stdlib.h>
16489 #endif
16490 #ifdef I_STRING
16491 #  include <string.h>
16492 #else
16493 #  include <strings.h>
16494 #endif
16495 #ifdef I_UNISTD
16496 #  include <unistd.h>  /* Needed for NetBSD */
16497 #endif
16498 int main()
16499 {
16500 char buf[128], abc[128];
16501 char *b;
16502 int len;
16503 int off;
16504 int align;
16505
16506 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16507    try to store the string in read-only memory. */
16508 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16509
16510 for (align = 7; align >= 0; align--) {
16511         for (len = 36; len; len--) {
16512                 b = buf+align;
16513                 memcpy(b, abc, len);
16514                 for (off = 1; off <= len; off++) {
16515                         memcpy(b+off, b, len);
16516                         memcpy(b, b+off, len);
16517                         if (memcmp(b, abc, len))
16518                                 exit(1);
16519                 }
16520         }
16521 }
16522 exit(0);
16523 }
16524 EOCP
16525                 set try
16526                 if eval $compile_ok; then
16527                         if $run ./try 2>/dev/null; then
16528                                 echo "Yes, it can."
16529                                 val="$define"
16530                         else
16531                                 echo "It can't, sorry."
16532                         fi
16533                 else
16534                         echo "(I can't compile the test program, so we'll assume not...)"
16535                 fi
16536                 ;;
16537         esac
16538         $rm_try
16539         ;;
16540 esac
16541 set d_safemcpy
16542 eval $setvar
16543
16544 : can memcmp be trusted to compare relative magnitude?
16545 val="$undef"
16546 case "$d_memcmp" in
16547 "$define")
16548         echo " "
16549         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16550         $cat >try.c <<EOCP
16551 #$i_memory I_MEMORY
16552 #$i_stdlib I_STDLIB
16553 #$i_string I_STRING
16554 #$i_unistd I_UNISTD
16555 EOCP
16556         $cat >>try.c <<'EOCP'
16557 #include <stdio.h>
16558 #ifdef I_MEMORY
16559 #  include <memory.h>
16560 #endif
16561 #ifdef I_STDLIB
16562 #  include <stdlib.h>
16563 #endif
16564 #ifdef I_STRING
16565 #  include <string.h>
16566 #else
16567 #  include <strings.h>
16568 #endif
16569 #ifdef I_UNISTD
16570 #  include <unistd.h>  /* Needed for NetBSD */
16571 #endif
16572 int main()
16573 {
16574 char a = -1;
16575 char b = 0;
16576 if ((a < b) && memcmp(&a, &b, 1) < 0)
16577         exit(1);
16578 exit(0);
16579 }
16580 EOCP
16581         set try
16582         if eval $compile_ok; then
16583                 if $run ./try 2>/dev/null; then
16584                         echo "Yes, it can."
16585                         val="$define"
16586                 else
16587                         echo "No, it can't (it uses signed chars)."
16588                 fi
16589         else
16590                 echo "(I can't compile the test program, so we'll assume not...)"
16591         fi
16592         ;;
16593 esac
16594 $rm_try
16595 set d_sanemcmp
16596 eval $setvar
16597
16598 : see if prototype for sbrk is available
16599 echo " "
16600 set d_sbrkproto sbrk $i_unistd unistd.h
16601 eval $hasproto
16602
16603 : see if select exists
16604 set select d_select
16605 eval $inlibc
16606
16607 : see if semctl exists
16608 set semctl d_semctl
16609 eval $inlibc
16610
16611 : see if semget exists
16612 set semget d_semget
16613 eval $inlibc
16614
16615 : see if semop exists
16616 set semop d_semop
16617 eval $inlibc
16618
16619 : see how much of the 'sem*(2)' library is present.
16620 h_sem=true
16621 echo " "
16622 case "$d_semctl$d_semget$d_semop" in
16623 *"$undef"*) h_sem=false;;
16624 esac
16625 case "$osname" in
16626 freebsd)
16627     case "`ipcs 2>&1`" in
16628     "SVID messages"*"not configured"*)
16629         echo "Your $osname does not have the sem*(2) configured." >&4
16630         h_sem=false
16631         val="$undef"
16632         set semctl d_semctl
16633         eval $setvar
16634         set semget d_semget
16635         eval $setvar
16636         set semop d_semop
16637         eval $setvar
16638         ;;
16639     esac
16640     ;;
16641 esac
16642 : we could also check for sys/ipc.h ...
16643 if $h_sem && $test `./findhdr sys/sem.h`; then
16644         echo "You have the full sem*(2) library." >&4
16645         val="$define"
16646 else
16647         echo "You don't have the full sem*(2) library." >&4
16648         val="$undef"
16649 fi
16650 set d_sem
16651 eval $setvar
16652
16653 : see whether sys/sem.h defines union semun
16654 echo " "
16655 $cat > try.c <<'END'
16656 #include <sys/types.h>
16657 #include <sys/ipc.h>
16658 #include <sys/sem.h>
16659 int main () { union semun semun; semun.buf = 0; }
16660 END
16661 set try
16662 if eval $compile; then
16663     echo "You have union semun in <sys/sem.h>." >&4
16664     val="$define"
16665 else
16666     echo "You do not have union semun in <sys/sem.h>." >&4
16667     val="$undef"
16668 fi
16669 $rm_try
16670 set d_union_semun
16671 eval $setvar
16672
16673 : see how to do semctl IPC_STAT
16674 case "$d_sem" in
16675 $define)
16676     echo " "
16677     $cat > tryh.h <<END
16678 #ifndef S_IRUSR
16679 #   ifdef S_IREAD
16680 #       define S_IRUSR S_IREAD
16681 #       define S_IWUSR S_IWRITE
16682 #       define S_IXUSR S_IEXEC
16683 #   else
16684 #       define S_IRUSR 0400
16685 #       define S_IWUSR 0200
16686 #       define S_IXUSR 0100
16687 #   endif
16688 #   define S_IRGRP (S_IRUSR>>3)
16689 #   define S_IWGRP (S_IWUSR>>3)
16690 #   define S_IXGRP (S_IXUSR>>3)
16691 #   define S_IROTH (S_IRUSR>>6)
16692 #   define S_IWOTH (S_IWUSR>>6)
16693 #   define S_IXOTH (S_IXUSR>>6)
16694 #endif
16695 #ifndef S_IRWXU
16696 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16697 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16698 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16699 #endif
16700 END
16701     : see whether semctl IPC_STAT can use union semun
16702     case "$d_semctl_semun" in
16703     '')
16704       val="$undef"
16705       $cat > try.c <<END
16706 #include <sys/types.h>
16707 #include <sys/ipc.h>
16708 #include <sys/sem.h>
16709 #include <sys/stat.h>
16710 #include <stdio.h>
16711 #include <errno.h>
16712 #include "tryh.h"
16713 #ifndef errno
16714 extern int errno;
16715 #endif
16716 #$d_union_semun HAS_UNION_SEMUN
16717 int main() {
16718     union semun
16719 #ifndef HAS_UNION_SEMUN
16720     {
16721         int val;
16722         struct semid_ds *buf;
16723         unsigned short *array;
16724     }
16725 #endif
16726     arg;
16727     int sem, st;
16728
16729 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16730     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16731     if (sem > -1) {
16732         struct semid_ds argbuf;
16733         arg.buf = &argbuf;
16734 #       ifdef IPC_STAT
16735         st = semctl(sem, 0, IPC_STAT, arg);
16736         if (st == 0)
16737             printf("semun\n");
16738         else
16739 #       endif /* IPC_STAT */
16740             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16741 #       ifdef IPC_RMID
16742         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16743 #       endif /* IPC_RMID */
16744             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16745     } else
16746 #endif /* IPC_PRIVATE && ... */
16747         printf("semget failed: errno = %d\n", errno);
16748   return 0;
16749 }
16750 END
16751       set try
16752       if eval $compile; then
16753           xxx=`$run ./try`
16754           case "$xxx" in
16755           semun) val="$define" ;;
16756           esac
16757       fi
16758       $rm_try
16759       set d_semctl_semun
16760       eval $setvar
16761       ;;
16762     esac
16763     case "$d_semctl_semun" in
16764     $define)
16765         echo "You can use union semun for semctl IPC_STAT." >&4
16766         also='also'
16767         ;;
16768     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16769         also=''
16770         ;;
16771     esac
16772
16773     : see whether semctl IPC_STAT can use struct semid_ds pointer
16774     case "$d_semctl_semid_ds" in
16775     '')
16776       val="$undef"
16777       $cat > try.c <<'END'
16778 #include <sys/types.h>
16779 #include <sys/ipc.h>
16780 #include <sys/sem.h>
16781 #include <sys/stat.h>
16782 #include "tryh.h"
16783 #include <stdio.h>
16784 #include <errno.h>
16785 #ifndef errno
16786 extern int errno;
16787 #endif
16788 int main() {
16789     struct semid_ds arg;
16790     int sem, st;
16791
16792 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16793     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16794     if (sem > -1) {
16795 #       ifdef IPC_STAT
16796         st = semctl(sem, 0, IPC_STAT, &arg);
16797         if (st == 0)
16798             printf("semid_ds\n");
16799         else
16800 #       endif /* IPC_STAT */
16801             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16802 #       ifdef IPC_RMID
16803         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16804 #       endif /* IPC_RMID */
16805             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16806     } else
16807 #endif /* IPC_PRIVATE && ... */
16808         printf("semget failed: errno = %d\n", errno);
16809
16810     return 0;
16811 }
16812 END
16813       set try
16814       if eval $compile; then
16815           xxx=`$run ./try`
16816           case "$xxx" in
16817           semid_ds) val="$define" ;;
16818           esac
16819       fi
16820       $rm_try
16821       set d_semctl_semid_ds
16822       eval $setvar
16823       ;;
16824     esac
16825     case "$d_semctl_semid_ds" in
16826     $define)
16827         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16828         ;;
16829     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16830         ;;
16831     esac
16832     ;;
16833 *)  val="$undef"
16834
16835     # We do not have the full sem*(2) library, so assume we can not
16836     # use either.
16837
16838     set d_semctl_semun
16839     eval $setvar
16840
16841     set d_semctl_semid_ds
16842     eval $setvar
16843     ;;
16844 esac
16845 $rm_try tryh.h
16846
16847 : see if sendmsg exists
16848 set sendmsg d_sendmsg
16849 eval $inlibc
16850
16851 : see if setegid exists
16852 set setegid d_setegid
16853 eval $inlibc
16854
16855 : see if seteuid exists
16856 set seteuid d_seteuid
16857 eval $inlibc
16858
16859 : see if setgrent exists
16860 set setgrent d_setgrent
16861 eval $inlibc
16862
16863 : see if setgrent_r exists
16864 set setgrent_r d_setgrent_r
16865 eval $inlibc
16866 case "$d_setgrent_r" in
16867 "$define")
16868         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16869         case "$d_setgrent_r_proto:$usethreads" in
16870         ":define")      d_setgrent_r_proto=define
16871                 set d_setgrent_r_proto setgrent_r $hdrs
16872                 eval $hasproto ;;
16873         *)      ;;
16874         esac
16875         case "$d_setgrent_r_proto" in
16876         define)
16877         case "$setgrent_r_proto" in
16878         ''|0) try='int setgrent_r(FILE**);'
16879         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16880         esac
16881         case "$setgrent_r_proto" in
16882         ''|0) try='void setgrent_r(FILE**);'
16883         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16884         esac
16885         case "$setgrent_r_proto" in
16886         ''|0)   d_setgrent_r=undef
16887                 setgrent_r_proto=0
16888                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16889         * )     case "$setgrent_r_proto" in
16890                 REENTRANT_PROTO*) ;;
16891                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16892                 esac
16893                 echo "Prototype: $try" ;;
16894         esac
16895         ;;
16896         *)      case "$usethreads" in
16897                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16898                 esac
16899                 d_setgrent_r=undef
16900                 setgrent_r_proto=0
16901                 ;;
16902         esac
16903         ;;
16904 *)      setgrent_r_proto=0
16905         ;;
16906 esac
16907
16908 : see if sethostent exists
16909 set sethostent d_sethent
16910 eval $inlibc
16911
16912 : see if sethostent_r exists
16913 set sethostent_r d_sethostent_r
16914 eval $inlibc
16915 case "$d_sethostent_r" in
16916 "$define")
16917         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16918         case "$d_sethostent_r_proto:$usethreads" in
16919         ":define")      d_sethostent_r_proto=define
16920                 set d_sethostent_r_proto sethostent_r $hdrs
16921                 eval $hasproto ;;
16922         *)      ;;
16923         esac
16924         case "$d_sethostent_r_proto" in
16925         define)
16926         case "$sethostent_r_proto" in
16927         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16928         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16929         esac
16930         case "$sethostent_r_proto" in
16931         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16932         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16933         esac
16934         case "$sethostent_r_proto" in
16935         ''|0)   d_sethostent_r=undef
16936                 sethostent_r_proto=0
16937                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16938         * )     case "$sethostent_r_proto" in
16939                 REENTRANT_PROTO*) ;;
16940                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16941                 esac
16942                 echo "Prototype: $try" ;;
16943         esac
16944         ;;
16945         *)      case "$usethreads" in
16946                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16947                 esac
16948                 d_sethostent_r=undef
16949                 sethostent_r_proto=0
16950                 ;;
16951         esac
16952         ;;
16953 *)      sethostent_r_proto=0
16954         ;;
16955 esac
16956
16957 : see if setitimer exists
16958 set setitimer d_setitimer
16959 eval $inlibc
16960
16961 : see if setlinebuf exists
16962 set setlinebuf d_setlinebuf
16963 eval $inlibc
16964
16965 : see if setlocale exists
16966 set setlocale d_setlocale
16967 eval $inlibc
16968
16969 : see if locale.h is available
16970 set locale.h i_locale
16971 eval $inhdr
16972
16973 : see if setlocale_r exists
16974 set setlocale_r d_setlocale_r
16975 eval $inlibc
16976 case "$d_setlocale_r" in
16977 "$define")
16978         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16979         case "$d_setlocale_r_proto:$usethreads" in
16980         ":define")      d_setlocale_r_proto=define
16981                 set d_setlocale_r_proto setlocale_r $hdrs
16982                 eval $hasproto ;;
16983         *)      ;;
16984         esac
16985         case "$d_setlocale_r_proto" in
16986         define)
16987         case "$setlocale_r_proto" in
16988         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16989         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16990         esac
16991         case "$setlocale_r_proto" in
16992         ''|0)   d_setlocale_r=undef
16993                 setlocale_r_proto=0
16994                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16995         * )     case "$setlocale_r_proto" in
16996                 REENTRANT_PROTO*) ;;
16997                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16998                 esac
16999                 echo "Prototype: $try" ;;
17000         esac
17001         ;;
17002         *)      case "$usethreads" in
17003                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17004                 esac
17005                 d_setlocale_r=undef
17006                 setlocale_r_proto=0
17007                 ;;
17008         esac
17009         ;;
17010 *)      setlocale_r_proto=0
17011         ;;
17012 esac
17013
17014 : see if setnetent exists
17015 set setnetent d_setnent
17016 eval $inlibc
17017
17018 : see if setnetent_r exists
17019 set setnetent_r d_setnetent_r
17020 eval $inlibc
17021 case "$d_setnetent_r" in
17022 "$define")
17023         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17024         case "$d_setnetent_r_proto:$usethreads" in
17025         ":define")      d_setnetent_r_proto=define
17026                 set d_setnetent_r_proto setnetent_r $hdrs
17027                 eval $hasproto ;;
17028         *)      ;;
17029         esac
17030         case "$d_setnetent_r_proto" in
17031         define)
17032         case "$setnetent_r_proto" in
17033         ''|0) try='int setnetent_r(int, struct netent_data*);'
17034         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17035         esac
17036         case "$setnetent_r_proto" in
17037         ''|0) try='void setnetent_r(int, struct netent_data*);'
17038         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17039         esac
17040         case "$setnetent_r_proto" in
17041         ''|0)   d_setnetent_r=undef
17042                 setnetent_r_proto=0
17043                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17044         * )     case "$setnetent_r_proto" in
17045                 REENTRANT_PROTO*) ;;
17046                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17047                 esac
17048                 echo "Prototype: $try" ;;
17049         esac
17050         ;;
17051         *)      case "$usethreads" in
17052                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17053                 esac
17054                 d_setnetent_r=undef
17055                 setnetent_r_proto=0
17056                 ;;
17057         esac
17058         ;;
17059 *)      setnetent_r_proto=0
17060         ;;
17061 esac
17062
17063 : see if setprotoent exists
17064 set setprotoent d_setpent
17065 eval $inlibc
17066
17067 : see if setpgid exists
17068 set setpgid d_setpgid
17069 eval $inlibc
17070
17071 : see if setpgrp2 exists
17072 set setpgrp2 d_setpgrp2
17073 eval $inlibc
17074
17075 : see if setpriority exists
17076 set setpriority d_setprior
17077 eval $inlibc
17078
17079 : see if setproctitle exists
17080 set setproctitle d_setproctitle
17081 eval $inlibc
17082
17083 : see if setprotoent_r exists
17084 set setprotoent_r d_setprotoent_r
17085 eval $inlibc
17086 case "$d_setprotoent_r" in
17087 "$define")
17088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17089         case "$d_setprotoent_r_proto:$usethreads" in
17090         ":define")      d_setprotoent_r_proto=define
17091                 set d_setprotoent_r_proto setprotoent_r $hdrs
17092                 eval $hasproto ;;
17093         *)      ;;
17094         esac
17095         case "$d_setprotoent_r_proto" in
17096         define)
17097         case "$setprotoent_r_proto" in
17098         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17099         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17100         esac
17101         case "$setprotoent_r_proto" in
17102         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17103         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17104         esac
17105         case "$setprotoent_r_proto" in
17106         ''|0)   d_setprotoent_r=undef
17107                 setprotoent_r_proto=0
17108                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17109         * )     case "$setprotoent_r_proto" in
17110                 REENTRANT_PROTO*) ;;
17111                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17112                 esac
17113                 echo "Prototype: $try" ;;
17114         esac
17115         ;;
17116         *)      case "$usethreads" in
17117                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17118                 esac
17119                 d_setprotoent_r=undef
17120                 setprotoent_r_proto=0
17121                 ;;
17122         esac
17123         ;;
17124 *)      setprotoent_r_proto=0
17125         ;;
17126 esac
17127
17128 : see if setpwent exists
17129 set setpwent d_setpwent
17130 eval $inlibc
17131
17132 : see if setpwent_r exists
17133 set setpwent_r d_setpwent_r
17134 eval $inlibc
17135 case "$d_setpwent_r" in
17136 "$define")
17137         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17138         case "$d_setpwent_r_proto:$usethreads" in
17139         ":define")      d_setpwent_r_proto=define
17140                 set d_setpwent_r_proto setpwent_r $hdrs
17141                 eval $hasproto ;;
17142         *)      ;;
17143         esac
17144         case "$d_setpwent_r_proto" in
17145         define)
17146         case "$setpwent_r_proto" in
17147         ''|0) try='int setpwent_r(FILE**);'
17148         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17149         esac
17150         case "$setpwent_r_proto" in
17151         ''|0) try='void setpwent_r(FILE**);'
17152         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17153         esac
17154         case "$setpwent_r_proto" in
17155         ''|0)   d_setpwent_r=undef
17156                 setpwent_r_proto=0
17157                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17158         * )     case "$setpwent_r_proto" in
17159                 REENTRANT_PROTO*) ;;
17160                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17161                 esac
17162                 echo "Prototype: $try" ;;
17163         esac
17164         ;;
17165         *)      case "$usethreads" in
17166                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17167                 esac
17168                 d_setpwent_r=undef
17169                 setpwent_r_proto=0
17170                 ;;
17171         esac
17172         ;;
17173 *)      setpwent_r_proto=0
17174         ;;
17175 esac
17176
17177 : see if setregid exists
17178 set setregid d_setregid
17179 eval $inlibc
17180 set setresgid d_setresgid
17181 eval $inlibc
17182
17183 : see if setreuid exists
17184 set setreuid d_setreuid
17185 eval $inlibc
17186 set setresuid d_setresuid
17187 eval $inlibc
17188
17189 : see if setrgid exists
17190 set setrgid d_setrgid
17191 eval $inlibc
17192
17193 : see if setruid exists
17194 set setruid d_setruid
17195 eval $inlibc
17196
17197 : see if setservent exists
17198 set setservent d_setsent
17199 eval $inlibc
17200
17201 : see if setservent_r exists
17202 set setservent_r d_setservent_r
17203 eval $inlibc
17204 case "$d_setservent_r" in
17205 "$define")
17206         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17207         case "$d_setservent_r_proto:$usethreads" in
17208         ":define")      d_setservent_r_proto=define
17209                 set d_setservent_r_proto setservent_r $hdrs
17210                 eval $hasproto ;;
17211         *)      ;;
17212         esac
17213         case "$d_setservent_r_proto" in
17214         define)
17215         case "$setservent_r_proto" in
17216         ''|0) try='int setservent_r(int, struct servent_data*);'
17217         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17218         esac
17219         case "$setservent_r_proto" in
17220         ''|0) try='void setservent_r(int, struct servent_data*);'
17221         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17222         esac
17223         case "$setservent_r_proto" in
17224         ''|0)   d_setservent_r=undef
17225                 setservent_r_proto=0
17226                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17227         * )     case "$setservent_r_proto" in
17228                 REENTRANT_PROTO*) ;;
17229                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17230                 esac
17231                 echo "Prototype: $try" ;;
17232         esac
17233         ;;
17234         *)      case "$usethreads" in
17235                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17236                 esac
17237                 d_setservent_r=undef
17238                 setservent_r_proto=0
17239                 ;;
17240         esac
17241         ;;
17242 *)      setservent_r_proto=0
17243         ;;
17244 esac
17245
17246 : see if setsid exists
17247 set setsid d_setsid
17248 eval $inlibc
17249
17250 : see if setvbuf exists
17251 set setvbuf d_setvbuf
17252 eval $inlibc
17253
17254 : see if sfio.h is available
17255 set sfio.h i_sfio
17256 eval $inhdr
17257
17258 : see if sfio library is available
17259 case "$i_sfio" in
17260 $define)
17261         val=''
17262         set sfreserve val
17263         eval $inlibc
17264         ;;
17265 *)
17266         val="$undef"
17267         ;;
17268 esac
17269 : Ok, but do we want to use it.
17270 case "$val" in
17271 $define)
17272         case "$usesfio" in
17273         true|$define|[yY]*) dflt='y';;
17274         *) dflt='n';;
17275         esac
17276         echo "$package can use the sfio library, but it is experimental."
17277         case "$useperlio" in
17278         "$undef")
17279             echo "For sfio also the PerlIO abstraction layer is needed."
17280             echo "Earlier you said you wouldn't want that."
17281             ;;
17282         esac
17283         rp="You seem to have sfio available, do you want to try using it?"
17284         . ./myread
17285         case "$ans" in
17286         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17287                 useperlio="$define"
17288                 val="$define"
17289                 ;;
17290         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17291                 val="$undef"
17292                 ;;
17293         esac
17294         ;;
17295 *)      case "$usesfio" in
17296         true|$define|[yY]*)
17297                 echo "Sorry, cannot find sfio on this machine." >&4
17298                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17299                 val="$undef"
17300                 ;;
17301         esac
17302         ;;
17303 esac
17304 set d_sfio
17305 eval $setvar
17306 case "$d_sfio" in
17307 $define) usesfio='true';;
17308 *) usesfio='false';;
17309 esac
17310 case "$d_sfio" in
17311 $define) ;;
17312 *)      : Remove sfio from list of libraries to use
17313         case "$libs" in
17314         *-lsfio*)
17315                 echo "Removing unneeded -lsfio from library list" >&4
17316                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17317                 shift
17318                 libs="$*"
17319                 echo "libs = $libs" >&4
17320                 ;;
17321         esac
17322 ;;
17323 esac
17324
17325
17326 : see if shmctl exists
17327 set shmctl d_shmctl
17328 eval $inlibc
17329
17330 : see if shmget exists
17331 set shmget d_shmget
17332 eval $inlibc
17333
17334 : see if shmat exists
17335 set shmat d_shmat
17336 eval $inlibc
17337 : see what shmat returns
17338 case "$d_shmat" in
17339 "$define")
17340         $cat >shmat.c <<'END'
17341 #include <sys/shm.h>
17342 void *shmat();
17343 END
17344         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17345                 shmattype='void *'
17346         else
17347                 shmattype='char *'
17348         fi
17349         echo "and it returns ($shmattype)." >&4
17350         : see if a prototype for shmat is available
17351         xxx=`./findhdr sys/shm.h`
17352         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17353         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17354                 val="$define"
17355         else
17356                 val="$undef"
17357         fi
17358         $rm -f shmat.[co]
17359         ;;
17360 *)
17361         val="$undef"
17362         ;;
17363 esac
17364 set d_shmatprototype
17365 eval $setvar
17366
17367 : see if shmdt exists
17368 set shmdt d_shmdt
17369 eval $inlibc
17370
17371 : see how much of the 'shm*(2)' library is present.
17372 h_shm=true
17373 echo " "
17374 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17375 *"$undef"*) h_shm=false;;
17376 esac
17377 case "$osname" in
17378 freebsd)
17379     case "`ipcs 2>&1`" in
17380     "SVID shared memory"*"not configured"*)
17381         echo "Your $osname does not have the shm*(2) configured." >&4
17382         h_shm=false
17383         val="$undef"
17384         set shmctl d_shmctl
17385         evat $setvar
17386         set shmget d_shmget
17387         evat $setvar
17388         set shmat d_shmat
17389         evat $setvar
17390         set shmdt d_shmdt
17391         evat $setvar
17392         ;;
17393     esac
17394     ;;
17395 esac
17396 : we could also check for sys/ipc.h ...
17397 if $h_shm && $test `./findhdr sys/shm.h`; then
17398         echo "You have the full shm*(2) library." >&4
17399         val="$define"
17400 else
17401         echo "You don't have the full shm*(2) library." >&4
17402         val="$undef"
17403 fi
17404 set d_shm
17405 eval $setvar
17406
17407 : see if we have sigaction
17408 echo " "
17409 if set sigaction val -f d_sigaction; eval $csym; $val; then
17410         echo 'sigaction() found.' >&4
17411         $cat > try.c <<EOP
17412 #include <stdio.h>
17413 #include <sys/types.h>
17414 #include <signal.h>
17415 #$i_stdlib I_STDLIB
17416 #ifdef I_STDLIB
17417 #include <stdlib.h>
17418 #endif
17419 int main()
17420 {
17421     struct sigaction act, oact;
17422     act.sa_flags = 0;
17423     oact.sa_handler = 0;
17424     /* so that act and oact are used */
17425     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17426 }
17427 EOP
17428         set try
17429         if eval $compile_ok; then
17430                 val="$define"
17431         else
17432                 echo "But you don't seem to have a useable struct sigaction." >&4
17433                 val="$undef"
17434         fi
17435 else
17436         echo 'sigaction NOT found.' >&4
17437         val="$undef"
17438 fi
17439 set d_sigaction; eval $setvar
17440 $rm_try
17441
17442 : see if this is a sunmath.h system
17443 set sunmath.h i_sunmath
17444 eval $inhdr
17445
17446 : see if signbit exists
17447 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17448 $cat >try.c <<EOCP
17449 #$i_math I_MATH
17450 #$i_sunmath I_SUNMATH
17451 #ifdef I_MATH
17452 #  include <math.h>
17453 #endif
17454 #ifdef I_SUNMATH  /* Solaris special math library */
17455 #  include <sunmath.h>
17456 #endif
17457 #define NV $nvtype
17458 int main(int argc, char **argv)
17459 {
17460     NV x = 0.0;
17461     NV y = -0.0;
17462     if ((signbit(x) == 0) && (signbit(y) != 0))
17463         return 0;
17464     else
17465         return 1;
17466 }
17467 EOCP
17468 val="$undef"
17469 set try
17470 if eval $compile; then
17471     if $run ./try; then
17472         $echo "Yes." >&4
17473         val="$define"
17474     else
17475         $echo "Signbit seems to be available, but doesn't work as I expected."
17476         $echo "I won't use it." >&4
17477         val="$undef"
17478     fi
17479 else
17480     $echo "Nope." >&4
17481     dflt="$undef"
17482 fi
17483 set d_signbit
17484 eval $setvar
17485 $rm_try
17486
17487 : see if sigprocmask exists
17488 set sigprocmask d_sigprocmask
17489 eval $inlibc
17490
17491 : see if sigsetjmp exists
17492 echo " "
17493 case "$d_sigsetjmp" in
17494 '')
17495         $cat >try.c <<EOP
17496 #include <setjmp.h>
17497 #$i_stdlib I_STDLIB
17498 #ifdef I_STDLIB
17499 #include <stdlib.h>
17500 #endif
17501 sigjmp_buf env;
17502 int set = 1;
17503 int main()
17504 {
17505         if (sigsetjmp(env,1))
17506                 exit(set);
17507         set = 0;
17508         siglongjmp(env, 1);
17509         exit(1);
17510 }
17511 EOP
17512         set try
17513         if eval $compile; then
17514                 if $run ./try >/dev/null 2>&1; then
17515                         echo "POSIX sigsetjmp found." >&4
17516                         val="$define"
17517                 else
17518                         $cat >&4 <<EOM
17519 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17520 I'll ignore them.
17521 EOM
17522                         val="$undef"
17523                 fi
17524         else
17525                 echo "sigsetjmp not found." >&4
17526                 val="$undef"
17527         fi
17528         ;;
17529 *) val="$d_sigsetjmp"
17530         case "$d_sigsetjmp" in
17531         $define) echo "POSIX sigsetjmp found." >&4;;
17532         $undef) echo "sigsetjmp not found." >&4;;
17533         esac
17534         ;;
17535 esac
17536 set d_sigsetjmp
17537 eval $setvar
17538 $rm_try
17539
17540 : see if snprintf exists
17541 set snprintf d_snprintf
17542 eval $inlibc
17543
17544 : see if vsnprintf exists
17545 set vsnprintf d_vsnprintf
17546 eval $inlibc
17547
17548 case "$d_snprintf-$d_vsnprintf" in
17549 "$define-$define")
17550     $cat <<EOM
17551 Checking whether your snprintf() and vsnprintf() work okay...
17552 EOM
17553     $cat >try.c <<'EOCP'
17554 /* v?snprintf testing logic courtesy of Russ Allbery.
17555  * According to C99:
17556  * - if the buffer is too short it still must be \0-terminated
17557  * - if the buffer is too short the potentially required length
17558  *   must be returned and not -1
17559  * - if the buffer is NULL the potentially required length
17560  *   must be returned and not -1 or core dump
17561  */
17562 #include <stdio.h>
17563 #include <stdarg.h>
17564
17565 char buf[2];
17566
17567 int test (char *format, ...)
17568 {
17569     va_list args;
17570     int count;
17571
17572     va_start (args, format);
17573     count = vsnprintf (buf, sizeof buf, format, args);
17574     va_end (args);
17575     return count;
17576 }
17577
17578 int main ()
17579 {
17580     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17581              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17582 }
17583 EOCP
17584     set try
17585     if eval $compile; then
17586         `$run ./try`
17587         case "$?" in
17588         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17589         *) cat <<EOM >&4
17590 Your snprintf() and snprintf() don't seem to be working okay.
17591 EOM
17592            d_snprintf="$undef"
17593            d_vsnprintf="$undef"
17594            ;;
17595         esac
17596     else
17597         echo "(I can't seem to compile the test program--assuming they don't)"
17598         d_snprintf="$undef"
17599         d_vsnprintf="$undef"
17600     fi
17601     $rm_try
17602     ;;
17603 esac
17604
17605 : see if sockatmark exists
17606 set sockatmark d_sockatmark
17607 eval $inlibc
17608
17609 : see if prototype for sockatmark is available
17610 echo " "
17611 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17612 eval $hasproto
17613
17614 : see if socks5_init exists
17615 set socks5_init d_socks5_init
17616 eval $inlibc
17617
17618 : see if sprintf returns the length of the string in the buffer as per ANSI
17619 $echo "Checking whether sprintf returns the length of the string..." >&4
17620 $cat <<EOP >try.c
17621 #include <stdio.h>
17622 #$i_stdlib I_STDLIB
17623 #ifdef I_STDLIB
17624 #include <stdlib.h>
17625 #endif
17626 #$i_string I_STRING
17627 #ifdef I_STRING
17628 #  include <string.h>
17629 #else
17630 #  include <strings.h>
17631 #endif
17632 #$i_math I_MATH
17633 #ifdef I_MATH
17634 #include <math.h>
17635 #endif
17636
17637 char buffer[256];
17638
17639 int check (size_t expect, int test) {
17640   size_t got = strlen(buffer);
17641   if (expect == got)
17642     return 0;
17643
17644   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17645        test, buffer);
17646   exit (test);
17647 }
17648
17649 int main(int argc, char **argv) {
17650   int test = 0;
17651
17652   check(sprintf(buffer, ""), ++test);
17653   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17654   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17655
17656   return 0;
17657 }
17658 EOP
17659 set try
17660
17661 if eval $compile; then
17662     xxx="`$run ./try`"
17663     case "$?" in
17664         0) cat >&4 <<EOM
17665 sprintf returns the length of the string (as ANSI says it should)
17666 EOM
17667         d_sprintf_returns_strlen="$define"
17668         ;;
17669         *) cat >&4 <<EOM
17670 sprintf does not return the length of the string (how old is this system?)
17671 EOM
17672         d_sprintf_returns_strlen="$undef"
17673         ;;
17674     esac
17675 else
17676     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17677     d_sprintf_returns_strlen="$undef"
17678 fi
17679 $rm_try
17680
17681 : see if srand48_r exists
17682 set srand48_r d_srand48_r
17683 eval $inlibc
17684 case "$d_srand48_r" in
17685 "$define")
17686         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17687         case "$d_srand48_r_proto:$usethreads" in
17688         ":define")      d_srand48_r_proto=define
17689                 set d_srand48_r_proto srand48_r $hdrs
17690                 eval $hasproto ;;
17691         *)      ;;
17692         esac
17693         case "$d_srand48_r_proto" in
17694         define)
17695         case "$srand48_r_proto" in
17696         ''|0) try='int srand48_r(long, struct drand48_data*);'
17697         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17698         esac
17699         case "$srand48_r_proto" in
17700         ''|0)   d_srand48_r=undef
17701                 srand48_r_proto=0
17702                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17703         * )     case "$srand48_r_proto" in
17704                 REENTRANT_PROTO*) ;;
17705                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17706                 esac
17707                 echo "Prototype: $try" ;;
17708         esac
17709         ;;
17710         *)      case "$usethreads" in
17711                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17712                 esac
17713                 d_srand48_r=undef
17714                 srand48_r_proto=0
17715                 ;;
17716         esac
17717         ;;
17718 *)      srand48_r_proto=0
17719         ;;
17720 esac
17721
17722 : see if srandom_r exists
17723 set srandom_r d_srandom_r
17724 eval $inlibc
17725 case "$d_srandom_r" in
17726 "$define")
17727         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17728         case "$d_srandom_r_proto:$usethreads" in
17729         ":define")      d_srandom_r_proto=define
17730                 set d_srandom_r_proto srandom_r $hdrs
17731                 eval $hasproto ;;
17732         *)      ;;
17733         esac
17734         case "$d_srandom_r_proto" in
17735         define)
17736         case "$srandom_r_proto" in
17737         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17738         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17739         esac
17740         case "$srandom_r_proto" in
17741         ''|0)   d_srandom_r=undef
17742                 srandom_r_proto=0
17743                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17744         * )     case "$srandom_r_proto" in
17745                 REENTRANT_PROTO*) ;;
17746                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17747                 esac
17748                 echo "Prototype: $try" ;;
17749         esac
17750         ;;
17751         *)      case "$usethreads" in
17752                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17753                 esac
17754                 d_srandom_r=undef
17755                 srandom_r_proto=0
17756                 ;;
17757         esac
17758         ;;
17759 *)      srandom_r_proto=0
17760         ;;
17761 esac
17762
17763 : see if prototype for setresgid is available
17764 echo " "
17765 set d_sresgproto setresgid $i_unistd unistd.h
17766 eval $hasproto
17767
17768 : see if prototype for setresuid is available
17769 echo " "
17770 set d_sresuproto setresuid $i_unistd unistd.h
17771 eval $hasproto
17772
17773 : see if sys/stat.h is available
17774 set sys/stat.h i_sysstat
17775 eval $inhdr
17776
17777 : see if stat knows about block sizes
17778 echo " "
17779 echo "Checking to see if your struct stat has st_blocks field..." >&4
17780 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17781 eval $hasfield
17782
17783 : see if this is a sys/vfs.h system
17784 set sys/vfs.h i_sysvfs
17785 eval $inhdr
17786
17787 : see if this is a sys/statfs.h system
17788 set sys/statfs.h i_sysstatfs
17789 eval $inhdr
17790
17791 : Check for statfs_s
17792 echo " "
17793 echo "Checking to see if your system supports struct statfs..." >&4
17794 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
17795 eval $hasstruct
17796 case "$d_statfs_s" in
17797 "$define")      echo "Yes, it does."   ;;
17798 *)              echo "No, it doesn't." ;;
17799 esac
17800
17801
17802 : see if struct statfs knows about f_flags
17803 case "$d_statfs_s" in
17804 define)
17805         echo " "
17806         echo "Checking to see if your struct statfs has f_flags field..." >&4
17807         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
17808         eval $hasfield
17809         ;;
17810 *)      val="$undef"
17811         set d_statfs_f_flags
17812         eval $setvar
17813         ;;
17814 esac
17815 case "$d_statfs_f_flags" in
17816 "$define")      echo "Yes, it does."   ;;
17817 *)              echo "No, it doesn't." ;;
17818 esac
17819
17820 : Check stream access
17821 $cat >&4 <<EOM
17822 Checking how to access stdio streams by file descriptor number...
17823 EOM
17824 case "$stdio_stream_array" in
17825 '')     $cat >try.c <<EOCP
17826 #include <stdio.h>
17827 int main() {
17828   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17829     printf("yes\n");
17830 }
17831 EOCP
17832         for s in _iob __iob __sF
17833         do
17834                 set try -DSTDIO_STREAM_ARRAY=$s
17835                 if eval $compile; then
17836                         case "`$run ./try`" in
17837                         yes)    stdio_stream_array=$s; break ;;
17838                         esac
17839                 fi
17840         done
17841         $rm_try
17842 esac
17843 case "$stdio_stream_array" in
17844 '')     $cat >&4 <<EOM
17845 I can't figure out how to access stdio streams by file descriptor number.
17846 EOM
17847         d_stdio_stream_array="$undef"
17848         ;;
17849 *)      $cat >&4 <<EOM
17850 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17851 EOM
17852         d_stdio_stream_array="$define"
17853         ;;
17854 esac
17855
17856 : see if strcoll exists
17857 set strcoll d_strcoll
17858 eval $inlibc
17859
17860 : check for structure copying
17861 echo " "
17862 echo "Checking to see if your C compiler can copy structs..." >&4
17863 $cat >try.c <<'EOCP'
17864 int main()
17865 {
17866         struct blurfl {
17867                 int dyick;
17868         } foo, bar;
17869
17870         foo = bar;
17871 }
17872 EOCP
17873 if $cc -c try.c >/dev/null 2>&1 ; then
17874         val="$define"
17875         echo "Yup, it can."
17876 else
17877         val="$undef"
17878         echo "Nope, it can't."
17879 fi
17880 set d_strctcpy
17881 eval $setvar
17882 $rm_try
17883
17884 : see if strerror and/or sys_errlist[] exist
17885 echo " "
17886 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17887     if set strerror val -f d_strerror; eval $csym; $val; then
17888                 echo 'strerror() found.' >&4
17889                 d_strerror="$define"
17890                 d_strerrm='strerror(e)'
17891                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17892                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17893                         d_syserrlst="$define"
17894                 else
17895                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17896                         d_syserrlst="$undef"
17897                 fi
17898     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17899                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17900                 echo 'strerror() found in string header.' >&4
17901                 d_strerror="$define"
17902                 d_strerrm='strerror(e)'
17903                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17904                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17905                                 d_syserrlst="$define"
17906                 else
17907                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17908                         d_syserrlst="$undef"
17909                 fi
17910     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17911                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17912                 d_strerror="$undef"
17913                 d_syserrlst="$define"
17914                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17915     else
17916                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17917                 d_strerror="$undef"
17918                 d_syserrlst="$undef"
17919                 d_strerrm='"unknown"'
17920     fi
17921 fi
17922
17923 : see if strerror_r exists
17924 set strerror_r d_strerror_r
17925 eval $inlibc
17926 case "$d_strerror_r" in
17927 "$define")
17928         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17929         case "$d_strerror_r_proto:$usethreads" in
17930         ":define")      d_strerror_r_proto=define
17931                 set d_strerror_r_proto strerror_r $hdrs
17932                 eval $hasproto ;;
17933         *)      ;;
17934         esac
17935         case "$d_strerror_r_proto" in
17936         define)
17937         case "$strerror_r_proto" in
17938         ''|0) try='int strerror_r(int, char*, size_t);'
17939         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17940         esac
17941         case "$strerror_r_proto" in
17942         ''|0) try='int strerror_r(int, char*, int);'
17943         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17944         esac
17945         case "$strerror_r_proto" in
17946         ''|0) try='char* strerror_r(int, char*, size_t);'
17947         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17948         esac
17949         case "$strerror_r_proto" in
17950         ''|0)   d_strerror_r=undef
17951                 strerror_r_proto=0
17952                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17953         * )     case "$strerror_r_proto" in
17954                 REENTRANT_PROTO*) ;;
17955                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17956                 esac
17957                 echo "Prototype: $try" ;;
17958         esac
17959         ;;
17960         *)      case "$usethreads" in
17961                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17962                 esac
17963                 d_strerror_r=undef
17964                 strerror_r_proto=0
17965                 ;;
17966         esac
17967         ;;
17968 *)      strerror_r_proto=0
17969         ;;
17970 esac
17971
17972 : see if strftime exists
17973 set strftime d_strftime
17974 eval $inlibc
17975
17976 : see if strlcat exists
17977 set strlcat d_strlcat
17978 eval $inlibc
17979
17980 : see if strlcpy exists
17981 set strlcpy d_strlcpy
17982 eval $inlibc
17983
17984 : see if strtod exists
17985 set strtod d_strtod
17986 eval $inlibc
17987
17988 : see if strtol exists
17989 set strtol d_strtol
17990 eval $inlibc
17991
17992 : see if strtold exists
17993 set strtold d_strtold
17994 eval $inlibc
17995
17996 : see if strtoll exists
17997 set strtoll d_strtoll
17998 eval $inlibc
17999
18000 case "$d_longlong-$d_strtoll" in
18001 "$define-$define")
18002         $cat <<EOM
18003 Checking whether your strtoll() works okay...
18004 EOM
18005         $cat >try.c <<'EOCP'
18006 #include <errno.h>
18007 #ifdef __hpux
18008 #define strtoll __strtoll
18009 #endif
18010 #ifdef __EMX__
18011 #define strtoll _strtoll
18012 #endif
18013 #include <stdio.h>
18014 extern long long int strtoll(char *s, char **, int);
18015 static int bad = 0;
18016 int check(char *s, long long ell, int een) {
18017         long long gll;
18018         errno = 0;
18019         gll = strtoll(s, 0, 10);
18020         if (!((gll == ell) && (errno == een)))
18021                 bad++;
18022 }
18023 int main() {
18024         check(" 1",                                      1LL, 0);
18025         check(" 0",                                      0LL, 0);
18026         check("-1",                                     -1LL, 0);
18027         check("-9223372036854775808", -9223372036854775808LL, 0);
18028         check("-9223372036854775808", -9223372036854775808LL, 0);
18029         check(" 9223372036854775807",  9223372036854775807LL, 0);
18030         check("-9223372036854775808", -9223372036854775808LL, 0);
18031         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18032         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18033         if (!bad)
18034                 printf("ok\n");
18035 }
18036 EOCP
18037         set try
18038         if eval $compile; then
18039                 yyy=`$run ./try`
18040                 case "$yyy" in
18041                 ok) echo "Your strtoll() seems to be working okay." ;;
18042                 *) cat <<EOM >&4
18043 Your strtoll() doesn't seem to be working okay.
18044 EOM
18045                    d_strtoll="$undef"
18046                    ;;
18047                 esac
18048         else
18049                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18050                 d_strtoll="$undef"
18051         fi
18052         ;;
18053 esac
18054
18055 : see if strtoq exists
18056 set strtoq d_strtoq
18057 eval $inlibc
18058
18059 : see if strtoul exists
18060 set strtoul d_strtoul
18061 eval $inlibc
18062
18063 case "$d_strtoul" in
18064 "$define")
18065         $cat <<EOM
18066 Checking whether your strtoul() works okay...
18067 EOM
18068         $cat >try.c <<'EOCP'
18069 #include <errno.h>
18070 #include <stdio.h>
18071 extern unsigned long int strtoul(char *s, char **, int);
18072 static int bad = 0;
18073 void check(char *s, unsigned long eul, int een) {
18074         unsigned long gul;
18075         errno = 0;
18076         gul = strtoul(s, 0, 10);
18077         if (!((gul == eul) && (errno == een)))
18078                 bad++;
18079 }
18080 int main() {
18081         check(" 1", 1L, 0);
18082         check(" 0", 0L, 0);
18083 EOCP
18084         case "$longsize" in
18085         8)
18086             $cat >>try.c <<'EOCP'
18087         check("18446744073709551615", 18446744073709551615UL, 0);
18088         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18089 #if 0 /* strtoul() for /^-/ strings is undefined. */
18090         check("-1", 18446744073709551615UL, 0);
18091         check("-18446744073709551614", 2, 0);
18092         check("-18446744073709551615", 1, 0);
18093         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18094         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18095 #endif
18096 EOCP
18097                 ;;
18098         4)
18099                     $cat >>try.c <<'EOCP'
18100         check("4294967295", 4294967295UL, 0);
18101         check("4294967296", 4294967295UL, ERANGE);
18102 #if 0 /* strtoul() for /^-/ strings is undefined. */
18103         check("-1", 4294967295UL, 0);
18104         check("-4294967294", 2, 0);
18105         check("-4294967295", 1, 0);
18106         check("-4294967296", 4294967295UL, ERANGE);
18107         check("-4294967297", 4294967295UL, ERANGE);
18108 #endif
18109 EOCP
18110                 ;;
18111         *)
18112 : Should we write these tests to be more portable by sprintf-ing
18113 : ~0 and then manipulating that char string as input for strtol?
18114                 ;;
18115         esac
18116         $cat >>try.c <<'EOCP'
18117         if (!bad)
18118                 printf("ok\n");
18119         return 0;
18120 }
18121 EOCP
18122         set try
18123         if eval $compile; then
18124                 case "`$run ./try`" in
18125                 ok) echo "Your strtoul() seems to be working okay." ;;
18126                 *) cat <<EOM >&4
18127 Your strtoul() doesn't seem to be working okay.
18128 EOM
18129                    d_strtoul="$undef"
18130                    ;;
18131                 esac
18132         else
18133                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18134                 d_strtoul="$undef"
18135         fi
18136         ;;
18137 esac
18138
18139 : see if strtoull exists
18140 set strtoull d_strtoull
18141 eval $inlibc
18142
18143 case "$d_longlong-$d_strtoull" in
18144 "$define-$define")
18145         $cat <<EOM
18146 Checking whether your strtoull() works okay...
18147 EOM
18148         $cat >try.c <<'EOCP'
18149 #include <errno.h>
18150 #ifdef __hpux
18151 #define strtoull __strtoull
18152 #endif
18153 #include <stdio.h>
18154 extern unsigned long long int strtoull(char *s, char **, int);
18155 static int bad = 0;
18156 int check(char *s, long long eull, int een) {
18157         long long gull;
18158         errno = 0;
18159         gull = strtoull(s, 0, 10);
18160         if (!((gull == eull) && (errno == een)))
18161                 bad++;
18162 }
18163 int main() {
18164         check(" 1",                                        1LL, 0);
18165         check(" 0",                                        0LL, 0);
18166         check("18446744073709551615",  18446744073709551615ULL, 0);
18167         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18168 #if 0 /* strtoull() for /^-/ strings is undefined. */
18169         check("-1",                    18446744073709551615ULL, 0);
18170         check("-18446744073709551614",                     2LL, 0);
18171         check("-18446744073709551615",                     1LL, 0);
18172         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18173         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18174 #endif
18175         if (!bad)
18176                 printf("ok\n");
18177 }
18178 EOCP
18179         set try
18180         if eval $compile; then
18181                 case "`$run ./try`" in
18182                 ok) echo "Your strtoull() seems to be working okay." ;;
18183                 *) cat <<EOM >&4
18184 Your strtoull() doesn't seem to be working okay.
18185 EOM
18186                    d_strtoull="$undef"
18187                    ;;
18188                 esac
18189         else
18190                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18191                 d_strtoull="$undef"
18192         fi
18193         ;;
18194 esac
18195
18196 : see if strtouq exists
18197 set strtouq d_strtouq
18198 eval $inlibc
18199
18200 case "$d_strtouq" in
18201 "$define")
18202         $cat <<EOM
18203 Checking whether your strtouq() works okay...
18204 EOM
18205         $cat >try.c <<'EOCP'
18206 #include <errno.h>
18207 #include <stdio.h>
18208 extern unsigned long long int strtouq(char *s, char **, int);
18209 static int bad = 0;
18210 void check(char *s, unsigned long long eull, int een) {
18211         unsigned long long gull;
18212         errno = 0;
18213         gull = strtouq(s, 0, 10);
18214         if (!((gull == eull) && (errno == een)))
18215                 bad++;
18216 }
18217 int main() {
18218         check(" 1",                                        1LL, 0);
18219         check(" 0",                                        0LL, 0);
18220         check("18446744073709551615",  18446744073709551615ULL, 0);
18221         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18222 #if 0 /* strtouq() for /^-/ strings is undefined. */
18223         check("-1",                    18446744073709551615ULL, 0);
18224         check("-18446744073709551614",                     2LL, 0);
18225         check("-18446744073709551615",                     1LL, 0);
18226         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18227         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18228 #endif
18229         if (!bad)
18230                 printf("ok\n");
18231         return 0;
18232 }
18233 EOCP
18234         set try
18235         if eval $compile; then
18236                 case "`$run ./try`" in
18237                 ok) echo "Your strtouq() seems to be working okay." ;;
18238                 *) cat <<EOM >&4
18239 Your strtouq() doesn't seem to be working okay.
18240 EOM
18241                    d_strtouq="$undef"
18242                    ;;
18243                 esac
18244         else
18245                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18246                 d_strtouq="$undef"
18247         fi
18248         ;;
18249 esac
18250
18251 : see if strxfrm exists
18252 set strxfrm d_strxfrm
18253 eval $inlibc
18254
18255 : see if symlink exists
18256 set symlink d_symlink
18257 eval $inlibc
18258
18259 : see if syscall exists
18260 set syscall d_syscall
18261 eval $inlibc
18262
18263 : see if prototype for syscall is available
18264 echo " "
18265 set d_syscallproto syscall $i_unistd unistd.h
18266 eval $hasproto
18267
18268 : see if sysconf exists
18269 set sysconf d_sysconf
18270 eval $inlibc
18271
18272 : see if system exists
18273 set system d_system
18274 eval $inlibc
18275
18276 : see if tcgetpgrp exists
18277 set tcgetpgrp d_tcgetpgrp
18278 eval $inlibc
18279
18280 : see if tcsetpgrp exists
18281 set tcsetpgrp d_tcsetpgrp
18282 eval $inlibc
18283
18284 : see if prototype for telldir is available
18285 echo " "
18286 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18287 eval $hasproto
18288
18289 : see if time exists
18290 echo " "
18291 if test "X$d_time" = X -o X"$timetype" = X; then
18292     if set time val -f d_time; eval $csym; $val; then
18293                 echo 'time() found.' >&4
18294                 val="$define"
18295                 rp="What is the type returned by time() on this system?"
18296                 set time_t timetype long stdio.h sys/types.h
18297                 eval $typedef_ask
18298     else
18299                 echo 'time() not found, hope that will do.' >&4
18300                 val="$undef"
18301                 timetype='int';
18302     fi
18303     set d_time
18304     eval $setvar
18305 fi
18306
18307 : see if timegm exists
18308 set timegm d_timegm
18309 eval $inlibc
18310
18311 : see if this is a sys/times.h system
18312 set sys/times.h i_systimes
18313 eval $inhdr
18314
18315 : see if times exists
18316 echo " "
18317 if set times val -f d_times; eval $csym; $val; then
18318         echo 'times() found.' >&4
18319         d_times="$define"
18320         inc=''
18321         case "$i_systimes" in
18322         "$define") inc='sys/times.h';;
18323         esac
18324         rp="What is the type returned by times() on this system?"
18325         set clock_t clocktype long stdio.h sys/types.h $inc
18326         eval $typedef_ask
18327 else
18328         echo 'times() NOT found, hope that will do.' >&4
18329         d_times="$undef"
18330         clocktype='int'
18331 fi
18332
18333 : see if tmpnam_r exists
18334 set tmpnam_r d_tmpnam_r
18335 eval $inlibc
18336 case "$d_tmpnam_r" in
18337 "$define")
18338         hdrs="$i_systypes sys/types.h define stdio.h "
18339         case "$d_tmpnam_r_proto:$usethreads" in
18340         ":define")      d_tmpnam_r_proto=define
18341                 set d_tmpnam_r_proto tmpnam_r $hdrs
18342                 eval $hasproto ;;
18343         *)      ;;
18344         esac
18345         case "$d_tmpnam_r_proto" in
18346         define)
18347         case "$tmpnam_r_proto" in
18348         ''|0) try='char* tmpnam_r(char*);'
18349         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18350         esac
18351         case "$tmpnam_r_proto" in
18352         ''|0)   d_tmpnam_r=undef
18353                 tmpnam_r_proto=0
18354                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18355         * )     case "$tmpnam_r_proto" in
18356                 REENTRANT_PROTO*) ;;
18357                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18358                 esac
18359                 echo "Prototype: $try" ;;
18360         esac
18361         ;;
18362         *)      case "$usethreads" in
18363                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18364                 esac
18365                 d_tmpnam_r=undef
18366                 tmpnam_r_proto=0
18367                 ;;
18368         esac
18369         ;;
18370 *)      tmpnam_r_proto=0
18371         ;;
18372 esac
18373
18374 : see if truncate exists
18375 set truncate d_truncate
18376 eval $inlibc
18377
18378 : see if ttyname_r exists
18379 set ttyname_r d_ttyname_r
18380 eval $inlibc
18381 case "$d_ttyname_r" in
18382 "$define")
18383         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18384         case "$d_ttyname_r_proto:$usethreads" in
18385         ":define")      d_ttyname_r_proto=define
18386                 set d_ttyname_r_proto ttyname_r $hdrs
18387                 eval $hasproto ;;
18388         *)      ;;
18389         esac
18390         case "$d_ttyname_r_proto" in
18391         define)
18392         case "$ttyname_r_proto" in
18393         ''|0) try='int ttyname_r(int, char*, size_t);'
18394         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18395         esac
18396         case "$ttyname_r_proto" in
18397         ''|0) try='int ttyname_r(int, char*, int);'
18398         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18399         esac
18400         case "$ttyname_r_proto" in
18401         ''|0) try='char* ttyname_r(int, char*, int);'
18402         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18403         esac
18404         case "$ttyname_r_proto" in
18405         ''|0)   d_ttyname_r=undef
18406                 ttyname_r_proto=0
18407                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18408         * )     case "$ttyname_r_proto" in
18409                 REENTRANT_PROTO*) ;;
18410                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18411                 esac
18412                 echo "Prototype: $try" ;;
18413         esac
18414         ;;
18415         *)      case "$usethreads" in
18416                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18417                 esac
18418                 d_ttyname_r=undef
18419                 ttyname_r_proto=0
18420                 ;;
18421         esac
18422         ;;
18423 *)      ttyname_r_proto=0
18424         ;;
18425 esac
18426
18427 : see if tzname[] exists
18428 echo " "
18429 if set tzname val -a d_tzname; eval $csym; $val; then
18430         val="$define"
18431         echo 'tzname[] found.' >&4
18432 else
18433         val="$undef"
18434         echo 'tzname[] NOT found.' >&4
18435 fi
18436 set d_tzname
18437 eval $setvar
18438
18439 : Check if is a multiplatform env
18440 case "$osname" in
18441 next|rhapsody|darwin) multiarch="$define" ;;
18442 esac
18443 case "$multiarch" in
18444 ''|[nN]*) multiarch="$undef" ;;
18445 esac
18446
18447 : check for ordering of bytes in a UV
18448 echo " "
18449 case "$usecrosscompile$multiarch" in
18450 *$define*)
18451         $cat <<EOM
18452 You seem to be either cross-compiling or doing a multiarchitecture build,
18453 skipping the byteorder check.
18454
18455 EOM
18456         byteorder='ffff'
18457         ;;
18458 *)
18459         case "$byteorder" in
18460         '')
18461                 $cat <<'EOM'
18462 In the following, larger digits indicate more significance.  A big-endian
18463 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18464 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18465 machines may have weird orders like 3412.  A Cray will report 87654321,
18466 an Alpha will report 12345678. If the test program works the default is
18467 probably right.
18468 I'm now running the test program...
18469 EOM
18470                 $cat >try.c <<EOCP
18471 #include <stdio.h>
18472 #$i_stdlib I_STDLIB
18473 #ifdef I_STDLIB
18474 #include <stdlib.h>
18475 #endif
18476 #include <sys/types.h>
18477 typedef $uvtype UV;
18478 int main()
18479 {
18480         int i;
18481         union {
18482                 UV l;
18483                 char c[$uvsize];
18484         } u;
18485
18486         if ($uvsize > 4)
18487                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18488         else
18489                 u.l = (UV)0x04030201;
18490         for (i = 0; i < $uvsize; i++)
18491                 printf("%c", u.c[i]+'0');
18492         printf("\n");
18493         exit(0);
18494 }
18495 EOCP
18496                 xxx_prompt=y
18497                 set try
18498                 if eval $compile && $run ./try > /dev/null; then
18499                         dflt=`$run ./try`
18500                         case "$dflt" in
18501                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18502                                 echo "(The test program ran ok.)"
18503                                 echo "byteorder=$dflt"
18504                                 xxx_prompt=n
18505                         ;;
18506                         ????|????????) echo "(The test program ran ok.)" ;;
18507                         *) echo "(The test program didn't run right for some reason.)" ;;
18508                         esac
18509                 else
18510                         dflt='4321'
18511                         cat <<'EOM'
18512 (I can't seem to compile the test program.  Guessing big-endian...)
18513 EOM
18514                 fi
18515                 case "$xxx_prompt" in
18516                 y)
18517                         rp="What is the order of bytes in $uvtype?"
18518                         . ./myread
18519                         byteorder="$ans"
18520                         ;;
18521                 *)      byteorder=$dflt
18522                         ;;
18523                 esac
18524                 ;;
18525         esac
18526         $rm_try
18527         ;;
18528 esac
18529
18530 : Checking 32bit aligndness
18531 $cat <<EOM
18532
18533 Checking to see whether you can access character data unalignedly...
18534 EOM
18535 case "$d_u32align" in
18536 '')   $cat >try.c <<EOCP
18537 #include <stdio.h>
18538 #$i_stdlib I_STDLIB
18539 #ifdef I_STDLIB
18540 #include <stdlib.h>
18541 #endif
18542 #define U32 $u32type
18543 #define BYTEORDER 0x$byteorder
18544 #define U8 $u8type
18545 #include <signal.h>
18546 #ifdef SIGBUS
18547 $signal_t bletch(int s) { exit(4); }
18548 #endif
18549 int main() {
18550 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18551     U8 buf[8];
18552     U32 *up;
18553     int i;
18554
18555     if (sizeof(U32) != 4) {
18556         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18557         exit(1);
18558     }
18559
18560     fflush(stdout);
18561
18562 #ifdef SIGBUS
18563     signal(SIGBUS, bletch);
18564 #endif
18565
18566     buf[0] = 0;
18567     buf[1] = 0;
18568     buf[2] = 0;
18569     buf[3] = 1;
18570     buf[4] = 0;
18571     buf[5] = 0;
18572     buf[6] = 0;
18573     buf[7] = 1;
18574
18575     for (i = 0; i < 4; i++) {
18576         up = (U32*)(buf + i);
18577         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18578                (*up == 1 << (8*(3-i)))  /* little-endian */
18579               )
18580            )
18581         {
18582             printf("read failed (%x)\n", *up);
18583             exit(2);
18584         }
18585     }
18586
18587     /* write test */
18588     for (i = 0; i < 4; i++) {
18589         up = (U32*)(buf + i);
18590         *up = 0xBeef;
18591         if (*up != 0xBeef) {
18592             printf("write failed (%x)\n", *up);
18593             exit(3);
18594         }
18595     }
18596
18597     exit(0);
18598 #else
18599     printf("1\n");
18600     exit(1);
18601 #endif
18602     return 0;
18603 }
18604 EOCP
18605 set try
18606 if eval $compile_ok; then
18607         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18608         $run ./try 2>&1 >/dev/null
18609         case "$?" in
18610         0)      cat >&4 <<EOM
18611 You can access character data pretty unalignedly.
18612 EOM
18613                 d_u32align="$undef"
18614                 ;;
18615         *)      cat >&4 <<EOM
18616 It seems that you must access character data in an aligned manner.
18617 EOM
18618                 d_u32align="$define"
18619                 ;;
18620         esac
18621 else
18622         rp='Can you access character data at unaligned addresses?'
18623         dflt='n'
18624         . ./myread
18625         case "$ans" in
18626         [yY]*)  d_u32align="$undef"  ;;
18627         *)      d_u32align="$define" ;;
18628         esac
18629 fi
18630 $rm_try
18631 ;;
18632 esac
18633
18634 : see if ualarm exists
18635 set ualarm d_ualarm
18636 eval $inlibc
18637
18638 : see if umask exists
18639 set umask d_umask
18640 eval $inlibc
18641
18642 : see if unordered exists
18643 set unordered d_unordered
18644 eval $inlibc
18645
18646 : see if unsetenv exists
18647 set unsetenv d_unsetenv
18648 eval $inlibc
18649
18650 : see if usleep exists
18651 set usleep d_usleep
18652 eval $inlibc
18653
18654 : see if prototype for usleep is available
18655 echo " "
18656 set d_usleepproto usleep $i_unistd unistd.h
18657 eval $hasproto
18658
18659 : see if ustat exists
18660 set ustat d_ustat
18661 eval $inlibc
18662
18663 : see if closedir exists
18664 set closedir d_closedir
18665 eval $inlibc
18666
18667 case "$d_closedir" in
18668 "$define")
18669         echo " "
18670         echo "Checking whether closedir() returns a status..." >&4
18671         cat > try.c <<EOM
18672 #$i_dirent I_DIRENT             /**/
18673 #$i_sysdir I_SYS_DIR            /**/
18674 #$i_sysndir I_SYS_NDIR          /**/
18675 #$i_systypes I_SYS_TYPES        /**/
18676
18677 #if defined(I_SYS_TYPES)
18678 #include <sys/types.h>
18679 #endif
18680 #if defined(I_DIRENT)
18681 #include <dirent.h>
18682 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18683 #include <sys/dir.h>
18684 #endif
18685 #else
18686 #ifdef I_SYS_NDIR
18687 #include <sys/ndir.h>
18688 #else
18689 #ifdef I_SYS_DIR
18690 #ifdef hp9000s500
18691 #include <ndir.h>       /* may be wrong in the future */
18692 #else
18693 #include <sys/dir.h>
18694 #endif
18695 #endif
18696 #endif
18697 #endif
18698 int main() { return closedir(opendir(".")); }
18699 EOM
18700         set try
18701         if eval $compile_ok; then
18702                 if $run ./try > /dev/null 2>&1 ; then
18703                         echo "Yes, it does."
18704                         val="$undef"
18705                 else
18706                         echo "No, it doesn't."
18707                         val="$define"
18708                 fi
18709         else
18710                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18711                 val="$define"
18712         fi
18713         ;;
18714 *)
18715         val="$undef";
18716         ;;
18717 esac
18718 set d_void_closedir
18719 eval $setvar
18720 $rm_try
18721
18722 : see if there is a wait4
18723 set wait4 d_wait4
18724 eval $inlibc
18725
18726 : see if waitpid exists
18727 set waitpid d_waitpid
18728 eval $inlibc
18729
18730 : see if wcstombs exists
18731 set wcstombs d_wcstombs
18732 eval $inlibc
18733
18734 : see if wctomb exists
18735 set wctomb d_wctomb
18736 eval $inlibc
18737
18738 : see if writev exists
18739 set writev d_writev
18740 eval $inlibc
18741
18742 : preserve RCS keywords in files with variable substitution, grrr
18743 Date='$Date'
18744 Id='$Id'
18745 Log='$Log'
18746 RCSfile='$RCSfile'
18747 Revision='$Revision'
18748
18749 : check for alignment requirements
18750 echo " "
18751 case "$usecrosscompile$multiarch" in
18752 *$define*)
18753         $cat <<EOM
18754 You seem to be either cross-compiling or doing a multiarchitecture build,
18755 skipping the memory alignment check.
18756
18757 EOM
18758         case "$alignbytes" in
18759         '') alignbytes=8 ;;
18760         esac
18761         ;;
18762 *)
18763         case "$alignbytes" in
18764         '') echo "Checking alignment constraints..." >&4
18765                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18766                         $cat >try.c <<'EOCP'
18767 typedef long double NV;
18768 EOCP
18769                 else
18770                         $cat >try.c <<'EOCP'
18771 typedef double NV;
18772 EOCP
18773                 fi
18774                 $cat >>try.c <<'EOCP'
18775 #include <stdio.h>
18776 struct foobar {
18777         char foo;
18778         NV bar;
18779 } try_algn;
18780 int main()
18781 {
18782     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18783     return(0);
18784 }
18785 EOCP
18786                 set try
18787                 if eval $compile_ok; then
18788                         dflt=`$run ./try`
18789                 else
18790                         dflt='8'
18791                         echo "(I can't seem to compile the test program...)"
18792                 fi
18793                 ;;
18794         *) dflt="$alignbytes"
18795                 ;;
18796         esac
18797         rp="Doubles must be aligned on a how-many-byte boundary?"
18798         . ./myread
18799         alignbytes="$ans"
18800         $rm_try
18801         ;;
18802 esac
18803
18804
18805 : set the base revision
18806 baserev=5.0
18807
18808 : how do we concatenate cpp tokens here?
18809 echo " "
18810 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18811 $cat >cpp_stuff.c <<'EOCP'
18812 #define RCAT(a,b)a/**/b
18813 #define ACAT(a,b)a ## b
18814 RCAT(Rei,ser)
18815 ACAT(Cir,cus)
18816 EOCP
18817 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18818 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18819         echo "Oh!  Smells like ANSI's been here." >&4
18820         echo "We can catify or stringify, separately or together!"
18821         cpp_stuff=42
18822 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18823         echo "Ah, yes!  The good old days!" >&4
18824         echo "However, in the good old days we don't know how to stringify and"
18825         echo "catify at the same time."
18826         cpp_stuff=1
18827 else
18828         $cat >&4 <<EOM
18829 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18830 You're going to have to edit the values of CAT[2-5] in config.h...
18831 EOM
18832         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18833 fi
18834 $rm -f cpp_stuff.*
18835
18836 : see if this is a db.h system
18837 set db.h i_db
18838 eval $inhdr
18839
18840 case "$i_db" in
18841 $define)
18842         : Check db version.
18843         echo " "
18844         echo "Checking Berkeley DB version ..." >&4
18845         $cat >try.c <<EOCP
18846 #$d_const HASCONST
18847 #ifndef HASCONST
18848 #define const
18849 #endif
18850 #include <sys/types.h>
18851 #include <stdio.h>
18852 #$i_stdlib I_STDLIB
18853 #ifdef I_STDLIB
18854 #include <stdlib.h>
18855 #endif
18856 #include <db.h>
18857 int main(int argc, char *argv[])
18858 {
18859 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18860     int Major, Minor, Patch ;
18861     unsigned long Version ;
18862     (void)db_version(&Major, &Minor, &Patch) ;
18863     if (argc == 2) {
18864         printf("%d %d %d %d %d %d\n",
18865                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18866                Major, Minor, Patch);
18867         exit(0);
18868     }
18869     printf("You have Berkeley DB Version 2 or greater.\n");
18870
18871     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18872                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18873     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18874                 Major, Minor, Patch) ;
18875
18876     /* check that db.h & libdb are compatible */
18877     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18878         printf("db.h and libdb are incompatible.\n") ;
18879         exit(3);
18880     }
18881
18882     printf("db.h and libdb are compatible.\n") ;
18883
18884     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18885                 + DB_VERSION_PATCH ;
18886
18887     /* needs to be >= 2.3.4 */
18888     if (Version < 2003004) {
18889     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18890         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18891         exit(2);
18892     }
18893
18894     exit(0);
18895 #else
18896 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18897     if (argc == 2) {
18898         printf("1 0 0\n");
18899         exit(0);
18900     }
18901     printf("You have Berkeley DB Version 1.\n");
18902     exit(0);    /* DB version < 2: the coast is clear. */
18903 #else
18904     exit(1);    /* <db.h> not Berkeley DB? */
18905 #endif
18906 #endif
18907 }
18908 EOCP
18909         set try
18910         if eval $compile_ok && $run ./try; then
18911                 echo 'Looks OK.' >&4
18912                 set `$run ./try 1`
18913                 db_version_major=$1
18914                 db_version_minor=$2
18915                 db_version_patch=$3
18916         else
18917                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18918                 i_db=$undef
18919                 case " $libs " in
18920                 *"-ldb "*)
18921                         : Remove db from list of libraries to use
18922                         echo "Removing unusable -ldb from library list" >&4
18923                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18924                         shift
18925                         libs="$*"
18926                         echo "libs = $libs" >&4
18927                         ;;
18928                 esac
18929         fi
18930         $rm_try
18931         ;;
18932 esac
18933
18934 case "$i_db" in
18935 define)
18936         : Check the return type needed for hash
18937         echo " "
18938         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18939         $cat >try.c <<EOCP
18940 #$d_const HASCONST
18941 #ifndef HASCONST
18942 #define const
18943 #endif
18944 #include <sys/types.h>
18945 #include <db.h>
18946
18947 #ifndef DB_VERSION_MAJOR
18948 u_int32_t hash_cb (ptr, size)
18949 const void *ptr;
18950 size_t size;
18951 {
18952 }
18953 HASHINFO info;
18954 int main()
18955 {
18956         info.hash = hash_cb;
18957 }
18958 #endif
18959 EOCP
18960         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18961                 if $contains warning try.out >>/dev/null 2>&1 ; then
18962                         db_hashtype='int'
18963                 else
18964                         db_hashtype='u_int32_t'
18965                 fi
18966         else
18967                 : XXX Maybe we should just give up here.
18968                 db_hashtype=u_int32_t
18969                 $cat try.out >&4
18970                 echo "Help:  I can't seem to compile the db test program." >&4
18971                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18972         fi
18973         $rm_try
18974         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18975         ;;
18976 *)      db_hashtype=u_int32_t
18977         ;;
18978 esac
18979 case "$i_db" in
18980 define)
18981         : Check the return type needed for prefix
18982         echo " "
18983         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18984         cat >try.c <<EOCP
18985 #$d_const HASCONST
18986 #ifndef HASCONST
18987 #define const
18988 #endif
18989 #include <sys/types.h>
18990 #include <db.h>
18991
18992 #ifndef DB_VERSION_MAJOR
18993 size_t prefix_cb (key1, key2)
18994 const DBT *key1;
18995 const DBT *key2;
18996 {
18997 }
18998 BTREEINFO info;
18999 int main()
19000 {
19001         info.prefix = prefix_cb;
19002 }
19003 #endif
19004 EOCP
19005         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19006                 if $contains warning try.out >>/dev/null 2>&1 ; then
19007                         db_prefixtype='int'
19008                 else
19009                         db_prefixtype='size_t'
19010                 fi
19011         else
19012                 db_prefixtype='size_t'
19013                 : XXX Maybe we should just give up here.
19014                 $cat try.out >&4
19015                 echo "Help:  I can't seem to compile the db test program." >&4
19016                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19017         fi
19018         $rm_try
19019         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19020         ;;
19021 *)      db_prefixtype='size_t'
19022         ;;
19023 esac
19024
19025 : How can we generate normalized random numbers ?
19026 echo " "
19027 echo "Looking for a random number function..." >&4
19028 case "$randfunc" in
19029 '')
19030         if set drand48 val -f; eval $csym; $val; then
19031                 dflt="drand48"
19032                 echo "Good, found drand48()." >&4
19033         elif set random val -f; eval $csym; $val; then
19034                 dflt="random"
19035                 echo "OK, found random()." >&4
19036         else
19037                 dflt="rand"
19038                 echo "Yick, looks like I have to use rand()." >&4
19039         fi
19040         echo " "
19041         ;;
19042 *)
19043         dflt="$randfunc"
19044         ;;
19045 esac
19046 cont=true
19047
19048 case "$ccflags" in
19049 *-Dmy_rand=*|*-Dmy_srand=*)
19050         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19051         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19052         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19053         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19054         ;;
19055 esac
19056
19057 while $test "$cont"; do
19058         rp="Use which function to generate random numbers?"
19059         . ./myread
19060         if $test "$ans" = "$dflt"; then
19061                 : null
19062         else
19063                 randbits=''
19064         fi
19065         randfunc="$ans"
19066         if set $ans val -f; eval $csym; $val; then
19067                 cont=''
19068         else
19069                 dflt=y
19070                 rp="I cannot find function $ans. Use that name anyway?"
19071                 . ./myread
19072                 dflt=rand
19073                 case "$ans" in
19074                         [yY]*) cont='';;
19075                 esac
19076         fi
19077         case "$cont" in
19078         '')
19079                 case "$randfunc" in
19080                 drand48)
19081                         drand01="drand48()"
19082                         seedfunc="srand48"
19083                         randbits=48
19084                         randseedtype=long
19085                         ;;
19086                 rand|random)
19087                         case "$randbits" in
19088                         '')
19089 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19090                                 $cat >try.c <<EOCP
19091 #$i_unistd I_UNISTD
19092 #$i_stdlib I_STDLIB
19093 #include <stdio.h>
19094 #ifdef I_UNISTD
19095 #  include <unistd.h>
19096 #endif
19097 #ifdef I_STDLIB
19098 #  include <stdlib.h>
19099 #endif
19100 int main()
19101 {
19102         register int i;
19103         register unsigned long tmp;
19104         register unsigned long max = 0L;
19105
19106         for (i = 1000; i; i--) {
19107                 tmp = (unsigned long) $randfunc();
19108                 if (tmp > max) max = tmp;
19109         }
19110         for (i = 0; max; i++)
19111                 max /= 2;
19112         printf("%d\n",i);
19113 }
19114 EOCP
19115                                 set try
19116                                 if eval $compile_ok; then
19117                                         dflt=`try`
19118                                 else
19119                                         dflt='?'
19120                                         echo "(I can't seem to compile the test program...)"
19121                                 fi
19122                                 ;;
19123                         *)
19124                                 dflt="$randbits"
19125                                 ;;
19126                         esac
19127                         rp="How many bits does your $randfunc() function produce?"
19128                         . ./myread
19129                         randbits="$ans"
19130                         $rm_try
19131                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19132                         seedfunc="s$randfunc"
19133                         randseedtype=unsigned
19134                         ;;
19135                 *)
19136                         dflt="31"
19137                         rp="How many bits does your $randfunc() function produce?"
19138                         . ./myread
19139                         randbits="$ans"
19140                         seedfunc="s$randfunc"
19141                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19142                         if set $seedfunc val -f; eval $csym; $val; then
19143                                 echo "(Using $seedfunc() to seed random generator)"
19144                         else
19145                                 echo "(Warning: no $seedfunc() to seed random generator)"
19146                                 seedfunc=rand
19147                         fi
19148                         randseedtype=unsigned
19149                         ;;
19150                 esac
19151                 ;;
19152         esac
19153 done
19154
19155 : Determine if this is an EBCDIC system
19156 echo " "
19157 echo "Determining whether or not we are on an EBCDIC system..." >&4
19158 $cat >try.c <<'EOM'
19159 int main()
19160 {
19161   if ('M'==0xd4) return 0;
19162   return 1;
19163 }
19164 EOM
19165
19166 val=$undef
19167 set try
19168 if eval $compile_ok; then
19169         if $run ./try; then
19170                 echo "You seem to speak EBCDIC." >&4
19171                 val="$define"
19172         else
19173                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19174         fi
19175 else
19176         echo "I'm unable to compile the test program." >&4
19177         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19178 fi
19179 $rm_try
19180 set ebcdic
19181 eval $setvar
19182
19183 : Check how to flush
19184 echo " "
19185 $cat >&4 <<EOM
19186 Checking how to flush all pending stdio output...
19187 EOM
19188 # I only know how to find the first 32 possibly open files on SunOS.
19189 # See also hints/sunos_4_1.sh and util.c  --AD
19190 case "$osname" in
19191 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19192 esac
19193 $cat >>try.c <<EOCP
19194 #include <stdio.h>
19195 #$i_stdlib I_STDLIB
19196 #ifdef I_STDLIB
19197 #include <stdlib.h>
19198 #endif
19199 #$i_unistd I_UNISTD
19200 #ifdef I_UNISTD
19201 # include <unistd.h>
19202 #endif
19203 #$d_sysconf HAS_SYSCONF
19204 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19205 #ifdef HAS_STDIO_STREAM_ARRAY
19206 # define STDIO_STREAM_ARRAY $stdio_stream_array
19207 #endif
19208 int main() {
19209   FILE* p;
19210   unlink("try.out");
19211   p = fopen("try.out", "w");
19212 #ifdef TRY_FPUTC
19213   fputc('x', p);
19214 #else
19215 # ifdef TRY_FPRINTF
19216   fprintf(p, "x");
19217 # endif
19218 #endif
19219 #ifdef TRY_FFLUSH_NULL
19220   fflush(NULL);
19221 #endif
19222 #ifdef TRY_FFLUSH_ALL
19223   {
19224     long open_max = -1;
19225 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19226     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19227 # else
19228 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19229     open_max = sysconf(_SC_OPEN_MAX);
19230 #  else
19231 #   ifdef FOPEN_MAX
19232     open_max = FOPEN_MAX;
19233 #   else
19234 #    ifdef OPEN_MAX
19235     open_max = OPEN_MAX;
19236 #    else
19237 #     ifdef _NFILE
19238     open_max = _NFILE;
19239 #     endif
19240 #    endif
19241 #   endif
19242 #  endif
19243 # endif
19244 # ifdef HAS_STDIO_STREAM_ARRAY
19245     if (open_max > 0) {
19246       long i;
19247       for (i = 0; i < open_max; i++)
19248             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19249                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19250                 STDIO_STREAM_ARRAY[i]._flag)
19251                 fflush(&STDIO_STREAM_ARRAY[i]);
19252     }
19253   }
19254 # endif
19255 #endif
19256   _exit(42);
19257 }
19258 EOCP
19259 : first we have to find out how _not_ to flush
19260 $to try.c
19261 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19262     output=''
19263     set try -DTRY_FPUTC
19264     if eval $compile; then
19265             $run ./try 2>/dev/null
19266             code="$?"
19267             $from try.out
19268             if $test ! -s try.out -a "X$code" = X42; then
19269                 output=-DTRY_FPUTC
19270             fi
19271     fi
19272     case "$output" in
19273     '')
19274             set try -DTRY_FPRINTF
19275             if eval $compile; then
19276                     $run ./try 2>/dev/null
19277                     code="$?"
19278                     $from try.out
19279                     if $test ! -s try.out -a "X$code" = X42; then
19280                         output=-DTRY_FPRINTF
19281                     fi
19282             fi
19283         ;;
19284     esac
19285 fi
19286 : check for fflush NULL behaviour
19287 case "$fflushNULL" in
19288 '')     set try -DTRY_FFLUSH_NULL $output
19289         if eval $compile; then
19290                 $run ./try 2>/dev/null
19291                 code="$?"
19292                 $from try.out
19293                 if $test -s try.out -a "X$code" = X42; then
19294                         fflushNULL="`$cat try.out`"
19295                 else
19296                         if $test "X$code" != X42; then
19297                                 $cat >&4 <<EOM
19298 (If this test failed, don't worry, we'll try another method shortly.)
19299 EOM
19300                         fi
19301                 fi
19302         fi
19303         $rm -f core try.core core.try.*
19304         case "$fflushNULL" in
19305         x)      $cat >&4 <<EOM
19306 Your fflush(NULL) works okay for output streams.
19307 Let's see if it clobbers input pipes...
19308 EOM
19309 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19310 # bug that improperly flushes the input end of pipes.  So we avoid the
19311 # autoflush on fork/system/exec support for now. :-(
19312 $cat >tryp.c <<EOCP
19313 #include <stdio.h>
19314 int
19315 main(int argc, char **argv)
19316 {
19317     char buf[1024];
19318     int i;
19319     char *bp = buf;
19320     while (1) {
19321         while ((i = getc(stdin)) != -1
19322                && (*bp++ = i) != '\n'
19323                && bp < &buf[1024])
19324         /* DO NOTHING */ ;
19325         *bp = '\0';
19326         fprintf(stdout, "%s", buf);
19327         fflush(NULL);
19328         if (i == -1)
19329             return 0;
19330         bp = buf;
19331     }
19332 }
19333 EOCP
19334                 fflushNULL="$define"
19335                 set tryp
19336                 if eval $compile; then
19337                     $rm -f tryp.out
19338                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19339                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19340                        $cat >&4 <<EOM
19341 fflush(NULL) seems to behave okay with input streams.
19342 EOM
19343                         fflushNULL="$define"
19344                     else
19345                         $cat >&4 <<EOM
19346 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19347 EOM
19348                         fflushNULL="$undef"
19349                     fi
19350                 fi
19351                 $rm -f core tryp.c tryp.core core.tryp.*
19352                 ;;
19353         '')     $cat >&4 <<EOM
19354 Your fflush(NULL) isn't working (contrary to ANSI C).
19355 EOM
19356                 fflushNULL="$undef"
19357                 ;;
19358         *)      $cat >&4 <<EOM
19359 Cannot figure out whether your fflush(NULL) works or not.
19360 I'm assuming it doesn't (contrary to ANSI C).
19361 EOM
19362                 fflushNULL="$undef"
19363                 ;;
19364         esac
19365         ;;
19366 $define|true|[yY]*)
19367         fflushNULL="$define"
19368         ;;
19369 *)
19370         fflushNULL="$undef"
19371         ;;
19372 esac
19373 : check explicit looping only if NULL did not work, and if the pipe
19374 : bug does not show up on an explicit flush too
19375 case "$fflushNULL" in
19376 "$undef")
19377         $cat >tryp.c <<EOCP
19378 #include <stdio.h>
19379 int
19380 main(int argc, char **argv)
19381 {
19382     char buf[1024];
19383     int i;
19384     char *bp = buf;
19385     while (1) {
19386         while ((i = getc(stdin)) != -1
19387                && (*bp++ = i) != '\n'
19388                && bp < &buf[1024])
19389         /* DO NOTHING */ ;
19390         *bp = '\0';
19391         fprintf(stdout, "%s", buf);
19392         fflush(stdin);
19393         if (i == -1)
19394             return 0;
19395         bp = buf;
19396     }
19397 }
19398 EOCP
19399         set tryp
19400         if eval $compile; then
19401             $rm -f tryp.out
19402             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19403             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19404                $cat >&4 <<EOM
19405 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19406 EOM
19407                 : now check for fflushall behaviour
19408                 case "$fflushall" in
19409                 '')     set try -DTRY_FFLUSH_ALL $output
19410                         if eval $compile; then
19411                                 $cat >&4 <<EOM
19412 (Now testing the other method--but note that this also may fail.)
19413 EOM
19414                                 $run ./try 2>/dev/null
19415                                 code=$?
19416                                 $from try.out
19417                                 if $test -s try.out -a "X$code" = X42; then
19418                                         fflushall="`$cat try.out`"
19419                                 fi
19420                         fi
19421                         $rm_try
19422                         case "$fflushall" in
19423                         x)      $cat >&4 <<EOM
19424 Whew. Flushing explicitly all the stdio streams works.
19425 EOM
19426                                 fflushall="$define"
19427                                 ;;
19428                         '')     $cat >&4 <<EOM
19429 Sigh. Flushing explicitly all the stdio streams doesn't work.
19430 EOM
19431                                 fflushall="$undef"
19432                                 ;;
19433                         *)      $cat >&4 <<EOM
19434 Cannot figure out whether flushing stdio streams explicitly works or not.
19435 I'm assuming it doesn't.
19436 EOM
19437                                 fflushall="$undef"
19438                                 ;;
19439                         esac
19440                         ;;
19441                 "$define"|true|[yY]*)
19442                         fflushall="$define"
19443                         ;;
19444                 *)
19445                         fflushall="$undef"
19446                         ;;
19447                 esac
19448             else
19449                 $cat >&4 <<EOM
19450 All is futile.  Even fflush(stdin) clobbers input pipes!
19451 EOM
19452                 fflushall="$undef"
19453             fi
19454         else
19455             fflushall="$undef"
19456         fi
19457         $rm -f core tryp.c tryp.core core.tryp.*
19458         ;;
19459 *)      fflushall="$undef"
19460         ;;
19461 esac
19462
19463 case "$fflushNULL$fflushall" in
19464 undefundef)
19465         $cat <<EOM
19466 OK, I give up.  I cannot figure out how to flush pending stdio output.
19467 We won't be flushing handles at all before fork/exec/popen.
19468 EOM
19469         ;;
19470 esac
19471 $rm_try tryp
19472
19473 : Store the full pathname to the ar program for use in the C program
19474 : Respect a hint or command line value for full_ar.
19475 case "$full_ar" in
19476 '') full_ar=$ar ;;
19477 esac
19478
19479 : Store the full pathname to the sed program for use in the C program
19480 full_sed=$sed
19481
19482 : see what type gids are declared as in the kernel
19483 echo " "
19484 echo "Looking for the type for group ids returned by getgid()."
19485 set gid_t gidtype xxx stdio.h sys/types.h
19486 eval $typedef
19487 case "$gidtype" in
19488 xxx)
19489         xxx=`./findhdr sys/user.h`
19490         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19491         case $1 in
19492         unsigned) dflt="$1 $2" ;;
19493         *) dflt="$1" ;;
19494         esac
19495         ;;
19496 *) dflt="$gidtype";;
19497 esac
19498 case "$gidtype" in
19499 gid_t) echo "gid_t found." ;;
19500 *)      rp="What is the type for group ids returned by getgid()?"
19501         . ./myread
19502         gidtype="$ans"
19503         ;;
19504 esac
19505
19506 : Check the size of GID
19507 echo " "
19508 case "$gidtype" in
19509 *_t) zzz="$gidtype"     ;;
19510 *)   zzz="gid"          ;;
19511 esac
19512 echo "Checking the size of $zzz..." >&4
19513 cat > try.c <<EOCP
19514 #include <sys/types.h>
19515 #include <stdio.h>
19516 #$i_stdlib I_STDLIB
19517 #ifdef I_STDLIB
19518 #include <stdlib.h>
19519 #endif
19520 int main() {
19521     printf("%d\n", (int)sizeof($gidtype));
19522     exit(0);
19523 }
19524 EOCP
19525 set try
19526 if eval $compile_ok; then
19527         yyy=`$run ./try`
19528         case "$yyy" in
19529         '')     gidsize=4
19530                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19531                 ;;
19532         *)      gidsize=$yyy
19533                 echo "Your $zzz is $gidsize bytes long."
19534                 ;;
19535         esac
19536 else
19537         gidsize=4
19538         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19539 fi
19540
19541
19542 : Check if GID is signed
19543 echo " "
19544 case "$gidtype" in
19545 *_t) zzz="$gidtype"     ;;
19546 *)   zzz="gid"          ;;
19547 esac
19548 echo "Checking the sign of $zzz..." >&4
19549 cat > try.c <<EOCP
19550 #include <sys/types.h>
19551 #include <stdio.h>
19552 int main() {
19553         $gidtype foo = -1;
19554         if (foo < 0)
19555                 printf("-1\n");
19556         else
19557                 printf("1\n");
19558 }
19559 EOCP
19560 set try
19561 if eval $compile; then
19562         yyy=`$run ./try`
19563         case "$yyy" in
19564         '')     gidsign=1
19565                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19566                 ;;
19567         *)      gidsign=$yyy
19568                 case "$gidsign" in
19569                  1) echo "Your $zzz is unsigned." ;;
19570                 -1) echo "Your $zzz is signed."   ;;
19571                 esac
19572                 ;;
19573         esac
19574 else
19575         gidsign=1
19576         echo "(I can't compile the test program--guessing unsigned.)" >&4
19577 fi
19578
19579
19580 : Check 64bit sizes
19581 echo " "
19582
19583 if $test X"$quadtype" != X; then
19584
19585 echo "Checking how to print 64-bit integers..." >&4
19586
19587 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19588         $cat >try.c <<'EOCP'
19589 #include <sys/types.h>
19590 #include <stdio.h>
19591 int main() {
19592   int q = 12345678901;
19593   printf("%ld\n", q);
19594 }
19595 EOCP
19596         set try
19597         if eval $compile; then
19598                 yyy=`$run ./try`
19599                 case "$yyy" in
19600                 12345678901)
19601                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19602                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19603                         echo "We will use %d."
19604                         ;;
19605                 esac
19606         fi
19607 fi
19608
19609 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19610         $cat >try.c <<'EOCP'
19611 #include <sys/types.h>
19612 #include <stdio.h>
19613 int main() {
19614   long q = 12345678901;
19615   printf("%ld\n", q);
19616 }
19617 EOCP
19618         set try
19619         if eval $compile; then
19620                 yyy=`$run ./try`
19621                 case "$yyy" in
19622                 12345678901)
19623                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19624                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19625                         echo "We will use %ld."
19626                         ;;
19627                 esac
19628         fi
19629 fi
19630
19631 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19632         $cat >try.c <<'EOCP'
19633 #include <sys/types.h>
19634 #include <inttypes.h>
19635 #include <stdio.h>
19636 int main() {
19637   int64_t q = 12345678901;
19638   printf("%" PRId64 "\n", q);
19639 }
19640 EOCP
19641         set try
19642         if eval $compile; then
19643                 yyy=`$run ./try`
19644                 case "$yyy" in
19645                 12345678901)
19646                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19647                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19648                         echo "We will use the C9X style."
19649                         ;;
19650                 esac
19651         fi
19652 fi
19653
19654 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19655         $cat >try.c <<EOCP
19656 #include <sys/types.h>
19657 #include <stdio.h>
19658 int main() {
19659   $quadtype q = 12345678901;
19660   printf("%Ld\n", q);
19661 }
19662 EOCP
19663         set try
19664         if eval $compile; then
19665                 yyy=`$run ./try`
19666                 case "$yyy" in
19667                 12345678901)
19668                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19669                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19670                         echo "We will use %Ld."
19671                         ;;
19672                 esac
19673         fi
19674 fi
19675
19676 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19677         $cat >try.c <<'EOCP'
19678 #include <sys/types.h>
19679 #include <stdio.h>
19680 int main() {
19681   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19682   printf("%lld\n", q);
19683 }
19684 EOCP
19685         set try
19686         if eval $compile; then
19687                 yyy=`$run ./try`
19688                 case "$yyy" in
19689                 12345678901)
19690                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19691                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19692                         echo "We will use the %lld style."
19693                         ;;
19694                 esac
19695         fi
19696 fi
19697
19698 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19699         $cat >try.c <<EOCP
19700 #include <sys/types.h>
19701 #include <stdio.h>
19702 int main() {
19703   $quadtype q = 12345678901;
19704   printf("%qd\n", q);
19705 }
19706 EOCP
19707         set try
19708         if eval $compile; then
19709                 yyy=`$run ./try`
19710                 case "$yyy" in
19711                 12345678901)
19712                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19713                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19714                         echo "We will use %qd."
19715                         ;;
19716                 esac
19717         fi
19718 fi
19719
19720 if $test X"$sPRId64" = X; then
19721         echo "Cannot figure out how to print 64-bit integers." >&4
19722 fi
19723 $rm_try
19724
19725 fi
19726
19727 case "$sPRId64" in
19728 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19729         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19730         ;;
19731 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19732         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19733         ;;
19734 esac
19735
19736 : Check format strings for internal types
19737 echo " "
19738 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19739
19740 if $test X"$ivsize" = X8; then
19741         ivdformat="$sPRId64"
19742         uvuformat="$sPRIu64"
19743         uvoformat="$sPRIo64"
19744         uvxformat="$sPRIx64"
19745         uvXUformat="$sPRIXU64"
19746 else
19747         if $test X"$ivsize" = X"$longsize"; then
19748                 ivdformat='"ld"'
19749                 uvuformat='"lu"'
19750                 uvoformat='"lo"'
19751                 uvxformat='"lx"'
19752                 uvXUformat='"lX"'
19753         else
19754                 if $test X"$ivsize" = X"$intsize"; then
19755                         ivdformat='"d"'
19756                         uvuformat='"u"'
19757                         uvoformat='"o"'
19758                         uvxformat='"x"'
19759                         uvXUformat='"X"'
19760                 else
19761                         : far out
19762                         if $test X"$ivsize" = X"$shortsize"; then
19763                                 ivdformat='"hd"'
19764                                 uvuformat='"hu"'
19765                                 uvoformat='"ho"'
19766                                 uvxformat='"hx"'
19767                                 uvXUformat='"hX"'
19768                         fi
19769                 fi
19770         fi
19771 fi
19772
19773 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19774         nveformat="$sPRIeldbl"
19775         nvfformat="$sPRIfldbl"
19776         nvgformat="$sPRIgldbl"
19777         nvEUformat="$sPRIEUldbl"
19778         nvFUformat="$sPRIFUldbl"
19779         nvGUformat="$sPRIGUldbl"
19780 else
19781         nveformat='"e"'
19782         nvfformat='"f"'
19783         nvgformat='"g"'
19784         nvEUformat='"E"'
19785         nvFUformat='"F"'
19786         nvGUformat='"G"'
19787 fi
19788
19789 case "$ivdformat" in
19790 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19791     exit 1
19792     ;;
19793 esac
19794
19795 : Check format string for GID
19796
19797 echo " "
19798 $echo "Checking the format string to be used for gids..." >&4
19799
19800 case "$gidsign" in
19801 -1)     if $test X"$gidsize" = X"$ivsize"; then
19802                 gidformat="$ivdformat"
19803         else
19804                 if $test X"$gidsize" = X"$longsize"; then
19805                         gidformat='"ld"'
19806                 else
19807                         if $test X"$gidsize" = X"$intsize"; then
19808                                 gidformat='"d"'
19809                         else
19810                                 if $test X"$gidsize" = X"$shortsize"; then
19811                                         gidformat='"hd"'
19812                                 fi
19813                         fi
19814                 fi
19815         fi
19816         ;;
19817 *)      if $test X"$gidsize" = X"$uvsize"; then
19818                 gidformat="$uvuformat"
19819         else
19820                 if $test X"$gidsize" = X"$longsize"; then
19821                         gidformat='"lu"'
19822                 else
19823                         if $test X"$gidsize" = X"$intsize"; then
19824                                 gidformat='"u"'
19825                         else
19826                                 if $test X"$gidsize" = X"$shortsize"; then
19827                                         gidformat='"hu"'
19828                                 fi
19829                         fi
19830                 fi
19831         fi
19832         ;;
19833 esac
19834
19835 : see if getgroups exists
19836 set getgroups d_getgrps
19837 eval $inlibc
19838
19839 : see if setgroups exists
19840 set setgroups d_setgrps
19841 eval $inlibc
19842
19843 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19844 echo " "
19845 case "$d_getgrps$d_setgrps" in
19846 *define*)
19847         case "$groupstype" in
19848         '') dflt="$gidtype" ;;
19849         *)  dflt="$groupstype" ;;
19850         esac
19851         $cat <<EOM
19852 What type of pointer is the second argument to getgroups() and setgroups()?
19853 Usually this is the same as group ids, $gidtype, but not always.
19854
19855 EOM
19856         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19857         . ./myread
19858         groupstype="$ans"
19859         ;;
19860 *)  groupstype="$gidtype";;
19861 esac
19862
19863 : MAD = Misc Attribute Definition
19864
19865 if $test $patchlevel -lt 9; then
19866 : MAD is not available in 5.8.x or earlier.
19867     ans=n;
19868 else
19869     case "$mad" in
19870     $define|true|[yY]*) dflt='y' ;;
19871     *)                  dflt='n' ;;
19872     esac
19873     cat <<EOM
19874
19875 Would you like to build with Misc Attribute Decoration? This is development
19876 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19877 overhead on the interpreter.
19878
19879 If this doesn't make any sense to you, just accept the default '$dflt'.
19880 EOM
19881     rp='Build Perl with MAD?'
19882     . ./myread
19883 fi
19884 case "$ans" in
19885 y|Y)    val="$define"
19886         madlyh='madly.h madly.act madly.tab'
19887         madlysrc='madly.c'
19888         madlyobj="madly$_o" ;;
19889 *)      val="$undef"
19890         madlyh=''
19891         madlysrc=''
19892         madlyobj='' ;;
19893 esac
19894 set mad
19895 eval $setvar
19896
19897 : check whether make sets MAKE
19898 echo " "
19899 echo "Checking if your $make program sets \$(MAKE)..." >&4
19900 case "$make_set_make" in
19901 '')
19902         $sed 's/^X //' > testmake.mak << 'EOF'
19903 Xall:
19904 X       @echo 'maketemp="$(MAKE)"'
19905 EOF
19906         case "`$make -f testmake.mak 2>/dev/null`" in
19907         *maketemp=*) make_set_make='#' ;;
19908         *)      make_set_make="MAKE=$make" ;;
19909         esac
19910         $rm -f testmake.mak
19911         ;;
19912 esac
19913 case "$make_set_make" in
19914 '#') echo "Yup, it does.";;
19915 *) echo "Nope, it doesn't.";;
19916 esac
19917
19918 : see what type is used for mode_t
19919 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19920 set mode_t modetype int stdio.h sys/types.h
19921 eval $typedef_ask
19922
19923 : see if we need va_copy
19924 echo " "
19925 case "$i_stdarg" in
19926 "$define")
19927         $cat >try.c <<EOCP
19928 #include <stdarg.h>
19929 #include <stdio.h>
19930 #$i_stdlib I_STDLIB
19931 #ifdef I_STDLIB
19932 #include <stdlib.h>
19933 #endif
19934 #include <signal.h>
19935
19936 int
19937 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19938 {
19939   return vfprintf(f, fmt, *valp);
19940 }
19941
19942 int
19943 myvfprintf(FILE *f, const  char *fmt, va_list val)
19944 {
19945   return ivfprintf(f, fmt, &val);
19946 }
19947
19948 int
19949 myprintf(char *fmt, ...)
19950 {
19951   va_list val;
19952   va_start(val, fmt);
19953   return myvfprintf(stdout, fmt, val);
19954 }
19955
19956 int
19957 main(int ac, char **av)
19958 {
19959   signal(SIGSEGV, exit);
19960
19961   myprintf("%s%cs all right, then\n", "that", '\'');
19962   exit(0);
19963 }
19964 EOCP
19965         set try
19966         if eval $compile && $run ./try 2>&1 >/dev/null; then
19967                 case "`$run ./try`" in
19968                 "that's all right, then")
19969                         okay=yes
19970                         ;;
19971                 esac
19972         fi
19973         case "$okay" in
19974         yes)    echo "It seems that you don't need va_copy()." >&4
19975                 need_va_copy="$undef"
19976                 ;;
19977         *)      echo "It seems that va_copy() or similar will be needed." >&4
19978                 need_va_copy="$define"
19979                 ;;
19980         esac
19981         $rm_try
19982         ;;
19983 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19984         ;;
19985 esac
19986
19987 : see what type is used for size_t
19988 rp="What is the type used for the length parameter for string functions?"
19989 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19990 eval $typedef_ask
19991
19992 : check for type of arguments to gethostbyaddr. 
19993 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19994         case "$d_gethbyaddr" in
19995         $define)
19996                 $cat <<EOM
19997
19998 Checking to see what type of arguments are accepted by gethostbyaddr().
19999 EOM
20000                 hdrs="$define sys/types.h
20001                         $d_socket sys/socket.h 
20002                         $i_niin netinet/in.h 
20003                         $i_netdb netdb.h
20004                         $i_unistd unistd.h"
20005                 : The first arg can 'char *' or 'void *'
20006                 : The second arg is some of integral type
20007                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20008                         for yyy in size_t long int; do
20009                                 case "$netdb_host_type" in
20010                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20011                                         if ./protochk "$try" $hdrs; then
20012                                                 echo "Your system accepts $xxx for the first arg."
20013                                                 echo "...and $yyy for the second arg."
20014                                                 netdb_host_type="$xxx"
20015                                                 netdb_hlen_type="$yyy"
20016                                         fi
20017                                         ;;
20018                                 esac
20019                         done
20020                 done
20021                 : In case none of those worked, prompt the user.
20022                 case "$netdb_host_type" in
20023                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20024                         dflt='char *'
20025                         . ./myread
20026                         netdb_host_type=$ans
20027                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20028                         dflt="$sizetype"
20029                         . ./myread
20030                         netdb_hlen_type=$ans
20031                         ;;
20032                 esac
20033                 ;;
20034         *)      : no gethostbyaddr, so pick harmless defaults
20035                 netdb_host_type='char *'
20036                 netdb_hlen_type="$sizetype"
20037                 ;;
20038         esac
20039         # Remove the "const" if needed. -- but then we'll have a 
20040         # prototype clash!
20041         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20042 fi
20043
20044 : check for type of argument to gethostbyname. 
20045 if test "X$netdb_name_type" = X ; then
20046         case "$d_gethbyname" in
20047         $define)
20048                 $cat <<EOM
20049
20050 Checking to see what type of argument is accepted by gethostbyname().
20051 EOM
20052                 hdrs="$define sys/types.h
20053                         $d_socket sys/socket.h 
20054                         $i_niin netinet/in.h 
20055                         $i_netdb netdb.h
20056                         $i_unistd unistd.h"
20057                 for xxx in "const char *" "char *"; do
20058                         case "$netdb_name_type" in
20059                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20060                                 if ./protochk "$try" $hdrs; then
20061                                         echo "Your system accepts $xxx."
20062                                         netdb_name_type="$xxx"
20063                                 fi
20064                                 ;;
20065                         esac
20066                 done
20067                 : In case none of those worked, prompt the user.
20068                 case "$netdb_name_type" in
20069                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20070                         dflt='char *'
20071                         . ./myread
20072                         netdb_name_type=$ans
20073                         ;;
20074                 esac
20075                 ;;
20076         *)      : no gethostbyname, so pick harmless default
20077                 netdb_name_type='char *'
20078                 ;;
20079         esac
20080 fi
20081
20082 : check for type of 1st argument to getnetbyaddr. 
20083 if test "X$netdb_net_type" = X ; then
20084         case "$d_getnbyaddr" in
20085         $define)
20086                 $cat <<EOM
20087
20088 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20089 EOM
20090                 hdrs="$define sys/types.h
20091                         $d_socket sys/socket.h 
20092                         $i_niin netinet/in.h 
20093                         $i_netdb netdb.h
20094                         $i_unistd unistd.h"
20095                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20096                         case "$netdb_net_type" in
20097                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20098                                 if ./protochk "$try" $hdrs; then
20099                                         echo "Your system accepts $xxx."
20100                                         netdb_net_type="$xxx"
20101                                 fi
20102                                 ;;
20103                         esac
20104                 done
20105                 : In case none of those worked, prompt the user.
20106                 case "$netdb_net_type" in
20107                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20108                         dflt='long'
20109                         . ./myread
20110                         netdb_net_type=$ans
20111                         ;;
20112                 esac
20113                 ;;
20114         *)      : no getnetbyaddr, so pick harmless default
20115                 netdb_net_type='long'
20116                 ;;
20117         esac
20118 fi
20119 : locate the preferred pager for this system
20120 fn=f/
20121 case "$pager" in
20122 '')
20123         dflt=''
20124         case "$pg" in
20125         /*) dflt=$pg;;
20126         [a-zA-Z]:/*) dflt=$pg;;
20127         esac
20128         case "$more" in
20129         /*) dflt=$more;;
20130         [a-zA-Z]:/*) dflt=$more;;
20131         esac
20132         case "$less" in
20133         /*) dflt=$less;;
20134         [a-zA-Z]:/*) dflt=$less;;
20135         esac
20136         case "$dflt" in
20137         '') dflt=/usr/ucb/more;;
20138         esac
20139         ;;
20140 *)      dflt="$pager"
20141         fn="f/($pager)"
20142         ;;
20143 esac
20144 echo " "
20145 rp='What pager is used on your system?'
20146 . ./getfile
20147 pager="$ans"
20148
20149 : see what type pids are declared as in the kernel
20150 rp="What is the type of process ids on this system?"
20151 set pid_t pidtype int stdio.h sys/types.h
20152 eval $typedef_ask
20153
20154 : see if ar generates random libraries by itself
20155 echo " "
20156 echo "Checking how to generate random libraries on your machine..." >&4
20157 echo 'int bar1() { return bar2(); }' > bar1.c
20158 echo 'int bar2() { return 2; }' > bar2.c
20159 $cat > foo.c <<EOP
20160 #$i_stdlib I_STDLIB
20161 #ifdef I_STDLIB
20162 #include <stdlib.h>
20163 #endif
20164 int main() { printf("%d\n", bar1()); exit(0); }
20165 EOP
20166 $cc $ccflags -c bar1.c >/dev/null 2>&1
20167 $cc $ccflags -c bar2.c >/dev/null 2>&1
20168 $cc $ccflags -c foo.c >/dev/null 2>&1
20169 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20170 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20171         $run ./foobar >/dev/null 2>&1; then
20172         echo "$ar appears to generate random libraries itself."
20173         orderlib=false
20174         if [ "X$ranlib" = "X" ]; then
20175             ranlib=":"
20176         fi
20177 elif $ar s bar$_a >/dev/null 2>&1 &&
20178         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20179         $run ./foobar >/dev/null 2>&1; then
20180                 echo "a table of contents needs to be added with '$ar s'."
20181                 orderlib=false
20182                 ranlib="$ar s"
20183 elif $ar ts bar$_a >/dev/null 2>&1 &&
20184         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20185         $run ./foobar >/dev/null 2>&1; then
20186                 echo "a table of contents needs to be added with '$ar ts'."
20187                 orderlib=false
20188                 ranlib="$ar ts"
20189 else
20190         case "$ranlib" in
20191         :) ranlib='';;
20192         '')
20193                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20194                 $test -f $ranlib || ranlib=''
20195                 ;;
20196         esac
20197         if $test -n "$ranlib"; then
20198                 echo "your system has '$ranlib'; we'll use that."
20199                 orderlib=false
20200         else
20201                 echo "your system doesn't seem to support random libraries"
20202                 echo "so we'll use lorder and tsort to order the libraries."
20203                 orderlib=true
20204                 ranlib=":"
20205         fi
20206 fi
20207 $rm -f foo* bar*
20208
20209 : see if this is a values.h system
20210 set values.h i_values
20211 eval $inhdr
20212
20213 : Check the max offset that gmtime and localtime accept
20214 echo "Checking max offsets that gmtime () accepts"
20215
20216 case $i_values in
20217     define) yyy="#include <values.h>" ;;
20218     *)      yyy="" ;;
20219     esac
20220
20221 case "$sGMTIME_min/$sGMTIME_max" in
20222     0/0|/)
20223         $cat >try.c <<EOCP
20224 #include <sys/types.h>
20225 #include <stdio.h>
20226 #include <time.h>
20227 $yyy
20228
20229 int i;
20230 struct tm *tmp;
20231 time_t pt;
20232
20233 void gm_check (time_t t, int min_year, int max_year)
20234 {
20235     tmp = gmtime (&t);
20236     if ( tmp == NULL ||
20237         /* Check tm_year overflow */
20238          tmp->tm_year < min_year || tmp->tm_year > max_year)
20239         tmp = NULL;
20240     else
20241         pt = t;
20242     } /* gm_check */
20243
20244 int check_max ()
20245 {
20246     tmp = NULL;
20247     pt  = 0;
20248 #ifdef MAXLONG
20249     gm_check (MAXLONG, 69, 0x7fffffff);
20250 #endif
20251     if (tmp == NULL || tmp->tm_year < 0) {
20252         for (i = 63; i >= 0; i--) {
20253             time_t x = pt | ((time_t)1 << i);
20254             if (x < 0 || x < pt) continue;
20255             gm_check (x, 69, 0x7fffffff);
20256             }
20257         }
20258     printf ("sGMTIME_max=%ld\n", pt);
20259     return (0);
20260     } /* check_max */
20261
20262 int check_min ()
20263 {
20264     tmp = NULL;
20265     pt  = 0;
20266 #ifdef MINLONG
20267     gm_check (MINLONG, -1900, 70);
20268 #endif
20269     if (tmp == NULL) {
20270         for (i = 36; i >= 0; i--) {
20271             time_t x = pt - ((time_t)1 << i);
20272             if (x > 0) continue;
20273             gm_check (x, -1900, 70);
20274             }
20275         }
20276     printf ("sGMTIME_min=%ld\n", pt);
20277     return (0);
20278     } /* check_min */
20279
20280 int main (int argc, char *argv[])
20281 {
20282     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20283     check_max ();
20284     check_min ();
20285     return (0);
20286     } /* main */
20287 EOCP
20288         set try
20289         if eval $compile; then
20290             eval `$run ./try`
20291         else
20292             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20293             fi
20294         $rm_try
20295         ;;
20296     esac
20297
20298 echo "Checking max offsets that localtime () accepts"
20299
20300 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20301     0/0|/)
20302         $cat >try.c <<EOCP
20303 #include <sys/types.h>
20304 #include <stdio.h>
20305 #include <time.h>
20306 $yyy
20307
20308 int i;
20309 struct tm *tmp;
20310 time_t pt;
20311
20312 void local_check (time_t t, int min_year, int max_year)
20313 {
20314     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20315         tmp = NULL;
20316     else
20317         tmp = localtime (&t);
20318     if ( tmp == NULL ||
20319         /* Check tm_year overflow */
20320          tmp->tm_year < min_year || tmp->tm_year > max_year)
20321         tmp = NULL;
20322     else
20323         pt = t;
20324     } /* local_check */
20325
20326 int check_max ()
20327 {
20328     tmp = NULL;
20329     pt  = 0;
20330 #ifdef MAXLONG
20331     local_check (MAXLONG, 69, 0x7fffffff);
20332 #endif
20333     if (tmp == NULL || tmp->tm_year < 0) {
20334         for (i = 63; i >= 0; i--) {
20335             time_t x = pt | ((time_t)1 << i);
20336             if (x < 0 || x < pt) continue;
20337             local_check (x, 69, 0x7fffffff);
20338             }
20339         }
20340     printf ("sLOCALTIME_max=%ld\n", pt);
20341     return (0);
20342    } /* check_max */
20343
20344 int check_min ()
20345 {
20346     tmp = NULL;
20347     pt  = 0;
20348 #ifdef MINLONG
20349     local_check (MINLONG, -1900, 70);
20350 #endif
20351     if (tmp == NULL) {
20352         for (i = 36; i >= 0; i--) {
20353             time_t x = pt - ((time_t)1 << i);
20354             if (x > 0) continue;
20355             local_check (x, -1900, 70);
20356             }
20357         }
20358     printf ("sLOCALTIME_min=%ld\n", pt);
20359     return (0);
20360     } /* check_min */
20361
20362 int main (int argc, char *argv[])
20363 {
20364     check_max ();
20365     check_min ();
20366     return (0);
20367     } /* main */
20368 EOCP
20369         set try
20370         if eval $compile; then
20371             eval `$run ./try`
20372         else
20373             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20374             fi
20375         $rm_try
20376         ;;
20377     esac
20378
20379 : check for type of arguments to select.
20380 case "$selecttype" in
20381 '') case "$d_select" in
20382         $define)
20383                 echo " "
20384                 $cat <<EOM
20385 Checking to see what type of arguments are accepted by select().
20386 EOM
20387                 hdrs="$define sys/types.h
20388                         $i_systime sys/time.h
20389                         $i_sysselct sys/select.h
20390                         $d_socket sys/socket.h"
20391                 : The first arg can be int, unsigned, or size_t
20392                 : The last arg may or may not be 'const'
20393                 val=''
20394                 : void pointer has been seen but using that
20395                 : breaks the selectminbits test
20396                 for xxx in 'fd_set *' 'int *'; do
20397                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20398                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20399                                         case "$val" in
20400                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20401                                                 if ./protochk "$try" $hdrs; then
20402                                                         echo "Your system accepts $xxx."
20403                                                         val="$xxx"
20404                                                 fi
20405                                                 ;;
20406                                         esac
20407                                 done
20408                         done
20409                 done
20410                 case "$val" in
20411                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20412                         case "$d_fd_set" in
20413                                 $define) dflt="fd_set *" ;;
20414                                 *)              dflt="int *" ;;
20415                         esac
20416                         . ./myread
20417                         val=$ans
20418                         ;;
20419                 esac
20420                 selecttype="$val"
20421                 ;;
20422         *)      : no select, so pick a harmless default
20423                 selecttype='int *'
20424                 ;;
20425         esac
20426         ;;
20427 esac
20428
20429 : check for the select 'width'
20430 case "$selectminbits" in
20431 '') safebits=`expr $ptrsize \* 8`
20432     case "$d_select" in
20433         $define)
20434                 $cat <<EOM
20435
20436 Checking to see on how many bits at a time your select() operates...
20437 EOM
20438                 $cat >try.c <<EOCP
20439 #include <sys/types.h>
20440 #$i_time I_TIME
20441 #$i_systime I_SYS_TIME
20442 #$i_systimek I_SYS_TIME_KERNEL
20443 #ifdef I_TIME
20444 #   include <time.h>
20445 #endif
20446 #ifdef I_SYS_TIME
20447 #   ifdef I_SYS_TIME_KERNEL
20448 #       define KERNEL
20449 #   endif
20450 #   include <sys/time.h>
20451 #   ifdef I_SYS_TIME_KERNEL
20452 #       undef KERNEL
20453 #   endif
20454 #endif
20455 #$i_sysselct I_SYS_SELECT
20456 #ifdef I_SYS_SELECT
20457 #include <sys/select.h>
20458 #endif
20459 #$d_socket HAS_SOCKET
20460 #ifdef HAS_SOCKET
20461 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20462 #endif
20463 #include <stdio.h>
20464 #$i_stdlib I_STDLIB
20465 #ifdef I_STDLIB
20466 #include <stdlib.h>
20467 #endif
20468 $selecttype b;
20469 #define S sizeof(*(b))
20470 #define MINBITS 64
20471 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20472 #define NBITS  (NBYTES * 8)
20473 int main() {
20474     char *s = (char *)malloc(NBYTES);
20475     struct timeval t;
20476     int i;
20477     FILE* fp;
20478     int fd;
20479
20480     if (!s)
20481         exit(1);
20482     fclose(stdin);
20483     fp = fopen("try.c", "r");
20484     if (fp == 0)
20485       exit(2);
20486     fd = fileno(fp);
20487     if (fd < 0)
20488       exit(3);
20489     b = ($selecttype)s;
20490     for (i = 0; i < NBITS; i++)
20491         FD_SET(i, b);
20492     t.tv_sec  = 0;
20493     t.tv_usec = 0;
20494     select(fd + 1, b, 0, 0, &t);
20495     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20496     free(s);
20497     printf("%d\n", i + 1);
20498     return 0;
20499 }
20500 EOCP
20501                 set try
20502                 if eval $compile_ok; then
20503                         selectminbits=`$run ./try`
20504                         case "$selectminbits" in
20505                         '')     cat >&4 <<EOM
20506 Cannot figure out on how many bits at a time your select() operates.
20507 I'll play safe and guess it is $safebits bits.
20508 EOM
20509                                 selectminbits=$safebits
20510                                 bits="$safebits bits"
20511                                 ;;
20512                         1)      bits="1 bit" ;;
20513                         *)      bits="$selectminbits bits" ;;
20514                         esac
20515                         echo "Your select() operates on $bits at a time." >&4
20516                 else
20517                         rp='What is the minimum number of bits your select() operates on?'
20518                         case "$byteorder" in
20519                         12345678)       dflt=64 ;;
20520                         1234)           dflt=32 ;;
20521                         *)              dflt=1  ;;
20522                         esac
20523                         . ./myread
20524                         val=$ans
20525                         selectminbits="$val"
20526                 fi
20527                 $rm_try
20528                 ;;
20529         *)      : no select, so pick a harmless default
20530                 selectminbits=$safebits
20531                 ;;
20532         esac
20533         ;;
20534 esac
20535
20536 : Trace out the files included by signal.h, then look for SIGxxx names.
20537 if [ "X$fieldn" = X ]; then
20538         : Just make some guesses.  We check them later.
20539         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20540 else
20541         xxx=`echo '#include <signal.h>' |
20542         $cppstdin $cppminus $cppflags 2>/dev/null |
20543         $grep '^[       ]*#.*include' |
20544         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20545                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20546 fi
20547 xxxfiles=''
20548 for xx in $xxx /dev/null ; do
20549         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20550 done
20551 case "$xxxfiles" in
20552 '')     xxxfiles=`./findhdr signal.h` ;;
20553 esac
20554 xxx=`awk '
20555 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20556         print substr($2, 4, 20)
20557 }
20558 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20559         print substr($3, 4, 20)
20560 }' $xxxfiles`
20561 : Append some common names just in case the awk scan failed.
20562 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20563 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20564 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20565 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20566 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20567
20568 : generate a few handy files for later
20569 $cat > signal.c <<EOCP
20570 #include <sys/types.h>
20571 #include <signal.h>
20572 #$i_stdlib I_STDLIB
20573 #ifdef I_STDLIB
20574 #include <stdlib.h>
20575 #endif
20576 #include <stdio.h>
20577 int main() {
20578
20579 /* Strange style to avoid deeply-nested #if/#else/#endif */
20580 #ifndef NSIG
20581 #  ifdef _NSIG
20582 #    define NSIG (_NSIG)
20583 #  endif
20584 #endif
20585
20586 #ifndef NSIG
20587 #  ifdef SIGMAX
20588 #    define NSIG (SIGMAX+1)
20589 #  endif
20590 #endif
20591
20592 #ifndef NSIG
20593 #  ifdef SIG_MAX
20594 #    define NSIG (SIG_MAX+1)
20595 #  endif
20596 #endif
20597
20598 #ifndef NSIG
20599 #  ifdef _SIG_MAX
20600 #    define NSIG (_SIG_MAX+1)
20601 #  endif
20602 #endif
20603
20604 #ifndef NSIG
20605 #  ifdef MAXSIG
20606 #    define NSIG (MAXSIG+1)
20607 #  endif
20608 #endif
20609
20610 #ifndef NSIG
20611 #  ifdef MAX_SIG
20612 #    define NSIG (MAX_SIG+1)
20613 #  endif
20614 #endif
20615
20616 #ifndef NSIG
20617 #  ifdef SIGARRAYSIZE
20618 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20619 #  endif
20620 #endif
20621
20622 #ifndef NSIG
20623 #  ifdef _sys_nsig
20624 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20625 #  endif
20626 #endif
20627
20628 /* Default to some arbitrary number that's big enough to get most
20629    of the common signals.
20630 */
20631 #ifndef NSIG
20632 #    define NSIG 50
20633 #endif
20634
20635 printf("NSIG %d\n", NSIG);
20636
20637 #ifndef JUST_NSIG
20638
20639 EOCP
20640
20641 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20642 {
20643         printf "#ifdef SIG"; printf $1; printf "\n"
20644         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20645         printf $1; printf ");\n"
20646         printf "#endif\n"
20647 }
20648 END {
20649         printf "#endif /* JUST_NSIG */\n";
20650         printf "exit(0);\n}\n";
20651 }
20652 ' >>signal.c
20653 $cat >signal.awk <<'EOP'
20654 BEGIN { ndups = 0 }
20655 $1 ~ /^NSIG$/ { nsig = $2 }
20656 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20657     if ($2 > maxsig) { maxsig = $2 }
20658     if (sig_name[$2]) {
20659         dup_name[ndups] = $1
20660         dup_num[ndups] = $2
20661         ndups++
20662     }
20663     else {
20664         sig_name[$2] = $1
20665         sig_num[$2] = $2
20666     }
20667 }
20668 END {
20669     if (nsig == 0) {
20670         nsig = maxsig + 1
20671     }
20672     printf("NSIG %d\n", nsig);
20673     for (n = 1; n < nsig; n++) {
20674         if (sig_name[n]) {
20675             printf("%s %d\n", sig_name[n], sig_num[n])
20676         }
20677         else {
20678             printf("NUM%d %d\n", n, n)
20679         }
20680     }
20681     for (n = 0; n < ndups; n++) {
20682         printf("%s %d\n", dup_name[n], dup_num[n])
20683     }
20684 }
20685 EOP
20686 $cat >signal_cmd <<EOS
20687 $startsh
20688 if $test -s signal.lst; then
20689     echo "Using your existing signal.lst file"
20690         exit 0
20691 fi
20692 xxx="$xxx"
20693 EOS
20694 $cat >>signal_cmd <<'EOS'
20695
20696 set signal
20697 if eval $compile_ok; then
20698         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20699                 $uniq | $awk -f signal.awk >signal.lst
20700 else
20701         echo "(I can't seem be able to compile the whole test program)" >&4
20702         echo "(I'll try it in little pieces.)" >&4
20703         set signal -DJUST_NSIG
20704         if eval $compile_ok; then
20705                 $run ./signal$_exe > signal.nsg
20706                 $cat signal.nsg
20707         else
20708                 echo "I can't seem to figure out how many signals you have." >&4
20709                 echo "Guessing 50." >&4
20710                 echo 'NSIG 50' > signal.nsg
20711         fi
20712         : Now look at all the signal names, one at a time.
20713         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20714                 $cat > signal.c <<EOCP
20715 #include <sys/types.h>
20716 #include <signal.h>
20717 #include <stdio.h>
20718 int main() {
20719 printf("$xx %d\n", SIG${xx});
20720 return 0;
20721 }
20722 EOCP
20723                 set signal
20724                 if eval $compile; then
20725                         echo "SIG${xx} found."
20726                         $run ./signal$_exe  >> signal.ls1
20727                 else
20728                         echo "SIG${xx} NOT found."
20729                 fi
20730         done
20731         if $test -s signal.ls1; then
20732                 $cat signal.nsg signal.ls1 |
20733                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20734         fi
20735
20736 fi
20737 if $test -s signal.lst; then
20738         :
20739 else
20740         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20741         echo 'kill -l' >signal
20742         set X `csh -f <signal`
20743         $rm -f signal
20744         shift
20745         case $# in
20746         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20747         esac
20748         echo $@ | $tr ' ' $trnl | \
20749             $awk '{ printf "%s %d\n", $1, ++s; }
20750                   END { printf "NSIG %d\n", ++s }' >signal.lst
20751 fi
20752 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20753 EOS
20754 chmod a+x signal_cmd
20755 $eunicefix signal_cmd
20756
20757 : generate list of signal names
20758 echo " "
20759 case "$sig_name_init" in
20760 '') doinit=yes ;;
20761 *)  case "$sig_num_init" in
20762     ''|*,*) doinit=yes ;;
20763     esac ;;
20764 esac
20765 case "$doinit" in
20766 yes)
20767         echo "Generating a list of signal names and numbers..." >&4
20768         . ./signal_cmd
20769         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20770         sig_name=`$awk 'BEGIN { printf "ZERO " }
20771                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20772         sig_num=`$awk  'BEGIN { printf "0 " }
20773                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20774         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20775                              !/^NSIG/   { printf "\"%s\", ", $1 }
20776                              END        { printf "0\n" }' signal.lst`
20777         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20778                              !/^NSIG/   { printf "%d, ", $2}
20779                              END        { printf "0\n"}' signal.lst`
20780         ;;
20781 esac
20782 echo "The following $sig_count signals are available:"
20783 echo " "
20784 echo $sig_name | $awk \
20785 'BEGIN { linelen = 0 }
20786 {
20787         for (i = 1; i <= NF; i++) {
20788                 name = "SIG" $i " "
20789                 linelen = linelen + length(name)
20790                 if (linelen > 70) {
20791                         printf "\n"
20792                         linelen = length(name)
20793                 }
20794                 printf "%s", name
20795         }
20796         printf "\n"
20797 }'
20798 sig_size=`echo $sig_name | awk '{print NF}'`
20799 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20800
20801 : Check size of size
20802 echo " "
20803 case "$sizetype" in
20804 *_t) zzz="$sizetype"    ;;
20805 *)   zzz="filesize"     ;;
20806 esac
20807 echo "Checking the size of $zzz..." >&4
20808 cat > try.c <<EOCP
20809 #include <sys/types.h>
20810 #include <stdio.h>
20811 #$i_stdlib I_STDLIB
20812 #ifdef I_STDLIB
20813 #include <stdlib.h>
20814 #endif
20815 int main() {
20816     printf("%d\n", (int)sizeof($sizetype));
20817     exit(0);
20818 }
20819 EOCP
20820 set try
20821 if eval $compile_ok; then
20822         yyy=`$run ./try`
20823         case "$yyy" in
20824         '')     sizesize=4
20825                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20826                 ;;
20827         *)      sizesize=$yyy
20828                 echo "Your $zzz size is $sizesize bytes."
20829                 ;;
20830         esac
20831 else
20832         sizesize=4
20833         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20834 fi
20835
20836
20837 : check for socklen_t
20838 echo " "
20839 echo "Checking to see if you have socklen_t..." >&4
20840 $cat >try.c <<EOCP
20841 #include <sys/types.h>
20842 #$d_socket HAS_SOCKET
20843 #ifdef HAS_SOCKET
20844 #include <sys/socket.h>
20845 #endif
20846 int main() { socklen_t x = 16; }
20847 EOCP
20848 set try
20849 if eval $compile; then
20850         val="$define"
20851         echo "You have socklen_t."
20852 else
20853         val="$undef"
20854         echo "You do not have socklen_t."
20855         case "$sizetype" in
20856         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20857         esac
20858 fi
20859 $rm_try
20860 set d_socklen_t
20861 eval $setvar
20862
20863 : see if this is a socks.h system
20864 set socks.h i_socks
20865 eval $inhdr
20866
20867 : check for type of the size argument to socket calls
20868 case "$d_socket" in
20869 "$define")
20870         $cat <<EOM
20871
20872 Checking to see what type is the last argument of accept().
20873 EOM
20874         yyy=''
20875         case "$d_socklen_t" in
20876         "$define") yyy="$yyy socklen_t"
20877         esac
20878         yyy="$yyy $sizetype int long unsigned"
20879         for xxx in $yyy; do
20880                 case "$socksizetype" in
20881                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20882                         case "$usesocks" in
20883                         "$define")
20884                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20885                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20886                                         socksizetype="$xxx"
20887                                 fi
20888                                 ;;
20889                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20890                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20891                                         socksizetype="$xxx"
20892                                 fi
20893                                 ;;
20894                         esac
20895                         ;;
20896                 esac
20897         done
20898 : In case none of those worked, prompt the user.
20899         case "$socksizetype" in
20900         '')     rp='What is the type for socket address structure sizes?'
20901                 dflt='int'
20902                 . ./myread
20903                 socksizetype=$ans
20904                 ;;
20905         esac
20906         ;;
20907 *)      : no sockets, so pick relatively harmless default
20908         socksizetype='int'
20909         ;;
20910 esac
20911
20912 : see what type is used for signed size_t
20913 set ssize_t ssizetype int stdio.h sys/types.h
20914 eval $typedef
20915 dflt="$ssizetype"
20916 $cat > try.c <<EOM
20917 #include <stdio.h>
20918 #$i_stdlib I_STDLIB
20919 #ifdef I_STDLIB
20920 #include <stdlib.h>
20921 #endif
20922 #include <sys/types.h>
20923 #define Size_t $sizetype
20924 #define SSize_t $dflt
20925 int main()
20926 {
20927         if (sizeof(Size_t) == sizeof(SSize_t))
20928                 printf("$dflt\n");
20929         else if (sizeof(Size_t) == sizeof(int))
20930                 printf("int\n");
20931         else
20932                 printf("long\n");
20933         exit(0);
20934 }
20935 EOM
20936 echo " "
20937 set try
20938 if eval $compile_ok && $run ./try > /dev/null; then
20939         ssizetype=`$run ./try`
20940         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20941 else
20942         $cat >&4 <<EOM
20943 Help! I can't compile and run the ssize_t test program: please enlighten me!
20944 (This is probably a misconfiguration in your system or libraries, and
20945 you really ought to fix it.  Still, I'll try anyway.)
20946
20947 I need a type that is the same size as $sizetype, but is guaranteed to
20948 be signed.  Common values are ssize_t, int and long.
20949
20950 EOM
20951         rp="What signed type is the same size as $sizetype?"
20952         . ./myread
20953         ssizetype="$ans"
20954 fi
20955 $rm_try
20956
20957 : see what type of char stdio uses.
20958 echo " "
20959 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20960 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20961         echo "Your stdio uses unsigned chars." >&4
20962         stdchar="unsigned char"
20963 else
20964         echo "Your stdio uses signed chars." >&4
20965         stdchar="char"
20966 fi
20967 $rm -f stdioh
20968
20969 : see what type uids are declared as in the kernel
20970 echo " "
20971 echo "Looking for the type for user ids returned by getuid()."
20972 set uid_t uidtype xxx stdio.h sys/types.h
20973 eval $typedef
20974 case "$uidtype" in
20975 xxx)
20976         xxx=`./findhdr sys/user.h`
20977         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20978         case $1 in
20979         unsigned) dflt="$1 $2" ;;
20980         *) dflt="$1" ;;
20981         esac
20982         ;;
20983 *) dflt="$uidtype";;
20984 esac
20985 case "$uidtype" in
20986 uid_t)  echo "uid_t found." ;;
20987 *)      rp="What is the type for user ids returned by getuid()?"
20988         . ./myread
20989         uidtype="$ans"
20990         ;;
20991 esac
20992
20993 : Check size of UID
20994 echo " "
20995 case "$uidtype" in
20996 *_t) zzz="$uidtype"     ;;
20997 *)   zzz="uid"          ;;
20998 esac
20999 echo "Checking the size of $zzz..." >&4
21000 cat > try.c <<EOCP
21001 #include <sys/types.h>
21002 #include <stdio.h>
21003 #$i_stdlib I_STDLIB
21004 #ifdef I_STDLIB
21005 #include <stdlib.h>
21006 #endif
21007 int main() {
21008     printf("%d\n", (int)sizeof($uidtype));
21009     exit(0);
21010 }
21011 EOCP
21012 set try
21013 if eval $compile_ok; then
21014         yyy=`$run ./try`
21015         case "$yyy" in
21016         '')     uidsize=4
21017                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21018                 ;;
21019         *)      uidsize=$yyy
21020                 echo "Your $zzz is $uidsize bytes long."
21021                 ;;
21022         esac
21023 else
21024         uidsize=4
21025         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21026 fi
21027
21028 : Check if UID is signed
21029 echo " "
21030 case "$uidtype" in
21031 *_t) zzz="$uidtype"     ;;
21032 *)   zzz="uid"          ;;
21033 esac
21034 echo "Checking the sign of $zzz..." >&4
21035 cat > try.c <<EOCP
21036 #include <sys/types.h>
21037 #include <stdio.h>
21038 int main() {
21039         $uidtype foo = -1;
21040         if (foo < 0)
21041                 printf("-1\n");
21042         else
21043                 printf("1\n");
21044 }
21045 EOCP
21046 set try
21047 if eval $compile; then
21048         yyy=`$run ./try`
21049         case "$yyy" in
21050         '')     uidsign=1
21051                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21052                 ;;
21053         *)      uidsign=$yyy
21054                 case "$uidsign" in
21055                  1) echo "Your $zzz is unsigned." ;;
21056                 -1) echo "Your $zzz is signed."   ;;
21057                 esac
21058                 ;;
21059         esac
21060 else
21061         uidsign=1
21062         echo "(I can't compile the test program--guessing unsigned.)" >&4
21063 fi
21064
21065
21066 : Check format string for UID
21067 echo " "
21068 $echo "Checking the format string to be used for uids..." >&4
21069
21070 case "$uidsign" in
21071 -1)     if $test X"$uidsize" = X"$ivsize"; then
21072                 uidformat="$ivdformat"
21073         else
21074                 if $test X"$uidsize" = X"$longsize"; then
21075                         uidformat='"ld"'
21076                 else
21077                         if $test X"$uidsize" = X"$intsize"; then
21078                                 uidformat='"d"'
21079                         else
21080                                 if $test X"$uidsize" = X"$shortsize"; then
21081                                         uidformat='"hd"'
21082                                 fi
21083                         fi
21084                 fi
21085         fi
21086         ;;
21087 *)      if $test X"$uidsize" = X"$uvsize"; then
21088                 uidformat="$uvuformat"
21089         else
21090                 if $test X"$uidsize" = X"$longsize"; then
21091                         uidformat='"lu"'
21092                 else
21093                         if $test X"$uidsize" = X"$intsize"; then
21094                                 uidformat='"u"'
21095                         else
21096                                 if $test X"$uidsize" = X"$shortsize"; then
21097                                         uidformat='"hu"'
21098                                 fi
21099                         fi
21100                 fi
21101         fi
21102         ;;
21103 esac
21104
21105 : Check if site customization support was requested
21106 case "$usesitecustomize" in
21107     $define|true|[Yy]*)
21108         usesitecustomize="$define"
21109         ;;
21110     *)
21111         usesitecustomize="$undef"
21112         ;;
21113     esac
21114
21115 : determine compiler compiler
21116 case "$yacc" in
21117 '')
21118         dflt=yacc;;
21119 *)
21120         dflt="$yacc";;
21121 esac
21122 echo " "
21123 comp='yacc'
21124 if $test -f "$byacc$_exe"; then
21125         dflt="$byacc"
21126         comp="byacc or $comp"
21127 fi
21128 if $test -f "$bison$_exe"; then
21129         comp="$comp or bison -y"
21130 fi
21131 rp="Which compiler compiler ($comp) shall I use?"
21132 . ./myread
21133 yacc="$ans"
21134 case "$yacc" in
21135 *bis*)
21136         case "$yacc" in
21137         *-y*) ;;
21138         *)
21139                 yacc="$yacc -y"
21140                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21141                 ;;
21142         esac
21143         ;;
21144 esac
21145
21146 : see if this is a assert.h system
21147 set assert.h i_assert
21148 eval $inhdr
21149
21150 : see if this is a fp.h system
21151 set fp.h i_fp
21152 eval $inhdr
21153
21154 : see if this is a fp_class.h system
21155 set fp_class.h i_fp_class
21156 eval $inhdr
21157
21158 : see if gdbm.h is available
21159 set gdbm.h t_gdbm
21160 eval $inhdr
21161 case "$t_gdbm" in
21162 $define)
21163         : see if gdbm_open exists
21164         set gdbm_open d_gdbm_open
21165         eval $inlibc
21166         case "$d_gdbm_open" in
21167         $undef)
21168                 t_gdbm="$undef"
21169                 echo "We won't be including <gdbm.h>"
21170                 ;;
21171         esac
21172         ;;
21173 esac
21174 val="$t_gdbm"
21175 set i_gdbm
21176 eval $setvar
21177
21178 : see if this is a ieeefp.h system
21179 case "$i_ieeefp" in
21180 '' ) set ieeefp.h i_ieeefp
21181      eval $inhdr
21182      ;;
21183 esac
21184
21185 : see if this is a libutil.h system
21186 set libutil.h i_libutil
21187 eval $inhdr
21188
21189 : see if mach cthreads are available
21190 if test "X$usethreads" = "X$define"; then
21191         set mach/cthreads.h i_machcthr
21192         eval $inhdr
21193 else
21194         i_machcthr="$undef"
21195 fi
21196
21197 : see if this is a mntent.h system
21198 set mntent.h i_mntent
21199 eval $inhdr
21200
21201 : see if net/errno.h is available
21202 val=''
21203 set net/errno.h val
21204 eval $inhdr
21205
21206 : Unfortunately, it causes problems on some systems.  Arrgh.
21207 case "$val" in
21208 $define)
21209         cat > try.c <<'EOM'
21210 #include <stdio.h>
21211 #include <errno.h>
21212 #include <net/errno.h>
21213 int func()
21214 {
21215         return ENOTSOCK;
21216 }
21217 EOM
21218         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21219                 echo "We'll be including <net/errno.h>." >&4
21220         else
21221                 echo "We won't be including <net/errno.h>." >&4
21222                 val="$undef"
21223         fi
21224         $rm_try
21225         ;;
21226 esac
21227 set i_neterrno
21228 eval $setvar
21229
21230 : see if netinet/tcp.h is available
21231 set netinet/tcp.h i_netinettcp
21232 eval $inhdr
21233
21234 : see if this is a poll.h system
21235 set poll.h i_poll
21236 eval $inhdr
21237
21238 : see if this is a prot.h system
21239 set prot.h i_prot
21240 eval $inhdr
21241
21242 : Preprocessor symbols
21243 echo " "
21244 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21245 $cat <<'EOSH' > Cppsym.know
21246 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21247 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21248 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21249 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21250 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21251 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21252 bull c cadmus clipper CMU COFF COMPILER_VERSION
21253 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21254 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21255 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21256 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21257 GLIBC GLIBC_MINOR
21258 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21259 H3050R H3050RX hbullx20 hcx host_mips
21260 hp200 hp300 hp700 HP700 hp800 hp9000
21261 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21262 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21263 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21264 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21265 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21266 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21267 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21268 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21269 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21270 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21271 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21272 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21273 MATH_HAS_NO_SIDE_EFFECTS
21274 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21275 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21276 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21277 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21278 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21279 NetBSD news1500 news1700 news1800 news1900 news3700
21280 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21281 ns32016 ns32332 ns32k nsc32000
21282 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21283 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21284 pc532 pdp11 PGC PIC plexus PORTAR posix
21285 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21286 POSIX_C_SOURCE POSIX_SOURCE POWER
21287 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21288 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21289 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21290 sony sony_news sonyrisc sparc sparclite spectrum
21291 stardent stdc STDC_EXT stratos sun sun3 sun386
21292 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21293 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21294 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21295 sysV68 sysV88 Tek4132 Tek4300 titan
21296 TM3200 TM5400 TM5600
21297 tower tower32 tower32_200 tower32_600 tower32_700
21298 tower32_800 tower32_850 tss
21299 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21300 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21301 unix UNIX95 UNIX99 unixpc unos
21302 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21303 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21304 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21305 USGr4 USGr4_2
21306 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21307 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21308 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21309 z8000
21310 EOSH
21311 # Maybe put other stuff here too.
21312 cat <<EOSH >>Cppsym.know
21313 $osname
21314 EOSH
21315 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21316 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21317 $cat Cppsym.know > Cppsym.c
21318 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21319 $rm -f Cppsym.a Cppsym.b Cppsym.c
21320 cat <<EOSH > Cppsym
21321 $startsh
21322 if $test \$# -gt 0; then
21323     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21324     if $test -s Cppsym.got; then
21325         $rm -f Cppsym.got
21326         exit 0
21327     fi
21328     $rm -f Cppsym.got
21329     exit 1
21330 else
21331     $tr " " "$trnl" | ./Cppsym.try
21332     exit 0
21333 fi
21334 EOSH
21335 chmod +x Cppsym
21336 $eunicefix Cppsym
21337 cat <<EOSH > Cppsym.try
21338 $startsh
21339 cat <<'EOCP' > try.c
21340 #include <stdio.h>
21341 #if cpp_stuff == 1
21342 #define STRINGIFY(a)    "a"
21343 #endif
21344 #if cpp_stuff == 42
21345 #define StGiFy(a)  #a
21346 #define STRINGIFY(a)    StGiFy(a)
21347 #endif
21348 #if $cpp_stuff != 1 && $cpp_stuff != 42
21349 #   include "Bletch: How does this C preprocessor stringify macros?"
21350 #endif
21351 int main() {
21352 EOCP
21353 $awk \\
21354 EOSH
21355 cat <<'EOSH' >> Cppsym.try
21356 'length($1) > 0 {
21357     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21358     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21359     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21360     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21361 }'       >> try.c
21362 echo 'return 0;}' >> try.c
21363 EOSH
21364 cat <<EOSH >> Cppsym.try
21365 ccflags="$ccflags"
21366 case "$osname-$gccversion" in
21367 irix-) ccflags="\$ccflags -woff 1178" ;;
21368 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21369 esac
21370 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21371 EOSH
21372 chmod +x Cppsym.try
21373 $eunicefix Cppsym.try
21374 ./Cppsym < Cppsym.know > Cppsym.true
21375 : Add in any linux cpp "predefined macros":
21376 case "$osname::$gccversion" in
21377   *linux*::*.*)
21378     tHdrH=_tmpHdr
21379     rm -f $tHdrH'.h' $tHdrH
21380     touch $tHdrH'.h'
21381     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21382        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21383        if [ -s $tHdrH'_cppsym.real' ]; then
21384           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21385        fi
21386     fi
21387     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21388   ;;
21389 esac
21390 : now check the C compiler for additional symbols
21391 postprocess_cc_v=''
21392 case "$osname" in
21393 aix) postprocess_cc_v="|$tr , ' '" ;;
21394 esac
21395 $cat >ccsym <<EOS
21396 $startsh
21397 $cat >tmp.c <<EOF
21398 extern int foo;
21399 EOF
21400 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21401 do
21402         case "\$i" in
21403         -D*) echo "\$i" | $sed 's/^-D//';;
21404         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21405         esac
21406 done
21407 $rm_try
21408 EOS
21409 postprocess_cc_v=''
21410 chmod +x ccsym
21411 $eunicefix ccsym
21412 ./ccsym > ccsym1.raw
21413 if $test -s ccsym1.raw; then
21414        $sort ccsym1.raw | $uniq >ccsym.raw
21415 else
21416        mv ccsym1.raw ccsym.raw
21417 fi
21418
21419 $awk '/\=/ { print $0; next }
21420         { print $0"=1" }' ccsym.raw >ccsym.list
21421 $comm -13 Cppsym.true ccsym.list >ccsym.own
21422 $comm -12 Cppsym.true ccsym.list >ccsym.com
21423 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21424 also=''
21425 if $test -z ccsym.raw; then
21426         echo "Your C compiler doesn't seem to define any symbols!" >&4
21427         echo " "
21428         echo "However, your C preprocessor defines the following symbols:"
21429         $cat Cppsym.true
21430         ccsymbols=''
21431         cppsymbols=`$cat Cppsym.true`
21432         cppsymbols=`echo $cppsymbols`
21433         cppccsymbols="$cppsymbols"
21434 else
21435         if $test -s ccsym.com; then
21436                 echo "Your C compiler and pre-processor define these symbols:"
21437                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21438                 also='also '
21439                 symbols='ones'
21440                 cppccsymbols=`$cat ccsym.com`
21441                 cppccsymbols=`echo $cppccsymbols`
21442                 $test "$silent" || sleep 1
21443         fi
21444         if $test -s ccsym.cpp; then
21445                 $test "$also" && echo " "
21446                 echo "Your C pre-processor ${also}defines the following symbols:"
21447                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21448                 also='further '
21449                 cppsymbols=`$cat ccsym.cpp`
21450                 cppsymbols=`echo $cppsymbols`
21451                 $test "$silent" || sleep 1
21452         fi
21453         if $test -s ccsym.own; then
21454                 $test "$also" && echo " "
21455                 echo "Your C compiler ${also}defines the following cpp symbols:"
21456                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21457                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21458                 ccsymbols=`$cat ccsym.own`
21459                 ccsymbols=`echo $ccsymbols`
21460                 $test "$silent" || sleep 1
21461         fi
21462 fi
21463
21464 : see if this is a termio system
21465 val="$undef"
21466 val2="$undef"
21467 val3="$undef"
21468 if $test `./findhdr termios.h`; then
21469         set tcsetattr i_termios
21470         eval $inlibc
21471         val3="$i_termios"
21472 fi
21473 echo " "
21474 case "$val3" in
21475 "$define") echo "You have POSIX termios.h... good!" >&4;;
21476 *) if ./Cppsym pyr; then
21477                 case "`/bin/universe`" in
21478                 ucb) if $test `./findhdr sgtty.h`; then
21479                                 val2="$define"
21480                                 echo "<sgtty.h> found." >&4
21481                         else
21482                                 echo "System is pyramid with BSD universe."
21483                                 ./warn "<sgtty.h> not found--you could have problems."
21484                         fi;;
21485                 *) if $test `./findhdr termio.h`; then
21486                                 val="$define"
21487                                 echo "<termio.h> found." >&4
21488                         else
21489                                 echo "System is pyramid with USG universe."
21490                                 ./warn "<termio.h> not found--you could have problems."
21491                         fi;;
21492                 esac
21493         elif ./usg; then
21494                 if $test `./findhdr termio.h`; then
21495                         echo "<termio.h> found." >&4
21496                         val="$define"
21497                 elif $test `./findhdr sgtty.h`; then
21498                         echo "<sgtty.h> found." >&4
21499                         val2="$define"
21500                 else
21501                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21502                 fi
21503         else
21504                 if $test `./findhdr sgtty.h`; then
21505                         echo "<sgtty.h> found." >&4
21506                         val2="$define"
21507                 elif $test `./findhdr termio.h`; then
21508                         echo "<termio.h> found." >&4
21509                         val="$define"
21510                 else
21511                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21512                 fi
21513         fi;;
21514 esac
21515 set i_termio; eval $setvar
21516 val=$val2; set i_sgtty; eval $setvar
21517 val=$val3; set i_termios; eval $setvar
21518
21519 : see if stddef is available
21520 set stddef.h i_stddef
21521 eval $inhdr
21522
21523 : see if sys/access.h is available
21524 set sys/access.h i_sysaccess
21525 eval $inhdr
21526
21527 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21528 set sys/filio.h i_sysfilio
21529 eval $inhdr
21530 echo " "
21531 if $test `./findhdr sys/ioctl.h`; then
21532         val="$define"
21533         echo '<sys/ioctl.h> found.' >&4
21534 else
21535         val="$undef"
21536         if $test $i_sysfilio = "$define"; then
21537             echo '<sys/ioctl.h> NOT found.' >&4
21538         else
21539                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21540                 $test $i_termio = "$define" && xxx="termio.h"
21541                 $test $i_termios = "$define" && xxx="termios.h"
21542 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21543         fi
21544 fi
21545 set i_sysioctl
21546 eval $setvar
21547
21548 : see if socket ioctl defs are in sys/sockio.h
21549 echo " "
21550 xxx=`./findhdr sys/sockio.h`
21551 if $test "$xxx"; then
21552         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21553                 val="$define"
21554                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21555         else
21556                 val="$undef"
21557                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21558         fi
21559 else
21560         val="$undef"
21561         $cat <<EOM
21562 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21563 EOM
21564 fi
21565 set i_syssockio
21566 eval $setvar
21567
21568 : see if this is a syslog.h system
21569 set syslog.h i_syslog
21570 eval $inhdr
21571
21572 : see if this is a sys/mode.h system
21573 set sys/mode.h i_sysmode
21574 eval $inhdr
21575
21576 : see if there is a sys/poll.h file
21577 set sys/poll.h i_syspoll
21578 eval $inhdr
21579
21580 : see if sys/resource.h has to be included
21581 set sys/resource.h i_sysresrc
21582 eval $inhdr
21583
21584 : see if sys/security.h is available
21585 set sys/security.h i_syssecrt
21586 eval $inhdr
21587
21588 : see if this is a sys/statvfs.h system
21589 set sys/statvfs.h i_sysstatvfs
21590 eval $inhdr
21591
21592 : see if this is a sys/un.h system
21593 set sys/un.h i_sysun
21594 eval $inhdr
21595
21596 : see if this is a sys/utsname.h system
21597 set sys/utsname.h i_sysutsname
21598 eval $inhdr
21599
21600 : see if this is a syswait system
21601 set sys/wait.h i_syswait
21602 eval $inhdr
21603
21604 : see if this is a ustat.h system
21605 set ustat.h i_ustat
21606 eval $inhdr
21607
21608 : see if this is an utime system
21609 set utime.h i_utime
21610 eval $inhdr
21611
21612 : see if this is a vfork system
21613 case "$d_vfork" in
21614 "$define")
21615         set vfork.h i_vfork
21616         eval $inhdr
21617         ;;
21618 *)
21619         i_vfork="$undef"
21620         ;;
21621 esac
21622
21623 : Check extensions
21624 echo " "
21625 echo "Looking for extensions..." >&4
21626 : If we are using the old config.sh, known_extensions may contain
21627 : old or inaccurate or duplicate values.
21628 known_extensions=''
21629 nonxs_extensions=''
21630 : We do not use find because it might not be available.
21631 : We do not just use MANIFEST because the user may have dropped
21632 : some additional extensions into the source tree and expect them
21633 : to be built.
21634
21635 : Function to recursively find available extensions, ignoring DynaLoader
21636 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21637 find_extensions='
21638     for xxx in *; do
21639         case "$xxx" in
21640             DynaLoader|dynaload) ;;
21641             *)
21642             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21643             leaf=`echo $xxx | $sed -e s/.*-//`;
21644             if $test -d File-Glob; then
21645                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21646                     known_extensions="$known_extensions $this_ext";
21647                 elif $test -d $xxx; then
21648                     nonxs_extensions="$nonxs_extensions $this_ext";
21649                 fi
21650             else
21651                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21652                     known_extensions="$known_extensions $1$this_ext";
21653                 elif $test -f $xxx/Makefile.PL; then
21654                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21655                 else
21656                     if $test -d $xxx -a $# -lt 10; then
21657                         set $1$xxx/ $*;
21658                         cd "$xxx";
21659                         eval $find_extensions;
21660                         cd ..;
21661                         shift;
21662                     fi;
21663                 fi;
21664             fi
21665             ;;
21666         esac;
21667     done'
21668 tdir=`pwd`
21669 cd "$rsrc/ext"
21670 set X
21671 shift
21672 eval $find_extensions
21673 if $test -d File-Glob; then
21674     : All ext/ flattened
21675 else
21676     # Special case:  Add in modules that nest beyond the first level.
21677     # Currently threads/shared and Hash/Util/FieldHash, since they are
21678     # not picked up by the recursive find above (and adding in general
21679     # recursive finding breaks SDBM_File/sdbm).
21680     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21681     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21682 fi
21683 set X $known_extensions
21684 shift
21685 known_extensions="$*"
21686 set X $nonxs_extensions
21687 shift
21688 nonxs_extensions="$*"
21689 cd "$tdir"
21690
21691 : Now see which are supported on this system.
21692 avail_ext=''
21693 for xxx in $known_extensions ; do
21694         case "$xxx" in
21695         DB_File|db_file)
21696                 case "$i_db" in
21697                 $define) avail_ext="$avail_ext $xxx" ;;
21698                 esac
21699                 ;;
21700         GDBM_File|gdbm_fil)
21701                 case "$i_gdbm" in
21702                 $define) avail_ext="$avail_ext $xxx" ;;
21703                 esac
21704                 ;;
21705         I18N/Langinfo|i18n_lan)
21706                 case "$i_langinfo$d_nl_langinfo" in
21707                 $define$define) avail_ext="$avail_ext $xxx" ;;
21708                 esac
21709                 ;;
21710         IPC/SysV|ipc/sysv)
21711                 : XXX Do we need a useipcsysv variable here
21712                 case "${d_msg}${d_sem}${d_shm}" in
21713                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21714                 esac
21715                 ;;
21716         NDBM_File|ndbm_fil)
21717                 case "$i_ndbm" in
21718                 $define)
21719                     case "$osname-$use64bitint" in
21720                     hpux-define)
21721                         case "$libs" in
21722                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21723                         esac
21724                         ;;
21725                     *) avail_ext="$avail_ext $xxx" ;;
21726                     esac
21727                     ;;
21728                 esac
21729                 ;;
21730         ODBM_File|odbm_fil)
21731                 case "${i_dbm}${i_rpcsvcdbm}" in
21732                 *"${define}"*)
21733                     case "$d_cplusplus" in
21734                     define) ;; # delete as a function name will not work
21735                     *)  case "$osname-$use64bitint" in
21736                         hpux-define)
21737                             case "$libs" in
21738                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21739                             esac
21740                             ;;
21741                         *) avail_ext="$avail_ext $xxx" ;;
21742                         esac
21743                         ;;
21744                     esac
21745                     ;;
21746                 esac
21747                 ;;
21748         Opcode|opcode)
21749                 case "$useopcode" in
21750                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21751                 esac
21752                 ;;
21753         POSIX|posix)
21754                 case "$useposix" in
21755                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21756                 esac
21757                 ;;
21758         Socket|socket)
21759                 case "$d_socket" in
21760                 true|$define|y)
21761                     case "$osname" in
21762                     beos) ;; # not unless BONE
21763                     *) avail_ext="$avail_ext $xxx" ;;
21764                     esac
21765                     ;;
21766                 esac
21767                 ;;
21768         Sys/Syslog|sys/syslog)
21769                 : XXX syslog requires socket
21770                 case "$d_socket" in
21771                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21772                 esac
21773                 ;;
21774         Thread|thread)
21775                 case "$usethreads" in
21776                 true|$define|y)
21777                         case "$use5005threads" in
21778                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21779                         esac
21780                 esac
21781                 ;;
21782         threads|threads/shared)
21783                 # threads and threads::shared are special cases.
21784                 # To stop people from asking "Perl 5.8.0 was supposed
21785                 # to have this new fancy threads implementation but my
21786                 # perl doesn't have it" and from people trying to
21787                 # (re)install the threads module using CPAN.pm and
21788                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21789                 # the threads.pm and threads/shared.pm will always be
21790                 # there, croaking informatively ("you need to rebuild
21791                 # all of Perl with threads, sorry") when threads haven't
21792                 # been compiled in.
21793                 # --jhi
21794                 avail_ext="$avail_ext $xxx"
21795                 ;;
21796         VMS*)
21797                 ;;
21798         Win32*)
21799                 case "$osname" in
21800                 cygwin) avail_ext="$avail_ext $xxx" ;;
21801                 esac
21802                 ;;
21803         XS/APItest|xs/apitest)
21804                 # This is just for testing.  Skip it unless we have dynamic loading.
21805
21806                 case "$usedl" in
21807                 $define) avail_ext="$avail_ext $xxx" ;;
21808                 esac
21809                 ;;
21810         XS/Typemap|xs/typemap)
21811                 # This is just for testing.  Skip it unless we have dynamic loading.
21812                 case "$usedl" in
21813                 $define) avail_ext="$avail_ext $xxx" ;;
21814                 esac
21815                 ;;
21816         *)      avail_ext="$avail_ext $xxx"
21817                 ;;
21818         esac
21819 done
21820
21821 set X $avail_ext
21822 shift
21823 avail_ext="$*"
21824
21825 case "$onlyextensions" in
21826 '') ;;
21827 *)  keepextensions=''
21828     echo "You have requested that only certains extensions be included..." >&4
21829     for i in $onlyextensions; do
21830         case " $avail_ext " in
21831         *" $i "*)
21832             echo "Keeping extension $i."
21833             keepextensions="$keepextensions $i"
21834             ;;
21835         *) echo "Ignoring extension $i." ;;
21836         esac
21837     done
21838     avail_ext="$keepextensions"
21839     ;;
21840 esac
21841
21842 case "$noextensions" in
21843 '') ;;
21844 *)  keepextensions=''
21845     echo "You have requested that certain extensions be ignored..." >&4
21846     for i in $avail_ext; do
21847         case " $noextensions " in
21848         *" $i "*) echo "Ignoring extension $i." ;;
21849         *) echo "Keeping extension $i.";
21850            keepextensions="$keepextensions $i"
21851            ;;
21852         esac
21853     done
21854     avail_ext="$keepextensions"
21855     ;;
21856 esac
21857
21858 : Now see which nonxs extensions are supported on this system.
21859 : For now assume all are.
21860 nonxs_ext=''
21861 for xxx in $nonxs_extensions ; do
21862         case "$xxx" in
21863         *)      nonxs_ext="$nonxs_ext $xxx"
21864                 ;;
21865         esac
21866 done
21867
21868 set X $nonxs_ext
21869 shift
21870 nonxs_ext="$*"
21871
21872 case $usedl in
21873 $define)
21874         $cat <<EOM
21875 A number of extensions are supplied with $package.  You may choose to
21876 compile these extensions for dynamic loading (the default), compile
21877 them into the $package executable (static loading), or not include
21878 them at all.  Answer "none" to include no extensions.
21879 Note that DynaLoader is always built and need not be mentioned here.
21880
21881 EOM
21882         case "$dynamic_ext" in
21883         '')
21884                 : Exclude those listed in static_ext
21885                 dflt=''
21886                 for xxx in $avail_ext; do
21887                         case " $static_ext " in
21888                         *" $xxx "*) ;;
21889                         *) dflt="$dflt $xxx" ;;
21890                         esac
21891                 done
21892                 set X $dflt
21893                 shift
21894                 dflt="$*"
21895                 ;;
21896         *)      dflt="$dynamic_ext"
21897                 # Perhaps we are reusing an old out-of-date config.sh.
21898                 case "$hint" in
21899                 previous)
21900                         if test X"$dynamic_ext" != X"$avail_ext"; then
21901                                 $cat <<EOM
21902 NOTICE:  Your previous config.sh list may be incorrect.
21903 The extensions now available to you are
21904         ${avail_ext}
21905 but the default list from your previous config.sh is
21906         ${dynamic_ext}
21907
21908 EOM
21909                         fi
21910                         ;;
21911                 esac
21912                 ;;
21913         esac
21914         case "$dflt" in
21915         '')     dflt=none;;
21916         esac
21917         rp="What extensions do you wish to load dynamically?"
21918         . ./myread
21919         case "$ans" in
21920         none) dynamic_ext=' ' ;;
21921         *) dynamic_ext="$ans" ;;
21922         esac
21923
21924         case "$static_ext" in
21925         '')
21926                 : Exclude those already listed in dynamic linking
21927                 dflt=''
21928                 for xxx in $avail_ext; do
21929                         case " $dynamic_ext " in
21930                         *" $xxx "*) ;;
21931                         *) dflt="$dflt $xxx" ;;
21932                         esac
21933                 done
21934                 set X $dflt
21935                 shift
21936                 dflt="$*"
21937                 ;;
21938         *)  dflt="$static_ext"
21939                 ;;
21940         esac
21941
21942         case "$dflt" in
21943         '')     dflt=none;;
21944         esac
21945         rp="What extensions do you wish to load statically?"
21946         . ./myread
21947         case "$ans" in
21948         none) static_ext=' ' ;;
21949         *) static_ext="$ans" ;;
21950         esac
21951         ;;
21952 *)
21953         $cat <<EOM
21954 A number of extensions are supplied with $package.  Answer "none"
21955 to include no extensions.
21956 Note that DynaLoader is always built and need not be mentioned here.
21957
21958 EOM
21959         case "$static_ext" in
21960         '') dflt="$avail_ext" ;;
21961         *)      dflt="$static_ext"
21962                 # Perhaps we are reusing an old out-of-date config.sh.
21963                 case "$hint" in
21964                 previous)
21965                         if test X"$static_ext" != X"$avail_ext"; then
21966                                 $cat <<EOM
21967 NOTICE:  Your previous config.sh list may be incorrect.
21968 The extensions now available to you are
21969         ${avail_ext}
21970 but the default list from your previous config.sh is
21971         ${static_ext}
21972
21973 EOM
21974                         fi
21975                         ;;
21976                 esac
21977                 ;;
21978         esac
21979         : Exclude those that are not xs extensions
21980         case "$dflt" in
21981         '')     dflt=none;;
21982         esac
21983         rp="What extensions do you wish to include?"
21984         . ./myread
21985         case "$ans" in
21986         none) static_ext=' ' ;;
21987         *) static_ext="$ans" ;;
21988         esac
21989         ;;
21990 esac
21991 #
21992 # Encode is a special case.  If we are building Encode as a static
21993 # extension, we need to explicitly list its subextensions as well.
21994 # For other nested extensions, this is handled automatically by
21995 # the appropriate Makefile.PL.
21996 case " $static_ext " in
21997         *" Encode "*) # Add the subextensions of Encode
21998         cd "$rsrc/ext"
21999         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22000                 static_ext="$static_ext Encode/$xxx"
22001         done
22002         cd "$tdir"
22003         ;;
22004 esac
22005
22006 set X $dynamic_ext $static_ext $nonxs_ext
22007 shift
22008 extensions="$*"
22009
22010 # Sanity check:  We require an extension suitable for use with
22011 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22012 # should show up as failures in the test suite, but it's helpful to
22013 # catch them now.) The 'extensions' list is normally sorted
22014 # alphabetically, so we need to accept either
22015 #    DB_File ... Fcntl ... IO  ....
22016 # or something like
22017 #    Fcntl ... NDBM_File ... IO  ....
22018 case " $extensions"  in
22019 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22020 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22021 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22022 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22023    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22024    ;;
22025 esac
22026
22027 : Remove libraries needed only for extensions
22028 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22029 : The exception is SunOS 4.x, which needs them.
22030 case "${osname}X${osvers}" in
22031 sunos*X4*)
22032     perllibs="$libs"
22033     ;;
22034 *) case "$usedl" in
22035     $define|true|[yY]*)
22036             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22037             shift
22038             perllibs="$*"
22039             ;;
22040     *)  perllibs="$libs"
22041             ;;
22042     esac
22043     ;;
22044 esac
22045
22046 : Remove build directory name from cppstdin so it can be used from
22047 : either the present location or the final installed location.
22048 echo " "
22049 : Get out of the UU directory to get correct path name.
22050 cd ..
22051 case "$cppstdin" in
22052 `pwd`/cppstdin)
22053         echo "Stripping down cppstdin path name"
22054         cppstdin=cppstdin
22055         ;;
22056 esac
22057 cd UU
22058
22059 : end of configuration questions
22060 echo " "
22061 echo "End of configuration questions."
22062 echo " "
22063
22064 : back to where it started
22065 if test -d ../UU; then
22066         cd ..
22067 fi
22068
22069 : configuration may be unconditionally patched via a 'config.arch' file
22070 if $test -f config.arch; then
22071         echo "I see a config.arch file, loading it." >&4
22072         . ./config.arch
22073 fi
22074
22075 : configuration may be patched via a 'config.over' file
22076 if $test -f config.over; then
22077         echo " "
22078         dflt=y
22079         rp='I see a config.over file.  Do you wish to load it?'
22080         . UU/myread
22081         case "$ans" in
22082         n*) echo "OK, I'll ignore it.";;
22083         *)      . ./config.over
22084                 echo "Configuration override changes have been loaded."
22085                 ;;
22086         esac
22087 fi
22088
22089 : in case they want portability, strip down executable paths
22090 case "$d_portable" in
22091 "$define")
22092         echo " "
22093         echo "Stripping down executable paths..." >&4
22094         for file in $loclist $trylist; do
22095                 eval temp=\$$file
22096                 eval $file=`basename $temp`
22097         done
22098         ;;
22099 esac
22100
22101 : create config.sh file
22102 echo " "
22103 echo "Creating config.sh..." >&4
22104 $spitshell <<EOT >config.sh
22105 $startsh
22106 #
22107 # This file was produced by running the Configure script. It holds all the
22108 # definitions figured out by Configure. Should you modify one of these values,
22109 # do not forget to propagate your changes by running "Configure -der". You may
22110 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22111 #
22112
22113 # Package name      : $package
22114 # Source directory  : $src
22115 # Configuration time: $cf_time
22116 # Configured by     : $cf_by
22117 # Target system     : $myuname
22118
22119 EOT
22120 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22121 $spitshell <<EOT >>config.sh
22122
22123 Author='$Author'
22124 Date='$Date'
22125 Header='$Header'
22126 Id='$Id'
22127 Locker='$Locker'
22128 Log='$Log'
22129 RCSfile='$RCSfile'
22130 Revision='$Revision'
22131 Source='$Source'
22132 State='$State'
22133 _a='$_a'
22134 _exe='$_exe'
22135 _o='$_o'
22136 afs='$afs'
22137 afsroot='$afsroot'
22138 alignbytes='$alignbytes'
22139 ansi2knr='$ansi2knr'
22140 aphostname='$aphostname'
22141 api_revision='$api_revision'
22142 api_subversion='$api_subversion'
22143 api_version='$api_version'
22144 api_versionstring='$api_versionstring'
22145 ar='$ar'
22146 archlib='$archlib'
22147 archlibexp='$archlibexp'
22148 archname64='$archname64'
22149 archname='$archname'
22150 archobjs='$archobjs'
22151 asctime_r_proto='$asctime_r_proto'
22152 awk='$awk'
22153 baserev='$baserev'
22154 bash='$bash'
22155 bin='$bin'
22156 binexp='$binexp'
22157 bison='$bison'
22158 byacc='$byacc'
22159 byteorder='$byteorder'
22160 c='$c'
22161 castflags='$castflags'
22162 cat='$cat'
22163 cc='$cc'
22164 cccdlflags='$cccdlflags'
22165 ccdlflags='$ccdlflags'
22166 ccflags='$ccflags'
22167 ccflags_uselargefiles='$ccflags_uselargefiles'
22168 ccname='$ccname'
22169 ccsymbols='$ccsymbols'
22170 ccversion='$ccversion'
22171 cf_by='$cf_by'
22172 cf_email='$cf_email'
22173 cf_time='$cf_time'
22174 chgrp='$chgrp'
22175 chmod='$chmod'
22176 chown='$chown'
22177 clocktype='$clocktype'
22178 comm='$comm'
22179 compress='$compress'
22180 contains='$contains'
22181 cp='$cp'
22182 cpio='$cpio'
22183 cpp='$cpp'
22184 cpp_stuff='$cpp_stuff'
22185 cppccsymbols='$cppccsymbols'
22186 cppflags='$cppflags'
22187 cpplast='$cpplast'
22188 cppminus='$cppminus'
22189 cpprun='$cpprun'
22190 cppstdin='$cppstdin'
22191 cppsymbols='$cppsymbols'
22192 crypt_r_proto='$crypt_r_proto'
22193 cryptlib='$cryptlib'
22194 csh='$csh'
22195 ctermid_r_proto='$ctermid_r_proto'
22196 ctime_r_proto='$ctime_r_proto'
22197 d_Gconvert='$d_Gconvert'
22198 d_PRIEUldbl='$d_PRIEUldbl'
22199 d_PRIFUldbl='$d_PRIFUldbl'
22200 d_PRIGUldbl='$d_PRIGUldbl'
22201 d_PRIXU64='$d_PRIXU64'
22202 d_PRId64='$d_PRId64'
22203 d_PRIeldbl='$d_PRIeldbl'
22204 d_PRIfldbl='$d_PRIfldbl'
22205 d_PRIgldbl='$d_PRIgldbl'
22206 d_PRIi64='$d_PRIi64'
22207 d_PRIo64='$d_PRIo64'
22208 d_PRIu64='$d_PRIu64'
22209 d_PRIx64='$d_PRIx64'
22210 d_SCNfldbl='$d_SCNfldbl'
22211 d__fwalk='$d__fwalk'
22212 d_access='$d_access'
22213 d_accessx='$d_accessx'
22214 d_aintl='$d_aintl'
22215 d_alarm='$d_alarm'
22216 d_archlib='$d_archlib'
22217 d_asctime64='$d_asctime64'
22218 d_asctime_r='$d_asctime_r'
22219 d_atolf='$d_atolf'
22220 d_atoll='$d_atoll'
22221 d_attribute_deprecated='$d_attribute_deprecated'
22222 d_attribute_format='$d_attribute_format'
22223 d_attribute_malloc='$d_attribute_malloc'
22224 d_attribute_nonnull='$d_attribute_nonnull'
22225 d_attribute_noreturn='$d_attribute_noreturn'
22226 d_attribute_pure='$d_attribute_pure'
22227 d_attribute_unused='$d_attribute_unused'
22228 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22229 d_bcmp='$d_bcmp'
22230 d_bcopy='$d_bcopy'
22231 d_bsd='$d_bsd'
22232 d_bsdgetpgrp='$d_bsdgetpgrp'
22233 d_bsdsetpgrp='$d_bsdsetpgrp'
22234 d_builtin_choose_expr='$d_builtin_choose_expr'
22235 d_builtin_expect='$d_builtin_expect'
22236 d_bzero='$d_bzero'
22237 d_c99_variadic_macros='$d_c99_variadic_macros'
22238 d_casti32='$d_casti32'
22239 d_castneg='$d_castneg'
22240 d_charvspr='$d_charvspr'
22241 d_chown='$d_chown'
22242 d_chroot='$d_chroot'
22243 d_chsize='$d_chsize'
22244 d_class='$d_class'
22245 d_clearenv='$d_clearenv'
22246 d_closedir='$d_closedir'
22247 d_cmsghdr_s='$d_cmsghdr_s'
22248 d_const='$d_const'
22249 d_copysignl='$d_copysignl'
22250 d_cplusplus='$d_cplusplus'
22251 d_crypt='$d_crypt'
22252 d_crypt_r='$d_crypt_r'
22253 d_csh='$d_csh'
22254 d_ctermid='$d_ctermid'
22255 d_ctermid_r='$d_ctermid_r'
22256 d_ctime64='$d_ctime64'
22257 d_ctime_r='$d_ctime_r'
22258 d_cuserid='$d_cuserid'
22259 d_dbl_dig='$d_dbl_dig'
22260 d_dbminitproto='$d_dbminitproto'
22261 d_difftime64='$d_difftime64'
22262 d_difftime='$d_difftime'
22263 d_dir_dd_fd='$d_dir_dd_fd'
22264 d_dirfd='$d_dirfd'
22265 d_dirnamlen='$d_dirnamlen'
22266 d_dlerror='$d_dlerror'
22267 d_dlopen='$d_dlopen'
22268 d_dlsymun='$d_dlsymun'
22269 d_dosuid='$d_dosuid'
22270 d_drand48_r='$d_drand48_r'
22271 d_drand48proto='$d_drand48proto'
22272 d_dup2='$d_dup2'
22273 d_eaccess='$d_eaccess'
22274 d_endgrent='$d_endgrent'
22275 d_endgrent_r='$d_endgrent_r'
22276 d_endhent='$d_endhent'
22277 d_endhostent_r='$d_endhostent_r'
22278 d_endnent='$d_endnent'
22279 d_endnetent_r='$d_endnetent_r'
22280 d_endpent='$d_endpent'
22281 d_endprotoent_r='$d_endprotoent_r'
22282 d_endpwent='$d_endpwent'
22283 d_endpwent_r='$d_endpwent_r'
22284 d_endsent='$d_endsent'
22285 d_endservent_r='$d_endservent_r'
22286 d_eofnblk='$d_eofnblk'
22287 d_eunice='$d_eunice'
22288 d_faststdio='$d_faststdio'
22289 d_fchdir='$d_fchdir'
22290 d_fchmod='$d_fchmod'
22291 d_fchown='$d_fchown'
22292 d_fcntl='$d_fcntl'
22293 d_fcntl_can_lock='$d_fcntl_can_lock'
22294 d_fd_macros='$d_fd_macros'
22295 d_fd_set='$d_fd_set'
22296 d_fds_bits='$d_fds_bits'
22297 d_fgetpos='$d_fgetpos'
22298 d_finite='$d_finite'
22299 d_finitel='$d_finitel'
22300 d_flexfnam='$d_flexfnam'
22301 d_flock='$d_flock'
22302 d_flockproto='$d_flockproto'
22303 d_fork='$d_fork'
22304 d_fp_class='$d_fp_class'
22305 d_fpathconf='$d_fpathconf'
22306 d_fpclass='$d_fpclass'
22307 d_fpclassify='$d_fpclassify'
22308 d_fpclassl='$d_fpclassl'
22309 d_fpos64_t='$d_fpos64_t'
22310 d_frexpl='$d_frexpl'
22311 d_fs_data_s='$d_fs_data_s'
22312 d_fseeko='$d_fseeko'
22313 d_fsetpos='$d_fsetpos'
22314 d_fstatfs='$d_fstatfs'
22315 d_fstatvfs='$d_fstatvfs'
22316 d_fsync='$d_fsync'
22317 d_ftello='$d_ftello'
22318 d_ftime='$d_ftime'
22319 d_futimes='$d_futimes'
22320 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22321 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22322 d_getaddrinfo='$d_getaddrinfo'
22323 d_getcwd='$d_getcwd'
22324 d_getespwnam='$d_getespwnam'
22325 d_getfsstat='$d_getfsstat'
22326 d_getgrent='$d_getgrent'
22327 d_getgrent_r='$d_getgrent_r'
22328 d_getgrgid_r='$d_getgrgid_r'
22329 d_getgrnam_r='$d_getgrnam_r'
22330 d_getgrps='$d_getgrps'
22331 d_gethbyaddr='$d_gethbyaddr'
22332 d_gethbyname='$d_gethbyname'
22333 d_gethent='$d_gethent'
22334 d_gethname='$d_gethname'
22335 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22336 d_gethostbyname_r='$d_gethostbyname_r'
22337 d_gethostent_r='$d_gethostent_r'
22338 d_gethostprotos='$d_gethostprotos'
22339 d_getitimer='$d_getitimer'
22340 d_getlogin='$d_getlogin'
22341 d_getlogin_r='$d_getlogin_r'
22342 d_getmnt='$d_getmnt'
22343 d_getmntent='$d_getmntent'
22344 d_getnameinfo='$d_getnameinfo'
22345 d_getnbyaddr='$d_getnbyaddr'
22346 d_getnbyname='$d_getnbyname'
22347 d_getnent='$d_getnent'
22348 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22349 d_getnetbyname_r='$d_getnetbyname_r'
22350 d_getnetent_r='$d_getnetent_r'
22351 d_getnetprotos='$d_getnetprotos'
22352 d_getpagsz='$d_getpagsz'
22353 d_getpbyname='$d_getpbyname'
22354 d_getpbynumber='$d_getpbynumber'
22355 d_getpent='$d_getpent'
22356 d_getpgid='$d_getpgid'
22357 d_getpgrp2='$d_getpgrp2'
22358 d_getpgrp='$d_getpgrp'
22359 d_getppid='$d_getppid'
22360 d_getprior='$d_getprior'
22361 d_getprotobyname_r='$d_getprotobyname_r'
22362 d_getprotobynumber_r='$d_getprotobynumber_r'
22363 d_getprotoent_r='$d_getprotoent_r'
22364 d_getprotoprotos='$d_getprotoprotos'
22365 d_getprpwnam='$d_getprpwnam'
22366 d_getpwent='$d_getpwent'
22367 d_getpwent_r='$d_getpwent_r'
22368 d_getpwnam_r='$d_getpwnam_r'
22369 d_getpwuid_r='$d_getpwuid_r'
22370 d_getsbyname='$d_getsbyname'
22371 d_getsbyport='$d_getsbyport'
22372 d_getsent='$d_getsent'
22373 d_getservbyname_r='$d_getservbyname_r'
22374 d_getservbyport_r='$d_getservbyport_r'
22375 d_getservent_r='$d_getservent_r'
22376 d_getservprotos='$d_getservprotos'
22377 d_getspnam='$d_getspnam'
22378 d_getspnam_r='$d_getspnam_r'
22379 d_gettimeod='$d_gettimeod'
22380 d_gmtime64='$d_gmtime64'
22381 d_gmtime_r='$d_gmtime_r'
22382 d_gnulibc='$d_gnulibc'
22383 d_grpasswd='$d_grpasswd'
22384 d_hasmntopt='$d_hasmntopt'
22385 d_htonl='$d_htonl'
22386 d_ilogbl='$d_ilogbl'
22387 d_inc_version_list='$d_inc_version_list'
22388 d_index='$d_index'
22389 d_inetaton='$d_inetaton'
22390 d_inetntop='$d_inetntop'
22391 d_inetpton='$d_inetpton'
22392 d_int64_t='$d_int64_t'
22393 d_isascii='$d_isascii'
22394 d_isfinite='$d_isfinite'
22395 d_isinf='$d_isinf'
22396 d_isnan='$d_isnan'
22397 d_isnanl='$d_isnanl'
22398 d_killpg='$d_killpg'
22399 d_lchown='$d_lchown'
22400 d_ldbl_dig='$d_ldbl_dig'
22401 d_libm_lib_version='$d_libm_lib_version'
22402 d_link='$d_link'
22403 d_localtime64='$d_localtime64'
22404 d_localtime_r='$d_localtime_r'
22405 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22406 d_locconv='$d_locconv'
22407 d_lockf='$d_lockf'
22408 d_longdbl='$d_longdbl'
22409 d_longlong='$d_longlong'
22410 d_lseekproto='$d_lseekproto'
22411 d_lstat='$d_lstat'
22412 d_madvise='$d_madvise'
22413 d_malloc_good_size='$d_malloc_good_size'
22414 d_malloc_size='$d_malloc_size'
22415 d_mblen='$d_mblen'
22416 d_mbstowcs='$d_mbstowcs'
22417 d_mbtowc='$d_mbtowc'
22418 d_memchr='$d_memchr'
22419 d_memcmp='$d_memcmp'
22420 d_memcpy='$d_memcpy'
22421 d_memmove='$d_memmove'
22422 d_memset='$d_memset'
22423 d_mkdir='$d_mkdir'
22424 d_mkdtemp='$d_mkdtemp'
22425 d_mkfifo='$d_mkfifo'
22426 d_mkstemp='$d_mkstemp'
22427 d_mkstemps='$d_mkstemps'
22428 d_mktime64='$d_mktime64'
22429 d_mktime='$d_mktime'
22430 d_mmap='$d_mmap'
22431 d_modfl='$d_modfl'
22432 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22433 d_modflproto='$d_modflproto'
22434 d_mprotect='$d_mprotect'
22435 d_msg='$d_msg'
22436 d_msg_ctrunc='$d_msg_ctrunc'
22437 d_msg_dontroute='$d_msg_dontroute'
22438 d_msg_oob='$d_msg_oob'
22439 d_msg_peek='$d_msg_peek'
22440 d_msg_proxy='$d_msg_proxy'
22441 d_msgctl='$d_msgctl'
22442 d_msgget='$d_msgget'
22443 d_msghdr_s='$d_msghdr_s'
22444 d_msgrcv='$d_msgrcv'
22445 d_msgsnd='$d_msgsnd'
22446 d_msync='$d_msync'
22447 d_munmap='$d_munmap'
22448 d_mymalloc='$d_mymalloc'
22449 d_ndbm='$d_ndbm'
22450 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22451 d_nice='$d_nice'
22452 d_nl_langinfo='$d_nl_langinfo'
22453 d_nv_preserves_uv='$d_nv_preserves_uv'
22454 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22455 d_off64_t='$d_off64_t'
22456 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22457 d_oldpthreads='$d_oldpthreads'
22458 d_oldsock='$d_oldsock'
22459 d_open3='$d_open3'
22460 d_pathconf='$d_pathconf'
22461 d_pause='$d_pause'
22462 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22463 d_phostname='$d_phostname'
22464 d_pipe='$d_pipe'
22465 d_poll='$d_poll'
22466 d_portable='$d_portable'
22467 d_printf_format_null='$d_printf_format_null'
22468 d_procselfexe='$d_procselfexe'
22469 d_pseudofork='$d_pseudofork'
22470 d_pthread_atfork='$d_pthread_atfork'
22471 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22472 d_pthread_yield='$d_pthread_yield'
22473 d_pwage='$d_pwage'
22474 d_pwchange='$d_pwchange'
22475 d_pwclass='$d_pwclass'
22476 d_pwcomment='$d_pwcomment'
22477 d_pwexpire='$d_pwexpire'
22478 d_pwgecos='$d_pwgecos'
22479 d_pwpasswd='$d_pwpasswd'
22480 d_pwquota='$d_pwquota'
22481 d_qgcvt='$d_qgcvt'
22482 d_quad='$d_quad'
22483 d_random_r='$d_random_r'
22484 d_readdir64_r='$d_readdir64_r'
22485 d_readdir='$d_readdir'
22486 d_readdir_r='$d_readdir_r'
22487 d_readlink='$d_readlink'
22488 d_readv='$d_readv'
22489 d_recvmsg='$d_recvmsg'
22490 d_rename='$d_rename'
22491 d_rewinddir='$d_rewinddir'
22492 d_rmdir='$d_rmdir'
22493 d_safebcpy='$d_safebcpy'
22494 d_safemcpy='$d_safemcpy'
22495 d_sanemcmp='$d_sanemcmp'
22496 d_sbrkproto='$d_sbrkproto'
22497 d_scalbnl='$d_scalbnl'
22498 d_sched_yield='$d_sched_yield'
22499 d_scm_rights='$d_scm_rights'
22500 d_seekdir='$d_seekdir'
22501 d_select='$d_select'
22502 d_sem='$d_sem'
22503 d_semctl='$d_semctl'
22504 d_semctl_semid_ds='$d_semctl_semid_ds'
22505 d_semctl_semun='$d_semctl_semun'
22506 d_semget='$d_semget'
22507 d_semop='$d_semop'
22508 d_sendmsg='$d_sendmsg'
22509 d_setegid='$d_setegid'
22510 d_seteuid='$d_seteuid'
22511 d_setgrent='$d_setgrent'
22512 d_setgrent_r='$d_setgrent_r'
22513 d_setgrps='$d_setgrps'
22514 d_sethent='$d_sethent'
22515 d_sethostent_r='$d_sethostent_r'
22516 d_setitimer='$d_setitimer'
22517 d_setlinebuf='$d_setlinebuf'
22518 d_setlocale='$d_setlocale'
22519 d_setlocale_r='$d_setlocale_r'
22520 d_setnent='$d_setnent'
22521 d_setnetent_r='$d_setnetent_r'
22522 d_setpent='$d_setpent'
22523 d_setpgid='$d_setpgid'
22524 d_setpgrp2='$d_setpgrp2'
22525 d_setpgrp='$d_setpgrp'
22526 d_setprior='$d_setprior'
22527 d_setproctitle='$d_setproctitle'
22528 d_setprotoent_r='$d_setprotoent_r'
22529 d_setpwent='$d_setpwent'
22530 d_setpwent_r='$d_setpwent_r'
22531 d_setregid='$d_setregid'
22532 d_setresgid='$d_setresgid'
22533 d_setresuid='$d_setresuid'
22534 d_setreuid='$d_setreuid'
22535 d_setrgid='$d_setrgid'
22536 d_setruid='$d_setruid'
22537 d_setsent='$d_setsent'
22538 d_setservent_r='$d_setservent_r'
22539 d_setsid='$d_setsid'
22540 d_setvbuf='$d_setvbuf'
22541 d_sfio='$d_sfio'
22542 d_shm='$d_shm'
22543 d_shmat='$d_shmat'
22544 d_shmatprototype='$d_shmatprototype'
22545 d_shmctl='$d_shmctl'
22546 d_shmdt='$d_shmdt'
22547 d_shmget='$d_shmget'
22548 d_sigaction='$d_sigaction'
22549 d_signbit='$d_signbit'
22550 d_sigprocmask='$d_sigprocmask'
22551 d_sigsetjmp='$d_sigsetjmp'
22552 d_sitearch='$d_sitearch'
22553 d_snprintf='$d_snprintf'
22554 d_sockatmark='$d_sockatmark'
22555 d_sockatmarkproto='$d_sockatmarkproto'
22556 d_socket='$d_socket'
22557 d_socklen_t='$d_socklen_t'
22558 d_sockpair='$d_sockpair'
22559 d_socks5_init='$d_socks5_init'
22560 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22561 d_sqrtl='$d_sqrtl'
22562 d_srand48_r='$d_srand48_r'
22563 d_srandom_r='$d_srandom_r'
22564 d_sresgproto='$d_sresgproto'
22565 d_sresuproto='$d_sresuproto'
22566 d_statblks='$d_statblks'
22567 d_statfs_f_flags='$d_statfs_f_flags'
22568 d_statfs_s='$d_statfs_s'
22569 d_statvfs='$d_statvfs'
22570 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22571 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22572 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22573 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22574 d_stdio_stream_array='$d_stdio_stream_array'
22575 d_stdiobase='$d_stdiobase'
22576 d_stdstdio='$d_stdstdio'
22577 d_strchr='$d_strchr'
22578 d_strcoll='$d_strcoll'
22579 d_strctcpy='$d_strctcpy'
22580 d_strerrm='$d_strerrm'
22581 d_strerror='$d_strerror'
22582 d_strerror_r='$d_strerror_r'
22583 d_strftime='$d_strftime'
22584 d_strlcat='$d_strlcat'
22585 d_strlcpy='$d_strlcpy'
22586 d_strtod='$d_strtod'
22587 d_strtol='$d_strtol'
22588 d_strtold='$d_strtold'
22589 d_strtoll='$d_strtoll'
22590 d_strtoq='$d_strtoq'
22591 d_strtoul='$d_strtoul'
22592 d_strtoull='$d_strtoull'
22593 d_strtouq='$d_strtouq'
22594 d_strxfrm='$d_strxfrm'
22595 d_suidsafe='$d_suidsafe'
22596 d_symlink='$d_symlink'
22597 d_syscall='$d_syscall'
22598 d_syscallproto='$d_syscallproto'
22599 d_sysconf='$d_sysconf'
22600 d_sysernlst='$d_sysernlst'
22601 d_syserrlst='$d_syserrlst'
22602 d_system='$d_system'
22603 d_tcgetpgrp='$d_tcgetpgrp'
22604 d_tcsetpgrp='$d_tcsetpgrp'
22605 d_telldir='$d_telldir'
22606 d_telldirproto='$d_telldirproto'
22607 d_time='$d_time'
22608 d_timegm='$d_timegm'
22609 d_times='$d_times'
22610 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22611 d_tm_tm_zone='$d_tm_tm_zone'
22612 d_tmpnam_r='$d_tmpnam_r'
22613 d_truncate='$d_truncate'
22614 d_ttyname_r='$d_ttyname_r'
22615 d_tzname='$d_tzname'
22616 d_u32align='$d_u32align'
22617 d_ualarm='$d_ualarm'
22618 d_umask='$d_umask'
22619 d_uname='$d_uname'
22620 d_union_semun='$d_union_semun'
22621 d_unordered='$d_unordered'
22622 d_unsetenv='$d_unsetenv'
22623 d_usleep='$d_usleep'
22624 d_usleepproto='$d_usleepproto'
22625 d_ustat='$d_ustat'
22626 d_vendorarch='$d_vendorarch'
22627 d_vendorbin='$d_vendorbin'
22628 d_vendorlib='$d_vendorlib'
22629 d_vendorscript='$d_vendorscript'
22630 d_vfork='$d_vfork'
22631 d_void_closedir='$d_void_closedir'
22632 d_voidsig='$d_voidsig'
22633 d_voidtty='$d_voidtty'
22634 d_volatile='$d_volatile'
22635 d_vprintf='$d_vprintf'
22636 d_vsnprintf='$d_vsnprintf'
22637 d_wait4='$d_wait4'
22638 d_waitpid='$d_waitpid'
22639 d_wcstombs='$d_wcstombs'
22640 d_wctomb='$d_wctomb'
22641 d_writev='$d_writev'
22642 d_xenix='$d_xenix'
22643 date='$date'
22644 db_hashtype='$db_hashtype'
22645 db_prefixtype='$db_prefixtype'
22646 db_version_major='$db_version_major'
22647 db_version_minor='$db_version_minor'
22648 db_version_patch='$db_version_patch'
22649 defvoidused='$defvoidused'
22650 direntrytype='$direntrytype'
22651 dlext='$dlext'
22652 dlsrc='$dlsrc'
22653 doublesize='$doublesize'
22654 drand01='$drand01'
22655 drand48_r_proto='$drand48_r_proto'
22656 dtrace='$dtrace'
22657 dynamic_ext='$dynamic_ext'
22658 eagain='$eagain'
22659 ebcdic='$ebcdic'
22660 echo='$echo'
22661 egrep='$egrep'
22662 emacs='$emacs'
22663 endgrent_r_proto='$endgrent_r_proto'
22664 endhostent_r_proto='$endhostent_r_proto'
22665 endnetent_r_proto='$endnetent_r_proto'
22666 endprotoent_r_proto='$endprotoent_r_proto'
22667 endpwent_r_proto='$endpwent_r_proto'
22668 endservent_r_proto='$endservent_r_proto'
22669 eunicefix='$eunicefix'
22670 exe_ext='$exe_ext'
22671 expr='$expr'
22672 extensions='$extensions'
22673 extern_C='$extern_C'
22674 extras='$extras'
22675 fflushNULL='$fflushNULL'
22676 fflushall='$fflushall'
22677 find='$find'
22678 firstmakefile='$firstmakefile'
22679 flex='$flex'
22680 fpossize='$fpossize'
22681 fpostype='$fpostype'
22682 freetype='$freetype'
22683 from='$from'
22684 full_ar='$full_ar'
22685 full_csh='$full_csh'
22686 full_sed='$full_sed'
22687 gccansipedantic='$gccansipedantic'
22688 gccosandvers='$gccosandvers'
22689 gccversion='$gccversion'
22690 getgrent_r_proto='$getgrent_r_proto'
22691 getgrgid_r_proto='$getgrgid_r_proto'
22692 getgrnam_r_proto='$getgrnam_r_proto'
22693 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22694 gethostbyname_r_proto='$gethostbyname_r_proto'
22695 gethostent_r_proto='$gethostent_r_proto'
22696 getlogin_r_proto='$getlogin_r_proto'
22697 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22698 getnetbyname_r_proto='$getnetbyname_r_proto'
22699 getnetent_r_proto='$getnetent_r_proto'
22700 getprotobyname_r_proto='$getprotobyname_r_proto'
22701 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22702 getprotoent_r_proto='$getprotoent_r_proto'
22703 getpwent_r_proto='$getpwent_r_proto'
22704 getpwnam_r_proto='$getpwnam_r_proto'
22705 getpwuid_r_proto='$getpwuid_r_proto'
22706 getservbyname_r_proto='$getservbyname_r_proto'
22707 getservbyport_r_proto='$getservbyport_r_proto'
22708 getservent_r_proto='$getservent_r_proto'
22709 getspnam_r_proto='$getspnam_r_proto'
22710 gidformat='$gidformat'
22711 gidsign='$gidsign'
22712 gidsize='$gidsize'
22713 gidtype='$gidtype'
22714 glibpth='$glibpth'
22715 gmake='$gmake'
22716 gmtime_r_proto='$gmtime_r_proto'
22717 gnulibc_version='$gnulibc_version'
22718 grep='$grep'
22719 groupcat='$groupcat'
22720 groupstype='$groupstype'
22721 gzip='$gzip'
22722 h_fcntl='$h_fcntl'
22723 h_sysfile='$h_sysfile'
22724 hint='$hint'
22725 hostcat='$hostcat'
22726 html1dir='$html1dir'
22727 html1direxp='$html1direxp'
22728 html3dir='$html3dir'
22729 html3direxp='$html3direxp'
22730 i16size='$i16size'
22731 i16type='$i16type'
22732 i32size='$i32size'
22733 i32type='$i32type'
22734 i64size='$i64size'
22735 i64type='$i64type'
22736 i8size='$i8size'
22737 i8type='$i8type'
22738 i_arpainet='$i_arpainet'
22739 i_assert='$i_assert'
22740 i_bsdioctl='$i_bsdioctl'
22741 i_crypt='$i_crypt'
22742 i_db='$i_db'
22743 i_dbm='$i_dbm'
22744 i_dirent='$i_dirent'
22745 i_dld='$i_dld'
22746 i_dlfcn='$i_dlfcn'
22747 i_fcntl='$i_fcntl'
22748 i_float='$i_float'
22749 i_fp='$i_fp'
22750 i_fp_class='$i_fp_class'
22751 i_gdbm='$i_gdbm'
22752 i_gdbm_ndbm='$i_gdbm_ndbm'
22753 i_gdbmndbm='$i_gdbmndbm'
22754 i_grp='$i_grp'
22755 i_ieeefp='$i_ieeefp'
22756 i_inttypes='$i_inttypes'
22757 i_langinfo='$i_langinfo'
22758 i_libutil='$i_libutil'
22759 i_limits='$i_limits'
22760 i_locale='$i_locale'
22761 i_machcthr='$i_machcthr'
22762 i_malloc='$i_malloc'
22763 i_mallocmalloc='$i_mallocmalloc'
22764 i_math='$i_math'
22765 i_memory='$i_memory'
22766 i_mntent='$i_mntent'
22767 i_ndbm='$i_ndbm'
22768 i_netdb='$i_netdb'
22769 i_neterrno='$i_neterrno'
22770 i_netinettcp='$i_netinettcp'
22771 i_niin='$i_niin'
22772 i_poll='$i_poll'
22773 i_prot='$i_prot'
22774 i_pthread='$i_pthread'
22775 i_pwd='$i_pwd'
22776 i_rpcsvcdbm='$i_rpcsvcdbm'
22777 i_sfio='$i_sfio'
22778 i_sgtty='$i_sgtty'
22779 i_shadow='$i_shadow'
22780 i_socks='$i_socks'
22781 i_stdarg='$i_stdarg'
22782 i_stddef='$i_stddef'
22783 i_stdlib='$i_stdlib'
22784 i_string='$i_string'
22785 i_sunmath='$i_sunmath'
22786 i_sysaccess='$i_sysaccess'
22787 i_sysdir='$i_sysdir'
22788 i_sysfile='$i_sysfile'
22789 i_sysfilio='$i_sysfilio'
22790 i_sysin='$i_sysin'
22791 i_sysioctl='$i_sysioctl'
22792 i_syslog='$i_syslog'
22793 i_sysmman='$i_sysmman'
22794 i_sysmode='$i_sysmode'
22795 i_sysmount='$i_sysmount'
22796 i_sysndir='$i_sysndir'
22797 i_sysparam='$i_sysparam'
22798 i_syspoll='$i_syspoll'
22799 i_sysresrc='$i_sysresrc'
22800 i_syssecrt='$i_syssecrt'
22801 i_sysselct='$i_sysselct'
22802 i_syssockio='$i_syssockio'
22803 i_sysstat='$i_sysstat'
22804 i_sysstatfs='$i_sysstatfs'
22805 i_sysstatvfs='$i_sysstatvfs'
22806 i_systime='$i_systime'
22807 i_systimek='$i_systimek'
22808 i_systimes='$i_systimes'
22809 i_systypes='$i_systypes'
22810 i_sysuio='$i_sysuio'
22811 i_sysun='$i_sysun'
22812 i_sysutsname='$i_sysutsname'
22813 i_sysvfs='$i_sysvfs'
22814 i_syswait='$i_syswait'
22815 i_termio='$i_termio'
22816 i_termios='$i_termios'
22817 i_time='$i_time'
22818 i_unistd='$i_unistd'
22819 i_ustat='$i_ustat'
22820 i_utime='$i_utime'
22821 i_values='$i_values'
22822 i_varargs='$i_varargs'
22823 i_varhdr='$i_varhdr'
22824 i_vfork='$i_vfork'
22825 ignore_versioned_solibs='$ignore_versioned_solibs'
22826 inc_version_list='$inc_version_list'
22827 inc_version_list_init='$inc_version_list_init'
22828 incpath='$incpath'
22829 inews='$inews'
22830 initialinstalllocation='$initialinstalllocation'
22831 installarchlib='$installarchlib'
22832 installbin='$installbin'
22833 installhtml1dir='$installhtml1dir'
22834 installhtml3dir='$installhtml3dir'
22835 installman1dir='$installman1dir'
22836 installman3dir='$installman3dir'
22837 installprefix='$installprefix'
22838 installprefixexp='$installprefixexp'
22839 installprivlib='$installprivlib'
22840 installscript='$installscript'
22841 installsitearch='$installsitearch'
22842 installsitebin='$installsitebin'
22843 installsitehtml1dir='$installsitehtml1dir'
22844 installsitehtml3dir='$installsitehtml3dir'
22845 installsitelib='$installsitelib'
22846 installsiteman1dir='$installsiteman1dir'
22847 installsiteman3dir='$installsiteman3dir'
22848 installsitescript='$installsitescript'
22849 installstyle='$installstyle'
22850 installusrbinperl='$installusrbinperl'
22851 installvendorarch='$installvendorarch'
22852 installvendorbin='$installvendorbin'
22853 installvendorhtml1dir='$installvendorhtml1dir'
22854 installvendorhtml3dir='$installvendorhtml3dir'
22855 installvendorlib='$installvendorlib'
22856 installvendorman1dir='$installvendorman1dir'
22857 installvendorman3dir='$installvendorman3dir'
22858 installvendorscript='$installvendorscript'
22859 intsize='$intsize'
22860 issymlink='$issymlink'
22861 ivdformat='$ivdformat'
22862 ivsize='$ivsize'
22863 ivtype='$ivtype'
22864 known_extensions='$known_extensions'
22865 ksh='$ksh'
22866 ld='$ld'
22867 lddlflags='$lddlflags'
22868 ldflags='$ldflags'
22869 ldflags_uselargefiles='$ldflags_uselargefiles'
22870 ldlibpthname='$ldlibpthname'
22871 less='$less'
22872 lib_ext='$lib_ext'
22873 libc='$libc'
22874 libperl='$libperl'
22875 libpth='$libpth'
22876 libs='$libs'
22877 libsdirs='$libsdirs'
22878 libsfiles='$libsfiles'
22879 libsfound='$libsfound'
22880 libspath='$libspath'
22881 libswanted='$libswanted'
22882 libswanted_uselargefiles='$libswanted_uselargefiles'
22883 line='$line'
22884 lint='$lint'
22885 lkflags='$lkflags'
22886 ln='$ln'
22887 lns='$lns'
22888 localtime_r_proto='$localtime_r_proto'
22889 locincpth='$locincpth'
22890 loclibpth='$loclibpth'
22891 longdblsize='$longdblsize'
22892 longlongsize='$longlongsize'
22893 longsize='$longsize'
22894 lp='$lp'
22895 lpr='$lpr'
22896 ls='$ls'
22897 lseeksize='$lseeksize'
22898 lseektype='$lseektype'
22899 mad='$mad'
22900 madlyh='$madlyh'
22901 madlyobj='$madlyobj'
22902 madlysrc='$madlysrc'
22903 mail='$mail'
22904 mailx='$mailx'
22905 make='$make'
22906 make_set_make='$make_set_make'
22907 mallocobj='$mallocobj'
22908 mallocsrc='$mallocsrc'
22909 malloctype='$malloctype'
22910 man1dir='$man1dir'
22911 man1direxp='$man1direxp'
22912 man1ext='$man1ext'
22913 man3dir='$man3dir'
22914 man3direxp='$man3direxp'
22915 man3ext='$man3ext'
22916 mips_type='$mips_type'
22917 mistrustnm='$mistrustnm'
22918 mkdir='$mkdir'
22919 mmaptype='$mmaptype'
22920 modetype='$modetype'
22921 more='$more'
22922 multiarch='$multiarch'
22923 mv='$mv'
22924 myarchname='$myarchname'
22925 mydomain='$mydomain'
22926 myhostname='$myhostname'
22927 myuname='$myuname'
22928 n='$n'
22929 need_va_copy='$need_va_copy'
22930 netdb_hlen_type='$netdb_hlen_type'
22931 netdb_host_type='$netdb_host_type'
22932 netdb_name_type='$netdb_name_type'
22933 netdb_net_type='$netdb_net_type'
22934 nm='$nm'
22935 nm_opt='$nm_opt'
22936 nm_so_opt='$nm_so_opt'
22937 nonxs_ext='$nonxs_ext'
22938 nroff='$nroff'
22939 nvEUformat='$nvEUformat'
22940 nvFUformat='$nvFUformat'
22941 nvGUformat='$nvGUformat'
22942 nv_overflows_integers_at='$nv_overflows_integers_at'
22943 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22944 nveformat='$nveformat'
22945 nvfformat='$nvfformat'
22946 nvgformat='$nvgformat'
22947 nvsize='$nvsize'
22948 nvtype='$nvtype'
22949 o_nonblock='$o_nonblock'
22950 obj_ext='$obj_ext'
22951 old_pthread_create_joinable='$old_pthread_create_joinable'
22952 optimize='$optimize'
22953 orderlib='$orderlib'
22954 osname='$osname'
22955 osvers='$osvers'
22956 otherlibdirs='$otherlibdirs'
22957 package='$package'
22958 pager='$pager'
22959 passcat='$passcat'
22960 patchlevel='$patchlevel'
22961 path_sep='$path_sep'
22962 perl5='$perl5'
22963 perl='$perl'
22964 perl_patchlevel='$perl_patchlevel'
22965 perladmin='$perladmin'
22966 perllibs='$perllibs'
22967 perlpath='$perlpath'
22968 pg='$pg'
22969 phostname='$phostname'
22970 pidtype='$pidtype'
22971 plibpth='$plibpth'
22972 pmake='$pmake'
22973 pr='$pr'
22974 prefix='$prefix'
22975 prefixexp='$prefixexp'
22976 privlib='$privlib'
22977 privlibexp='$privlibexp'
22978 procselfexe='$procselfexe'
22979 prototype='$prototype'
22980 ptrsize='$ptrsize'
22981 quadkind='$quadkind'
22982 quadtype='$quadtype'
22983 randbits='$randbits'
22984 randfunc='$randfunc'
22985 random_r_proto='$random_r_proto'
22986 randseedtype='$randseedtype'
22987 ranlib='$ranlib'
22988 rd_nodata='$rd_nodata'
22989 readdir64_r_proto='$readdir64_r_proto'
22990 readdir_r_proto='$readdir_r_proto'
22991 revision='$revision'
22992 rm='$rm'
22993 rm_try='$rm_try'
22994 rmail='$rmail'
22995 run='$run'
22996 runnm='$runnm'
22997 sGMTIME_max='$sGMTIME_max'
22998 sGMTIME_min='$sGMTIME_min'
22999 sLOCALTIME_max='$sLOCALTIME_max'
23000 sLOCALTIME_min='$sLOCALTIME_min'
23001 sPRIEUldbl='$sPRIEUldbl'
23002 sPRIFUldbl='$sPRIFUldbl'
23003 sPRIGUldbl='$sPRIGUldbl'
23004 sPRIXU64='$sPRIXU64'
23005 sPRId64='$sPRId64'
23006 sPRIeldbl='$sPRIeldbl'
23007 sPRIfldbl='$sPRIfldbl'
23008 sPRIgldbl='$sPRIgldbl'
23009 sPRIi64='$sPRIi64'
23010 sPRIo64='$sPRIo64'
23011 sPRIu64='$sPRIu64'
23012 sPRIx64='$sPRIx64'
23013 sSCNfldbl='$sSCNfldbl'
23014 sched_yield='$sched_yield'
23015 scriptdir='$scriptdir'
23016 scriptdirexp='$scriptdirexp'
23017 sed='$sed'
23018 seedfunc='$seedfunc'
23019 selectminbits='$selectminbits'
23020 selecttype='$selecttype'
23021 sendmail='$sendmail'
23022 setgrent_r_proto='$setgrent_r_proto'
23023 sethostent_r_proto='$sethostent_r_proto'
23024 setlocale_r_proto='$setlocale_r_proto'
23025 setnetent_r_proto='$setnetent_r_proto'
23026 setprotoent_r_proto='$setprotoent_r_proto'
23027 setpwent_r_proto='$setpwent_r_proto'
23028 setservent_r_proto='$setservent_r_proto'
23029 sh='$sh'
23030 shar='$shar'
23031 sharpbang='$sharpbang'
23032 shmattype='$shmattype'
23033 shortsize='$shortsize'
23034 shrpenv='$shrpenv'
23035 shsharp='$shsharp'
23036 sig_count='$sig_count'
23037 sig_name='$sig_name'
23038 sig_name_init='$sig_name_init'
23039 sig_num='$sig_num'
23040 sig_num_init='$sig_num_init'
23041 sig_size='$sig_size'
23042 signal_t='$signal_t'
23043 sitearch='$sitearch'
23044 sitearchexp='$sitearchexp'
23045 sitebin='$sitebin'
23046 sitebinexp='$sitebinexp'
23047 sitehtml1dir='$sitehtml1dir'
23048 sitehtml1direxp='$sitehtml1direxp'
23049 sitehtml3dir='$sitehtml3dir'
23050 sitehtml3direxp='$sitehtml3direxp'
23051 sitelib='$sitelib'
23052 sitelib_stem='$sitelib_stem'
23053 sitelibexp='$sitelibexp'
23054 siteman1dir='$siteman1dir'
23055 siteman1direxp='$siteman1direxp'
23056 siteman3dir='$siteman3dir'
23057 siteman3direxp='$siteman3direxp'
23058 siteprefix='$siteprefix'
23059 siteprefixexp='$siteprefixexp'
23060 sitescript='$sitescript'
23061 sitescriptexp='$sitescriptexp'
23062 sizesize='$sizesize'
23063 sizetype='$sizetype'
23064 sleep='$sleep'
23065 smail='$smail'
23066 so='$so'
23067 sockethdr='$sockethdr'
23068 socketlib='$socketlib'
23069 socksizetype='$socksizetype'
23070 sort='$sort'
23071 spackage='$spackage'
23072 spitshell='$spitshell'
23073 srand48_r_proto='$srand48_r_proto'
23074 srandom_r_proto='$srandom_r_proto'
23075 src='$src'
23076 ssizetype='$ssizetype'
23077 startperl='$startperl'
23078 startsh='$startsh'
23079 static_ext='$static_ext'
23080 stdchar='$stdchar'
23081 stdio_base='$stdio_base'
23082 stdio_bufsiz='$stdio_bufsiz'
23083 stdio_cnt='$stdio_cnt'
23084 stdio_filbuf='$stdio_filbuf'
23085 stdio_ptr='$stdio_ptr'
23086 stdio_stream_array='$stdio_stream_array'
23087 strerror_r_proto='$strerror_r_proto'
23088 strings='$strings'
23089 submit='$submit'
23090 subversion='$subversion'
23091 sysman='$sysman'
23092 tail='$tail'
23093 tar='$tar'
23094 targetarch='$targetarch'
23095 tbl='$tbl'
23096 tee='$tee'
23097 test='$test'
23098 timeincl='$timeincl'
23099 timetype='$timetype'
23100 tmpnam_r_proto='$tmpnam_r_proto'
23101 to='$to'
23102 touch='$touch'
23103 tr='$tr'
23104 trnl='$trnl'
23105 troff='$troff'
23106 ttyname_r_proto='$ttyname_r_proto'
23107 u16size='$u16size'
23108 u16type='$u16type'
23109 u32size='$u32size'
23110 u32type='$u32type'
23111 u64size='$u64size'
23112 u64type='$u64type'
23113 u8size='$u8size'
23114 u8type='$u8type'
23115 uidformat='$uidformat'
23116 uidsign='$uidsign'
23117 uidsize='$uidsize'
23118 uidtype='$uidtype'
23119 uname='$uname'
23120 uniq='$uniq'
23121 uquadtype='$uquadtype'
23122 use5005threads='$use5005threads'
23123 use64bitall='$use64bitall'
23124 use64bitint='$use64bitint'
23125 usecrosscompile='$usecrosscompile'
23126 usedevel='$usedevel'
23127 usedl='$usedl'
23128 usedtrace='$usedtrace'
23129 usefaststdio='$usefaststdio'
23130 useithreads='$useithreads'
23131 uselargefiles='$uselargefiles'
23132 uselongdouble='$uselongdouble'
23133 usemallocwrap='$usemallocwrap'
23134 usemorebits='$usemorebits'
23135 usemultiplicity='$usemultiplicity'
23136 usemymalloc='$usemymalloc'
23137 usenm='$usenm'
23138 useopcode='$useopcode'
23139 useperlio='$useperlio'
23140 useposix='$useposix'
23141 usereentrant='$usereentrant'
23142 userelocatableinc='$userelocatableinc'
23143 usesfio='$usesfio'
23144 useshrplib='$useshrplib'
23145 usesitecustomize='$usesitecustomize'
23146 usesocks='$usesocks'
23147 usethreads='$usethreads'
23148 usevendorprefix='$usevendorprefix'
23149 usevfork='$usevfork'
23150 usrinc='$usrinc'
23151 uuname='$uuname'
23152 uvXUformat='$uvXUformat'
23153 uvoformat='$uvoformat'
23154 uvsize='$uvsize'
23155 uvtype='$uvtype'
23156 uvuformat='$uvuformat'
23157 uvxformat='$uvxformat'
23158 vendorarch='$vendorarch'
23159 vendorarchexp='$vendorarchexp'
23160 vendorbin='$vendorbin'
23161 vendorbinexp='$vendorbinexp'
23162 vendorhtml1dir='$vendorhtml1dir'
23163 vendorhtml1direxp='$vendorhtml1direxp'
23164 vendorhtml3dir='$vendorhtml3dir'
23165 vendorhtml3direxp='$vendorhtml3direxp'
23166 vendorlib='$vendorlib'
23167 vendorlib_stem='$vendorlib_stem'
23168 vendorlibexp='$vendorlibexp'
23169 vendorman1dir='$vendorman1dir'
23170 vendorman1direxp='$vendorman1direxp'
23171 vendorman3dir='$vendorman3dir'
23172 vendorman3direxp='$vendorman3direxp'
23173 vendorprefix='$vendorprefix'
23174 vendorprefixexp='$vendorprefixexp'
23175 vendorscript='$vendorscript'
23176 vendorscriptexp='$vendorscriptexp'
23177 version='$version'
23178 version_patchlevel_string='$version_patchlevel_string'
23179 versiononly='$versiononly'
23180 vi='$vi'
23181 voidflags='$voidflags'
23182 xlibpth='$xlibpth'
23183 yacc='$yacc'
23184 yaccflags='$yaccflags'
23185 zcat='$zcat'
23186 zip='$zip'
23187 EOT
23188
23189 : Add in command line options if available
23190 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23191
23192 : add special variables
23193 $test -f $src/patchlevel.h && \
23194 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23195 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23196 echo "PERL_CONFIG_SH=true" >>config.sh
23197
23198 : propagate old symbols
23199 if $test -f UU/config.sh; then
23200         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23201         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23202                 config.sh config.sh UU/oldconfig.sh |\
23203                 $sort | $uniq -u >UU/oldsyms
23204         set X `cat UU/oldsyms`
23205         shift
23206         case $# in
23207         0) ;;
23208         *)
23209                 cat <<EOM
23210 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23211 EOM
23212                 echo ": Variables propagated from previous config.sh file." >>config.sh
23213                 for sym in `cat UU/oldsyms`; do
23214                         echo "    Propagating $hint variable "'$'"$sym..."
23215                         eval 'tmp="$'"${sym}"'"'
23216                         echo "$tmp" | \
23217                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23218                 done
23219                 ;;
23220         esac
23221 fi
23222
23223 : Finish up by extracting the .SH files
23224 case "$alldone" in
23225 exit)
23226         $rm -rf UU
23227         echo "Extraction done."
23228         exit 0
23229         ;;
23230 cont)
23231         ;;
23232 '')
23233         dflt=''
23234         nostick=true
23235         $cat <<EOM
23236
23237 If you'd like to make any changes to the config.sh file before I begin
23238 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23239
23240 EOM
23241         rp="Press return or use a shell escape to edit config.sh:"
23242         . UU/myread
23243         nostick=''
23244         case "$ans" in
23245         '') ;;
23246         *) : in case they cannot read
23247                 sh 1>&4 -c "$ans";;
23248         esac
23249         ;;
23250 esac
23251
23252 : if this fails, just run all the .SH files by hand
23253 . ./config.sh
23254
23255 echo " "
23256 exec 1>&4
23257 pwd=`pwd`
23258 . ./UU/extract
23259 cd "$pwd"
23260
23261 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23262         dflt=y
23263         case "$silent" in
23264         true) ;;
23265         *)
23266                 $cat <<EOM
23267
23268 Now you need to generate make dependencies by running "$make depend".
23269 You might prefer to run it in background: "$make depend > makedepend.out &"
23270 It can take a while, so you might not want to run it right now.
23271
23272 EOM
23273                 ;;
23274         esac
23275         rp="Run $make depend now?"
23276         . UU/myread
23277         case "$ans" in
23278         y*)
23279                 $make depend && echo "Now you must run '$make'."
23280                 ;;
23281         *)
23282                 echo "You must run '$make depend' then '$make'."
23283                 ;;
23284         esac
23285 elif test -f [Mm]akefile; then
23286         echo " "
23287         echo "Now you must run a $make."
23288 else
23289         echo "Configure done."
23290 fi
23291
23292 if $test -f Policy.sh; then
23293     $cat <<EOM
23294
23295 If you compile $package on a different machine or from a different object
23296 directory, copy the Policy.sh file from this object directory to the
23297 new one before you run Configure -- this will help you with most of
23298 the policy defaults.
23299
23300 EOM
23301 fi
23302 if $test -f config.msg; then
23303     echo "Hmm.  I also noted the following information while running:"
23304     echo " "
23305     $cat config.msg >&4
23306     $rm -f config.msg
23307 fi
23308 $rm -f kit*isdone ark*isdone
23309 $rm -rf UU
23310
23311 : End of Configure
23312