Update to IO-1.25 from CPAN
[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 Thu Jun  4 09:30:45 CEST 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 bin_ELF=''
828 cccdlflags=''
829 ccdlflags=''
830 dlsrc=''
831 ld=''
832 lddlflags=''
833 usedl=''
834 doublesize=''
835 ebcdic=''
836 fflushNULL=''
837 fflushall=''
838 fpossize=''
839 fpostype=''
840 gccansipedantic=''
841 gccosandvers=''
842 gccversion=''
843 gidformat=''
844 gidsign=''
845 gidsize=''
846 gidtype=''
847 groupstype=''
848 h_fcntl=''
849 h_sysfile=''
850 html1dir=''
851 html1direxp=''
852 installhtml1dir=''
853 html3dir=''
854 html3direxp=''
855 installhtml3dir=''
856 i_arpainet=''
857 i_assert=''
858 i_crypt=''
859 db_hashtype=''
860 db_prefixtype=''
861 db_version_major=''
862 db_version_minor=''
863 db_version_patch=''
864 i_db=''
865 i_dbm=''
866 i_rpcsvcdbm=''
867 d_dirnamlen=''
868 direntrytype=''
869 i_dirent=''
870 i_dld=''
871 i_dlfcn=''
872 i_fcntl=''
873 i_float=''
874 i_fp=''
875 i_fp_class=''
876 i_gdbm=''
877 d_grpasswd=''
878 i_grp=''
879 i_ieeefp=''
880 i_inttypes=''
881 i_langinfo=''
882 i_libutil=''
883 i_limits=''
884 i_locale=''
885 i_machcthr=''
886 i_malloc=''
887 i_mallocmalloc=''
888 i_math=''
889 i_memory=''
890 i_mntent=''
891 d_gdbm_ndbm_h_uses_prototypes=''
892 d_gdbmndbm_h_uses_prototypes=''
893 d_ndbm=''
894 d_ndbm_h_uses_prototypes=''
895 i_gdbm_ndbm=''
896 i_gdbmndbm=''
897 i_ndbm=''
898 i_netdb=''
899 i_neterrno=''
900 i_netinettcp=''
901 i_niin=''
902 i_sysin=''
903 i_poll=''
904 i_prot=''
905 i_pthread=''
906 d_pwage=''
907 d_pwchange=''
908 d_pwclass=''
909 d_pwcomment=''
910 d_pwexpire=''
911 d_pwgecos=''
912 d_pwpasswd=''
913 d_pwquota=''
914 i_pwd=''
915 i_sfio=''
916 i_shadow=''
917 i_socks=''
918 i_stddef=''
919 i_stdlib=''
920 i_string=''
921 strings=''
922 i_sunmath=''
923 i_sysaccess=''
924 i_sysdir=''
925 i_sysfile=''
926 d_voidtty=''
927 i_bsdioctl=''
928 i_sysfilio=''
929 i_sysioctl=''
930 i_syssockio=''
931 i_syslog=''
932 i_sysmman=''
933 i_sysmode=''
934 i_sysmount=''
935 i_sysndir=''
936 i_sysparam=''
937 i_syspoll=''
938 i_sysresrc=''
939 i_syssecrt=''
940 i_sysselct=''
941 i_sysstat=''
942 i_sysstatfs=''
943 i_sysstatvfs=''
944 i_systimes=''
945 i_systypes=''
946 i_sysuio=''
947 i_sysun=''
948 i_sysutsname=''
949 i_sysvfs=''
950 i_syswait=''
951 i_sgtty=''
952 i_termio=''
953 i_termios=''
954 d_tm_tm_gmtoff=''
955 d_tm_tm_zone=''
956 i_systime=''
957 i_systimek=''
958 i_time=''
959 timeincl=''
960 i_unistd=''
961 i_ustat=''
962 i_utime=''
963 i_values=''
964 i_stdarg=''
965 i_varargs=''
966 i_varhdr=''
967 i_vfork=''
968 d_inc_version_list=''
969 inc_version_list=''
970 inc_version_list_init=''
971 installprefix=''
972 installprefixexp=''
973 installstyle=''
974 installusrbinperl=''
975 intsize=''
976 longsize=''
977 shortsize=''
978 issymlink=''
979 libc=''
980 ldlibpthname=''
981 libperl=''
982 shrpenv=''
983 useshrplib=''
984 glibpth=''
985 libpth=''
986 loclibpth=''
987 plibpth=''
988 xlibpth=''
989 ignore_versioned_solibs=''
990 libs=''
991 libsdirs=''
992 libsfiles=''
993 libsfound=''
994 libspath=''
995 lns=''
996 d_PRIEUldbl=''
997 d_PRIFUldbl=''
998 d_PRIGUldbl=''
999 d_PRIeldbl=''
1000 d_PRIfldbl=''
1001 d_PRIgldbl=''
1002 d_SCNfldbl=''
1003 sPRIEUldbl=''
1004 sPRIFUldbl=''
1005 sPRIGUldbl=''
1006 sPRIeldbl=''
1007 sPRIfldbl=''
1008 sPRIgldbl=''
1009 sSCNfldbl=''
1010 lseeksize=''
1011 lseektype=''
1012 mad=''
1013 madlyh=''
1014 madlyobj=''
1015 madlysrc=''
1016 make_set_make=''
1017 d_mymalloc=''
1018 freetype=''
1019 mallocobj=''
1020 mallocsrc=''
1021 malloctype=''
1022 usemallocwrap=''
1023 usemymalloc=''
1024 installman1dir=''
1025 man1dir=''
1026 man1direxp=''
1027 man1ext=''
1028 installman3dir=''
1029 man3dir=''
1030 man3direxp=''
1031 man3ext=''
1032 modetype=''
1033 multiarch=''
1034 mydomain=''
1035 myhostname=''
1036 phostname=''
1037 c=''
1038 n=''
1039 d_eofnblk=''
1040 eagain=''
1041 o_nonblock=''
1042 rd_nodata=''
1043 need_va_copy=''
1044 netdb_hlen_type=''
1045 netdb_host_type=''
1046 netdb_name_type=''
1047 netdb_net_type=''
1048 groupcat=''
1049 hostcat=''
1050 passcat=''
1051 orderlib=''
1052 ranlib=''
1053 d_perl_otherlibdirs=''
1054 otherlibdirs=''
1055 package=''
1056 spackage=''
1057 pager=''
1058 api_revision=''
1059 api_subversion=''
1060 api_version=''
1061 api_versionstring=''
1062 patchlevel=''
1063 perl_patchlevel=''
1064 revision=''
1065 subversion=''
1066 version=''
1067 version_patchlevel_string=''
1068 perl5=''
1069 perladmin=''
1070 perlpath=''
1071 d_nv_preserves_uv=''
1072 d_nv_zero_is_allbits_zero=''
1073 i16size=''
1074 i16type=''
1075 i32size=''
1076 i32type=''
1077 i64size=''
1078 i64type=''
1079 i8size=''
1080 i8type=''
1081 ivsize=''
1082 ivtype=''
1083 nv_overflows_integers_at=''
1084 nv_preserves_uv_bits=''
1085 nvsize=''
1086 nvtype=''
1087 u16size=''
1088 u16type=''
1089 u32size=''
1090 u32type=''
1091 u64size=''
1092 u64type=''
1093 u8size=''
1094 u8type=''
1095 uvsize=''
1096 uvtype=''
1097 ivdformat=''
1098 nvEUformat=''
1099 nvFUformat=''
1100 nvGUformat=''
1101 nveformat=''
1102 nvfformat=''
1103 nvgformat=''
1104 uvXUformat=''
1105 uvoformat=''
1106 uvuformat=''
1107 uvxformat=''
1108 pidtype=''
1109 prefix=''
1110 prefixexp=''
1111 installprivlib=''
1112 privlib=''
1113 privlibexp=''
1114 prototype=''
1115 ptrsize=''
1116 d_PRIXU64=''
1117 d_PRId64=''
1118 d_PRIi64=''
1119 d_PRIo64=''
1120 d_PRIu64=''
1121 d_PRIx64=''
1122 sPRIXU64=''
1123 sPRId64=''
1124 sPRIi64=''
1125 sPRIo64=''
1126 sPRIu64=''
1127 sPRIx64=''
1128 d_quad=''
1129 quadkind=''
1130 quadtype=''
1131 uquadtype=''
1132 drand01=''
1133 randbits=''
1134 randfunc=''
1135 randseedtype=''
1136 seedfunc=''
1137 installscript=''
1138 scriptdir=''
1139 scriptdirexp=''
1140 selectminbits=''
1141 selecttype=''
1142 sh=''
1143 sig_count=''
1144 sig_name=''
1145 sig_name_init=''
1146 sig_num=''
1147 sig_num_init=''
1148 sig_size=''
1149 d_sitearch=''
1150 installsitearch=''
1151 sitearch=''
1152 sitearchexp=''
1153 installsitebin=''
1154 sitebin=''
1155 sitebinexp=''
1156 installsitehtml1dir=''
1157 sitehtml1dir=''
1158 sitehtml1direxp=''
1159 installsitehtml3dir=''
1160 sitehtml3dir=''
1161 sitehtml3direxp=''
1162 installsitelib=''
1163 sitelib=''
1164 sitelib_stem=''
1165 sitelibexp=''
1166 installsiteman1dir=''
1167 siteman1dir=''
1168 siteman1direxp=''
1169 installsiteman3dir=''
1170 siteman3dir=''
1171 siteman3direxp=''
1172 siteprefix=''
1173 siteprefixexp=''
1174 installsitescript=''
1175 sitescript=''
1176 sitescriptexp=''
1177 sizesize=''
1178 sizetype=''
1179 so=''
1180 socksizetype=''
1181 sharpbang=''
1182 shsharp=''
1183 spitshell=''
1184 src=''
1185 ssizetype=''
1186 startperl=''
1187 startsh=''
1188 stdchar=''
1189 d_stdio_stream_array=''
1190 stdio_stream_array=''
1191 sysman=''
1192 sGMTIME_max=''
1193 sGMTIME_min=''
1194 sLOCALTIME_max=''
1195 sLOCALTIME_min=''
1196 trnl=''
1197 uidformat=''
1198 uidsign=''
1199 uidsize=''
1200 uidtype=''
1201 archname64=''
1202 use64bitall=''
1203 use64bitint=''
1204 dtrace=''
1205 usedtrace=''
1206 usefaststdio=''
1207 ccflags_uselargefiles=''
1208 ldflags_uselargefiles=''
1209 libswanted_uselargefiles=''
1210 uselargefiles=''
1211 uselongdouble=''
1212 usemorebits=''
1213 usemultiplicity=''
1214 nm_opt=''
1215 nm_so_opt=''
1216 runnm=''
1217 usenm=''
1218 useperlio=''
1219 usesocks=''
1220 d_oldpthreads=''
1221 use5005threads=''
1222 useithreads=''
1223 usereentrant=''
1224 usethreads=''
1225 incpath=''
1226 mips_type=''
1227 usrinc=''
1228 d_vendorarch=''
1229 installvendorarch=''
1230 vendorarch=''
1231 vendorarchexp=''
1232 d_vendorbin=''
1233 installvendorbin=''
1234 vendorbin=''
1235 vendorbinexp=''
1236 installvendorhtml1dir=''
1237 vendorhtml1dir=''
1238 vendorhtml1direxp=''
1239 installvendorhtml3dir=''
1240 vendorhtml3dir=''
1241 vendorhtml3direxp=''
1242 d_vendorlib=''
1243 installvendorlib=''
1244 vendorlib=''
1245 vendorlib_stem=''
1246 vendorlibexp=''
1247 installvendorman1dir=''
1248 vendorman1dir=''
1249 vendorman1direxp=''
1250 installvendorman3dir=''
1251 vendorman3dir=''
1252 vendorman3direxp=''
1253 usevendorprefix=''
1254 vendorprefix=''
1255 vendorprefixexp=''
1256 d_vendorscript=''
1257 installvendorscript=''
1258 vendorscript=''
1259 vendorscriptexp=''
1260 versiononly=''
1261 defvoidused=''
1262 voidflags=''
1263 yacc=''
1264 yaccflags=''
1265 CONFIG=''
1266
1267 : Detect odd OSs
1268 define='define'
1269 undef='undef'
1270 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1271 rmlist=''
1272
1273 : We must find out about Eunice early
1274 eunicefix=':'
1275 if test -f /etc/unixtovms; then
1276         eunicefix=/etc/unixtovms
1277 fi
1278 if test -f /etc/unixtovms.exe; then
1279         eunicefix=/etc/unixtovms.exe
1280 fi
1281
1282 : Set executable suffix now -- needed before hints available
1283 if test -f "/libs/version.library"; then
1284 : Amiga OS
1285     _exe=""
1286 elif test -f "/system/gnu_library/bin/ar.pm"; then
1287 : Stratus VOS
1288     _exe=".pm"
1289 elif test -n "$DJGPP"; then
1290 : DOS DJGPP
1291     _exe=".exe"
1292 elif test -d c:/. -o -n "$is_os2" ; then
1293 : OS/2 or cygwin
1294     _exe=".exe"
1295 fi
1296
1297 groupstype=''
1298 i_whoami=''
1299 : Trailing extension.  Override this in a hint file, if needed.
1300 : Extra object files, if any, needed on this platform.
1301 archobjs=''
1302 archname=''
1303 libnames=''
1304 : change the next line if compiling for Xenix/286 on Xenix/386
1305 xlibpth='/usr/lib/386 /lib/386'
1306 : Possible local library directories to search.
1307 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1308 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1309
1310 : general looking path for locating libraries
1311 glibpth="/lib /usr/lib $xlibpth"
1312 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1313 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1314 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1315 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1316
1317 : Private path used by Configure to find libraries.  Its value
1318 : is prepended to libpth. This variable takes care of special
1319 : machines, like the mips.  Usually, it should be empty.
1320 plibpth=''
1321
1322 : default library list
1323 libswanted=''
1324 : some systems want to use only the non-versioned libso:s
1325 ignore_versioned_solibs=''
1326 : set usethreads on the Configure command line to enable threads.
1327 usereentrant='undef'
1328 : full support for void wanted by default
1329 defvoidused=15
1330
1331 : Possible local include directories to search.
1332 : Set locincpth to "" in a hint file to defeat local include searches.
1333 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1334 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1335 :
1336 : no include file wanted by default
1337 inclwanted=''
1338
1339 : Enable -DEBUGGING and -DDEBUGGING from the command line
1340 EBUGGING=''
1341 DEBUGGING=old
1342
1343 ccname=''
1344 ccversion=''
1345 perllibs=''
1346 : set useposix=false in your hint file to disable the POSIX extension.
1347 useposix=true
1348 : set useopcode=false in your hint file to disable the Opcode extension.
1349 useopcode=true
1350 archname64=''
1351 ccflags_uselargefiles=''
1352 ldflags_uselargefiles=''
1353 libswanted_uselargefiles=''
1354 : set usemultiplicity on the Configure command line to enable multiplicity.
1355 : set usesocks on the Configure command line to enable socks.
1356 : List of libraries we want.
1357 : If anyone needs extra -lxxx, put those in a hint file.
1358 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1359 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1360 : We probably want to search /usr/shlib before most other libraries.
1361 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1362 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1363 glibpth="/usr/shlib $glibpth"
1364 : Do not use vfork unless overridden by a hint file.
1365 usevfork=false
1366
1367 : Find the basic shell for Bourne shell scripts
1368 case "$sh" in
1369 '')
1370         case "$SYSTYPE" in
1371         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1372         *) xxx='/bin/sh';;
1373         esac
1374         if test -f "$xxx"; then
1375                 sh="$xxx"
1376         else
1377                 : Build up a list and do a single loop so we can 'break' out.
1378                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1379                 for xxx in sh bash ksh pdksh ash; do
1380                         for p in $pth; do
1381                                 try="$try ${p}/${xxx}"
1382                         done
1383                 done
1384                 for xxx in $try; do
1385                         if test -f "$xxx"; then
1386                                 sh="$xxx";
1387                                 break
1388                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1389                                 sh="$xxx";
1390                                 break
1391                         elif test -f "$xxx.exe"; then
1392                                 sh="$xxx";
1393                                 break
1394                         fi
1395                 done
1396         fi
1397         ;;
1398 esac
1399
1400 case "$sh" in
1401 '')     cat >&2 <<EOM
1402 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1403
1404 Usually it's in /bin/sh.  How did you even get this far?
1405 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1406 we'll try to straighten this all out.
1407 EOM
1408         exit 1
1409         ;;
1410 esac
1411
1412 : see if sh knows # comments
1413 if `$sh -c '#' >/dev/null 2>&1`; then
1414         shsharp=true
1415         spitshell=cat
1416         xcat=/bin/cat
1417         test -f $xcat$_exe || xcat=/usr/bin/cat
1418         if test ! -f $xcat$_exe; then
1419                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1420                         if test -f $p/cat$_exe; then
1421                                 xcat=$p/cat
1422                                 break
1423                         fi
1424                 done
1425                 if test ! -f $xcat$_exe; then
1426                         echo "Can't find cat anywhere!"
1427                         exit 1
1428                 fi
1429         fi
1430         echo "#!$xcat" >sharp
1431         $eunicefix sharp
1432         chmod +x sharp
1433         ./sharp > today 2>/dev/null
1434         if test -s today; then
1435                 sharpbang='#!'
1436         else
1437                 echo "#! $xcat" > sharp
1438                 $eunicefix sharp
1439                 chmod +x sharp
1440                 ./sharp > today 2>/dev/null
1441                 if test -s today; then
1442                         sharpbang='#! '
1443                 else
1444                         sharpbang=': use '
1445                 fi
1446         fi
1447 else
1448         echo " "
1449         echo "Your $sh doesn't grok # comments--I will strip them later on."
1450         shsharp=false
1451         cd ..
1452         echo "exec grep -v '^[  ]*#'" >spitshell
1453         chmod +x spitshell
1454         $eunicefix spitshell
1455         spitshell=`pwd`/spitshell
1456         cd UU
1457         echo "I presume that if # doesn't work, #! won't work either!"
1458         sharpbang=': use '
1459 fi
1460 rm -f sharp today
1461
1462 : figure out how to guarantee sh startup
1463 case "$startsh" in
1464 '') startsh=${sharpbang}${sh} ;;
1465 *)
1466 esac
1467 cat >sharp <<EOSS
1468 $startsh
1469 set abc
1470 test "$?abc" != 1
1471 EOSS
1472
1473 chmod +x sharp
1474 $eunicefix sharp
1475 if ./sharp; then
1476         : echo "Yup, it does."
1477 else
1478         echo "Hmm... '$startsh' does not guarantee sh startup..."
1479         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1480 fi
1481 rm -f sharp
1482
1483 : Save command line options in file UU/cmdline.opt for later use in
1484 : generating config.sh.
1485 cat > cmdline.opt <<EOSH
1486 : Configure command line arguments.
1487 config_arg0='$0'
1488 config_args='$*'
1489 config_argc=$#
1490 EOSH
1491 argn=1
1492 args_exp=''
1493 args_sep=''
1494 for arg in "$@"; do
1495         cat >>cmdline.opt <<EOSH
1496 config_arg$argn='$arg'
1497 EOSH
1498         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1499 $arg
1500 EOC
1501         arg_exp=`cat cmdl.opt`
1502         args_exp="$args_exp$args_sep'$arg_exp'"
1503         argn=`expr $argn + 1`
1504         args_sep=' '
1505 done
1506 rm -f cmdl.opt
1507
1508 : produce awk script to parse command line options
1509 cat >options.awk <<'EOF'
1510 BEGIN {
1511         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1512
1513         len = length(optstr);
1514         for (i = 1; i <= len; i++) {
1515                 c = substr(optstr, i, 1);
1516                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1517                 if (a == ":") {
1518                         arg[c] = 1;
1519                         i++;
1520                 }
1521                 opt[c] = 1;
1522         }
1523 }
1524 {
1525         expect = 0;
1526         str = $0;
1527         if (substr(str, 1, 1) != "-") {
1528                 printf("'%s'\n", str);
1529                 next;
1530         }
1531         len = length($0);
1532         for (i = 2; i <= len; i++) {
1533                 c = substr(str, i, 1);
1534                 if (!opt[c]) {
1535                         printf("-%s\n", substr(str, i));
1536                         next;
1537                 }
1538                 printf("-%s\n", c);
1539                 if (arg[c]) {
1540                         if (i < len)
1541                                 printf("'%s'\n", substr(str, i + 1));
1542                         else
1543                                 expect = 1;
1544                         next;
1545                 }
1546         }
1547 }
1548 END {
1549         if (expect)
1550                 print "?";
1551 }
1552 EOF
1553
1554 : process the command line options
1555 set X `for arg in "$@"; do echo "X$arg"; done |
1556         sed -e s/X// | awk -f options.awk`
1557 eval "set $*"
1558 shift
1559 rm -f options.awk
1560
1561 : set up default values
1562 fastread=''
1563 reuseval=false
1564 config_sh=''
1565 alldone=''
1566 error=''
1567 silent=''
1568 extractsh=''
1569 override=''
1570 knowitall=''
1571 rm -f optdef.sh posthint.sh
1572 cat >optdef.sh <<EOS
1573 $startsh
1574 EOS
1575
1576
1577 : option parsing
1578 while test $# -gt 0; do
1579         case "$1" in
1580         -d) shift; fastread=yes;;
1581         -e) shift; alldone=cont;;
1582         -f)
1583                 shift
1584                 cd ..
1585                 if test -r "$1"; then
1586                         config_sh="$1"
1587                 else
1588                         echo "$me: cannot read config file $1." >&2
1589                         error=true
1590                 fi
1591                 cd UU
1592                 shift;;
1593         --help|\
1594         -h) shift; error=true;;
1595         -r) shift; reuseval=true;;
1596         -s) shift; silent=true; realsilent=true;;
1597         -E) shift; alldone=exit;;
1598         -K) shift; knowitall=true;;
1599         -O) shift; override=true;;
1600         -S) shift; silent=true; extractsh=true;;
1601         -D)
1602                 shift
1603                 case "$1" in
1604                 *=)
1605                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1606                         echo "$me: ignoring -D $1" >&2
1607                         ;;
1608                 *=*) echo "$1" | \
1609                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1610                 *) echo "$1='define'" >> optdef.sh;;
1611                 esac
1612                 shift
1613                 ;;
1614         -U)
1615                 shift
1616                 case "$1" in
1617                 *=) echo "$1" >> optdef.sh;;
1618                 *=*)
1619                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1620                         echo "$me: ignoring -U $1" >&2
1621                         ;;
1622                 *) echo "$1='undef'" >> optdef.sh;;
1623                 esac
1624                 shift
1625                 ;;
1626         -A)
1627             shift
1628             xxx=''
1629             yyy="$1"
1630             zzz=''
1631             uuu=undef
1632             case "$yyy" in
1633             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1634                  case "$zzz" in
1635                  *:*) zzz='' ;;
1636                  *)   xxx=append
1637                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1638                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1639                  esac
1640                  ;;
1641             esac
1642             case "$xxx" in
1643             '')  case "$yyy" in
1644                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1645                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1646                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1647                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1648                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1649                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1650                  esac
1651                  ;;
1652             esac
1653             case "$xxx" in
1654             append)
1655                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1656             clear)
1657                 echo "$yyy=''"                  >> posthint.sh ;;
1658             define)
1659                 case "$zzz" in
1660                 '') zzz=define ;;
1661                 esac
1662                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1663             eval)
1664                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1665             prepend)
1666                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1667             undef)
1668                 case "$zzz" in
1669                 '') zzz="$uuu" ;;
1670                 esac
1671                 echo "$yyy=$zzz"                >> posthint.sh ;;
1672             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1673             esac
1674             shift
1675             ;;
1676         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1677             exit 0;;
1678         --) break;;
1679         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1680         *) break;;
1681         esac
1682 done
1683
1684 case "$error" in
1685 true)
1686         cat >&2 <<EOM
1687 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1688                  [-U symbol] [-U symbol=] [-A command:symbol...]
1689   -d : use defaults for all answers.
1690   -e : go on without questioning past the production of config.sh.
1691   -f : specify an alternate default configuration file.
1692   -h : print this help message and exit (with an error status).
1693   -r : reuse C symbols value if possible (skips costly nm extraction).
1694   -s : silent mode, only echoes questions and essential information.
1695   -D : define symbol to have some value:
1696          -D symbol         symbol gets the value 'define'
1697          -D symbol=value   symbol gets the value 'value'
1698        common used examples (see INSTALL for more info):
1699          -Duse64bitint            use 64bit integers
1700          -Duse64bitall            use 64bit integers and pointers
1701          -Dusethreads             use thread support
1702          -Dinc_version_list=none  do not include older perl trees in @INC
1703          -DEBUGGING=none          DEBUGGING options
1704          -Dcc=gcc                 choose your compiler
1705          -Dprefix=/opt/perl5      choose your destination
1706   -E : stop at the end of questions, after having produced config.sh.
1707   -K : do not use unless you know what you are doing.
1708   -O : let -D and -U override definitions from loaded configuration file.
1709   -S : perform variable substitutions on all .SH files (can mix with -f)
1710   -U : undefine symbol:
1711          -U symbol    symbol gets the value 'undef'
1712          -U symbol=   symbol gets completely empty
1713        e.g.:  -Uversiononly
1714   -A : manipulate symbol after the platform specific hints have been applied:
1715          -A append:symbol=value   append value to symbol
1716          -A symbol=value          like append:, but with a separating space
1717          -A define:symbol=value   define symbol to have value
1718          -A clear:symbol          define symbol to be ''
1719          -A define:symbol         define symbol to be 'define'
1720          -A eval:symbol=value     define symbol to be eval of value
1721          -A prepend:symbol=value  prepend value to symbol
1722          -A undef:symbol          define symbol to be 'undef'
1723          -A undef:symbol=         define symbol to be ''
1724        e.g.:  -A prepend:libswanted='cl pthread '
1725               -A ccflags=-DSOME_MACRO
1726   -V : print version number and exit (with a zero status).
1727 EOM
1728         exit 1
1729         ;;
1730 esac
1731
1732 : Sanity checks
1733 case "$fastread$alldone" in
1734 yescont|yesexit) ;;
1735 *)
1736         case "$extractsh" in
1737         true) ;;
1738         *)
1739                 if test ! -t 0; then
1740                         echo "Say 'sh Configure', not 'sh <Configure'"
1741                         exit 1
1742                 fi
1743                 ;;
1744         esac
1745         ;;
1746 esac
1747
1748 exec 4>&1
1749 case "$silent" in
1750 true) exec 1>/dev/null;;
1751 esac
1752
1753 : run the defines and the undefines, if any, but leave the file out there...
1754 touch optdef.sh
1755 . ./optdef.sh
1756 : create the posthint manipulation script and leave the file out there...
1757 touch posthint.sh
1758
1759 : set package name
1760 package='perl5'
1761 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1762 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1763 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1764 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1765 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1766 esac
1767
1768 : Some greps do not return status, grrr.
1769 echo "grimblepritz" >grimble
1770 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1771         contains=contains
1772 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1773         contains=grep
1774 else
1775         contains=contains
1776 fi
1777 rm -f grimble
1778 : the following should work in any shell
1779 case "$contains" in
1780 contains*)
1781         echo " "
1782         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1783         cat >contains <<'EOSS'
1784 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1785 EOSS
1786 chmod +x contains
1787 esac
1788
1789 : Find the path to the source tree
1790 case "$src" in
1791 '') case "$0" in
1792     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1793          case "$src" in
1794          /*)    ;;
1795          .)     ;;
1796          *)     src=`cd ../$src && pwd` ;;
1797          esac
1798          ;;
1799     *)   src='.';;
1800     esac;;
1801 esac
1802 case "$src" in
1803 '')     src=/
1804         rsrc=/
1805         ;;
1806 /*)     rsrc="$src";;
1807 *)      rsrc="../$src";;
1808 esac
1809 if test -f $rsrc/Configure && \
1810         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1811 then
1812    : found it, so we are ok.
1813 else
1814         rsrc=''
1815         for src in . .. ../.. ../../.. ../../../..; do
1816                 if test -f ../$src/Configure && \
1817                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1818                 then
1819                         rsrc=../$src
1820                         break
1821                 fi
1822         done
1823 fi
1824 case "$rsrc" in
1825 '')
1826         cat <<EOM >&4
1827
1828 Sorry, I can't seem to locate the source dir for $package.  Please start
1829 Configure with an explicit path -- i.e. /some/path/Configure.
1830
1831 EOM
1832         exit 1
1833         ;;
1834 ../.)   rsrc='..';;
1835 *)
1836         echo " "
1837         echo "Sources for $package found in \"$src\"." >&4
1838         ;;
1839 esac
1840
1841 : script used to extract .SH files with variable substitutions
1842 cat >extract <<'EOS'
1843 PERL_CONFIG_SH=true
1844 echo "Doing variable substitutions on .SH files..."
1845 if test -f MANIFEST; then
1846         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1847 else
1848         echo "(Looking for .SH files under the source directory.)"
1849         set x `(cd "$src"; find . -name "*.SH" -print)`
1850 fi
1851 shift
1852 case $# in
1853 0) set x `(cd "$src"; echo *.SH)`; shift;;
1854 esac
1855 if test ! -f "$src/$1"; then
1856         shift
1857 fi
1858 mkdir_p='
1859 name=$1;
1860 create="";
1861 while test $name; do
1862         if test ! -d "$name"; then
1863                 create="$name $create";
1864                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1865                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1866         else
1867                 name="";
1868         fi;
1869 done;
1870 for file in $create; do
1871         mkdir $file;
1872 done
1873 '
1874 for file in $*; do
1875         case "$src" in
1876         ".")
1877                 case "$file" in
1878                 */*)
1879                         dir=`expr X$file : 'X\(.*\)/'`
1880                         file=`expr X$file : 'X.*/\(.*\)'`
1881                         (cd "$dir" && . ./$file)
1882                         ;;
1883                 *)
1884                         . ./$file
1885                         ;;
1886                 esac
1887                 ;;
1888         *)
1889                 case "$file" in
1890                 */*)
1891                         dir=`expr X$file : 'X\(.*\)/'`
1892                         file=`expr X$file : 'X.*/\(.*\)'`
1893                         (set x $dir; shift; eval $mkdir_p)
1894                         sh <"$src/$dir/$file"
1895                         ;;
1896                 *)
1897                         sh <"$src/$file"
1898                         ;;
1899                 esac
1900                 ;;
1901         esac
1902 done
1903 if test -f "$src/config_h.SH"; then
1904         if test ! -f config.h; then
1905         : oops, they left it out of MANIFEST, probably, so do it anyway.
1906         . "$src/config_h.SH"
1907         fi
1908 fi
1909 EOS
1910
1911 : extract files and exit if asked to do so
1912 case "$extractsh" in
1913 true)
1914         case "$realsilent" in
1915         true) ;;
1916         *) exec 1>&4;;
1917         esac
1918         case "$config_sh" in
1919         '') config_sh='config.sh';;
1920         esac
1921         echo " "
1922         echo "Fetching answers from $config_sh..."
1923         cd ..
1924         . $config_sh
1925         test "$override" && . ./optdef.sh
1926         echo " "
1927         . UU/extract
1928         rm -rf UU
1929         echo "Extraction done."
1930         exit 0
1931         ;;
1932 esac
1933
1934 : Eunice requires " " instead of "", can you believe it
1935 echo " "
1936 : Here we go...
1937 echo "Beginning of configuration questions for $package."
1938
1939 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1940
1941 : first determine how to suppress newline on echo command
1942 echo " "
1943 echo "Checking echo to see how to suppress newlines..."
1944 (echo "hi there\c" ; echo " ") >.echotmp
1945 if $contains c .echotmp >/dev/null 2>&1 ; then
1946         echo "...using -n."
1947         n='-n'
1948         c=''
1949 else
1950         cat <<'EOM'
1951 ...using \c
1952 EOM
1953         n=''
1954         c='\c'
1955 fi
1956 echo $n "The star should be here-->$c"
1957 echo '*'
1958 rm -f .echotmp
1959
1960 : Now test for existence of everything in MANIFEST
1961 echo " "
1962 if test -f "$rsrc/MANIFEST"; then
1963         echo "First let's make sure your kit is complete.  Checking..." >&4
1964         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1965                 (split -l 50 2>/dev/null || split -50)
1966         rm -f missing
1967         tmppwd=`pwd`
1968         for filelist in x??; do
1969                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1970                         >/dev/null 2>>"$tmppwd/missing")
1971         done
1972         if test -s missing; then
1973                 cat missing >&4
1974                 cat >&4 <<'EOM'
1975
1976 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1977
1978 You have the option of continuing the configuration process, despite the
1979 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1980 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1981 and contact the author (perlbug@perl.org).
1982
1983 EOM
1984                 echo $n "Continue? [n] $c" >&4
1985                 read ans
1986                 case "$ans" in
1987                 y*)
1988                         echo "Continuing..." >&4
1989                         rm -f missing
1990                         ;;
1991                 *)
1992                         echo "ABORTING..." >&4
1993                         kill $$
1994                         ;;
1995                 esac
1996         else
1997                 echo "Looks good..."
1998         fi
1999 else
2000         echo "There is no MANIFEST file.  I hope your kit is complete !"
2001 fi
2002 rm -f missing x??
2003
2004 : Find the appropriate value for a newline for tr
2005 echo " "
2006 if test -n "$DJGPP"; then
2007        trnl='\012'
2008 fi
2009 if test X"$trnl" = X; then
2010         case "`echo foo|tr '\n' x 2>/dev/null`" in
2011         foox) trnl='\n' ;;
2012         esac
2013 fi
2014 if test X"$trnl" = X; then
2015         case "`echo foo|tr '\012' x 2>/dev/null`" in
2016         foox) trnl='\012' ;;
2017         esac
2018 fi
2019 if test X"$trnl" = X; then
2020        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2021        fooxy) trnl='\n\r' ;;
2022        esac
2023 fi
2024 if test X"$trnl" = X; then
2025         cat <<EOM >&2
2026
2027 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2028
2029 EOM
2030         exit 1
2031 fi
2032
2033 : compute the number of columns on the terminal for proper question formatting
2034 case "$COLUMNS" in
2035 '') COLUMNS='80';;
2036 esac
2037
2038 : set up the echo used in my read
2039 myecho="case \"\$xxxm\" in
2040 '') echo $n \"\$rp $c\" >&4;;
2041 *) case \"\$rp\" in
2042         '') echo $n \"[\$xxxm] $c\";;
2043         *)
2044                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2045                         echo \"\$rp\" >&4
2046                         echo $n \"[\$xxxm] $c\" >&4
2047                 else
2048                         echo $n \"\$rp [\$xxxm] $c\" >&4
2049                 fi
2050                 ;;
2051         esac;;
2052 esac"
2053
2054 : now set up to do reads with possible shell escape and default assignment
2055 cat <<EOSC >myread
2056 $startsh
2057 xxxm=\$dflt
2058 $myecho
2059 ans='!'
2060 case "\$fastread" in
2061 yes) case "\$dflt" in
2062         '') ;;
2063         *) ans='';
2064                 case "\$silent-\$rp" in
2065                 true-) ;;
2066                 *) echo " " >&4;;
2067                 esac;;
2068         esac;;
2069 *) case "\$silent" in
2070         true) case "\$rp" in
2071                 '') ans='';;
2072                 esac;;
2073         esac;;
2074 esac
2075 while expr "X\$ans" : "X!" >/dev/null; do
2076         read answ
2077         set x \$xxxm
2078         shift
2079         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2080         case  "\$answ" in
2081         "!")
2082                 sh 1>&4
2083                 echo " "
2084                 $myecho
2085                 ;;
2086         !*)
2087                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2088                 shift
2089                 sh 1>&4 -c "\$*"
2090                 echo " "
2091                 $myecho
2092                 ;;
2093         "\$ans")
2094                 case "\$ans" in
2095                 \\&*)
2096                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2097                         shift
2098                         case "\$1" in
2099                         -d)
2100                                 fastread=yes
2101                                 echo "(OK, I'll run with -d after this question.)" >&4
2102                                 ;;
2103                         -*)
2104                                 echo "*** Sorry, \$1 not supported yet." >&4
2105                                 ;;
2106                         esac
2107                         $myecho
2108                         ans=!
2109                         ;;
2110                 esac;;
2111         *)
2112                 case "\$aok" in
2113                 y)
2114                         echo "*** Substitution done -- please confirm."
2115                         xxxm="\$ans"
2116                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2117                         xxxm="\$ans"
2118                         ans=!
2119                         ;;
2120                 *)
2121                         echo "*** Error -- try again."
2122                         ans=!
2123                         ;;
2124                 esac
2125                 $myecho
2126                 ;;
2127         esac
2128         case "\$ans\$xxxm\$nostick" in
2129         '')
2130                 ans=!
2131                 $myecho
2132                 ;;
2133         esac
2134 done
2135 case "\$ans" in
2136 '') ans="\$xxxm";;
2137 esac
2138 EOSC
2139
2140 : create .config dir to save info across Configure sessions
2141 test -d ../.config || mkdir ../.config
2142 cat >../.config/README <<EOF
2143 This directory created by Configure to save information that should
2144 persist across sessions for $package.
2145
2146 You may safely delete it if you wish.
2147 EOF
2148
2149 : See if we are using a devel version and want that
2150 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2151 case "$usedevel" in
2152 $define|true|[yY]*)
2153     usedevel="$define" ;;
2154 *) case "$xversion" in
2155    *[13579])
2156         cat >&4 <<EOH
2157 *** WHOA THERE!!! ***
2158
2159     This is an UNSTABLE DEVELOPMENT release.
2160     The version of this $package distribution is $xversion, that is, odd,
2161     (as opposed to even) and that signifies a development release.
2162     If you want a maintenance release, you want an even-numbered version.
2163
2164     Do ***NOT*** install this into production use.
2165     Data corruption and crashes are possible.
2166
2167     It is most seriously suggested that you do not continue any further
2168     unless you want to help in developing and debugging Perl.
2169
2170     If you *still* want to build perl, you can answer 'y' now,
2171     or pass -Dusedevel to Configure.
2172
2173 EOH
2174         rp='Do you really want to continue?'
2175         dflt='n'
2176         . ./myread
2177         case "$ans" in
2178         [yY]) echo >&4 "Okay, continuing."
2179               usedevel="$define" ;;
2180         *) echo >&4 "Okay, bye."
2181            exit 1
2182            ;;
2183         esac
2184         ;;
2185     esac
2186     usedevel="$undef"
2187     ;;
2188 esac
2189 case "$usedevel" in
2190 $define|true|[yY]*)
2191         case "$versiononly" in
2192         '') versiononly="$define" ;;
2193         esac
2194         case "$installusrbinperl" in
2195         '') installusrbinperl="$undef" ;;
2196         esac
2197         ;;
2198 esac
2199
2200 : general instructions
2201 needman=true
2202 firsttime=true
2203 user=`(logname) 2>/dev/null`
2204 case "$user" in
2205 '') user=`whoami 2>&1`;;
2206 esac
2207 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2208         firsttime=false
2209         echo " "
2210         rp='Would you like to see the instructions?'
2211         dflt=n
2212         . ./myread
2213         case "$ans" in
2214         [yY]*) ;;
2215         *) needman=false;;
2216         esac
2217 fi
2218 if $needman; then
2219         cat <<EOH
2220
2221 This installation shell script will examine your system and ask you questions
2222 to determine how the perl5 package should be installed. If you get
2223 stuck on a question, you may use a ! shell escape to start a subshell or
2224 execute a command.  Many of the questions will have default answers in square
2225 brackets; typing carriage return will give you the default.
2226
2227 On some of the questions which ask for file or directory names you are allowed
2228 to use the ~name construct to specify the login directory belonging to "name",
2229 even if you don't have a shell which knows about that.  Questions where this is
2230 allowed will be marked "(~name ok)".
2231
2232 EOH
2233         rp=''
2234         dflt='Type carriage return to continue'
2235         . ./myread
2236         cat <<'EOH'
2237
2238 The prompter used in this script allows you to use shell variables and
2239 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2240 in the default answer, as if the default line was a set of arguments given to a
2241 script shell.  This means you may also use $* to repeat the whole default line,
2242 so you do not have to re-type everything to add something to the default.
2243
2244 Everytime there is a substitution, you will have to confirm.  If there is an
2245 error (e.g. an unmatched backtick), the default answer will remain unchanged
2246 and you will be prompted again.
2247
2248 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2249 the questions and use the computed defaults (or the previous answers if there
2250 was already a config.sh file). Type 'Configure -h' for a list of options.
2251 You may also start interactively and then answer '& -d' at any prompt to turn
2252 on the non-interactive behaviour for the remainder of the execution.
2253
2254 EOH
2255         . ./myread
2256         cat <<EOH
2257
2258 Much effort has been expended to ensure that this shell script will run on any
2259 Unix system.  If despite that it blows up on yours, your best bet is to edit
2260 Configure and run it again.  If you can't run Configure for some reason,
2261 you'll have to generate a config.sh file by hand.  Whatever problems you
2262 have, let me (perlbug@perl.org) know how I blew it.
2263
2264 This installation script affects things in two ways:
2265
2266 1) it may do direct variable substitutions on some of the files included
2267    in this kit.
2268 2) it builds a config.h file for inclusion in C programs.  You may edit
2269    any of these files as the need arises after running this script.
2270
2271 If you make a mistake on a question, there is no easy way to back up to it
2272 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2273 files.  Configure will offer to let you do this before it runs the SH files.
2274
2275 EOH
2276         dflt='Type carriage return to continue'
2277         . ./myread
2278         case "$firsttime" in
2279         true) echo $user >>../.config/instruct;;
2280         esac
2281 fi
2282
2283 : find out where common programs are
2284 echo " "
2285 echo "Locating common programs..." >&4
2286 cat <<EOSC >loc
2287 $startsh
2288 case \$# in
2289 0) exit 1;;
2290 esac
2291 thing=\$1
2292 shift
2293 dflt=\$1
2294 shift
2295 for dir in \$*; do
2296         case "\$thing" in
2297         .)
2298         if test -d \$dir/\$thing; then
2299                 echo \$dir
2300                 exit 0
2301         fi
2302         ;;
2303         *)
2304         for thisthing in \$dir/\$thing; do
2305                 : just loop through to pick last item
2306         done
2307         if test -f \$thisthing; then
2308                 echo \$thisthing
2309                 exit 0
2310         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2311                 echo \$thisthing
2312                 exit 0
2313         elif test -f \$dir/\$thing.exe; then
2314                 if test -n "$DJGPP"; then
2315                         echo \$dir/\$thing.exe
2316                 elif test "$eunicefix" != ":"; then
2317                         : on Eunice apparently
2318                         echo \$dir/\$thing
2319                 fi
2320                 exit 0
2321         fi
2322         ;;
2323         esac
2324 done
2325 echo \$dflt
2326 exit 1
2327 EOSC
2328 chmod +x loc
2329 $eunicefix loc
2330 loclist="
2331 awk
2332 cat
2333 chmod
2334 comm
2335 cp
2336 echo
2337 expr
2338 grep
2339 ls
2340 mkdir
2341 rm
2342 sed
2343 sort
2344 touch
2345 tr
2346 uniq
2347 "
2348 trylist="
2349 ar
2350 bison
2351 byacc
2352 cpp
2353 csh
2354 date
2355 egrep
2356 gmake
2357 gzip
2358 less
2359 ln
2360 make
2361 more
2362 nm
2363 nroff
2364 pg
2365 test
2366 uname
2367 zip
2368 "
2369 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2370 pth="$pth /lib /usr/lib"
2371 for file in $loclist; do
2372         eval xxx=\$$file
2373         case "$xxx" in
2374         /*|?:[\\/]*)
2375                 if test -f "$xxx"; then
2376                         : ok
2377                 else
2378                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2379                         xxx=`./loc $file $file $pth`
2380                 fi
2381                 ;;
2382         '') xxx=`./loc $file $file $pth`;;
2383         *) xxx=`./loc $xxx $xxx $pth`;;
2384         esac
2385         eval $file=$xxx$_exe
2386         eval _$file=$xxx
2387         case "$xxx" in
2388         /*)
2389                 echo $file is in $xxx.
2390                 ;;
2391         ?:[\\/]*)
2392                 echo $file is in $xxx.
2393                 ;;
2394         *)
2395                 echo "I don't know where '$file' is, and my life depends on it." >&4
2396                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2397                 exit 1
2398                 ;;
2399         esac
2400 done
2401 echo " "
2402 echo "Don't worry if any of the following aren't found..."
2403 say=offhand
2404 for file in $trylist; do
2405         eval xxx=\$$file
2406         case "$xxx" in
2407         /*|?:[\\/]*)
2408                 if test -f "$xxx"; then
2409                         : ok
2410                 else
2411                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2412                         xxx=`./loc $file $file $pth`
2413                 fi
2414                 ;;
2415         '') xxx=`./loc $file $file $pth`;;
2416         *) xxx=`./loc $xxx $xxx $pth`;;
2417         esac
2418         eval $file=$xxx$_exe
2419         eval _$file=$xxx
2420         case "$xxx" in
2421         /*)
2422                 echo $file is in $xxx.
2423                 ;;
2424         ?:[\\/]*)
2425                 echo $file is in $xxx.
2426                 ;;
2427         *)
2428                 echo "I don't see $file out there, $say."
2429                 say=either
2430                 ;;
2431         esac
2432 done
2433 case "$egrep" in
2434 egrep)
2435         echo "Substituting grep for egrep."
2436         egrep=$grep
2437         _egrep=$grep
2438         ;;
2439 esac
2440 case "$ln" in
2441 ln)
2442         echo "Substituting cp for ln."
2443         ln=$cp
2444         _ln=$cp
2445         ;;
2446 esac
2447 case "$make" in
2448 make)
2449         case "$gmake" in
2450         gmake)
2451         echo "I can't find make or gmake, and my life depends on it." >&4
2452         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2453         exit 1
2454         ;;
2455         esac
2456         ;;
2457 esac
2458 case "$gmake" in
2459 gmake)  ;;
2460 *)      # We can't have osname yet.
2461         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2462                 # Assume that gmake, if found, is definitely GNU make
2463                 # and prefer it over the system make.
2464                 echo "Substituting gmake for make."
2465                 make=$gmake
2466                 _make=$gmake
2467         fi
2468         ;;
2469 esac
2470 case "$test" in
2471 test)
2472         echo "Hopefully test is built into your sh."
2473         ;;
2474 *)
2475         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2476                 echo "Using the test built into your sh."
2477                 test=test
2478                 _test=test
2479         fi
2480         ;;
2481 esac
2482 case "$echo" in
2483 echo)
2484         echo "Hopefully echo is built into your sh."
2485         ;;
2486 '') ;;
2487 *)
2488         echo " "
2489 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2490         $echo $n "hi there$c" >foo1
2491         echo $n "hi there$c" >foo2
2492         if cmp foo1 foo2 >/dev/null 2>&1; then
2493                 echo "They are compatible.  In fact, they may be identical."
2494         else
2495                 case "$n" in
2496                 '-n') n='' c='\c';;
2497                 *) n='-n' c='';;
2498                 esac
2499                 cat <<FOO
2500 They are not compatible!  You are probably running ksh on a non-USG system.
2501 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2502 have echo built in and we may have to run some Bourne shell scripts.  That
2503 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2504
2505 FOO
2506                 $echo $n "The star should be here-->$c"
2507                 $echo "*"
2508         fi
2509         $rm -f foo1 foo2
2510         ;;
2511 esac
2512
2513 # This question was auctioned at YAPC::Europe-2007 in Vienna
2514 # I never promised you could answer it. I only auctioned the question.
2515 cat <<FOO
2516 The following message is sponsored by
2517
2518   Dresden.pm<--The stars should be here.
2519
2520 Dear Perl user, system administrator or package
2521 maintainer, the Perl community sends greetings to
2522 you. Do you (emblematical) greet back [Y/n]? n
2523
2524 FOO
2525
2526 : Check what type of C compiler we use
2527 cat <<EOS >trygcc
2528 $startsh
2529 EOS
2530 cat <<'EOSC' >>trygcc
2531 case "$cc" in
2532 '') ;;
2533 *)  $rm -f try try.*
2534     $cat >try.c <<EOM
2535 int main(int argc, char *argv[]) {
2536   return 0;
2537 }
2538 EOM
2539     if $cc -o try $ccflags $ldflags try.c; then
2540        :
2541     else
2542         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2543         despair=yes
2544         trygcc=yes
2545         case "$cc" in
2546         *gcc*) trygcc=no ;;
2547         esac
2548         # Skip this test because it gives a false match on output like:
2549         #    ./trygcc: line 23: cc: command not found
2550         # case "`$cc -v -c try.c 2>&1`" in
2551         # *gcc*) trygcc=no ;;
2552         # esac
2553         if $test X"$trygcc" = Xyes; then
2554             if gcc -o try -c try.c; then
2555                 echo " "
2556                 echo "You seem to have a working gcc, though." >&4
2557                 # Switching compilers may undo the work of hints files.
2558                 # The most common problem is -D_REENTRANT for threads.
2559                 # This heuristic catches that case, but gets false positives
2560                 # if -Dusethreads was not actually specified.  Better to
2561                 # bail out here with a useful message than fail 
2562                 # mysteriously later. Should we perhaps just try to
2563                 # re-invoke Configure -Dcc=gcc config_args ?
2564                 if $test -f usethreads.cbu; then
2565                         $cat >&4 <<EOM 
2566
2567 *** However, any setting of the C compiler flags (e.g. for thread support)
2568 *** will be lost.  It may be necessary for you to restart Configure and
2569 *** add -Dcc=gcc to your Configure command line.
2570
2571 EOM
2572                         rp="Would you like to go ahead and try gcc anyway?"
2573                         dflt=n
2574                 else
2575                         rp="Would you like to use it?"
2576                         dflt=y
2577                 fi
2578                 if $test -f myread; then
2579                     . ./myread
2580                 else
2581                     if $test -f UU/myread; then
2582                         . ./UU/myread
2583                     else
2584                         echo "Cannot find myread, sorry.  Aborting." >&2
2585                         exit 1
2586                     fi
2587                 fi  
2588                 case "$ans" in
2589                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2590                 esac
2591             fi
2592         fi
2593     fi
2594     $rm -f try try.*
2595     ;;
2596 esac
2597 EOSC
2598
2599 cat <<EOS >checkcc
2600 $startsh
2601 EOS
2602 cat <<'EOSC' >>checkcc
2603 case "$cc" in        
2604 '') ;;
2605 *)  $rm -f try try.*              
2606     $cat >try.c <<EOM
2607 int main(int argc, char *argv[]) {
2608   return 0;
2609 }
2610 EOM
2611     if $cc -o try $ccflags $ldflags try.c; then
2612        :
2613     else
2614         if $test X"$despair" = Xyes; then
2615            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2616         fi
2617         $cat >&4 <<EOM         
2618 You need to find a working C compiler.
2619 Either (purchase and) install the C compiler supplied by your OS vendor,
2620 or for a free C compiler try http://gcc.gnu.org/
2621 I cannot continue any further, aborting.
2622 EOM
2623         exit 1
2624     fi
2625     $rm -f try try.*
2626     ;;
2627 esac
2628 EOSC
2629
2630 : determine whether symbolic links are supported
2631 echo " "
2632 $touch blurfl
2633 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2634         echo "Symbolic links are supported." >&4
2635         lns="$ln -s"
2636 else
2637         echo "Symbolic links are NOT supported." >&4
2638         lns="$ln"
2639 fi
2640 $rm -f blurfl sym
2641
2642 : determine whether symbolic links are supported
2643 echo " "
2644 case "$lns" in
2645 *"ln"*" -s")
2646         echo "Checking how to test for symbolic links..." >&4
2647         $lns blurfl sym
2648         if $test "X$issymlink" = X; then
2649                 case "$newsh" in
2650                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2651                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2652                 esac
2653                 if test $? = 0; then
2654                         issymlink="test -h"
2655                 else
2656                         echo "Your builtin 'test -h' may be broken." >&4
2657                         case "$test" in
2658                         /*)     ;;
2659                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2660                                 for p in $pth
2661                                 do
2662                                         if test -f "$p/$test"; then
2663                                                 test="$p/$test"
2664                                                 break
2665                                         fi
2666                                 done
2667                                 ;;
2668                         esac
2669                         case "$test" in
2670                         /*)
2671                                 echo "Trying external '$test -h'." >&4
2672                                 issymlink="$test -h"
2673                                 if $test ! -h sym >/dev/null 2>&1; then
2674                                         echo "External '$test -h' is broken, too." >&4
2675                                         issymlink=''
2676                                 fi
2677                                 ;;
2678                         *)      issymlink='' ;;
2679                         esac
2680                 fi              
2681         fi
2682         if $test "X$issymlink" = X; then
2683                 if $test -L sym 2>/dev/null; then
2684                         issymlink="$test -L"
2685                         echo "The builtin '$test -L' worked." >&4
2686                 fi
2687         fi
2688         if $test "X$issymlink" != X; then
2689                 echo "You can test for symbolic links with '$issymlink'." >&4
2690         else
2691                 echo "I do not know how you can test for symbolic links." >&4
2692         fi
2693         $rm -f blurfl sym
2694         ;;
2695 *)      echo "No symbolic links, so not testing for their testing..." >&4
2696         ;;
2697 esac
2698 echo " "
2699
2700 : Make symlinks util
2701 case "$mksymlinks" in
2702 $define|true|[yY]*)
2703         case "$src" in
2704         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2705                 exit 1
2706                 ;;
2707         *)      case "$lns:$issymlink" in
2708                 *"ln"*" -s:"*"test -"?)
2709                         echo "Creating the symbolic links..." >&4
2710                         echo "(First creating the subdirectories...)" >&4
2711                         cd ..
2712                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2713                                 read directory
2714                                 test -z "$directory" && break
2715                                 mkdir -p $directory
2716                         done
2717                         # Sanity check 1.
2718                         if test ! -d t/base; then
2719                                 echo "Failed to create the subdirectories.  Aborting." >&4
2720                                 exit 1
2721                         fi
2722                         echo "(Then creating the symlinks...)" >&4
2723                         awk '{print $1}' $src/MANIFEST | while true; do
2724                                 read filename
2725                                 test -z "$filename" && break
2726                                 if test -f $filename; then
2727                                         if $issymlink $filename; then
2728                                                 rm -f $filename
2729                                         fi
2730                                 fi
2731                                 if test -f $filename; then
2732                                         echo "$filename already exists, not symlinking."
2733                                 else
2734                                         ln -s $src/$filename $filename
2735                                 fi
2736                         done
2737                         # Sanity check 2.
2738                         if test ! -f t/base/lex.t; then
2739                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2740                                 exit 1
2741                         fi
2742                         cd UU
2743                         ;;
2744                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2745                         ;;
2746                 esac
2747                 ;;
2748         esac
2749         ;;
2750 esac
2751
2752 : Check for Cross-Compilation
2753 case "$usecrosscompile" in
2754 $define|true|[yY]*)
2755         $echo "Cross-compiling..."
2756         croak=''
2757         case "$cc" in
2758         *-*-gcc) # A cross-compiling gcc, probably.
2759             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2760             ar=$targetarch-ar
2761             # leave out ld, choosing it is more complex
2762             nm=$targetarch-nm
2763             ranlib=$targetarch-ranlib
2764             $echo 'extern int foo;' > try.c
2765             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2766             shift
2767             if $test $# -gt 0; then
2768                 incpth="$incpth $*"
2769                 incpth="`$echo $incpth|$sed 's/^ //'`"
2770                 echo "Guessing incpth '$incpth'." >&4
2771                 for i in $*; do
2772                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2773                     if $test -d $j; then
2774                         libpth="$libpth $j"
2775                     fi
2776                 done   
2777                 libpth="`$echo $libpth|$sed 's/^ //'`"
2778                 echo "Guessing libpth '$libpth'." >&4
2779             fi
2780             $rm -f try.c
2781             ;;
2782         esac
2783         case "$targetarch" in
2784         '') echo "Targetarch not defined." >&4; croak=y ;;
2785         *)  echo "Using targetarch $targetarch." >&4 ;;
2786         esac
2787         case "$incpth" in
2788         '') echo "Incpth not defined." >&4; croak=y ;;
2789         *)  echo "Using incpth '$incpth'." >&4 ;;
2790         esac
2791         case "$libpth" in
2792         '') echo "Libpth not defined." >&4; croak=y ;;
2793         *)  echo "Using libpth '$libpth'." >&4 ;;
2794         esac
2795         case "$usrinc" in
2796         '') for i in $incpth; do
2797                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2798                     usrinc=$i
2799                     echo "Guessing usrinc $usrinc." >&4
2800                     break
2801                 fi
2802             done
2803             case "$usrinc" in
2804             '') echo "Usrinc not defined." >&4; croak=y ;;
2805             esac
2806             ;;
2807         *)  echo "Using usrinc $usrinc." >&4 ;;
2808         esac
2809         case "$targethost" in
2810         '') echo "Targethost not defined." >&4; croak=y ;;
2811         *)  echo "Using targethost $targethost." >&4
2812         esac
2813         locincpth=' '
2814         loclibpth=' '
2815         case "$croak" in
2816         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2817         esac
2818         case "$src" in
2819         /*) run=$src/Cross/run
2820             targetmkdir=$src/Cross/mkdir
2821             to=$src/Cross/to
2822             from=$src/Cross/from
2823             ;;
2824         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2825             run=$pwd/Cross/run
2826             targetmkdir=$pwd/Cross/mkdir
2827             to=$pwd/Cross/to
2828             from=$pwd/Cross/from
2829             ;;
2830         esac
2831         case "$targetrun" in
2832         '') targetrun=ssh ;;
2833         esac
2834         case "$targetto" in
2835         '') targetto=scp ;;
2836         esac
2837         case "$targetfrom" in
2838         '') targetfrom=scp ;;
2839         esac
2840         run=$run-$targetrun
2841         to=$to-$targetto
2842         from=$from-$targetfrom
2843         case "$targetdir" in
2844         '')  targetdir=/tmp
2845              echo "Guessing targetdir $targetdir." >&4
2846              ;;
2847         esac
2848         case "$targetuser" in
2849         '')  targetuser=root
2850              echo "Guessing targetuser $targetuser." >&4
2851              ;;
2852         esac
2853         case "$targetfrom" in
2854         scp)    q=-q ;;
2855         *)      q='' ;;
2856         esac
2857         case "$targetrun" in
2858         ssh|rsh)
2859             cat >$run <<EOF
2860 #!/bin/sh
2861 case "\$1" in
2862 -cwd)
2863   shift
2864   cwd=\$1
2865   shift
2866   ;;
2867 esac
2868 case "\$cwd" in
2869 '') cwd=$targetdir ;;
2870 esac
2871 exe=\$1
2872 shift
2873 if $test ! -f \$exe.xok; then
2874   $to \$exe
2875   $touch \$exe.xok
2876 fi
2877 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2878 EOF
2879             ;;
2880         *)  echo "Unknown targetrun '$targetrun'" >&4
2881             exit 1
2882             ;;
2883         esac
2884         case "$targetmkdir" in
2885         */Cross/mkdir)
2886             cat >$targetmkdir <<EOF
2887 #!/bin/sh
2888 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2889 EOF
2890             $chmod a+rx $targetmkdir
2891             ;;
2892         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2893             exit 1
2894             ;;
2895         esac
2896         case "$targetto" in
2897         scp|rcp)
2898             cat >$to <<EOF
2899 #!/bin/sh
2900 for f in \$@
2901 do
2902   case "\$f" in
2903   /*)
2904     $targetmkdir \`dirname \$f\`
2905     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2906     ;;
2907   *)
2908     $targetmkdir $targetdir/\`dirname \$f\`
2909     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2910     ;;
2911   esac
2912 done
2913 exit 0
2914 EOF
2915             ;;
2916         cp) cat >$to <<EOF
2917 #!/bin/sh
2918 for f in \$@
2919 do
2920   case "\$f" in
2921   /*)
2922     $mkdir -p $targetdir/\`dirname \$f\`
2923     $cp \$f $targetdir/\$f || exit 1
2924     ;;
2925   *)
2926     $targetmkdir $targetdir/\`dirname \$f\`
2927     $cp \$f $targetdir/\$f || exit 1
2928     ;;
2929   esac
2930 done
2931 exit 0
2932 EOF
2933             ;;
2934         *)  echo "Unknown targetto '$targetto'" >&4
2935             exit 1
2936             ;;
2937         esac
2938         case "$targetfrom" in
2939         scp|rcp)
2940           cat >$from <<EOF
2941 #!/bin/sh
2942 for f in \$@
2943 do
2944   $rm -f \$f
2945   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2946 done
2947 exit 0
2948 EOF
2949             ;;
2950         cp) cat >$from <<EOF
2951 #!/bin/sh
2952 for f in \$@
2953 do
2954   $rm -f \$f
2955   cp $targetdir/\$f . || exit 1
2956 done
2957 exit 0
2958 EOF
2959             ;;
2960         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2961             exit 1
2962             ;;
2963         esac
2964         if $test ! -f $run; then
2965             echo "Target 'run' script '$run' not found." >&4
2966         else
2967             $chmod a+rx $run
2968         fi
2969         if $test ! -f $to; then
2970             echo "Target 'to' script '$to' not found." >&4
2971         else
2972             $chmod a+rx $to
2973         fi
2974         if $test ! -f $from; then
2975             echo "Target 'from' script '$from' not found." >&4
2976         else
2977             $chmod a+rx $from
2978         fi
2979         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2980             exit 1
2981         fi
2982         cat >&4 <<EOF
2983 Using '$run' for remote execution,
2984 and '$from' and '$to'
2985 for remote file transfer.
2986 EOF
2987         ;;
2988 *)      run=''
2989         to=:
2990         from=:
2991         usecrosscompile='undef'
2992         targetarch=''
2993         ;;
2994 esac
2995
2996 : see whether [:lower:] and [:upper:] are supported character classes
2997 echo " "
2998 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2999 ABYZ)
3000         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3001         up='[:upper:]'
3002         low='[:lower:]'
3003         ;;
3004 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3005         # (0xd9 and 0xe2), therefore that is a nice testing point.
3006         if test "X$up" = X -o "X$low" = X; then
3007             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3008             rs) up='[A-Z]'
3009                 low='[a-z]'
3010                 ;;
3011             esac
3012         fi
3013         if test "X$up" = X -o "X$low" = X; then
3014             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3015             rs) up='A-Z'
3016                 low='a-z'
3017                 ;;
3018             esac
3019         fi
3020         if test "X$up" = X -o "X$low" = X; then
3021             case "`echo RS | od -x 2>/dev/null`" in
3022             *D9E2*|*d9e2*)
3023                 echo "Hey, this might be EBCDIC." >&4
3024                 if test "X$up" = X -o "X$low" = X; then
3025                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3026                     rs) up='[A-IJ-RS-Z]'
3027                         low='[a-ij-rs-z]'
3028                         ;;
3029                     esac
3030                 fi
3031                 if test "X$up" = X -o "X$low" = X; then
3032                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3033                     rs) up='A-IJ-RS-Z'
3034                         low='a-ij-rs-z'
3035                         ;;
3036                     esac
3037                 fi
3038                 ;;
3039             esac
3040         fi
3041 esac
3042 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3043 rs)
3044     echo "Using $up and $low to convert case." >&4
3045     ;;
3046 *)
3047     echo "I don't know how to translate letters from upper to lower case." >&4
3048     echo "Your tr is not acting any way I know of." >&4
3049     exit 1
3050     ;;
3051 esac
3052 : set up the translation script tr, must be called with ./tr of course
3053 cat >tr <<EOSC
3054 $startsh
3055 case "\$1\$2" in
3056 '[A-Z][a-z]') exec $tr '$up' '$low';;
3057 '[a-z][A-Z]') exec $tr '$low' '$up';;
3058 esac
3059 exec $tr "\$@"
3060 EOSC
3061 chmod +x tr
3062 $eunicefix tr
3063
3064 : Try to determine whether config.sh was made on this system
3065 case "$config_sh" in
3066 '')
3067 myuname=`$uname -a 2>/dev/null`
3068 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3069 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3070 # because the A-Z/a-z are not consecutive.
3071 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3072         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3073 newmyuname="$myuname"
3074 dflt=n
3075 case "$knowitall" in
3076 '')
3077         if test -f ../config.sh; then
3078                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3079                         eval "`grep myuname= ../config.sh`"
3080                 fi
3081                 if test "X$myuname" = "X$newmyuname"; then
3082                         dflt=y
3083                 fi
3084         fi
3085         ;;
3086 *) dflt=y;;
3087 esac
3088
3089 : Get old answers from old config file if Configure was run on the
3090 : same system, otherwise use the hints.
3091 hint=default
3092 cd ..
3093 if test -f config.sh; then
3094         echo " "
3095         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3096         . UU/myread
3097         case "$ans" in
3098         n*|N*) echo "OK, I'll ignore it."
3099                 mv config.sh config.sh.old
3100                 myuname="$newmyuname"
3101                 ;;
3102         *)  echo "Fetching default answers from your old config.sh file..." >&4
3103                 tmp_n="$n"
3104                 tmp_c="$c"
3105                 tmp_sh="$sh"
3106                 . ./config.sh
3107                 cp config.sh UU
3108                 n="$tmp_n"
3109                 c="$tmp_c"
3110                 : Older versions did not always set $sh.  Catch re-use of such
3111                 : an old config.sh.
3112                 case "$sh" in
3113                 '') sh="$tmp_sh" ;;
3114                 esac
3115                 hint=previous
3116                 ;;
3117         esac
3118 fi
3119 . ./UU/checkcc
3120 if test ! -f config.sh; then
3121         $cat <<EOM
3122
3123 First time through, eh?  I have some defaults handy for some systems
3124 that need some extra help getting the Configure answers right:
3125
3126 EOM
3127         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3128         dflt=''
3129         : Half the following guesses are probably wrong... If you have better
3130         : tests or hints, please send them to perlbug@perl.org
3131         : The metaconfig authors would also appreciate a copy...
3132         $test -f /irix && osname=irix
3133         $test -f /xenix && osname=sco_xenix
3134         $test -f /dynix && osname=dynix
3135         $test -f /dnix && osname=dnix
3136         $test -f /lynx.os && osname=lynxos
3137         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3138         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3139         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3140         $test -f /bin/mips && /bin/mips && osname=mips
3141         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3142                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3143         $test -d /usr/apollo/bin && osname=apollo
3144         $test -f /etc/saf/_sactab && osname=svr4
3145         $test -d /usr/include/minix && osname=minix
3146         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3147         if $test -d /MachTen -o -d /MachTen_Folder; then
3148                 osname=machten
3149                 if $test -x /sbin/version; then
3150                         osvers=`/sbin/version | $awk '{print $2}' |
3151                         $sed -e 's/[A-Za-z]$//'`
3152                 elif $test -x /usr/etc/version; then
3153                         osvers=`/usr/etc/version | $awk '{print $2}' |
3154                         $sed -e 's/[A-Za-z]$//'`
3155                 else
3156                         osvers="$2.$3"
3157                 fi
3158         fi
3159
3160         $test -f /sys/posix.dll &&
3161                 $test -f /usr/bin/what &&
3162                 set X `/usr/bin/what /sys/posix.dll` &&
3163                 $test "$3" = UWIN &&
3164                 osname=uwin &&
3165                 osvers="$5"
3166
3167         if $test -f $uname; then
3168                 set X $myuname
3169                 shift
3170
3171                 case "$5" in
3172                 fps*) osname=fps ;;
3173                 mips*)
3174                         case "$4" in
3175                         umips) osname=umips ;;
3176                         *) osname=mips ;;
3177                         esac;;
3178                 [23]100) osname=mips ;;
3179                 next*) osname=next ;;
3180                 i386*)
3181                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3182                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3183                                 osname='sco'
3184                                 osvers=$tmp
3185                         elif $test -f /etc/kconfig; then
3186                                 osname=isc
3187                                 if test "$lns" = "$ln -s"; then
3188                                         osvers=4
3189                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3190                                         osvers=3
3191                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3192                                         osvers=2
3193                                 fi
3194                         fi
3195                         tmp=''
3196                         ;;
3197                 pc*)
3198                         if test -n "$DJGPP"; then
3199                                 osname=dos
3200                                 osvers=djgpp
3201                         fi
3202                         ;;
3203                 esac
3204
3205                 case "$1" in
3206                 aix) osname=aix
3207                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3208                         case "$tmp" in
3209                         # oslevel can fail with:
3210                         # oslevel: Unable to acquire lock.
3211                         *not\ found) osvers="$4"."$3" ;;
3212                         '<3240'|'<>3240') osvers=3.2.0 ;;
3213                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3214                         '=3250'|'>3250') osvers=3.2.5 ;;
3215                         *) osvers=$tmp;;
3216                         esac
3217                         ;;
3218                 bsd386) osname=bsd386
3219                         osvers=`$uname -r`
3220                         ;;
3221                 cygwin*) osname=cygwin
3222                         osvers="$3"
3223                         ;;
3224                 *dc.osx) osname=dcosx
3225                         osvers="$3"
3226                         ;;
3227                 dnix) osname=dnix
3228                         osvers="$3"
3229                         ;;
3230                 domainos) osname=apollo
3231                         osvers="$3"
3232                         ;;
3233                 dgux)   osname=dgux
3234                         osvers="$3"
3235                         ;;
3236                 dragonfly) osname=dragonfly
3237                         osvers="$3"
3238                         ;;
3239                 dynixptx*) osname=dynixptx
3240                         osvers=`echo "$4"|sed 's/^v//'`
3241                         ;;
3242                 freebsd) osname=freebsd
3243                         osvers="$3" ;;
3244                 genix)  osname=genix ;;
3245                 gnu)    osname=gnu
3246                         osvers="$3" ;;
3247                 hp*)    osname=hpux
3248                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3249                         ;;
3250                 irix*)  osname=irix
3251                         case "$3" in
3252                         4*) osvers=4 ;;
3253                         5*) osvers=5 ;;
3254                         *)      osvers="$3" ;;
3255                         esac
3256                         ;;
3257                 linux)  osname=linux
3258                         case "$3" in
3259                         *)      osvers="$3" ;;
3260                         esac
3261                         ;;
3262                 MiNT)   osname=mint
3263                         ;;
3264                 netbsd*) osname=netbsd
3265                         osvers="$3"
3266                         ;;
3267                 news-os) osvers="$3"
3268                         case "$3" in
3269                         4*) osname=newsos4 ;;
3270                         *) osname=newsos ;;
3271                         esac
3272                         ;;
3273                 next*) osname=next ;;
3274                 nonstop-ux) osname=nonstopux ;;
3275                 openbsd) osname=openbsd
3276                         osvers="$3"
3277                         ;;
3278                 os2)    osname=os2
3279                         osvers="$4"
3280                         ;;
3281                 POSIX-BC | posix-bc ) osname=posix-bc
3282                         osvers="$3"
3283                         ;;
3284                 powerux | power_ux | powermax_os | powermaxos | \
3285                 powerunix | power_unix) osname=powerux
3286                         osvers="$3"
3287                         ;;
3288                 qnx) osname=qnx
3289                         osvers="$4"
3290                         ;;
3291                 solaris) osname=solaris
3292                         case "$3" in
3293                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3294                         *)      osvers="$3" ;;
3295                         esac
3296                         ;;
3297                 sunos) osname=sunos
3298                         case "$3" in
3299                         5*) osname=solaris
3300                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3301                         *)      osvers="$3" ;;
3302                         esac
3303                         ;;
3304                 titanos) osname=titanos
3305                         case "$3" in
3306                         1*) osvers=1 ;;
3307                         2*) osvers=2 ;;
3308                         3*) osvers=3 ;;
3309                         4*) osvers=4 ;;
3310                         *)      osvers="$3" ;;
3311                         esac
3312                         ;;
3313                 ultrix) osname=ultrix
3314                         osvers="$3"
3315                         ;;
3316                 osf1|mls+)      case "$5" in
3317                                 alpha)
3318                                         osname=dec_osf
3319                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3320                                         case "$osvers" in
3321                                         [1-9].[0-9]*) ;;
3322                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3323                                         esac
3324                                         ;;
3325                         hp*)    osname=hp_osf1  ;;
3326                         mips)   osname=mips_osf1 ;;
3327                         esac
3328                         ;;
3329                 # UnixWare 7.1.2 is known as Open UNIX 8
3330                 openunix|unixware) osname=svr5
3331                         osvers="$4"
3332                         ;;
3333                 uts)    osname=uts
3334                         osvers="$3"
3335                         ;;
3336                 vos) osvers="$3"
3337                         ;;
3338                 $2) case "$osname" in
3339                         *isc*) ;;
3340                         *freebsd*) ;;
3341                         svr*)
3342                                 : svr4.x or possibly later
3343                                 case "svr$3" in
3344                                 ${osname}*)
3345                                         osname=svr$3
3346                                         osvers=$4
3347                                         ;;
3348                                 esac
3349                                 case "$osname" in
3350                                 svr4.0)
3351                                         : Check for ESIX
3352                                         if test -f /stand/boot ; then
3353                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3354                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3355                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3356                                                         if test -n "$isesix"; then
3357                                                                 osname=esix4
3358                                                         fi
3359                                                 fi
3360                                         fi
3361                                         ;;
3362                                 esac
3363                                 ;;
3364                         *)      if test -f /etc/systemid; then
3365                                         osname=sco
3366                                         set `echo $3 | $sed 's/\./ /g'` $4
3367                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3368                                                 osvers=$1.$2.$3
3369                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3370                                                 osvers=$1.$2
3371                                         elif $test -f $src/hints/sco_$1.sh; then
3372                                                 osvers=$1
3373                                         fi
3374                                 else
3375                                         case "$osname" in
3376                                         '') : Still unknown.  Probably a generic Sys V.
3377                                                 osname="sysv"
3378                                                 osvers="$3"
3379                                                 ;;
3380                                         esac
3381                                 fi
3382                                 ;;
3383                         esac
3384                         ;;
3385                 *)      case "$osname" in
3386                         '') : Still unknown.  Probably a generic BSD.
3387                                 osname="$1"
3388                                 osvers="$3"
3389                                 ;;
3390                         esac
3391                         ;;
3392                 esac
3393         else
3394                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3395                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3396                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3397                                 osname=news_os
3398                         fi
3399                         $rm -f UU/kernel.what
3400                 elif test -d c:/. -o -n "$is_os2" ; then
3401                         set X $myuname
3402                         osname=os2
3403                         osvers="$5"
3404                 fi
3405         fi
3406
3407         case "$targetarch" in
3408         '') ;;
3409         *)  hostarch=$osname
3410             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3411             osvers=''
3412             ;;
3413         esac
3414
3415         : Now look for a hint file osname_osvers, unless one has been
3416         : specified already.
3417         case "$hintfile" in
3418         ''|' ')
3419                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3420                 : Also try without trailing minor version numbers.
3421                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3422                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3423                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3424                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3425                 case "$file" in
3426                 '') dflt=none ;;
3427                 *)  case "$osvers" in
3428                         '') dflt=$file
3429                                 ;;
3430                         *)  if $test -f $src/hints/$file.sh ; then
3431                                         dflt=$file
3432                                 elif $test -f $src/hints/$xfile.sh ; then
3433                                         dflt=$xfile
3434                                 elif $test -f $src/hints/$xxfile.sh ; then
3435                                         dflt=$xxfile
3436                                 elif $test -f $src/hints/$xxxfile.sh ; then
3437                                         dflt=$xxxfile
3438                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3439                                         dflt=$xxxxfile
3440                                 elif $test -f "$src/hints/${osname}.sh" ; then
3441                                         dflt="${osname}"
3442                                 else
3443                                         dflt=none
3444                                 fi
3445                                 ;;
3446                         esac
3447                         ;;
3448                 esac
3449                 if $test -f Policy.sh ; then
3450                         case "$dflt" in
3451                         *Policy*) ;;
3452                         none) dflt="Policy" ;;
3453                         *) dflt="Policy $dflt" ;;
3454                         esac
3455                 fi
3456                 ;;
3457         *)
3458                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3459                 ;;
3460         esac
3461
3462         if $test -f Policy.sh ; then
3463                 $cat <<EOM
3464
3465 There's also a Policy hint file available, which should make the
3466 site-specific (policy) questions easier to answer.
3467 EOM
3468
3469         fi
3470
3471         $cat <<EOM
3472
3473 You may give one or more space-separated answers, or "none" if appropriate.
3474 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3475 previous run of Configure, you may specify it as well as or instead of
3476 OS-specific hints.  If hints are provided for your OS, you should use them:
3477 although Perl can probably be built without hints on many platforms, using
3478 hints often improve performance and may enable features that Configure can't
3479 set up on its own. If there are no hints that match your OS, specify "none";
3480 DO NOT give a wrong version or a wrong OS.
3481
3482 EOM
3483
3484         rp="Which of these apply, if any?"
3485         . UU/myread
3486         tans=$ans
3487         for file in $tans; do
3488                 if $test X$file = XPolicy -a -f Policy.sh; then
3489                         . Policy.sh
3490                         $cat Policy.sh >> UU/config.sh
3491                 elif $test -f $src/hints/$file.sh; then
3492                         . $src/hints/$file.sh
3493                         $cat $src/hints/$file.sh >> UU/config.sh
3494                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3495                         : nothing
3496                 else
3497                         : Give one chance to correct a possible typo.
3498                         echo "$file.sh does not exist"
3499                         dflt=$file
3500                         rp="hint to use instead?"
3501                         . UU/myread
3502                         for file in $ans; do
3503                                 if $test -f "$src/hints/$file.sh"; then
3504                                         . $src/hints/$file.sh
3505                                         $cat $src/hints/$file.sh >> UU/config.sh
3506                                 elif $test X$ans = X -o X$ans = Xnone ; then
3507                                         : nothing
3508                                 else
3509                                         echo "$file.sh does not exist -- ignored."
3510                                 fi
3511                         done
3512                 fi
3513         done
3514
3515         hint=recommended
3516         : Remember our hint file for later.
3517         if $test -f "$src/hints/$file.sh" ; then
3518                 hintfile="$file"
3519         else
3520                 hintfile=''
3521         fi
3522 fi
3523 cd UU
3524 ;;
3525 *)
3526         echo " "
3527         echo "Fetching default answers from $config_sh..." >&4
3528         tmp_n="$n"
3529         tmp_c="$c"
3530         cd ..
3531         cp $config_sh config.sh 2>/dev/null
3532         chmod +w config.sh
3533         . ./config.sh
3534         cd UU
3535         cp ../config.sh .
3536         n="$tmp_n"
3537         c="$tmp_c"
3538         hint=previous
3539         ;;
3540 esac
3541 test "$override" && . ./optdef.sh
3542
3543 : Restore computed paths
3544 for file in $loclist $trylist; do
3545         eval $file="\$_$file"
3546 done
3547
3548 cat << EOM
3549
3550 Configure uses the operating system name and version to set some defaults.
3551 The default value is probably right if the name rings a bell. Otherwise,
3552 since spelling matters for me, either accept the default or answer "none"
3553 to leave it blank.
3554
3555 EOM
3556 case "$osname" in
3557         ''|' ')
3558                 case "$hintfile" in
3559                 ''|' '|none) dflt=none ;;
3560                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3561                 esac
3562                 ;;
3563         *) dflt="$osname" ;;
3564 esac
3565 rp="Operating system name?"
3566 . ./myread
3567 case "$ans" in
3568 none)  osname='' ;;
3569 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3570 esac
3571 echo " "
3572 case "$osvers" in
3573         ''|' ')
3574                 case "$hintfile" in
3575                 ''|' '|none) dflt=none ;;
3576                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3577                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3578                         case "$dflt" in
3579                         ''|' ') dflt=none ;;
3580                         esac
3581                         ;;
3582                 esac
3583                 ;;
3584         *) dflt="$osvers" ;;
3585 esac
3586 rp="Operating system version?"
3587 . ./myread
3588 case "$ans" in
3589 none)  osvers='' ;;
3590 *) osvers="$ans" ;;
3591 esac
3592
3593
3594 . ./posthint.sh
3595
3596 : who configured the system
3597 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3598 case "$cf_by" in
3599 "")
3600         cf_by=`(logname) 2>/dev/null`
3601         case "$cf_by" in
3602         "")
3603                 cf_by=`(whoami) 2>/dev/null`
3604                 case "$cf_by" in
3605                 "") cf_by=unknown ;;
3606                 esac ;;
3607         esac ;;
3608 esac
3609
3610 : decide how portable to be.  Allow command line overrides.
3611 case "$d_portable" in
3612 "$undef") ;;
3613 *)      d_portable="$define" ;;
3614 esac
3615
3616 : set up shell script to do ~ expansion
3617 cat >filexp <<EOSS
3618 $startsh
3619 : expand filename
3620 case "\$1" in
3621  \~/*|\~)
3622         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3623         ;;
3624  \~*)
3625         if $test -f /bin/csh; then
3626                 /bin/csh -f -c "glob \$1"
3627                 failed=\$?
3628                 echo ""
3629                 exit \$failed
3630         else
3631                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3632                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3633                 if $test ! -d "\$dir"; then
3634                         me=\`basename \$0\`
3635                         echo "\$me: can't locate home directory for: \$name" >&2
3636                         exit 1
3637                 fi
3638                 case "\$1" in
3639                 */*)
3640                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3641                         ;;
3642                 *)
3643                         echo \$dir
3644                         ;;
3645                 esac
3646         fi
3647         ;;
3648 *)
3649         echo \$1
3650         ;;
3651 esac
3652 EOSS
3653 chmod +x filexp
3654 $eunicefix filexp
3655
3656 : now set up to get a file name
3657 cat <<EOS >getfile
3658 $startsh
3659 EOS
3660 cat <<'EOSC' >>getfile
3661 tilde=''
3662 fullpath=''
3663 already=''
3664 skip=''
3665 none_ok=''
3666 exp_file=''
3667 nopath_ok=''
3668 orig_rp="$rp"
3669 orig_dflt="$dflt"
3670 case "$gfpth" in
3671 '') gfpth='.' ;;
3672 esac
3673
3674 case "$fn" in
3675 *\(*)
3676         : getfile will accept an answer from the comma-separated list
3677         : enclosed in parentheses even if it does not meet other criteria.
3678         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3679         fn=`echo $fn | sed 's/(.*)//'`
3680         ;;
3681 esac
3682
3683 case "$fn" in
3684 *:*)
3685         loc_file=`expr $fn : '.*:\(.*\)'`
3686         fn=`expr $fn : '\(.*\):.*'`
3687         ;;
3688 esac
3689
3690 case "$fn" in
3691 *~*) tilde=true;;
3692 esac
3693 case "$fn" in
3694 */*) fullpath=true;;
3695 esac
3696 case "$fn" in
3697 *+*) skip=true;;
3698 esac
3699 case "$fn" in
3700 *n*) none_ok=true;;
3701 esac
3702 case "$fn" in
3703 *e*) exp_file=true;;
3704 esac
3705 case "$fn" in
3706 *p*) nopath_ok=true;;
3707 esac
3708
3709 case "$fn" in
3710 *f*) type='File';;
3711 *d*) type='Directory';;
3712 *l*) type='Locate';;
3713 esac
3714
3715 what="$type"
3716 case "$what" in
3717 Locate) what='File';;
3718 esac
3719
3720 case "$exp_file" in
3721 '')
3722         case "$d_portable" in
3723         "$define") ;;
3724         *) exp_file=true;;
3725         esac
3726         ;;
3727 esac
3728
3729 cd ..
3730 while test "$type"; do
3731         redo=''
3732         rp="$orig_rp"
3733         dflt="$orig_dflt"
3734         case "$tilde" in
3735         true) rp="$rp (~name ok)";;
3736         esac
3737         . UU/myread
3738         if test -f UU/getfile.ok && \
3739                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3740         then
3741                 value="$ans"
3742                 ansexp="$ans"
3743                 break
3744         fi
3745         case "$ans" in
3746         none)
3747                 value=''
3748                 ansexp=''
3749                 case "$none_ok" in
3750                 true) type='';;
3751                 esac
3752                 ;;
3753         *)
3754                 case "$tilde" in
3755                 '') value="$ans"
3756                         ansexp="$ans";;
3757                 *)
3758                         value=`UU/filexp $ans`
3759                         case $? in
3760                         0)
3761                                 if test "$ans" != "$value"; then
3762                                         echo "(That expands to $value on this system.)"
3763                                 fi
3764                                 ;;
3765                         *) value="$ans";;
3766                         esac
3767                         ansexp="$value"
3768                         case "$exp_file" in
3769                         '') value="$ans";;
3770                         esac
3771                         ;;
3772                 esac
3773                 case "$fullpath" in
3774                 true)
3775                         case "$ansexp" in
3776                         /*) value="$ansexp" ;;
3777                         [a-zA-Z]:/*) value="$ansexp" ;;
3778                         *)
3779                                 redo=true
3780                                 case "$already" in
3781                                 true)
3782                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3783                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3784                                         ;;
3785                                 *)
3786                                 echo "Please give a full path name, starting with slash." >&4
3787                                         case "$tilde" in
3788                                         true)
3789                                 echo "Note that using ~name is ok provided it expands well." >&4
3790                                                 already=true
3791                                                 ;;
3792                                         esac
3793                                 esac
3794                                 ;;
3795                         esac
3796                         ;;
3797                 esac
3798                 case "$redo" in
3799                 '')
3800                         case "$type" in
3801                         File)
3802                                 for fp in $gfpth; do
3803                                         if test "X$fp" = X.; then
3804                                             pf="$ansexp"
3805                                         else    
3806                                             pf="$fp/$ansexp"
3807                                         fi
3808                                         if test -f "$pf"; then
3809                                                 type=''
3810                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3811                                         then
3812                                                 echo "($value is not a plain file, but that's ok.)"
3813                                                 type=''
3814                                         fi
3815                                         if test X"$type" = X; then
3816                                             value="$pf"
3817                                             break
3818                                         fi
3819                                 done
3820                                 ;;
3821                         Directory)
3822                                 for fp in $gfpth; do
3823                                         if test "X$fp" = X.; then
3824                                             dir="$ans"
3825                                             direxp="$ansexp"
3826                                         else    
3827                                             dir="$fp/$ansexp"
3828                                             direxp="$fp/$ansexp"
3829                                         fi
3830                                         if test -d "$direxp"; then
3831                                                 type=''
3832                                                 value="$dir"
3833                                                 break
3834                                         fi
3835                                 done
3836                                 ;;
3837                         Locate)
3838                                 if test -d "$ansexp"; then
3839                                         echo "(Looking for $loc_file in directory $value.)"
3840                                         value="$value/$loc_file"
3841                                         ansexp="$ansexp/$loc_file"
3842                                 fi
3843                                 if test -f "$ansexp"; then
3844                                         type=''
3845                                 fi
3846                                 case "$nopath_ok" in
3847                                 true)   case "$value" in
3848                                         */*) ;;
3849                                         *)      echo "Assuming $value will be in people's path."
3850                                                 type=''
3851                                                 ;;
3852                                         esac
3853                                         ;;
3854                                 esac
3855                                 ;;
3856                         esac
3857
3858                         case "$skip" in
3859                         true) type='';
3860                         esac
3861
3862                         case "$type" in
3863                         '') ;;
3864                         *)
3865                                 if test "$fastread" = yes; then
3866                                         dflt=y
3867                                 else
3868                                         dflt=n
3869                                 fi
3870                                 rp="$what $value doesn't exist.  Use that name anyway?"
3871                                 . UU/myread
3872                                 dflt=''
3873                                 case "$ans" in
3874                                 y*) type='';;
3875                                 *) echo " ";;
3876                                 esac
3877                                 ;;
3878                         esac
3879                         ;;
3880                 esac
3881                 ;;
3882         esac
3883 done
3884 cd UU
3885 ans="$value"
3886 rp="$orig_rp"
3887 dflt="$orig_dflt"
3888 rm -f getfile.ok
3889 test "X$gfpthkeep" != Xy && gfpth=""
3890 EOSC
3891
3892 : determine root of directory hierarchy where package will be installed.
3893 case "$prefix" in
3894 '')
3895         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3896         ;;
3897 *?/)
3898         dflt=`echo "$prefix" | sed 's/.$//'`
3899         ;;
3900 *)
3901         dflt="$prefix"
3902         ;;
3903 esac
3904 $cat <<EOM
3905
3906 By default, $package will be installed in $dflt/bin, manual pages
3907 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3908 installation directories. Typically this is something like /usr/local.
3909 If you wish to have binaries under /usr/bin but other parts of the
3910 installation under /usr/local, that's ok: you will be prompted
3911 separately for each of the installation directories, the prefix being
3912 only used to set the defaults.
3913
3914 EOM
3915 fn=d~
3916 rp='Installation prefix to use?'
3917 . ./getfile
3918 oldprefix=''
3919 case "$prefix" in
3920 '') ;;
3921 *)
3922         case "$ans" in
3923         "$prefix") ;;
3924         *) oldprefix="$prefix";;
3925         esac
3926         ;;
3927 esac
3928 prefix="$ans"
3929 prefixexp="$ansexp"
3930
3931 : allow them to override the AFS root
3932 case "$afsroot" in
3933 '')     afsroot=/afs ;;
3934 *)      afsroot=$afsroot ;;
3935 esac
3936
3937 : is AFS running?
3938 echo " "
3939 case "$afs" in
3940 $define|true)   afs=true ;;
3941 $undef|false)   afs=false ;;
3942 *)      if $test -d $afsroot; then
3943                 afs=true
3944         else
3945                 afs=false
3946         fi
3947         ;;
3948 esac
3949 if $afs; then
3950         echo "AFS may be running... I'll be extra cautious then..." >&4
3951 else
3952         echo "AFS does not seem to be running..." >&4
3953 fi
3954
3955 : determine installation prefix for where package is to be installed.
3956 if $afs; then 
3957 $cat <<EOM
3958
3959 Since you are running AFS, I need to distinguish the directory in which
3960 files will reside from the directory in which they are installed (and from
3961 which they are presumably copied to the former directory by occult means).
3962
3963 EOM
3964         case "$installprefix" in
3965         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3966         *) dflt="$installprefix";;
3967         esac
3968 else
3969 $cat <<EOM
3970
3971 In some special cases, particularly when building $package for distribution,
3972 it is convenient to distinguish the directory in which files should be
3973 installed from the directory ($prefix) in which they will
3974 eventually reside.  For most users, these two directories are the same.
3975
3976 EOM
3977         case "$installprefix" in
3978         '') dflt=$prefix ;;
3979         *) dflt=$installprefix;;
3980         esac
3981 fi
3982 fn=d~
3983 rp='What installation prefix should I use for installing files?'
3984 . ./getfile
3985 installprefix="$ans"
3986 installprefixexp="$ansexp"
3987
3988 : Perform the prefixexp/installprefixexp correction if necessary
3989 cat <<EOS >installprefix
3990 $startsh
3991 EOS
3992 cat <<'EOSC' >>installprefix
3993 : Change installation prefix, if necessary.
3994 if $test X"$prefix" != X"$installprefix"; then
3995     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3996 else
3997     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3998 fi
3999 EOSC
4000 chmod +x installprefix
4001 $eunicefix installprefix
4002
4003 : Set variables such as privlib and privlibexp from the output of ./getfile
4004 : performing the prefixexp/installprefixexp correction if necessary.
4005 cat <<EOS >setprefixvar
4006 $startsh
4007 EOS
4008 cat <<'EOSC' >>setprefixvar
4009 eval "${prefixvar}=\"\$ans\""
4010 eval "${prefixvar}exp=\"\$ansexp\""
4011 . ./installprefix
4012 EOSC
4013 chmod +x setprefixvar
4014 $eunicefix setprefixvar
4015
4016 : set up the script used to warn in case of inconsistency
4017 cat <<EOS >whoa
4018 $startsh
4019 EOS
4020 cat <<'EOSC' >>whoa
4021 dflt=y
4022 case "$hint" in
4023     recommended)
4024         case "$hintfile" in
4025         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4026                 ;;
4027         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4028                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4029                 ;;
4030         esac
4031         ;;
4032     *)  echo " "
4033         echo "*** WHOA THERE!!! ***" >&4
4034         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4035         ;;
4036 esac
4037 rp="    Keep the $hint value?"
4038 . ./myread
4039 case "$ans" in
4040 y) td=$was; tu=$was;;
4041 esac
4042 EOSC
4043
4044 : function used to set '$1' to '$val'
4045 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4046 case "$val$was" in
4047 $define$undef) . ./whoa; eval "$var=\$td";;
4048 $undef$define) . ./whoa; eval "$var=\$tu";;
4049 *) eval "$var=$val";;
4050 esac'
4051
4052 : Check is we will use socks
4053 case "$usesocks" in
4054 $define|true|[yY]*)     dflt='y';;
4055 *) dflt='n';;
4056 esac
4057 cat <<EOM
4058
4059 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4060 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4061 to use the PerlIO abstraction layer, this will be implicitly selected.
4062
4063 If this doesn't make any sense to you, just accept the default '$dflt'.
4064 EOM
4065 rp='Build Perl for SOCKS?'
4066 . ./myread
4067 case "$ans" in
4068 y|Y)    val="$define" ;;
4069 *)      val="$undef" ;;
4070 esac
4071 set usesocks
4072 eval $setvar
4073
4074 case "$usesocks" in
4075 $define|true|[yY]*) useperlio="$define";;
4076 esac
4077
4078 : Check if we want perlio
4079 case "$useperlio" in
4080 $define|true|[yY]*|'')  dflt='y';;
4081 *) dflt='n';;
4082 esac
4083 cat <<EOM
4084
4085 Previous version of $package used the standard IO mechanisms as
4086 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4087 alternate IO mechanisms via the PerlIO abstraction layer, but the
4088 stdio mechanism is still available if needed.  The abstraction layer
4089 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4090 Using PerlIO with sfio may cause problems with some extension modules.
4091
4092 If this doesn't make any sense to you, just accept the default '$dflt'.
4093 EOM
4094 rp='Use the PerlIO abstraction layer?'
4095 . ./myread
4096 case "$ans" in
4097 y|Y)
4098         val="$define"
4099         ;;
4100 *)
4101         echo "Ok, doing things the stdio way."
4102         val="$undef"
4103         ;;
4104 esac
4105 set useperlio
4106 eval $setvar
4107
4108 case "$usesocks" in
4109 $define|true|[yY]*)
4110         case "$useperlio" in
4111         $define|true|[yY]*) ;;
4112         *)      cat >&4 <<EOM
4113
4114 You are using the SOCKS proxy protocol library which means that you
4115 should also use the PerlIO layer.  You may be headed for trouble.
4116
4117 EOM
4118                 ;;
4119         esac
4120         ;;
4121 esac
4122
4123 : get the patchlevel
4124 echo " "
4125 echo "Getting the current patchlevel..." >&4
4126 if $test -r $rsrc/patchlevel.h;then
4127         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4128         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4129         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4130         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4131         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4132         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4133         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4134 else
4135         revision=0
4136         patchlevel=0
4137         subversion=0
4138         api_revision=0
4139         api_version=0
4140         api_subversion=0
4141         perl_patchlevel=0
4142         $echo "(You do not have patchlevel.h.  Eek.)"
4143 fi
4144 if $test -r $rsrc/.patch ; then
4145         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4146                 perl_patchlevel=`cat $rsrc/.patch`
4147         fi
4148 fi
4149 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4150 version_patchlevel_string="version $patchlevel subversion $subversion"
4151 case "$perl_patchlevel" in
4152 0|'') ;;
4153 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4154     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4155     ;;
4156 esac
4157
4158 $echo "(You have $package $version_patchlevel_string.)"
4159
4160 case "$osname" in
4161 dos|vms)
4162         : XXX Should be a Configure test for double-dots in filenames.
4163         version=`echo $revision $patchlevel $subversion | \
4164                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4165         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4166                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4167         ;;
4168 *)
4169         version=`echo $revision $patchlevel $subversion | \
4170                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4171         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4172                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4173         ;;
4174 esac
4175 : Special case the 5.005_xx maintenance series, which used 5.005
4176 : without any subversion label as a subdirectory in $sitelib
4177 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4178         api_versionstring='5.005'
4179 fi
4180
4181 : Do we want threads support and if so, what type
4182 case "$usethreads" in
4183 $define|true|[yY]*)     dflt='y';;
4184 *)     # Catch case where user specified ithreads or 5005threads but
4185        # forgot -Dusethreads (A.D. 4/2002)
4186        case "$useithreads$use5005threads" in
4187        *$define*)
4188                 case "$useperlio" in
4189                 "$define")      dflt='y' ;;
4190                 *)              dflt='n' ;;
4191                 esac
4192                 ;;
4193        *)       dflt='n';;
4194        esac
4195        ;;
4196 esac
4197 cat <<EOM
4198
4199 Perl can be built to take advantage of threads on some systems.
4200 To do so, Configure can be run with -Dusethreads.
4201
4202 Note that Perl built with threading support runs slightly slower
4203 and uses more memory than plain Perl. The current implementation
4204 is believed to be stable, but it is fairly new, and so should be
4205 treated with caution.
4206
4207 If this doesn't make any sense to you, just accept the default '$dflt'.
4208 EOM
4209 rp='Build a threading Perl?'
4210 . ./myread
4211 case "$ans" in
4212 y|Y)    val="$define" ;;
4213 *)      val="$undef" ;;
4214 esac
4215 set usethreads
4216 eval $setvar
4217
4218 if $test $patchlevel -lt 9; then
4219     case "$usethreads" in
4220     $define)
4221         $cat <<EOM
4222
4223 Since release 5.6, Perl has had two different threading implementations,
4224 the newer interpreter-based version (ithreads) with one interpreter per
4225 thread, and the older 5.005 version (5005threads).
4226 The 5005threads version is effectively unmaintained and will probably be
4227 removed in Perl 5.10, so there should be no need to build a Perl using it
4228 unless needed for backwards compatibility with some existing 5.005threads
4229 code.
4230
4231 EOM
4232         : Default to ithreads unless overridden on command line or with
4233         : old config.sh
4234         dflt='y'
4235         case "$use5005threads" in
4236                 $define|true|[yY]*) dflt='n';;
4237         esac
4238         case "$useithreads" in
4239                 $undef|false|[nN]*) dflt='n';;
4240         esac
4241         rp='Use the newer interpreter-based ithreads?'
4242         . ./myread
4243         case "$ans" in
4244         y|Y)    val="$define" ;;
4245         *)      val="$undef" ;;
4246         esac
4247         set useithreads
4248         eval $setvar
4249         : Now set use5005threads to the opposite value.
4250         case "$useithreads" in
4251         $define) val="$undef" ;;
4252         *) val="$define" ;;
4253         esac
4254         set use5005threads
4255         eval $setvar
4256         ;;
4257     *)
4258         useithreads="$undef"
4259         use5005threads="$undef"
4260         ;;
4261     esac
4262
4263     case "$useithreads$use5005threads" in
4264     "$define$define")
4265         $cat >&4 <<EOM
4266
4267 You cannot have both the ithreads and the 5.005 threads enabled
4268 at the same time.  Disabling the 5.005 threads since they are
4269 much less stable than the ithreads.
4270
4271 EOM
4272         use5005threads="$undef"
4273         ;;
4274     esac
4275
4276 else
4277 : perl-5.9.x and later
4278
4279     if test X"$usethreads" = "X$define"; then
4280         case "$use5005threads" in
4281             $define|true|[yY]*)
4282                 $cat >&4 <<EOM
4283
4284 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4285
4286 EOM
4287             ;;
4288         esac
4289     fi
4290
4291     use5005threads="$undef"
4292     useithreads="$usethreads"
4293 fi
4294
4295 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4296         cat >&4 <<EOF
4297 ***
4298 *** To build with ithreads you must also use the PerlIO layer.
4299 *** Cannot continue, aborting.
4300 ***
4301 EOF
4302         exit 1
4303 fi
4304
4305 case "$d_oldpthreads" in
4306 '')     : Configure tests would be welcome here.  For now, assume undef.
4307         val="$undef" ;;
4308 *)      val="$d_oldpthreads" ;;
4309 esac
4310 set d_oldpthreads
4311 eval $setvar
4312
4313
4314 : Look for a hint-file generated 'call-back-unit'.  If the
4315 : user has specified that a threading perl is to be built,
4316 : we may need to set or change some other defaults.
4317 if $test -f usethreads.cbu; then
4318     echo "Your platform has some specific hints regarding threaded builds, using them..."
4319     . ./usethreads.cbu
4320 else
4321     case "$usethreads" in
4322         "$define"|true|[yY]*)
4323                 $cat <<EOM
4324 (Your platform does not have any specific hints for threaded builds.
4325  Assuming POSIX threads, then.)
4326 EOM
4327         ;;
4328     esac
4329 fi
4330
4331 : Check if multiplicity is required
4332 cat <<EOM
4333
4334 Perl can be built so that multiple Perl interpreters can coexist
4335 within the same Perl executable.
4336 EOM
4337
4338 case "$useithreads" in
4339 $define)
4340         cat <<EOM
4341 This multiple interpreter support is required for interpreter-based threads.
4342 EOM
4343         val="$define"
4344         ;;
4345 *)      case "$usemultiplicity" in
4346         $define|true|[yY]*)     dflt='y';;
4347         *) dflt='n';;
4348         esac
4349         echo " "
4350         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4351         rp='Build Perl for multiplicity?'
4352         . ./myread
4353         case "$ans" in
4354         y|Y)    val="$define" ;;
4355         *)      val="$undef" ;;
4356         esac
4357         ;;
4358 esac
4359 set usemultiplicity
4360 eval $setvar
4361
4362 : Check if morebits is requested
4363 case "$usemorebits" in
4364 "$define"|true|[yY]*)
4365         use64bitint="$define"
4366         uselongdouble="$define"
4367         usemorebits="$define"
4368         ;;
4369 *)      usemorebits="$undef"
4370         ;;
4371 esac
4372
4373 : Determine the C compiler to be used
4374 echo " "
4375 case "$cc" in
4376 '') dflt=cc;;
4377 *) dflt="$cc";;
4378 esac
4379 rp="Use which C compiler?"
4380 . ./myread
4381 cc="$ans"
4382
4383 : See whether they have no cc but they do have gcc
4384 . ./trygcc
4385 if $test -f cc.cbu; then
4386     . ./cc.cbu
4387 fi
4388 . ./checkcc
4389
4390 : make some quick guesses about what we are up against
4391 echo " "
4392 $echo $n "Hmm...  $c"
4393 echo exit 1 >bsd
4394 echo exit 1 >usg
4395 echo exit 1 >v7
4396 echo exit 1 >osf1
4397 echo exit 1 >eunice
4398 echo exit 1 >xenix
4399 echo exit 1 >venix
4400 echo exit 1 >os2
4401 d_bsd="$undef"
4402 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4403 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4404 then
4405         echo "Looks kind of like an OSF/1 system, but we'll see..."
4406         echo exit 0 >osf1
4407 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4408         xxx=`./loc addbib blurfl $pth`
4409         if $test -f $xxx; then
4410         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4411                 echo exit 0 >bsd
4412                 echo exit 0 >usg
4413         else
4414                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4415                         echo "Looks kind of like an extended USG system, but we'll see..."
4416                 else
4417                         echo "Looks kind of like a USG system, but we'll see..."
4418                 fi
4419                 echo exit 0 >usg
4420         fi
4421 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4422         echo "Looks kind of like a BSD system, but we'll see..."
4423         d_bsd="$define"
4424         echo exit 0 >bsd
4425 else
4426         echo "Looks kind of like a Version 7 system, but we'll see..."
4427         echo exit 0 >v7
4428 fi
4429 case "$eunicefix" in
4430 *unixtovms*)
4431         $cat <<'EOI'
4432 There is, however, a strange, musty smell in the air that reminds me of
4433 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4434 EOI
4435         echo exit 0 >eunice
4436         d_eunice="$define"
4437 : it so happens the Eunice I know will not run shell scripts in Unix format
4438         ;;
4439 *)
4440         echo " "
4441         echo "Congratulations.  You aren't running Eunice."
4442         d_eunice="$undef"
4443         ;;
4444 esac
4445 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4446 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4447 : semicolon as a patch separator
4448 case "$p_" in
4449 :) ;;
4450 *)
4451         $cat <<'EOI'
4452 I have the feeling something is not exactly right, however...don't tell me...
4453 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4454 (Or you may be running DOS with DJGPP.)
4455 EOI
4456         echo exit 0 >os2
4457         ;;
4458 esac
4459 if test -f /xenix; then
4460         echo "Actually, this looks more like a XENIX system..."
4461         echo exit 0 >xenix
4462         d_xenix="$define"
4463 else
4464         echo " "
4465         echo "It's not Xenix..."
4466         d_xenix="$undef"
4467 fi
4468 chmod +x xenix
4469 $eunicefix xenix
4470 if test -f /venix; then
4471         echo "Actually, this looks more like a VENIX system..."
4472         echo exit 0 >venix
4473 else
4474         echo " "
4475         if ./xenix; then
4476                 : null
4477         else
4478                 echo "Nor is it Venix..."
4479         fi
4480 fi
4481 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4482 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4483 $rm -f foo
4484
4485 : Check if we are using GNU gcc and what its version is
4486 echo " "
4487 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4488 $cat >try.c <<EOM
4489 #include <stdio.h>
4490 int main() {
4491 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4492 #ifdef __VERSION__
4493         printf("%s\n", __VERSION__);
4494 #else
4495         printf("%s\n", "1");
4496 #endif
4497 #endif
4498         return(0);
4499 }
4500 EOM
4501 if $cc -o try $ccflags $ldflags try.c; then
4502         gccversion=`$run ./try`
4503         case "$gccversion" in
4504         '') echo "You are not using GNU cc." ;;
4505         *)  echo "You are using GNU cc $gccversion."
4506             ccname=gcc
4507             ;;
4508         esac
4509 else
4510         echo " "
4511         echo "*** WHOA THERE!!! ***" >&4
4512         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4513         case "$knowitall" in
4514         '')
4515         echo "    You'd better start hunting for one and let me know about it." >&4
4516                 exit 1
4517                 ;;
4518         esac
4519 fi
4520 $rm -f try try.*
4521 case "$gccversion" in
4522 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4523 esac
4524 case "$gccversion" in
4525 '') gccosandvers='' ;;
4526 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4527    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4528    gccshortvers=''
4529    case "$gccosandvers" in
4530    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4531    $osname$osvers) ;; # looking good
4532    $osname*) cat <<EOM >&4
4533
4534 *** WHOA THERE!!! ***
4535
4536     Your gcc has not been compiled for the exact release of
4537     your operating system ($gccosandvers versus $osname$osvers).
4538
4539     In general it is a good idea to keep gcc synchronized with
4540     the operating system because otherwise serious problems
4541     may ensue when trying to compile software, like Perl.
4542
4543     I'm trying to be optimistic here, though, and will continue.
4544     If later during the configuration and build icky compilation
4545     problems appear (headerfile conflicts being the most common
4546     manifestation), I suggest reinstalling the gcc to match
4547     your operating system release.
4548
4549 EOM
4550       ;;
4551    *) gccosandvers='' ;; # failed to parse, better be silent
4552    esac
4553    ;;
4554 esac
4555 case "$ccname" in
4556 '') ccname="$cc" ;;
4557 esac
4558
4559 # gcc 3.* complain about adding -Idirectories that they already know about,
4560 # so we will take those off from locincpth.
4561 case "$gccversion" in
4562 3*)
4563     echo "main(){}">try.c
4564     for incdir in $locincpth; do
4565        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4566              grep '^c[cp]p*[01]: warning: changing search order '`
4567        if test "X$warn" != X; then
4568            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4569        fi
4570     done
4571     $rm -f try try.*
4572 esac
4573
4574 : What should the include directory be ?
4575 echo " "
4576 $echo $n "Hmm...  $c"
4577 dflt='/usr/include'
4578 incpath=''
4579 mips_type=''
4580 if $test -f /bin/mips && /bin/mips; then
4581         echo "Looks like a MIPS system..."
4582         $cat >usr.c <<'EOCP'
4583 #ifdef SYSTYPE_BSD43
4584 /bsd43
4585 #endif
4586 EOCP
4587         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4588                 dflt='/bsd43/usr/include'
4589                 incpath='/bsd43'
4590                 mips_type='BSD 4.3'
4591         else
4592                 mips_type='System V'
4593         fi
4594         $rm -f usr.c usr.out
4595         echo "and you're compiling with the $mips_type compiler and libraries."
4596         xxx_prompt=y
4597         echo "exit 0" >mips
4598 else
4599         echo "Doesn't look like a MIPS system."
4600         xxx_prompt=n
4601         echo "exit 1" >mips
4602 fi
4603 chmod +x mips
4604 $eunicefix mips
4605 case "$usrinc" in
4606 '') ;;
4607 *) dflt="$usrinc";;
4608 esac
4609 case "$xxx_prompt" in
4610 y)      fn=d/
4611         echo " "
4612         rp='Where are the include files you want to use?'
4613         . ./getfile
4614         usrinc="$ans"
4615         ;;
4616 *)      usrinc="$dflt"
4617         ;;
4618 esac
4619
4620 : see how we invoke the C preprocessor
4621 echo " "
4622 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4623 cat <<'EOT' >testcpp.c
4624 #define ABC abc
4625 #define XYZ xyz
4626 ABC.XYZ
4627 EOT
4628 cd ..
4629 if test ! -f cppstdin; then
4630         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4631                 # AIX cc -E doesn't show the absolute headerfile
4632                 # locations but we'll cheat by using the -M flag.
4633                 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
4634         else
4635                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4636         fi
4637 else
4638         echo "Keeping your $hint cppstdin wrapper."
4639 fi
4640 chmod 755 cppstdin
4641 wrapper=`pwd`/cppstdin
4642 ok='false'
4643 cd UU
4644
4645 if $test "X$cppstdin" != "X" && \
4646         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4648 then
4649         echo "You used to use $cppstdin $cppminus so we'll use that again."
4650         case "$cpprun" in
4651         '') echo "But let's see if we can live without a wrapper..." ;;
4652         *)
4653                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4654                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4655                 then
4656                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4657                         ok='true'
4658                 else
4659                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4660                 fi
4661                 ;;
4662         esac
4663 else
4664         case "$cppstdin" in
4665         '') ;;
4666         *)
4667                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4668                 ;;
4669         esac
4670 fi
4671
4672 if $ok; then
4673         : nothing
4674 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4675         $cc -E <testcpp.c >testcpp.out 2>&1; \
4676         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4677         echo "Yup, it does."
4678         x_cpp="$cc -E"
4679         x_minus='';
4680 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4681         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4682         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4683         echo "Yup, it does."
4684         x_cpp="$cc -E"
4685         x_minus='-';
4686 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4687         $cc -P <testcpp.c >testcpp.out 2>&1; \
4688         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4689         echo "Yipee, that works!"
4690         x_cpp="$cc -P"
4691         x_minus='';
4692 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4693         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4694         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4695         echo "At long last!"
4696         x_cpp="$cc -P"
4697         x_minus='-';
4698 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4699         $cpp <testcpp.c >testcpp.out 2>&1; \
4700         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4701         echo "It works!"
4702         x_cpp="$cpp"
4703         x_minus='';
4704 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4705         $cpp - <testcpp.c >testcpp.out 2>&1; \
4706         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4707         echo "Hooray, it works!  I was beginning to wonder."
4708         x_cpp="$cpp"
4709         x_minus='-';
4710 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4711         $wrapper <testcpp.c >testcpp.out 2>&1; \
4712         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4713         x_cpp="$wrapper"
4714         x_minus=''
4715         echo "Eureka!"
4716 else
4717         dflt=''
4718         rp="No dice.  I can't find a C preprocessor.  Name one:"
4719         . ./myread
4720         x_cpp="$ans"
4721         x_minus=''
4722         $x_cpp <testcpp.c >testcpp.out 2>&1
4723         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4724                 echo "OK, that will do." >&4
4725         else
4726 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4727                 exit 1
4728         fi
4729 fi
4730
4731 case "$ok" in
4732 false)
4733         cppstdin="$x_cpp"
4734         cppminus="$x_minus"
4735         cpprun="$x_cpp"
4736         cpplast="$x_minus"
4737         set X $x_cpp
4738         shift
4739         case "$1" in
4740         "$cpp")
4741                 echo "Perhaps can we force $cc -E using a wrapper..."
4742                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4743                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4744                 then
4745                         echo "Yup, we can."
4746                         cppstdin="$wrapper"
4747                         cppminus='';
4748                 else
4749                         echo "Nope, we'll have to live without it..."
4750                 fi
4751                 ;;
4752         esac
4753         case "$cpprun" in
4754         "$wrapper")
4755                 cpprun=''
4756                 cpplast=''
4757                 ;;
4758         esac
4759         ;;
4760 esac
4761
4762 case "$cppstdin" in
4763 "$wrapper"|'cppstdin') ;;
4764 *) $rm -f $wrapper;;
4765 esac
4766 $rm -f testcpp.c testcpp.out
4767
4768 : Set private lib path
4769 case "$plibpth" in
4770 '') if ./mips; then
4771                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4772         fi;;
4773 esac
4774 case "$libpth" in
4775 ' ') dlist='';;
4776 '') dlist="$loclibpth $plibpth $glibpth";;
4777 *) dlist="$libpth";;
4778 esac
4779
4780 : Now check and see which directories actually exist, avoiding duplicates
4781 libpth=''
4782 for xxx in $dlist
4783 do
4784     if $test -d $xxx; then
4785                 case " $libpth " in
4786                 *" $xxx "*) ;;
4787                 *) libpth="$libpth $xxx";;
4788                 esac
4789     fi
4790 done
4791 $cat <<'EOM'
4792
4793 Some systems have incompatible or broken versions of libraries.  Among
4794 the directories listed in the question below, please remove any you
4795 know not to be holding relevant libraries, and add any that are needed.
4796 Say "none" for none.
4797
4798 EOM
4799 case "$libpth" in
4800 '') dflt='none';;
4801 *)
4802         set X $libpth
4803         shift
4804         dflt=${1+"$@"}
4805         ;;
4806 esac
4807 rp="Directories to use for library searches?"
4808 . ./myread
4809 case "$ans" in
4810 none) libpth=' ';;
4811 *) libpth="$ans";;
4812 esac
4813
4814 : compute shared library extension
4815 case "$so" in
4816 '')
4817         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4818                 dflt='sl'
4819         else
4820                 dflt='so'
4821         fi
4822         ;;
4823 *) dflt="$so";;
4824 esac
4825 $cat <<EOM
4826
4827 On some systems, shared libraries may be available.  Answer 'none' if
4828 you want to suppress searching of shared libraries for the remainder
4829 of this configuration.
4830
4831 EOM
4832 rp='What is the file extension used for shared libraries?'
4833 . ./myread
4834 so="$ans"
4835
4836 : Define several unixisms.
4837 : Hints files or command line option can be used to override them.
4838 : The convoluted testing is in case hints files set either the old
4839 : or the new name.
4840 case "$_exe" in
4841 '')     case "$exe_ext" in
4842         '')     ;;
4843         *)      _exe="$exe_ext" ;;
4844         esac
4845         ;;
4846 esac
4847 case "$_a" in
4848 '')     case "$lib_ext" in
4849     '') _a='.a';;
4850         *)      _a="$lib_ext" ;;
4851         esac
4852         ;;
4853 esac
4854 case "$_o" in
4855 '') case "$obj_ext" in
4856         '')     _o='.o';;
4857         *)      _o="$obj_ext";;
4858         esac
4859         ;;
4860 esac
4861 case "$p_" in
4862 '') case "$path_sep" in
4863         '')     p_=':';;
4864         *)      p_="$path_sep";;
4865         esac
4866         ;;
4867 esac
4868 exe_ext=$_exe
4869 lib_ext=$_a
4870 obj_ext=$_o
4871 path_sep=$p_
4872
4873 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4874
4875 : Which makefile gets called first.  This is used by make depend.
4876 case "$firstmakefile" in
4877 '') firstmakefile='makefile';;
4878 esac
4879
4880 : Check for uselongdouble support
4881 case "$ccflags" in
4882 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4883 esac
4884
4885 case "$uselongdouble" in
4886 $define|true|[yY]*)     dflt='y';;
4887 *) dflt='n';;
4888 esac
4889 cat <<EOM
4890
4891 Perl can be built to take advantage of long doubles which
4892 (if available) may give more accuracy and range for floating point numbers.
4893
4894 If this doesn't make any sense to you, just accept the default '$dflt'.
4895 EOM
4896 rp='Try to use long doubles if available?'
4897 . ./myread
4898 case "$ans" in
4899 y|Y)    val="$define"   ;;
4900 *)      val="$undef"    ;;
4901 esac
4902 set uselongdouble
4903 eval $setvar
4904
4905 case "$uselongdouble" in
4906 true|[yY]*) uselongdouble="$define" ;;
4907 esac
4908
4909 : Look for a hint-file generated 'call-back-unit'.  If the
4910 : user has specified that long doubles should be used,
4911 : we may need to set or change some other defaults.
4912 if $test -f uselongdouble.cbu; then
4913     echo "Your platform has some specific hints regarding long doubles, using them..."
4914     . ./uselongdouble.cbu
4915 else
4916     case "$uselongdouble" in
4917         $define)
4918                 $cat <<EOM
4919 (Your platform does not have any specific hints for long doubles.)
4920 EOM
4921         ;;
4922     esac
4923 fi
4924
4925 : Looking for optional libraries
4926 echo " "
4927 echo "Checking for optional libraries..." >&4
4928 case "$libs" in
4929 ' '|'') dflt='';;
4930 *) dflt="$libs";;
4931 esac
4932 case "$libswanted" in
4933 '') libswanted='c_s';;
4934 esac
4935 case "$usesocks" in
4936 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4937 esac
4938 libsfound=''
4939 libsfiles=''
4940 libsdirs=''
4941 libspath=''
4942 for thisdir in $libpth $xlibpth; do
4943   test -d $thisdir && libspath="$libspath $thisdir"
4944 done
4945 for thislib in $libswanted; do
4946         for thisdir in $libspath; do
4947             xxx=''
4948             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4949                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4950                 $test -f "$xxx" && eval $libscheck
4951                 $test -f "$xxx" && libstyle=shared
4952             fi
4953             if test ! -f "$xxx"; then
4954                 xxx=$thisdir/lib$thislib.$so
4955                 $test -f "$xxx" && eval $libscheck
4956                 $test -f "$xxx" && libstyle=shared
4957             fi
4958             if test ! -f "$xxx"; then
4959                 xxx=$thisdir/lib$thislib$_a
4960                 $test -f "$xxx" && eval $libscheck
4961                 $test -f "$xxx" && libstyle=static
4962             fi
4963             if test ! -f "$xxx"; then
4964                 xxx=$thisdir/$thislib$_a
4965                 $test -f "$xxx" && eval $libscheck
4966                 $test -f "$xxx" && libstyle=static
4967             fi
4968             if test ! -f "$xxx"; then
4969                 xxx=$thisdir/lib${thislib}_s$_a
4970                 $test -f "$xxx" && eval $libscheck
4971                 $test -f "$xxx" && libstyle=static
4972                 $test -f "$xxx" && thislib=${thislib}_s
4973             fi
4974             if test ! -f "$xxx"; then
4975                 xxx=$thisdir/Slib$thislib$_a
4976                 $test -f "$xxx" && eval $libscheck
4977                 $test -f "$xxx" && libstyle=static
4978             fi
4979             if $test -f "$xxx"; then
4980                 case "$libstyle" in
4981                 shared) echo "Found -l$thislib (shared)." ;;
4982                 static) echo "Found -l$thislib." ;;
4983                 *)      echo "Found -l$thislib ($libstyle)." ;;
4984                 esac
4985                 case " $dflt " in
4986                 *"-l$thislib "*);;
4987                 *) dflt="$dflt -l$thislib"
4988                    libsfound="$libsfound $xxx"
4989                    yyy=`basename $xxx`
4990                    libsfiles="$libsfiles $yyy"
4991                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4992                    case " $libsdirs " in
4993                    *" $yyy "*) ;;
4994                    *) libsdirs="$libsdirs $yyy" ;;
4995                    esac
4996                    ;;
4997                 esac
4998                 break
4999             fi
5000         done
5001         if $test ! -f "$xxx"; then
5002             echo "No -l$thislib."
5003         fi
5004 done
5005 set X $dflt
5006 shift
5007 dflt="$*"
5008 case "$libs" in
5009 '') dflt="$dflt";;
5010 *) dflt="$libs";;
5011 esac
5012 case "$dflt" in
5013 ' '|'') dflt='none';;
5014 esac
5015
5016 $cat <<EOM
5017
5018 In order to compile $package on your machine, a number of libraries
5019 are usually needed.  Include any other special libraries here as well.
5020 Say "none" for none.  The default list is almost always right.
5021 EOM
5022
5023 echo " "
5024 rp="What libraries to use?"
5025 . ./myread
5026 case "$ans" in
5027 none) libs=' ';;
5028 *) libs="$ans";;
5029 esac
5030
5031 : determine optimization, if desired, or use for debug flag also
5032 case "$optimize" in
5033 ' '|$undef) dflt='none';;
5034 '') dflt='-O';;
5035 *) dflt="$optimize";;
5036 esac
5037 $cat <<EOH
5038
5039 By default, $package compiles with the -O flag to use the optimizer.
5040 Alternately, you might want to use the symbolic debugger, which uses
5041 the -g flag (on traditional Unix systems).  Either flag can be
5042 specified here.  To use neither flag, specify the word "none".
5043
5044 EOH
5045 rp="What optimizer/debugger flag should be used?"
5046 . ./myread
5047 optimize="$ans"
5048 case "$optimize" in
5049 'none') optimize=" ";;
5050 esac
5051
5052 : Check what DEBUGGING is required from the command line
5053 : -DEBUGGING      or -DDEBUGGING or
5054 : -DEBUGGING=both                       = -g + -DDEBUGGING
5055 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5056 : -DEBUGGING=none or -UDEBUGGING        =
5057 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5058 case "$EBUGGING" in
5059 '')     ;;
5060 *)      DEBUGGING=$EBUGGING ;;
5061 esac
5062
5063 case "$DEBUGGING" in
5064 -g|both|$define)
5065     case "$optimize" in
5066         *-g*) ;;
5067         *)    optimize="$optimize -g" ;;
5068     esac ;;
5069 none|$undef)
5070     case "$optimize" in
5071         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5072                 shift
5073                 optimize="$*"
5074                 ;;
5075     esac ;;
5076 esac
5077
5078 dflt=''
5079 case "$DEBUGGING" in
5080 both|$define) dflt='-DDEBUGGING'
5081 esac
5082
5083 : argument order is deliberate, as the flag will start with - which set could
5084 : think is an option
5085 checkccflag='check=$1; flag=$2; callback=$3;
5086 echo " ";
5087 echo "Checking if your compiler accepts $flag" 2>&1;
5088 echo "int main(void) { return 0; }" > gcctest.c;
5089 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5090     echo "Yes, it does." 2>&1;
5091     if $test -s gcctest.out ; then
5092         echo "But your platform does not like it:";
5093         cat gcctest.out;
5094     else
5095         case "$ccflags" in
5096         *$check*)
5097             echo "Leaving current flags $ccflags alone." 2>&1
5098             ;;
5099         *) dflt="$dflt $flag";
5100             eval $callback
5101             ;;
5102         esac
5103     fi
5104 else
5105     echo "Nope, it does not, but that is ok." 2>&1;
5106 fi
5107 '
5108
5109 : We will not override a previous value, but we might want to
5110 : augment a hint file
5111 case "$hint" in
5112 default|recommended)
5113         case "$gccversion" in
5114         1*) dflt="$dflt -fpcc-struct-return" ;;
5115         esac
5116         case "$optimize:$DEBUGGING" in
5117         *-g*:old) dflt="$dflt -DDEBUGGING";;
5118         esac
5119         case "$gccversion" in
5120         2*) if $test -d /etc/conf/kconfig.d &&
5121                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5122                 then
5123                         # Interactive Systems (ISC) POSIX mode.
5124                         dflt="$dflt -posix"
5125                 fi
5126                 ;;
5127         esac
5128         case "$gccversion" in
5129         1*) ;;
5130         2.[0-8]*) ;;
5131         ?*)     set strict-aliasing -fno-strict-aliasing
5132                 eval $checkccflag
5133                 ;;
5134         esac
5135         # For gcc, adding -pipe speeds up compilations for some, but apparently
5136         # some assemblers can't read from stdin.  (It also slows down compilations
5137         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5138         case "$gccversion" in
5139         ?*)     set pipe -pipe
5140                 eval $checkccflag
5141                 ;;
5142         esac
5143
5144         # on x86_64 (at least) we require an extra library (libssp) in the
5145         # link command line. This library is not named, so I infer that it is
5146         # an implementation detail that may change. Hence the safest approach
5147         # is to add the flag to the flags passed to the compiler at link time,
5148         # as that way the compiler can do the right implementation dependant
5149         # thing. (NWC)
5150         case "$gccversion" in
5151         ?*)     set stack-protector -fstack-protector
5152                 eval $checkccflag
5153                 ;;
5154         esac
5155         ;;
5156 esac
5157
5158 case "$mips_type" in
5159 *BSD*|'') inclwanted="$locincpth $usrinc";;
5160 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5161 esac
5162 for thisincl in $inclwanted; do
5163         if $test -d $thisincl; then
5164                 if $test x$thisincl != x$usrinc; then
5165                         case "$dflt" in
5166                         *" -I$thisincl "*);;
5167                         *) dflt="$dflt -I$thisincl ";;
5168                         esac
5169                 fi
5170         fi
5171 done
5172
5173 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5174         xxx=true;
5175 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5176         xxx=true;
5177 else
5178         xxx=false;
5179 fi;
5180 if $xxx; then
5181         case "$dflt" in
5182         *$2*);;
5183         *) dflt="$dflt -D$2";;
5184         esac;
5185 fi'
5186
5187 set signal.h LANGUAGE_C; eval $inctest
5188
5189 case "$usesocks" in
5190 $define)
5191         ccflags="$ccflags -DSOCKS"
5192         ;;
5193 esac
5194
5195 case "$hint" in
5196 default|recommended) dflt="$ccflags $dflt" ;;
5197 *) dflt="$ccflags";;
5198 esac
5199
5200 case "$dflt" in
5201 ''|' ') dflt=none;;
5202 esac
5203
5204 $cat <<EOH
5205
5206 Your C compiler may want other flags.  For this question you should include
5207 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5208 but you should NOT include libraries or ld flags like -lwhatever.  If you
5209 want $package to honor its debug switch, you should include -DDEBUGGING here.
5210 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5211
5212 To use no flags, specify the word "none".
5213
5214 EOH
5215 set X $dflt
5216 shift
5217 dflt=${1+"$@"}
5218 rp="Any additional cc flags?"
5219 . ./myread
5220 case "$ans" in
5221 none) ccflags='';;
5222 *) ccflags="$ans";;
5223 esac
5224
5225 : the following weeds options from ccflags that are of no interest to cpp
5226 case "$cppflags" in
5227 '') cppflags="$ccflags" ;;
5228 *)  cppflags="$cppflags $ccflags" ;;
5229 esac
5230 case "$gccversion" in
5231 1*) cppflags="$cppflags -D__GNUC__"
5232 esac
5233 case "$mips_type" in
5234 '');;
5235 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5236 esac
5237 case "$cppflags" in
5238 '');;
5239 *)
5240         echo " "
5241         echo "Let me guess what the preprocessor flags are..." >&4
5242         set X $cppflags
5243         shift
5244         cppflags=''
5245         $cat >cpp.c <<'EOM'
5246 #define BLURFL foo
5247
5248 BLURFL xx LFRULB
5249 EOM
5250         previous=''
5251         for flag in $*
5252         do
5253                 case "$flag" in
5254                 -*) ftry="$flag";;
5255                 *) ftry="$previous $flag";;
5256                 esac
5257                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5258                         >cpp1.out 2>/dev/null && \
5259                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5260                         >cpp2.out 2>/dev/null && \
5261                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5262                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5263                 then
5264                         cppflags="$cppflags $ftry"
5265                         previous=''
5266                 else
5267                         previous="$flag"
5268                 fi
5269         done
5270         set X $cppflags
5271         shift
5272         cppflags=${1+"$@"}
5273         case "$cppflags" in
5274         *-*)  echo "They appear to be: $cppflags";;
5275         esac
5276         $rm -f cpp.c cpp?.out
5277         ;;
5278 esac
5279
5280 : flags used in final linking phase
5281 case "$ldflags" in
5282 '') if ./venix; then
5283                 dflt='-i -z'
5284         else
5285                 dflt=''
5286         fi
5287         case "$ccflags" in
5288         *-posix*) dflt="$dflt -posix" ;;
5289         esac
5290         ;;
5291 *) dflt="$ldflags";;
5292 esac
5293 # See note above about -fstack-protector
5294 case "$ccflags" in
5295 *-fstack-protector*) 
5296         case "$dflt" in
5297         *-fstack-protector*) ;; # Don't add it again
5298         *) dflt="$dflt -fstack-protector" ;; 
5299         esac
5300         ;;
5301 esac
5302
5303 : Try to guess additional flags to pick up local libraries.
5304 for thislibdir in $libpth; do
5305         case " $loclibpth " in
5306         *" $thislibdir "*)
5307                 case "$dflt " in
5308                 *"-L$thislibdir "*) ;;
5309                 *)  dflt="$dflt -L$thislibdir" ;;
5310                 esac
5311                 ;;
5312         esac
5313 done
5314
5315 case "$dflt" in
5316 '') dflt='none' ;;
5317 esac
5318
5319 $cat <<EOH
5320
5321 Your C linker may need flags.  For this question you should
5322 include -L/whatever and any other flags used by the C linker, but you
5323 should NOT include libraries like -lwhatever.
5324
5325 Make sure you include the appropriate -L/path flags if your C linker
5326 does not normally search all of the directories you specified above,
5327 namely
5328         $libpth
5329 To use no flags, specify the word "none".
5330
5331 EOH
5332
5333 rp="Any additional ld flags (NOT including libraries)?"
5334 . ./myread
5335 case "$ans" in
5336 none) ldflags='';;
5337 *) ldflags="$ans";;
5338 esac
5339 rmlist="$rmlist pdp11"
5340
5341 : coherency check
5342 echo " "
5343 echo "Checking your choice of C compiler and flags for coherency..." >&4
5344 $cat > try.c <<'EOF'
5345 #include <stdio.h>
5346 int main() { printf("Ok\n"); return(0); }
5347 EOF
5348 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5349 shift
5350 $cat >try.msg <<'EOM'
5351 I've tried to compile and run the following simple program:
5352
5353 EOM
5354 $cat try.c >> try.msg
5355
5356 $cat >> try.msg <<EOM
5357
5358 I used the command:
5359
5360         $*
5361         $run ./try
5362
5363 and I got the following output:
5364
5365 EOM
5366 dflt=y
5367 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5368         if $sh -c "$run ./try " >>try.msg 2>&1; then
5369                 xxx=`$run ./try`
5370                 case "$xxx" in
5371                 "Ok") dflt=n ;;
5372                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5373                         case " $libs " in
5374                         *" -lsfio "*)
5375                                 cat >> try.msg <<'EOQS'
5376 If $libs contains -lsfio, and sfio is mis-configured, then it
5377 sometimes (apparently) runs and exits with a 0 status, but with no
5378 output!  It may have to do with sfio's use of _exit vs. exit.
5379
5380 EOQS
5381                                 rp="You have a big problem.  Shall I abort Configure"
5382                                 dflt=y
5383                                 ;;
5384                         esac
5385                         ;;
5386                 esac
5387         else
5388                 echo "The program compiled OK, but exited with status $?." >>try.msg
5389                 rp="You have a problem.  Shall I abort Configure"
5390                 dflt=y
5391         fi
5392 else
5393         echo "I can't compile the test program." >>try.msg
5394         rp="You have a BIG problem.  Shall I abort Configure"
5395         dflt=y
5396 fi
5397 case "$dflt" in
5398 y)
5399         $cat try.msg >&4
5400         case "$knowitall" in
5401         '')
5402                 echo "(The supplied flags or libraries might be incorrect.)"
5403                 ;;
5404         *) dflt=n;;
5405         esac
5406         echo " "
5407         . ./myread
5408         case "$ans" in
5409         n*|N*) ;;
5410         *)      echo "Ok.  Stopping Configure." >&4
5411                 exit 1
5412                 ;;
5413         esac
5414         ;;
5415 n) echo "OK, that should do.";;
5416 esac
5417 $rm_try gcctest gcctest.out
5418
5419 : define a shorthand compile call
5420 compile='
5421 mc_file=$1;
5422 shift;
5423 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5424 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5425 exit 1;
5426 fi;
5427 esac;
5428 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5429 : define a shorthand compile call for compilations that should be ok.
5430 compile_ok='
5431 mc_file=$1;
5432 shift;
5433 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5434
5435 : determine filename position in cpp output
5436 echo " "
5437 echo "Computing filename position in cpp output for #include directives..." >&4
5438 case "$osname" in
5439 vos) testaccess=-e ;;
5440 *)   testaccess=-r ;;
5441 esac
5442 echo '#include <stdio.h>' > foo.c
5443 $cat >fieldn <<EOF
5444 $startsh
5445 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5446 $grep '^[       ]*#.*stdio\.h' | \
5447 while read cline; do
5448         pos=1
5449         set \$cline
5450         while $test \$# -gt 0; do
5451                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5452                         echo "\$pos"
5453                         exit 0
5454                 fi
5455                 shift
5456                 pos=\`expr \$pos + 1\`
5457         done
5458 done
5459 EOF
5460 chmod +x fieldn
5461 fieldn=`./fieldn`
5462 $rm -f foo.c fieldn
5463 case $fieldn in
5464 '') pos='???';;
5465 1) pos=first;;
5466 2) pos=second;;
5467 3) pos=third;;
5468 *) pos="${fieldn}th";;
5469 esac
5470 echo "Your cpp writes the filename in the $pos field of the line."
5471
5472 case "$osname" in
5473 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5474 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5475 *)   cppfilter='' ;;
5476 esac
5477 : locate header file
5478 $cat >findhdr <<EOF
5479 $startsh
5480 wanted=\$1
5481 name=''
5482 for usrincdir in $usrinc
5483 do
5484         if test -f \$usrincdir/\$wanted; then
5485                 echo "\$usrincdir/\$wanted"
5486                 exit 0
5487         fi
5488 done
5489 awkprg='{ print \$$fieldn }'
5490 echo "#include <\$wanted>" > foo\$\$.c
5491 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5492 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5493 while read cline; do
5494         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5495         case "\$name" in
5496         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5497         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5498         *) exit 2;;
5499         esac;
5500 done;
5501 #
5502 # status = 0: grep returned 0 lines, case statement not executed
5503 # status = 1: headerfile found
5504 # status = 2: while loop executed, no headerfile found
5505 #
5506 status=\$?
5507 $rm -f foo\$\$.c;
5508 if test \$status -eq 1; then
5509         exit 0;
5510 fi
5511 exit 1
5512 EOF
5513 chmod +x findhdr
5514
5515 : define an alternate in-header-list? function
5516 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5517 cont=true; xxf="echo \"<\$1> found.\" >&4";
5518 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5519 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5520 esac;
5521 case $# in 4) instead=instead;; *) instead="at last";; esac;
5522 while $test "$cont"; do
5523         xxx=`./findhdr $1`
5524         var=$2; eval "was=\$$2";
5525         if $test "$xxx" && $test -r "$xxx";
5526         then eval $xxf;
5527         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5528                 cont="";
5529         else eval $xxnf;
5530         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5531         set $yyy; shift; shift; yyy=$@;
5532         case $# in 0) cont="";;
5533         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5534                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5535         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5536                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5537         esac;
5538 done;
5539 while $test "$yyy";
5540 do set $yyy; var=$2; eval "was=\$$2";
5541         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5542         set $yyy; shift; shift; yyy=$@;
5543 done'
5544
5545 : see if stdlib is available
5546 set stdlib.h i_stdlib
5547 eval $inhdr
5548
5549 : check for lengths of integral types
5550 echo " "
5551 case "$intsize" in
5552 '')
5553         echo "Checking to see how big your integers are..." >&4
5554         $cat >try.c <<EOCP
5555 #include <stdio.h>
5556 #$i_stdlib I_STDLIB
5557 #ifdef I_STDLIB
5558 #include <stdlib.h>
5559 #endif
5560 int main()
5561 {
5562         printf("intsize=%d;\n", (int)sizeof(int));
5563         printf("longsize=%d;\n", (int)sizeof(long));
5564         printf("shortsize=%d;\n", (int)sizeof(short));
5565         exit(0);
5566 }
5567 EOCP
5568         set try
5569         if eval $compile_ok && $run ./try > /dev/null; then
5570                 eval `$run ./try`
5571                 echo "Your integers are $intsize bytes long."
5572                 echo "Your long integers are $longsize bytes long."
5573                 echo "Your short integers are $shortsize bytes long."
5574         else
5575                 $cat >&4 <<EOM
5576 !
5577 Help! I can't compile and run the intsize test program: please enlighten me!
5578 (This is probably a misconfiguration in your system or libraries, and
5579 you really ought to fix it.  Still, I'll try anyway.)
5580 !
5581 EOM
5582                 dflt=4
5583                 rp="What is the size of an integer (in bytes)?"
5584                 . ./myread
5585                 intsize="$ans"
5586                 dflt=$intsize
5587                 rp="What is the size of a long integer (in bytes)?"
5588                 . ./myread
5589                 longsize="$ans"
5590                 dflt=2
5591                 rp="What is the size of a short integer (in bytes)?"
5592                 . ./myread
5593                 shortsize="$ans"
5594         fi
5595         ;;
5596 esac
5597 $rm_try
5598
5599 : check for long long
5600 echo " "
5601 echo "Checking to see if you have long long..." >&4
5602 echo 'int main() { long long x = 7; return 0; }' > try.c
5603 set try
5604 if eval $compile; then
5605         val="$define"
5606         echo "You have long long."
5607 else
5608         val="$undef"
5609         echo "You do not have long long."
5610 fi
5611 $rm_try
5612 set d_longlong
5613 eval $setvar
5614
5615 : check for length of long long
5616 case "${d_longlong}${longlongsize}" in
5617 $define)
5618         echo " "
5619         echo "Checking to see how big your long longs are..." >&4
5620         $cat >try.c <<'EOCP'
5621 #include <stdio.h>
5622 int main()
5623 {
5624     printf("%d\n", (int)sizeof(long long));
5625     return(0);
5626 }
5627 EOCP
5628         set try
5629         if eval $compile_ok; then
5630                 longlongsize=`$run ./try`
5631                 echo "Your long longs are $longlongsize bytes long."
5632         else
5633                 dflt='8'
5634                 echo " "
5635                 echo "(I can't seem to compile the test program.  Guessing...)"
5636                 rp="What is the size of a long long (in bytes)?"
5637                 . ./myread
5638                 longlongsize="$ans"
5639         fi
5640         if $test "X$longsize" = "X$longlongsize"; then
5641                 echo "(That isn't any different from an ordinary long.)"
5642         fi
5643         ;;
5644 esac
5645 $rm_try
5646
5647 : see if inttypes.h is available
5648 : we want a real compile instead of Inhdr because some systems
5649 : have an inttypes.h which includes non-existent headers
5650 echo " "
5651 $cat >try.c <<EOCP
5652 #include <inttypes.h>
5653 int main() {
5654         static int32_t foo32 = 0x12345678;
5655 }
5656 EOCP
5657 set try
5658 if eval $compile; then
5659         echo "<inttypes.h> found." >&4
5660         val="$define"
5661 else
5662         echo "<inttypes.h> NOT found." >&4
5663         val="$undef"
5664 fi
5665 $rm_try
5666 set i_inttypes
5667 eval $setvar
5668
5669 : check for int64_t
5670 echo " "
5671 echo "Checking to see if you have int64_t..." >&4
5672 $cat >try.c <<EOCP
5673 #include <sys/types.h>
5674 #$i_inttypes I_INTTYPES
5675 #ifdef I_INTTYPES
5676 #include <inttypes.h>
5677 #endif
5678 int main() { int64_t x = 7; }
5679 EOCP
5680 set try
5681 if eval $compile; then
5682         val="$define"
5683         echo "You have int64_t."
5684 else
5685         val="$undef"
5686         echo "You do not have int64_t."
5687 fi
5688 $rm_try
5689 set d_int64_t
5690 eval $setvar
5691
5692 : Check if 64bit ints have a quad type
5693 echo " "
5694 echo "Checking which 64-bit integer type we could use..." >&4
5695
5696 case "$intsize" in
5697 8) val=int
5698    set quadtype
5699    eval $setvar
5700    val='"unsigned int"'
5701    set uquadtype
5702    eval $setvar
5703    quadkind=1
5704    ;;
5705 *) case "$longsize" in
5706    8) val=long
5707       set quadtype
5708       eval $setvar
5709       val='"unsigned long"'
5710       set uquadtype
5711       eval $setvar
5712       quadkind=2
5713       ;;
5714    *) case "$d_longlong:$longlongsize" in
5715       define:8)
5716         val='"long long"'
5717         set quadtype
5718         eval $setvar
5719         val='"unsigned long long"'
5720         set uquadtype
5721         eval $setvar
5722         quadkind=3
5723         ;;
5724       *) case "$d_int64_t" in
5725          define)
5726            val=int64_t
5727            set quadtype
5728            eval $setvar
5729            val=uint64_t
5730            set uquadtype
5731            eval $setvar
5732            quadkind=4
5733            ;;
5734          esac
5735          ;;
5736       esac
5737       ;;
5738    esac
5739    ;;
5740 esac
5741
5742 case "$quadtype" in
5743 '')     echo "Alas, no 64-bit integer types in sight." >&4
5744         d_quad="$undef"
5745         ;;
5746 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5747         d_quad="$define"
5748         ;;
5749 esac
5750
5751 : Do we want 64bit support
5752 case "$uselonglong" in
5753 "$define"|true|[yY]*)
5754         cat <<EOM >&4
5755
5756 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5757 EOM
5758         use64bitint="$define"
5759         ;;
5760 esac
5761 case "$use64bits" in
5762 "$define"|true|[yY]*)
5763         cat <<EOM >&4
5764
5765 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5766 EOM
5767         use64bitint="$define"
5768         ;;
5769 esac
5770 case "$use64bitints" in
5771 "$define"|true|[yY]*)
5772         cat <<EOM >&4
5773
5774 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5775 EOM
5776         use64bitint="$define"
5777         ;;
5778 esac
5779 case "$use64bitsint" in
5780 "$define"|true|[yY]*)
5781         cat <<EOM >&4
5782
5783 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5784 EOM
5785         use64bitint="$define"
5786         ;;
5787 esac
5788 case "$uselonglongs" in
5789 "$define"|true|[yY]*)
5790         cat <<EOM >&4
5791
5792 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5793 EOM
5794         use64bitint="$define"
5795         ;;
5796 esac
5797 case "$use64bitsall" in
5798 "$define"|true|[yY]*)
5799         cat <<EOM >&4
5800
5801 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5802 EOM
5803         use64bitall="$define"
5804         ;;
5805 esac
5806
5807 case "$ccflags" in
5808 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5809 esac
5810 case "$use64bitall" in
5811 "$define"|true|[yY]*) use64bitint="$define" ;;
5812 esac
5813
5814 case "$longsize" in
5815 8) cat <<EOM
5816
5817 You have natively 64-bit long integers.
5818 EOM
5819    val="$define"
5820    ;;
5821 *) case "$use64bitint" in
5822    "$define"|true|[yY]*) dflt='y';;
5823    *) dflt='n';;
5824    esac
5825    case "$d_quad" in
5826    "$define") ;;
5827    *) dflt='n' ;;
5828    esac
5829    cat <<EOM
5830
5831 Perl can be built to take advantage of 64-bit integer types
5832 on some systems.  To do so, Configure can be run with -Duse64bitint.
5833 Choosing this option will most probably introduce binary incompatibilities.
5834
5835 If this doesn't make any sense to you, just accept the default '$dflt'.
5836 (The default has been chosen based on your configuration.)
5837 EOM
5838    rp='Try to use 64-bit integers, if available?'
5839    . ./myread
5840    case "$ans" in
5841    [yY]*) val="$define" ;;
5842    *)     val="$undef"  ;;
5843    esac
5844    ;;
5845 esac
5846 set use64bitint
5847 eval $setvar
5848
5849 case "$use64bitall" in
5850 "$define"|true|[yY]*) dflt='y' ;;
5851 *) case "$longsize" in
5852    8) dflt='y' ;;
5853    *) dflt='n' ;;
5854    esac
5855    ;;
5856 esac
5857 cat <<EOM
5858
5859 You may also choose to try maximal 64-bitness.  It means using as much
5860 64-bitness as possible on the platform.  This in turn means even more
5861 binary incompatibilities.  On the other hand, your platform may not
5862 have any more 64-bitness available than what you already have chosen.
5863
5864 If this doesn't make any sense to you, just accept the default '$dflt'.
5865 (The default has been chosen based on your configuration.)
5866 EOM
5867 rp='Try to use maximal 64-bit support, if available?'
5868 . ./myread
5869 case "$ans" in
5870 [yY]*) val="$define" ;;
5871 *)     val="$undef"  ;;
5872 esac
5873 set use64bitall
5874 eval $setvar
5875 case "$use64bitall" in
5876 "$define")
5877         case "$use64bitint" in
5878         "$undef")
5879                 cat <<EOM
5880
5881 Since you have chosen a maximally 64-bit build, I'm also turning on
5882 the use of 64-bit integers.
5883 EOM
5884                 use64bitint="$define" ;;
5885         esac
5886         ;;
5887 esac
5888
5889 : Look for a hint-file generated 'call-back-unit'.  If the
5890 : user has specified that a 64-bit perl is to be built,
5891 : we may need to set or change some other defaults.
5892 if $test -f use64bitint.cbu; then
5893         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5894         . ./use64bitint.cbu
5895 fi
5896 case "$use64bitint" in
5897 "$define"|true|[yY]*)
5898         case "$longsize" in
5899         4) case "$archname64" in
5900            '') archname64=64int ;;
5901            esac
5902            ;;
5903         esac
5904         ;;
5905 esac
5906
5907 : Look for a hint-file generated 'call-back-unit'.  If the
5908 : user has specified that a maximally 64-bit perl is to be built,
5909 : we may need to set or change some other defaults.
5910 if $test -f use64bitall.cbu; then
5911         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5912         . ./use64bitall.cbu
5913 fi
5914 case "$use64bitall" in
5915 "$define"|true|[yY]*)
5916         case "$longsize" in
5917         4) case "$archname64" in
5918            ''|64int) archname64=64all ;;
5919            esac
5920            ;;
5921         esac
5922         ;;
5923 esac
5924
5925 case "$d_quad:$use64bitint" in
5926 $undef:$define)
5927         cat >&4 <<EOF
5928
5929 *** You have chosen to use 64-bit integers,
5930 *** but none can be found.
5931 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5932 *** Cannot continue, aborting.
5933
5934 EOF
5935         exit 1
5936         ;;
5937 esac
5938
5939 : check for length of double
5940 echo " "
5941 case "$doublesize" in
5942 '')
5943         echo "Checking to see how big your double precision numbers are..." >&4
5944         $cat >try.c <<EOCP
5945 #include <stdio.h>
5946 #$i_stdlib I_STDLIB
5947 #ifdef I_STDLIB
5948 #include <stdlib.h>
5949 #endif
5950 int main()
5951 {
5952     printf("%d\n", (int)sizeof(double));
5953     exit(0);
5954 }
5955 EOCP
5956         set try
5957         if eval $compile_ok; then
5958                 doublesize=`$run ./try`
5959                 echo "Your double is $doublesize bytes long."
5960         else
5961                 dflt='8'
5962                 echo "(I can't seem to compile the test program.  Guessing...)"
5963                 rp="What is the size of a double precision number (in bytes)?"
5964                 . ./myread
5965                 doublesize="$ans"
5966         fi
5967         ;;
5968 esac
5969 $rm_try
5970
5971 : check for long doubles
5972 echo " "
5973 echo "Checking to see if you have long double..." >&4
5974 echo 'int main() { long double x = 7.0; }' > try.c
5975 set try
5976 if eval $compile; then
5977         val="$define"
5978         echo "You have long double."
5979 else
5980         val="$undef"
5981         echo "You do not have long double."
5982 fi
5983 $rm_try
5984 set d_longdbl
5985 eval $setvar
5986
5987 : check for length of long double
5988 case "${d_longdbl}${longdblsize}" in
5989 $define)
5990         echo " "
5991         echo "Checking to see how big your long doubles are..." >&4
5992         $cat >try.c <<'EOCP'
5993 #include <stdio.h>
5994 int main()
5995 {
5996         printf("%d\n", sizeof(long double));
5997 }
5998 EOCP
5999         set try
6000         set try
6001         if eval $compile; then
6002                 longdblsize=`$run ./try`
6003                 echo "Your long doubles are $longdblsize bytes long."
6004         else
6005                 dflt='8'
6006                 echo " "
6007                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6008                 rp="What is the size of a long double (in bytes)?"
6009                 . ./myread
6010                 longdblsize="$ans"
6011         fi
6012         if $test "X$doublesize" = "X$longdblsize"; then
6013                 echo "That isn't any different from an ordinary double."
6014                 echo "I'll keep your setting anyway, but you may see some"
6015                 echo "harmless compilation warnings."
6016         fi
6017         ;;
6018 esac
6019 $rm_try
6020
6021 : determine the architecture name
6022 echo " "
6023 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6024         tarch=`arch`"-$osname"
6025 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6026         if uname -m > tmparch 2>&1 ; then
6027                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6028                         -e 's/$/'"-$osname/" tmparch`
6029         else
6030                 tarch="$osname"
6031         fi
6032         $rm -f tmparch
6033 else
6034         tarch="$osname"
6035 fi
6036 case "$myarchname" in
6037 ''|"$tarch") ;;
6038 *)
6039         echo "(Your architecture name used to be $myarchname.)"
6040         archname=''
6041         ;;
6042 esac
6043 case "$targetarch" in
6044 '') ;;
6045 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6046 esac
6047 myarchname="$tarch"
6048 case "$archname" in
6049 '') dflt="$tarch";;
6050 *) dflt="$archname";;
6051 esac
6052 rp='What is your architecture name'
6053 . ./myread
6054 archname="$ans"
6055 case "$usethreads" in
6056 $define)
6057         echo "Threads selected." >&4
6058         case "$archname" in
6059         *-thread*) echo "...and architecture name already has -thread." >&4
6060                 ;;
6061         *)      archname="$archname-thread"
6062                 echo "...setting architecture name to $archname." >&4
6063                 ;;
6064         esac
6065         ;;
6066 esac
6067 case "$usemultiplicity" in
6068 $define)
6069         echo "Multiplicity selected." >&4
6070         case "$archname" in
6071         *-multi*) echo "...and architecture name already has -multi." >&4
6072                 ;;
6073         *)      archname="$archname-multi"
6074                 echo "...setting architecture name to $archname." >&4
6075                 ;;
6076         esac
6077         ;;
6078 esac
6079 case "$use64bitint$use64bitall" in
6080 *"$define"*)
6081         case "$archname64" in
6082         '')
6083                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6084                 ;;
6085         *)
6086                 case "$use64bitint" in
6087                 "$define") echo "64 bit integers selected." >&4 ;;
6088                 esac
6089                 case "$use64bitall" in
6090                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6091                 esac
6092                 case "$archname" in
6093                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6094                         ;;
6095                 *)      archname="$archname-$archname64"
6096                         echo "...setting architecture name to $archname." >&4
6097                         ;;
6098                 esac
6099                 ;;
6100         esac
6101 esac
6102 case "$uselongdouble" in
6103 $define)
6104         echo "Long doubles selected." >&4
6105         case "$longdblsize" in
6106         $doublesize)
6107                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6108                 ;;
6109         *)
6110                 case "$archname" in
6111                 *-ld*) echo "...and architecture name already has -ld." >&4
6112                         ;;
6113                 *)      archname="$archname-ld"
6114                         echo "...setting architecture name to $archname." >&4
6115                         ;;
6116                 esac
6117                 ;;
6118         esac
6119         ;;
6120 esac
6121 case "$useperlio" in
6122 $define)
6123         echo "Perlio selected." >&4
6124         ;;
6125 *)
6126         echo "Perlio not selected, using stdio." >&4
6127         case "$archname" in
6128         *-stdio*) echo "...and architecture name already has -stdio." >&4
6129                 ;;
6130         *)      archname="$archname-stdio"
6131                 echo "...setting architecture name to $archname." >&4
6132                 ;;
6133         esac
6134         ;;
6135 esac
6136 if $test -f archname.cbu; then
6137         echo "Your platform has some specific hints for architecture name, using them..."
6138         . ./archname.cbu
6139 fi
6140
6141 : set the prefixit variable, to compute a suitable default value
6142 prefixit='case "$3" in
6143 ""|none)
6144         case "$oldprefix" in
6145         "") eval "$1=\"\$$2\"";;
6146         *)
6147                 case "$3" in
6148                 "") eval "$1=";;
6149                 none)
6150                         eval "tp=\"\$$2\"";
6151                         case "$tp" in
6152                         ""|" ") eval "$1=\"\$$2\"";;
6153                         *) eval "$1=";;
6154                         esac;;
6155                 esac;;
6156         esac;;
6157 *)
6158         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6159         case "$tp" in
6160         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6161         /*-$oldprefix/*|\~*-$oldprefix/*)
6162                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6163         *) eval "$1=\"\$$2\"";;
6164         esac;;
6165 esac'
6166
6167 : determine installation style
6168 : For now, try to deduce it from prefix unless it is already set.
6169 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6170 case "$installstyle" in
6171 '')     case "$prefix" in
6172                 *perl*) dflt='lib';;
6173                 *) dflt='lib/perl5' ;;
6174         esac
6175         ;;
6176 *)      dflt="$installstyle" ;;
6177 esac
6178 : Probably not worth prompting for this since we prompt for all
6179 : the directories individually, and the prompt would be too long and
6180 : confusing anyway.
6181 installstyle=$dflt
6182
6183 : determine where public executables go
6184 echo " "
6185 set dflt bin bin
6186 eval $prefixit
6187 fn=d~
6188 rp='Pathname where the public executables will reside?'
6189 . ./getfile
6190 if $test "X$ansexp" != "X$binexp"; then
6191         installbin=''
6192 fi
6193 prefixvar=bin
6194 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6195 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6196 :     this via initialinstalllocation
6197 . ./setprefixvar
6198
6199 case "$userelocatableinc" in
6200 $define|true|[yY]*)     dflt='y' ;;
6201 *)                      dflt='n' ;;
6202 esac
6203 cat <<EOM
6204
6205 Would you like to build Perl so that the installation is relocatable, so that
6206 library paths in @INC are determined relative to the path of the perl binary?
6207 This is not advised for system Perl installs, or if you need to run setid
6208 scripts or scripts under taint mode.
6209
6210 If this doesn't make any sense to you, just accept the default '$dflt'.
6211 EOM
6212 rp='Use relocatable @INC?'
6213 . ./myread
6214 case "$ans" in
6215 y|Y)    val="$define" ;;
6216 *)      val="$undef"  ;;
6217 esac
6218 set userelocatableinc
6219 eval $setvar
6220
6221 initialinstalllocation="$binexp"
6222 : Default prefix is now "up one level from where the binaries are"
6223 case "$userelocatableinc" in
6224 $define|true|[yY]*)
6225     bin=".../"
6226     binexp=".../"
6227     prefix=".../.."
6228     prefixexp=".../.."
6229     installprefixexp=".../.."
6230     ;;
6231 esac
6232
6233 : determine where private library files go
6234 : Usual default is /usr/local/lib/perl5/$version.
6235 : Also allow things like /opt/perl/lib/$version, since
6236 : /opt/perl/lib/perl5... would be redundant.
6237 : The default "style" setting is made in installstyle.U
6238 case "$installstyle" in
6239 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6240 *)       set dflt privlib lib/$version ;;
6241 esac
6242 eval $prefixit
6243 $cat <<EOM
6244
6245 There are some auxiliary files for $package that need to be put into a
6246 private library directory that is accessible by everyone.
6247
6248 EOM
6249 fn=$binexp
6250 fn=d~+
6251 rp='Pathname where the private library files will reside?'
6252 . ./getfile
6253 prefixvar=privlib
6254 . ./setprefixvar
6255
6256 : set the prefixup variable, to restore leading tilda escape
6257 prefixup='case "$prefixexp" in
6258 "$prefix") ;;
6259 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6260 esac'
6261
6262 : determine where public architecture dependent libraries go
6263 set archlib archlib
6264 eval $prefixit
6265 : privlib default is /usr/local/lib/$package/$version
6266 : archlib default is /usr/local/lib/$package/$version/$archname
6267 : privlib may have an optional trailing /share.
6268 tdflt=`echo $privlib | $sed 's,/share$,,'`
6269 tdflt=$tdflt/$archname
6270 case "$archlib" in
6271 '')     dflt=$tdflt
6272         ;;
6273 *)      dflt="$archlib"
6274     ;;
6275 esac
6276 $cat <<EOM
6277
6278 $spackage contains architecture-dependent library files.  If you are
6279 sharing libraries in a heterogeneous environment, you might store
6280 these files in a separate location.  Otherwise, you can just include
6281 them with the rest of the public library files.
6282
6283 EOM
6284 fn=$binexp
6285 fn=d+~
6286 rp='Where do you want to put the public architecture-dependent libraries?'
6287 . ./getfile
6288 prefixvar=archlib
6289 . ./setprefixvar
6290 if $test X"$archlib" = X"$privlib"; then
6291         d_archlib="$undef"
6292 else
6293         d_archlib="$define"
6294 fi
6295
6296 : see if setuid scripts can be secure
6297 $cat <<EOM
6298
6299 Some kernels have a bug that prevents setuid #! scripts from being
6300 secure.  Some sites have disabled setuid #! scripts because of this.
6301
6302 First let's decide if your kernel supports secure setuid #! scripts.
6303 (If setuid #! scripts would be secure but have been disabled anyway,
6304 don't say that they are secure if asked.)
6305
6306 EOM
6307
6308 val="$undef"
6309 if $test -d /dev/fd; then
6310         echo "#!$ls" >reflect
6311         chmod +x,u+s reflect
6312         ./reflect >flect 2>&1
6313         if $contains "/dev/fd" flect >/dev/null; then
6314                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6315                 val="$define"
6316         else
6317                 $cat <<EOM
6318 If you are not sure if they are secure, I can check but I'll need a
6319 username and password different from the one you are using right now.
6320 If you don't have such a username or don't want me to test, simply
6321 enter 'none'.
6322
6323 EOM
6324                 rp='Other username to test security of setuid scripts with?'
6325                 dflt='none'
6326                 . ./myread
6327                 case "$ans" in
6328                 n|none)
6329                         case "$d_suidsafe" in
6330                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6331                                 dflt=n;;
6332                         "$undef")
6333                                 echo "Well, the $hint value is *not* secure." >&4
6334                                 dflt=n;;
6335                         *)      echo "Well, the $hint value *is* secure." >&4
6336                                 dflt=y;;
6337                         esac
6338                         ;;
6339                 *)
6340                         $rm -f reflect flect
6341                         echo "#!$ls" >reflect
6342                         chmod +x,u+s reflect
6343                         echo >flect
6344                         chmod a+w flect
6345                         echo '"su" will (probably) prompt you for '"$ans's password."
6346                         su $ans -c './reflect >flect'
6347                         if $contains "/dev/fd" flect >/dev/null; then
6348                                 echo "Okay, it looks like setuid scripts are secure." >&4
6349                                 dflt=y
6350                         else
6351                                 echo "I don't think setuid scripts are secure." >&4
6352                                 dflt=n
6353                         fi
6354                         ;;
6355                 esac
6356                 rp='Does your kernel have *secure* setuid scripts?'
6357                 . ./myread
6358                 case "$ans" in
6359                 [yY]*)  val="$define";;
6360                 *)      val="$undef";;
6361                 esac
6362         fi
6363 else
6364         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6365         echo "(That's for file descriptors, not floppy disks.)"
6366         val="$undef"
6367 fi
6368 set d_suidsafe
6369 eval $setvar
6370
6371 $rm -f reflect flect
6372
6373 : now see if they want to do setuid emulation
6374 if $test $patchlevel -lt 11; then
6375 echo " "
6376 val="$undef"
6377 case "$d_suidsafe" in
6378 "$define")
6379         val="$undef"
6380         echo "No need to emulate SUID scripts since they are secure here." >&4
6381         ;;
6382 *)
6383         $cat <<EOM
6384 Some systems have disabled setuid scripts, especially systems where
6385 setuid scripts cannot be secure.  On systems where setuid scripts have
6386 been disabled, the setuid/setgid bits on scripts are currently
6387 useless.  It is possible for $package to detect those bits and emulate
6388 setuid/setgid in a secure fashion.  This emulation will only work if
6389 setuid scripts have been disabled in your kernel.
6390
6391 EOM
6392         case "$d_dosuid" in
6393         "$define") dflt=y ;;
6394         *) dflt=n ;;
6395         esac
6396         rp="Do you want to do setuid/setgid emulation?"
6397         . ./myread
6398         case "$ans" in
6399         [yY]*)  val="$define";;
6400         *)      val="$undef";;
6401         esac
6402         ;;
6403 esac
6404 set d_dosuid
6405 eval $setvar
6406 else
6407     case "$d_dosuid" in
6408         "$define")
6409         cat >&4 <<EOH
6410
6411 SUID emulation has been removed for 5.12
6412 Please re-run Configure without -Dd_dosuid
6413
6414 EOH
6415         exit 1;
6416         ;;
6417     esac
6418     d_dosuid=undef
6419 fi
6420
6421 : Find perl5.005 or later.
6422 echo "Looking for a previously installed perl5.005 or later... "
6423 case "$perl5" in
6424 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6425                 : Check if this perl is recent and can load a simple module
6426                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6427                         perl5=$tdir/perl
6428                         break;
6429                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6430                         perl5=$tdir/perl5
6431                         break;
6432                 fi
6433         done
6434         ;;
6435 *)      perl5="$perl5"
6436         ;;
6437 esac
6438 case "$perl5" in
6439 '')     echo "None found.  That's ok.";;
6440 *)      echo "Using $perl5." ;;
6441 esac
6442
6443 : Set the siteprefix variables
6444 $cat <<EOM
6445
6446 After $package is installed, you may wish to install various
6447 add-on modules and utilities.  Typically, these add-ons will
6448 be installed under $prefix with the rest
6449 of this package.  However, you may wish to install such add-ons
6450 elsewhere under a different prefix.
6451
6452 If you do not wish to put everything under a single prefix, that's
6453 ok.  You will be prompted for the individual locations; this siteprefix
6454 is only used to suggest the defaults.
6455
6456 The default should be fine for most people.
6457
6458 EOM
6459 fn=d~+
6460 rp='Installation prefix to use for add-on modules and utilities?'
6461 : XXX Here might be another good place for an installstyle setting.
6462 case "$siteprefix" in
6463 '') dflt=$prefix ;;
6464 *)  dflt=$siteprefix ;;
6465 esac
6466 . ./getfile
6467 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6468 oldsiteprefix=''
6469 case "$siteprefix" in
6470 '') ;;
6471 *)      case "$ans" in
6472         "$prefix") ;;
6473         *) oldsiteprefix="$prefix";;
6474         esac
6475         ;;
6476 esac
6477 siteprefix="$ans"
6478 siteprefixexp="$ansexp"
6479
6480 : determine where site specific libraries go.
6481 : Usual default is /usr/local/lib/perl5/site_perl/$version
6482 : The default "style" setting is made in installstyle.U
6483 : XXX No longer works with Prefixit stuff.
6484 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6485 case "$sitelib" in
6486 '') case "$installstyle" in
6487         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6488         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6489         esac
6490         ;;
6491 *)      dflt="$sitelib"
6492         ;;
6493 esac
6494 $cat <<EOM
6495
6496 The installation process will create a directory for
6497 site-specific extensions and modules.  Most users find it convenient
6498 to place all site-specific files in this directory rather than in the
6499 main distribution directory.
6500
6501 EOM
6502 fn=d~+
6503 rp='Pathname for the site-specific library files?'
6504 . ./getfile
6505 prefixvar=sitelib
6506 . ./setprefixvar
6507 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6508
6509 : Determine list of previous versions to include in @INC
6510 $cat > getverlist <<EOPL
6511 #!$perl5 -w
6512 use File::Basename;
6513 \$api_versionstring = "$api_versionstring";
6514 \$version = "$version";
6515 \$stem = "$sitelib_stem";
6516 \$archname = "$archname";
6517 EOPL
6518         $cat >> getverlist <<'EOPL'
6519 # The list found is store twice for each entry: the original name, and
6520 # the binary broken down version as pack "sss", so sorting is easy and
6521 # unambiguous. This will work for all versions that have a maximum of
6522 # three digit groups, separate by '.'s or '_'s. Names are extended with
6523 # ".0.0" to ensure at least three elements for the pack.
6524 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6525
6526 # Can't have leading @ because metaconfig interprets it as a command!
6527 ;@inc_version_list=();
6528 # XXX Redo to do opendir/readdir?
6529 if (-d $stem) {
6530     chdir($stem);
6531     ;@candidates = map {
6532         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6533 }
6534 else {
6535     ;@candidates = ();
6536 }
6537
6538 ($pversion, $aversion, $vsn5005) = map {
6539     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6540 foreach $d (@candidates) {
6541     if ($d->[1] lt $pversion) {
6542         if ($d->[1] ge $aversion) {
6543             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6544         }
6545         elsif ($d->[1] ge $vsn5005) {
6546             unshift(@inc_version_list, grep { -d } $d->[0]);
6547         }
6548     }
6549     else {
6550         # Skip newer version.  I.e. don't look in
6551         # 5.7.0 if we're installing 5.6.1.
6552     }
6553 }
6554
6555 if (@inc_version_list) {
6556     print join(' ', @inc_version_list);
6557 }
6558 else {
6559     # Blank space to preserve value for next Configure run.
6560     print " ";
6561 }
6562 EOPL
6563 chmod +x getverlist
6564 case "$inc_version_list" in
6565 '')     if test -x "$perl5$exe_ext"; then
6566                 dflt=`$perl5 getverlist`
6567         else
6568                 dflt='none'
6569         fi
6570         ;;
6571 $undef) dflt='none' ;;
6572 *)  eval dflt=\"$inc_version_list\" ;;
6573 esac
6574 case "$dflt" in
6575 ''|' ') dflt=none ;;
6576 esac
6577 case "$dflt" in
6578 5.005) dflt=none ;;
6579 esac
6580 $cat <<EOM
6581
6582 In order to ease the process of upgrading, this version of perl
6583 can be configured to use modules built and installed with earlier
6584 versions of perl that were installed under $prefix.  Specify here
6585 the list of earlier versions that this version of perl should check.
6586 If Configure detected no earlier versions of perl installed under
6587 $prefix, then the list will be empty.  Answer 'none' to tell perl
6588 to not search earlier versions.
6589
6590 The default should almost always be sensible, so if you're not sure,
6591 just accept the default.
6592 EOM
6593
6594 rp='List of earlier versions to include in @INC?'
6595 . ./myread
6596 case "$ans" in
6597 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6598 *) inc_version_list="$ans" ;;
6599 esac
6600 case "$inc_version_list" in
6601 ''|' ')
6602         inc_version_list_init='0'
6603         d_inc_version_list="$undef"
6604         ;;
6605 *)      inc_version_list_init=`echo $inc_version_list |
6606                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6607         d_inc_version_list="$define"
6608         ;;
6609 esac
6610 $rm -f getverlist
6611
6612 : see if malloc/malloc.h has to be included
6613 set malloc/malloc.h i_mallocmalloc
6614 eval $inhdr
6615
6616 : see if this is a malloc.h system
6617 : we want a real compile instead of Inhdr because some systems have a
6618 : malloc.h that just gives a compile error saying to use stdlib.h instead
6619 echo " "
6620 $cat >try.c <<EOCP
6621 #include <stdlib.h>
6622 #include <malloc.h>
6623 #$i_mallocmalloc I_MALLOCMALLOC
6624 #ifdef I_MALLOCMALLOC
6625 # include <malloc/malloc.h>
6626 #endif
6627
6628 int main () { return 0; }
6629 EOCP
6630 set try
6631 if eval $compile; then
6632     echo "<malloc.h> found." >&4
6633     val="$define"
6634 else
6635     echo "<malloc.h> NOT found." >&4
6636     val="$undef"
6637 fi
6638 $rm_try
6639 set i_malloc
6640 eval $setvar
6641
6642 : check for void type
6643 echo " "
6644 echo "Checking to see how well your C compiler groks the void type..." >&4
6645 case "$voidflags" in
6646 '')
6647         $cat >try.c <<EOCP
6648 #$i_stdlib I_STDLIB
6649 #ifdef I_STDLIB
6650 #include <stdlib.h>
6651 #endif
6652 #if TRY & 1
6653 void sub() {
6654 #else
6655 sub() {
6656 #endif
6657         extern void moo();      /* function returning void */
6658         void (*goo)();          /* ptr to func returning void */
6659 #if TRY & 8
6660         void *hue;              /* generic ptr */
6661 #endif
6662 #if TRY & 2
6663         void (*foo[10])();
6664 #endif
6665
6666 #if TRY & 4
6667         if(goo == moo) {
6668                 exit(0);
6669         }
6670 #endif
6671         exit(0);
6672 }
6673 int main() { sub(); }
6674 EOCP
6675         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6676                 voidflags=$defvoidused
6677         echo "Good.  It appears to support void to the level $package wants.">&4
6678                 if $contains warning .out >/dev/null 2>&1; then
6679                         echo "However, you might get some warnings that look like this:"
6680                         $cat .out
6681                 fi
6682         else
6683 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6684                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6685                         echo "It supports 1..."
6686                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6687                                 echo "It also supports 2..."
6688                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6689                                         voidflags=7
6690                                         echo "And it supports 4 but not 8 definitely."
6691                                 else
6692                                         echo "It doesn't support 4..."
6693                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6694                                                 voidflags=11
6695                                                 echo "But it supports 8."
6696                                         else
6697                                                 voidflags=3
6698                                                 echo "Neither does it support 8."
6699                                         fi
6700                                 fi
6701                         else
6702                                 echo "It does not support 2..."
6703                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6704                                         voidflags=13
6705                                         echo "But it supports 4 and 8."
6706                                 else
6707                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6708                                                 voidflags=5
6709                                                 echo "And it supports 4 but has not heard about 8."
6710                                         else
6711                                                 echo "However it supports 8 but not 4."
6712                                         fi
6713                                 fi
6714                         fi
6715                 else
6716                         echo "There is no support at all for void."
6717                         voidflags=0
6718                 fi
6719         fi
6720 esac
6721 case "$voidflags" in
6722 "$defvoidused") ;;
6723 *)      $cat >&4 <<'EOM'
6724   Support flag bits are:
6725     1: basic void declarations.
6726     2: arrays of pointers to functions returning void.
6727     4: operations between pointers to and addresses of void functions.
6728     8: generic void pointers.
6729 EOM
6730         dflt="$voidflags";
6731         rp="Your void support flags add up to what?"
6732         . ./myread
6733         voidflags="$ans"
6734         ;;
6735 esac
6736 $rm_try
6737
6738 : check for length of pointer
6739 echo " "
6740 case "$ptrsize" in
6741 '')
6742         echo "Checking to see how big your pointers are..." >&4
6743         if test "$voidflags" -gt 7; then
6744                 echo '#define VOID_PTR char *' > try.c
6745         else
6746                 echo '#define VOID_PTR void *' > try.c
6747         fi
6748         $cat >>try.c <<EOCP
6749 #include <stdio.h>
6750 #$i_stdlib I_STDLIB
6751 #ifdef I_STDLIB
6752 #include <stdlib.h>
6753 #endif
6754 int main()
6755 {
6756     printf("%d\n", (int)sizeof(VOID_PTR));
6757     exit(0);
6758 }
6759 EOCP
6760         set try
6761         if eval $compile_ok; then
6762                 ptrsize=`$run ./try`
6763                 echo "Your pointers are $ptrsize bytes long."
6764         else
6765                 dflt='4'
6766                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6767                 rp="What is the size of a pointer (in bytes)?"
6768                 . ./myread
6769                 ptrsize="$ans"
6770         fi
6771         ;;
6772 esac
6773 $rm_try
6774 case "$use64bitall" in
6775 "$define"|true|[yY]*)
6776         case "$ptrsize" in
6777         4)      cat <<EOM >&4
6778
6779 *** You have chosen a maximally 64-bit build,
6780 *** but your pointers are only 4 bytes wide.
6781 *** Please rerun Configure without -Duse64bitall.
6782 EOM
6783                 case "$d_quad" in
6784                 define)
6785                         cat <<EOM >&4
6786 *** Since you have quads, you could possibly try with -Duse64bitint.
6787 EOM
6788                         ;;
6789                 esac
6790                 cat <<EOM >&4
6791 *** Cannot continue, aborting.
6792
6793 EOM
6794
6795                 exit 1
6796                 ;;
6797         esac
6798         ;;
6799 esac
6800
6801
6802 : determine whether to use malloc wrapping
6803 echo " "
6804 case "$usemallocwrap" in
6805 [yY]*|true|$define)     dflt='y' ;;
6806 [nN]*|false|$undef)     dflt='n' ;;
6807 *)      case "$usedevel" in
6808         [yY]*|true|$define)     dflt='y' ;;
6809         *) dflt='n' ;;
6810         esac
6811         ;;
6812 esac
6813 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6814 . ./myread
6815 usemallocwrap="$ans"
6816 case "$ans" in
6817 y*|true)
6818         usemallocwrap="$define" ;;
6819 *)
6820         usemallocwrap="$undef" ;;
6821 esac
6822
6823 : determine which malloc to compile in
6824 echo " "
6825 case "$usemymalloc" in
6826 [yY]*|true|$define)     dflt='y' ;;
6827 [nN]*|false|$undef)     dflt='n' ;;
6828 *)      case "$ptrsize" in
6829         4) dflt='y' ;;
6830         *) dflt='n' ;;
6831         esac
6832         ;;
6833 esac
6834 rp="Do you wish to attempt to use the malloc that comes with $package?"
6835 . ./myread
6836 usemymalloc="$ans"
6837 case "$ans" in
6838 y*|true)
6839         usemymalloc='y'
6840         mallocsrc='malloc.c'
6841         mallocobj="malloc$_o"
6842         d_mymalloc="$define"
6843         case "$libs" in
6844         *-lmalloc*)
6845                 : Remove malloc from list of libraries to use
6846                 echo "Removing unneeded -lmalloc from library list" >&4
6847                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6848                 shift
6849                 libs="$*"
6850                 echo "libs = $libs" >&4
6851                 ;;
6852         esac
6853         ;;
6854 *)
6855         usemymalloc='n'
6856         mallocsrc=''
6857         mallocobj=''
6858         d_mymalloc="$undef"
6859         ;;
6860 esac
6861
6862 : compute the return types of malloc and free
6863 echo " "
6864 $cat >malloc.c <<END
6865 #$i_malloc I_MALLOC
6866 #$i_stdlib I_STDLIB
6867 #include <stdio.h>
6868 #include <sys/types.h>
6869 #ifdef I_MALLOC
6870 #include <malloc.h>
6871 #endif
6872 #ifdef I_STDLIB
6873 #include <stdlib.h>
6874 #endif
6875 #ifdef TRY_MALLOC
6876 void *malloc();
6877 #endif
6878 #ifdef TRY_FREE
6879 void free();
6880 #endif
6881 END
6882 case "$malloctype" in
6883 '')
6884         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6885                 malloctype='void *'
6886         else
6887                 malloctype='char *'
6888         fi
6889         ;;
6890 esac
6891 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6892
6893 case "$freetype" in
6894 '')
6895         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6896                 freetype='void'
6897         else
6898                 freetype='int'
6899         fi
6900         ;;
6901 esac
6902 echo "Your system uses $freetype free(), it would seem." >&4
6903 $rm -f malloc.[co]
6904 : determine where site specific architecture-dependent libraries go.
6905 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6906 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6907 : sitelib may have an optional trailing /share.
6908 case "$sitearch" in
6909 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6910         dflt="$dflt/$archname"
6911         ;;
6912 *)      dflt="$sitearch"
6913         ;;
6914 esac
6915 set sitearch sitearch none
6916 eval $prefixit
6917 $cat <<EOM
6918
6919 The installation process will also create a directory for
6920 architecture-dependent site-specific extensions and modules.
6921
6922 EOM
6923 fn=d~+
6924 rp='Pathname for the site-specific architecture-dependent library files?'
6925 . ./getfile
6926 prefixvar=sitearch
6927 . ./setprefixvar
6928 if $test X"$sitearch" = X"$sitelib"; then
6929         d_sitearch="$undef"
6930 else
6931         d_sitearch="$define"
6932 fi
6933
6934 : Set the vendorprefix variables
6935 $cat <<EOM
6936
6937 The installation process will also create a directory for
6938 vendor-supplied add-ons.  Vendors who supply perl with their system
6939 may find it convenient to place all vendor-supplied files in this
6940 directory rather than in the main distribution directory.  This will
6941 ease upgrades between binary-compatible maintenance versions of perl.
6942
6943 Of course you may also use these directories in whatever way you see
6944 fit.  For example, you might use them to access modules shared over a
6945 company-wide network.
6946
6947 The default answer should be fine for most people.
6948 This causes further questions about vendor add-ons to be skipped
6949 and no vendor-specific directories will be configured for perl.
6950
6951 EOM
6952 rp='Do you want to configure vendor-specific add-on directories?'
6953 case "$usevendorprefix" in
6954 define|true|[yY]*) dflt=y ;;
6955 *)      : User may have set vendorprefix directly on Configure command line.
6956         case "$vendorprefix" in
6957         ''|' ') dflt=n ;;
6958         *)      dflt=y ;;
6959         esac
6960         ;;
6961 esac
6962 . ./myread
6963 case "$ans" in
6964 [yY]*)  fn=d~+
6965         rp='Installation prefix to use for vendor-supplied add-ons?'
6966         case "$vendorprefix" in
6967         '') dflt='' ;;
6968         *)  dflt=$vendorprefix ;;
6969         esac
6970         . ./getfile
6971         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6972         oldvendorprefix=''
6973         case "$vendorprefix" in
6974         '') ;;
6975         *)      case "$ans" in
6976                 "$prefix") ;;
6977                 *) oldvendorprefix="$prefix";;
6978                 esac
6979                 ;;
6980         esac
6981         usevendorprefix="$define"
6982         vendorprefix="$ans"
6983         vendorprefixexp="$ansexp"
6984         ;;
6985 *)      usevendorprefix="$undef"
6986         vendorprefix=''
6987         vendorprefixexp=''
6988         ;;
6989 esac
6990
6991 : Set the vendorlib variables
6992 case "$vendorprefix" in
6993 '')     d_vendorlib="$undef"
6994         vendorlib=''
6995         vendorlibexp=''
6996         ;;
6997 *)      d_vendorlib="$define"
6998         : determine where vendor-supplied modules go.
6999         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7000         case "$vendorlib" in
7001         '')
7002                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7003                 case "$installstyle" in
7004                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7005                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7006                 esac
7007                 ;;
7008         *)      dflt="$vendorlib"
7009                 ;;
7010         esac
7011         fn=d~+
7012         rp='Pathname for the vendor-supplied library files?'
7013         . ./getfile
7014         vendorlib="$ans"
7015         vendorlibexp="$ansexp"
7016         ;;
7017 esac
7018 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7019 prefixvar=vendorlib
7020 . ./installprefix
7021
7022 : Set the vendorarch variables
7023 case "$vendorprefix" in
7024 '')     d_vendorarch="$undef"
7025         vendorarch=''
7026         vendorarchexp=''
7027         ;;
7028 *)      d_vendorarch="$define"
7029         : determine where vendor-supplied architecture-dependent libraries go.
7030         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7031         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7032         : vendorlib may have an optional trailing /share.
7033         case "$vendorarch" in
7034         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7035                 dflt="$dflt/$archname"
7036                 ;;
7037         *)      dflt="$vendorarch" ;;
7038         esac
7039         fn=d~+
7040         rp='Pathname for vendor-supplied architecture-dependent files?'
7041         . ./getfile
7042         vendorarch="$ans"
7043         vendorarchexp="$ansexp"
7044         ;;
7045 esac
7046 prefixvar=vendorarch
7047 . ./installprefix
7048 if $test X"$vendorarch" = X"$vendorlib"; then
7049         d_vendorarch="$undef"
7050 else
7051         d_vendorarch="$define"
7052 fi
7053
7054 : Final catch-all directories to search
7055 $cat <<EOM
7056
7057 Lastly, you can have perl look in other directories for extensions and
7058 modules in addition to those already specified.
7059 These directories will be searched after 
7060         $sitearch 
7061         $sitelib 
7062 EOM
7063 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7064 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7065 echo ' '
7066 case "$otherlibdirs" in
7067 ''|' ') dflt='none' ;;
7068 *)      dflt="$otherlibdirs" ;;
7069 esac
7070 $cat <<EOM
7071 Enter a colon-separated set of extra paths to include in perl's @INC
7072 search path, or enter 'none' for no extra paths.
7073
7074 EOM
7075
7076 rp='Colon-separated list of additional directories for perl to search?'
7077 . ./myread
7078 case "$ans" in
7079 ' '|''|none)    otherlibdirs=' ' ;;     
7080 *)      otherlibdirs="$ans" ;;
7081 esac
7082 case "$otherlibdirs" in
7083 ' ') val=$undef ;;
7084 *)      val=$define ;;
7085 esac
7086 set d_perl_otherlibdirs
7087 eval $setvar
7088
7089 : Cruising for prototypes
7090 echo " "
7091 echo "Checking out function prototypes..." >&4
7092 $cat >prototype.c <<EOCP
7093 #$i_stdlib I_STDLIB
7094 #ifdef I_STDLIB
7095 #include <stdlib.h>
7096 #endif
7097 int main(int argc, char *argv[]) {
7098         exit(0);}
7099 EOCP
7100 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7101         echo "Your C compiler appears to support function prototypes."
7102         val="$define"
7103 else
7104         echo "Your C compiler doesn't seem to understand function prototypes."
7105         val="$undef"
7106 fi
7107 set prototype
7108 eval $setvar
7109 $rm -f prototype*
7110
7111 : Check if ansi2knr is required
7112 case "$prototype" in
7113 "$define") ;;
7114 *)      ansi2knr='ansi2knr'
7115         echo " "
7116         cat <<EOM >&4
7117
7118 $me:  FATAL ERROR:
7119 This version of $package can only be compiled by a compiler that 
7120 understands function prototypes.  Unfortunately, your C compiler 
7121         $cc $ccflags
7122 doesn't seem to understand them.  Sorry about that.
7123
7124 If GNU cc is available for your system, perhaps you could try that instead.  
7125
7126 Eventually, we hope to support building Perl with pre-ANSI compilers.
7127 If you would like to help in that effort, please contact <perlbug@perl.org>.
7128
7129 Aborting Configure now.
7130 EOM
7131         exit 2
7132         ;;
7133 esac
7134
7135 : DTrace support
7136 dflt_dtrace='/usr/sbin/dtrace'
7137 cat <<EOM
7138
7139 Perl can be built to support DTrace on platforms that support it.
7140 DTrace is a diagnosis and performance analysis tool from Sun.
7141
7142 If this doesn't make any sense to you, just accept the default '$dflt'.
7143 EOM
7144
7145 while $test 1 ; do
7146         case "$usedtrace" in
7147         $define|true|[yY]*)
7148                 dflt='y'
7149                 ;;
7150         ?*)
7151                 dflt='y'
7152                 dflt_dtrace=$usedtrace
7153                 ;;
7154         *)
7155                 dflt='n'
7156                 ;;
7157         esac
7158
7159         rp='Support DTrace if available?'
7160         . ./myread
7161         case "$ans" in
7162         y|Y)    val="$define" ;;
7163         *)      val="$undef" ;;
7164         esac
7165         set usedtrace
7166         eval $setvar
7167
7168         test "X$usedtrace" != "X$define" && break
7169
7170         echo " "
7171         rp='Where is the dtrace executable?'
7172         dflt=$dflt_dtrace
7173         . ./getfile
7174         val="$ans"
7175         set dtrace
7176         eval $setvar
7177
7178         if $test -f $dtrace
7179         then
7180                 if $dtrace -h -s ../perldtrace.d \
7181                         -o perldtrace.tmp >/dev/null 2>&1 \
7182                         && rm -f perldtrace.tmp
7183                 then
7184                         echo " "
7185                         echo "Good: your $dtrace knows about the -h flag."
7186                 else
7187                         cat >&2 <<EOM
7188
7189 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7190 ***
7191 *** Your installed dtrace doesn't support the -h switch to compile a D
7192 *** program into a C header. Can't continue.
7193
7194 EOM
7195                         exit 1
7196                 fi
7197                 break;
7198         fi
7199
7200         case "$fastread" in
7201         yes)
7202                 cat >&2 <<EOM
7203
7204 *** $me:  Fatal Error:  $dtrace not found.
7205 *** Can't continue.
7206
7207 EOM
7208                 exit 1
7209                 ;;
7210         *)
7211                 echo "*** $dtrace was not found."
7212                 echo " "
7213                 ;;
7214         esac
7215 done
7216
7217 : See if we want extra modules installed
7218 echo " "
7219 case "$extras" in
7220 '') dflt='n';;
7221 *) dflt='y';;
7222 esac
7223 cat <<EOM
7224 Perl can be built with extra modules or bundles of modules which
7225 will be fetched from the CPAN and installed alongside Perl.
7226
7227 Notice that you will need access to the CPAN; either via the Internet,
7228 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7229 be asked later to configure the CPAN.pm module which will in turn do
7230 the installation of the rest of the extra modules or bundles.)
7231
7232 Notice also that if the modules require any external software such as
7233 libraries and headers (the libz library and the zlib.h header for the
7234 Compress::Zlib module, for example) you MUST have any such software
7235 already installed, this configuration process will NOT install such
7236 things for you.
7237
7238 If this doesn't make any sense to you, just accept the default '$dflt'.
7239 EOM
7240 rp='Install any extra modules (y or n)?'
7241 . ./myread
7242 case "$ans" in
7243 y|Y)
7244         cat <<EOM
7245
7246 Please list any extra modules or bundles to be installed from CPAN,
7247 with spaces between the names.  The names can be in any format the
7248 'install' command of CPAN.pm will understand.  (Answer 'none',
7249 without the quotes, to install no extra modules or bundles.)
7250 EOM
7251         rp='Extras?'
7252         dflt="$extras"
7253         . ./myread
7254         extras="$ans"
7255 esac
7256 case "$extras" in
7257 ''|'none')
7258         val=''
7259         $rm -f ../extras.lst
7260         ;;
7261 *)      echo "(Saving the list of extras for later...)"
7262         echo "$extras" > ../extras.lst
7263         val="'$extras'"
7264         ;;
7265 esac
7266 set extras
7267 eval $setvar
7268 echo " "
7269
7270 : determine where html pages for programs go
7271 set html1dir html1dir none
7272 eval $prefixit
7273 $cat <<EOM
7274
7275 If you wish to install html files for programs in $spackage, indicate
7276 the appropriate directory here.  To skip installing html files,
7277 answer "none".
7278 EOM
7279 case "$html1dir" in
7280 ''|none|$undef|' ') dflt=none ;;
7281 *) dflt=$html1dir ;;
7282 esac
7283 fn=dn+~
7284 rp="Directory for the main $spackage html pages?"
7285 . ./getfile
7286 prefixvar=html1dir
7287 . ./setprefixvar
7288 : Use ' ' for none so value is preserved next time through Configure
7289 $test X"$html1dir" = "X" && html1dir=' '
7290
7291 : determine where html pages for libraries and modules go
7292 set html3dir html3dir none
7293 eval $prefixit
7294 $cat <<EOM
7295
7296 If you wish to install html files for modules associated with $spackage,
7297 indicate the appropriate directory here.  To skip installing html files,
7298 answer "none".
7299 EOM
7300 : There is no obvious default.  If they have specified html1dir, then
7301 : try to key off that, possibly changing .../html1 into .../html3.
7302 case "$html3dir" in
7303 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7304 *) dflt=$html3dir ;;
7305 esac
7306 fn=dn+~
7307 rp="Directory for the $spackage module html pages?"
7308 . ./getfile
7309 prefixvar=html3dir
7310 . ./setprefixvar
7311 : Use ' ' for none so value is preserved next time through Configure
7312 $test X"$html3dir" = "X" && html3dir=' '
7313
7314 : determine whether to install perl also as /usr/bin/perl
7315
7316 echo " "
7317 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7318         $cat <<EOM
7319 Many scripts expect perl to be installed as /usr/bin/perl.
7320
7321 If you want to, I can install the perl you are about to compile
7322 as /usr/bin/perl (in addition to $bin/perl).
7323 EOM
7324         if test -f /usr/bin/perl; then
7325             $cat <<EOM
7326
7327 However, please note that because you already have a /usr/bin/perl,
7328 overwriting that with a new Perl would very probably cause problems.
7329 Therefore I'm assuming you don't want to do that (unless you insist).
7330
7331 EOM
7332             case "$installusrbinperl" in
7333             "$define"|[yY]*)    dflt='y';;
7334             *)                  dflt='n';;
7335             esac
7336         else
7337             $cat <<EOM
7338
7339 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7340
7341 EOM
7342             case "$installusrbinperl" in
7343             "$undef"|[nN]*)     dflt='n';;
7344             *)                  dflt='y';;
7345             esac
7346         fi
7347         rp="Do you want to install perl as /usr/bin/perl?"
7348         . ./myread
7349         case "$ans" in
7350         [yY]*)  val="$define";;
7351         *)      val="$undef" ;;
7352         esac
7353 else
7354         val="$undef"
7355 fi
7356 set installusrbinperl
7357 eval $setvar
7358
7359 : Check if we are using the GNU C library
7360 echo " "
7361 echo "Checking for GNU C Library..." >&4
7362 cat >try.c <<'EOCP'
7363 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7364    alone are insufficient to distinguish different versions, such as
7365    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7366    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7367 */
7368 #include <stdio.h>
7369 int main(void)
7370 {
7371 #ifdef __GLIBC__
7372 #   ifdef __GLIBC_MINOR__
7373 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7374 #           include <gnu/libc-version.h>
7375             printf("%s\n",  gnu_get_libc_version());
7376 #       else
7377             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7378 #       endif
7379 #   else
7380         printf("%d\n",  __GLIBC__);
7381 #   endif
7382     return 0;
7383 #else
7384     return 1;
7385 #endif
7386 }
7387 EOCP
7388 set try
7389 if eval $compile_ok && $run ./try > glibc.ver; then
7390         val="$define"
7391         gnulibc_version=`$cat glibc.ver`
7392         echo "You are using the GNU C Library version $gnulibc_version"
7393 else
7394         val="$undef"
7395         gnulibc_version=''
7396         echo "You are not using the GNU C Library"
7397 fi
7398 $rm_try glibc.ver
7399 set d_gnulibc
7400 eval $setvar
7401
7402 : see if nm is to be used to determine whether a symbol is defined or not
7403 case "$usenm" in
7404 '')
7405         dflt=''
7406         case "$d_gnulibc" in
7407         "$define")
7408                 echo " "
7409                 echo "nm probably won't work on the GNU C Library." >&4
7410                 dflt=n
7411                 ;;
7412         esac
7413         case "$dflt" in
7414         '') 
7415                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7416                         echo " "
7417                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7418                         echo "'nm' won't be sufficient on this sytem." >&4
7419                         dflt=n
7420                 fi
7421                 ;;
7422         esac
7423         case "$dflt" in
7424         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7425                 if $test $dflt -gt 20; then
7426                         dflt=y
7427                 else
7428                         dflt=n
7429                 fi
7430                 ;;
7431         esac
7432         ;;
7433 *)
7434         case "$usenm" in
7435         true|$define) dflt=y;;
7436         *) dflt=n;;
7437         esac
7438         ;;
7439 esac
7440 $cat <<EOM
7441
7442 I can use $nm to extract the symbols from your C libraries. This
7443 is a time consuming task which may generate huge output on the disk (up
7444 to 3 megabytes) but that should make the symbols extraction faster. The
7445 alternative is to skip the 'nm' extraction part and to compile a small
7446 test program instead to determine whether each symbol is present. If
7447 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7448 this may be the best solution.
7449
7450 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7451
7452 EOM
7453 rp="Shall I use $nm to extract C symbols from the libraries?"
7454 . ./myread
7455 case "$ans" in
7456 [Nn]*) usenm=false;;
7457 *) usenm=true;;
7458 esac
7459
7460 runnm=$usenm
7461 case "$reuseval" in
7462 true) runnm=false;;
7463 esac
7464
7465 : nm options which may be necessary
7466 case "$nm_opt" in
7467 '') if $test -f /mach_boot; then
7468                 nm_opt=''       # Mach
7469         elif $test -d /usr/ccs/lib; then
7470                 nm_opt='-p'     # Solaris (and SunOS?)
7471         elif $test -f /dgux; then
7472                 nm_opt='-p'     # DG-UX
7473         elif $test -f /lib64/rld; then
7474                 nm_opt='-p'     # 64-bit Irix
7475         else
7476                 nm_opt=''
7477         fi;;
7478 esac
7479
7480 : nm options which may be necessary for shared libraries but illegal
7481 : for archive libraries.  Thank you, Linux.
7482 case "$nm_so_opt" in
7483 '')     case "$myuname" in
7484         *linux*|gnu*)
7485                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7486                         nm_so_opt='--dynamic'
7487                 fi
7488                 ;;
7489         esac
7490         ;;
7491 esac
7492
7493 : Figure out where the libc is located
7494 case "$runnm" in
7495 true)
7496 : get list of predefined functions in a handy place
7497 echo " "
7498 case "$libc" in
7499 '') libc=unknown
7500         case "$libs" in
7501         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7502         esac
7503         ;;
7504 esac
7505 case "$libs" in
7506 '') ;;
7507 *)  for thislib in $libs; do
7508         case "$thislib" in
7509         -lc|-lc_s)
7510                 : Handle C library specially below.
7511                 ;;
7512         -l*)
7513                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7514                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7515                         :
7516                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7517                         :
7518                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7519                         :
7520                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7521                         :
7522                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7523                         :
7524                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7525                         :
7526                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7527                         :
7528                 else
7529                         try=''
7530                 fi
7531                 libnames="$libnames $try"
7532                 ;;
7533         *) libnames="$libnames $thislib" ;;
7534         esac
7535         done
7536         ;;
7537 esac
7538 xxx=normal
7539 case "$libc" in
7540 unknown)
7541         set /lib/libc.$so
7542         for xxx in $libpth; do
7543                 $test -r $1 || set $xxx/libc.$so
7544                 : The messy sed command sorts on library version numbers.
7545                 $test -r $1 || \
7546                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7547                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7548                                 h
7549                                 s/[0-9][0-9]*/0000&/g
7550                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7551                                 G
7552                                 s/\n/ /' | \
7553                          $sort | $sed -e 's/^.* //'`
7554                 eval set \$$#
7555         done
7556         $test -r $1 || set /usr/ccs/lib/libc.$so
7557         $test -r $1 || set /lib/libsys_s$_a
7558         ;;
7559 *)
7560         set blurfl
7561         ;;
7562 esac
7563 if $test -r "$1"; then
7564         echo "Your (shared) C library seems to be in $1."
7565         libc="$1"
7566 elif $test -r /lib/libc && $test -r /lib/clib; then
7567         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7568         xxx=apollo
7569         libc='/lib/clib /lib/libc'
7570         if $test -r /lib/syslib; then
7571                 echo "(Your math library is in /lib/syslib.)"
7572                 libc="$libc /lib/syslib"
7573         fi
7574 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7575         echo "Your C library seems to be in $libc, as you said before."
7576 elif $test -r $incpath/usr/lib/libc$_a; then
7577         libc=$incpath/usr/lib/libc$_a;
7578         echo "Your C library seems to be in $libc.  That's fine."
7579 elif $test -r /lib/libc$_a; then
7580         libc=/lib/libc$_a;
7581         echo "Your C library seems to be in $libc.  You're normal."
7582 else
7583         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7584                 :
7585         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7586                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7587         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7588                 :
7589         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7590                 :
7591         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7592                 :
7593         else
7594                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7595         fi
7596         if $test -r "$tans"; then
7597                 echo "Your C library seems to be in $tans, of all places."
7598                 libc=$tans
7599         else
7600                 libc='blurfl'
7601         fi
7602 fi
7603 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7604         dflt="$libc"
7605         cat <<EOM
7606
7607 If the guess above is wrong (which it might be if you're using a strange
7608 compiler, or your machine supports multiple models), you can override it here.
7609
7610 EOM
7611 else
7612         dflt=''
7613         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7614         cat >&4 <<EOM
7615 I can't seem to find your C library.  I've looked in the following places:
7616
7617 EOM
7618         $sed 's/^/      /' libpath
7619         cat <<EOM
7620
7621 None of these seems to contain your C library. I need to get its name...
7622
7623 EOM
7624 fi
7625 fn=f
7626 rp='Where is your C library?'
7627 . ./getfile
7628 libc="$ans"
7629
7630 echo " "
7631 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7632 set X `cat libnames`
7633 shift
7634 xxx=files
7635 case $# in 1) xxx=file; esac
7636 echo "Extracting names from the following $xxx for later perusal:" >&4
7637 echo " "
7638 $sed 's/^/      /' libnames >&4
7639 echo " "
7640 $echo $n "This may take a while...$c" >&4
7641
7642 for file in $*; do
7643         case $file in
7644         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7645         *) $nm $nm_opt $file 2>/dev/null;;
7646         esac
7647 done >libc.tmp
7648
7649 $echo $n ".$c"
7650 $grep fprintf libc.tmp > libc.ptf
7651 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7652 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7653 xxx='[ADTSIW]'
7654 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7655         eval $xscan;\
7656         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7657                 eval $xrun
7658 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7659         eval $xscan;\
7660         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7661                 eval $xrun
7662 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7663         eval $xscan;\
7664         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7665                 eval $xrun
7666 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7667         eval $xscan;\
7668         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7669                 eval $xrun
7670 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7671         eval $xscan;\
7672         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7673                 eval $xrun
7674 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7675         eval $xscan;\
7676         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7677                 eval $xrun
7678 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7679                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7680         eval $xscan;\
7681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7682                 eval $xrun
7683 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7684         eval $xscan;\
7685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7686                 eval $xrun
7687 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7688         eval $xscan;\
7689         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7690                 eval $xrun
7691 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7692         eval $xscan;\
7693         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7694                 eval $xrun
7695 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7696         eval $xscan;\
7697         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7698                 eval $xrun
7699 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7700         eval $xscan;\
7701         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7702                 eval $xrun
7703 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7704         eval $xscan;\
7705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7706                 eval $xrun
7707 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7708         eval $xscan;\
7709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7710                 eval $xrun
7711 else
7712         $nm -p $* 2>/dev/null >libc.tmp
7713         $grep fprintf libc.tmp > libc.ptf
7714         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7715                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7716         then
7717                 nm_opt='-p'
7718                 eval $xrun
7719         else
7720                 echo " "
7721                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7722                 com=''
7723                 if $ar t $libc > libc.tmp && \
7724                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7725                 then
7726                         for thisname in $libnames $libc; do
7727                                 $ar t $thisname >>libc.tmp
7728                         done
7729                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7730                         echo "Ok." >&4
7731                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7732                         for thisname in $libnames $libc; do
7733                                 $ar tv $thisname >>libc.tmp
7734                                 emximp -o tmp.imp $thisname \
7735                                     2>/dev/null && \
7736                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7737                                     < tmp.imp >>libc.tmp
7738                                 $rm -f tmp.imp
7739                         done
7740                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7741                         echo "Ok." >&4
7742                 else
7743                         echo "$ar didn't seem to work right." >&4
7744                         echo "Maybe this is a Cray...trying bld instead..." >&4
7745                         if  bld t $libc | \
7746                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7747                                 $test -s libc.list
7748                         then
7749                                 for thisname in $libnames; do
7750                                         bld t $libnames | \
7751                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7752                                         $ar t $thisname >>libc.tmp
7753                                 done
7754                                 echo "Ok." >&4
7755                         else
7756                                 echo "That didn't work either.  Giving up." >&4
7757                                 exit 1
7758                         fi
7759                 fi
7760         fi
7761 fi
7762 nm_extract="$com"
7763 case "$PASE" in
7764 define)
7765     echo " "
7766     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7767     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7768     ;;
7769 *)  if $test -f /lib/syscalls.exp; then
7770         echo " "
7771         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7772         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7773                 /lib/syscalls.exp >>libc.list
7774     fi
7775     ;;
7776 esac
7777 ;;
7778 esac
7779 $rm -f libnames libpath
7780
7781 : see if dld is available
7782 set dld.h i_dld
7783 eval $inhdr
7784
7785 : Check if we are using C++
7786 echo " "
7787 echo "Checking for C++..." >&4
7788 $cat >try.c <<'EOCP'
7789 #include <stdio.h>
7790 int main(void)
7791 {
7792 #ifdef __cplusplus
7793     return 0;
7794 #else
7795     return 1;
7796 #endif
7797 }
7798 EOCP
7799 set try
7800 if eval $compile_ok && $run ./try; then
7801         val="$define"
7802         echo "You are using a C++ compiler."
7803 else
7804         val="$undef"
7805         echo "You are not using a C++ compiler."
7806 fi
7807 $rm_try cplusplus$$
7808 set d_cplusplus
7809 eval $setvar
7810
7811 : is a C symbol defined?
7812 csym='tlook=$1;
7813 case "$3" in
7814 -v) tf=libc.tmp; tdc="";;
7815 -a) tf=libc.tmp; tdc="[]";;
7816 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7817 esac;
7818 case "$d_cplusplus" in
7819     $define)    extern_C="extern \"C\"" ;;
7820     *)          extern_C="extern"       ;;
7821 esac;
7822 tx=yes;
7823 case "$reuseval-$4" in
7824 true-) ;;
7825 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7826 esac;
7827 case "$tx" in
7828 yes)
7829         tval=false;
7830         if $test "$runnm" = true; then
7831                 if $contains $tlook $tf >/dev/null 2>&1; then
7832                         tval=true;
7833                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7834                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7835                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7836                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7837                         $rm_try;
7838                 fi;
7839         else
7840                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7841                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7842                 $rm_try;
7843         fi;
7844         ;;
7845 *)
7846         case "$tval" in
7847         $define) tval=true;;
7848         *) tval=false;;
7849         esac;
7850         ;;
7851 esac;
7852 eval "$2=$tval"'
7853
7854 : define an is-in-libc? function
7855 inlibc='echo " "; td=$define; tu=$undef;
7856 sym=$1; var=$2; eval "was=\$$2";
7857 tx=yes;
7858 case "$reuseval$was" in
7859 true) ;;
7860 true*) tx=no;;
7861 esac;
7862 case "$tx" in
7863 yes)
7864         set $sym tres -f;
7865         eval $csym;
7866         case "$tres" in
7867         true)
7868                 echo "$sym() found." >&4;
7869                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7870         *)
7871                 echo "$sym() NOT found." >&4;
7872                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7873         esac;;
7874 *)
7875         case "$was" in
7876         $define) echo "$sym() found." >&4;;
7877         *) echo "$sym() NOT found." >&4;;
7878         esac;;
7879 esac'
7880
7881 : see if dlopen exists
7882 xxx_runnm="$runnm"
7883 xxx_ccflags="$ccflags"
7884 runnm=false
7885 : with g++ one needs -shared to get is-in-libc to work for dlopen
7886 case "$gccversion" in
7887 '')     ;;
7888 *)      case "$d_cplusplus" in
7889         "$define") ccflags="$ccflags -shared" ;;
7890         esac
7891         ;;
7892 esac
7893 set dlopen d_dlopen
7894 eval $inlibc
7895 runnm="$xxx_runnm"
7896 ccflags="$xxx_ccflags"
7897
7898 : see if this is a unistd.h system
7899 set unistd.h i_unistd
7900 eval $inhdr
7901
7902 : determine which dynamic loading, if any, to compile in
7903 echo " "
7904 dldir="ext/DynaLoader"
7905 case "$usedl" in
7906 $define|y|true)
7907         dflt='y'
7908         usedl="$define"
7909         ;;
7910 $undef|n|false)
7911         dflt='n'
7912         usedl="$undef"
7913         ;;
7914 *)
7915         dflt='n'
7916         case "$d_dlopen" in
7917             $define) dflt='y' ;;
7918         esac
7919         case "$i_dld" in
7920             $define) dflt='y' ;;
7921         esac
7922         : Does a dl_xxx.xs file exist for this operating system
7923         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7924         ;;
7925 esac
7926 rp="Do you wish to use dynamic loading?"
7927 . ./myread
7928 usedl="$ans"
7929 bin_ELF="$undef"
7930 case "$ans" in
7931 y*) usedl="$define"
7932         case "$dlsrc" in
7933         '')
7934                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7935                         dflt="$dldir/dl_${osname}.xs"
7936                 elif $test "$d_dlopen" = "$define" ; then
7937                         dflt="$dldir/dl_dlopen.xs"
7938                 elif $test "$i_dld" = "$define" ; then
7939                         dflt="$dldir/dl_dld.xs"
7940                 else
7941                         dflt=''
7942                 fi
7943                 ;;
7944         *)      dflt="$dldir/$dlsrc"
7945                 ;;
7946         esac
7947     echo "The following dynamic loading files are available:"
7948         : Can not go over to $dldir because getfile has path hard-coded in.
7949         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7950         rp="Source file to use for dynamic loading"
7951         fn="fne"
7952         gfpth="$src"
7953         . ./getfile
7954         usedl="$define"
7955         : emulate basename
7956         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7957
7958         $cat << EOM
7959
7960 Some systems may require passing special flags to $cc -c to
7961 compile modules that will be used to create a shared library.
7962 To use no flags, say "none".
7963
7964 EOM
7965     case "$cccdlflags" in
7966     '') case "$gccversion" in
7967                 '') case "$osname" in
7968                         hpux)   dflt='+z' ;;
7969                         next)   dflt='none' ;;
7970                         irix*)  dflt='-KPIC' ;;
7971                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7972                         sunos)  dflt='-pic' ;;
7973                         *)      dflt='none' ;;
7974                     esac
7975                         ;;
7976                 *)  case "$osname" in
7977                         darwin) dflt='none' ;;
7978                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7979                         *)      dflt='-fpic' ;;
7980                     esac ;;
7981             esac ;;
7982         ' ') dflt='none' ;;
7983     *)  dflt="$cccdlflags" ;;
7984     esac
7985     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7986     . ./myread
7987     case "$ans" in
7988     none) cccdlflags=' ' ;;
7989     *) cccdlflags="$ans" ;;
7990     esac
7991
7992     cat << EOM
7993
7994 Some systems use ld to create libraries that can be dynamically loaded,
7995 while other systems (such as those using ELF) use $cc.
7996
7997 EOM
7998         case "$ld" in
7999         '')     $cat >try.c <<EOM
8000 /* Test for whether ELF binaries are produced */
8001 #include <fcntl.h>
8002 #$i_stdlib I_STDLIB
8003 #ifdef I_STDLIB
8004 #include <stdlib.h>
8005 #endif
8006 #$i_unistd I_UNISTD
8007 #ifdef I_UNISTD
8008 #include <unistd.h>
8009 #endif
8010 int main() {
8011         char b[4];
8012         int i = open("a.out",O_RDONLY);
8013         if(i == -1)
8014                 exit(1); /* fail */
8015         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8016                 exit(0); /* succeed (yes, it's ELF) */
8017         else
8018                 exit(1); /* fail */
8019 }
8020 EOM
8021                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8022                         cat <<EOM
8023 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8024 EOM
8025                         dflt="$cc"
8026                         bin_ELF="$define"
8027                 else
8028                         echo "I'll use ld to build dynamic libraries."
8029                         dflt='ld'
8030                 fi
8031                 $rm_try
8032                 ;;
8033         *)      dflt="$ld"
8034                 ;;
8035         esac
8036
8037     rp="What command should be used to create dynamic libraries?"
8038     . ./myread
8039         ld="$ans"
8040
8041     cat << EOM
8042
8043 Some systems may require passing special flags to $ld to create a
8044 library that can be dynamically loaded.  If your ld flags include
8045 -L/other/path options to locate libraries outside your loader's normal
8046 search path, you may need to specify those -L options here as well.  To
8047 use no flags, say "none".
8048
8049 EOM
8050     case "$lddlflags" in
8051     '') case "$osname" in
8052                         beos) dflt='-nostart' ;;
8053                         haiku) dflt='-shared' ;;
8054                         hpux) dflt='-b';
8055                               case "$gccversion" in
8056                               '') dflt="$dflt +vnocompatwarnings" ;;
8057                               esac
8058                               ;;
8059                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8060                         next)  dflt='none' ;;
8061                         solaris) dflt='-G' ;;
8062                         sunos) dflt='-assert nodefinitions' ;;
8063                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8064                 *)     dflt='none' ;;
8065                         esac
8066                         ;;
8067     *) dflt="$lddlflags" ;;
8068     esac
8069
8070         : Try to guess additional flags to pick up local libraries.
8071         : Be careful not to append to a plain 'none'
8072         case "$dflt" in
8073         none) dflt='' ;;
8074         esac
8075         for thisflag in $ldflags; do
8076                 case "$thisflag" in
8077                 -L*|-R*|-Wl,-R*)
8078                         case " $dflt " in
8079                         *" $thisflag "*) ;;
8080                         *) dflt="$dflt $thisflag" ;;
8081                         esac
8082                         ;;
8083                 esac
8084         done
8085
8086         case "$dflt" in
8087         ''|' ') dflt='none' ;;
8088         esac
8089
8090         case "$ldflags" in
8091         *-fstack-protector*)
8092             case "$dflt" in
8093                         *-fstack-protector*) ;; # Don't add it again
8094                         *) dflt="$dflt -fstack-protector" ;; 
8095                 esac
8096                 ;;
8097         esac
8098
8099
8100     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8101     . ./myread
8102     case "$ans" in
8103     none) lddlflags=' ' ;;
8104     *) lddlflags="$ans" ;;
8105     esac
8106
8107         cat <<EOM
8108
8109 Some systems may require passing special flags to $cc to indicate that
8110 the resulting executable will use dynamic linking.  To use no flags,
8111 say "none".
8112
8113 EOM
8114     case "$ccdlflags" in
8115     '') case "$osname" in
8116             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8117             next|sunos) dflt='none' ;;
8118             *)          dflt='none' ;;
8119             esac ;;
8120     ' ')  dflt='none' ;;
8121     *)  dflt="$ccdlflags" ;;
8122     esac
8123     rp="Any special flags to pass to $cc to use dynamic linking?"
8124     . ./myread
8125     case "$ans" in
8126     none) ccdlflags=' ' ;;
8127     *) ccdlflags="$ans" ;;
8128     esac
8129     ;;
8130 *)  usedl="$undef"
8131         ld='ld'
8132     dlsrc='dl_none.xs'
8133     lddlflags=''
8134     ccdlflags=''
8135     ;;
8136 esac
8137
8138 : Do we want a shared libperl?
8139 also=''
8140 case "$usedl" in
8141 $undef)
8142         # No dynamic loading being used, so don't bother even to prompt.
8143         useshrplib='false'
8144         ;;
8145 *)      case "$useshrplib" in
8146         '')     case "$osname" in
8147                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8148                         dflt=y
8149                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8150                         ;;
8151                 next*)
8152                         case "$osvers" in
8153                         4*)     dflt=y
8154                                 also='Building a shared libperl is needed for MAB support.'
8155                                 ;;
8156                         *)      dflt=n
8157                                 ;;
8158                         esac
8159                         ;;
8160                 *)      dflt=n
8161                         ;;
8162                 esac
8163                 ;;
8164         $define|true|[Yy]*)
8165                 dflt=y
8166                 ;;
8167         *)      dflt=n
8168                 ;;
8169         esac
8170         $cat << EOM
8171
8172 The perl executable is normally obtained by linking perlmain.c with
8173 libperl${_a}, any static extensions (usually just DynaLoader), and
8174 any other libraries needed on this system (such as -lm, etc.).  Since
8175 your system supports dynamic loading, it is probably possible to build
8176 a shared libperl.$so.  If you will have more than one executable linked
8177 to libperl.$so, this will significantly reduce the size of each
8178 executable, but it may have a noticeable effect on performance.  The
8179 default is probably sensible for your system.
8180 $also
8181
8182 EOM
8183         rp="Build a shared libperl.$so (y/n)"
8184         . ./myread
8185         case "$ans" in
8186         true|$define|[Yy]*)
8187                 useshrplib='true'  ;;
8188         *)      useshrplib='false' ;;
8189         esac
8190         ;;
8191 esac
8192
8193 case "$useshrplib" in
8194 true)
8195         case "$userelocatableinc" in
8196         true|define)
8197                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8198                 echo "See INSTALL for an explanation why that won't work." >&4
8199                 exit 4
8200                 ;;
8201         esac
8202         case "$libperl" in
8203         '')
8204                 # Figure out a good name for libperl.so.  Since it gets stored in
8205                 # a version-specific architecture-dependent library, the version
8206                 # number isn't really that important, except for making cc/ld happy.
8207                 #
8208                 # A name such as libperl.so.10.1
8209                 majmin="libperl.$so.$patchlevel.$subversion"
8210                 # A name such as libperl.so.100
8211                 majonly=`echo $patchlevel $subversion |
8212                         $awk '{printf "%d%02d", $1, $2}'`
8213                 majonly=libperl.$so.$majonly
8214                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8215                 # rely on figuring it out from the naming of libc.
8216                 case "${osname}${osvers}" in
8217                 next4*)
8218                         dflt=libperl.5.$so
8219                         # XXX How handle the --version stuff for MAB?
8220                         ;;
8221                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8222                         dflt=libperl.$so
8223                         ;;
8224                 cygwin*) # ld links now against the dll directly
8225                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8226                         majonly=`echo $patchlevel $subversion |
8227                                 $awk '{printf "%03d%03d", $1, $2}'`
8228                         majonly=cygperl5.$majonly.$so
8229                         dflt=$majmin
8230                         ;;
8231                 *)      # Try to guess based on whether libc has major.minor.
8232                         case "$libc" in
8233                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8234                         *libc.$so.[0-9]*) dflt=$majonly ;;
8235                         *)      dflt=libperl.$so ;;
8236                         esac
8237                         ;;
8238                 esac
8239                 ;;
8240         *)      dflt=$libperl
8241                 ;;
8242         esac
8243         cat << EOM
8244
8245 I need to select a good name for the shared libperl.  If your system uses
8246 library names with major and minor numbers, then you might want something
8247 like $majmin.  Alternatively, if your system uses a single version
8248 number for shared libraries, then you might want to use $majonly.
8249 Or, your system might be quite happy with a simple libperl.$so.
8250
8251 Since the shared libperl will get installed into a version-specific
8252 architecture-dependent directory, the version number of the shared perl
8253 library probably isn't important, so the default should be o.k.
8254
8255 EOM
8256         rp='What name do you want to give to the shared libperl?'
8257         . ./myread
8258         libperl=$ans
8259         echo "Ok, I'll use $libperl"
8260         ;;
8261 *)
8262         libperl="libperl${_a}"
8263         ;;
8264 esac
8265
8266 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8267 case "$shrpdir" in
8268 '') ;;
8269 *)      $cat >&4 <<EOM
8270 WARNING:  Use of the shrpdir variable for the installation location of
8271 the shared $libperl is not supported.  It was never documented and
8272 will not work in this version.  Let me (perlbug@perl.org)
8273 know of any problems this may cause.
8274
8275 EOM
8276         case "$shrpdir" in
8277         "$archlibexp/CORE")
8278                 $cat >&4 <<EOM
8279 But your current setting of $shrpdir is
8280 the default anyway, so it's harmless.
8281 EOM
8282                 ;;
8283         *)
8284                 $cat >&4 <<EOM
8285 Further, your current attempted setting of $shrpdir
8286 conflicts with the value of $archlibexp/CORE
8287 that installperl will use.
8288 EOM
8289                 ;;
8290         esac
8291         ;;
8292 esac
8293
8294 # How will the perl executable find the installed shared $libperl?
8295 # Add $xxx to ccdlflags.
8296 # If we can't figure out a command-line option, use $shrpenv to
8297 # set env LD_RUN_PATH.  The main perl makefile uses this.
8298 shrpdir=$archlibexp/CORE
8299 xxx=''
8300 tmp_shrpenv=''
8301 if "$useshrplib"; then
8302     case "$osname" in
8303         aix)
8304                 # We'll set it in Makefile.SH...
8305                 ;;
8306         solaris)
8307                 xxx="-R $shrpdir"
8308                 ;;
8309         freebsd|netbsd|openbsd|interix|dragonfly)
8310                 xxx="-Wl,-R$shrpdir"
8311                 ;;
8312         bsdos|linux|irix*|dec_osf|gnu*)
8313                 xxx="-Wl,-rpath,$shrpdir"
8314                 ;;
8315         next)
8316                 # next doesn't like the default...
8317                 ;;
8318         beos)
8319                 # beos doesn't like the default, either.
8320                 ;;
8321         haiku)
8322                 # Haiku doesn't like the default, either.
8323                 ;;
8324         hpux*)
8325                 # hpux doesn't like the default, either.
8326                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8327                 ;;
8328         cygwin)
8329                 # cygwin needs only ldlibpth
8330                 ;;
8331         *)
8332                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8333                 ;;
8334         esac
8335         case "$xxx" in
8336         '') ;;
8337         *)
8338                 # Only add $xxx if it isn't already in ccdlflags.
8339                 case " $ccdlflags " in
8340                 *" $xxx "*)     ;;
8341                 *)      ccdlflags="$ccdlflags $xxx"
8342                         cat <<EOM >&4
8343
8344 Adding $xxx to the flags
8345 passed to $ld so that the perl executable will find the
8346 installed shared $libperl.
8347
8348 EOM
8349                         ;;
8350                 esac
8351                 ;;
8352         esac
8353 fi
8354 # Fix ccdlflags in AIX for building external extensions.
8355 # (For building Perl itself bare -bE:perl.exp is needed,
8356 #  Makefile.SH takes care of this.)
8357 case "$osname" in
8358 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8359 esac
8360 # Respect a hint or command-line value.
8361 case "$shrpenv" in
8362 '') shrpenv="$tmp_shrpenv" ;;
8363 esac
8364 case "$ldlibpthname" in
8365 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8366 none)   ldlibpthname='' ;;
8367 esac
8368
8369 : determine where manual pages are on this system
8370 echo " "
8371 case "$sysman" in
8372 '') 
8373         syspath='/usr/share/man/man1 /usr/man/man1'
8374         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8375         syspath="$syspath /usr/man/u_man/man1"
8376         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8377         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8378         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8379         sysman=`./loc . /usr/man/man1 $syspath`
8380         ;;
8381 esac
8382 if $test -d "$sysman"; then
8383         echo "System manual is in $sysman." >&4
8384 else
8385         echo "Could not find manual pages in source form." >&4
8386 fi
8387
8388 : determine where manual pages go
8389 set man1dir man1dir none
8390 eval $prefixit
8391 $cat <<EOM
8392
8393 $spackage has manual pages available in source form.
8394 EOM
8395 case "$nroff" in
8396 nroff)
8397         echo "However, you don't have nroff, so they're probably useless to you."
8398         case "$man1dir" in
8399         '') man1dir="none";;
8400         esac;;
8401 esac
8402 echo "If you don't want the manual sources installed, answer 'none'."
8403 case "$man1dir" in
8404 ' ') dflt=none
8405         ;;
8406 '')
8407         lookpath="$prefixexp/share/man/man1"
8408         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8409         lookpath="$lookpath $prefixexp/man/p_man/man1"
8410         lookpath="$lookpath $prefixexp/man/u_man/man1"
8411         lookpath="$lookpath $prefixexp/man/man.1"
8412         case "$sysman" in
8413         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8414         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8415         esac
8416         set dflt
8417         eval $prefixup
8418         ;;
8419 *)  dflt="$man1dir"
8420         ;;
8421 esac
8422 echo " "
8423 fn=dn+~
8424 rp="Where do the main $spackage manual pages (source) go?"
8425 . ./getfile
8426 if $test "X$man1direxp" != "X$ansexp"; then
8427         installman1dir=''
8428 fi
8429 prefixvar=man1dir
8430 . ./setprefixvar
8431
8432 case "$man1dir" in
8433 '')     man1dir=' '
8434         installman1dir='';;
8435 esac
8436
8437 : What suffix to use on installed man pages
8438
8439 case "$man1dir" in
8440 ' ')
8441         man1ext='0'
8442         ;;
8443 *)
8444         rp="What suffix should be used for the main $spackage man pages?"
8445         case "$man1ext" in
8446         '')     case "$man1dir" in
8447                 *1)  dflt=1 ;;
8448                 *1p) dflt=1p ;;
8449                 *1pm) dflt=1pm ;;
8450                 *l) dflt=l;;
8451                 *n) dflt=n;;
8452                 *o) dflt=o;;
8453                 *p) dflt=p;;
8454                 *C) dflt=C;;
8455                 *L) dflt=L;;
8456                 *L1) dflt=L1;;
8457                 *) dflt=1;;
8458                 esac
8459                 ;;
8460         *)      dflt="$man1ext";;
8461         esac
8462         . ./myread
8463         man1ext="$ans"
8464         ;;
8465 esac
8466
8467 : see if we can have long filenames
8468 echo " "
8469 first=123456789abcdef
8470 $rm -f $first
8471 if (echo hi >$first) 2>/dev/null; then
8472         if $test -f 123456789abcde; then
8473                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8474                 val="$undef"
8475         else
8476                 echo 'You can have filenames longer than 14 characters.'>&4
8477                 val="$define"
8478         fi
8479 else
8480         $cat <<'EOM'
8481 You can't have filenames longer than 14 chars.
8482 You can't even think about them!
8483 EOM
8484         val="$undef"
8485 fi
8486 set d_flexfnam
8487 eval $setvar
8488 $rm -rf 123456789abcde*
8489
8490 : determine where library module manual pages go
8491 set man3dir man3dir none
8492 eval $prefixit
8493 $cat <<EOM
8494
8495 $spackage has manual pages for many of the library modules.
8496 EOM
8497
8498 case "$nroff" in
8499 nroff)
8500         $cat <<'EOM'
8501 However, you don't have nroff, so they're probably useless to you.
8502 EOM
8503         case "$man3dir" in
8504         '') man3dir="none";;
8505         esac;;
8506 esac
8507
8508 case "$d_flexfnam" in
8509 undef)
8510         $cat <<'EOM'
8511 However, your system can't handle the long file names like File::Basename.3.
8512 EOM
8513         case "$man3dir" in
8514         '') man3dir="none";;
8515         esac;;
8516 esac
8517
8518 echo "If you don't want the manual sources installed, answer 'none'."
8519 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8520 case "$man3dir" in
8521 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8522         if $test -d "$privlib/man/man3"; then
8523                 cat <<EOM >&4
8524
8525 WARNING:  Previous versions of perl installed man3 pages into
8526 $privlib/man/man3.  This version will suggest a
8527 new default of $dflt.
8528 EOM
8529                 tdflt=$dflt
8530                 dflt='n'
8531                 rp='Do you wish to preserve the old behavior?(y/n)'
8532                 . ./myread
8533                 case "$ans" in
8534                 y*) dflt="$privlib/man/man3" ;;
8535                 *)  dflt=$tdflt ;;
8536                 esac
8537     fi
8538         ;;
8539 *)      dflt="$man3dir" ;;
8540 esac
8541 case "$dflt" in
8542 ' ') dflt=none ;;
8543 esac
8544 echo " "
8545 fn=dn+~
8546 rp="Where do the $package library man pages (source) go?"
8547 . ./getfile
8548 prefixvar=man3dir
8549 . ./setprefixvar
8550
8551 case "$man3dir" in
8552 '')     man3dir=' '
8553         installman3dir='';;
8554 esac
8555
8556 : What suffix to use on installed man pages
8557 case "$man3dir" in
8558 ' ')
8559         man3ext='0'
8560         ;;
8561 *)
8562         rp="What suffix should be used for the $package library man pages?"
8563         case "$man3ext" in
8564         '')     case "$man3dir" in
8565                 *3)  dflt=3 ;;
8566                 *3p) dflt=3p ;;
8567                 *3pm) dflt=3pm ;;
8568                 *l) dflt=l;;
8569                 *n) dflt=n;;
8570                 *o) dflt=o;;
8571                 *p) dflt=p;;
8572                 *C) dflt=C;;
8573                 *L) dflt=L;;
8574                 *L3) dflt=L3;;
8575                 *) dflt=3;;
8576                 esac
8577                 ;;
8578         *)      dflt="$man3ext";;
8579         esac
8580         . ./myread
8581         man3ext="$ans"
8582         ;;
8583 esac
8584
8585 : see if we have to deal with yellow pages, now NIS.
8586 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8587         if $test -f /usr/etc/nibindd; then
8588                 echo " "
8589                 echo "I'm fairly confident you're on a NeXT."
8590                 echo " "
8591                 rp='Do you get the hosts file via NetInfo?'
8592                 dflt=y
8593                 case "$hostcat" in
8594                 nidump*) ;;
8595                 '') ;;
8596                 *) dflt=n;;
8597                 esac
8598                 . ./myread
8599                 case "$ans" in
8600                 y*) hostcat='nidump hosts .';;
8601                 *)      case "$hostcat" in
8602                         nidump*) hostcat='';;
8603                         esac
8604                         ;;
8605                 esac
8606         fi
8607         case "$hostcat" in
8608         nidump*) ;;
8609         *)
8610                 case "$hostcat" in
8611                 *ypcat*) dflt=y;;
8612                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8613                                 dflt=y
8614                         else
8615                                 dflt=n
8616                         fi;;
8617                 *) dflt=n;;
8618                 esac
8619                 echo " "
8620                 rp='Are you getting the hosts file via yellow pages?'
8621                 . ./myread
8622                 case "$ans" in
8623                 y*) hostcat='ypcat hosts';;
8624                 *) hostcat='cat /etc/hosts';;
8625                 esac
8626                 ;;
8627         esac
8628 fi
8629 case "$hostcat" in
8630 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8631 esac
8632 case "$groupcat" in
8633 '') test -f /etc/group && groupcat='cat /etc/group';;
8634 esac
8635 case "$passcat" in
8636 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8637 esac
8638
8639 : now get the host name
8640 echo " "
8641 echo "Figuring out host name..." >&4
8642 case "$myhostname" in
8643 '') cont=true
8644         echo 'Maybe "hostname" will work...'
8645         if tans=`sh -c hostname 2>&1` ; then
8646                 myhostname=$tans
8647                 phostname=hostname
8648                 cont=''
8649         fi
8650         ;;
8651 *) cont='';;
8652 esac
8653 if $test "$cont"; then
8654         if ./xenix; then
8655                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8656                 if tans=`cat /etc/systemid 2>&1` ; then
8657                         myhostname=$tans
8658                         phostname='cat /etc/systemid'
8659                         echo "Whadyaknow.  Xenix always was a bit strange..."
8660                         cont=''
8661                 fi
8662         elif $test -r /etc/systemid; then
8663                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8664         fi
8665 fi
8666 if $test "$cont"; then
8667         echo 'No, maybe "uuname -l" will work...'
8668         if tans=`sh -c 'uuname -l' 2>&1` ; then
8669                 myhostname=$tans
8670                 phostname='uuname -l'
8671         else
8672                 echo 'Strange.  Maybe "uname -n" will work...'
8673                 if tans=`sh -c 'uname -n' 2>&1` ; then
8674                         myhostname=$tans
8675                         phostname='uname -n'
8676                 else
8677                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8678                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8679                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8680                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8681                         else
8682                                 case "$myhostname" in
8683                                 '') echo "Does this machine have an identity crisis or something?"
8684                                         phostname='';;
8685                                 *)
8686                                         echo "Well, you said $myhostname before..."
8687                                         phostname='echo $myhostname';;
8688                                 esac
8689                         fi
8690                 fi
8691         fi
8692 fi
8693 case "$myhostname" in
8694 '') myhostname=noname ;;
8695 esac
8696 : you do not want to know about this
8697 set $myhostname
8698 myhostname=$1
8699
8700 : verify guess
8701 if $test "$myhostname" ; then
8702         dflt=y
8703         rp='Your host name appears to be "'$myhostname'".'" Right?"
8704         . ./myread
8705         case "$ans" in
8706         y*) ;;
8707         *) myhostname='';;
8708         esac
8709 fi
8710
8711 : bad guess or no guess
8712 while $test "X$myhostname" = X ; do
8713         dflt=''
8714         rp="Please type the (one word) name of your host:"
8715         . ./myread
8716         myhostname="$ans"
8717 done
8718
8719 : translate upper to lower if necessary
8720 case "$myhostname" in
8721 *[A-Z]*)
8722         echo "(Normalizing case in your host name)"
8723         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8724         ;;
8725 esac
8726
8727 case "$myhostname" in
8728 *.*)
8729         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8730         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8731         echo "(Trimming domain name from host name--host name is now $myhostname)"
8732         ;;
8733 *) case "$mydomain" in
8734         '')
8735                 {
8736                         test "X$hostcat" = "Xypcat hosts" &&
8737                         ypmatch "$myhostname" hosts 2>/dev/null |\
8738                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8739                         $test -s hosts
8740                 } || {
8741                         test "X$hostcat" != "X" &&
8742                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8743                                         /[       ]$myhostname[  . ]/p" > hosts
8744                 }
8745                 tmp_re="[       . ]"
8746                 if $test -f hosts; then
8747                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8748                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8749                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8750                                 hosts | $sort | $uniq | \
8751                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8752                         case `$echo X$dflt` in
8753                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8754                                 dflt=.
8755                                 ;;
8756                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8757                                 ;;
8758                         esac
8759                 else
8760                         echo "(I cannot locate a hosts database anywhere)"
8761                         dflt=.
8762                 fi
8763                 case "$dflt" in
8764                 .)
8765                         tans=`./loc resolv.conf X /etc /usr/etc`
8766                         if $test -f "$tans"; then
8767                                 echo "(Attempting domain name extraction from $tans)"
8768                                 dflt=.`$sed -n -e 's/   / /g' \
8769                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8770                                   -e 1q 2>/dev/null`
8771                                 case "$dflt" in
8772                                 .) dflt=.`$sed -n -e 's/        / /g' \
8773                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8774                                      -e 1q 2>/dev/null`
8775                                         ;;
8776                                 esac
8777                         fi
8778                         ;;
8779                 esac
8780                 case "$dflt" in
8781                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8782                         dflt=.`sh -c domainname 2>/dev/null`
8783                         case "$dflt" in
8784                         '') dflt='.';;
8785                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8786                         esac
8787                         ;;
8788                 esac
8789                 case "$dflt$osname" in
8790                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8791                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8792                         ;;
8793                 esac
8794                 case "$dflt" in
8795                 .) echo "(Lost all hope -- silly guess then)"
8796                         dflt='.nonet'
8797                         ;;
8798                 esac
8799                 $rm -f hosts
8800                 ;;
8801         *) dflt="$mydomain";;
8802         esac;;
8803 esac
8804 echo " "
8805 rp="What is your domain name?"
8806 . ./myread
8807 tans="$ans"
8808 case "$ans" in
8809 '') ;;
8810 .*) ;;
8811 *) tans=".$tans";;
8812 esac
8813 mydomain="$tans"
8814
8815 : translate upper to lower if necessary
8816 case "$mydomain" in
8817 *[A-Z]*)
8818         echo "(Normalizing case in your domain name)"
8819         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8820         ;;
8821 esac
8822
8823 : a little sanity check here
8824 case "$phostname" in
8825 '') ;;
8826 *)
8827         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8828         $myhostname$mydomain|$myhostname) ;;
8829         *)
8830                 case "$phostname" in
8831                 sed*)
8832                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8833                         ;;
8834                 *)
8835                         echo "(That doesn't agree with your $phostname command, by the way.)"
8836                         ;;
8837                 esac
8838         ;;
8839         esac
8840         ;;
8841 esac
8842
8843 : determine the e-mail address of the user who is running us
8844 $cat <<EOM
8845
8846 I need to get your e-mail address in Internet format if possible, i.e.
8847 something like user@host.domain. Please answer accurately since I have
8848 no easy means to double check it. The default value provided below
8849 is most probably close to reality but may not be valid from outside
8850 your organization...
8851
8852 EOM
8853 cont=x
8854 while test "$cont"; do
8855         case "$cf_email" in
8856         '') dflt="$cf_by@$myhostname$mydomain";;
8857         *) dflt="$cf_email";;
8858         esac
8859         rp='What is your e-mail address?'
8860         . ./myread
8861         cf_email="$ans"
8862         case "$cf_email" in
8863         *@*.*) cont='' ;;
8864         *)
8865                 rp='Address does not look like an Internet one.  Use it anyway?'
8866                 case "$fastread" in
8867                 yes) dflt=y ;;
8868                 *) dflt=n ;;
8869                 esac
8870                 . ./myread
8871                 case "$ans" in
8872                 y*) cont='' ;;
8873                 *) echo " " ;;
8874                 esac
8875                 ;;
8876         esac
8877 done
8878
8879 : Ask e-mail of administrator
8880 $cat <<EOM
8881
8882 If you or somebody else will be maintaining perl at your site, please
8883 fill in the correct e-mail address here so that they may be contacted
8884 if necessary. Currently, the "perlbug" program included with perl
8885 will send mail to this address in addition to perlbug@perl.org. You may
8886 enter "none" for no administrator.
8887
8888 EOM
8889 case "$perladmin" in
8890 '') dflt="$cf_email";;
8891 *) dflt="$perladmin";;
8892 esac
8893 rp='Perl administrator e-mail address'
8894 . ./myread
8895 perladmin="$ans"
8896
8897 : determine whether to only install version-specific parts.
8898 echo " "
8899 $cat <<EOM
8900 Do you want to install only the version-specific parts of the perl
8901 distribution?  Usually you do *not* want to do this.
8902 EOM
8903 case "$versiononly" in
8904 "$define"|[Yy]*|true) dflt='y' ;;
8905 *) dflt='n';
8906 esac
8907 rp="Do you want to install only the version-specific parts of perl?"
8908 . ./myread
8909 case "$ans" in
8910 [yY]*)  val="$define";;
8911 *)      val="$undef" ;;
8912 esac
8913 set versiononly
8914 eval $setvar
8915
8916 case "$versiononly" in
8917 "$define") inc_version_list=''
8918            inc_version_list_init=0
8919            ;;
8920 esac
8921
8922 : figure out how to guarantee perl startup
8923 : XXX Note that this currently takes advantage of the bug that binexp ignores
8924 :     the Configure -Dinstallprefix setting, which in turn means that under
8925 :     relocatable @INC, initialinstalllocation is what binexp started as.
8926 case "$startperl" in
8927 '')
8928         case "$sharpbang" in
8929         *!)
8930                 $cat <<EOH
8931
8932 I can use the #! construct to start perl on your system. This will
8933 make startup of perl scripts faster, but may cause problems if you
8934 want to share those scripts and perl is not in a standard place
8935 ($initialinstalllocation/perl) on all your platforms. The alternative
8936 is to force a shell by starting the script with a single ':' character.
8937
8938 EOH
8939                 case "$versiononly" in
8940                 "$define")      dflt="$initialinstalllocation/perl$version";;
8941                 *)              dflt="$initialinstalllocation/perl";;
8942                 esac
8943                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8944                 . ./myread
8945                 case "$ans" in
8946                 none)   startperl=": # use perl";;
8947                 *)      startperl="#!$ans"
8948                         if $test 30 -lt `echo "$ans" | wc -c`; then
8949                                 $cat >&4 <<EOM
8950
8951 WARNING:  Some systems limit the #! command to 32 characters.
8952 If you experience difficulty running Perl scripts with #!, try
8953 installing Perl in a directory with a shorter pathname.
8954
8955 EOM
8956                         fi ;;
8957                 esac
8958                 ;;
8959         *) startperl=": # use perl"
8960                 ;;
8961         esac
8962         ;;
8963 esac
8964 echo "I'll use $startperl to start perl scripts."
8965
8966 : figure best path for perl in scripts
8967 case "$perlpath" in
8968 '')
8969         case "$versiononly" in
8970         "$define")      perlpath="$initialinstalllocation/perl$version";;
8971         *)              perlpath="$initialinstalllocation/perl";;
8972         esac
8973         case "$startperl" in
8974         *!*) ;;
8975         *)
8976                 $cat <<EOH
8977
8978 I will use the "eval 'exec'" idiom to start Perl on your system.
8979 I can use the full path of your Perl binary for this purpose, but
8980 doing so may cause problems if you want to share those scripts and
8981 Perl is not always in a standard place ($initialinstalllocation/perl).
8982
8983 EOH
8984                 dflt="$initialinstalllocation/perl"
8985                 rp="What path shall I use in \"eval 'exec'\"?"
8986                 . ./myread
8987                 perlpath="$ans"
8988                 ;;
8989         esac
8990         ;;
8991 esac
8992 case "$startperl" in
8993 *!*)    ;;
8994 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8995 esac
8996
8997 : determine where public executable scripts go
8998 set scriptdir scriptdir
8999 eval $prefixit
9000 case "$scriptdir" in
9001 '')
9002         dflt="$bin"
9003         : guess some guesses
9004         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9005         $test -d /usr/share/bin     && dflt=/usr/share/bin
9006         $test -d /usr/local/script  && dflt=/usr/local/script
9007         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9008         $test -d $prefixexp/script  && dflt=$prefixexp/script
9009         set dflt
9010         eval $prefixup
9011         ;;
9012 *)  dflt="$scriptdir"
9013         ;;
9014 esac
9015 $cat <<EOM
9016
9017 Some installations have a separate directory just for executable scripts so
9018 that they can mount it across multiple architectures but keep the scripts in
9019 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9020 Or you might just lump your scripts in with all your other executables.
9021
9022 EOM
9023 fn=d~
9024 rp='Where do you keep publicly executable scripts?'
9025 . ./getfile
9026 if $test "X$ansexp" != "X$scriptdirexp"; then
9027         installscript=''
9028 fi
9029 installscriptdir=''
9030 prefixvar=scriptdir
9031 . ./setprefixvar
9032 : A little fix up for an irregularly named variable.
9033 installscript="$installscriptdir"
9034
9035 : determine where add-on public executables go
9036 case "$sitebin" in
9037 '')     dflt=$siteprefix/bin ;;
9038 *)      dflt=$sitebin ;;
9039 esac
9040 fn=d~
9041 rp='Pathname where the add-on public executables should be installed?'
9042 . ./getfile
9043 prefixvar=sitebin
9044 . ./setprefixvar
9045
9046 : determine where add-on html pages go
9047 : There is no standard location, so try to copy the previously-selected
9048 : directory structure for the core html pages.
9049 case "$sitehtml1dir" in
9050 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9051 *)     dflt=$sitehtml1dir ;;
9052 esac
9053 case "$dflt" in
9054 ''|' ') dflt=none ;;
9055 esac
9056 fn=dn+~
9057 rp='Pathname where the site-specific html pages should be installed?'
9058 . ./getfile
9059 prefixvar=sitehtml1dir
9060 . ./setprefixvar
9061
9062 : determine where add-on library html pages go
9063 : There is no standard location, so try to copy the previously-selected
9064 : directory structure for the core html pages.
9065 case "$sitehtml3dir" in
9066 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9067 *)     dflt=$sitehtml3dir ;;
9068 esac
9069 case "$dflt" in
9070 ''|' ') dflt=none ;;
9071 esac
9072 fn=dn+~
9073 rp='Pathname where the site-specific library html pages should be installed?'
9074 . ./getfile
9075 prefixvar=sitehtml3dir
9076 . ./setprefixvar
9077
9078 : determine where add-on manual pages go
9079 case "$siteman1dir" in
9080 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9081 *)      dflt=$siteman1dir ;;
9082 esac
9083 case "$dflt" in
9084 ''|' ') dflt=none ;;
9085 esac
9086 fn=dn+~
9087 rp='Pathname where the site-specific manual pages should be installed?'
9088 . ./getfile
9089 prefixvar=siteman1dir
9090 . ./setprefixvar
9091
9092 : determine where add-on library man pages go
9093 case "$siteman3dir" in
9094 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9095 *)      dflt=$siteman3dir ;;
9096 esac
9097 case "$dflt" in
9098 ''|' ') dflt=none ;;
9099 esac
9100 fn=dn+~
9101 rp='Pathname where the site-specific library manual pages should be installed?'
9102 . ./getfile
9103 prefixvar=siteman3dir
9104 . ./setprefixvar
9105
9106 : determine where add-on public executable scripts go
9107 case "$sitescript" in
9108 '')     dflt=$siteprefix/script
9109         $test -d $dflt || dflt=$sitebin ;;
9110 *)  dflt="$sitescript" ;;
9111 esac
9112 fn=d~+
9113 rp='Pathname where add-on public executable scripts should be installed?'
9114 . ./getfile
9115 prefixvar=sitescript
9116 . ./setprefixvar
9117
9118 : Check if faststdio is requested and available
9119 case "$usefaststdio" in
9120 $define|true|[yY]*|'')
9121         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9122         case "$xversion" in
9123         [68])   dflt='y' ;;
9124         *)      dflt='n' ;;
9125         esac
9126         ;;
9127 *) dflt='n';;
9128 esac
9129 cat <<EOM
9130
9131 Perl can be built to use 'fast stdio', which means using the stdio
9132 library but also directly manipulating the stdio buffers to enable
9133 faster I/O.  Using stdio is better for backward compatibility (especially
9134 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9135 interface has been preferred instead of stdio.
9136
9137 If this doesn't make any sense to you, just accept the default '$dflt'.
9138 EOM
9139 rp='Use the "fast stdio" if available?'
9140 . ./myread
9141 case "$ans" in
9142 y|Y)    val="$define" ;;
9143 *)      val="$undef" ;;
9144 esac
9145 set usefaststdio
9146 eval $setvar
9147
9148
9149 : define an is-a-typedef? function
9150 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9151 case "$inclist" in
9152 "") inclist="sys/types.h";;
9153 esac;
9154 eval "varval=\$$var";
9155 case "$varval" in
9156 "")
9157         $rm -f temp.c;
9158         for inc in $inclist; do
9159                 echo "#include <$inc>" >>temp.c;
9160         done;
9161         echo "#ifdef $type" >> temp.c;
9162         echo "printf(\"We have $type\");" >> temp.c;
9163         echo "#endif" >> temp.c;
9164         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9165         if $contains $type temp.E >/dev/null 2>&1; then
9166                 eval "$var=\$type";
9167         else
9168                 eval "$var=\$def";
9169         fi;
9170         $rm -f temp.?;;
9171 *) eval "$var=\$varval";;
9172 esac'
9173
9174 : define an is-a-typedef? function that prompts if the type is not available.
9175 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9176 case "$inclist" in
9177 "") inclist="sys/types.h";;
9178 esac;
9179 eval "varval=\$$var";
9180 case "$varval" in
9181 "")
9182         $rm -f temp.c;
9183         for inc in $inclist; do
9184                 echo "#include <$inc>" >>temp.c;
9185         done;
9186         echo "#ifdef $type" >> temp.c;
9187         echo "printf(\"We have $type\");" >> temp.c;
9188         echo "#endif" >> temp.c;
9189         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9190         echo " " ;
9191         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9192         if $contains $type temp.E >/dev/null 2>&1; then
9193                 echo "$type found." >&4;
9194                 eval "$var=\$type";
9195         else
9196                 echo "$type NOT found." >&4;
9197                 dflt="$def";
9198                 . ./myread ;
9199                 eval "$var=\$ans";
9200         fi;
9201         $rm -f temp.?;;
9202 *) eval "$var=\$varval";;
9203 esac'
9204
9205 : see what type lseek is declared as in the kernel
9206 rp="What is the type used for lseek's offset on this system?"
9207 set off_t lseektype long stdio.h sys/types.h
9208 eval $typedef_ask
9209
9210 echo " "
9211 echo "Checking to see how big your file offsets are..." >&4
9212 $cat >try.c <<EOCP
9213 #include <sys/types.h>
9214 #include <stdio.h>
9215 int main()
9216 {
9217     printf("%d\n", (int)sizeof($lseektype));
9218     return(0);
9219 }
9220 EOCP
9221 set try
9222 if eval $compile_ok; then
9223         lseeksize=`$run ./try`
9224         echo "Your file offsets are $lseeksize bytes long."
9225 else
9226         dflt=$longsize
9227         echo " "
9228         echo "(I can't seem to compile the test program.  Guessing...)"
9229         rp="What is the size of your file offsets (in bytes)?"
9230         . ./myread
9231         lseeksize="$ans"
9232 fi
9233 $rm_try
9234
9235 : see what type file positions are declared as in the library
9236 rp="What is the type for file position used by fsetpos()?"
9237 set fpos_t fpostype long stdio.h sys/types.h
9238 eval $typedef_ask
9239
9240 : Check size for Fpos_t
9241 echo " "
9242 case "$fpostype" in
9243 *_t) zzz="$fpostype"    ;;
9244 *)   zzz="fpos_t"       ;;
9245 esac
9246 echo "Checking the size of $zzz..." >&4
9247 cat > try.c <<EOCP
9248 #include <sys/types.h>
9249 #include <stdio.h>
9250 #$i_stdlib I_STDLIB
9251 #ifdef I_STDLIB
9252 #include <stdlib.h>
9253 #endif
9254 int main() {
9255     printf("%d\n", (int)sizeof($fpostype));
9256     exit(0);
9257 }
9258 EOCP
9259 set try
9260 if eval $compile_ok; then
9261         yyy=`$run ./try`
9262         case "$yyy" in
9263         '')     fpossize=4
9264                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9265                 ;;
9266         *)      fpossize=$yyy
9267                 echo "Your $zzz is $fpossize bytes long."
9268                 ;;
9269         esac
9270 else
9271         dflt="$longsize"
9272         echo " " >&4
9273         echo "(I can't compile the test program.  Guessing...)" >&4
9274         rp="What is the size of your file positions (in bytes)?"
9275         . ./myread
9276         fpossize="$ans"
9277 fi
9278
9279 : Check for large file support
9280 # Backward compatibility (uselfs is deprecated).
9281 case "$uselfs" in
9282 "$define"|true|[yY]*)
9283         cat <<EOM >&4
9284
9285 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9286 EOM
9287         uselargefiles="$define"
9288         ;;
9289 esac
9290
9291 case "$lseeksize:$fpossize" in
9292 8:8) cat <<EOM
9293
9294 You can have files larger than 2 gigabytes.
9295 EOM
9296    val="$define" ;;
9297 *)    case "$uselargefiles" in
9298    "$undef"|false|[nN]*) dflt='n' ;;
9299    *)   dflt='y' ;;
9300    esac
9301    cat <<EOM
9302
9303 Perl can be built to understand large files (files larger than 2 gigabytes)
9304 on some systems.  To do so, Configure can be run with -Duselargefiles.
9305
9306 If this doesn't make any sense to you, just accept the default '$dflt'.
9307 EOM
9308    rp='Try to understand large files, if available?'
9309    . ./myread
9310    case "$ans" in
9311    y|Y)         val="$define" ;;
9312    *)           val="$undef"  ;;
9313    esac
9314    ;;
9315 esac
9316 set uselargefiles
9317 eval $setvar
9318 : Look for a hint-file generated 'call-back-unit'.  If the
9319 : user has specified that a large files perl is to be built,
9320 : we may need to set or change some other defaults.
9321 if $test -f uselargefiles.cbu; then
9322         echo "Your platform has some specific hints regarding large file builds, using them..."
9323         . ./uselargefiles.cbu
9324 fi
9325 case "$uselargefiles" in
9326 "$define")
9327         if $test -f uselargefiles.cbu; then
9328                 echo " "
9329                 echo "Rechecking to see how big your file offsets are..." >&4
9330                 $cat >try.c <<EOCP
9331 #include <sys/types.h>
9332 #include <stdio.h>
9333 int main()
9334 {
9335     printf("%d\n", (int)sizeof($lseektype));
9336     return(0);
9337 }
9338 EOCP
9339                 set try
9340                 if eval $compile_ok; then
9341                         lseeksize=`$run ./try`
9342                         $echo "Your file offsets are now $lseeksize bytes long."
9343                 else
9344                         dflt="$lseeksize"
9345                         echo " "
9346                         echo "(I can't seem to compile the test program.  Guessing...)"
9347                         rp="What is the size of your file offsets (in bytes)?"
9348                         . ./myread
9349                         lseeksize="$ans"
9350                 fi
9351                 case "$fpostype" in
9352                 *_t) zzz="$fpostype"    ;;
9353                 *)   zzz="fpos_t"       ;;
9354                 esac
9355                 $echo $n "Rechecking the size of $zzz...$c" >&4
9356                 $cat > try.c <<EOCP
9357 #include <sys/types.h>
9358 #include <stdio.h>
9359 #$i_stdlib I_STDLIB
9360 #ifdef I_STDLIB
9361 #include <stdlib.h>
9362 #endif
9363 int main() {
9364     printf("%d\n", (int)sizeof($fpostype));
9365     return(0);
9366 }
9367 EOCP
9368                 set try
9369                 if eval $compile_ok; then
9370                         yyy=`$run ./try`
9371                         dflt="$lseeksize"
9372                         case "$yyy" in
9373                         '')     echo " "
9374                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9375                                 ;;
9376                         *)      fpossize=$yyy
9377                                 echo " $fpossize bytes." >&4
9378                                 ;;
9379                         esac
9380                 else
9381                         dflt="$fpossize"
9382                         echo " "
9383                         echo "(I can't compile the test program.  Guessing...)" >&4
9384                         rp="What is the size of your file positions (in bytes)?"
9385                         . ./myread
9386                         fpossize="$ans"
9387                 fi
9388                 $rm_try
9389         fi
9390         ;;
9391 esac
9392
9393 : Set the vendorbin variables
9394 case "$vendorprefix" in
9395 '')     d_vendorbin="$undef"
9396         vendorbin=''
9397         vendorbinexp=''
9398         ;;
9399 *)      d_vendorbin="$define"
9400         : determine where vendor-supplied executables go.
9401         case "$vendorbin" in
9402         '') dflt=$vendorprefix/bin ;;
9403         *)      dflt="$vendorbin" ;;
9404         esac
9405         fn=d~+
9406         rp='Pathname for the vendor-supplied executables directory?'
9407         . ./getfile
9408         vendorbin="$ans"
9409         vendorbinexp="$ansexp"
9410         ;;
9411 esac
9412 prefixvar=vendorbin
9413 . ./installprefix
9414
9415 : Set the vendorhtml1dir variables
9416 case "$vendorprefix" in
9417 '')     vendorhtml1dir=''
9418         vendorhtml1direxp=''
9419         ;;
9420 *)      : determine where vendor-supplied html pages go.
9421         : There is no standard location, so try to copy the previously-selected
9422         : directory structure for the core html pages.
9423         : XXX Better default suggestions would be welcome.
9424         case "$vendorhtml1dir" in
9425         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9426         *)      dflt=$vendorhtml1dir ;;
9427         esac
9428         case "$dflt" in
9429         ''|' ') dflt=none ;;
9430         esac
9431         fn=dn+~
9432         rp='Pathname for the vendor-supplied html pages?'
9433         . ./getfile
9434         vendorhtml1dir="$ans"
9435         vendorhtml1direxp="$ansexp"
9436         ;;
9437 esac
9438 : Use ' ' for none so value is preserved next time through Configure
9439 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9440 prefixvar=vendorhtml1dir
9441 . ./installprefix
9442
9443 : Set the vendorhtml3dir variables
9444 case "$vendorprefix" in
9445 '')     vendorhtml3dir=''
9446         vendorhtml3direxp=''
9447         ;;
9448 *)      : determine where vendor-supplied module html pages go.
9449         : There is no standard location, so try to copy the previously-selected
9450         : directory structure for the core html pages.
9451         : XXX Better default suggestions would be welcome.
9452         case "$vendorhtml3dir" in
9453         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9454         *)      dflt=$vendorhtml3dir ;;
9455         esac
9456         case "$dflt" in
9457         ''|' ') dflt=none ;;
9458         esac
9459         fn=dn+~
9460         rp='Pathname for the vendor-supplied html pages?'
9461         . ./getfile
9462         vendorhtml3dir="$ans"
9463         vendorhtml3direxp="$ansexp"
9464         ;;
9465 esac
9466 : Use ' ' for none so value is preserved next time through Configure
9467 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9468 prefixvar=vendorhtml3dir
9469 . ./installprefix
9470
9471 : Set the vendorman1dir variables
9472 case "$vendorprefix" in
9473 '')     vendorman1dir=''
9474         vendorman1direxp=''
9475         ;;
9476 *)      : determine where vendor-supplied manual pages go.
9477         case "$vendorman1dir" in
9478         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9479         *)      dflt=$vendorman1dir ;;
9480         esac
9481         case "$dflt" in
9482         ''|' ') dflt=none ;;
9483         esac
9484         fn=nd~+
9485         rp='Pathname for the vendor-supplied manual section 1 pages?'
9486         . ./getfile
9487         vendorman1dir="$ans"
9488         vendorman1direxp="$ansexp"
9489         ;;
9490 esac
9491 : Use ' ' for none so value is preserved next time through Configure
9492 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9493 prefixvar=vendorman1dir
9494 . ./installprefix
9495
9496 : Set the vendorman3dir variables
9497 case "$vendorprefix" in
9498 '')     vendorman3dir=''
9499         vendorman3direxp=''
9500         ;;
9501 *)      : determine where vendor-supplied module manual pages go.
9502         case "$vendorman3dir" in
9503         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9504         *)      dflt=$vendorman3dir ;;
9505         esac
9506         case "$dflt" in
9507         ''|' ') dflt=none ;;
9508         esac
9509         fn=nd~+
9510         rp='Pathname for the vendor-supplied manual section 3 pages?'
9511         . ./getfile
9512         vendorman3dir="$ans"
9513         vendorman3direxp="$ansexp"
9514         ;;
9515 esac
9516 : Use ' ' for none so value is preserved next time through Configure
9517 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9518 prefixvar=vendorman3dir
9519 . ./installprefix
9520
9521 : Set the vendorscript variables
9522 case "$vendorprefix" in
9523 '')     d_vendorscript="$undef"
9524         vendorscript=''
9525         vendorscriptexp=''
9526         ;;
9527 *)      d_vendorscript="$define"
9528         : determine where vendor-supplied scripts go.
9529         case "$vendorscript" in
9530         '')     dflt=$vendorprefix/script
9531                 $test -d $dflt || dflt=$vendorbin ;;
9532         *)  dflt="$vendorscript" ;;
9533         esac
9534         $cat <<EOM
9535
9536 The installation process will create a directory for
9537 vendor-supplied scripts.
9538
9539 EOM
9540         fn=d~+
9541         rp='Pathname for the vendor-supplied scripts directory?'
9542         . ./getfile
9543         vendorscript="$ans"
9544         vendorscriptexp="$ansexp"
9545         ;;
9546 esac
9547 prefixvar=vendorscript
9548 . ./installprefix
9549
9550 : script used to emit important warnings
9551 cat >warn <<EOS
9552 $startsh
9553 if test \$# -gt 0; then
9554         echo "\$@" >msg
9555 else
9556         cat >msg
9557 fi
9558 echo "*** WARNING:" >&4
9559 sed -e 's/^/*** /' <msg >&4
9560 echo "*** " >&4
9561 cat msg >>config.msg
9562 echo " " >>config.msg
9563 rm -f msg
9564 EOS
9565 chmod +x warn
9566 $eunicefix warn
9567
9568 : see which of string.h or strings.h is needed
9569 echo " "
9570 strings=`./findhdr string.h`
9571 if $test "$strings" && $test -r "$strings"; then
9572         echo "Using <string.h> instead of <strings.h>." >&4
9573         val="$define"
9574 else
9575         val="$undef"
9576         strings=`./findhdr strings.h`
9577         if $test "$strings" && $test -r "$strings"; then
9578                 echo "Using <strings.h> instead of <string.h>." >&4
9579         else
9580                 ./warn "No string header found -- You'll surely have problems."
9581         fi
9582 fi
9583 set i_string
9584 eval $setvar
9585 case "$i_string" in
9586 "$undef") strings=`./findhdr strings.h`;;
9587 *)        strings=`./findhdr string.h`;;
9588 esac
9589
9590 : see if qgcvt exists
9591 set qgcvt d_qgcvt
9592 eval $inlibc
9593
9594 : Check print/scan long double stuff
9595 echo " "
9596
9597 if $test X"$d_longdbl" = X"$define"; then
9598
9599 echo "Checking how to print long doubles..." >&4
9600
9601 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9602         $cat >try.c <<'EOCP'
9603 #include <sys/types.h>
9604 #include <stdio.h>
9605 int main() {
9606   double d = 123.456;
9607   printf("%.3f\n", d);
9608 }
9609 EOCP
9610         set try
9611         if eval $compile; then
9612                 yyy=`$run ./try`
9613                 case "$yyy" in
9614                 123.456)
9615                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9616                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9617                         echo "We will use %f."
9618                         ;;
9619                 esac
9620         fi
9621 fi
9622
9623 if $test X"$sPRIfldbl" = X; then
9624         $cat >try.c <<'EOCP'
9625 #include <sys/types.h>
9626 #include <stdio.h>
9627 int main() {
9628   long double d = 123.456;
9629   printf("%.3Lf\n", d);
9630 }
9631 EOCP
9632         set try
9633         if eval $compile; then
9634                 yyy=`$run ./try`
9635                 case "$yyy" in
9636                 123.456)
9637                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9638                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9639                         echo "We will use %Lf."
9640                         ;;
9641                 esac
9642         fi
9643 fi
9644
9645 if $test X"$sPRIfldbl" = X; then
9646         $cat >try.c <<'EOCP'
9647 #include <sys/types.h>
9648 #include <stdio.h>
9649 int main() {
9650   long double d = 123.456;
9651   printf("%.3llf\n", d);
9652 }
9653 EOCP
9654         set try
9655         if eval $compile; then
9656                 yyy=`$run ./try`
9657                 case "$yyy" in
9658                 123.456)
9659                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9660                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9661                         echo "We will use %llf."
9662                         ;;
9663                 esac
9664         fi
9665 fi
9666
9667 if $test X"$sPRIfldbl" = X; then
9668         $cat >try.c <<'EOCP'
9669 #include <sys/types.h>
9670 #include <stdio.h>
9671 int main() {
9672   long double d = 123.456;
9673   printf("%.3lf\n", d);
9674 }
9675 EOCP
9676         set try
9677         if eval $compile; then
9678                 yyy=`$run ./try`
9679                 case "$yyy" in
9680                 123.456)
9681                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9682                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9683                         echo "We will use %lf."
9684                         ;;
9685                 esac
9686         fi
9687 fi
9688
9689 if $test X"$sPRIfldbl" = X; then
9690         echo "Cannot figure out how to print long doubles." >&4
9691 else
9692         sSCNfldbl=$sPRIfldbl    # expect consistency
9693 fi
9694
9695 $rm_try
9696
9697 fi # d_longdbl
9698
9699 case "$sPRIfldbl" in
9700 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9701         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9702         d_SCNfldbl="$undef";
9703         ;;
9704 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9705         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9706         d_SCNfldbl="$define";
9707         ;;
9708 esac
9709
9710 : Check how to convert floats to strings.
9711
9712 if test "X$d_Gconvert" = X; then
9713
9714 echo " "
9715 echo "Checking for an efficient way to convert floats to strings."
9716 echo " " > try.c
9717 case "$uselongdouble" in
9718 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9719 esac
9720 case "$d_longdbl" in
9721 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9722 esac
9723 case "$d_PRIgldbl" in
9724 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9725 esac
9726 $cat >>try.c <<EOP
9727 #ifdef TRY_gconvert
9728 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9729 char *myname = "gconvert";
9730 #endif
9731 #ifdef TRY_gcvt
9732 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9733 char *myname = "gcvt";
9734 #endif
9735 #ifdef TRY_qgcvt
9736 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9737 char *myname = "qgcvt";
9738 #define DOUBLETYPE long double
9739 #endif
9740 #ifdef TRY_sprintf
9741 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9742 #ifdef HAS_PRIgldbl
9743 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9744 #else
9745 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9746 #endif
9747 #else
9748 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9749 #endif
9750 char *myname = "sprintf";
9751 #endif
9752
9753 #ifndef DOUBLETYPE
9754 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9755 #define DOUBLETYPE long double
9756 #else
9757 #define DOUBLETYPE double
9758 #endif
9759 #endif
9760
9761 #include <stdio.h>
9762
9763 #$i_stdlib I_STDLIB
9764 #ifdef I_STDLIB
9765 #include <stdlib.h>
9766 #endif
9767 #$i_string I_STRING
9768 #ifdef I_STRING
9769 #  include <string.h>
9770 #else
9771 #  include <strings.h>
9772 #endif
9773
9774 int checkit(char *expect, char *got)
9775 {
9776     if (strcmp(expect, got)) {
9777                 printf("%s oddity:  Expected %s, got %s\n",
9778                         myname, expect, got);
9779                 exit(1);
9780         }
9781 }
9782
9783 int main()
9784 {
9785         char buf[64];
9786         buf[63] = '\0';
9787
9788         /* This must be 1st test on (which?) platform */
9789         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9790         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9791         checkit("0.1", buf);
9792
9793         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9794         checkit("0.01", buf);
9795
9796         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9797         checkit("0.001", buf);
9798
9799         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9800         checkit("0.0001", buf);
9801
9802         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9803         if (strlen(buf) > 5)
9804             checkit("9e-005", buf); /* for Microsoft ?? */
9805         else
9806             checkit("9e-05", buf);
9807
9808         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9809         checkit("1", buf);
9810
9811         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9812         checkit("1.1", buf);
9813
9814         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9815         checkit("1.01", buf);
9816
9817         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9818         checkit("1.001", buf);
9819
9820         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9821         checkit("1.0001", buf);
9822
9823         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9824         checkit("1.00001", buf);
9825
9826         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9827         checkit("1.000001", buf);
9828
9829         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9830         checkit("0", buf);
9831
9832         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9833         checkit("-1", buf);
9834
9835         /* Some Linux gcvt's give 1.e+5 here. */
9836         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9837         checkit("100000", buf);
9838
9839         /* Some Linux gcvt's give -1.e+5 here. */
9840         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9841         checkit("-100000", buf);
9842
9843         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9844         checkit("123.456", buf);
9845
9846         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9847         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9848         /* 34 should be enough to scare even long double
9849          * places into using the e notation. */
9850         if (strlen(buf) > 5)
9851             checkit("1e+034", buf); /* for Microsoft */
9852         else
9853             checkit("1e+34", buf);
9854
9855         /* For Perl, if you add additional tests here, also add them to
9856          * t/base/num.t for benefit of platforms not using Configure or
9857          * overriding d_Gconvert */
9858
9859         exit(0);
9860 }
9861 EOP
9862 : first add preferred functions to our list
9863 xxx_list=""
9864 for xxx_convert in $gconvert_preference; do
9865     case $xxx_convert in
9866     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9867     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9868     esac
9869 done
9870 : then add any others
9871 for xxx_convert in gconvert gcvt sprintf; do
9872     case "$xxx_list" in
9873     *$xxx_convert*) ;;
9874     *) xxx_list="$xxx_list $xxx_convert" ;;
9875     esac
9876 done
9877
9878 case "$d_longdbl$uselongdouble" in
9879 "$define$define")
9880     : again, add prefered functions to our list first
9881     xxx_ld_list=""
9882     for xxx_convert in $gconvert_ld_preference; do
9883         case $xxx_convert in
9884         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9885         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9886         esac
9887     done
9888     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9889     for xxx_convert in qgcvt sprintf $xxx_list; do
9890         case "$xxx_ld_list" in
9891         $xxx_convert*|*" $xxx_convert"*) ;;
9892         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9893         esac
9894     done
9895     : if sprintf cannot do long doubles, move it to the end
9896     if test "$d_PRIgldbl" != "$define"; then
9897         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9898     fi
9899     : if no qgcvt, remove it
9900     if test "$d_qgcvt" != "$define"; then
9901         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9902     fi
9903     : use the ld_list
9904     xxx_list="$xxx_ld_list"
9905     ;;
9906 esac
9907
9908 for xxx_convert in $xxx_list; do
9909         echo "Trying $xxx_convert..."
9910         $rm -f try try$_o core
9911         set try -DTRY_$xxx_convert
9912         if eval $compile; then
9913                 echo "$xxx_convert() found." >&4
9914                 if $run ./try; then
9915                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9916                         break;
9917                 else
9918                         echo "...But $xxx_convert didn't work as I expected."
9919                         xxx_convert=''
9920                 fi
9921         else
9922                 echo "$xxx_convert NOT found." >&4
9923         fi
9924 done
9925
9926 if test X$xxx_convert = X; then
9927     echo "*** WHOA THERE!!! ***" >&4
9928     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9929     xxx_convert=sprintf
9930 fi
9931
9932 case "$xxx_convert" in
9933 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9934 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9935 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9936 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9937    "$define$define$define")
9938       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9939    "$define$define$undef")
9940       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9941    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9942    esac
9943    ;;
9944 esac
9945
9946 fi
9947 $rm_try
9948
9949 : see if _fwalk exists
9950 set fwalk d__fwalk
9951 eval $inlibc
9952
9953 : Initialize h_fcntl
9954 h_fcntl=false
9955
9956 : Initialize h_sysfile
9957 h_sysfile=false
9958
9959 : access call always available on UNIX
9960 set access d_access
9961 eval $inlibc
9962
9963 : locate the flags for 'access()'
9964 case "$d_access" in
9965 "$define")
9966         echo " "
9967         $cat >access.c <<EOCP
9968 #include <sys/types.h>
9969 #ifdef I_FCNTL
9970 #include <fcntl.h>
9971 #endif
9972 #ifdef I_SYS_FILE
9973 #include <sys/file.h>
9974 #endif
9975 #ifdef I_UNISTD
9976 #include <unistd.h>
9977 #endif
9978 #$i_stdlib I_STDLIB
9979 #ifdef I_STDLIB
9980 #include <stdlib.h>
9981 #endif
9982 int main() {
9983         exit(R_OK);
9984 }
9985 EOCP
9986         : check sys/file.h first, no particular reason here
9987         if $test `./findhdr sys/file.h` && \
9988                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9989                 h_sysfile=true;
9990                 echo "<sys/file.h> defines the *_OK access constants." >&4
9991         elif $test `./findhdr fcntl.h` && \
9992                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9993                 h_fcntl=true;
9994                 echo "<fcntl.h> defines the *_OK access constants." >&4
9995         elif $test `./findhdr unistd.h` && \
9996                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9997                 echo "<unistd.h> defines the *_OK access constants." >&4
9998         else
9999                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10000         fi
10001         ;;
10002 esac
10003 $rm -f access*
10004
10005 : see if accessx exists
10006 set accessx d_accessx
10007 eval $inlibc
10008
10009 : see if aintl exists
10010 set aintl d_aintl
10011 eval $inlibc
10012
10013 : see if alarm exists
10014 set alarm d_alarm
10015 eval $inlibc
10016
10017 : see if 64bit time functions exists
10018
10019 set ctime64 d_ctime64
10020 eval $inlibc
10021
10022 set localtime64 d_localtime64
10023 eval $inlibc
10024
10025 set gmtime64 d_gmtime64
10026 eval $inlibc
10027
10028 set mktime64 d_mktime64
10029 eval $inlibc
10030
10031 set difftime64 d_difftime64
10032 eval $inlibc
10033
10034 set asctime64 d_asctime64
10035 eval $inlibc
10036
10037 : see if POSIX threads are available
10038 set pthread.h i_pthread
10039 eval $inhdr
10040
10041 : define a fucntion to check prototypes
10042 $cat > protochk <<EOSH
10043 $startsh
10044 cc="$cc"
10045 optimize="$optimize"
10046 ccflags="$ccflags"
10047 prototype="$prototype"
10048 define="$define"
10049 rm_try="$rm_try"
10050 usethreads=$usethreads
10051 i_pthread=$i_pthread
10052 pthread_h_first=$pthread_h_first
10053 EOSH
10054
10055 $cat >> protochk <<'EOSH'
10056
10057 $rm_try
10058 foo="$1"
10059 shift
10060 while test $# -ge 2; do
10061         case "$1" in
10062                 $define) echo "#include <$2>" >> try.c ;;
10063                 literal) echo "$2" >> try.c ;;
10064         esac
10065     # Extra magic for the benefit of systems that need pthread.h
10066     # to be included early to correctly detect threadsafe functions.
10067     # Such functions must guarantee themselves, though, that the usethreads
10068     # and i_pthread have been defined, before calling protochk.
10069     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10070         echo "#include <pthread.h>" >> try.c
10071         pthread_h_done=yes
10072     fi
10073     shift 2
10074 done
10075 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10076 cat >> try.c <<'EOCP'
10077 #ifdef CAN_PROTOTYPE
10078 #define _(args) args
10079 #else
10080 #define _(args) ()
10081 #endif
10082 EOCP
10083 echo "$foo" >> try.c
10084 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10085 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10086 status=$?
10087 $rm_try
10088 exit $status
10089 EOSH
10090 chmod +x protochk
10091 $eunicefix protochk
10092
10093 : Define hasproto macro for Configure internal use
10094 hasproto='varname=$1; func=$2; shift; shift;
10095 while $test $# -ge 2; do
10096         case "$1" in
10097         $define) echo "#include <$2>";;
10098         esac ;
10099     shift 2;
10100 done > try.c;
10101 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10102 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10103         echo "$func() prototype found.";
10104         val="$define";
10105 else
10106         echo "$func() prototype NOT found.";
10107         val="$undef";
10108 fi;
10109 set $varname;
10110 eval $setvar;
10111 $rm_try tryout.c'
10112
10113 : see if sys/types.h has to be included
10114 set sys/types.h i_systypes
10115 eval $inhdr
10116
10117 : see if sys/select.h has to be included
10118 set sys/select.h i_sysselct
10119 eval $inhdr
10120
10121 : Define hasfield macro for Configure internal use
10122 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10123 while $test $# -ge 2; do
10124         case "$1" in
10125         $define) echo "#include <$2>";;
10126         esac ;
10127     shift 2;
10128 done > try.c;
10129 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10130 set try;
10131 if eval $compile; then
10132         val="$define";
10133 else
10134         val="$undef";
10135 fi;
10136 set $varname;
10137 eval $setvar;
10138 $rm_try'
10139
10140 : see if we should include time.h, sys/time.h, or both
10141 echo " "
10142 if test "X$timeincl" = X; then
10143         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10144         $echo $n "I'm now running the test program...$c"
10145         $cat >try.c <<EOCP
10146 #include <sys/types.h>
10147 #ifdef I_TIME
10148 #include <time.h>
10149 #endif
10150 #ifdef I_SYSTIME
10151 #ifdef SYSTIMEKERNEL
10152 #define KERNEL
10153 #endif
10154 #include <sys/time.h>
10155 #endif
10156 #ifdef I_SYSSELECT
10157 #include <sys/select.h>
10158 #endif
10159 #$i_stdlib I_STDLIB
10160 #ifdef I_STDLIB
10161 #include <stdlib.h>
10162 #endif
10163 int main()
10164 {
10165         struct tm foo;
10166 #ifdef S_TIMEVAL
10167         struct timeval bar;
10168 #endif
10169 #ifdef S_TIMEZONE
10170         struct timezone tzp;
10171 #endif
10172         if (foo.tm_sec == foo.tm_sec)
10173                 exit(0);
10174 #ifdef S_TIMEVAL
10175         if (bar.tv_sec == bar.tv_sec)
10176                 exit(0);
10177 #endif
10178         exit(1);
10179 }
10180 EOCP
10181         flags=''
10182         for s_timezone in '-DS_TIMEZONE' ''; do
10183         sysselect=''
10184         for s_timeval in '-DS_TIMEVAL' ''; do
10185         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10186         for i_time in '' '-DI_TIME'; do
10187         for i_systime in '-DI_SYSTIME' ''; do
10188                 case "$flags" in
10189                 '') $echo $n ".$c"
10190                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10191                         if eval $compile; then
10192                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10193                                 shift
10194                                 flags="$*"
10195                                 echo " "
10196                                 $echo $n "Succeeded with $flags$c"
10197                         fi
10198                         ;;
10199                 esac
10200         done
10201         done
10202         done
10203         done
10204         done
10205         timeincl=''
10206         echo " "
10207         case "$flags" in
10208         *SYSTIMEKERNEL*) i_systimek="$define"
10209                 timeincl=`./findhdr sys/time.h`
10210                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10211         *) i_systimek="$undef";;
10212         esac
10213         case "$flags" in
10214         *I_TIME*) i_time="$define"
10215                 timeincl=`./findhdr time.h`" $timeincl"
10216                 echo "We'll include <time.h>." >&4;;
10217         *) i_time="$undef";;
10218         esac
10219         case "$flags" in
10220         *I_SYSTIME*) i_systime="$define"
10221                 timeincl=`./findhdr sys/time.h`" $timeincl"
10222                 echo "We'll include <sys/time.h>." >&4;;
10223         *) i_systime="$undef";;
10224         esac
10225         $rm_try
10226 fi
10227 : see if struct tm knows about tm_zone
10228 case "$i_systime$i_time" in
10229 *$define*)
10230         echo " "
10231         echo "Checking to see if your struct tm has tm_zone field..." >&4
10232         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10233         eval $hasfield
10234         ;;
10235 *)      val="$undef"
10236         set d_tm_tm_zone
10237         eval $setvar
10238         ;;
10239 esac
10240 case "$d_tm_tm_zone" in
10241 "$define")      echo "Yes, it does."   ;;
10242 *)              echo "No, it doesn't." ;;
10243 esac
10244 : see if struct tm knows about tm_gmtoff
10245 case "$i_systime$i_time" in
10246 *$define*)
10247         echo " "
10248         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10249         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10250         eval $hasfield
10251         ;;
10252 *)      val="$undef"
10253         set d_tm_tm_gmtoff
10254         eval $setvar
10255         ;;
10256 esac
10257 case "$d_tm_tm_gmtoff" in
10258 "$define")      echo "Yes, it does."   ;;
10259 *)              echo "No, it doesn't." ;;
10260 esac
10261
10262 : see if asctime_r exists
10263 set asctime_r d_asctime_r
10264 eval $inlibc
10265 case "$d_asctime_r" in
10266 "$define")
10267         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10268         case "$d_asctime_r_proto:$usethreads" in
10269         ":define")      d_asctime_r_proto=define
10270                 set d_asctime_r_proto asctime_r $hdrs
10271                 eval $hasproto ;;
10272         *)      ;;
10273         esac
10274         case "$d_asctime_r_proto" in
10275         define)
10276         case "$asctime_r_proto" in
10277         ''|0) try='char* asctime_r(const struct tm*, char*);'
10278         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10279         esac
10280         case "$asctime_r_proto" in
10281         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10282         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10283         esac
10284         case "$asctime_r_proto" in
10285         ''|0) try='int asctime_r(const struct tm*, char*);'
10286         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10287         esac
10288         case "$asctime_r_proto" in
10289         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10290         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10291         esac
10292         case "$asctime_r_proto" in
10293         ''|0)   d_asctime_r=undef
10294                 asctime_r_proto=0
10295                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10296         * )     case "$asctime_r_proto" in
10297                 REENTRANT_PROTO*) ;;
10298                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10299                 esac
10300                 echo "Prototype: $try" ;;
10301         esac
10302         ;;
10303         *)      case "$usethreads" in
10304                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10305                 esac
10306                 d_asctime_r=undef
10307                 asctime_r_proto=0
10308                 ;;
10309         esac
10310         ;;
10311 *)      asctime_r_proto=0
10312         ;;
10313 esac
10314
10315 : see if atolf exists
10316 set atolf d_atolf
10317 eval $inlibc
10318
10319 : see if atoll exists
10320 set atoll d_atoll
10321 eval $inlibc
10322
10323 : Look for GCC-style attribute format
10324 case "$d_attribute_format" in
10325 '')
10326 echo " "
10327 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10328 $cat >attrib.c <<'EOCP'
10329 #include <stdio.h>
10330 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10331 EOCP
10332 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10333         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10334                 echo "Your C compiler doesn't support __attribute__((format))."
10335                 val="$undef"
10336         else
10337                 echo "Your C compiler supports __attribute__((format))."
10338                 val="$define"
10339         fi
10340 else
10341         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10342         val="$undef"
10343 fi
10344 ;;
10345 *) val="$d_attribute_format" ;;
10346 esac
10347 set d_attribute_format
10348 eval $setvar
10349 $rm -f attrib*
10350
10351 : Look for GCC-style attribute format with null format allowed
10352 case "$d_printf_format_null" in
10353 '') case "$d_attribute_format" in
10354     $define)
10355         echo " "
10356         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10357 $cat >attrib.c <<EOCP
10358 #include <stdio.h>
10359 #$i_stdlib I_STDLIB
10360 #ifdef I_STDLIB
10361 #include <stdlib.h>
10362 #endif
10363 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10364 int null_printf (char* pat,...) { return (int)pat; }
10365 int main () { exit(null_printf(NULL)); }
10366 EOCP
10367         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10368             : run the executable in case it produces a run-time warning
10369             if $run ./attrib >>attrib.out 2>&1; then
10370                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10371                     echo "Your C compiler doesn't allow __printf__ format to be null."
10372                     val="$undef"
10373                 else
10374                     echo "Your C compiler allows __printf__ format to be null."
10375                     val="$define"
10376                 fi
10377             else
10378             echo "Your C compiler executable failed with __printf__ format null."
10379             val="$undef"
10380         fi
10381     else
10382         echo "Your C compiler fails with __printf__ format null."
10383         val="$undef"
10384     fi
10385     ;;
10386     *)  val="$undef" ;;
10387     esac
10388 ;;
10389 *)  val="$d_printf_format_null" ;;
10390 esac
10391 set d_printf_format_null
10392 eval $setvar
10393 $rm -f attrib*
10394
10395 : Look for GCC-style attribute malloc
10396 case "$d_attribute_malloc" in
10397 '')
10398 echo " "
10399 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10400 $cat >attrib.c <<'EOCP'
10401 #include <stdio.h>
10402 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10403 EOCP
10404 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10405         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10406                 echo "Your C compiler doesn't support __attribute__((malloc))."
10407                 val="$undef"
10408         else
10409                 echo "Your C compiler supports __attribute__((malloc))."
10410                 val="$define"
10411         fi
10412 else
10413         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10414         val="$undef"
10415 fi
10416 ;;
10417 *) val="$d_attribute_malloc" ;;
10418 esac
10419 set d_attribute_malloc
10420 eval $setvar
10421 $rm -f attrib*
10422
10423 : Look for GCC-style attribute nonnull
10424 case "$d_attribute_nonnull" in
10425 '')
10426 echo " "
10427 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10428 $cat >attrib.c <<'EOCP'
10429 #include <stdio.h>
10430 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10431 EOCP
10432 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10433         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10434                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10435                 val="$undef"
10436         else
10437                 echo "Your C compiler supports __attribute__((nonnull))."
10438                 val="$define"
10439         fi
10440 else
10441         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10442         val="$undef"
10443 fi
10444 ;;
10445 *) val="$d_attribute_nonnull" ;;
10446 esac
10447 set d_attribute_nonnull
10448 eval $setvar
10449 $rm -f attrib*
10450
10451 : Look for GCC-style attribute noreturn
10452 case "$d_attribute_noreturn" in
10453 '')
10454 echo " "
10455 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10456 $cat >attrib.c <<'EOCP'
10457 #include <stdio.h>
10458 void fall_over_dead( void ) __attribute__((noreturn));
10459 EOCP
10460 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10461         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10462                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10463                 val="$undef"
10464         else
10465                 echo "Your C compiler supports __attribute__((noreturn))."
10466                 val="$define"
10467         fi
10468 else
10469         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10470         val="$undef"
10471 fi
10472 ;;
10473 *) val="$d_attribute_noreturn" ;;
10474 esac
10475 set d_attribute_noreturn
10476 eval $setvar
10477 $rm -f attrib*
10478
10479 : Look for GCC-style attribute pure
10480 case "$d_attribute_pure" in
10481 '')
10482 echo " "
10483 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10484 $cat >attrib.c <<'EOCP'
10485 #include <stdio.h>
10486 int square( int n ) __attribute__((pure));
10487 EOCP
10488 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10489         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10490                 echo "Your C compiler doesn't support __attribute__((pure))."
10491                 val="$undef"
10492         else
10493                 echo "Your C compiler supports __attribute__((pure))."
10494                 val="$define"
10495         fi
10496 else
10497         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10498         val="$undef"
10499 fi
10500 ;;
10501 *) val="$d_attribute_pure" ;;
10502 esac
10503 set d_attribute_pure
10504 eval $setvar
10505 $rm -f attrib*
10506
10507 : Look for GCC-style attribute unused
10508 case "$d_attribute_unused" in
10509 '')
10510 echo " "
10511 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10512 $cat >attrib.c <<'EOCP'
10513 #include <stdio.h>
10514 int do_something( int dummy __attribute__((unused)), int n );
10515 EOCP
10516 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10517         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10518                 echo "Your C compiler doesn't support __attribute__((unused))."
10519                 val="$undef"
10520         else
10521                 echo "Your C compiler supports __attribute__((unused))."
10522                 val="$define"
10523         fi
10524 else
10525         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10526         val="$undef"
10527 fi
10528 ;;
10529 *) val="$d_attribute_unused" ;;
10530 esac
10531 set d_attribute_unused
10532 eval $setvar
10533 $rm -f attrib*
10534
10535 : Look for GCC-style attribute deprecated
10536 case "$d_attribute_deprecated" in
10537 '')
10538 echo " "
10539 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10540 $cat >attrib.c <<'EOCP'
10541 #include <stdio.h>
10542 int I_am_deprecated(void) __attribute__((deprecated));
10543 EOCP
10544 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10545         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10546                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10547                 val="$undef"
10548         else
10549                 echo "Your C compiler supports __attribute__((deprecated))."
10550                 val="$define"
10551         fi
10552 else
10553         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10554         val="$undef"
10555 fi
10556 ;;
10557 *) val="$d_attribute_deprecated" ;;
10558 esac
10559 set d_attribute_deprecated
10560 eval $setvar
10561 $rm -f attrib*
10562
10563 : Look for GCC-style attribute warn_unused_result
10564 case "$d_attribute_warn_unused_result" in
10565 '')
10566 echo " "
10567 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10568 $cat >attrib.c <<'EOCP'
10569 #include <stdio.h>
10570 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10571 EOCP
10572 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10573         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10574                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10575                 val="$undef"
10576         else
10577                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10578                 val="$define"
10579         fi
10580 else
10581         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10582         val="$undef"
10583 fi
10584 ;;
10585 *) val="$d_attribute_warn_unused_result" ;;
10586 esac
10587 set d_attribute_warn_unused_result
10588 eval $setvar
10589 $rm -f attrib*
10590
10591 : see if bcmp exists
10592 set bcmp d_bcmp
10593 eval $inlibc
10594
10595 : see if bcopy exists
10596 set bcopy d_bcopy
10597 eval $inlibc
10598
10599 : see if getpgrp exists
10600 set getpgrp d_getpgrp
10601 eval $inlibc
10602
10603 case "$d_getpgrp" in
10604 "$define")
10605         echo " "
10606         echo "Checking to see which flavor of getpgrp is in use..."
10607         $cat >try.c <<EOP
10608 #$i_unistd I_UNISTD
10609 #include <sys/types.h>
10610 #ifdef I_UNISTD
10611 #  include <unistd.h>
10612 #endif
10613 #$i_stdlib I_STDLIB
10614 #ifdef I_STDLIB
10615 #include <stdlib.h>
10616 #endif
10617 int main()
10618 {
10619         if (getuid() == 0) {
10620                 printf("(I see you are running Configure as super-user...)\n");
10621                 setuid(1);
10622         }
10623 #ifdef TRY_BSD_PGRP
10624         if (getpgrp(1) == 0)
10625                 exit(0);
10626 #else
10627         if (getpgrp() > 0)
10628                 exit(0);
10629 #endif
10630         exit(1);
10631 }
10632 EOP
10633         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10634                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10635                 val="$define"
10636         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10637                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10638                 val="$undef"
10639         else
10640                 echo "I can't seem to compile and run the test program."
10641                 if ./usg; then
10642                         xxx="a USG one, i.e. you use getpgrp()."
10643                 else
10644                         # SVR4 systems can appear rather BSD-ish.
10645                         case "$i_unistd" in
10646                         $undef)
10647                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10648                                 val="$define"
10649                                 ;;
10650                         $define)
10651                                 xxx="probably a USG one, i.e. you use getpgrp()."
10652                                 val="$undef"
10653                                 ;;
10654                         esac
10655                 fi
10656                 echo "Assuming your getpgrp is $xxx" >&4
10657         fi
10658         ;;
10659 *) val="$undef";;
10660 esac
10661 set d_bsdgetpgrp
10662 eval $setvar
10663 $rm_try
10664
10665 : see if setpgrp exists
10666 set setpgrp d_setpgrp
10667 eval $inlibc
10668
10669 case "$d_setpgrp" in
10670 "$define")
10671         echo " "
10672         echo "Checking to see which flavor of setpgrp is in use..."
10673         $cat >try.c <<EOP
10674 #$i_unistd I_UNISTD
10675 #include <sys/types.h>
10676 #ifdef I_UNISTD
10677 #  include <unistd.h>
10678 #endif
10679 #$i_stdlib I_STDLIB
10680 #ifdef I_STDLIB
10681 #include <stdlib.h>
10682 #endif
10683 int main()
10684 {
10685         if (getuid() == 0) {
10686                 printf("(I see you are running Configure as super-user...)\n");
10687                 setuid(1);
10688         }
10689 #ifdef TRY_BSD_PGRP
10690         if (-1 == setpgrp(1, 1))
10691                 exit(0);
10692 #else
10693         if (setpgrp() != -1)
10694                 exit(0);
10695 #endif
10696         exit(1);
10697 }
10698 EOP
10699         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10700                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10701                 val="$define"
10702         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10703                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10704                 val="$undef"
10705         else
10706                 echo "(I can't seem to compile and run the test program.)"
10707                 if ./usg; then
10708                         xxx="a USG one, i.e. you use setpgrp()."
10709                 else
10710                         # SVR4 systems can appear rather BSD-ish.
10711                         case "$i_unistd" in
10712                         $undef)
10713                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10714                                 val="$define"
10715                                 ;;
10716                         $define)
10717                                 xxx="probably a USG one, i.e. you use setpgrp()."
10718                                 val="$undef"
10719                                 ;;
10720                         esac
10721                 fi
10722                 echo "Assuming your setpgrp is $xxx" >&4
10723         fi
10724         ;;
10725 *) val="$undef";;
10726 esac
10727 set d_bsdsetpgrp
10728 eval $setvar
10729 $rm_try
10730
10731 : Look for GCC-style __builtin_choose_expr
10732 case "$d_builtin_choose_expr" in
10733 '')
10734     echo " "
10735     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10736     $cat >try.c <<'EOCP'
10737 #include <assert.h>
10738 #include <stdlib.h>
10739 #include <stdio.h>
10740
10741 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10742
10743 int main(void) {
10744     assert( SYRINX(1) == 2112 );
10745     assert( SYRINX(1) != 5150 );
10746     assert( SYRINX(0) == 5150 );
10747     assert( SYRINX(0) != 2112 );
10748     puts( "All good!" );
10749     exit(0);
10750 }
10751
10752 EOCP
10753     set try
10754     if eval $compile && $run ./try; then
10755         echo "Your C compiler supports __builtin_choose_expr."
10756         val="$define"
10757     else
10758         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10759         val="$undef"
10760     fi
10761 ;;
10762 *) val="$d_builtin_choose_expr" ;;
10763 esac
10764
10765 set d_builtin_choose_expr
10766 eval $setvar
10767 $rm_try
10768
10769 : Look for GCC-style __builtin_expect
10770 case "$d_builtin_expect" in
10771 '')
10772     echo " "
10773     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10774     $cat >try.c <<'EOCP'
10775 int main(void) {
10776     int n = 50;
10777     if ( __builtin_expect(n, 0) ) n = 1;
10778     /* Remember shell exit code truth is 0, C truth is non-zero */
10779     return !(n == 1);
10780 }
10781 EOCP
10782     set try
10783     if eval $compile && $run ./try; then
10784         echo "Your C compiler supports __builtin_expect."
10785         val="$define"
10786     else
10787         echo "Your C compiler doesn't seem to understand __builtin_expect."
10788         val="$undef"
10789     fi
10790     ;;
10791 *) val="$d_builtin_expect" ;;
10792 esac
10793
10794 set d_builtin_expect
10795 eval $setvar
10796 $rm_try
10797
10798 : see if bzero exists
10799 set bzero d_bzero
10800 eval $inlibc
10801
10802 : see if stdarg is available
10803 echo " "
10804 if $test `./findhdr stdarg.h`; then
10805         echo "<stdarg.h> found." >&4
10806         valstd="$define"
10807 else
10808         echo "<stdarg.h> NOT found." >&4
10809         valstd="$undef"
10810 fi
10811
10812 : see if varags is available
10813 echo " "
10814 if $test `./findhdr varargs.h`; then
10815         echo "<varargs.h> found." >&4
10816 else
10817         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10818 fi
10819
10820 : set up the varargs testing programs
10821 $cat > varargs.c <<EOP
10822 #ifdef I_STDARG
10823 #include <stdarg.h>
10824 #endif
10825 #ifdef I_VARARGS
10826 #include <varargs.h>
10827 #endif
10828
10829 #ifdef I_STDARG
10830 int f(char *p, ...)
10831 #else
10832 int f(va_alist)
10833 va_dcl
10834 #endif
10835 {
10836         va_list ap;
10837 #ifndef I_STDARG
10838         char *p;
10839 #endif
10840 #ifdef I_STDARG
10841         va_start(ap,p);
10842 #else
10843         va_start(ap);
10844         p = va_arg(ap, char *);
10845 #endif
10846         va_end(ap);
10847         return 0;
10848 }
10849 EOP
10850 $cat > varargs <<EOP
10851 $startsh
10852 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10853         echo "true"
10854 else
10855         echo "false"
10856 fi
10857 $rm -f varargs$_o
10858 EOP
10859 chmod +x varargs
10860
10861 : now check which varargs header should be included
10862 echo " "
10863 i_varhdr=''
10864 case "$valstd" in
10865 "$define")
10866         if `./varargs I_STDARG`; then
10867                 val='stdarg.h'
10868         elif `./varargs I_VARARGS`; then
10869                 val='varargs.h'
10870         fi
10871         ;;
10872 *)
10873         if `./varargs I_VARARGS`; then
10874                 val='varargs.h'
10875         fi
10876         ;;
10877 esac
10878 case "$val" in
10879 '')
10880 echo "I could not find the definition for va_dcl... You have problems..." >&4
10881         val="$undef"; set i_stdarg; eval $setvar
10882         val="$undef"; set i_varargs; eval $setvar
10883         ;;
10884 *)
10885         set i_varhdr
10886         eval $setvar
10887         case "$i_varhdr" in
10888         stdarg.h)
10889                 val="$define"; set i_stdarg; eval $setvar
10890                 val="$undef"; set i_varargs; eval $setvar
10891                 ;;
10892         varargs.h)
10893                 val="$undef"; set i_stdarg; eval $setvar
10894                 val="$define"; set i_varargs; eval $setvar
10895                 ;;
10896         esac
10897         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10898 esac
10899 $rm -f varargs*
10900
10901 : see if the Compiler supports C99 variadic macros
10902 case "$i_stdarg$i_stdlib" in
10903     "$define$define")
10904     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10905     $cat >try.c <<EOCP
10906 #include <stdio.h>
10907 #include <stdarg.h>
10908
10909 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10910
10911 int main() {
10912   char buf[20];
10913   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10914   puts(buf);
10915   return 0;
10916 }
10917 EOCP
10918     set try
10919     if eval $compile && $run ./try 2>&1 >/dev/null; then
10920         case "`$run ./try`" in
10921             "123 456 789")
10922             echo "You have C99 variadic macros." >&4
10923             d_c99_variadic_macros="$define"
10924             ;;
10925             *)
10926             echo "You don't have functional C99 variadic macros." >&4
10927             d_c99_variadic_macros="$undef"
10928             ;;
10929         esac
10930     else
10931         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10932         d_c99_variadic_macros="$undef"
10933     fi
10934     $rm_try
10935     ;;
10936     *)
10937     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10938     d_c99_variadic_macros="$undef"
10939     ;;
10940 esac
10941
10942 : see if signal is declared as pointer to function returning int or void
10943 echo " "
10944 xxx=`./findhdr signal.h`
10945 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10946 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10947         echo "You have int (*signal())() instead of void." >&4
10948         val="$undef"
10949 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10950         echo "You have void (*signal())()." >&4
10951         val="$define"
10952 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10953         echo "You have int (*signal())() instead of void." >&4
10954         val="$undef"
10955 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10956         echo "You have void (*signal())()." >&4
10957         val="$define"
10958 else
10959         case "$d_voidsig" in
10960         '')
10961         echo "I can't determine whether signal handler returns void or int..." >&4
10962                 dflt=void
10963                 rp="What type does your signal handler return?"
10964                 . ./myread
10965                 case "$ans" in
10966                 v*) val="$define";;
10967                 *) val="$undef";;
10968                 esac;;
10969         "$define")
10970                 echo "As you already told me, signal handler returns void." >&4
10971                 val="$define"
10972                 ;;
10973         *)      echo "As you already told me, signal handler returns int." >&4
10974                 val="$undef"
10975                 ;;
10976         esac
10977 fi
10978 set d_voidsig
10979 eval $setvar
10980 case "$d_voidsig" in
10981 "$define") signal_t="void";;
10982 *) signal_t="int";;
10983 esac
10984 $rm -f $$.tmp
10985
10986 : check for ability to cast large floats to 32-bit ints.
10987 echo " "
10988 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10989 if $test "$intsize" -ge 4; then
10990         xxx=int
10991 else
10992         xxx=long
10993 fi
10994 $cat >try.c <<EOCP
10995 #include <stdio.h>
10996 #$i_stdlib I_STDLIB
10997 #ifdef I_STDLIB
10998 #include <stdlib.h>
10999 #endif
11000 #include <sys/types.h>
11001 #include <signal.h>
11002 $signal_t blech(int s) { exit(3); }
11003 int main()
11004 {
11005         $xxx i32;
11006         double f, g;
11007         int result = 0;
11008         char str[16];
11009         signal(SIGFPE, blech);
11010
11011         /* Don't let compiler optimize the test away.  Store the number
11012            in a writable string for gcc to pass to sscanf under HP/UX.
11013         */
11014         sprintf(str, "2147483647");
11015         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11016         g = 10 * f;
11017         i32  = ($xxx) g;
11018
11019         /* x86 processors will probably give 0x8000 0000, which is a
11020            sign change.  We don't want that.  We want to mimic SPARC
11021            behavior here, which is to preserve the sign and give
11022            back 0x7fff ffff.
11023         */
11024         if (i32 != ($xxx) f)
11025                 result |= 1;
11026         exit(result);
11027 }
11028 EOCP
11029 set try
11030 if eval $compile_ok; then
11031         $run ./try
11032         yyy=$?
11033 else
11034         echo "(I can't seem to compile the test program--assuming it can't)"
11035         yyy=1
11036 fi
11037 case "$yyy" in
11038 0)      val="$define"
11039         echo "Yup, it can."
11040         ;;
11041 *)      val="$undef"
11042         echo "Nope, it can't."
11043         ;;
11044 esac
11045 set d_casti32
11046 eval $setvar
11047 $rm_try
11048
11049 : check for ability to cast negative floats to unsigned
11050 echo " "
11051 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11052 $cat >try.c <<EOCP
11053 #include <stdio.h>
11054 #$i_stdlib I_STDLIB
11055 #ifdef I_STDLIB
11056 #include <stdlib.h>
11057 #endif
11058 #include <sys/types.h>
11059 #include <signal.h>
11060 $signal_t blech(int s) { exit(7); }
11061 $signal_t blech_in_list(int s) { exit(4); }
11062 unsigned long dummy_long(unsigned long p) { return p; }
11063 unsigned int dummy_int(unsigned int p) { return p; }
11064 unsigned short dummy_short(unsigned short p) { return p; }
11065 int main()
11066 {
11067         double f;
11068         unsigned long along;
11069         unsigned int aint;
11070         unsigned short ashort;
11071         int result = 0;
11072         char str[16];
11073
11074         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11075            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11076            optimized the whole file away
11077         */
11078         /* Store the number in a writable string for gcc to pass to
11079            sscanf under HP/UX.
11080         */
11081         sprintf(str, "-123");
11082         sscanf(str, "%lf", &f);  /* f = -123.; */
11083
11084         signal(SIGFPE, blech);
11085         along = (unsigned long)f;
11086         aint = (unsigned int)f;
11087         ashort = (unsigned short)f;
11088         if (along != (unsigned long)-123)
11089                 result |= 1;
11090         if (aint != (unsigned int)-123)
11091                 result |= 1;
11092         if (ashort != (unsigned short)-123)
11093                 result |= 1;
11094         sprintf(str, "1073741824.");
11095         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11096         f = f + f;
11097         along = 0;
11098         along = (unsigned long)f;
11099         if (along != 0x80000000)
11100                 result |= 2;
11101         f -= 1.;
11102         along = 0;
11103         along = (unsigned long)f;
11104         if (along != 0x7fffffff)
11105                 result |= 1;
11106         f += 2.;
11107         along = 0;
11108         along = (unsigned long)f;
11109         if (along != 0x80000001)
11110                 result |= 2;
11111         if (result)
11112                 exit(result);
11113         signal(SIGFPE, blech_in_list);
11114         sprintf(str, "123.");
11115         sscanf(str, "%lf", &f);  /* f = 123.; */
11116         along = dummy_long((unsigned long)f);
11117         aint = dummy_int((unsigned int)f);
11118         ashort = dummy_short((unsigned short)f);
11119         if (along != (unsigned long)123)
11120                 result |= 4;
11121         if (aint != (unsigned int)123)
11122                 result |= 4;
11123         if (ashort != (unsigned short)123)
11124                 result |= 4;
11125         exit(result);
11126
11127 }
11128 EOCP
11129 set try
11130 if eval $compile_ok; then
11131         $run ./try
11132         castflags=$?
11133 else
11134         echo "(I can't seem to compile the test program--assuming it can't)"
11135         castflags=7
11136 fi
11137 case "$castflags" in
11138 0)      val="$define"
11139         echo "Yup, it can."
11140         ;;
11141 *)      val="$undef"
11142         echo "Nope, it can't."
11143         ;;
11144 esac
11145 set d_castneg
11146 eval $setvar
11147 $rm_try
11148
11149 : see if vprintf exists
11150 echo " "
11151 if set vprintf val -f d_vprintf; eval $csym; $val; then
11152         echo 'vprintf() found.' >&4
11153         val="$define"
11154         $cat >try.c <<EOF
11155 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11156 #$i_varargs I_VARARGS
11157
11158 #$i_stdlib I_STDLIB
11159 #$i_unistd I_UNISTD
11160
11161 #ifdef I_STDARG
11162 #  include <stdarg.h>
11163 #else /* I_VARARGS */
11164 #  include <varargs.h>
11165 #endif
11166
11167 #ifdef I_UNISTD
11168 #  include <unistd.h>
11169 #endif
11170
11171 #ifdef I_STDLIB
11172 #  include <stdlib.h>
11173 #endif
11174
11175 #include <stdio.h> /* vsprintf prototype */
11176
11177 #ifdef I_STDARG
11178 void xxx(int n, ...)
11179 {
11180     va_list args;
11181     char buf[10];
11182     va_start(args, n);
11183     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11184 }
11185 int main() { xxx(1, "foo"); }
11186
11187 #else /* I_VARARGS */
11188
11189 xxx(va_alist)
11190 va_dcl
11191 {
11192     va_list args;
11193     char buf[10];
11194     va_start(args);
11195     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11196 }
11197 int main() { xxx("foo"); }
11198
11199 #endif
11200
11201 EOF
11202         set try
11203         if eval $compile_ok; then
11204                 if $run ./try; then
11205                         echo "Your vsprintf() returns (int)." >&4
11206                         val2="$undef"
11207                 else
11208                         echo "Your vsprintf() returns (char*)." >&4
11209                         val2="$define"
11210                 fi
11211         else
11212                 echo 'I am unable to compile the vsprintf() test program.' >&4
11213                 # We shouldn't get here.  If we do, assume the standard signature,
11214                 # not the old BSD one.
11215                 echo 'Guessing that vsprintf() returns (int).' >&4
11216                 val2="$undef"
11217         fi
11218 else
11219         echo 'vprintf() NOT found.' >&4
11220         val="$undef"
11221         val2="$undef"
11222 fi
11223 $rm_try
11224 set d_vprintf
11225 eval $setvar
11226 val=$val2
11227 set d_charvspr
11228 eval $setvar
11229
11230 : see if chown exists
11231 set chown d_chown
11232 eval $inlibc
11233
11234 : see if chroot exists
11235 set chroot d_chroot
11236 eval $inlibc
11237
11238 : see if chsize exists
11239 set chsize d_chsize
11240 eval $inlibc
11241
11242 : see if class exists
11243 set class d_class
11244 eval $inlibc
11245
11246 : see if clearenv exists
11247 set clearenv d_clearenv
11248 eval $inlibc
11249
11250 : Define hasstruct macro for Configure internal use
11251 hasstruct='varname=$1; struct=$2; shift; shift;
11252 while $test $# -ge 2; do
11253         case "$1" in
11254         $define) echo "#include <$2>";;
11255         esac ;
11256     shift 2;
11257 done > try.c;
11258 echo "int main () { struct $struct foo; }" >> try.c;
11259 set try;
11260 if eval $compile; then
11261         val="$define";
11262 else
11263         val="$undef";
11264 fi;
11265 set $varname;
11266 eval $setvar;
11267 $rm_try'
11268
11269 : see whether socket exists
11270 socketlib=''
11271 sockethdr=''
11272 echo " "
11273 $echo $n "Hmm... $c" >&4
11274 if set socket val -f d_socket; eval $csym; $val; then
11275         echo "Looks like you have Berkeley networking support." >&4
11276         d_socket="$define"
11277         if set setsockopt val -f; eval $csym; $val; then
11278                 d_oldsock="$undef"
11279         else
11280                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11281                 d_oldsock="$define"
11282         fi
11283 else
11284         if $contains socklib libc.list >/dev/null 2>&1; then
11285                 echo "Looks like you have Berkeley networking support." >&4
11286                 d_socket="$define"
11287                 : we will have to assume that it supports the 4.2 BSD interface
11288                 d_oldsock="$undef"
11289         else
11290                 echo "You don't have Berkeley networking in libc$_a..." >&4
11291                 if test "X$d_socket" = "X$define"; then
11292                    echo "...but you seem to believe that you have sockets." >&4
11293                 else
11294                         for net in net socket
11295                         do
11296                                 if test -f /usr/lib/lib$net$_a; then
11297                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11298                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11299                                         if $contains socket libc.list >/dev/null 2>&1; then
11300                                                 d_socket="$define"
11301                                                 socketlib="-l$net"
11302                                                 case "$net" in
11303                                                 net)
11304                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11305                                                         sockethdr="-I/usr/netinclude"
11306                                                         ;;
11307                                                 esac
11308                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11309                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11310                                                         d_oldsock="$undef"
11311                                                 else
11312                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11313                                                         d_oldsock="$define"
11314                                                 fi
11315                                                 break
11316                                         fi
11317                                 fi
11318                         done
11319                         if test "X$d_socket" != "X$define"; then
11320                            echo "or anywhere else I see." >&4
11321                            d_socket="$undef"
11322                            d_oldsock="$undef"
11323                         fi
11324                 fi
11325         fi
11326 fi
11327
11328 : see if socketpair exists
11329 set socketpair d_sockpair
11330 eval $inlibc
11331
11332
11333 echo " "
11334 echo "Checking the availability of certain socket constants..." >&4
11335 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11336         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11337         $cat >try.c <<EOF
11338 #include <sys/types.h>
11339 #include <sys/socket.h>
11340 int main() {
11341     int i = $ENUM;
11342 }
11343 EOF
11344         val="$undef"
11345         set try; if eval $compile; then
11346                 val="$define"
11347         fi
11348         set d_${enum}; eval $setvar
11349         $rm_try
11350 done
11351
11352 : see if this is a sys/uio.h system
11353 set sys/uio.h i_sysuio
11354 eval $inhdr
11355
11356 : Check for cmsghdr support
11357 echo " "
11358 echo "Checking to see if your system supports struct cmsghdr..." >&4
11359 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11360 eval $hasstruct
11361 case "$d_cmsghdr_s" in
11362 "$define")      echo "Yes, it does."   ;;
11363 *)              echo "No, it doesn't." ;;
11364 esac
11365
11366
11367 : check for const keyword
11368 echo " "
11369 echo 'Checking to see if your C compiler knows about "const"...' >&4
11370 $cat >const.c <<'EOCP'
11371 typedef struct spug { int drokk; } spug;
11372 int main()
11373 {
11374         const char *foo;
11375         const spug y = { 0 };
11376 }
11377 EOCP
11378 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11379         val="$define"
11380         echo "Yup, it does."
11381 else
11382         val="$undef"
11383         echo "Nope, it doesn't."
11384 fi
11385 set d_const
11386 eval $setvar
11387
11388 : see if copysignl exists
11389 set copysignl d_copysignl
11390 eval $inlibc
11391
11392 : see if crypt exists
11393 echo " "
11394 set crypt d_crypt
11395 eval $inlibc
11396 case "$d_crypt" in
11397 $define) cryptlib='' ;;
11398 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11399                 echo 'crypt() found.' >&4
11400                 val="$define"
11401                 cryptlib=''
11402         else
11403                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11404                 if $test -z "$cryptlib"; then
11405                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11406                 else
11407                         cryptlib=-lcrypt
11408                 fi
11409                 if $test -z "$cryptlib"; then
11410                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11411                 else
11412                         cryptlib=-lcrypt
11413                 fi
11414                 if $test -z "$cryptlib"; then
11415                         cryptlib=`./loc libcrypt$_a "" $libpth`
11416                 else
11417                         cryptlib=-lcrypt
11418                 fi
11419                 if $test -z "$cryptlib"; then
11420                         echo 'crypt() NOT found.' >&4
11421                         val="$undef"
11422                 else
11423                         val="$define"
11424                 fi
11425         fi
11426         set d_crypt
11427         eval $setvar
11428         ;;
11429 esac
11430
11431 : see if this is a crypt.h system
11432 set crypt.h i_crypt
11433 eval $inhdr
11434
11435 : see if crypt_r exists
11436 set crypt_r d_crypt_r
11437 eval $inlibc
11438 case "$d_crypt_r" in
11439 "$define")
11440         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11441         case "$d_crypt_r_proto:$usethreads" in
11442         ":define")      d_crypt_r_proto=define
11443                 set d_crypt_r_proto crypt_r $hdrs
11444                 eval $hasproto ;;
11445         *)      ;;
11446         esac
11447         case "$d_crypt_r_proto" in
11448         define)
11449         case "$crypt_r_proto" in
11450         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11451         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11452         esac
11453         case "$crypt_r_proto" in
11454         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11455         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11456         esac
11457         case "$crypt_r_proto" in
11458         ''|0)   d_crypt_r=undef
11459                 crypt_r_proto=0
11460                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11461         * )     case "$crypt_r_proto" in
11462                 REENTRANT_PROTO*) ;;
11463                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11464                 esac
11465                 echo "Prototype: $try" ;;
11466         esac
11467         ;;
11468         *)      case "$usethreads" in
11469                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11470                 esac
11471                 d_crypt_r=undef
11472                 crypt_r_proto=0
11473                 ;;
11474         esac
11475         ;;
11476 *)      crypt_r_proto=0
11477         ;;
11478 esac
11479
11480 : get csh whereabouts
11481 case "$csh" in
11482 'csh') val="$undef" ;;
11483 *) val="$define" ;;
11484 esac
11485 set d_csh
11486 eval $setvar
11487 : Respect a hint or command line value for full_csh.
11488 case "$full_csh" in
11489 '') full_csh=$csh ;;
11490 esac
11491
11492 : see if ctermid exists
11493 set ctermid d_ctermid
11494 eval $inlibc
11495
11496 : see if ctermid_r exists
11497 set ctermid_r d_ctermid_r
11498 eval $inlibc
11499 case "$d_ctermid_r" in
11500 "$define")
11501         hdrs="$i_systypes sys/types.h define stdio.h "
11502         case "$d_ctermid_r_proto:$usethreads" in
11503         ":define")      d_ctermid_r_proto=define
11504                 set d_ctermid_r_proto ctermid_r $hdrs
11505                 eval $hasproto ;;
11506         *)      ;;
11507         esac
11508         case "$d_ctermid_r_proto" in
11509         define)
11510         case "$ctermid_r_proto" in
11511         ''|0) try='char* ctermid_r(char*);'
11512         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11513         esac
11514         case "$ctermid_r_proto" in
11515         ''|0)   d_ctermid_r=undef
11516                 ctermid_r_proto=0
11517                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11518         * )     case "$ctermid_r_proto" in
11519                 REENTRANT_PROTO*) ;;
11520                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11521                 esac
11522                 echo "Prototype: $try" ;;
11523         esac
11524         ;;
11525         *)      case "$usethreads" in
11526                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11527                 esac
11528                 d_ctermid_r=undef
11529                 ctermid_r_proto=0
11530                 ;;
11531         esac
11532         ;;
11533 *)      ctermid_r_proto=0
11534         ;;
11535 esac
11536
11537 : see if ctime_r exists
11538 set ctime_r d_ctime_r
11539 eval $inlibc
11540 case "$d_ctime_r" in
11541 "$define")
11542         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11543         case "$d_ctime_r_proto:$usethreads" in
11544         ":define")      d_ctime_r_proto=define
11545                 set d_ctime_r_proto ctime_r $hdrs
11546                 eval $hasproto ;;
11547         *)      ;;
11548         esac
11549         case "$d_ctime_r_proto" in
11550         define)
11551         case "$ctime_r_proto" in
11552         ''|0) try='char* ctime_r(const time_t*, char*);'
11553         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11554         esac
11555         case "$ctime_r_proto" in
11556         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11557         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11558         esac
11559         case "$ctime_r_proto" in
11560         ''|0) try='int ctime_r(const time_t*, char*);'
11561         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11562         esac
11563         case "$ctime_r_proto" in
11564         ''|0) try='int ctime_r(const time_t*, char*, int);'
11565         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11566         esac
11567         case "$ctime_r_proto" in
11568         ''|0)   d_ctime_r=undef
11569                 ctime_r_proto=0
11570                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11571         * )     case "$ctime_r_proto" in
11572                 REENTRANT_PROTO*) ;;
11573                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11574                 esac
11575                 echo "Prototype: $try" ;;
11576         esac
11577         ;;
11578         *)      case "$usethreads" in
11579                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11580                 esac
11581                 d_ctime_r=undef
11582                 ctime_r_proto=0
11583                 ;;
11584         esac
11585         ;;
11586 *)      ctime_r_proto=0
11587         ;;
11588 esac
11589
11590 : see if cuserid exists
11591 set cuserid d_cuserid
11592 eval $inlibc
11593
11594 : see if this is a limits.h system
11595 set limits.h i_limits
11596 eval $inhdr
11597
11598 : see if this is a float.h system
11599 set float.h i_float
11600 eval $inhdr
11601
11602 : See if number of significant digits in a double precision number is known
11603 echo " "
11604 $cat >dbl_dig.c <<EOM
11605 #$i_limits I_LIMITS
11606 #$i_float I_FLOAT
11607 #ifdef I_LIMITS
11608 #include <limits.h>
11609 #endif
11610 #ifdef I_FLOAT
11611 #include <float.h>
11612 #endif
11613 #ifdef DBL_DIG
11614 printf("Contains DBL_DIG");
11615 #endif
11616 EOM
11617 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11618 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11619         echo "DBL_DIG found." >&4
11620         val="$define"
11621 else
11622         echo "DBL_DIG NOT found." >&4
11623         val="$undef"
11624 fi
11625 $rm -f dbl_dig.?
11626 set d_dbl_dig
11627 eval $setvar
11628
11629 : see if dbm.h is available
11630 : see if dbmclose exists
11631 set dbmclose d_dbmclose
11632 eval $inlibc
11633
11634 case "$d_dbmclose" in
11635 $define)
11636         set dbm.h i_dbm
11637         eval $inhdr
11638         case "$i_dbm" in
11639         $define)
11640                 val="$undef"
11641                 set i_rpcsvcdbm
11642                 eval $setvar
11643                 ;;
11644         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11645                 eval $inhdr
11646                 ;;
11647         esac
11648         ;;
11649 *)      echo "We won't be including <dbm.h>"
11650         val="$undef"
11651         set i_dbm
11652         eval $setvar
11653         val="$undef"
11654         set i_rpcsvcdbm
11655         eval $setvar
11656         ;;
11657 esac
11658
11659 : see if prototype for dbminit is available
11660 echo " "
11661 set d_dbminitproto dbminit $i_dbm dbm.h
11662 eval $hasproto
11663
11664 : see if difftime exists
11665 set difftime d_difftime
11666 eval $inlibc
11667
11668 : see if this is a dirent system
11669 echo " "
11670 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11671         val="$define"
11672         echo "<dirent.h> found." >&4
11673 else
11674         val="$undef"
11675         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11676                 echo "<sys/dir.h> found." >&4
11677                 echo " "
11678         else
11679                 xinc=`./findhdr sys/ndir.h`
11680         fi
11681         echo "<dirent.h> NOT found." >&4
11682 fi
11683 set i_dirent
11684 eval $setvar
11685
11686 : Look for type of directory structure.
11687 echo " "
11688 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11689
11690 case "$direntrytype" in
11691 ''|' ')
11692         case "$i_dirent" in
11693         $define) guess1='struct dirent' ;;
11694         *) guess1='struct direct'  ;;
11695         esac
11696         ;;
11697 *)      guess1="$direntrytype"
11698         ;;
11699 esac
11700
11701 case "$guess1" in
11702 'struct dirent') guess2='struct direct' ;;
11703 *) guess2='struct dirent' ;;
11704 esac
11705
11706 if $contains "$guess1" try.c >/dev/null 2>&1; then
11707         direntrytype="$guess1"
11708         echo "Your directory entries are $direntrytype." >&4
11709 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11710         direntrytype="$guess2"
11711         echo "Your directory entries seem to be $direntrytype." >&4
11712 else
11713         echo "I don't recognize your system's directory entries." >&4
11714         rp="What type is used for directory entries on this system?"
11715         dflt="$guess1"
11716         . ./myread
11717         direntrytype="$ans"
11718 fi
11719 $rm_try
11720
11721 : see if the directory entry stores field length
11722 echo " "
11723 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11724 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11725         echo "Good, your directory entry keeps length information in d_namlen." >&4
11726         val="$define"
11727 else
11728         echo "Your directory entry does not know about the d_namlen field." >&4
11729         val="$undef"
11730 fi
11731 set d_dirnamlen
11732 eval $setvar
11733 $rm_try
11734
11735 : Look for DIR.dd_fd
11736 case "$i_dirent" in
11737 "$define")
11738     echo "Checking to see if DIR has a dd_fd member variable" >&4
11739     $cat >try.c <<EOCP
11740 #$i_stdlib I_STDLIB
11741 #ifdef I_STDLIB
11742 #include <stdlib.h>
11743 #endif
11744 #include <dirent.h>
11745
11746 int main() {
11747     DIR dir;
11748     dir.dd_fd = 1;
11749     return 0;
11750 }
11751 EOCP
11752     val=$undef
11753     set try
11754     if eval $compile; then
11755         echo "Yes, it does."
11756         val="$define"
11757     else
11758         echo "No, it does not."
11759         val="$undef"
11760     fi
11761     ;;
11762 *)
11763     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11764     val="$undef"
11765     ;;
11766 esac
11767 set d_dir_dd_fd
11768 eval $setvar
11769 $rm_try
11770
11771 : see if this is an sysdir system
11772 set sys/dir.h i_sysdir
11773 eval $inhdr
11774
11775 : see if this is an sysndir system
11776 set sys/ndir.h i_sysndir
11777 eval $inhdr
11778
11779 : Look for dirfd
11780 echo " "
11781 $cat >dirfd.c <<EOM
11782 #include <stdio.h>
11783 #$i_stdlib I_STDLIB
11784 #ifdef I_STDLIB
11785 #include <stdlib.h>
11786 #endif
11787 #$i_dirent I_DIRENT             /**/
11788 #$i_sysdir I_SYS_DIR            /**/
11789 #$i_sysndir I_SYS_NDIR          /**/
11790 #$i_systypes I_SYS_TYPES        /**/
11791 #if defined(I_SYS_TYPES)
11792 #include <sys/types.h>
11793 #endif
11794 #if defined(I_DIRENT)
11795 #include <dirent.h>
11796 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11797 #include <sys/dir.h>
11798 #endif
11799 #else
11800 #ifdef I_SYS_NDIR
11801 #include <sys/ndir.h>
11802 #else
11803 #ifdef I_SYS_DIR
11804 #ifdef hp9000s500
11805 #include <ndir.h>       /* may be wrong in the future */
11806 #else
11807 #include <sys/dir.h>
11808 #endif
11809 #endif
11810 #endif
11811 #endif 
11812 int main() {
11813         DIR *dirp = opendir(".");
11814         if (dirfd(dirp) >= 0)
11815                 exit(0);
11816         else
11817                 exit(1);
11818 }
11819 EOM
11820 val=$undef
11821 set dirfd
11822 if eval $compile; then
11823         val="$define"
11824 fi
11825 case "$val" in
11826 $define)        echo "dirfd() found." >&4       ;;
11827 *)              echo "dirfd() NOT found." >&4   ;;
11828 esac
11829 set d_dirfd
11830 eval $setvar
11831 $rm -f dirfd*
11832
11833 : see if dlerror exists
11834 xxx_runnm="$runnm"
11835 runnm=false
11836 set dlerror d_dlerror
11837 eval $inlibc
11838 runnm="$xxx_runnm"
11839
11840 : see if dlfcn is available
11841 set dlfcn.h i_dlfcn
11842 eval $inhdr
11843
11844 : Check what extension to use for shared libs
11845 case "$usedl" in
11846 $define|y|true)
11847         $cat << EOM
11848
11849 On a few systems, the dynamically loaded modules that perl generates and uses
11850 will need a different extension than shared libs. The default will probably
11851 be appropriate.
11852
11853 EOM
11854         case "$dlext" in
11855         '')     dflt="$so" ;;
11856         *)      dflt="$dlext" ;;
11857         esac
11858         rp='What is the extension of dynamically loaded modules'
11859         . ./myread
11860         dlext="$ans"
11861         ;;
11862 *)
11863         dlext="none"
11864         ;;
11865 esac
11866
11867 : Check if dlsym need a leading underscore
11868 echo " "
11869 val="$undef"
11870
11871 case "$dlsrc" in
11872 dl_dlopen.xs)
11873         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11874         $cat >dyna.c <<'EOM'
11875 fred () { }
11876 EOM
11877
11878 $cat >fred.c<<EOM
11879
11880 #include <stdio.h>
11881 #$i_stdlib I_STDLIB
11882 #ifdef I_STDLIB
11883 #include <stdlib.h>
11884 #endif
11885 #$i_dlfcn I_DLFCN
11886 #ifdef I_DLFCN
11887 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11888 #else
11889 #include <sys/types.h>
11890 #include <nlist.h>
11891 #include <link.h>
11892 #endif
11893
11894 extern int fred() ;
11895
11896 int main()
11897 {
11898     void * handle ;
11899     void * symbol ;
11900 #ifndef RTLD_LAZY
11901     int mode = 1 ;
11902 #else
11903     int mode = RTLD_LAZY ;
11904 #endif
11905     handle = dlopen("./dyna.$dlext", mode) ;
11906     if (handle == NULL) {
11907         printf ("1\n") ;
11908         fflush (stdout) ;
11909         exit(0);
11910     }
11911     symbol = dlsym(handle, "fred") ;
11912     if (symbol == NULL) {
11913         /* try putting a leading underscore */
11914         symbol = dlsym(handle, "_fred") ;
11915         if (symbol == NULL) {
11916             printf ("2\n") ;
11917             fflush (stdout) ;
11918             exit(0);
11919         }
11920         printf ("3\n") ;
11921     }
11922     else
11923         printf ("4\n") ;
11924     fflush (stdout) ;
11925     exit(0);
11926 }
11927 EOM
11928         : Call the object file tmp-dyna.o in case dlext=o.
11929         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11930                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11931                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11932                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11933                 xxx=`$run ./fred`
11934                 case $xxx in
11935                 1)      echo "Test program failed using dlopen." >&4
11936                         echo "Perhaps you should not use dynamic loading." >&4;;
11937                 2)      echo "Test program failed using dlsym." >&4
11938                         echo "Perhaps you should not use dynamic loading." >&4;;
11939                 3)      echo "dlsym needs a leading underscore" >&4
11940                         val="$define" ;;
11941                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11942                 esac
11943         else
11944                 echo "I can't compile and run the test program." >&4
11945                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11946         fi
11947         ;;
11948 esac
11949
11950 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11951
11952 set d_dlsymun
11953 eval $setvar
11954
11955 : see if drand48_r exists
11956 set drand48_r d_drand48_r
11957 eval $inlibc
11958 case "$d_drand48_r" in
11959 "$define")
11960         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11961         case "$d_drand48_r_proto:$usethreads" in
11962         ":define")      d_drand48_r_proto=define
11963                 set d_drand48_r_proto drand48_r $hdrs
11964                 eval $hasproto ;;
11965         *)      ;;
11966         esac
11967         case "$d_drand48_r_proto" in
11968         define)
11969         case "$drand48_r_proto" in
11970         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11971         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11972         esac
11973         case "$drand48_r_proto" in
11974         ''|0)   d_drand48_r=undef
11975                 drand48_r_proto=0
11976                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11977         * )     case "$drand48_r_proto" in
11978                 REENTRANT_PROTO*) ;;
11979                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11980                 esac
11981                 echo "Prototype: $try" ;;
11982         esac
11983         ;;
11984         *)      case "$usethreads" in
11985                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11986                 esac
11987                 d_drand48_r=undef
11988                 drand48_r_proto=0
11989                 ;;
11990         esac
11991         ;;
11992 *)      drand48_r_proto=0
11993         ;;
11994 esac
11995
11996 : see if prototype for drand48 is available
11997 echo " "
11998 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11999 eval $hasproto
12000
12001 : see if dup2 exists
12002 set dup2 d_dup2
12003 eval $inlibc
12004
12005 : see if eaccess exists
12006 set eaccess d_eaccess
12007 eval $inlibc
12008
12009 : see if endgrent exists
12010 set endgrent d_endgrent
12011 eval $inlibc
12012
12013 : see if this is an grp system
12014 set grp.h i_grp
12015 eval $inhdr
12016
12017 case "$i_grp" in
12018 $define)
12019         xxx=`./findhdr grp.h`
12020         $cppstdin $cppflags $cppminus < $xxx >$$.h
12021
12022         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12023                 val="$define"
12024         else
12025                 val="$undef"
12026         fi
12027         set d_grpasswd
12028         eval $setvar
12029
12030         $rm -f $$.h
12031         ;;
12032 *)
12033         val="$undef";
12034         set d_grpasswd; eval $setvar
12035         ;;
12036 esac
12037
12038 : see if endgrent_r exists
12039 set endgrent_r d_endgrent_r
12040 eval $inlibc
12041 case "$d_endgrent_r" in
12042 "$define")
12043         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12044         case "$d_endgrent_r_proto:$usethreads" in
12045         ":define")      d_endgrent_r_proto=define
12046                 set d_endgrent_r_proto endgrent_r $hdrs
12047                 eval $hasproto ;;
12048         *)      ;;
12049         esac
12050         case "$d_endgrent_r_proto" in
12051         define)
12052         case "$endgrent_r_proto" in
12053         ''|0) try='int endgrent_r(FILE**);'
12054         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12055         esac
12056         case "$endgrent_r_proto" in
12057         ''|0) try='void endgrent_r(FILE**);'
12058         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12059         esac
12060         case "$endgrent_r_proto" in
12061         ''|0)   d_endgrent_r=undef
12062                 endgrent_r_proto=0
12063                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12064         * )     case "$endgrent_r_proto" in
12065                 REENTRANT_PROTO*) ;;
12066                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12067                 esac
12068                 echo "Prototype: $try" ;;
12069         esac
12070         ;;
12071         *)      case "$usethreads" in
12072                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12073                 esac
12074                 d_endgrent_r=undef
12075                 endgrent_r_proto=0
12076                 ;;
12077         esac
12078         ;;
12079 *)      endgrent_r_proto=0
12080         ;;
12081 esac
12082
12083 : see if endhostent exists
12084 set endhostent d_endhent
12085 eval $inlibc
12086
12087 : see if this is a netdb.h system
12088 set netdb.h i_netdb
12089 eval $inhdr
12090
12091 : see if endhostent_r exists
12092 set endhostent_r d_endhostent_r
12093 eval $inlibc
12094 case "$d_endhostent_r" in
12095 "$define")
12096         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12097         case "$d_endhostent_r_proto:$usethreads" in
12098         ":define")      d_endhostent_r_proto=define
12099                 set d_endhostent_r_proto endhostent_r $hdrs
12100                 eval $hasproto ;;
12101         *)      ;;
12102         esac
12103         case "$d_endhostent_r_proto" in
12104         define)
12105         case "$endhostent_r_proto" in
12106         ''|0) try='int endhostent_r(struct hostent_data*);'
12107         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12108         esac
12109         case "$endhostent_r_proto" in
12110         ''|0) try='void endhostent_r(struct hostent_data*);'
12111         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12112         esac
12113         case "$endhostent_r_proto" in
12114         ''|0)   d_endhostent_r=undef
12115                 endhostent_r_proto=0
12116                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12117         * )     case "$endhostent_r_proto" in
12118                 REENTRANT_PROTO*) ;;
12119                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12120                 esac
12121                 echo "Prototype: $try" ;;
12122         esac
12123         ;;
12124         *)      case "$usethreads" in
12125                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12126                 esac
12127                 d_endhostent_r=undef
12128                 endhostent_r_proto=0
12129                 ;;
12130         esac
12131         ;;
12132 *)      endhostent_r_proto=0
12133         ;;
12134 esac
12135
12136 : see if endnetent exists
12137 set endnetent d_endnent
12138 eval $inlibc
12139
12140 : see if endnetent_r exists
12141 set endnetent_r d_endnetent_r
12142 eval $inlibc
12143 case "$d_endnetent_r" in
12144 "$define")
12145         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12146         case "$d_endnetent_r_proto:$usethreads" in
12147         ":define")      d_endnetent_r_proto=define
12148                 set d_endnetent_r_proto endnetent_r $hdrs
12149                 eval $hasproto ;;
12150         *)      ;;
12151         esac
12152         case "$d_endnetent_r_proto" in
12153         define)
12154         case "$endnetent_r_proto" in
12155         ''|0) try='int endnetent_r(struct netent_data*);'
12156         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12157         esac
12158         case "$endnetent_r_proto" in
12159         ''|0) try='void endnetent_r(struct netent_data*);'
12160         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12161         esac
12162         case "$endnetent_r_proto" in
12163         ''|0)   d_endnetent_r=undef
12164                 endnetent_r_proto=0
12165                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12166         * )     case "$endnetent_r_proto" in
12167                 REENTRANT_PROTO*) ;;
12168                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12169                 esac
12170                 echo "Prototype: $try" ;;
12171         esac
12172         ;;
12173         *)      case "$usethreads" in
12174                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12175                 esac
12176                 d_endnetent_r=undef
12177                 endnetent_r_proto=0
12178                 ;;
12179         esac
12180         ;;
12181 *)      endnetent_r_proto=0
12182         ;;
12183 esac
12184
12185 : see if endprotoent exists
12186 set endprotoent d_endpent
12187 eval $inlibc
12188
12189 : see if endprotoent_r exists
12190 set endprotoent_r d_endprotoent_r
12191 eval $inlibc
12192 case "$d_endprotoent_r" in
12193 "$define")
12194         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12195         case "$d_endprotoent_r_proto:$usethreads" in
12196         ":define")      d_endprotoent_r_proto=define
12197                 set d_endprotoent_r_proto endprotoent_r $hdrs
12198                 eval $hasproto ;;
12199         *)      ;;
12200         esac
12201         case "$d_endprotoent_r_proto" in
12202         define)
12203         case "$endprotoent_r_proto" in
12204         ''|0) try='int endprotoent_r(struct protoent_data*);'
12205         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12206         esac
12207         case "$endprotoent_r_proto" in
12208         ''|0) try='void endprotoent_r(struct protoent_data*);'
12209         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12210         esac
12211         case "$endprotoent_r_proto" in
12212         ''|0)   d_endprotoent_r=undef
12213                 endprotoent_r_proto=0
12214                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12215         * )     case "$endprotoent_r_proto" in
12216                 REENTRANT_PROTO*) ;;
12217                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12218                 esac
12219                 echo "Prototype: $try" ;;
12220         esac
12221         ;;
12222         *)      case "$usethreads" in
12223                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12224                 esac
12225                 d_endprotoent_r=undef
12226                 endprotoent_r_proto=0
12227                 ;;
12228         esac
12229         ;;
12230 *)      endprotoent_r_proto=0
12231         ;;
12232 esac
12233
12234 : see if endpwent exists
12235 set endpwent d_endpwent
12236 eval $inlibc
12237
12238 : see if this is a pwd.h system
12239 set pwd.h i_pwd
12240 eval $inhdr
12241
12242 case "$i_pwd" in
12243 $define)
12244         xxx=`./findhdr pwd.h`
12245         $cppstdin $cppflags $cppminus < $xxx >$$.h
12246
12247         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12248                 val="$define"
12249         else
12250                 val="$undef"
12251         fi
12252         set d_pwquota
12253         eval $setvar
12254
12255         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12256                 val="$define"
12257         else
12258                 val="$undef"
12259         fi
12260         set d_pwage
12261         eval $setvar
12262
12263         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12264                 val="$define"
12265         else
12266                 val="$undef"
12267         fi
12268         set d_pwchange
12269         eval $setvar
12270
12271         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12272                 val="$define"
12273         else
12274                 val="$undef"
12275         fi
12276         set d_pwclass
12277         eval $setvar
12278
12279         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12280                 val="$define"
12281         else
12282                 val="$undef"
12283         fi
12284         set d_pwexpire
12285         eval $setvar
12286
12287         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12288                 val="$define"
12289         else
12290                 val="$undef"
12291         fi
12292         set d_pwcomment
12293         eval $setvar
12294
12295         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12296                 val="$define"
12297         else
12298                 val="$undef"
12299         fi
12300         set d_pwgecos
12301         eval $setvar
12302
12303         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12304                 val="$define"
12305         else
12306                 val="$undef"
12307         fi
12308         set d_pwpasswd
12309         eval $setvar
12310
12311         $rm -f $$.h
12312         ;;
12313 *)
12314         val="$undef"; 
12315         set d_pwquota; eval $setvar
12316         set d_pwage; eval $setvar
12317         set d_pwchange; eval $setvar
12318         set d_pwclass; eval $setvar
12319         set d_pwexpire; eval $setvar
12320         set d_pwcomment; eval $setvar
12321         set d_pwgecos; eval $setvar
12322         set d_pwpasswd; eval $setvar
12323         ;;
12324 esac
12325
12326 : see if endpwent_r exists
12327 set endpwent_r d_endpwent_r
12328 eval $inlibc
12329 case "$d_endpwent_r" in
12330 "$define")
12331         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12332         case "$d_endpwent_r_proto:$usethreads" in
12333         ":define")      d_endpwent_r_proto=define
12334                 set d_endpwent_r_proto endpwent_r $hdrs
12335                 eval $hasproto ;;
12336         *)      ;;
12337         esac
12338         case "$d_endpwent_r_proto" in
12339         define)
12340         case "$endpwent_r_proto" in
12341         ''|0) try='int endpwent_r(FILE**);'
12342         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12343         esac
12344         case "$endpwent_r_proto" in
12345         ''|0) try='void endpwent_r(FILE**);'
12346         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12347         esac
12348         case "$endpwent_r_proto" in
12349         ''|0)   d_endpwent_r=undef
12350                 endpwent_r_proto=0
12351                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12352         * )     case "$endpwent_r_proto" in
12353                 REENTRANT_PROTO*) ;;
12354                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12355                 esac
12356                 echo "Prototype: $try" ;;
12357         esac
12358         ;;
12359         *)      case "$usethreads" in
12360                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12361                 esac
12362                 d_endpwent_r=undef
12363                 endpwent_r_proto=0
12364                 ;;
12365         esac
12366         ;;
12367 *)      endpwent_r_proto=0
12368         ;;
12369 esac
12370
12371 : see if endservent exists
12372 set endservent d_endsent
12373 eval $inlibc
12374
12375 : see if endservent_r exists
12376 set endservent_r d_endservent_r
12377 eval $inlibc
12378 case "$d_endservent_r" in
12379 "$define")
12380         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12381         case "$d_endservent_r_proto:$usethreads" in
12382         ":define")      d_endservent_r_proto=define
12383                 set d_endservent_r_proto endservent_r $hdrs
12384                 eval $hasproto ;;
12385         *)      ;;
12386         esac
12387         case "$d_endservent_r_proto" in
12388         define)
12389         case "$endservent_r_proto" in
12390         ''|0) try='int endservent_r(struct servent_data*);'
12391         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12392         esac
12393         case "$endservent_r_proto" in
12394         ''|0) try='void endservent_r(struct servent_data*);'
12395         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12396         esac
12397         case "$endservent_r_proto" in
12398         ''|0)   d_endservent_r=undef
12399                 endservent_r_proto=0
12400                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12401         * )     case "$endservent_r_proto" in
12402                 REENTRANT_PROTO*) ;;
12403                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12404                 esac
12405                 echo "Prototype: $try" ;;
12406         esac
12407         ;;
12408         *)      case "$usethreads" in
12409                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12410                 esac
12411                 d_endservent_r=undef
12412                 endservent_r_proto=0
12413                 ;;
12414         esac
12415         ;;
12416 *)      endservent_r_proto=0
12417         ;;
12418 esac
12419
12420 : Locate the flags for 'open()'
12421 echo " "
12422 $cat >try.c <<EOCP
12423 #include <sys/types.h>
12424 #ifdef I_FCNTL
12425 #include <fcntl.h>
12426 #endif
12427 #ifdef I_SYS_FILE
12428 #include <sys/file.h>
12429 #endif
12430 #$i_stdlib I_STDLIB
12431 #ifdef I_STDLIB
12432 #include <stdlib.h>
12433 #endif
12434 int main() {
12435         if(O_RDONLY);
12436 #ifdef O_TRUNC
12437         exit(0);
12438 #else
12439         exit(1);
12440 #endif
12441 }
12442 EOCP
12443 : check sys/file.h first to get FREAD on Sun
12444 if $test `./findhdr sys/file.h` && \
12445                 set try -DI_SYS_FILE && eval $compile; then
12446         h_sysfile=true;
12447         echo "<sys/file.h> defines the O_* constants..." >&4
12448         if $run ./try; then
12449                 echo "and you have the 3 argument form of open()." >&4
12450                 val="$define"
12451         else
12452                 echo "but not the 3 argument form of open().  Oh, well." >&4
12453                 val="$undef"
12454         fi
12455 elif $test `./findhdr fcntl.h` && \
12456                 set try -DI_FCNTL && eval $compile; then
12457         h_fcntl=true;
12458         echo "<fcntl.h> defines the O_* constants..." >&4
12459         if $run ./try; then
12460                 echo "and you have the 3 argument form of open()." >&4
12461                 val="$define"
12462         else
12463                 echo "but not the 3 argument form of open().  Oh, well." >&4
12464                 val="$undef"
12465         fi
12466 else
12467         val="$undef"
12468         echo "I can't find the O_* constant definitions!  You got problems." >&4
12469 fi
12470 set d_open3
12471 eval $setvar
12472 $rm_try
12473
12474 : see if this is a sys/file.h system
12475 val=''
12476 set sys/file.h val
12477 eval $inhdr
12478
12479 : do we need to include sys/file.h ?
12480 case "$val" in
12481 "$define")
12482         echo " "
12483         if $h_sysfile; then
12484                 val="$define"
12485                 echo "We'll be including <sys/file.h>." >&4
12486         else
12487                 val="$undef"
12488                 echo "We won't be including <sys/file.h>." >&4
12489         fi
12490         ;;
12491 *)
12492         h_sysfile=false
12493         ;;
12494 esac
12495 set i_sysfile
12496 eval $setvar
12497
12498 : see if fcntl.h is there
12499 val=''
12500 set fcntl.h val
12501 eval $inhdr
12502
12503 : see if we can include fcntl.h
12504 case "$val" in
12505 "$define")
12506         echo " "
12507         if $h_fcntl; then
12508                 val="$define"
12509                 echo "We'll be including <fcntl.h>." >&4
12510         else
12511                 val="$undef"
12512                 if $h_sysfile; then
12513         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12514                 else
12515                         echo "We won't be including <fcntl.h>." >&4
12516                 fi
12517         fi
12518         ;;
12519 *)
12520         h_fcntl=false
12521         val="$undef"
12522         ;;
12523 esac
12524 set i_fcntl
12525 eval $setvar
12526
12527 : see if fork exists
12528 set fork d_fork
12529 eval $inlibc
12530
12531 : see if pipe exists
12532 set pipe d_pipe
12533 eval $inlibc
12534
12535 : check for non-blocking I/O stuff
12536 case "$h_sysfile" in
12537 true) echo "#include <sys/file.h>" > head.c;;
12538 *)
12539        case "$h_fcntl" in
12540        true) echo "#include <fcntl.h>" > head.c;;
12541        *) echo "#include <sys/fcntl.h>" > head.c;;
12542        esac
12543        ;;
12544 esac
12545 echo " "
12546 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12547 case "$o_nonblock" in
12548 '')
12549         $cat head.c > try.c
12550         $cat >>try.c <<EOCP
12551 #include <stdio.h>
12552 #$i_stdlib I_STDLIB
12553 #ifdef I_STDLIB
12554 #include <stdlib.h>
12555 #endif
12556 #$i_fcntl I_FCNTL
12557 #ifdef I_FCNTL
12558 #include <fcntl.h>
12559 #endif
12560 int main() {
12561 #ifdef O_NONBLOCK
12562         printf("O_NONBLOCK\n");
12563         exit(0);
12564 #endif
12565 #ifdef O_NDELAY
12566         printf("O_NDELAY\n");
12567         exit(0);
12568 #endif
12569 #ifdef FNDELAY
12570         printf("FNDELAY\n");
12571         exit(0);
12572 #endif
12573         exit(0);
12574 }
12575 EOCP
12576         set try
12577         if eval $compile_ok; then
12578                 o_nonblock=`$run ./try`
12579                 case "$o_nonblock" in
12580                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12581                 *) echo "Seems like we can use $o_nonblock.";;
12582                 esac
12583         else
12584                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12585         fi
12586         ;;
12587 *) echo "Using $hint value $o_nonblock.";;
12588 esac
12589 $rm_try
12590
12591 echo " "
12592 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12593 case "$eagain" in
12594 '')
12595         case "$d_fork:$d_pipe" in
12596         define:define)
12597         $cat head.c > try.c
12598         $cat >>try.c <<EOCP
12599 #include <errno.h>
12600 #include <sys/types.h>
12601 #include <signal.h>
12602 #include <stdio.h>
12603 #$i_stdlib I_STDLIB
12604 #ifdef I_STDLIB
12605 #include <stdlib.h>
12606 #endif
12607 #$i_fcntl I_FCNTL
12608 #ifdef I_FCNTL
12609 #include <fcntl.h>
12610 #endif
12611 #define MY_O_NONBLOCK $o_nonblock
12612 #ifndef errno  /* XXX need better Configure test */
12613 extern int errno;
12614 #endif
12615 #$i_unistd I_UNISTD
12616 #ifdef I_UNISTD
12617 #include <unistd.h>
12618 #endif
12619 #$i_string I_STRING
12620 #ifdef I_STRING
12621 #include <string.h>
12622 #else
12623 #include <strings.h>
12624 #endif
12625 $signal_t blech(int x) { exit(3); }
12626 EOCP
12627         $cat >> try.c <<'EOCP'
12628 int main()
12629 {
12630         int pd[2];
12631         int pu[2];
12632         char buf[1];
12633         char string[100];
12634
12635         pipe(pd);       /* Down: child -> parent */
12636         pipe(pu);       /* Up: parent -> child */
12637         if (0 != fork()) {
12638                 int ret;
12639                 close(pd[1]);   /* Parent reads from pd[0] */
12640                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12641 #ifdef F_SETFL
12642                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12643                         exit(1);
12644 #else
12645                 exit(4);
12646 #endif
12647                 signal(SIGALRM, blech);
12648                 alarm(5);
12649                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12650                         exit(2);
12651                 sprintf(string, "%d\n", ret);
12652                 write(2, string, strlen(string));
12653                 alarm(0);
12654 #ifdef EAGAIN
12655                 if (errno == EAGAIN) {
12656                         printf("EAGAIN\n");
12657                         goto ok;
12658                 }
12659 #endif
12660 #ifdef EWOULDBLOCK
12661                 if (errno == EWOULDBLOCK)
12662                         printf("EWOULDBLOCK\n");
12663 #endif
12664         ok:
12665                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12666                 sleep(2);                               /* Give it time to close our pipe */
12667                 alarm(5);
12668                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12669                 alarm(0);
12670                 sprintf(string, "%d\n", ret);
12671                 write(4, string, strlen(string));
12672                 exit(0);
12673         }
12674
12675         close(pd[0]);                   /* We write to pd[1] */
12676         close(pu[1]);                   /* We read from pu[0] */
12677         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12678         close(pd[1]);                   /* Pipe pd is now fully closed! */
12679         exit(0);                                /* Bye bye, thank you for playing! */
12680 }
12681 EOCP
12682         set try
12683         if eval $compile_ok; then
12684                 echo "$startsh" >mtry
12685                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12686                 chmod +x mtry
12687                 ./mtry >/dev/null 2>&1
12688                 case $? in
12689                 0) eagain=`$cat try.out`;;
12690                 1) echo "Could not perform non-blocking setting!";;
12691                 2) echo "I did a successful read() for something that was not there!";;
12692                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12693                 4) echo "Could not find F_SETFL!";;
12694                 *) echo "Something terribly wrong happened during testing.";;
12695                 esac
12696                 rd_nodata=`$cat try.ret`
12697                 echo "A read() system call with no data present returns $rd_nodata."
12698                 case "$rd_nodata" in
12699                 0|-1) ;;
12700                 *)
12701                         echo "(That's peculiar, fixing that to be -1.)"
12702                         rd_nodata=-1
12703                         ;;
12704                 esac
12705                 case "$eagain" in
12706                 '')
12707                         echo "Forcing errno EAGAIN on read() with no data available."
12708                         eagain=EAGAIN
12709                         ;;
12710                 *)
12711                         echo "Your read() sets errno to $eagain when no data is available."
12712                         ;;
12713                 esac
12714                 status=`$cat try.err`
12715                 case "$status" in
12716                 0) echo "And it correctly returns 0 to signal EOF.";;
12717                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12718                 *) echo "However, your read() returns '$status' on EOF??";;
12719                 esac
12720                 val="$define"
12721                 if test "$status" = "$rd_nodata"; then
12722                         echo "WARNING: you can't distinguish between EOF and no data!"
12723                         val="$undef"
12724                 fi
12725         else
12726                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12727                 eagain=EAGAIN
12728         fi
12729         ;;
12730         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12731                 eagain=EAGAIN
12732                 val="$define"
12733                 ;;
12734         esac
12735         set d_eofnblk
12736         eval $setvar
12737         ;;
12738 *)
12739         echo "Using $hint value $eagain."
12740         echo "Your read() returns $rd_nodata when no data is present."
12741         case "$d_eofnblk" in
12742         "$define") echo "And you can see EOF because read() returns 0.";;
12743         "$undef") echo "But you can't see EOF status from read() returned value.";;
12744         *)
12745                 echo "(Assuming you can't see EOF status from read anyway.)"
12746                 d_eofnblk=$undef
12747                 ;;
12748         esac
12749         ;;
12750 esac
12751 $rm_try head.c mtry
12752
12753 : see if _ptr and _cnt from stdio act std
12754 echo " "
12755
12756 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12757         echo "(Looks like you have stdio.h from BSD.)"
12758         case "$stdio_ptr" in
12759         '') stdio_ptr='((fp)->_p)'
12760                 ptr_lval=$define
12761                 ;;
12762         *)      ptr_lval=$d_stdio_ptr_lval;;
12763         esac
12764         case "$stdio_cnt" in
12765         '') stdio_cnt='((fp)->_r)'
12766                 cnt_lval=$define
12767                 ;;
12768         *)      cnt_lval=$d_stdio_cnt_lval;;
12769         esac
12770         case "$stdio_base" in
12771         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12772         esac
12773         case "$stdio_bufsiz" in
12774         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12775         esac
12776 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12777         echo "(Looks like you have stdio.h from Linux.)"
12778         case "$stdio_ptr" in
12779         '') stdio_ptr='((fp)->_IO_read_ptr)'
12780                 ptr_lval=$define
12781                 ;;
12782         *)      ptr_lval=$d_stdio_ptr_lval;;
12783         esac
12784         case "$stdio_cnt" in
12785         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12786                 cnt_lval=$undef
12787                 ;;
12788         *)      cnt_lval=$d_stdio_cnt_lval;;
12789         esac
12790         case "$stdio_base" in
12791         '') stdio_base='((fp)->_IO_read_base)';;
12792         esac
12793         case "$stdio_bufsiz" in
12794         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12795         esac
12796 else
12797         case "$stdio_ptr" in
12798         '') stdio_ptr='((fp)->_ptr)'
12799                 ptr_lval=$define
12800                 ;;
12801         *)      ptr_lval=$d_stdio_ptr_lval;;
12802         esac
12803         case "$stdio_cnt" in
12804         '') stdio_cnt='((fp)->_cnt)'
12805                 cnt_lval=$define
12806                 ;;
12807         *)      cnt_lval=$d_stdio_cnt_lval;;
12808         esac
12809         case "$stdio_base" in
12810         '') stdio_base='((fp)->_base)';;
12811         esac
12812         case "$stdio_bufsiz" in
12813         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12814         esac
12815 fi
12816
12817 : test whether _ptr and _cnt really work
12818 echo "Checking how std your stdio is..." >&4
12819 $cat >try.c <<EOP
12820 #include <stdio.h>
12821 #$i_stdlib I_STDLIB
12822 #ifdef I_STDLIB
12823 #include <stdlib.h>
12824 #endif
12825 #define FILE_ptr(fp)    $stdio_ptr
12826 #define FILE_cnt(fp)    $stdio_cnt
12827 int main() {
12828         FILE *fp = fopen("try.c", "r");
12829         char c = getc(fp);
12830         if (
12831                 18 <= FILE_cnt(fp) &&
12832                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12833         )
12834                 exit(0);
12835         exit(1);
12836 }
12837 EOP
12838 val="$undef"
12839 set try
12840 if eval $compile && $to try.c; then
12841         if $run ./try; then
12842                 echo "Your stdio acts pretty std."
12843                 val="$define"
12844         else
12845                 echo "Your stdio isn't very std."
12846         fi
12847 else
12848         echo "Your stdio doesn't appear very std."
12849 fi
12850 $rm_try
12851
12852 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12853 # direct buffer manipulation no longer works.  The Configure tests
12854 # should be changed to correctly detect this, but until then,
12855 # the following check should at least let perl compile and run.
12856 # (This quick fix should be updated before 5.8.1.)
12857 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12858 # A. Dougherty, June 3, 2002.
12859 case "$d_gnulibc" in
12860 $define)
12861         case "$gnulibc_version" in
12862         2.[01]*)  ;;
12863         2.2) ;;
12864         2.2.[0-9]) ;;
12865         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12866                 val="$undef"
12867                 ;;
12868         esac
12869         ;;
12870 esac
12871 set d_stdstdio
12872 eval $setvar
12873
12874 : Can _ptr be used as an lvalue?
12875 case "$d_stdstdio$ptr_lval" in
12876 $define$define) val=$define ;;
12877 *) val=$undef ;;
12878 esac
12879 set d_stdio_ptr_lval
12880 eval $setvar
12881
12882 : Can _cnt be used as an lvalue?
12883 case "$d_stdstdio$cnt_lval" in
12884 $define$define) val=$define ;;
12885 *) val=$undef ;;
12886 esac
12887 set d_stdio_cnt_lval
12888 eval $setvar
12889
12890
12891 : test whether setting _ptr sets _cnt as a side effect
12892 d_stdio_ptr_lval_sets_cnt="$undef"
12893 d_stdio_ptr_lval_nochange_cnt="$undef"
12894 case "$d_stdio_ptr_lval$d_stdstdio" in
12895 $define$define)
12896         echo "Checking to see what happens if we set the stdio ptr..." >&4
12897 $cat >try.c <<EOP
12898 #include <stdio.h>
12899 /* Can we scream? */
12900 /* Eat dust sed :-) */
12901 /* In the buffer space, no one can hear you scream. */
12902 #$i_stdlib I_STDLIB
12903 #ifdef I_STDLIB
12904 #include <stdlib.h>
12905 #endif
12906 #define FILE_ptr(fp)    $stdio_ptr
12907 #define FILE_cnt(fp)    $stdio_cnt
12908 #include <sys/types.h>
12909 int main() {
12910         FILE *fp = fopen("try.c", "r");
12911         int c;
12912         char *ptr;
12913         size_t cnt;
12914         if (!fp) {
12915             puts("Fail even to read");
12916             exit(1);
12917         }
12918         c = getc(fp); /* Read away the first # */
12919         if (c == EOF) {
12920             puts("Fail even to read");
12921             exit(1);
12922         }
12923         if (!(
12924                 18 <= FILE_cnt(fp) &&
12925                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12926         )) {
12927                 puts("Fail even to read");
12928                 exit (1);
12929         }
12930         ptr = (char*) FILE_ptr(fp);
12931         cnt = (size_t)FILE_cnt(fp);
12932
12933         FILE_ptr(fp) += 42;
12934
12935         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12936                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12937                 exit (1);
12938         }
12939         if (FILE_cnt(fp) <= 20) {
12940                 printf ("Fail (<20 chars to test)");
12941                 exit (1);
12942         }
12943         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12944                 puts("Fail compare");
12945                 exit (1);
12946         }
12947         if (cnt == FILE_cnt(fp)) {
12948                 puts("Pass_unchanged");
12949                 exit (0);
12950         }
12951         if (FILE_cnt(fp) == (cnt - 42)) {
12952                 puts("Pass_changed");
12953                 exit (0);
12954         }
12955         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12956         return 1;
12957
12958 }
12959 EOP
12960         set try
12961         if eval $compile && $to try.c; then
12962                 case `$run ./try` in
12963                 Pass_changed)
12964                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12965                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12966                 Pass_unchanged)
12967                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12968                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12969                 Fail*)
12970                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12971                 *)
12972                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12973         esac
12974         else
12975                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12976         fi
12977         $rm_try
12978         ;;
12979 esac
12980
12981 : see if _base is also standard
12982 val="$undef"
12983 case "$d_stdstdio" in
12984 $define)
12985         $cat >try.c <<EOP
12986 #include <stdio.h>
12987 #$i_stdlib I_STDLIB
12988 #ifdef I_STDLIB
12989 #include <stdlib.h>
12990 #endif
12991 #define FILE_base(fp)   $stdio_base
12992 #define FILE_bufsiz(fp) $stdio_bufsiz
12993 int main() {
12994         FILE *fp = fopen("try.c", "r");
12995         char c = getc(fp);
12996         if (
12997                 19 <= FILE_bufsiz(fp) &&
12998                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12999         )
13000                 exit(0);
13001         exit(1);
13002 }
13003 EOP
13004         set try
13005         if eval $compile && $to try.c; then
13006                 if $run ./try; then
13007                         echo "And its _base field acts std."
13008                         val="$define"
13009                 else
13010                         echo "But its _base field isn't std."
13011                 fi
13012         else
13013                 echo "However, it seems to be lacking the _base field."
13014         fi
13015         $rm_try
13016         ;;
13017 esac
13018 set d_stdiobase
13019 eval $setvar
13020
13021 : see if fast_stdio exists
13022 val="$undef"
13023 case "$d_stdstdio:$d_stdio_ptr_lval" in
13024 "$define:$define")
13025         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13026         *$define*)
13027                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13028                 val="$define"
13029                 ;;
13030         esac
13031         ;;
13032 esac
13033 set d_faststdio
13034 eval $setvar
13035
13036
13037
13038 : see if fchdir exists
13039 set fchdir d_fchdir
13040 eval $inlibc
13041
13042 : see if fchmod exists
13043 set fchmod d_fchmod
13044 eval $inlibc
13045
13046 : see if fchown exists
13047 set fchown d_fchown
13048 eval $inlibc
13049
13050 : see if this is an fcntl system
13051 set fcntl d_fcntl
13052 eval $inlibc
13053
13054 : See if fcntl-based locking works.
13055 echo " "
13056 $cat >try.c <<EOCP
13057 #$i_stdlib I_STDLIB
13058 #ifdef I_STDLIB
13059 #include <stdlib.h>
13060 #endif
13061 #include <unistd.h>
13062 #include <fcntl.h>
13063 #include <signal.h>
13064 $signal_t blech(int x) { exit(3); }
13065 int main() {
13066 #if defined(F_SETLK) && defined(F_SETLKW)
13067      struct flock flock;
13068      int retval, fd;
13069      fd = open("try.c", O_RDONLY);
13070      flock.l_type = F_RDLCK;
13071      flock.l_whence = SEEK_SET;
13072      flock.l_start = flock.l_len = 0;
13073      signal(SIGALRM, blech);
13074      alarm(10);
13075      retval = fcntl(fd, F_SETLK, &flock);
13076      close(fd);
13077      (retval < 0 ? exit(2) : exit(0));
13078 #else
13079      exit(2);
13080 #endif
13081 }
13082 EOCP
13083 echo "Checking if fcntl-based file locking works... "
13084 case "$d_fcntl" in
13085 "$define")
13086         set try
13087         if eval $compile_ok; then
13088                 if $run ./try; then
13089                         echo "Yes, it seems to work."
13090                         val="$define"
13091                 else
13092                         echo "Nope, it didn't work."
13093                         val="$undef"
13094                         case "$?" in
13095                         3) $cat >&4 <<EOM
13096 ***
13097 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13098 *** This is (almost) impossible.
13099 *** If your NFS lock daemons are not feeling well, something like
13100 *** this may happen, please investigate.  Cannot continue, aborting.
13101 ***
13102 EOM
13103                                 exit 1
13104                                 ;;
13105                         esac
13106                 fi
13107         else
13108                 echo "I'm unable to compile the test program, so I'll assume not."
13109                 val="$undef"
13110         fi
13111         ;;
13112 *) val="$undef";
13113         echo "Nope, since you don't even have fcntl()."
13114         ;;
13115 esac
13116 set d_fcntl_can_lock
13117 eval $setvar
13118 $rm_try
13119
13120 : check for fd_set items
13121 $cat <<EOM
13122
13123 Checking to see how well your C compiler handles fd_set and friends ...
13124 EOM
13125 $cat >try.c <<EOCP
13126 #$i_stdlib I_STDLIB
13127 #ifdef I_STDLIB
13128 #include <stdlib.h>
13129 #endif
13130 #$i_systime I_SYS_TIME
13131 #$i_sysselct I_SYS_SELECT
13132 #$d_socket HAS_SOCKET
13133 #include <sys/types.h>
13134 #ifdef HAS_SOCKET
13135 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13136 #endif
13137 #ifdef I_SYS_TIME
13138 #include <sys/time.h>
13139 #endif
13140 #ifdef I_SYS_SELECT
13141 #include <sys/select.h>
13142 #endif
13143 int main() {
13144         fd_set fds;
13145
13146 #ifdef TRYBITS
13147         if(fds.fds_bits);
13148 #endif
13149
13150 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13151         exit(0);
13152 #else
13153         exit(1);
13154 #endif
13155 }
13156 EOCP
13157 set try -DTRYBITS
13158 if eval $compile; then
13159         d_fds_bits="$define"
13160         d_fd_set="$define"
13161         echo "Well, your system knows about the normal fd_set typedef..." >&4
13162         if $run ./try; then
13163                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13164                 d_fd_macros="$define"
13165         else
13166                 $cat >&4 <<'EOM'
13167 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13168 EOM
13169                 d_fd_macros="$undef"
13170         fi
13171 else
13172         $cat <<'EOM'
13173 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13174 EOM
13175         set try
13176         if eval $compile; then
13177                 d_fds_bits="$undef"
13178                 d_fd_set="$define"
13179                 echo "Well, your system has some sort of fd_set available..." >&4
13180                 if $run ./try; then
13181                         echo "and you have the normal fd_set macros." >&4
13182                         d_fd_macros="$define"
13183                 else
13184                         $cat <<'EOM'
13185 but not the normal fd_set macros!  Gross!  More work for me...
13186 EOM
13187                         d_fd_macros="$undef"
13188                 fi
13189         else
13190         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13191                 d_fd_set="$undef"
13192                 d_fds_bits="$undef"
13193                 d_fd_macros="$undef"
13194         fi
13195 fi
13196 $rm_try
13197
13198 : see if fgetpos exists
13199 set fgetpos d_fgetpos
13200 eval $inlibc
13201
13202 : see if finite exists
13203 set finite d_finite
13204 eval $inlibc
13205
13206 : see if finitel exists
13207 set finitel d_finitel
13208 eval $inlibc
13209
13210 : see if flock exists
13211 set flock d_flock
13212 eval $inlibc
13213
13214 : see if prototype for flock is available
13215 echo " "
13216 set d_flockproto flock $i_sysfile sys/file.h
13217 eval $hasproto
13218
13219 : see if fp_class exists
13220 set fp_class d_fp_class
13221 eval $inlibc
13222
13223 : see if pathconf exists
13224 set pathconf d_pathconf
13225 eval $inlibc
13226
13227 : see if fpathconf exists
13228 set fpathconf d_fpathconf
13229 eval $inlibc
13230
13231 : see if fpclass exists
13232 set fpclass d_fpclass
13233 eval $inlibc
13234
13235 : see if fpclassify exists
13236 set fpclassify d_fpclassify
13237 eval $inlibc
13238
13239 : see if fpclassl exists
13240 set fpclassl d_fpclassl
13241 eval $inlibc
13242
13243 : check for fpos64_t
13244 echo " "
13245 echo "Checking to see if you have fpos64_t..." >&4
13246 $cat >try.c <<EOCP
13247 #include <stdio.h>
13248 int main() { fpos64_t x = 7; }
13249 EOCP
13250 set try
13251 if eval $compile; then
13252         val="$define"
13253         echo "You have fpos64_t."
13254 else
13255         val="$undef"
13256         echo "You do not have fpos64_t."
13257         case "$fpossize" in
13258         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13259         esac
13260 fi
13261 $rm_try
13262 set d_fpos64_t
13263 eval $setvar
13264
13265 : see if frexpl exists
13266 set frexpl d_frexpl
13267 eval $inlibc
13268
13269 : see if this is a sys/param system
13270 set sys/param.h i_sysparam
13271 eval $inhdr
13272
13273 : see if this is a sys/mount.h system
13274 set sys/mount.h i_sysmount
13275 eval $inhdr
13276
13277 : Check for fs_data_s
13278 echo " "
13279 echo "Checking to see if your system supports struct fs_data..." >&4
13280 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13281 eval $hasstruct
13282 case "$d_fs_data_s" in
13283 "$define")      echo "Yes, it does."   ;;
13284 *)              echo "No, it doesn't." ;;
13285 esac
13286
13287 : see if fseeko exists
13288 set fseeko d_fseeko
13289 eval $inlibc
13290 case "$longsize" in
13291 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13292 esac
13293
13294 : see if fsetpos exists
13295 set fsetpos d_fsetpos
13296 eval $inlibc
13297
13298 : see if fstatfs exists
13299 set fstatfs d_fstatfs
13300 eval $inlibc
13301
13302 : see if statvfs exists
13303 set statvfs d_statvfs
13304 eval $inlibc
13305
13306 : see if fstatvfs exists
13307 set fstatvfs d_fstatvfs
13308 eval $inlibc
13309
13310
13311 : see if fsync exists
13312 set fsync d_fsync
13313 eval $inlibc
13314
13315 : see if ftello exists
13316 set ftello d_ftello
13317 eval $inlibc
13318 case "$longsize" in
13319 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13320 esac
13321
13322 : check for a working futimes
13323 d_futimes="$undef"
13324 echo " "
13325 echo "Checking if you have a working futimes()" >&4
13326 $cat >try.c <<EOCP
13327 #include <stdio.h>
13328 #include <sys/time.h>
13329 #include <errno.h>
13330 #include <fcntl.h>
13331
13332 int main ()
13333 {
13334     int fd, rv;
13335     fd = open ("try.c", O_RDWR);
13336     if (-1 == fd) exit (1);
13337     rv = futimes (fd, NULL);
13338     exit (rv == -1 ? errno : 0);
13339 }
13340 EOCP
13341 set try
13342 if eval $compile; then
13343     `$run ./try`
13344     rc=$?
13345     case "$rc" in
13346         0)  echo "Yes, you have" >&4
13347             d_futimes="$define"
13348             ;;
13349         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13350             ;;
13351     esac
13352 else
13353     echo "No, it does not (probably harmless)" >&4
13354 fi
13355 $rm_try
13356
13357 : see if ndbm.h is available
13358 set ndbm.h i_ndbm
13359 eval $inhdr
13360 : Compatibility location for RedHat 7.1
13361 set gdbm/ndbm.h i_gdbmndbm
13362 eval $inhdr
13363 : Compatibility location for Debian 4.0
13364 set gdbm-ndbm.h i_gdbm_ndbm
13365 eval $inhdr
13366
13367 val="$undef"
13368 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13369         : see if dbm_open exists
13370         set dbm_open d_dbm_open
13371         eval $inlibc
13372         case "$d_dbm_open" in
13373         $undef)
13374                 i_ndbm="$undef"
13375                 i_gdbmndbm="$undef"
13376                 i_gdbm_ndbm="$undef"
13377                 echo "We won't be including <ndbm.h>"
13378                 val="$undef"
13379                 ;;
13380         *) val="$define"
13381            ;;
13382         esac
13383 fi
13384 set d_ndbm
13385 eval $setvar
13386
13387 ndbm_hdr_protochk='name=$1; hdr=$2;
13388 eval "ihdr=\$""i_$name";
13389 val="$undef";
13390 if $test "$ihdr" = "$define"; then
13391         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13392         case "$d_cplusplus" in
13393         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13394         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13395         esac;
13396         case "$val" in
13397         $define) $echo "Your <$hdr> seems to have prototypes";;
13398         *) $echo "Your <$hdr> does not seem to have prototypes";;
13399         esac;
13400 fi;
13401 set "d_${name}_h_uses_prototypes";
13402 eval $setvar'
13403
13404 set ndbm ndbm.h
13405 eval $ndbm_hdr_protochk
13406 set gdbmndbm gdbm/ndbm.h
13407 eval $ndbm_hdr_protochk
13408 set gdbm_ndbm gdbm-ndbm.h
13409 eval $ndbm_hdr_protochk
13410
13411 : see if getaddrinfo exists
13412 set getaddrinfo d_getaddrinfo
13413 eval $inlibc
13414
13415 : see if getcwd exists
13416 set getcwd d_getcwd
13417 eval $inlibc
13418
13419 : see if getespwnam exists
13420 set getespwnam d_getespwnam
13421 eval $inlibc
13422
13423 : see if getfsstat exists
13424 set getfsstat d_getfsstat
13425 eval $inlibc
13426
13427 : see if getgrent exists
13428 set getgrent d_getgrent
13429 eval $inlibc
13430
13431 : see if getgrent_r exists
13432 set getgrent_r d_getgrent_r
13433 eval $inlibc
13434 case "$d_getgrent_r" in
13435 "$define")
13436         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13437         case "$d_getgrent_r_proto:$usethreads" in
13438         ":define")      d_getgrent_r_proto=define
13439                 set d_getgrent_r_proto getgrent_r $hdrs
13440                 eval $hasproto ;;
13441         *)      ;;
13442         esac
13443         case "$d_getgrent_r_proto" in
13444         define)
13445         case "$getgrent_r_proto" in
13446         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13447         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13448         esac
13449         case "$getgrent_r_proto" in
13450         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13451         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13452         esac
13453         case "$getgrent_r_proto" in
13454         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13455         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13456         esac
13457         case "$getgrent_r_proto" in
13458         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13459         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13460         esac
13461         case "$getgrent_r_proto" in
13462         ''|0) try='int getgrent_r(struct group*, char*, int);'
13463         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13464         esac
13465         case "$getgrent_r_proto" in
13466         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13467         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13468         esac
13469         case "$getgrent_r_proto" in
13470         ''|0)   d_getgrent_r=undef
13471                 getgrent_r_proto=0
13472                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13473         * )     case "$getgrent_r_proto" in
13474                 REENTRANT_PROTO*) ;;
13475                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13476                 esac
13477                 echo "Prototype: $try" ;;
13478         esac
13479         ;;
13480         *)      case "$usethreads" in
13481                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13482                 esac
13483                 d_getgrent_r=undef
13484                 getgrent_r_proto=0
13485                 ;;
13486         esac
13487         ;;
13488 *)      getgrent_r_proto=0
13489         ;;
13490 esac
13491
13492 : see if getgrgid_r exists
13493 set getgrgid_r d_getgrgid_r
13494 eval $inlibc
13495 case "$d_getgrgid_r" in
13496 "$define")
13497         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13498         case "$d_getgrgid_r_proto:$usethreads" in
13499         ":define")      d_getgrgid_r_proto=define
13500                 set d_getgrgid_r_proto getgrgid_r $hdrs
13501                 eval $hasproto ;;
13502         *)      ;;
13503         esac
13504         case "$d_getgrgid_r_proto" in
13505         define)
13506         case "$getgrgid_r_proto" in
13507         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13508         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13509         esac
13510         case "$getgrgid_r_proto" in
13511         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13512         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13513         esac
13514         case "$getgrgid_r_proto" in
13515         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13516         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13517         esac
13518         case "$getgrgid_r_proto" in
13519         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13520         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13521         esac
13522         case "$getgrgid_r_proto" in
13523         ''|0)   d_getgrgid_r=undef
13524                 getgrgid_r_proto=0
13525                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13526         * )     case "$getgrgid_r_proto" in
13527                 REENTRANT_PROTO*) ;;
13528                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13529                 esac
13530                 echo "Prototype: $try" ;;
13531         esac
13532         ;;
13533         *)      case "$usethreads" in
13534                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13535                 esac
13536                 d_getgrgid_r=undef
13537                 getgrgid_r_proto=0
13538                 ;;
13539         esac
13540         ;;
13541 *)      getgrgid_r_proto=0
13542         ;;
13543 esac
13544
13545 : see if getgrnam_r exists
13546 set getgrnam_r d_getgrnam_r
13547 eval $inlibc
13548 case "$d_getgrnam_r" in
13549 "$define")
13550         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13551         case "$d_getgrnam_r_proto:$usethreads" in
13552         ":define")      d_getgrnam_r_proto=define
13553                 set d_getgrnam_r_proto getgrnam_r $hdrs
13554                 eval $hasproto ;;
13555         *)      ;;
13556         esac
13557         case "$d_getgrnam_r_proto" in
13558         define)
13559         case "$getgrnam_r_proto" in
13560         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13561         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13562         esac
13563         case "$getgrnam_r_proto" in
13564         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13565         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13566         esac
13567         case "$getgrnam_r_proto" in
13568         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13569         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13570         esac
13571         case "$getgrnam_r_proto" in
13572         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13573         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13574         esac
13575         case "$getgrnam_r_proto" in
13576         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13577         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13578         esac
13579         case "$getgrnam_r_proto" in
13580         ''|0)   d_getgrnam_r=undef
13581                 getgrnam_r_proto=0
13582                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13583         * )     case "$getgrnam_r_proto" in
13584                 REENTRANT_PROTO*) ;;
13585                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13586                 esac
13587                 echo "Prototype: $try" ;;
13588         esac
13589         ;;
13590         *)      case "$usethreads" in
13591                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13592                 esac
13593                 d_getgrnam_r=undef
13594                 getgrnam_r_proto=0
13595                 ;;
13596         esac
13597         ;;
13598 *)      getgrnam_r_proto=0
13599         ;;
13600 esac
13601
13602 : see if gethostbyaddr exists
13603 set gethostbyaddr d_gethbyaddr
13604 eval $inlibc
13605
13606 : see if gethostbyname exists
13607 set gethostbyname d_gethbyname
13608 eval $inlibc
13609
13610 : see if gethostent exists
13611 set gethostent d_gethent
13612 eval $inlibc
13613
13614 : see how we will look up host name
13615 echo " "
13616 call=''
13617 if set gethostname val -f d_gethname; eval $csym; $val; then
13618         echo 'gethostname() found.' >&4
13619         d_gethname="$define"
13620         call=gethostname
13621 fi
13622 if set uname val -f d_uname; eval $csym; $val; then
13623         if ./xenix; then
13624                 $cat <<'EOM'
13625 uname() was found, but you're running xenix, and older versions of xenix
13626 have a broken uname(). If you don't really know whether your xenix is old
13627 enough to have a broken system call, use the default answer.
13628
13629 EOM
13630                 dflt=y
13631                 case "$d_uname" in
13632                 "$define") dflt=n;;
13633                 esac
13634                 rp='Is your uname() broken?'
13635                 . ./myread
13636                 case "$ans" in
13637                 n*) d_uname="$define"; call=uname;;
13638                 esac
13639         else
13640                 echo 'uname() found.' >&4
13641                 d_uname="$define"
13642                 case "$call" in
13643                 '') call=uname ;;
13644                 esac
13645         fi
13646 fi
13647 case "$d_gethname" in
13648 '') d_gethname="$undef";;
13649 esac
13650 case "$d_uname" in
13651 '') d_uname="$undef";;
13652 esac
13653 case "$d_uname$d_gethname" in
13654 *define*)
13655         dflt=n
13656         cat <<EOM
13657
13658 Every now and then someone has a $call() that lies about the hostname
13659 but can't be fixed for political or economic reasons.  If you wish, I can
13660 pretend $call() isn't there and maybe compute hostname at run-time
13661 thanks to the '$phostname' command.
13662
13663 EOM
13664         rp="Shall I ignore $call() from now on?"
13665         . ./myread
13666         case "$ans" in
13667         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13668         esac;;
13669 esac
13670 case "$phostname" in
13671 '') aphostname='';;
13672 *) case "$aphostname" in
13673         /*) ;;
13674         *) set X $phostname
13675                 shift
13676                 file=$1
13677                 shift
13678                 file=`./loc $file $file $pth`
13679                 aphostname=`echo $file $*`
13680                 ;;
13681         esac
13682         ;;
13683 esac
13684 case "$d_uname$d_gethname" in
13685 *define*) ;;
13686 *)
13687         case "$phostname" in
13688         '')
13689                 echo "There will be no way for $package to get your hostname." >&4;;
13690         *)
13691         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13692                 ;;
13693         esac;;
13694 esac
13695 case "$d_phostname" in
13696 '') d_phostname="$undef";;
13697 esac
13698
13699 : see if gethostbyaddr_r exists
13700 set gethostbyaddr_r d_gethostbyaddr_r
13701 eval $inlibc
13702 case "$d_gethostbyaddr_r" in
13703 "$define")
13704         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13705         case "$d_gethostbyaddr_r_proto:$usethreads" in
13706         ":define")      d_gethostbyaddr_r_proto=define
13707                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13708                 eval $hasproto ;;
13709         *)      ;;
13710         esac
13711         case "$d_gethostbyaddr_r_proto" in
13712         define)
13713         case "$gethostbyaddr_r_proto" in
13714         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13715         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13716         esac
13717         case "$gethostbyaddr_r_proto" in
13718         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13719         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13720         esac
13721         case "$gethostbyaddr_r_proto" in
13722         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13723         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13724         esac
13725         case "$gethostbyaddr_r_proto" in
13726         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13727         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13728         esac
13729         case "$gethostbyaddr_r_proto" in
13730         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13731         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13732         esac
13733         case "$gethostbyaddr_r_proto" in
13734         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13735         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13736         esac
13737         case "$gethostbyaddr_r_proto" in
13738         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13739         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13740         esac
13741         case "$gethostbyaddr_r_proto" in
13742         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13743         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13744         esac
13745         case "$gethostbyaddr_r_proto" in
13746         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13747         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13748         esac
13749         case "$gethostbyaddr_r_proto" in
13750         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13751         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13752         esac
13753         case "$gethostbyaddr_r_proto" in
13754         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13755         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13756         esac
13757         case "$gethostbyaddr_r_proto" in
13758         ''|0)   d_gethostbyaddr_r=undef
13759                 gethostbyaddr_r_proto=0
13760                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13761         * )     case "$gethostbyaddr_r_proto" in
13762                 REENTRANT_PROTO*) ;;
13763                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13764                 esac
13765                 echo "Prototype: $try" ;;
13766         esac
13767         ;;
13768         *)      case "$usethreads" in
13769                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13770                 esac
13771                 d_gethostbyaddr_r=undef
13772                 gethostbyaddr_r_proto=0
13773                 ;;
13774         esac
13775         ;;
13776 *)      gethostbyaddr_r_proto=0
13777         ;;
13778 esac
13779
13780 : see if gethostbyname_r exists
13781 set gethostbyname_r d_gethostbyname_r
13782 eval $inlibc
13783 case "$d_gethostbyname_r" in
13784 "$define")
13785         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13786         case "$d_gethostbyname_r_proto:$usethreads" in
13787         ":define")      d_gethostbyname_r_proto=define
13788                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13789                 eval $hasproto ;;
13790         *)      ;;
13791         esac
13792         case "$d_gethostbyname_r_proto" in
13793         define)
13794         case "$gethostbyname_r_proto" in
13795         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13796         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13797         esac
13798         case "$gethostbyname_r_proto" in
13799         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13800         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13801         esac
13802         case "$gethostbyname_r_proto" in
13803         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13804         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13805         esac
13806         case "$gethostbyname_r_proto" in
13807         ''|0)   d_gethostbyname_r=undef
13808                 gethostbyname_r_proto=0
13809                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13810         * )     case "$gethostbyname_r_proto" in
13811                 REENTRANT_PROTO*) ;;
13812                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13813                 esac
13814                 echo "Prototype: $try" ;;
13815         esac
13816         ;;
13817         *)      case "$usethreads" in
13818                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13819                 esac
13820                 d_gethostbyname_r=undef
13821                 gethostbyname_r_proto=0
13822                 ;;
13823         esac
13824         ;;
13825 *)      gethostbyname_r_proto=0
13826         ;;
13827 esac
13828
13829 : see if gethostent_r exists
13830 set gethostent_r d_gethostent_r
13831 eval $inlibc
13832 case "$d_gethostent_r" in
13833 "$define")
13834         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13835         case "$d_gethostent_r_proto:$usethreads" in
13836         ":define")      d_gethostent_r_proto=define
13837                 set d_gethostent_r_proto gethostent_r $hdrs
13838                 eval $hasproto ;;
13839         *)      ;;
13840         esac
13841         case "$d_gethostent_r_proto" in
13842         define)
13843         case "$gethostent_r_proto" in
13844         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13845         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13846         esac
13847         case "$gethostent_r_proto" in
13848         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13849         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13850         esac
13851         case "$gethostent_r_proto" in
13852         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13853         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13854         esac
13855         case "$gethostent_r_proto" in
13856         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13857         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13858         esac
13859         case "$gethostent_r_proto" in
13860         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13861         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13862         esac
13863         case "$gethostent_r_proto" in
13864         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13865         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13866         esac
13867         case "$gethostent_r_proto" in
13868         ''|0)   d_gethostent_r=undef
13869                 gethostent_r_proto=0
13870                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13871         * )     case "$gethostent_r_proto" in
13872                 REENTRANT_PROTO*) ;;
13873                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13874                 esac
13875                 echo "Prototype: $try" ;;
13876         esac
13877         ;;
13878         *)      case "$usethreads" in
13879                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13880                 esac
13881                 d_gethostent_r=undef
13882                 gethostent_r_proto=0
13883                 ;;
13884         esac
13885         ;;
13886 *)      gethostent_r_proto=0
13887         ;;
13888 esac
13889
13890 : see if prototypes for various gethostxxx netdb.h functions are available
13891 echo " "
13892 set d_gethostprotos gethostent $i_netdb netdb.h
13893 eval $hasproto
13894
13895 : see if getitimer exists
13896 set getitimer d_getitimer
13897 eval $inlibc
13898
13899 : see if getlogin exists
13900 set getlogin d_getlogin
13901 eval $inlibc
13902
13903 : see if getlogin_r exists
13904 set getlogin_r d_getlogin_r
13905 eval $inlibc
13906 case "$d_getlogin_r" in
13907 "$define")
13908         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13909         case "$d_getlogin_r_proto:$usethreads" in
13910         ":define")      d_getlogin_r_proto=define
13911                 set d_getlogin_r_proto getlogin_r $hdrs
13912                 eval $hasproto ;;
13913         *)      ;;
13914         esac
13915         case "$d_getlogin_r_proto" in
13916         define)
13917         case "$getlogin_r_proto" in
13918         ''|0) try='int getlogin_r(char*, size_t);'
13919         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13920         esac
13921         case "$getlogin_r_proto" in
13922         ''|0) try='int getlogin_r(char*, int);'
13923         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13924         esac
13925         case "$getlogin_r_proto" in
13926         ''|0) try='char* getlogin_r(char*, size_t);'
13927         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13928         esac
13929         case "$getlogin_r_proto" in
13930         ''|0) try='char* getlogin_r(char*, int);'
13931         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13932         esac
13933         case "$getlogin_r_proto" in
13934         ''|0)   d_getlogin_r=undef
13935                 getlogin_r_proto=0
13936                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13937         * )     case "$getlogin_r_proto" in
13938                 REENTRANT_PROTO*) ;;
13939                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13940                 esac
13941                 echo "Prototype: $try" ;;
13942         esac
13943         ;;
13944         *)      case "$usethreads" in
13945                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13946                 esac
13947                 d_getlogin_r=undef
13948                 getlogin_r_proto=0
13949                 ;;
13950         esac
13951         ;;
13952 *)      getlogin_r_proto=0
13953         ;;
13954 esac
13955
13956 : see if getmnt exists
13957 set getmnt d_getmnt
13958 eval $inlibc
13959
13960 : see if getmntent exists
13961 set getmntent d_getmntent
13962 eval $inlibc
13963
13964 : see if getnameinfo exists
13965 set getnameinfo d_getnameinfo
13966 eval $inlibc
13967
13968 : see if getnetbyaddr exists
13969 set getnetbyaddr d_getnbyaddr
13970 eval $inlibc
13971
13972 : see if getnetbyname exists
13973 set getnetbyname d_getnbyname
13974 eval $inlibc
13975
13976 : see if getnetent exists
13977 set getnetent d_getnent
13978 eval $inlibc
13979
13980 : see if getnetbyaddr_r exists
13981 set getnetbyaddr_r d_getnetbyaddr_r
13982 eval $inlibc
13983 case "$d_getnetbyaddr_r" in
13984 "$define")
13985         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13986         case "$d_getnetbyaddr_r_proto:$usethreads" in
13987         ":define")      d_getnetbyaddr_r_proto=define
13988                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13989                 eval $hasproto ;;
13990         *)      ;;
13991         esac
13992         case "$d_getnetbyaddr_r_proto" in
13993         define)
13994         case "$getnetbyaddr_r_proto" in
13995         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13996         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13997         esac
13998         case "$getnetbyaddr_r_proto" in
13999         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14000         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14001         esac
14002         case "$getnetbyaddr_r_proto" in
14003         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14004         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14005         esac
14006         case "$getnetbyaddr_r_proto" in
14007         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14008         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14009         esac
14010         case "$getnetbyaddr_r_proto" in
14011         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14012         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14013         esac
14014         case "$getnetbyaddr_r_proto" in
14015         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14016         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14017         esac
14018         case "$getnetbyaddr_r_proto" in
14019         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14020         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14021         esac
14022         case "$getnetbyaddr_r_proto" in
14023         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14024         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14025         esac
14026         case "$getnetbyaddr_r_proto" in
14027         ''|0)   d_getnetbyaddr_r=undef
14028                 getnetbyaddr_r_proto=0
14029                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14030         * )     case "$getnetbyaddr_r_proto" in
14031                 REENTRANT_PROTO*) ;;
14032                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14033                 esac
14034                 echo "Prototype: $try" ;;
14035         esac
14036         ;;
14037         *)      case "$usethreads" in
14038                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14039                 esac
14040                 d_getnetbyaddr_r=undef
14041                 getnetbyaddr_r_proto=0
14042                 ;;
14043         esac
14044         ;;
14045 *)      getnetbyaddr_r_proto=0
14046         ;;
14047 esac
14048
14049 : see if getnetbyname_r exists
14050 set getnetbyname_r d_getnetbyname_r
14051 eval $inlibc
14052 case "$d_getnetbyname_r" in
14053 "$define")
14054         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14055         case "$d_getnetbyname_r_proto:$usethreads" in
14056         ":define")      d_getnetbyname_r_proto=define
14057                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14058                 eval $hasproto ;;
14059         *)      ;;
14060         esac
14061         case "$d_getnetbyname_r_proto" in
14062         define)
14063         case "$getnetbyname_r_proto" in
14064         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14065         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14066         esac
14067         case "$getnetbyname_r_proto" in
14068         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14069         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14070         esac
14071         case "$getnetbyname_r_proto" in
14072         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14073         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14074         esac
14075         case "$getnetbyname_r_proto" in
14076         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14077         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14078         esac
14079         case "$getnetbyname_r_proto" in
14080         ''|0)   d_getnetbyname_r=undef
14081                 getnetbyname_r_proto=0
14082                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14083         * )     case "$getnetbyname_r_proto" in
14084                 REENTRANT_PROTO*) ;;
14085                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14086                 esac
14087                 echo "Prototype: $try" ;;
14088         esac
14089         ;;
14090         *)      case "$usethreads" in
14091                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14092                 esac
14093                 d_getnetbyname_r=undef
14094                 getnetbyname_r_proto=0
14095                 ;;
14096         esac
14097         ;;
14098 *)      getnetbyname_r_proto=0
14099         ;;
14100 esac
14101
14102 : see if getnetent_r exists
14103 set getnetent_r d_getnetent_r
14104 eval $inlibc
14105 case "$d_getnetent_r" in
14106 "$define")
14107         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14108         case "$d_getnetent_r_proto:$usethreads" in
14109         ":define")      d_getnetent_r_proto=define
14110                 set d_getnetent_r_proto getnetent_r $hdrs
14111                 eval $hasproto ;;
14112         *)      ;;
14113         esac
14114         case "$d_getnetent_r_proto" in
14115         define)
14116         case "$getnetent_r_proto" in
14117         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14118         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14119         esac
14120         case "$getnetent_r_proto" in
14121         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14122         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14123         esac
14124         case "$getnetent_r_proto" in
14125         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14126         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14127         esac
14128         case "$getnetent_r_proto" in
14129         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14130         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14131         esac
14132         case "$getnetent_r_proto" in
14133         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14134         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14135         esac
14136         case "$getnetent_r_proto" in
14137         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14138         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14139         esac
14140         case "$getnetent_r_proto" in
14141         ''|0)   d_getnetent_r=undef
14142                 getnetent_r_proto=0
14143                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14144         * )     case "$getnetent_r_proto" in
14145                 REENTRANT_PROTO*) ;;
14146                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14147                 esac
14148                 echo "Prototype: $try" ;;
14149         esac
14150         ;;
14151         *)      case "$usethreads" in
14152                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14153                 esac
14154                 d_getnetent_r=undef
14155                 getnetent_r_proto=0
14156                 ;;
14157         esac
14158         ;;
14159 *)      getnetent_r_proto=0
14160         ;;
14161 esac
14162
14163 : see if prototypes for various getnetxxx netdb.h functions are available
14164 echo " "
14165 set d_getnetprotos getnetent $i_netdb netdb.h
14166 eval $hasproto
14167
14168 : see if getpagesize exists
14169 set getpagesize d_getpagsz
14170 eval $inlibc
14171
14172 : Optional checks for getprotobyname and getprotobynumber
14173
14174 : see if getprotobyname exists
14175 set getprotobyname d_getpbyname
14176 eval $inlibc
14177
14178 : see if getprotobynumber exists
14179 set getprotobynumber d_getpbynumber
14180 eval $inlibc
14181
14182 : see if getprotoent exists
14183 set getprotoent d_getpent
14184 eval $inlibc
14185
14186 : see if getpgid exists
14187 set getpgid d_getpgid
14188 eval $inlibc
14189
14190 : see if getpgrp2 exists
14191 set getpgrp2 d_getpgrp2
14192 eval $inlibc
14193
14194 : see if getppid exists
14195 set getppid d_getppid
14196 eval $inlibc
14197
14198 : see if getpriority exists
14199 set getpriority d_getprior
14200 eval $inlibc
14201
14202 : see if getprotobyname_r exists
14203 set getprotobyname_r d_getprotobyname_r
14204 eval $inlibc
14205 case "$d_getprotobyname_r" in
14206 "$define")
14207         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14208         case "$d_getprotobyname_r_proto:$usethreads" in
14209         ":define")      d_getprotobyname_r_proto=define
14210                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14211                 eval $hasproto ;;
14212         *)      ;;
14213         esac
14214         case "$d_getprotobyname_r_proto" in
14215         define)
14216         case "$getprotobyname_r_proto" in
14217         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14218         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14219         esac
14220         case "$getprotobyname_r_proto" in
14221         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14222         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14223         esac
14224         case "$getprotobyname_r_proto" in
14225         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14226         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14227         esac
14228         case "$getprotobyname_r_proto" in
14229         ''|0)   d_getprotobyname_r=undef
14230                 getprotobyname_r_proto=0
14231                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14232         * )     case "$getprotobyname_r_proto" in
14233                 REENTRANT_PROTO*) ;;
14234                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14235                 esac
14236                 echo "Prototype: $try" ;;
14237         esac
14238         ;;
14239         *)      case "$usethreads" in
14240                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14241                 esac
14242                 d_getprotobyname_r=undef
14243                 getprotobyname_r_proto=0
14244                 ;;
14245         esac
14246         ;;
14247 *)      getprotobyname_r_proto=0
14248         ;;
14249 esac
14250
14251 : see if getprotobynumber_r exists
14252 set getprotobynumber_r d_getprotobynumber_r
14253 eval $inlibc
14254 case "$d_getprotobynumber_r" in
14255 "$define")
14256         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14257         case "$d_getprotobynumber_r_proto:$usethreads" in
14258         ":define")      d_getprotobynumber_r_proto=define
14259                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14260                 eval $hasproto ;;
14261         *)      ;;
14262         esac
14263         case "$d_getprotobynumber_r_proto" in
14264         define)
14265         case "$getprotobynumber_r_proto" in
14266         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14267         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14268         esac
14269         case "$getprotobynumber_r_proto" in
14270         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14271         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14272         esac
14273         case "$getprotobynumber_r_proto" in
14274         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14275         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14276         esac
14277         case "$getprotobynumber_r_proto" in
14278         ''|0)   d_getprotobynumber_r=undef
14279                 getprotobynumber_r_proto=0
14280                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14281         * )     case "$getprotobynumber_r_proto" in
14282                 REENTRANT_PROTO*) ;;
14283                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14284                 esac
14285                 echo "Prototype: $try" ;;
14286         esac
14287         ;;
14288         *)      case "$usethreads" in
14289                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14290                 esac
14291                 d_getprotobynumber_r=undef
14292                 getprotobynumber_r_proto=0
14293                 ;;
14294         esac
14295         ;;
14296 *)      getprotobynumber_r_proto=0
14297         ;;
14298 esac
14299
14300 : see if getprotoent_r exists
14301 set getprotoent_r d_getprotoent_r
14302 eval $inlibc
14303 case "$d_getprotoent_r" in
14304 "$define")
14305         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14306         case "$d_getprotoent_r_proto:$usethreads" in
14307         ":define")      d_getprotoent_r_proto=define
14308                 set d_getprotoent_r_proto getprotoent_r $hdrs
14309                 eval $hasproto ;;
14310         *)      ;;
14311         esac
14312         case "$d_getprotoent_r_proto" in
14313         define)
14314         case "$getprotoent_r_proto" in
14315         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14316         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14317         esac
14318         case "$getprotoent_r_proto" in
14319         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14320         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14321         esac
14322         case "$getprotoent_r_proto" in
14323         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14324         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14325         esac
14326         case "$getprotoent_r_proto" in
14327         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14328         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14329         esac
14330         case "$getprotoent_r_proto" in
14331         ''|0)   d_getprotoent_r=undef
14332                 getprotoent_r_proto=0
14333                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14334         * )     case "$getprotoent_r_proto" in
14335                 REENTRANT_PROTO*) ;;
14336                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14337                 esac
14338                 echo "Prototype: $try" ;;
14339         esac
14340         ;;
14341         *)      case "$usethreads" in
14342                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14343                 esac
14344                 d_getprotoent_r=undef
14345                 getprotoent_r_proto=0
14346                 ;;
14347         esac
14348         ;;
14349 *)      getprotoent_r_proto=0
14350         ;;
14351 esac
14352
14353 : see if prototypes for various getprotoxxx netdb.h functions are available
14354 echo " "
14355 set d_getprotoprotos getprotoent $i_netdb netdb.h
14356 eval $hasproto
14357
14358 : see if getprpwnam exists
14359 set getprpwnam d_getprpwnam
14360 eval $inlibc
14361
14362 : see if getpwent exists
14363 set getpwent d_getpwent
14364 eval $inlibc
14365
14366 : see if getpwent_r exists
14367 set getpwent_r d_getpwent_r
14368 eval $inlibc
14369 case "$d_getpwent_r" in
14370 "$define")
14371         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14372         case "$d_getpwent_r_proto:$usethreads" in
14373         ":define")      d_getpwent_r_proto=define
14374                 set d_getpwent_r_proto getpwent_r $hdrs
14375                 eval $hasproto ;;
14376         *)      ;;
14377         esac
14378         case "$d_getpwent_r_proto" in
14379         define)
14380         case "$getpwent_r_proto" in
14381         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14382         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14383         esac
14384         case "$getpwent_r_proto" in
14385         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14386         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14387         esac
14388         case "$getpwent_r_proto" in
14389         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14390         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14391         esac
14392         case "$getpwent_r_proto" in
14393         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14394         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14395         esac
14396         case "$getpwent_r_proto" in
14397         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14398         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14399         esac
14400         case "$getpwent_r_proto" in
14401         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14402         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14403         esac
14404         case "$getpwent_r_proto" in
14405         ''|0)   d_getpwent_r=undef
14406                 getpwent_r_proto=0
14407                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14408         * )     case "$getpwent_r_proto" in
14409                 REENTRANT_PROTO*) ;;
14410                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14411                 esac
14412                 echo "Prototype: $try" ;;
14413         esac
14414         ;;
14415         *)      case "$usethreads" in
14416                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14417                 esac
14418                 d_getpwent_r=undef
14419                 getpwent_r_proto=0
14420                 ;;
14421         esac
14422         ;;
14423 *)      getpwent_r_proto=0
14424         ;;
14425 esac
14426
14427 : see if getpwnam_r exists
14428 set getpwnam_r d_getpwnam_r
14429 eval $inlibc
14430 case "$d_getpwnam_r" in
14431 "$define")
14432         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14433         case "$d_getpwnam_r_proto:$usethreads" in
14434         ":define")      d_getpwnam_r_proto=define
14435                 set d_getpwnam_r_proto getpwnam_r $hdrs
14436                 eval $hasproto ;;
14437         *)      ;;
14438         esac
14439         case "$d_getpwnam_r_proto" in
14440         define)
14441         case "$getpwnam_r_proto" in
14442         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14443         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14444         esac
14445         case "$getpwnam_r_proto" in
14446         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14447         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14448         esac
14449         case "$getpwnam_r_proto" in
14450         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14451         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14452         esac
14453         case "$getpwnam_r_proto" in
14454         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14455         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14456         esac
14457         case "$getpwnam_r_proto" in
14458         ''|0)   d_getpwnam_r=undef
14459                 getpwnam_r_proto=0
14460                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14461         * )     case "$getpwnam_r_proto" in
14462                 REENTRANT_PROTO*) ;;
14463                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14464                 esac
14465                 echo "Prototype: $try" ;;
14466         esac
14467         ;;
14468         *)      case "$usethreads" in
14469                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14470                 esac
14471                 d_getpwnam_r=undef
14472                 getpwnam_r_proto=0
14473                 ;;
14474         esac
14475         ;;
14476 *)      getpwnam_r_proto=0
14477         ;;
14478 esac
14479
14480 : see if getpwuid_r exists
14481 set getpwuid_r d_getpwuid_r
14482 eval $inlibc
14483 case "$d_getpwuid_r" in
14484 "$define")
14485         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14486         case "$d_getpwuid_r_proto:$usethreads" in
14487         ":define")      d_getpwuid_r_proto=define
14488                 set d_getpwuid_r_proto getpwuid_r $hdrs
14489                 eval $hasproto ;;
14490         *)      ;;
14491         esac
14492         case "$d_getpwuid_r_proto" in
14493         define)
14494         case "$getpwuid_r_proto" in
14495         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14496         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14497         esac
14498         case "$getpwuid_r_proto" in
14499         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14500         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14501         esac
14502         case "$getpwuid_r_proto" in
14503         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14504         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14505         esac
14506         case "$getpwuid_r_proto" in
14507         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14508         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14509         esac
14510         case "$getpwuid_r_proto" in
14511         ''|0)   d_getpwuid_r=undef
14512                 getpwuid_r_proto=0
14513                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14514         * )     case "$getpwuid_r_proto" in
14515                 REENTRANT_PROTO*) ;;
14516                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14517                 esac
14518                 echo "Prototype: $try" ;;
14519         esac
14520         ;;
14521         *)      case "$usethreads" in
14522                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14523                 esac
14524                 d_getpwuid_r=undef
14525                 getpwuid_r_proto=0
14526                 ;;
14527         esac
14528         ;;
14529 *)      getpwuid_r_proto=0
14530         ;;
14531 esac
14532
14533 : Optional checks for getsbyname and getsbyport
14534
14535 : see if getservbyname exists
14536 set getservbyname d_getsbyname
14537 eval $inlibc
14538
14539 : see if getservbyport exists
14540 set getservbyport d_getsbyport
14541 eval $inlibc
14542
14543 : see if getservent exists
14544 set getservent d_getsent
14545 eval $inlibc
14546
14547 : see if getservbyname_r exists
14548 set getservbyname_r d_getservbyname_r
14549 eval $inlibc
14550 case "$d_getservbyname_r" in
14551 "$define")
14552         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14553         case "$d_getservbyname_r_proto:$usethreads" in
14554         ":define")      d_getservbyname_r_proto=define
14555                 set d_getservbyname_r_proto getservbyname_r $hdrs
14556                 eval $hasproto ;;
14557         *)      ;;
14558         esac
14559         case "$d_getservbyname_r_proto" in
14560         define)
14561         case "$getservbyname_r_proto" in
14562         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14563         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14564         esac
14565         case "$getservbyname_r_proto" in
14566         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14567         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14568         esac
14569         case "$getservbyname_r_proto" in
14570         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14571         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14572         esac
14573         case "$getservbyname_r_proto" in
14574         ''|0)   d_getservbyname_r=undef
14575                 getservbyname_r_proto=0
14576                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14577         * )     case "$getservbyname_r_proto" in
14578                 REENTRANT_PROTO*) ;;
14579                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14580                 esac
14581                 echo "Prototype: $try" ;;
14582         esac
14583         ;;
14584         *)      case "$usethreads" in
14585                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14586                 esac
14587                 d_getservbyname_r=undef
14588                 getservbyname_r_proto=0
14589                 ;;
14590         esac
14591         ;;
14592 *)      getservbyname_r_proto=0
14593         ;;
14594 esac
14595
14596 : see if getservbyport_r exists
14597 set getservbyport_r d_getservbyport_r
14598 eval $inlibc
14599 case "$d_getservbyport_r" in
14600 "$define")
14601         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14602         case "$d_getservbyport_r_proto:$usethreads" in
14603         ":define")      d_getservbyport_r_proto=define
14604                 set d_getservbyport_r_proto getservbyport_r $hdrs
14605                 eval $hasproto ;;
14606         *)      ;;
14607         esac
14608         case "$d_getservbyport_r_proto" in
14609         define)
14610         case "$getservbyport_r_proto" in
14611         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14612         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14613         esac
14614         case "$getservbyport_r_proto" in
14615         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14616         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14617         esac
14618         case "$getservbyport_r_proto" in
14619         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14620         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14621         esac
14622         case "$getservbyport_r_proto" in
14623         ''|0)   d_getservbyport_r=undef
14624                 getservbyport_r_proto=0
14625                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14626         * )     case "$getservbyport_r_proto" in
14627                 REENTRANT_PROTO*) ;;
14628                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14629                 esac
14630                 echo "Prototype: $try" ;;
14631         esac
14632         ;;
14633         *)      case "$usethreads" in
14634                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14635                 esac
14636                 d_getservbyport_r=undef
14637                 getservbyport_r_proto=0
14638                 ;;
14639         esac
14640         ;;
14641 *)      getservbyport_r_proto=0
14642         ;;
14643 esac
14644
14645 : see if getservent_r exists
14646 set getservent_r d_getservent_r
14647 eval $inlibc
14648 case "$d_getservent_r" in
14649 "$define")
14650         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14651         case "$d_getservent_r_proto:$usethreads" in
14652         ":define")      d_getservent_r_proto=define
14653                 set d_getservent_r_proto getservent_r $hdrs
14654                 eval $hasproto ;;
14655         *)      ;;
14656         esac
14657         case "$d_getservent_r_proto" in
14658         define)
14659         case "$getservent_r_proto" in
14660         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14661         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14662         esac
14663         case "$getservent_r_proto" in
14664         ''|0) try='int getservent_r(struct servent*, char*, int);'
14665         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14666         esac
14667         case "$getservent_r_proto" in
14668         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14669         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14670         esac
14671         case "$getservent_r_proto" in
14672         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14673         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14674         esac
14675         case "$getservent_r_proto" in
14676         ''|0)   d_getservent_r=undef
14677                 getservent_r_proto=0
14678                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14679         * )     case "$getservent_r_proto" in
14680                 REENTRANT_PROTO*) ;;
14681                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14682                 esac
14683                 echo "Prototype: $try" ;;
14684         esac
14685         ;;
14686         *)      case "$usethreads" in
14687                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14688                 esac
14689                 d_getservent_r=undef
14690                 getservent_r_proto=0
14691                 ;;
14692         esac
14693         ;;
14694 *)      getservent_r_proto=0
14695         ;;
14696 esac
14697
14698 : see if prototypes for various getservxxx netdb.h functions are available
14699 echo " "
14700 set d_getservprotos getservent $i_netdb netdb.h
14701 eval $hasproto
14702
14703 : see if getspnam exists
14704 set getspnam d_getspnam
14705 eval $inlibc
14706
14707 : see if this is a shadow.h system
14708 set shadow.h i_shadow
14709 eval $inhdr
14710
14711 : see if getspnam_r exists
14712 set getspnam_r d_getspnam_r
14713 eval $inlibc
14714 case "$d_getspnam_r" in
14715 "$define")
14716         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14717         case "$d_getspnam_r_proto:$usethreads" in
14718         ":define")      d_getspnam_r_proto=define
14719                 set d_getspnam_r_proto getspnam_r $hdrs
14720                 eval $hasproto ;;
14721         *)      ;;
14722         esac
14723         case "$d_getspnam_r_proto" in
14724         define)
14725         case "$getspnam_r_proto" in
14726         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14727         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14728         esac
14729         case "$getspnam_r_proto" in
14730         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14731         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14732         esac
14733         case "$getspnam_r_proto" in
14734         ''|0)   d_getspnam_r=undef
14735                 getspnam_r_proto=0
14736                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14737         * )     case "$getspnam_r_proto" in
14738                 REENTRANT_PROTO*) ;;
14739                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14740                 esac
14741                 echo "Prototype: $try" ;;
14742         esac
14743         ;;
14744         *)      case "$usethreads" in
14745                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14746                 esac
14747                 d_getspnam_r=undef
14748                 getspnam_r_proto=0
14749                 ;;
14750         esac
14751         ;;
14752 *)      getspnam_r_proto=0
14753         ;;
14754 esac
14755
14756 : see if gettimeofday or ftime exists
14757 set gettimeofday d_gettimeod
14758 eval $inlibc
14759 case "$d_gettimeod" in
14760 "$undef")
14761         set ftime d_ftime 
14762         eval $inlibc
14763         ;;
14764 *)
14765         val="$undef"; set d_ftime; eval $setvar
14766         ;;
14767 esac
14768 case "$d_gettimeod$d_ftime" in
14769 "$undef$undef")
14770         echo " "
14771         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14772         ;;
14773 esac
14774
14775 : see if gmtime_r exists
14776 set gmtime_r d_gmtime_r
14777 eval $inlibc
14778 case "$d_gmtime_r" in
14779 "$define")
14780         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14781         case "$d_gmtime_r_proto:$usethreads" in
14782         ":define")      d_gmtime_r_proto=define
14783                 set d_gmtime_r_proto gmtime_r $hdrs
14784                 eval $hasproto ;;
14785         *)      ;;
14786         esac
14787         case "$d_gmtime_r_proto" in
14788         define)
14789         case "$gmtime_r_proto" in
14790         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14791         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14792         esac
14793         case "$gmtime_r_proto" in
14794         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14795         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14796         esac
14797         case "$gmtime_r_proto" in
14798         ''|0)   d_gmtime_r=undef
14799                 gmtime_r_proto=0
14800                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14801         * )     case "$gmtime_r_proto" in
14802                 REENTRANT_PROTO*) ;;
14803                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14804                 esac
14805                 echo "Prototype: $try" ;;
14806         esac
14807         ;;
14808         *)      case "$usethreads" in
14809                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14810                 esac
14811                 d_gmtime_r=undef
14812                 gmtime_r_proto=0
14813                 ;;
14814         esac
14815         ;;
14816 *)      gmtime_r_proto=0
14817         ;;
14818 esac
14819
14820 : see if hasmntopt exists
14821 set hasmntopt d_hasmntopt
14822 eval $inlibc
14823
14824 : see if this is a netinet/in.h or sys/in.h system
14825 set netinet/in.h i_niin sys/in.h i_sysin
14826 eval $inhdr
14827
14828 : see if arpa/inet.h has to be included
14829 set arpa/inet.h i_arpainet
14830 eval $inhdr
14831
14832 : see if htonl --and friends-- exists
14833 val=''
14834 set htonl val
14835 eval $inlibc
14836
14837 : Maybe they are macros.
14838 case "$val" in
14839 $undef)
14840         $cat >htonl.c <<EOM
14841 #include <stdio.h>
14842 #include <sys/types.h>
14843 #$i_niin I_NETINET_IN
14844 #$i_sysin I_SYS_IN
14845 #$i_arpainet I_ARPA_INET
14846 #ifdef I_NETINET_IN
14847 #include <netinet/in.h>
14848 #endif
14849 #ifdef I_SYS_IN
14850 #include <sys/in.h>
14851 #endif
14852 #ifdef I_ARPA_INET
14853 #include <arpa/inet.h>
14854 #endif
14855 #ifdef htonl
14856 printf("Defined as a macro.");
14857 #endif
14858 EOM
14859         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14860         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14861                 val="$define"
14862                 echo "But it seems to be defined as a macro." >&4
14863         fi
14864         $rm -f htonl.?
14865         ;;
14866 esac
14867 set d_htonl
14868 eval $setvar
14869
14870 : see if ilogbl exists
14871 set ilogbl d_ilogbl
14872 eval $inlibc
14873
14874 : index or strchr
14875 echo " "
14876 if set index val -f; eval $csym; $val; then
14877         if set strchr val -f d_strchr; eval $csym; $val; then
14878                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14879                         val="$define"
14880                         vali="$undef"
14881                         echo "strchr() found." >&4
14882                 else
14883                         val="$undef"
14884                         vali="$define"
14885                         echo "index() found." >&4
14886                 fi
14887         else
14888                 val="$undef"
14889                 vali="$define"
14890                 echo "index() found." >&4
14891         fi
14892 else
14893         if set strchr val -f d_strchr; eval $csym; $val; then
14894                 val="$define"
14895                 vali="$undef"
14896                 echo "strchr() found." >&4
14897         else
14898                 echo "No index() or strchr() found!" >&4
14899                 val="$undef"
14900                 vali="$undef"
14901         fi
14902 fi
14903 set d_strchr; eval $setvar
14904 val="$vali"
14905 set d_index; eval $setvar
14906
14907 : check whether inet_aton exists
14908 set inet_aton d_inetaton
14909 eval $inlibc
14910
14911 : see if inet_ntop exists
14912 set inet_ntop d_inetntop
14913 eval $inlibc
14914
14915 : see if inet_pton exists
14916 set inet_pton d_inetpton
14917 eval $inlibc
14918
14919 : Look for isascii
14920 echo " "
14921 $cat >isascii.c <<EOCP
14922 #include <stdio.h>
14923 #include <ctype.h>
14924 #$i_stdlib I_STDLIB
14925 #ifdef I_STDLIB
14926 #include <stdlib.h>
14927 #endif
14928 int main() {
14929         int c = 'A';
14930         if (isascii(c))
14931                 exit(0);
14932         else
14933                 exit(1);
14934 }
14935 EOCP
14936 set isascii
14937 if eval $compile; then
14938         echo "isascii() found." >&4
14939         val="$define"
14940 else
14941         echo "isascii() NOT found." >&4
14942         val="$undef"
14943 fi
14944 set d_isascii
14945 eval $setvar
14946 $rm -f isascii*
14947
14948 : see if isfinite exists
14949 set isfinite d_isfinite
14950 eval $inlibc
14951
14952 : see if isinf exists
14953 set isinf d_isinf
14954 eval $inlibc
14955
14956 : see if isnan exists
14957 set isnan d_isnan
14958 eval $inlibc
14959
14960 : see if isnanl exists
14961 set isnanl d_isnanl
14962 eval $inlibc
14963
14964 : see if killpg exists
14965 set killpg d_killpg
14966 eval $inlibc
14967
14968 : see if lchown exists
14969 echo " "
14970 $cat > try.c <<'EOCP'
14971 /* System header to define __stub macros and hopefully few prototypes,
14972     which can conflict with char lchown(); below.  */
14973 #include <assert.h>
14974 /* Override any gcc2 internal prototype to avoid an error.  */
14975 /* We use char because int might match the return type of a gcc2
14976    builtin and then its argument prototype would still apply.  */
14977 char lchown();
14978 int main() {
14979     /*  The GNU C library defines this for functions which it implements
14980         to always fail with ENOSYS.  Some functions are actually named
14981         something starting with __ and the normal name is an alias.  */
14982 #if defined (__stub_lchown) || defined (__stub___lchown)
14983 choke me
14984 #else
14985 lchown();
14986 #endif
14987 ; return 0; }
14988 EOCP
14989 set try
14990 if eval $compile; then
14991     $echo "lchown() found." >&4
14992     val="$define"
14993 else
14994     $echo "lchown() NOT found." >&4
14995     val="$undef"
14996 fi
14997 set d_lchown
14998 eval $setvar
14999
15000 : See if number of significant digits in a double precision number is known
15001 echo " "
15002 $cat >ldbl_dig.c <<EOM
15003 #$i_limits I_LIMITS
15004 #$i_float I_FLOAT
15005 #ifdef I_LIMITS
15006 #include <limits.h>
15007 #endif
15008 #ifdef I_FLOAT
15009 #include <float.h>
15010 #endif
15011 #ifdef LDBL_DIG
15012 printf("Contains LDBL_DIG");
15013 #endif
15014 EOM
15015 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15016 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15017         echo "LDBL_DIG found." >&4
15018         val="$define"
15019 else
15020         echo "LDBL_DIG NOT found." >&4
15021         val="$undef"
15022 fi
15023 $rm -f ldbl_dig.?
15024 set d_ldbl_dig
15025 eval $setvar
15026
15027 : see if this is a math.h system
15028 set math.h i_math
15029 eval $inhdr
15030
15031 : check to see if math.h defines _LIB_VERSION
15032 d_libm_lib_version="$undef"
15033 case $i_math in
15034     $define)
15035         echo " "
15036         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15037         $cat >try.c <<EOCP
15038 #include <unistd.h>
15039 #include <math.h>
15040 int main (int argc, char *argv[])
15041 {
15042     printf ("%d\n", _LIB_VERSION);
15043     return (0);
15044     } /* main */
15045 EOCP
15046         set try
15047         if eval $compile; then
15048             foo=`$run ./try`
15049             echo "Yes, it does ($foo)" >&4
15050             d_libm_lib_version="$define"
15051         else
15052             echo "No, it does not (probably harmless)" >&4
15053             fi
15054         $rm_try
15055         ;;
15056
15057     esac
15058
15059 : see if link exists
15060 set link d_link
15061 eval $inlibc
15062
15063 : see if localtime_r exists
15064 set localtime_r d_localtime_r
15065 eval $inlibc
15066 case "$d_localtime_r" in
15067 "$define")
15068         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15069         case "$d_localtime_r_proto:$usethreads" in
15070         ":define")      d_localtime_r_proto=define
15071                 set d_localtime_r_proto localtime_r $hdrs
15072                 eval $hasproto ;;
15073         *)      ;;
15074         esac
15075         case "$d_localtime_r_proto" in
15076         define)
15077         case "$localtime_r_proto" in
15078         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15079         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15080         esac
15081         case "$localtime_r_proto" in
15082         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15083         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15084         esac
15085         case "$localtime_r_proto" in
15086         ''|0)   d_localtime_r=undef
15087                 localtime_r_proto=0
15088                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15089         * )     case "$localtime_r_proto" in
15090                 REENTRANT_PROTO*) ;;
15091                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15092                 esac
15093                 echo "Prototype: $try" ;;
15094         esac
15095         ;;
15096         *)      case "$usethreads" in
15097                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15098                 esac
15099                 d_localtime_r=undef
15100                 localtime_r_proto=0
15101                 ;;
15102         esac
15103         ;;
15104 *)      localtime_r_proto=0
15105         ;;
15106 esac
15107
15108 : see if localtime_r calls tzset
15109 case "$localtime_r_proto" in
15110 REENTRANT_PROTO*)
15111         $cat >try.c <<EOCP
15112 /*  Does our libc's localtime_r call tzset ?
15113  *  return 0 if so, 1 otherwise.
15114  */
15115 #$i_systypes    I_SYS_TYPES
15116 #$i_unistd      I_UNISTD
15117 #$i_time        I_TIME
15118 #$i_stdlib      I_STDLIB
15119 #$i_string      I_STRING
15120 #$i_malloc      I_MALLOC
15121 #ifdef I_SYS_TYPES
15122 #  include <sys/types.h>
15123 #endif
15124 #ifdef I_UNISTD
15125 #  include <unistd.h>
15126 #endif
15127 #ifdef I_TIME
15128 #  include <time.h>
15129 #endif
15130 #ifdef I_STDLIB
15131 #include <stdlib.h>
15132 #endif
15133 #ifdef I_STRING
15134 #  include <string.h>
15135 #else
15136 #  include <strings.h>
15137 #endif
15138 #ifdef I_MALLOC
15139 #  include <malloc.h>
15140 #endif
15141 int main()
15142 {
15143     time_t t = time(0L);
15144     char w_tz[]="TZ" "=GMT+5",
15145          e_tz[]="TZ" "=GMT-5",
15146         *tz_e = (char*)malloc(16),
15147         *tz_w = (char*)malloc(16);
15148     struct tm tm_e, tm_w;
15149     memset(&tm_e,'\0',sizeof(struct tm));
15150     memset(&tm_w,'\0',sizeof(struct tm));
15151     strcpy(tz_e,e_tz);
15152     strcpy(tz_w,w_tz);
15153
15154     putenv(tz_e);
15155     localtime_r(&t, &tm_e);
15156
15157     putenv(tz_w);
15158     localtime_r(&t, &tm_w);
15159
15160     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15161         return 1;
15162     return 0;
15163 }
15164 EOCP
15165         set try
15166         if eval $compile; then
15167             if $run ./try; then
15168                 d_localtime_r_needs_tzset=undef;
15169             else
15170                 d_localtime_r_needs_tzset=define;
15171             fi;
15172         else
15173             d_localtime_r_needs_tzset=undef;
15174         fi;
15175      ;;
15176   *)
15177      d_localtime_r_needs_tzset=undef;
15178      ;;
15179 esac
15180 $rm_try
15181
15182 : see if localeconv exists
15183 set localeconv d_locconv
15184 eval $inlibc
15185
15186 : see if lockf exists
15187 set lockf d_lockf
15188 eval $inlibc
15189
15190 : see if prototype for lseek is available
15191 echo " "
15192 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15193 eval $hasproto
15194
15195 : see if lstat exists
15196 set lstat d_lstat
15197 eval $inlibc
15198
15199 : see if madvise exists
15200 set madvise d_madvise
15201 eval $inlibc
15202
15203 : see if malloc_size exists
15204 set malloc_size d_malloc_size
15205 eval $inlibc
15206
15207 : see if malloc_size_good exists
15208 set malloc_good_size d_malloc_good_size
15209 eval $inlibc
15210
15211 : see if mblen exists
15212 set mblen d_mblen
15213 eval $inlibc
15214
15215 : see if mbstowcs exists
15216 set mbstowcs d_mbstowcs
15217 eval $inlibc
15218
15219 : see if mbtowc exists
15220 set mbtowc d_mbtowc
15221 eval $inlibc
15222
15223 : see if memchr exists
15224 set memchr d_memchr
15225 eval $inlibc
15226
15227 : see if memcmp exists
15228 set memcmp d_memcmp
15229 eval $inlibc
15230
15231 : see if memcpy exists
15232 set memcpy d_memcpy
15233 eval $inlibc
15234
15235 : see if memmove exists
15236 set memmove d_memmove
15237 eval $inlibc
15238
15239 : see if memset exists
15240 set memset d_memset
15241 eval $inlibc
15242
15243 : see if mkdir exists
15244 set mkdir d_mkdir
15245 eval $inlibc
15246
15247 : see if mkdtemp exists
15248 set mkdtemp d_mkdtemp
15249 eval $inlibc
15250
15251 : see if mkfifo exists
15252 set mkfifo d_mkfifo
15253 eval $inlibc
15254
15255 : see if mkstemp exists
15256 set mkstemp d_mkstemp
15257 eval $inlibc
15258
15259 : see if mkstemps exists
15260 set mkstemps d_mkstemps
15261 eval $inlibc
15262
15263 : see if mktime exists
15264 set mktime d_mktime
15265 eval $inlibc
15266
15267 : see if this is a sys/mman.h system
15268 set sys/mman.h i_sysmman
15269 eval $inhdr
15270
15271 : see if mmap exists
15272 set mmap d_mmap
15273 eval $inlibc
15274 : see what shmat returns
15275 : default to something harmless
15276 mmaptype='void *'
15277 case "$i_sysmman$d_mmap" in
15278 "$define$define")
15279         $cat >mmap.c <<'END'
15280 #include <sys/mman.h>
15281 void *mmap();
15282 END
15283         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15284                 mmaptype='void *'
15285         else
15286                 mmaptype='caddr_t'
15287         fi
15288         echo "and it returns ($mmaptype)." >&4
15289         ;;
15290 esac
15291
15292
15293
15294 : see if sqrtl exists
15295 set sqrtl d_sqrtl
15296 eval $inlibc
15297
15298 : see if scalbnl exists
15299 set scalbnl d_scalbnl
15300 eval $inlibc
15301
15302 : see if modfl exists
15303 set modfl d_modfl
15304 eval $inlibc
15305
15306 : see if prototype for modfl is available
15307 echo " "
15308 set d_modflproto modfl $i_math math.h
15309 eval $hasproto
15310
15311 d_modfl_pow32_bug="$undef"
15312
15313 case "$d_longdbl$d_modfl" in
15314 $define$define)
15315         $cat <<EOM
15316 Checking to see whether your modfl() is okay for large values...
15317 EOM
15318 $cat >try.c <<EOCP
15319 #include <math.h>
15320 #include <stdio.h>
15321 EOCP
15322 if $test "X$d_modflproto" != "X$define"; then
15323         $cat >>try.c <<EOCP
15324 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15325 long double modfl (long double, long double *);
15326 EOCP
15327 fi
15328 $cat >>try.c <<EOCP
15329 int main() {
15330     long double nv = 4294967303.15;
15331     long double v, w;
15332     v = modfl(nv, &w);
15333 #ifdef __GLIBC__
15334     printf("glibc");
15335 #endif
15336     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15337     return 0;
15338 }
15339 EOCP
15340         case "$osname:$gccversion" in
15341         aix:)   saveccflags="$ccflags"
15342                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15343         esac
15344         set try
15345         if eval $compile; then
15346                 foo=`$run ./try`
15347                 case "$foo" in
15348                 *" 4294967303.150000 1.150000 4294967302.000000")
15349                         echo >&4 "Your modfl() is broken for large values."
15350                         d_modfl_pow32_bug="$define"
15351                         case "$foo" in
15352                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15353                         ;;
15354                         esac
15355                         ;;
15356                 *" 4294967303.150000 0.150000 4294967303.000000")
15357                         echo >&4 "Your modfl() seems okay for large values."
15358                         ;;
15359                 *)      echo >&4 "I don't understand your modfl() at all."
15360                         d_modfl="$undef"
15361                         ;;
15362                 esac
15363                 $rm_try
15364         else
15365                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15366                 d_modfl="$undef"
15367         fi
15368         case "$osname:$gccversion" in
15369         aix:)   ccflags="$saveccflags" ;; # restore
15370         esac
15371         ;;
15372 esac
15373
15374 if $test "$uselongdouble" = "$define"; then
15375     message=""
15376     if $test "$d_sqrtl" != "$define"; then
15377         message="$message sqrtl"
15378     fi
15379     if $test "$d_modfl" != "$define"; then
15380         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15381             echo "You have both aintl and copysignl, so I can emulate modfl."
15382         else
15383             message="$message modfl"
15384         fi
15385     fi
15386     if $test "$d_frexpl" != "$define"; then
15387         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15388             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15389         else
15390             message="$message frexpl"
15391         fi
15392     fi
15393
15394     if $test "$message" != ""; then
15395         $cat <<EOM >&4
15396
15397 *** You requested the use of long doubles but you do not seem to have
15398 *** the following mathematical functions needed for long double support:
15399 ***    $message
15400 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15401 *** Cannot continue, aborting.
15402
15403 EOM
15404
15405         exit 1
15406     fi
15407 fi
15408
15409 : see if mprotect exists
15410 set mprotect d_mprotect
15411 eval $inlibc
15412
15413 : see if msgctl exists
15414 set msgctl d_msgctl
15415 eval $inlibc
15416
15417 : see if msgget exists
15418 set msgget d_msgget
15419 eval $inlibc
15420
15421 : see if msgsnd exists
15422 set msgsnd d_msgsnd
15423 eval $inlibc
15424
15425 : see if msgrcv exists
15426 set msgrcv d_msgrcv
15427 eval $inlibc
15428
15429 : see how much of the 'msg*(2)' library is present.
15430 h_msg=true
15431 echo " "
15432 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15433 *"$undef"*) h_msg=false;;
15434 esac
15435 case "$osname" in
15436 freebsd)
15437     case "`ipcs 2>&1`" in
15438     "SVID messages"*"not configured"*)
15439         echo "Your $osname does not have the msg*(2) configured." >&4
15440         h_msg=false
15441         val="$undef"
15442         set msgctl d_msgctl
15443         eval $setvar
15444         set msgget d_msgget
15445         eval $setvar
15446         set msgsnd d_msgsnd
15447         eval $setvar
15448         set msgrcv d_msgrcv
15449         eval $setvar
15450         ;;
15451     esac
15452     ;;
15453 esac
15454 : we could also check for sys/ipc.h ...
15455 if $h_msg && $test `./findhdr sys/msg.h`; then
15456         echo "You have the full msg*(2) library." >&4
15457         val="$define"
15458 else
15459         echo "You don't have the full msg*(2) library." >&4
15460         val="$undef"
15461 fi
15462 set d_msg
15463 eval $setvar
15464
15465 : Check for msghdr_s
15466 echo " "
15467 echo "Checking to see if your system supports struct msghdr..." >&4
15468 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15469 eval $hasstruct
15470 case "$d_msghdr_s" in
15471 "$define")      echo "Yes, it does."   ;;
15472 *)              echo "No, it doesn't." ;;
15473 esac
15474
15475
15476 : see if msync exists
15477 set msync d_msync
15478 eval $inlibc
15479
15480 : see if munmap exists
15481 set munmap d_munmap
15482 eval $inlibc
15483
15484 : see if nice exists
15485 set nice d_nice
15486 eval $inlibc
15487
15488 : see if this is a langinfo.h system
15489 set langinfo.h i_langinfo
15490 eval $inhdr
15491
15492 : see if nl_langinfo exists
15493 set nl_langinfo d_nl_langinfo
15494 eval $inlibc
15495
15496 : check for volatile keyword
15497 echo " "
15498 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15499 $cat >try.c <<'EOCP'
15500 int main()
15501 {
15502         typedef struct _goo_struct goo_struct;
15503         goo_struct * volatile goo = ((goo_struct *)0);
15504         struct _goo_struct {
15505                 long long_int;
15506                 int reg_int;
15507                 char char_var;
15508         };
15509         typedef unsigned short foo_t;
15510         char *volatile foo;
15511         volatile int bar;
15512         volatile foo_t blech;
15513         foo = foo;
15514 }
15515 EOCP
15516 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15517         val="$define"
15518         echo "Yup, it does."
15519 else
15520         val="$undef"
15521         echo "Nope, it doesn't."
15522 fi
15523 set d_volatile
15524 eval $setvar
15525 $rm_try
15526
15527 : Check basic sizes
15528 echo " "
15529 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15530
15531 case "$use64bitint:$d_quad:$quadtype" in
15532 define:define:?*)
15533         ivtype="$quadtype"
15534         uvtype="$uquadtype"
15535         ivsize=8
15536         uvsize=8
15537         ;;
15538 *)      ivtype="long"
15539         uvtype="unsigned long"
15540         ivsize=$longsize
15541         uvsize=$longsize
15542         ;;
15543 esac
15544
15545 case "$uselongdouble:$d_longdbl" in
15546 define:define)
15547         nvtype="long double"
15548         nvsize=$longdblsize
15549         ;;
15550 *)      nvtype=double
15551         nvsize=$doublesize
15552         ;;
15553 esac
15554
15555 $echo "(IV will be "$ivtype", $ivsize bytes)"
15556 $echo "(UV will be "$uvtype", $uvsize bytes)"
15557 $echo "(NV will be "$nvtype", $nvsize bytes)"
15558
15559 $cat >try.c <<EOCP
15560 #$i_inttypes I_INTTYPES
15561 #ifdef I_INTTYPES
15562 #include <inttypes.h>
15563 #endif
15564 #include <stdio.h>
15565 int main() {
15566 #ifdef INT8
15567    int8_t i =  INT8_MAX;
15568   uint8_t u = UINT8_MAX;
15569   printf("int8_t\n");
15570 #endif
15571 #ifdef INT16
15572    int16_t i =  INT16_MAX;
15573   uint16_t i = UINT16_MAX;
15574   printf("int16_t\n");
15575 #endif
15576 #ifdef INT32
15577    int32_t i =  INT32_MAX;
15578   uint32_t u = UINT32_MAX;
15579   printf("int32_t\n");
15580 #endif
15581 }
15582 EOCP
15583
15584 i8type="signed char"
15585 u8type="unsigned char"
15586 i8size=1
15587 u8size=1
15588
15589 case "$i16type" in
15590 '')     case "$shortsize" in
15591         2)      i16type=short
15592                 u16type="unsigned short"
15593                 i16size=$shortsize
15594                 u16size=$shortsize
15595                 ;;
15596         esac
15597         ;;
15598 esac
15599 case "$i16type" in
15600 '')     set try -DINT16
15601         if eval $compile; then
15602                 case "`$run ./try`" in
15603                 int16_t)
15604                         i16type=int16_t
15605                         u16type=uint16_t
15606                         i16size=2
15607                         u16size=2
15608                         ;;
15609                 esac
15610         fi
15611         ;;
15612 esac
15613 case "$i16type" in
15614 '')     if $test $shortsize -ge 2; then
15615                 i16type=short
15616                 u16type="unsigned short"
15617                 i16size=$shortsize
15618                 u16size=$shortsize
15619         fi
15620         ;;
15621 esac
15622
15623 case "$i32type" in
15624 '')     case "$longsize" in
15625         4)      i32type=long
15626                 u32type="unsigned long"
15627                 i32size=$longsize
15628                 u32size=$longsize
15629                 ;;
15630         *)      case "$intsize" in
15631                 4)      i32type=int
15632                         u32type="unsigned int"
15633                         i32size=$intsize
15634                         u32size=$intsize
15635                         ;;
15636                 esac
15637                 ;;
15638         esac
15639         ;;
15640 esac
15641 case "$i32type" in
15642 '')     set try -DINT32
15643         if eval $compile; then
15644                 case "`$run ./try`" in
15645                 int32_t)
15646                         i32type=int32_t
15647                         u32type=uint32_t
15648                         i32size=4
15649                         u32size=4
15650                         ;;
15651                 esac
15652         fi
15653         ;;
15654 esac
15655 case "$i32type" in
15656 '')     if $test $intsize -ge 4; then
15657                 i32type=int
15658                 u32type="unsigned int"
15659                 i32size=$intsize
15660                 u32size=$intsize
15661         fi
15662         ;;
15663 esac
15664
15665 case "$i64type" in
15666 '')     case "$d_quad:$quadtype" in
15667         define:?*)
15668                 i64type="$quadtype"
15669                 u64type="$uquadtype"
15670                 i64size=8
15671                 u64size=8
15672                 ;;
15673         esac
15674         ;;
15675 esac
15676
15677 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15678 : volatile so that the compiler has to store it out to memory.
15679 if test X"$d_volatile" = X"$define"; then
15680         volatile=volatile
15681 fi
15682 $cat <<EOP >try.c
15683 #include <stdio.h>
15684 #$i_stdlib I_STDLIB
15685 #ifdef I_STDLIB
15686 #include <stdlib.h>
15687 #endif
15688 #include <sys/types.h>
15689 #include <signal.h>
15690 #ifdef SIGFPE
15691 $volatile int bletched = 0;
15692 $signal_t blech(int s) { bletched = 1; }
15693 #endif
15694 int main() {
15695     $uvtype u = 0;
15696     $nvtype d;
15697     int     n = 8 * $uvsize;
15698     int     i;
15699 #ifdef SIGFPE
15700     signal(SIGFPE, blech);
15701 #endif
15702
15703     for (i = 0; i < n; i++) {
15704       u = u << 1 | ($uvtype)1;
15705       d = ($nvtype)u;
15706       if (($uvtype)d != u)
15707         break;
15708       if (d <= 0)
15709         break;
15710       d = ($nvtype)(u - 1);
15711       if (($uvtype)d != (u - 1))
15712         break;
15713 #ifdef SIGFPE
15714       if (bletched)
15715         break;
15716 #endif
15717     }
15718     printf("%d\n", ((i == n) ? -n : i));
15719     exit(0);
15720 }
15721 EOP
15722 set try
15723
15724 d_nv_preserves_uv="$undef"
15725 if eval $compile; then
15726         nv_preserves_uv_bits="`$run ./try`"
15727 fi
15728 case "$nv_preserves_uv_bits" in
15729 \-[1-9]*)
15730         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15731         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15732         d_nv_preserves_uv="$define"
15733         ;;
15734 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15735         d_nv_preserves_uv="$undef" ;;
15736 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15737         nv_preserves_uv_bits="0" ;;
15738 esac
15739 $rm_try
15740
15741 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15742 : volatile so that the compiler has to store it out to memory.
15743 if test X"$d_volatile" = X"$define"; then
15744         volatile=volatile
15745 fi
15746 $cat <<EOP >try.c
15747 #include <stdio.h>
15748
15749 typedef $nvtype NV;
15750
15751 int
15752 main() {
15753   NV value = 2;
15754   int count = 1;
15755
15756   while(count < 256) {
15757     $volatile NV up = value + 1.0;
15758     $volatile NV negated = -value;
15759     $volatile NV down = negated - 1.0;
15760     $volatile NV got_up = up - value;
15761     int up_good = got_up == 1.0;
15762     int got_down = down - negated;
15763     int down_good = got_down == -1.0;
15764
15765     if (down_good != up_good) {
15766       fprintf(stderr,
15767               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15768               up_good, (double) got_up, down_good, (double) got_down,
15769               count, (double) value);
15770       return 1;
15771     }
15772     if (!up_good) {
15773       while (1) {
15774         if (count > 8) {
15775           count -= 8;
15776           fputs("256.0", stdout);
15777         } else {
15778           count--;
15779           fputs("2.0", stdout);
15780         }
15781         if (!count) {
15782           puts("");
15783           return 0;
15784         }
15785         fputs("*", stdout);
15786       }
15787     }
15788     value *= 2;
15789     ++count;
15790   }
15791   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15792           count, (double) value);
15793   return 1;
15794 }
15795 EOP
15796 set try
15797
15798 nv_overflows_integers_at='0'
15799 if eval $compile; then
15800     xxx="`$run ./try`"
15801     case "$?" in
15802         0)
15803             case "$xxx" in
15804                 2*)  cat >&4 <<EOM
15805 The largest integer your NVs can preserve is equal to $xxx
15806 EOM
15807                     nv_overflows_integers_at="$xxx"
15808                     ;;
15809                 *)  cat >&4 <<EOM
15810 Cannot determine the largest integer value your NVs can hold, unexpected output
15811 '$xxx'
15812 EOM
15813                     ;;
15814             esac
15815             ;;
15816         *)  cat >&4 <<EOM
15817 Cannot determine the largest integer value your NVs can hold
15818 EOM
15819             ;;
15820     esac
15821 fi
15822 $rm_try
15823
15824 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15825 : volatile so that the compiler has to store it out to memory.
15826 if test X"$d_volatile" = X"$define"; then
15827         volatile=volatile
15828 fi
15829 $cat <<EOP >try.c
15830 #include <stdio.h>
15831 #$i_stdlib I_STDLIB
15832 #ifdef I_STDLIB
15833 #include <stdlib.h>
15834 #endif
15835 #$i_string I_STRING
15836 #ifdef I_STRING
15837 #  include <string.h>
15838 #else
15839 #  include <strings.h>
15840 #endif
15841 #include <sys/types.h>
15842 #include <signal.h>
15843 #ifdef SIGFPE
15844 $volatile int bletched = 0;
15845 $signal_t blech(int s) { bletched = 1; }
15846 #endif
15847
15848 int checkit($nvtype d, char *where) {
15849     unsigned char *p = (char *)&d;
15850     unsigned char *end = p + sizeof(d);
15851     int fail = 0;
15852
15853     while (p < end)
15854         fail += *p++;
15855
15856     if (!fail)
15857         return 0;
15858
15859     p = (char *)&d;
15860     printf("No - %s: 0x", where);
15861     while (p < end)
15862         printf ("%02X", *p++);
15863     printf("\n");
15864     return 1;
15865 }
15866
15867 int main(int argc, char **argv) {
15868     $nvtype d = 0.0;
15869     int fail = 0;
15870     fail += checkit(d, "0.0");
15871
15872     /* The compiler shouldn't be assuming that bletched is 0  */
15873     d = bletched;
15874
15875     fail += checkit(d, "bleched");
15876
15877 #ifdef SIGFPE
15878     signal(SIGFPE, blech);
15879 #endif
15880
15881     /* Paranoia - the compiler should have no way of knowing that ANSI says
15882        that argv[argc] will always be NULL.  Actually, if it did assume this it
15883        would be buggy, as this is C and main() can be called from elsewhere in
15884        the program.  */
15885     d = argv[argc] ? 1 : 0;
15886
15887     if (d) {
15888         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15889     }
15890
15891     fail += checkit(d, "ternary");
15892
15893     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15894
15895     if (d != 0.0) {
15896         printf("No - memset doesn't give 0.0\n");
15897         /* This might just blow up:  */
15898         printf("(gives %g)\n", d);
15899         return 1;
15900     }
15901
15902 #ifdef SIGFPE
15903     if (bletched) {
15904         printf("No - something bleched\n");
15905         return 1;
15906     }
15907 #endif
15908     if (fail) {
15909       printf("No - %d fail(s)\n", fail);
15910       return 1;
15911     }
15912     printf("Yes\n");
15913     return 0;
15914 }
15915 EOP
15916 set try
15917
15918 d_nv_zero_is_allbits_zero="$undef"
15919 if eval $compile; then
15920     xxx="`$run ./try`"
15921     case "$?" in
15922         0)
15923             case "$xxx" in
15924                 Yes)  cat >&4 <<EOM
15925 0.0 is represented as all bits zero in memory
15926 EOM
15927                     d_nv_zero_is_allbits_zero="$define"
15928                     ;;
15929                 *)  cat >&4 <<EOM
15930 0.0 is not represented as all bits zero in memory
15931 EOM
15932                     d_nv_zero_is_allbits_zero="$undef"
15933                     ;;
15934             esac
15935             ;;
15936         *)  cat >&4 <<EOM
15937 0.0 is not represented as all bits zero in memory
15938 EOM
15939             d_nv_zero_is_allbits_zero="$undef"
15940             ;;
15941     esac
15942 fi
15943 $rm_try
15944
15945 : check for off64_t
15946 echo " "
15947 echo "Checking to see if you have off64_t..." >&4
15948 $cat >try.c <<EOCP
15949 #include <sys/types.h>
15950 #include <unistd.h>
15951 int main() { off64_t x = 7; }
15952 EOCP
15953 set try
15954 if eval $compile; then
15955         val="$define"
15956         echo "You have off64_t."
15957 else
15958         val="$undef"
15959         echo "You do not have off64_t."
15960         case "$lseeksize" in
15961         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15962         esac
15963 fi
15964 $rm_try
15965 set d_off64_t
15966 eval $setvar
15967
15968 : how to create joinable pthreads
15969 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15970         echo " "
15971         echo "Checking what constant to use for creating joinable pthreads..." >&4
15972         $cat >try.c <<'EOCP'
15973 #include <pthread.h>
15974 int main() {
15975     int detachstate = JOINABLE;
15976 }
15977 EOCP
15978         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15979         if eval $compile; then
15980                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15981                 val="$undef" # Yes, undef.
15982                 set d_old_pthread_create_joinable
15983                 eval $setvar
15984                 val=""
15985                 set old_pthread_create_joinable
15986                 eval $setvar
15987         else
15988                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15989                 if eval $compile; then
15990                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15991                         val="$define"
15992                         set d_old_pthread_create_joinable
15993                         eval $setvar
15994                         val=PTHREAD_CREATE_UNDETACHED
15995                         set old_pthread_create_joinable
15996                         eval $setvar
15997                 else
15998                         set try -DJOINABLE=__UNDETACHED
15999                         if eval $compile; then
16000                                 echo "You seem to use __UNDETACHED." >&4
16001                                 val="$define"
16002                                 set d_old_pthread_create_joinable
16003                                 eval $setvar
16004                                 val=__UNDETACHED
16005                                 set old_pthread_create_joinable
16006                                 eval $setvar
16007                         else
16008                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16009                                 val="$define"
16010                                 set d_old_pthread_create_joinable
16011                                 eval $setvar
16012                                 val=0
16013                                 set old_pthread_create_joinable
16014                                 eval $setvar
16015                         fi
16016                 fi
16017         fi
16018         $rm_try
16019 else
16020     d_old_pthread_create_joinable="$undef"
16021     old_pthread_create_joinable=""
16022 fi
16023
16024 : see if pause exists
16025 set pause d_pause
16026 eval $inlibc
16027
16028 : see if poll exists
16029 set poll d_poll
16030 eval $inlibc
16031
16032 : see if readlink exists
16033 set readlink d_readlink
16034 eval $inlibc
16035
16036 : Check if exe is symlink to abs path of executing program
16037 echo " "
16038 procselfexe=''
16039 val="$undef"
16040 case "$d_readlink" in
16041 "$define")
16042         if $issymlink /proc/self/exe ; then
16043                 $ls -l /proc/self/exe > reflect
16044                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16045                         echo "You have Linux-like /proc/self/exe."
16046                         procselfexe='"/proc/self/exe"'
16047                         val="$define"
16048                 fi
16049         fi
16050         if $issymlink /proc/curproc/file ; then
16051                 $ls -l /proc/curproc/file > reflect
16052                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16053                         echo "You have BSD-like /proc/curproc/file."
16054                         procselfexe='"/proc/curproc/file"'
16055                         val="$define"
16056                 fi
16057         fi
16058         ;;
16059 esac
16060 $rm -f reflect
16061 set d_procselfexe
16062 eval $setvar
16063
16064 : backward compatibility for d_hvfork
16065 if test X$d_hvfork != X; then
16066         d_vfork="$d_hvfork"
16067         d_hvfork=''
16068 fi
16069 : see if there is a vfork
16070 val=''
16071 set vfork val
16072 eval $inlibc
16073
16074 d_pseudofork=$undef
16075
16076 : Ok, but do we want to use it. vfork is reportedly unreliable in
16077 : perl on Solaris 2.x, and probably elsewhere.
16078 case "$val" in
16079 $define)
16080         echo " "
16081         case "$usevfork" in
16082         false) dflt='n';;
16083         *) dflt='y';;
16084         esac
16085         cat <<'EOM'
16086
16087 Perl can only use a vfork() that doesn't suffer from strict
16088 restrictions on calling functions or modifying global data in
16089 the child.  For example, glibc-2.1 contains such a vfork()
16090 that is unsuitable.  If your system provides a proper fork()
16091 call, chances are that you do NOT want perl to use vfork().
16092
16093 EOM
16094         rp="Do you still want to use vfork()?"
16095         . ./myread
16096         case "$ans" in
16097         y|Y) ;;
16098         *)
16099                 echo "Ok, we won't use vfork()."
16100                 val="$undef"
16101                 ;;
16102         esac
16103         ;;
16104 esac
16105 set d_vfork
16106 eval $setvar
16107 case "$d_vfork" in
16108 $define) usevfork='true';;
16109 *) usevfork='false';;
16110 esac
16111
16112 : see whether the pthread_atfork exists
16113 $cat >try.c <<EOP
16114 #include <pthread.h>
16115 #include <stdio.h>
16116 int main() {
16117 #ifdef  PTHREAD_ATFORK
16118         pthread_atfork(NULL,NULL,NULL);
16119 #endif
16120 }
16121 EOP
16122
16123 : see if pthread_atfork exists
16124 set try -DPTHREAD_ATFORK
16125 if eval $compile; then
16126     val="$define"
16127 else
16128     val="$undef"
16129 fi
16130 case "$usethreads" in
16131 $define)
16132         case "$val" in
16133         $define) echo 'pthread_atfork found.' >&4        ;;
16134         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16135         esac
16136 esac
16137 set d_pthread_atfork
16138 eval $setvar
16139
16140 : see if pthread_attr_setscope exists
16141 set pthread_attr_setscope d_pthread_attr_setscope
16142 eval $inlibc
16143
16144 : see whether the various POSIXish _yields exist
16145 $cat >try.c <<EOP
16146 #include <pthread.h>
16147 #include <stdio.h>
16148 int main() {
16149 #ifdef SCHED_YIELD
16150         sched_yield();
16151 #else
16152 #ifdef PTHREAD_YIELD
16153         pthread_yield();
16154 #else
16155 #ifdef PTHREAD_YIELD_NULL
16156         pthread_yield(NULL);
16157 #endif
16158 #endif
16159 #endif
16160 }
16161 EOP
16162 : see if sched_yield exists
16163 set try -DSCHED_YIELD
16164 if eval $compile; then
16165     val="$define"
16166     sched_yield='sched_yield()'
16167 else
16168     val="$undef"
16169 fi
16170 case "$usethreads" in
16171 $define)
16172         case "$val" in
16173         $define) echo 'sched_yield() found.' >&4        ;;
16174         *)       echo 'sched_yield() NOT found.' >&4    ;;
16175         esac
16176 esac
16177 set d_sched_yield
16178 eval $setvar
16179
16180 : see if pthread_yield exists
16181 set try -DPTHREAD_YIELD
16182 if eval $compile; then
16183     val="$define"
16184     case "$sched_yield" in
16185     '') sched_yield='pthread_yield()' ;;
16186     esac
16187 else
16188     set try -DPTHREAD_YIELD_NULL
16189     if eval $compile; then
16190         val="$define"
16191         case "$sched_yield" in
16192         '') sched_yield='pthread_yield(NULL)' ;;
16193         esac
16194     else
16195         val="$undef"
16196     fi
16197 fi
16198 case "$usethreads" in
16199 $define)
16200         case "$val" in
16201         $define) echo 'pthread_yield() found.' >&4      ;;
16202         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16203         esac
16204         ;;
16205 esac
16206 set d_pthread_yield
16207 eval $setvar
16208 case "$sched_yield" in
16209 '') sched_yield=undef ;;
16210 esac
16211 $rm_try
16212
16213 : see if random_r exists
16214 set random_r d_random_r
16215 eval $inlibc
16216 case "$d_random_r" in
16217 "$define")
16218         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16219         case "$d_random_r_proto:$usethreads" in
16220         ":define")      d_random_r_proto=define
16221                 set d_random_r_proto random_r $hdrs
16222                 eval $hasproto ;;
16223         *)      ;;
16224         esac
16225         case "$d_random_r_proto" in
16226         define)
16227         case "$random_r_proto" in
16228         ''|0) try='int random_r(int*, struct random_data*);'
16229         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16230         esac
16231         case "$random_r_proto" in
16232         ''|0) try='int random_r(long*, struct random_data*);'
16233         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16234         esac
16235         case "$random_r_proto" in
16236         ''|0) try='int random_r(struct random_data*, int32_t*);'
16237         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16238         esac
16239         case "$random_r_proto" in
16240         ''|0)   d_random_r=undef
16241                 random_r_proto=0
16242                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16243         * )     case "$random_r_proto" in
16244                 REENTRANT_PROTO*) ;;
16245                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16246                 esac
16247                 echo "Prototype: $try" ;;
16248         esac
16249         ;;
16250         *)      case "$usethreads" in
16251                 define) echo "random_r has no prototype, not using it." >&4 ;;
16252                 esac
16253                 d_random_r=undef
16254                 random_r_proto=0
16255                 ;;
16256         esac
16257         ;;
16258 *)      random_r_proto=0
16259         ;;
16260 esac
16261
16262 : see if readdir and friends exist
16263 set readdir d_readdir
16264 eval $inlibc
16265 set seekdir d_seekdir
16266 eval $inlibc
16267 set telldir d_telldir
16268 eval $inlibc
16269 set rewinddir d_rewinddir
16270 eval $inlibc
16271
16272 : see if readdir64_r exists
16273 set readdir64_r d_readdir64_r
16274 eval $inlibc
16275 case "$d_readdir64_r" in
16276 "$define")
16277         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16278         case "$d_readdir64_r_proto:$usethreads" in
16279         ":define")      d_readdir64_r_proto=define
16280                 set d_readdir64_r_proto readdir64_r $hdrs
16281                 eval $hasproto ;;
16282         *)      ;;
16283         esac
16284         case "$d_readdir64_r_proto" in
16285         define)
16286         case "$readdir64_r_proto" in
16287         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16288         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16289         esac
16290         case "$readdir64_r_proto" in
16291         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16292         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16293         esac
16294         case "$readdir64_r_proto" in
16295         ''|0)   d_readdir64_r=undef
16296                 readdir64_r_proto=0
16297                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16298         * )     case "$readdir64_r_proto" in
16299                 REENTRANT_PROTO*) ;;
16300                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16301                 esac
16302                 echo "Prototype: $try" ;;
16303         esac
16304         ;;
16305         *)      case "$usethreads" in
16306                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16307                 esac
16308                 d_readdir64_r=undef
16309                 readdir64_r_proto=0
16310                 ;;
16311         esac
16312         ;;
16313 *)      readdir64_r_proto=0
16314         ;;
16315 esac
16316
16317 : see if readdir_r exists
16318 set readdir_r d_readdir_r
16319 eval $inlibc
16320 case "$d_readdir_r" in
16321 "$define")
16322         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16323         case "$d_readdir_r_proto:$usethreads" in
16324         ":define")      d_readdir_r_proto=define
16325                 set d_readdir_r_proto readdir_r $hdrs
16326                 eval $hasproto ;;
16327         *)      ;;
16328         esac
16329         case "$d_readdir_r_proto" in
16330         define)
16331         case "$readdir_r_proto" in
16332         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16333         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16334         esac
16335         case "$readdir_r_proto" in
16336         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16337         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16338         esac
16339         case "$readdir_r_proto" in
16340         ''|0)   d_readdir_r=undef
16341                 readdir_r_proto=0
16342                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16343         * )     case "$readdir_r_proto" in
16344                 REENTRANT_PROTO*) ;;
16345                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16346                 esac
16347                 echo "Prototype: $try" ;;
16348         esac
16349         ;;
16350         *)      case "$usethreads" in
16351                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16352                 esac
16353                 d_readdir_r=undef
16354                 readdir_r_proto=0
16355                 ;;
16356         esac
16357         ;;
16358 *)      readdir_r_proto=0
16359         ;;
16360 esac
16361
16362 : see if readv exists
16363 set readv d_readv
16364 eval $inlibc
16365
16366 : see if recvmsg exists
16367 set recvmsg d_recvmsg
16368 eval $inlibc
16369
16370 : see if rename exists
16371 set rename d_rename
16372 eval $inlibc
16373
16374 : see if rmdir exists
16375 set rmdir d_rmdir
16376 eval $inlibc
16377
16378 : see if memory.h is available.
16379 val=''
16380 set memory.h val
16381 eval $inhdr
16382
16383 : See if it conflicts with string.h
16384 case "$val" in
16385 $define)
16386         case "$strings" in
16387         '') ;;
16388         *)
16389                 $cppstdin $cppflags $cppminus < $strings > mem.h
16390                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16391                         echo " "
16392                         echo "We won't be including <memory.h>."
16393                         val="$undef"
16394                 fi
16395                 $rm -f mem.h
16396                 ;;
16397         esac
16398 esac
16399 set i_memory
16400 eval $setvar
16401
16402 : can bcopy handle overlapping blocks?
16403 echo " "
16404 val="$undef"
16405 case "$d_memmove" in
16406 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16407 *)      case "$d_bcopy" in
16408         "$define")
16409                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16410                 $cat >try.c <<EOCP
16411 #$i_memory I_MEMORY
16412 #$i_stdlib I_STDLIB
16413 #$i_string I_STRING
16414 #$i_unistd I_UNISTD
16415 EOCP
16416         $cat >>try.c <<'EOCP'
16417 #include <stdio.h>
16418 #ifdef I_MEMORY
16419 #  include <memory.h>
16420 #endif
16421 #ifdef I_STDLIB
16422 #  include <stdlib.h>
16423 #endif
16424 #ifdef I_STRING
16425 #  include <string.h>
16426 #else
16427 #  include <strings.h>
16428 #endif
16429 #ifdef I_UNISTD
16430 #  include <unistd.h>  /* Needed for NetBSD */
16431 #endif
16432 int main()
16433 {
16434 char buf[128], abc[128];
16435 char *b;
16436 int len;
16437 int off;
16438 int align;
16439
16440 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16441    try to store the string in read-only memory. */
16442 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16443
16444 for (align = 7; align >= 0; align--) {
16445         for (len = 36; len; len--) {
16446                 b = buf+align;
16447                 bcopy(abc, b, len);
16448                 for (off = 1; off <= len; off++) {
16449                         bcopy(b, b+off, len);
16450                         bcopy(b+off, b, len);
16451                         if (bcmp(b, abc, len))
16452                                 exit(1);
16453                 }
16454         }
16455 }
16456 exit(0);
16457 }
16458 EOCP
16459                 set try
16460                 if eval $compile_ok; then
16461                         if $run ./try 2>/dev/null; then
16462                                 echo "Yes, it can."
16463                                 val="$define"
16464                         else
16465                                 echo "It can't, sorry."
16466                         fi
16467                 else
16468                         echo "(I can't compile the test program, so we'll assume not...)"
16469                 fi
16470                 ;;
16471         esac
16472         $rm_try
16473         ;;
16474 esac
16475 set d_safebcpy
16476 eval $setvar
16477
16478 : can memcpy handle overlapping blocks?
16479 echo " "
16480 val="$undef"
16481 case "$d_memmove" in
16482 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16483 *)      case "$d_memcpy" in
16484         "$define")
16485                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16486                 $cat >try.c <<EOCP
16487 #$i_memory I_MEMORY
16488 #$i_stdlib I_STDLIB
16489 #$i_string I_STRING
16490 #$i_unistd I_UNISTD
16491 EOCP
16492         $cat >>try.c <<'EOCP'
16493 #include <stdio.h>
16494 #ifdef I_MEMORY
16495 #  include <memory.h>
16496 #endif
16497 #ifdef I_STDLIB
16498 #  include <stdlib.h>
16499 #endif
16500 #ifdef I_STRING
16501 #  include <string.h>
16502 #else
16503 #  include <strings.h>
16504 #endif
16505 #ifdef I_UNISTD
16506 #  include <unistd.h>  /* Needed for NetBSD */
16507 #endif
16508 int main()
16509 {
16510 char buf[128], abc[128];
16511 char *b;
16512 int len;
16513 int off;
16514 int align;
16515
16516 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16517    try to store the string in read-only memory. */
16518 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16519
16520 for (align = 7; align >= 0; align--) {
16521         for (len = 36; len; len--) {
16522                 b = buf+align;
16523                 memcpy(b, abc, len);
16524                 for (off = 1; off <= len; off++) {
16525                         memcpy(b+off, b, len);
16526                         memcpy(b, b+off, len);
16527                         if (memcmp(b, abc, len))
16528                                 exit(1);
16529                 }
16530         }
16531 }
16532 exit(0);
16533 }
16534 EOCP
16535                 set try
16536                 if eval $compile_ok; then
16537                         if $run ./try 2>/dev/null; then
16538                                 echo "Yes, it can."
16539                                 val="$define"
16540                         else
16541                                 echo "It can't, sorry."
16542                         fi
16543                 else
16544                         echo "(I can't compile the test program, so we'll assume not...)"
16545                 fi
16546                 ;;
16547         esac
16548         $rm_try
16549         ;;
16550 esac
16551 set d_safemcpy
16552 eval $setvar
16553
16554 : can memcmp be trusted to compare relative magnitude?
16555 val="$undef"
16556 case "$d_memcmp" in
16557 "$define")
16558         echo " "
16559         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16560         $cat >try.c <<EOCP
16561 #$i_memory I_MEMORY
16562 #$i_stdlib I_STDLIB
16563 #$i_string I_STRING
16564 #$i_unistd I_UNISTD
16565 EOCP
16566         $cat >>try.c <<'EOCP'
16567 #include <stdio.h>
16568 #ifdef I_MEMORY
16569 #  include <memory.h>
16570 #endif
16571 #ifdef I_STDLIB
16572 #  include <stdlib.h>
16573 #endif
16574 #ifdef I_STRING
16575 #  include <string.h>
16576 #else
16577 #  include <strings.h>
16578 #endif
16579 #ifdef I_UNISTD
16580 #  include <unistd.h>  /* Needed for NetBSD */
16581 #endif
16582 int main()
16583 {
16584 char a = -1;
16585 char b = 0;
16586 if ((a < b) && memcmp(&a, &b, 1) < 0)
16587         exit(1);
16588 exit(0);
16589 }
16590 EOCP
16591         set try
16592         if eval $compile_ok; then
16593                 if $run ./try 2>/dev/null; then
16594                         echo "Yes, it can."
16595                         val="$define"
16596                 else
16597                         echo "No, it can't (it uses signed chars)."
16598                 fi
16599         else
16600                 echo "(I can't compile the test program, so we'll assume not...)"
16601         fi
16602         ;;
16603 esac
16604 $rm_try
16605 set d_sanemcmp
16606 eval $setvar
16607
16608 : see if prototype for sbrk is available
16609 echo " "
16610 set d_sbrkproto sbrk $i_unistd unistd.h
16611 eval $hasproto
16612
16613 : see if select exists
16614 set select d_select
16615 eval $inlibc
16616
16617 : see if semctl exists
16618 set semctl d_semctl
16619 eval $inlibc
16620
16621 : see if semget exists
16622 set semget d_semget
16623 eval $inlibc
16624
16625 : see if semop exists
16626 set semop d_semop
16627 eval $inlibc
16628
16629 : see how much of the 'sem*(2)' library is present.
16630 h_sem=true
16631 echo " "
16632 case "$d_semctl$d_semget$d_semop" in
16633 *"$undef"*) h_sem=false;;
16634 esac
16635 case "$osname" in
16636 freebsd)
16637     case "`ipcs 2>&1`" in
16638     "SVID messages"*"not configured"*)
16639         echo "Your $osname does not have the sem*(2) configured." >&4
16640         h_sem=false
16641         val="$undef"
16642         set semctl d_semctl
16643         eval $setvar
16644         set semget d_semget
16645         eval $setvar
16646         set semop d_semop
16647         eval $setvar
16648         ;;
16649     esac
16650     ;;
16651 esac
16652 : we could also check for sys/ipc.h ...
16653 if $h_sem && $test `./findhdr sys/sem.h`; then
16654         echo "You have the full sem*(2) library." >&4
16655         val="$define"
16656 else
16657         echo "You don't have the full sem*(2) library." >&4
16658         val="$undef"
16659 fi
16660 set d_sem
16661 eval $setvar
16662
16663 : see whether sys/sem.h defines union semun
16664 echo " "
16665 $cat > try.c <<'END'
16666 #include <sys/types.h>
16667 #include <sys/ipc.h>
16668 #include <sys/sem.h>
16669 int main () { union semun semun; semun.buf = 0; }
16670 END
16671 set try
16672 if eval $compile; then
16673     echo "You have union semun in <sys/sem.h>." >&4
16674     val="$define"
16675 else
16676     echo "You do not have union semun in <sys/sem.h>." >&4
16677     val="$undef"
16678 fi
16679 $rm_try
16680 set d_union_semun
16681 eval $setvar
16682
16683 : see how to do semctl IPC_STAT
16684 case "$d_sem" in
16685 $define)
16686     echo " "
16687     $cat > tryh.h <<END
16688 #ifndef S_IRUSR
16689 #   ifdef S_IREAD
16690 #       define S_IRUSR S_IREAD
16691 #       define S_IWUSR S_IWRITE
16692 #       define S_IXUSR S_IEXEC
16693 #   else
16694 #       define S_IRUSR 0400
16695 #       define S_IWUSR 0200
16696 #       define S_IXUSR 0100
16697 #   endif
16698 #   define S_IRGRP (S_IRUSR>>3)
16699 #   define S_IWGRP (S_IWUSR>>3)
16700 #   define S_IXGRP (S_IXUSR>>3)
16701 #   define S_IROTH (S_IRUSR>>6)
16702 #   define S_IWOTH (S_IWUSR>>6)
16703 #   define S_IXOTH (S_IXUSR>>6)
16704 #endif
16705 #ifndef S_IRWXU
16706 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16707 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16708 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16709 #endif
16710 END
16711     : see whether semctl IPC_STAT can use union semun
16712     case "$d_semctl_semun" in
16713     '')
16714       val="$undef"
16715       $cat > try.c <<END
16716 #include <sys/types.h>
16717 #include <sys/ipc.h>
16718 #include <sys/sem.h>
16719 #include <sys/stat.h>
16720 #include <stdio.h>
16721 #include <errno.h>
16722 #include "tryh.h"
16723 #ifndef errno
16724 extern int errno;
16725 #endif
16726 #$d_union_semun HAS_UNION_SEMUN
16727 int main() {
16728     union semun
16729 #ifndef HAS_UNION_SEMUN
16730     {
16731         int val;
16732         struct semid_ds *buf;
16733         unsigned short *array;
16734     }
16735 #endif
16736     arg;
16737     int sem, st;
16738
16739 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16740     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16741     if (sem > -1) {
16742         struct semid_ds argbuf;
16743         arg.buf = &argbuf;
16744 #       ifdef IPC_STAT
16745         st = semctl(sem, 0, IPC_STAT, arg);
16746         if (st == 0)
16747             printf("semun\n");
16748         else
16749 #       endif /* IPC_STAT */
16750             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16751 #       ifdef IPC_RMID
16752         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16753 #       endif /* IPC_RMID */
16754             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16755     } else
16756 #endif /* IPC_PRIVATE && ... */
16757         printf("semget failed: errno = %d\n", errno);
16758   return 0;
16759 }
16760 END
16761       set try
16762       if eval $compile; then
16763           xxx=`$run ./try`
16764           case "$xxx" in
16765           semun) val="$define" ;;
16766           esac
16767       fi
16768       $rm_try
16769       set d_semctl_semun
16770       eval $setvar
16771       ;;
16772     esac
16773     case "$d_semctl_semun" in
16774     $define)
16775         echo "You can use union semun for semctl IPC_STAT." >&4
16776         also='also'
16777         ;;
16778     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16779         also=''
16780         ;;
16781     esac
16782
16783     : see whether semctl IPC_STAT can use struct semid_ds pointer
16784     case "$d_semctl_semid_ds" in
16785     '')
16786       val="$undef"
16787       $cat > try.c <<'END'
16788 #include <sys/types.h>
16789 #include <sys/ipc.h>
16790 #include <sys/sem.h>
16791 #include <sys/stat.h>
16792 #include "tryh.h"
16793 #include <stdio.h>
16794 #include <errno.h>
16795 #ifndef errno
16796 extern int errno;
16797 #endif
16798 int main() {
16799     struct semid_ds arg;
16800     int sem, st;
16801
16802 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16803     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16804     if (sem > -1) {
16805 #       ifdef IPC_STAT
16806         st = semctl(sem, 0, IPC_STAT, &arg);
16807         if (st == 0)
16808             printf("semid_ds\n");
16809         else
16810 #       endif /* IPC_STAT */
16811             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16812 #       ifdef IPC_RMID
16813         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16814 #       endif /* IPC_RMID */
16815             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16816     } else
16817 #endif /* IPC_PRIVATE && ... */
16818         printf("semget failed: errno = %d\n", errno);
16819
16820     return 0;
16821 }
16822 END
16823       set try
16824       if eval $compile; then
16825           xxx=`$run ./try`
16826           case "$xxx" in
16827           semid_ds) val="$define" ;;
16828           esac
16829       fi
16830       $rm_try
16831       set d_semctl_semid_ds
16832       eval $setvar
16833       ;;
16834     esac
16835     case "$d_semctl_semid_ds" in
16836     $define)
16837         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16838         ;;
16839     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16840         ;;
16841     esac
16842     ;;
16843 *)  val="$undef"
16844
16845     # We do not have the full sem*(2) library, so assume we can not
16846     # use either.
16847
16848     set d_semctl_semun
16849     eval $setvar
16850
16851     set d_semctl_semid_ds
16852     eval $setvar
16853     ;;
16854 esac
16855 $rm_try tryh.h
16856
16857 : see if sendmsg exists
16858 set sendmsg d_sendmsg
16859 eval $inlibc
16860
16861 : see if setegid exists
16862 set setegid d_setegid
16863 eval $inlibc
16864
16865 : see if seteuid exists
16866 set seteuid d_seteuid
16867 eval $inlibc
16868
16869 : see if setgrent exists
16870 set setgrent d_setgrent
16871 eval $inlibc
16872
16873 : see if setgrent_r exists
16874 set setgrent_r d_setgrent_r
16875 eval $inlibc
16876 case "$d_setgrent_r" in
16877 "$define")
16878         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16879         case "$d_setgrent_r_proto:$usethreads" in
16880         ":define")      d_setgrent_r_proto=define
16881                 set d_setgrent_r_proto setgrent_r $hdrs
16882                 eval $hasproto ;;
16883         *)      ;;
16884         esac
16885         case "$d_setgrent_r_proto" in
16886         define)
16887         case "$setgrent_r_proto" in
16888         ''|0) try='int setgrent_r(FILE**);'
16889         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16890         esac
16891         case "$setgrent_r_proto" in
16892         ''|0) try='void setgrent_r(FILE**);'
16893         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16894         esac
16895         case "$setgrent_r_proto" in
16896         ''|0)   d_setgrent_r=undef
16897                 setgrent_r_proto=0
16898                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16899         * )     case "$setgrent_r_proto" in
16900                 REENTRANT_PROTO*) ;;
16901                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16902                 esac
16903                 echo "Prototype: $try" ;;
16904         esac
16905         ;;
16906         *)      case "$usethreads" in
16907                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16908                 esac
16909                 d_setgrent_r=undef
16910                 setgrent_r_proto=0
16911                 ;;
16912         esac
16913         ;;
16914 *)      setgrent_r_proto=0
16915         ;;
16916 esac
16917
16918 : see if sethostent exists
16919 set sethostent d_sethent
16920 eval $inlibc
16921
16922 : see if sethostent_r exists
16923 set sethostent_r d_sethostent_r
16924 eval $inlibc
16925 case "$d_sethostent_r" in
16926 "$define")
16927         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16928         case "$d_sethostent_r_proto:$usethreads" in
16929         ":define")      d_sethostent_r_proto=define
16930                 set d_sethostent_r_proto sethostent_r $hdrs
16931                 eval $hasproto ;;
16932         *)      ;;
16933         esac
16934         case "$d_sethostent_r_proto" in
16935         define)
16936         case "$sethostent_r_proto" in
16937         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16938         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16939         esac
16940         case "$sethostent_r_proto" in
16941         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16942         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16943         esac
16944         case "$sethostent_r_proto" in
16945         ''|0)   d_sethostent_r=undef
16946                 sethostent_r_proto=0
16947                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16948         * )     case "$sethostent_r_proto" in
16949                 REENTRANT_PROTO*) ;;
16950                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16951                 esac
16952                 echo "Prototype: $try" ;;
16953         esac
16954         ;;
16955         *)      case "$usethreads" in
16956                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16957                 esac
16958                 d_sethostent_r=undef
16959                 sethostent_r_proto=0
16960                 ;;
16961         esac
16962         ;;
16963 *)      sethostent_r_proto=0
16964         ;;
16965 esac
16966
16967 : see if setitimer exists
16968 set setitimer d_setitimer
16969 eval $inlibc
16970
16971 : see if setlinebuf exists
16972 set setlinebuf d_setlinebuf
16973 eval $inlibc
16974
16975 : see if setlocale exists
16976 set setlocale d_setlocale
16977 eval $inlibc
16978
16979 : see if locale.h is available
16980 set locale.h i_locale
16981 eval $inhdr
16982
16983 : see if setlocale_r exists
16984 set setlocale_r d_setlocale_r
16985 eval $inlibc
16986 case "$d_setlocale_r" in
16987 "$define")
16988         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16989         case "$d_setlocale_r_proto:$usethreads" in
16990         ":define")      d_setlocale_r_proto=define
16991                 set d_setlocale_r_proto setlocale_r $hdrs
16992                 eval $hasproto ;;
16993         *)      ;;
16994         esac
16995         case "$d_setlocale_r_proto" in
16996         define)
16997         case "$setlocale_r_proto" in
16998         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16999         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17000         esac
17001         case "$setlocale_r_proto" in
17002         ''|0)   d_setlocale_r=undef
17003                 setlocale_r_proto=0
17004                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17005         * )     case "$setlocale_r_proto" in
17006                 REENTRANT_PROTO*) ;;
17007                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17008                 esac
17009                 echo "Prototype: $try" ;;
17010         esac
17011         ;;
17012         *)      case "$usethreads" in
17013                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17014                 esac
17015                 d_setlocale_r=undef
17016                 setlocale_r_proto=0
17017                 ;;
17018         esac
17019         ;;
17020 *)      setlocale_r_proto=0
17021         ;;
17022 esac
17023
17024 : see if setnetent exists
17025 set setnetent d_setnent
17026 eval $inlibc
17027
17028 : see if setnetent_r exists
17029 set setnetent_r d_setnetent_r
17030 eval $inlibc
17031 case "$d_setnetent_r" in
17032 "$define")
17033         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17034         case "$d_setnetent_r_proto:$usethreads" in
17035         ":define")      d_setnetent_r_proto=define
17036                 set d_setnetent_r_proto setnetent_r $hdrs
17037                 eval $hasproto ;;
17038         *)      ;;
17039         esac
17040         case "$d_setnetent_r_proto" in
17041         define)
17042         case "$setnetent_r_proto" in
17043         ''|0) try='int setnetent_r(int, struct netent_data*);'
17044         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17045         esac
17046         case "$setnetent_r_proto" in
17047         ''|0) try='void setnetent_r(int, struct netent_data*);'
17048         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17049         esac
17050         case "$setnetent_r_proto" in
17051         ''|0)   d_setnetent_r=undef
17052                 setnetent_r_proto=0
17053                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17054         * )     case "$setnetent_r_proto" in
17055                 REENTRANT_PROTO*) ;;
17056                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17057                 esac
17058                 echo "Prototype: $try" ;;
17059         esac
17060         ;;
17061         *)      case "$usethreads" in
17062                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17063                 esac
17064                 d_setnetent_r=undef
17065                 setnetent_r_proto=0
17066                 ;;
17067         esac
17068         ;;
17069 *)      setnetent_r_proto=0
17070         ;;
17071 esac
17072
17073 : see if setprotoent exists
17074 set setprotoent d_setpent
17075 eval $inlibc
17076
17077 : see if setpgid exists
17078 set setpgid d_setpgid
17079 eval $inlibc
17080
17081 : see if setpgrp2 exists
17082 set setpgrp2 d_setpgrp2
17083 eval $inlibc
17084
17085 : see if setpriority exists
17086 set setpriority d_setprior
17087 eval $inlibc
17088
17089 : see if setproctitle exists
17090 set setproctitle d_setproctitle
17091 eval $inlibc
17092
17093 : see if setprotoent_r exists
17094 set setprotoent_r d_setprotoent_r
17095 eval $inlibc
17096 case "$d_setprotoent_r" in
17097 "$define")
17098         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17099         case "$d_setprotoent_r_proto:$usethreads" in
17100         ":define")      d_setprotoent_r_proto=define
17101                 set d_setprotoent_r_proto setprotoent_r $hdrs
17102                 eval $hasproto ;;
17103         *)      ;;
17104         esac
17105         case "$d_setprotoent_r_proto" in
17106         define)
17107         case "$setprotoent_r_proto" in
17108         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17109         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17110         esac
17111         case "$setprotoent_r_proto" in
17112         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17113         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17114         esac
17115         case "$setprotoent_r_proto" in
17116         ''|0)   d_setprotoent_r=undef
17117                 setprotoent_r_proto=0
17118                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17119         * )     case "$setprotoent_r_proto" in
17120                 REENTRANT_PROTO*) ;;
17121                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17122                 esac
17123                 echo "Prototype: $try" ;;
17124         esac
17125         ;;
17126         *)      case "$usethreads" in
17127                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17128                 esac
17129                 d_setprotoent_r=undef
17130                 setprotoent_r_proto=0
17131                 ;;
17132         esac
17133         ;;
17134 *)      setprotoent_r_proto=0
17135         ;;
17136 esac
17137
17138 : see if setpwent exists
17139 set setpwent d_setpwent
17140 eval $inlibc
17141
17142 : see if setpwent_r exists
17143 set setpwent_r d_setpwent_r
17144 eval $inlibc
17145 case "$d_setpwent_r" in
17146 "$define")
17147         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17148         case "$d_setpwent_r_proto:$usethreads" in
17149         ":define")      d_setpwent_r_proto=define
17150                 set d_setpwent_r_proto setpwent_r $hdrs
17151                 eval $hasproto ;;
17152         *)      ;;
17153         esac
17154         case "$d_setpwent_r_proto" in
17155         define)
17156         case "$setpwent_r_proto" in
17157         ''|0) try='int setpwent_r(FILE**);'
17158         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17159         esac
17160         case "$setpwent_r_proto" in
17161         ''|0) try='void setpwent_r(FILE**);'
17162         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17163         esac
17164         case "$setpwent_r_proto" in
17165         ''|0)   d_setpwent_r=undef
17166                 setpwent_r_proto=0
17167                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17168         * )     case "$setpwent_r_proto" in
17169                 REENTRANT_PROTO*) ;;
17170                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17171                 esac
17172                 echo "Prototype: $try" ;;
17173         esac
17174         ;;
17175         *)      case "$usethreads" in
17176                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17177                 esac
17178                 d_setpwent_r=undef
17179                 setpwent_r_proto=0
17180                 ;;
17181         esac
17182         ;;
17183 *)      setpwent_r_proto=0
17184         ;;
17185 esac
17186
17187 : see if setregid exists
17188 set setregid d_setregid
17189 eval $inlibc
17190 set setresgid d_setresgid
17191 eval $inlibc
17192
17193 : see if setreuid exists
17194 set setreuid d_setreuid
17195 eval $inlibc
17196 set setresuid d_setresuid
17197 eval $inlibc
17198
17199 : see if setrgid exists
17200 set setrgid d_setrgid
17201 eval $inlibc
17202
17203 : see if setruid exists
17204 set setruid d_setruid
17205 eval $inlibc
17206
17207 : see if setservent exists
17208 set setservent d_setsent
17209 eval $inlibc
17210
17211 : see if setservent_r exists
17212 set setservent_r d_setservent_r
17213 eval $inlibc
17214 case "$d_setservent_r" in
17215 "$define")
17216         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17217         case "$d_setservent_r_proto:$usethreads" in
17218         ":define")      d_setservent_r_proto=define
17219                 set d_setservent_r_proto setservent_r $hdrs
17220                 eval $hasproto ;;
17221         *)      ;;
17222         esac
17223         case "$d_setservent_r_proto" in
17224         define)
17225         case "$setservent_r_proto" in
17226         ''|0) try='int setservent_r(int, struct servent_data*);'
17227         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17228         esac
17229         case "$setservent_r_proto" in
17230         ''|0) try='void setservent_r(int, struct servent_data*);'
17231         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17232         esac
17233         case "$setservent_r_proto" in
17234         ''|0)   d_setservent_r=undef
17235                 setservent_r_proto=0
17236                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17237         * )     case "$setservent_r_proto" in
17238                 REENTRANT_PROTO*) ;;
17239                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17240                 esac
17241                 echo "Prototype: $try" ;;
17242         esac
17243         ;;
17244         *)      case "$usethreads" in
17245                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17246                 esac
17247                 d_setservent_r=undef
17248                 setservent_r_proto=0
17249                 ;;
17250         esac
17251         ;;
17252 *)      setservent_r_proto=0
17253         ;;
17254 esac
17255
17256 : see if setsid exists
17257 set setsid d_setsid
17258 eval $inlibc
17259
17260 : see if setvbuf exists
17261 set setvbuf d_setvbuf
17262 eval $inlibc
17263
17264 : see if sfio.h is available
17265 set sfio.h i_sfio
17266 eval $inhdr
17267
17268 : see if sfio library is available
17269 case "$i_sfio" in
17270 $define)
17271         val=''
17272         set sfreserve val
17273         eval $inlibc
17274         ;;
17275 *)
17276         val="$undef"
17277         ;;
17278 esac
17279 : Ok, but do we want to use it.
17280 case "$val" in
17281 $define)
17282         case "$usesfio" in
17283         true|$define|[yY]*) dflt='y';;
17284         *) dflt='n';;
17285         esac
17286         echo "$package can use the sfio library, but it is experimental."
17287         case "$useperlio" in
17288         "$undef")
17289             echo "For sfio also the PerlIO abstraction layer is needed."
17290             echo "Earlier you said you wouldn't want that."
17291             ;;
17292         esac
17293         rp="You seem to have sfio available, do you want to try using it?"
17294         . ./myread
17295         case "$ans" in
17296         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17297                 useperlio="$define"
17298                 val="$define"
17299                 ;;
17300         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17301                 val="$undef"
17302                 ;;
17303         esac
17304         ;;
17305 *)      case "$usesfio" in
17306         true|$define|[yY]*)
17307                 echo "Sorry, cannot find sfio on this machine." >&4
17308                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17309                 val="$undef"
17310                 ;;
17311         esac
17312         ;;
17313 esac
17314 set d_sfio
17315 eval $setvar
17316 case "$d_sfio" in
17317 $define) usesfio='true';;
17318 *) usesfio='false';;
17319 esac
17320 case "$d_sfio" in
17321 $define) ;;
17322 *)      : Remove sfio from list of libraries to use
17323         case "$libs" in
17324         *-lsfio*)
17325                 echo "Removing unneeded -lsfio from library list" >&4
17326                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17327                 shift
17328                 libs="$*"
17329                 echo "libs = $libs" >&4
17330                 ;;
17331         esac
17332 ;;
17333 esac
17334
17335
17336 : see if shmctl exists
17337 set shmctl d_shmctl
17338 eval $inlibc
17339
17340 : see if shmget exists
17341 set shmget d_shmget
17342 eval $inlibc
17343
17344 : see if shmat exists
17345 set shmat d_shmat
17346 eval $inlibc
17347 : see what shmat returns
17348 case "$d_shmat" in
17349 "$define")
17350         $cat >shmat.c <<'END'
17351 #include <sys/shm.h>
17352 void *shmat();
17353 END
17354         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17355                 shmattype='void *'
17356         else
17357                 shmattype='char *'
17358         fi
17359         echo "and it returns ($shmattype)." >&4
17360         : see if a prototype for shmat is available
17361         xxx=`./findhdr sys/shm.h`
17362         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17363         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17364                 val="$define"
17365         else
17366                 val="$undef"
17367         fi
17368         $rm -f shmat.[co]
17369         ;;
17370 *)
17371         val="$undef"
17372         ;;
17373 esac
17374 set d_shmatprototype
17375 eval $setvar
17376
17377 : see if shmdt exists
17378 set shmdt d_shmdt
17379 eval $inlibc
17380
17381 : see how much of the 'shm*(2)' library is present.
17382 h_shm=true
17383 echo " "
17384 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17385 *"$undef"*) h_shm=false;;
17386 esac
17387 case "$osname" in
17388 freebsd)
17389     case "`ipcs 2>&1`" in
17390     "SVID shared memory"*"not configured"*)
17391         echo "Your $osname does not have the shm*(2) configured." >&4
17392         h_shm=false
17393         val="$undef"
17394         set shmctl d_shmctl
17395         evat $setvar
17396         set shmget d_shmget
17397         evat $setvar
17398         set shmat d_shmat
17399         evat $setvar
17400         set shmdt d_shmdt
17401         evat $setvar
17402         ;;
17403     esac
17404     ;;
17405 esac
17406 : we could also check for sys/ipc.h ...
17407 if $h_shm && $test `./findhdr sys/shm.h`; then
17408         echo "You have the full shm*(2) library." >&4
17409         val="$define"
17410 else
17411         echo "You don't have the full shm*(2) library." >&4
17412         val="$undef"
17413 fi
17414 set d_shm
17415 eval $setvar
17416
17417 : see if we have sigaction
17418 echo " "
17419 if set sigaction val -f d_sigaction; eval $csym; $val; then
17420         echo 'sigaction() found.' >&4
17421         $cat > try.c <<EOP
17422 #include <stdio.h>
17423 #include <sys/types.h>
17424 #include <signal.h>
17425 #$i_stdlib I_STDLIB
17426 #ifdef I_STDLIB
17427 #include <stdlib.h>
17428 #endif
17429 int main()
17430 {
17431     struct sigaction act, oact;
17432     act.sa_flags = 0;
17433     oact.sa_handler = 0;
17434     /* so that act and oact are used */
17435     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17436 }
17437 EOP
17438         set try
17439         if eval $compile_ok; then
17440                 val="$define"
17441         else
17442                 echo "But you don't seem to have a useable struct sigaction." >&4
17443                 val="$undef"
17444         fi
17445 else
17446         echo 'sigaction NOT found.' >&4
17447         val="$undef"
17448 fi
17449 set d_sigaction; eval $setvar
17450 $rm_try
17451
17452 : see if this is a sunmath.h system
17453 set sunmath.h i_sunmath
17454 eval $inhdr
17455
17456 : see if signbit exists
17457 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17458 $cat >try.c <<EOCP
17459 #$i_math I_MATH
17460 #$i_sunmath I_SUNMATH
17461 #ifdef I_MATH
17462 #  include <math.h>
17463 #endif
17464 #ifdef I_SUNMATH  /* Solaris special math library */
17465 #  include <sunmath.h>
17466 #endif
17467 #define NV $nvtype
17468 int main(int argc, char **argv)
17469 {
17470     NV x = 0.0;
17471     NV y = -0.0;
17472     if ((signbit(x) == 0) && (signbit(y) != 0))
17473         return 0;
17474     else
17475         return 1;
17476 }
17477 EOCP
17478 val="$undef"
17479 set try
17480 if eval $compile; then
17481     if $run ./try; then
17482         $echo "Yes." >&4
17483         val="$define"
17484     else
17485         $echo "Signbit seems to be available, but doesn't work as I expected."
17486         $echo "I won't use it." >&4
17487         val="$undef"
17488     fi
17489 else
17490     $echo "Nope." >&4
17491     dflt="$undef"
17492 fi
17493 set d_signbit
17494 eval $setvar
17495 $rm_try
17496
17497 : see if sigprocmask exists
17498 set sigprocmask d_sigprocmask
17499 eval $inlibc
17500
17501 : see if sigsetjmp exists
17502 echo " "
17503 case "$d_sigsetjmp" in
17504 '')
17505         $cat >try.c <<EOP
17506 #include <setjmp.h>
17507 #$i_stdlib I_STDLIB
17508 #ifdef I_STDLIB
17509 #include <stdlib.h>
17510 #endif
17511 sigjmp_buf env;
17512 int set = 1;
17513 int main()
17514 {
17515         if (sigsetjmp(env,1))
17516                 exit(set);
17517         set = 0;
17518         siglongjmp(env, 1);
17519         exit(1);
17520 }
17521 EOP
17522         set try
17523         if eval $compile; then
17524                 if $run ./try >/dev/null 2>&1; then
17525                         echo "POSIX sigsetjmp found." >&4
17526                         val="$define"
17527                 else
17528                         $cat >&4 <<EOM
17529 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17530 I'll ignore them.
17531 EOM
17532                         val="$undef"
17533                 fi
17534         else
17535                 echo "sigsetjmp not found." >&4
17536                 val="$undef"
17537         fi
17538         ;;
17539 *) val="$d_sigsetjmp"
17540         case "$d_sigsetjmp" in
17541         $define) echo "POSIX sigsetjmp found." >&4;;
17542         $undef) echo "sigsetjmp not found." >&4;;
17543         esac
17544         ;;
17545 esac
17546 set d_sigsetjmp
17547 eval $setvar
17548 $rm_try
17549
17550 : see if snprintf exists
17551 set snprintf d_snprintf
17552 eval $inlibc
17553
17554 : see if vsnprintf exists
17555 set vsnprintf d_vsnprintf
17556 eval $inlibc
17557
17558 case "$d_snprintf-$d_vsnprintf" in
17559 "$define-$define")
17560     $cat <<EOM
17561 Checking whether your snprintf() and vsnprintf() work okay...
17562 EOM
17563     $cat >try.c <<'EOCP'
17564 /* v?snprintf testing logic courtesy of Russ Allbery.
17565  * According to C99:
17566  * - if the buffer is too short it still must be \0-terminated
17567  * - if the buffer is too short the potentially required length
17568  *   must be returned and not -1
17569  * - if the buffer is NULL the potentially required length
17570  *   must be returned and not -1 or core dump
17571  */
17572 #include <stdio.h>
17573 #include <stdarg.h>
17574
17575 char buf[2];
17576
17577 int test (char *format, ...)
17578 {
17579     va_list args;
17580     int count;
17581
17582     va_start (args, format);
17583     count = vsnprintf (buf, sizeof buf, format, args);
17584     va_end (args);
17585     return count;
17586 }
17587
17588 int main ()
17589 {
17590     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17591              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17592 }
17593 EOCP
17594     set try
17595     if eval $compile; then
17596         `$run ./try`
17597         case "$?" in
17598         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17599         *) cat <<EOM >&4
17600 Your snprintf() and snprintf() don't seem to be working okay.
17601 EOM
17602            d_snprintf="$undef"
17603            d_vsnprintf="$undef"
17604            ;;
17605         esac
17606     else
17607         echo "(I can't seem to compile the test program--assuming they don't)"
17608         d_snprintf="$undef"
17609         d_vsnprintf="$undef"
17610     fi
17611     $rm_try
17612     ;;
17613 esac
17614
17615 : see if sockatmark exists
17616 set sockatmark d_sockatmark
17617 eval $inlibc
17618
17619 : see if prototype for sockatmark is available
17620 echo " "
17621 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17622 eval $hasproto
17623
17624 : see if socks5_init exists
17625 set socks5_init d_socks5_init
17626 eval $inlibc
17627
17628 : see if sprintf returns the length of the string in the buffer as per ANSI
17629 $echo "Checking whether sprintf returns the length of the string..." >&4
17630 $cat <<EOP >try.c
17631 #include <stdio.h>
17632 #$i_stdlib I_STDLIB
17633 #ifdef I_STDLIB
17634 #include <stdlib.h>
17635 #endif
17636 #$i_string I_STRING
17637 #ifdef I_STRING
17638 #  include <string.h>
17639 #else
17640 #  include <strings.h>
17641 #endif
17642 #$i_math I_MATH
17643 #ifdef I_MATH
17644 #include <math.h>
17645 #endif
17646
17647 char buffer[256];
17648
17649 int check (size_t expect, int test) {
17650   size_t got = strlen(buffer);
17651   if (expect == got)
17652     return 0;
17653
17654   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17655        test, buffer);
17656   exit (test);
17657 }
17658
17659 int main(int argc, char **argv) {
17660   int test = 0;
17661
17662   check(sprintf(buffer, ""), ++test);
17663   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17664   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17665
17666   return 0;
17667 }
17668 EOP
17669 set try
17670
17671 if eval $compile; then
17672     xxx="`$run ./try`"
17673     case "$?" in
17674         0) cat >&4 <<EOM
17675 sprintf returns the length of the string (as ANSI says it should)
17676 EOM
17677         d_sprintf_returns_strlen="$define"
17678         ;;
17679         *) cat >&4 <<EOM
17680 sprintf does not return the length of the string (how old is this system?)
17681 EOM
17682         d_sprintf_returns_strlen="$undef"
17683         ;;
17684     esac
17685 else
17686     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17687     d_sprintf_returns_strlen="$undef"
17688 fi
17689 $rm_try
17690
17691 : see if srand48_r exists
17692 set srand48_r d_srand48_r
17693 eval $inlibc
17694 case "$d_srand48_r" in
17695 "$define")
17696         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17697         case "$d_srand48_r_proto:$usethreads" in
17698         ":define")      d_srand48_r_proto=define
17699                 set d_srand48_r_proto srand48_r $hdrs
17700                 eval $hasproto ;;
17701         *)      ;;
17702         esac
17703         case "$d_srand48_r_proto" in
17704         define)
17705         case "$srand48_r_proto" in
17706         ''|0) try='int srand48_r(long, struct drand48_data*);'
17707         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17708         esac
17709         case "$srand48_r_proto" in
17710         ''|0)   d_srand48_r=undef
17711                 srand48_r_proto=0
17712                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17713         * )     case "$srand48_r_proto" in
17714                 REENTRANT_PROTO*) ;;
17715                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17716                 esac
17717                 echo "Prototype: $try" ;;
17718         esac
17719         ;;
17720         *)      case "$usethreads" in
17721                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17722                 esac
17723                 d_srand48_r=undef
17724                 srand48_r_proto=0
17725                 ;;
17726         esac
17727         ;;
17728 *)      srand48_r_proto=0
17729         ;;
17730 esac
17731
17732 : see if srandom_r exists
17733 set srandom_r d_srandom_r
17734 eval $inlibc
17735 case "$d_srandom_r" in
17736 "$define")
17737         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17738         case "$d_srandom_r_proto:$usethreads" in
17739         ":define")      d_srandom_r_proto=define
17740                 set d_srandom_r_proto srandom_r $hdrs
17741                 eval $hasproto ;;
17742         *)      ;;
17743         esac
17744         case "$d_srandom_r_proto" in
17745         define)
17746         case "$srandom_r_proto" in
17747         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17748         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17749         esac
17750         case "$srandom_r_proto" in
17751         ''|0)   d_srandom_r=undef
17752                 srandom_r_proto=0
17753                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17754         * )     case "$srandom_r_proto" in
17755                 REENTRANT_PROTO*) ;;
17756                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17757                 esac
17758                 echo "Prototype: $try" ;;
17759         esac
17760         ;;
17761         *)      case "$usethreads" in
17762                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17763                 esac
17764                 d_srandom_r=undef
17765                 srandom_r_proto=0
17766                 ;;
17767         esac
17768         ;;
17769 *)      srandom_r_proto=0
17770         ;;
17771 esac
17772
17773 : see if prototype for setresgid is available
17774 echo " "
17775 set d_sresgproto setresgid $i_unistd unistd.h
17776 eval $hasproto
17777
17778 : see if prototype for setresuid is available
17779 echo " "
17780 set d_sresuproto setresuid $i_unistd unistd.h
17781 eval $hasproto
17782
17783 : see if sys/stat.h is available
17784 set sys/stat.h i_sysstat
17785 eval $inhdr
17786
17787 : see if stat knows about block sizes
17788 echo " "
17789 echo "Checking to see if your struct stat has st_blocks field..." >&4
17790 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17791 eval $hasfield
17792
17793 : see if this is a sys/vfs.h system
17794 set sys/vfs.h i_sysvfs
17795 eval $inhdr
17796
17797 : see if this is a sys/statfs.h system
17798 set sys/statfs.h i_sysstatfs
17799 eval $inhdr
17800
17801 : Check for statfs_s
17802 echo " "
17803 echo "Checking to see if your system supports struct statfs..." >&4
17804 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
17805 eval $hasstruct
17806 case "$d_statfs_s" in
17807 "$define")      echo "Yes, it does."   ;;
17808 *)              echo "No, it doesn't." ;;
17809 esac
17810
17811
17812 : see if struct statfs knows about f_flags
17813 case "$d_statfs_s" in
17814 define)
17815         echo " "
17816         echo "Checking to see if your struct statfs has f_flags field..." >&4
17817         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
17818         eval $hasfield
17819         ;;
17820 *)      val="$undef"
17821         set d_statfs_f_flags
17822         eval $setvar
17823         ;;
17824 esac
17825 case "$d_statfs_f_flags" in
17826 "$define")      echo "Yes, it does."   ;;
17827 *)              echo "No, it doesn't." ;;
17828 esac
17829
17830 : Check stream access
17831 $cat >&4 <<EOM
17832 Checking how to access stdio streams by file descriptor number...
17833 EOM
17834 case "$stdio_stream_array" in
17835 '')     $cat >try.c <<EOCP
17836 #include <stdio.h>
17837 int main() {
17838   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17839     printf("yes\n");
17840 }
17841 EOCP
17842         for s in _iob __iob __sF
17843         do
17844                 set try -DSTDIO_STREAM_ARRAY=$s
17845                 if eval $compile; then
17846                         case "`$run ./try`" in
17847                         yes)    stdio_stream_array=$s; break ;;
17848                         esac
17849                 fi
17850         done
17851         $rm_try
17852 esac
17853 case "$stdio_stream_array" in
17854 '')     $cat >&4 <<EOM
17855 I can't figure out how to access stdio streams by file descriptor number.
17856 EOM
17857         d_stdio_stream_array="$undef"
17858         ;;
17859 *)      $cat >&4 <<EOM
17860 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17861 EOM
17862         d_stdio_stream_array="$define"
17863         ;;
17864 esac
17865
17866 : see if strcoll exists
17867 set strcoll d_strcoll
17868 eval $inlibc
17869
17870 : check for structure copying
17871 echo " "
17872 echo "Checking to see if your C compiler can copy structs..." >&4
17873 $cat >try.c <<'EOCP'
17874 int main()
17875 {
17876         struct blurfl {
17877                 int dyick;
17878         } foo, bar;
17879
17880         foo = bar;
17881 }
17882 EOCP
17883 if $cc -c try.c >/dev/null 2>&1 ; then
17884         val="$define"
17885         echo "Yup, it can."
17886 else
17887         val="$undef"
17888         echo "Nope, it can't."
17889 fi
17890 set d_strctcpy
17891 eval $setvar
17892 $rm_try
17893
17894 : see if strerror and/or sys_errlist[] exist
17895 echo " "
17896 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17897     if set strerror val -f d_strerror; eval $csym; $val; then
17898                 echo 'strerror() found.' >&4
17899                 d_strerror="$define"
17900                 d_strerrm='strerror(e)'
17901                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17902                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17903                         d_syserrlst="$define"
17904                 else
17905                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17906                         d_syserrlst="$undef"
17907                 fi
17908     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17909                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17910                 echo 'strerror() found in string header.' >&4
17911                 d_strerror="$define"
17912                 d_strerrm='strerror(e)'
17913                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17914                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17915                                 d_syserrlst="$define"
17916                 else
17917                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17918                         d_syserrlst="$undef"
17919                 fi
17920     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17921                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17922                 d_strerror="$undef"
17923                 d_syserrlst="$define"
17924                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17925     else
17926                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17927                 d_strerror="$undef"
17928                 d_syserrlst="$undef"
17929                 d_strerrm='"unknown"'
17930     fi
17931 fi
17932
17933 : see if strerror_r exists
17934 set strerror_r d_strerror_r
17935 eval $inlibc
17936 case "$d_strerror_r" in
17937 "$define")
17938         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17939         case "$d_strerror_r_proto:$usethreads" in
17940         ":define")      d_strerror_r_proto=define
17941                 set d_strerror_r_proto strerror_r $hdrs
17942                 eval $hasproto ;;
17943         *)      ;;
17944         esac
17945         case "$d_strerror_r_proto" in
17946         define)
17947         case "$strerror_r_proto" in
17948         ''|0) try='int strerror_r(int, char*, size_t);'
17949         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17950         esac
17951         case "$strerror_r_proto" in
17952         ''|0) try='int strerror_r(int, char*, int);'
17953         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17954         esac
17955         case "$strerror_r_proto" in
17956         ''|0) try='char* strerror_r(int, char*, size_t);'
17957         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17958         esac
17959         case "$strerror_r_proto" in
17960         ''|0)   d_strerror_r=undef
17961                 strerror_r_proto=0
17962                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17963         * )     case "$strerror_r_proto" in
17964                 REENTRANT_PROTO*) ;;
17965                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17966                 esac
17967                 echo "Prototype: $try" ;;
17968         esac
17969         ;;
17970         *)      case "$usethreads" in
17971                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17972                 esac
17973                 d_strerror_r=undef
17974                 strerror_r_proto=0
17975                 ;;
17976         esac
17977         ;;
17978 *)      strerror_r_proto=0
17979         ;;
17980 esac
17981
17982 : see if strftime exists
17983 set strftime d_strftime
17984 eval $inlibc
17985
17986 : see if strlcat exists
17987 set strlcat d_strlcat
17988 eval $inlibc
17989
17990 : see if strlcpy exists
17991 set strlcpy d_strlcpy
17992 eval $inlibc
17993
17994 : see if strtod exists
17995 set strtod d_strtod
17996 eval $inlibc
17997
17998 : see if strtol exists
17999 set strtol d_strtol
18000 eval $inlibc
18001
18002 : see if strtold exists
18003 set strtold d_strtold
18004 eval $inlibc
18005
18006 : see if strtoll exists
18007 set strtoll d_strtoll
18008 eval $inlibc
18009
18010 case "$d_longlong-$d_strtoll" in
18011 "$define-$define")
18012         $cat <<EOM
18013 Checking whether your strtoll() works okay...
18014 EOM
18015         $cat >try.c <<'EOCP'
18016 #include <errno.h>
18017 #ifdef __hpux
18018 #define strtoll __strtoll
18019 #endif
18020 #ifdef __EMX__
18021 #define strtoll _strtoll
18022 #endif
18023 #include <stdio.h>
18024 extern long long int strtoll(char *s, char **, int);
18025 static int bad = 0;
18026 int check(char *s, long long ell, int een) {
18027         long long gll;
18028         errno = 0;
18029         gll = strtoll(s, 0, 10);
18030         if (!((gll == ell) && (errno == een)))
18031                 bad++;
18032 }
18033 int main() {
18034         check(" 1",                                      1LL, 0);
18035         check(" 0",                                      0LL, 0);
18036         check("-1",                                     -1LL, 0);
18037         check("-9223372036854775808", -9223372036854775808LL, 0);
18038         check("-9223372036854775808", -9223372036854775808LL, 0);
18039         check(" 9223372036854775807",  9223372036854775807LL, 0);
18040         check("-9223372036854775808", -9223372036854775808LL, 0);
18041         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18042         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18043         if (!bad)
18044                 printf("ok\n");
18045 }
18046 EOCP
18047         set try
18048         if eval $compile; then
18049                 yyy=`$run ./try`
18050                 case "$yyy" in
18051                 ok) echo "Your strtoll() seems to be working okay." ;;
18052                 *) cat <<EOM >&4
18053 Your strtoll() doesn't seem to be working okay.
18054 EOM
18055                    d_strtoll="$undef"
18056                    ;;
18057                 esac
18058         else
18059                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18060                 d_strtoll="$undef"
18061         fi
18062         ;;
18063 esac
18064
18065 : see if strtoq exists
18066 set strtoq d_strtoq
18067 eval $inlibc
18068
18069 : see if strtoul exists
18070 set strtoul d_strtoul
18071 eval $inlibc
18072
18073 case "$d_strtoul" in
18074 "$define")
18075         $cat <<EOM
18076 Checking whether your strtoul() works okay...
18077 EOM
18078         $cat >try.c <<'EOCP'
18079 #include <errno.h>
18080 #include <stdio.h>
18081 extern unsigned long int strtoul(char *s, char **, int);
18082 static int bad = 0;
18083 void check(char *s, unsigned long eul, int een) {
18084         unsigned long gul;
18085         errno = 0;
18086         gul = strtoul(s, 0, 10);
18087         if (!((gul == eul) && (errno == een)))
18088                 bad++;
18089 }
18090 int main() {
18091         check(" 1", 1L, 0);
18092         check(" 0", 0L, 0);
18093 EOCP
18094         case "$longsize" in
18095         8)
18096             $cat >>try.c <<'EOCP'
18097         check("18446744073709551615", 18446744073709551615UL, 0);
18098         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18099 #if 0 /* strtoul() for /^-/ strings is undefined. */
18100         check("-1", 18446744073709551615UL, 0);
18101         check("-18446744073709551614", 2, 0);
18102         check("-18446744073709551615", 1, 0);
18103         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18104         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18105 #endif
18106 EOCP
18107                 ;;
18108         4)
18109                     $cat >>try.c <<'EOCP'
18110         check("4294967295", 4294967295UL, 0);
18111         check("4294967296", 4294967295UL, ERANGE);
18112 #if 0 /* strtoul() for /^-/ strings is undefined. */
18113         check("-1", 4294967295UL, 0);
18114         check("-4294967294", 2, 0);
18115         check("-4294967295", 1, 0);
18116         check("-4294967296", 4294967295UL, ERANGE);
18117         check("-4294967297", 4294967295UL, ERANGE);
18118 #endif
18119 EOCP
18120                 ;;
18121         *)
18122 : Should we write these tests to be more portable by sprintf-ing
18123 : ~0 and then manipulating that char string as input for strtol?
18124                 ;;
18125         esac
18126         $cat >>try.c <<'EOCP'
18127         if (!bad)
18128                 printf("ok\n");
18129         return 0;
18130 }
18131 EOCP
18132         set try
18133         if eval $compile; then
18134                 case "`$run ./try`" in
18135                 ok) echo "Your strtoul() seems to be working okay." ;;
18136                 *) cat <<EOM >&4
18137 Your strtoul() doesn't seem to be working okay.
18138 EOM
18139                    d_strtoul="$undef"
18140                    ;;
18141                 esac
18142         else
18143                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18144                 d_strtoul="$undef"
18145         fi
18146         ;;
18147 esac
18148
18149 : see if strtoull exists
18150 set strtoull d_strtoull
18151 eval $inlibc
18152
18153 case "$d_longlong-$d_strtoull" in
18154 "$define-$define")
18155         $cat <<EOM
18156 Checking whether your strtoull() works okay...
18157 EOM
18158         $cat >try.c <<'EOCP'
18159 #include <errno.h>
18160 #ifdef __hpux
18161 #define strtoull __strtoull
18162 #endif
18163 #include <stdio.h>
18164 extern unsigned long long int strtoull(char *s, char **, int);
18165 static int bad = 0;
18166 int check(char *s, long long eull, int een) {
18167         long long gull;
18168         errno = 0;
18169         gull = strtoull(s, 0, 10);
18170         if (!((gull == eull) && (errno == een)))
18171                 bad++;
18172 }
18173 int main() {
18174         check(" 1",                                        1LL, 0);
18175         check(" 0",                                        0LL, 0);
18176         check("18446744073709551615",  18446744073709551615ULL, 0);
18177         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18178 #if 0 /* strtoull() for /^-/ strings is undefined. */
18179         check("-1",                    18446744073709551615ULL, 0);
18180         check("-18446744073709551614",                     2LL, 0);
18181         check("-18446744073709551615",                     1LL, 0);
18182         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18183         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18184 #endif
18185         if (!bad)
18186                 printf("ok\n");
18187 }
18188 EOCP
18189         set try
18190         if eval $compile; then
18191                 case "`$run ./try`" in
18192                 ok) echo "Your strtoull() seems to be working okay." ;;
18193                 *) cat <<EOM >&4
18194 Your strtoull() doesn't seem to be working okay.
18195 EOM
18196                    d_strtoull="$undef"
18197                    ;;
18198                 esac
18199         else
18200                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18201                 d_strtoull="$undef"
18202         fi
18203         ;;
18204 esac
18205
18206 : see if strtouq exists
18207 set strtouq d_strtouq
18208 eval $inlibc
18209
18210 case "$d_strtouq" in
18211 "$define")
18212         $cat <<EOM
18213 Checking whether your strtouq() works okay...
18214 EOM
18215         $cat >try.c <<'EOCP'
18216 #include <errno.h>
18217 #include <stdio.h>
18218 extern unsigned long long int strtouq(char *s, char **, int);
18219 static int bad = 0;
18220 void check(char *s, unsigned long long eull, int een) {
18221         unsigned long long gull;
18222         errno = 0;
18223         gull = strtouq(s, 0, 10);
18224         if (!((gull == eull) && (errno == een)))
18225                 bad++;
18226 }
18227 int main() {
18228         check(" 1",                                        1LL, 0);
18229         check(" 0",                                        0LL, 0);
18230         check("18446744073709551615",  18446744073709551615ULL, 0);
18231         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18232 #if 0 /* strtouq() for /^-/ strings is undefined. */
18233         check("-1",                    18446744073709551615ULL, 0);
18234         check("-18446744073709551614",                     2LL, 0);
18235         check("-18446744073709551615",                     1LL, 0);
18236         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18237         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18238 #endif
18239         if (!bad)
18240                 printf("ok\n");
18241         return 0;
18242 }
18243 EOCP
18244         set try
18245         if eval $compile; then
18246                 case "`$run ./try`" in
18247                 ok) echo "Your strtouq() seems to be working okay." ;;
18248                 *) cat <<EOM >&4
18249 Your strtouq() doesn't seem to be working okay.
18250 EOM
18251                    d_strtouq="$undef"
18252                    ;;
18253                 esac
18254         else
18255                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18256                 d_strtouq="$undef"
18257         fi
18258         ;;
18259 esac
18260
18261 : see if strxfrm exists
18262 set strxfrm d_strxfrm
18263 eval $inlibc
18264
18265 : see if symlink exists
18266 set symlink d_symlink
18267 eval $inlibc
18268
18269 : see if syscall exists
18270 set syscall d_syscall
18271 eval $inlibc
18272
18273 : see if prototype for syscall is available
18274 echo " "
18275 set d_syscallproto syscall $i_unistd unistd.h
18276 eval $hasproto
18277
18278 : see if sysconf exists
18279 set sysconf d_sysconf
18280 eval $inlibc
18281
18282 : see if system exists
18283 set system d_system
18284 eval $inlibc
18285
18286 : see if tcgetpgrp exists
18287 set tcgetpgrp d_tcgetpgrp
18288 eval $inlibc
18289
18290 : see if tcsetpgrp exists
18291 set tcsetpgrp d_tcsetpgrp
18292 eval $inlibc
18293
18294 : see if prototype for telldir is available
18295 echo " "
18296 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18297 eval $hasproto
18298
18299 : see if time exists
18300 echo " "
18301 if test "X$d_time" = X -o X"$timetype" = X; then
18302     if set time val -f d_time; eval $csym; $val; then
18303                 echo 'time() found.' >&4
18304                 val="$define"
18305                 rp="What is the type returned by time() on this system?"
18306                 set time_t timetype long stdio.h sys/types.h
18307                 eval $typedef_ask
18308     else
18309                 echo 'time() not found, hope that will do.' >&4
18310                 val="$undef"
18311                 timetype='int';
18312     fi
18313     set d_time
18314     eval $setvar
18315 fi
18316
18317 : see if timegm exists
18318 set timegm d_timegm
18319 eval $inlibc
18320
18321 : see if this is a sys/times.h system
18322 set sys/times.h i_systimes
18323 eval $inhdr
18324
18325 : see if times exists
18326 echo " "
18327 if set times val -f d_times; eval $csym; $val; then
18328         echo 'times() found.' >&4
18329         d_times="$define"
18330         inc=''
18331         case "$i_systimes" in
18332         "$define") inc='sys/times.h';;
18333         esac
18334         rp="What is the type returned by times() on this system?"
18335         set clock_t clocktype long stdio.h sys/types.h $inc
18336         eval $typedef_ask
18337 else
18338         echo 'times() NOT found, hope that will do.' >&4
18339         d_times="$undef"
18340         clocktype='int'
18341 fi
18342
18343 : see if tmpnam_r exists
18344 set tmpnam_r d_tmpnam_r
18345 eval $inlibc
18346 case "$d_tmpnam_r" in
18347 "$define")
18348         hdrs="$i_systypes sys/types.h define stdio.h "
18349         case "$d_tmpnam_r_proto:$usethreads" in
18350         ":define")      d_tmpnam_r_proto=define
18351                 set d_tmpnam_r_proto tmpnam_r $hdrs
18352                 eval $hasproto ;;
18353         *)      ;;
18354         esac
18355         case "$d_tmpnam_r_proto" in
18356         define)
18357         case "$tmpnam_r_proto" in
18358         ''|0) try='char* tmpnam_r(char*);'
18359         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18360         esac
18361         case "$tmpnam_r_proto" in
18362         ''|0)   d_tmpnam_r=undef
18363                 tmpnam_r_proto=0
18364                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18365         * )     case "$tmpnam_r_proto" in
18366                 REENTRANT_PROTO*) ;;
18367                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18368                 esac
18369                 echo "Prototype: $try" ;;
18370         esac
18371         ;;
18372         *)      case "$usethreads" in
18373                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18374                 esac
18375                 d_tmpnam_r=undef
18376                 tmpnam_r_proto=0
18377                 ;;
18378         esac
18379         ;;
18380 *)      tmpnam_r_proto=0
18381         ;;
18382 esac
18383
18384 : see if truncate exists
18385 set truncate d_truncate
18386 eval $inlibc
18387
18388 : see if ttyname_r exists
18389 set ttyname_r d_ttyname_r
18390 eval $inlibc
18391 case "$d_ttyname_r" in
18392 "$define")
18393         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18394         case "$d_ttyname_r_proto:$usethreads" in
18395         ":define")      d_ttyname_r_proto=define
18396                 set d_ttyname_r_proto ttyname_r $hdrs
18397                 eval $hasproto ;;
18398         *)      ;;
18399         esac
18400         case "$d_ttyname_r_proto" in
18401         define)
18402         case "$ttyname_r_proto" in
18403         ''|0) try='int ttyname_r(int, char*, size_t);'
18404         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18405         esac
18406         case "$ttyname_r_proto" in
18407         ''|0) try='int ttyname_r(int, char*, int);'
18408         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18409         esac
18410         case "$ttyname_r_proto" in
18411         ''|0) try='char* ttyname_r(int, char*, int);'
18412         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18413         esac
18414         case "$ttyname_r_proto" in
18415         ''|0)   d_ttyname_r=undef
18416                 ttyname_r_proto=0
18417                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18418         * )     case "$ttyname_r_proto" in
18419                 REENTRANT_PROTO*) ;;
18420                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18421                 esac
18422                 echo "Prototype: $try" ;;
18423         esac
18424         ;;
18425         *)      case "$usethreads" in
18426                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18427                 esac
18428                 d_ttyname_r=undef
18429                 ttyname_r_proto=0
18430                 ;;
18431         esac
18432         ;;
18433 *)      ttyname_r_proto=0
18434         ;;
18435 esac
18436
18437 : see if tzname[] exists
18438 echo " "
18439 if set tzname val -a d_tzname; eval $csym; $val; then
18440         val="$define"
18441         echo 'tzname[] found.' >&4
18442 else
18443         val="$undef"
18444         echo 'tzname[] NOT found.' >&4
18445 fi
18446 set d_tzname
18447 eval $setvar
18448
18449 : Check if is a multiplatform env
18450 case "$osname" in
18451 next|rhapsody|darwin) multiarch="$define" ;;
18452 esac
18453 case "$multiarch" in
18454 ''|[nN]*) multiarch="$undef" ;;
18455 esac
18456
18457 : check for ordering of bytes in a UV
18458 echo " "
18459 case "$usecrosscompile$multiarch" in
18460 *$define*)
18461         $cat <<EOM
18462 You seem to be either cross-compiling or doing a multiarchitecture build,
18463 skipping the byteorder check.
18464
18465 EOM
18466         byteorder='ffff'
18467         ;;
18468 *)
18469         case "$byteorder" in
18470         '')
18471                 $cat <<'EOM'
18472 In the following, larger digits indicate more significance.  A big-endian
18473 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18474 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18475 machines may have weird orders like 3412.  A Cray will report 87654321,
18476 an Alpha will report 12345678. If the test program works the default is
18477 probably right.
18478 I'm now running the test program...
18479 EOM
18480                 $cat >try.c <<EOCP
18481 #include <stdio.h>
18482 #$i_stdlib I_STDLIB
18483 #ifdef I_STDLIB
18484 #include <stdlib.h>
18485 #endif
18486 #include <sys/types.h>
18487 typedef $uvtype UV;
18488 int main()
18489 {
18490         int i;
18491         union {
18492                 UV l;
18493                 char c[$uvsize];
18494         } u;
18495
18496         if ($uvsize > 4)
18497                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18498         else
18499                 u.l = (UV)0x04030201;
18500         for (i = 0; i < $uvsize; i++)
18501                 printf("%c", u.c[i]+'0');
18502         printf("\n");
18503         exit(0);
18504 }
18505 EOCP
18506                 xxx_prompt=y
18507                 set try
18508                 if eval $compile && $run ./try > /dev/null; then
18509                         dflt=`$run ./try`
18510                         case "$dflt" in
18511                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18512                                 echo "(The test program ran ok.)"
18513                                 echo "byteorder=$dflt"
18514                                 xxx_prompt=n
18515                         ;;
18516                         ????|????????) echo "(The test program ran ok.)" ;;
18517                         *) echo "(The test program didn't run right for some reason.)" ;;
18518                         esac
18519                 else
18520                         dflt='4321'
18521                         cat <<'EOM'
18522 (I can't seem to compile the test program.  Guessing big-endian...)
18523 EOM
18524                 fi
18525                 case "$xxx_prompt" in
18526                 y)
18527                         rp="What is the order of bytes in $uvtype?"
18528                         . ./myread
18529                         byteorder="$ans"
18530                         ;;
18531                 *)      byteorder=$dflt
18532                         ;;
18533                 esac
18534                 ;;
18535         esac
18536         $rm_try
18537         ;;
18538 esac
18539
18540 : Checking 32bit aligndness
18541 $cat <<EOM
18542
18543 Checking to see whether you can access character data unalignedly...
18544 EOM
18545 case "$d_u32align" in
18546 '')   $cat >try.c <<EOCP
18547 #include <stdio.h>
18548 #$i_stdlib I_STDLIB
18549 #ifdef I_STDLIB
18550 #include <stdlib.h>
18551 #endif
18552 #define U32 $u32type
18553 #define BYTEORDER 0x$byteorder
18554 #define U8 $u8type
18555 #include <signal.h>
18556 #ifdef SIGBUS
18557 $signal_t bletch(int s) { exit(4); }
18558 #endif
18559 int main() {
18560 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18561     U8 buf[8];
18562     U32 *up;
18563     int i;
18564
18565     if (sizeof(U32) != 4) {
18566         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18567         exit(1);
18568     }
18569
18570     fflush(stdout);
18571
18572 #ifdef SIGBUS
18573     signal(SIGBUS, bletch);
18574 #endif
18575
18576     buf[0] = 0;
18577     buf[1] = 0;
18578     buf[2] = 0;
18579     buf[3] = 1;
18580     buf[4] = 0;
18581     buf[5] = 0;
18582     buf[6] = 0;
18583     buf[7] = 1;
18584
18585     for (i = 0; i < 4; i++) {
18586         up = (U32*)(buf + i);
18587         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18588                (*up == 1 << (8*(3-i)))  /* little-endian */
18589               )
18590            )
18591         {
18592             printf("read failed (%x)\n", *up);
18593             exit(2);
18594         }
18595     }
18596
18597     /* write test */
18598     for (i = 0; i < 4; i++) {
18599         up = (U32*)(buf + i);
18600         *up = 0xBeef;
18601         if (*up != 0xBeef) {
18602             printf("write failed (%x)\n", *up);
18603             exit(3);
18604         }
18605     }
18606
18607     exit(0);
18608 #else
18609     printf("1\n");
18610     exit(1);
18611 #endif
18612     return 0;
18613 }
18614 EOCP
18615 set try
18616 if eval $compile_ok; then
18617         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18618         $run ./try 2>&1 >/dev/null
18619         case "$?" in
18620         0)      cat >&4 <<EOM
18621 You can access character data pretty unalignedly.
18622 EOM
18623                 d_u32align="$undef"
18624                 ;;
18625         *)      cat >&4 <<EOM
18626 It seems that you must access character data in an aligned manner.
18627 EOM
18628                 d_u32align="$define"
18629                 ;;
18630         esac
18631 else
18632         rp='Can you access character data at unaligned addresses?'
18633         dflt='n'
18634         . ./myread
18635         case "$ans" in
18636         [yY]*)  d_u32align="$undef"  ;;
18637         *)      d_u32align="$define" ;;
18638         esac
18639 fi
18640 $rm_try
18641 ;;
18642 esac
18643
18644 : see if ualarm exists
18645 set ualarm d_ualarm
18646 eval $inlibc
18647
18648 : see if umask exists
18649 set umask d_umask
18650 eval $inlibc
18651
18652 : see if unordered exists
18653 set unordered d_unordered
18654 eval $inlibc
18655
18656 : see if unsetenv exists
18657 set unsetenv d_unsetenv
18658 eval $inlibc
18659
18660 : see if usleep exists
18661 set usleep d_usleep
18662 eval $inlibc
18663
18664 : see if prototype for usleep is available
18665 echo " "
18666 set d_usleepproto usleep $i_unistd unistd.h
18667 eval $hasproto
18668
18669 : see if ustat exists
18670 set ustat d_ustat
18671 eval $inlibc
18672
18673 : see if closedir exists
18674 set closedir d_closedir
18675 eval $inlibc
18676
18677 case "$d_closedir" in
18678 "$define")
18679         echo " "
18680         echo "Checking whether closedir() returns a status..." >&4
18681         cat > try.c <<EOM
18682 #$i_dirent I_DIRENT             /**/
18683 #$i_sysdir I_SYS_DIR            /**/
18684 #$i_sysndir I_SYS_NDIR          /**/
18685 #$i_systypes I_SYS_TYPES        /**/
18686
18687 #if defined(I_SYS_TYPES)
18688 #include <sys/types.h>
18689 #endif
18690 #if defined(I_DIRENT)
18691 #include <dirent.h>
18692 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18693 #include <sys/dir.h>
18694 #endif
18695 #else
18696 #ifdef I_SYS_NDIR
18697 #include <sys/ndir.h>
18698 #else
18699 #ifdef I_SYS_DIR
18700 #ifdef hp9000s500
18701 #include <ndir.h>       /* may be wrong in the future */
18702 #else
18703 #include <sys/dir.h>
18704 #endif
18705 #endif
18706 #endif
18707 #endif
18708 int main() { return closedir(opendir(".")); }
18709 EOM
18710         set try
18711         if eval $compile_ok; then
18712                 if $run ./try > /dev/null 2>&1 ; then
18713                         echo "Yes, it does."
18714                         val="$undef"
18715                 else
18716                         echo "No, it doesn't."
18717                         val="$define"
18718                 fi
18719         else
18720                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18721                 val="$define"
18722         fi
18723         ;;
18724 *)
18725         val="$undef";
18726         ;;
18727 esac
18728 set d_void_closedir
18729 eval $setvar
18730 $rm_try
18731
18732 : see if there is a wait4
18733 set wait4 d_wait4
18734 eval $inlibc
18735
18736 : see if waitpid exists
18737 set waitpid d_waitpid
18738 eval $inlibc
18739
18740 : see if wcstombs exists
18741 set wcstombs d_wcstombs
18742 eval $inlibc
18743
18744 : see if wctomb exists
18745 set wctomb d_wctomb
18746 eval $inlibc
18747
18748 : see if writev exists
18749 set writev d_writev
18750 eval $inlibc
18751
18752 : preserve RCS keywords in files with variable substitution, grrr
18753 Date='$Date'
18754 Id='$Id'
18755 Log='$Log'
18756 RCSfile='$RCSfile'
18757 Revision='$Revision'
18758
18759 : check for alignment requirements
18760 echo " "
18761 case "$usecrosscompile$multiarch" in
18762 *$define*)
18763         $cat <<EOM
18764 You seem to be either cross-compiling or doing a multiarchitecture build,
18765 skipping the memory alignment check.
18766
18767 EOM
18768         case "$alignbytes" in
18769         '') alignbytes=8 ;;
18770         esac
18771         ;;
18772 *)
18773         case "$alignbytes" in
18774         '') echo "Checking alignment constraints..." >&4
18775                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18776                         $cat >try.c <<'EOCP'
18777 typedef long double NV;
18778 EOCP
18779                 else
18780                         $cat >try.c <<'EOCP'
18781 typedef double NV;
18782 EOCP
18783                 fi
18784                 $cat >>try.c <<'EOCP'
18785 #include <stdio.h>
18786 struct foobar {
18787         char foo;
18788         NV bar;
18789 } try_algn;
18790 int main()
18791 {
18792     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18793     return(0);
18794 }
18795 EOCP
18796                 set try
18797                 if eval $compile_ok; then
18798                         dflt=`$run ./try`
18799                 else
18800                         dflt='8'
18801                         echo "(I can't seem to compile the test program...)"
18802                 fi
18803                 ;;
18804         *) dflt="$alignbytes"
18805                 ;;
18806         esac
18807         rp="Doubles must be aligned on a how-many-byte boundary?"
18808         . ./myread
18809         alignbytes="$ans"
18810         $rm_try
18811         ;;
18812 esac
18813
18814
18815 : set the base revision
18816 baserev=5.0
18817
18818 : how do we concatenate cpp tokens here?
18819 echo " "
18820 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18821 $cat >cpp_stuff.c <<'EOCP'
18822 #define RCAT(a,b)a/**/b
18823 #define ACAT(a,b)a ## b
18824 RCAT(Rei,ser)
18825 ACAT(Cir,cus)
18826 EOCP
18827 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18828 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18829         echo "Oh!  Smells like ANSI's been here." >&4
18830         echo "We can catify or stringify, separately or together!"
18831         cpp_stuff=42
18832 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18833         echo "Ah, yes!  The good old days!" >&4
18834         echo "However, in the good old days we don't know how to stringify and"
18835         echo "catify at the same time."
18836         cpp_stuff=1
18837 else
18838         $cat >&4 <<EOM
18839 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18840 You're going to have to edit the values of CAT[2-5] in config.h...
18841 EOM
18842         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18843 fi
18844 $rm -f cpp_stuff.*
18845
18846 : see if this is a db.h system
18847 set db.h i_db
18848 eval $inhdr
18849
18850 case "$i_db" in
18851 $define)
18852         : Check db version.
18853         echo " "
18854         echo "Checking Berkeley DB version ..." >&4
18855         $cat >try.c <<EOCP
18856 #$d_const HASCONST
18857 #ifndef HASCONST
18858 #define const
18859 #endif
18860 #include <sys/types.h>
18861 #include <stdio.h>
18862 #$i_stdlib I_STDLIB
18863 #ifdef I_STDLIB
18864 #include <stdlib.h>
18865 #endif
18866 #include <db.h>
18867 int main(int argc, char *argv[])
18868 {
18869 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18870     int Major, Minor, Patch ;
18871     unsigned long Version ;
18872     (void)db_version(&Major, &Minor, &Patch) ;
18873     if (argc == 2) {
18874         printf("%d %d %d %d %d %d\n",
18875                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18876                Major, Minor, Patch);
18877         exit(0);
18878     }
18879     printf("You have Berkeley DB Version 2 or greater.\n");
18880
18881     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18882                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18883     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18884                 Major, Minor, Patch) ;
18885
18886     /* check that db.h & libdb are compatible */
18887     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18888         printf("db.h and libdb are incompatible.\n") ;
18889         exit(3);
18890     }
18891
18892     printf("db.h and libdb are compatible.\n") ;
18893
18894     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18895                 + DB_VERSION_PATCH ;
18896
18897     /* needs to be >= 2.3.4 */
18898     if (Version < 2003004) {
18899     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18900         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18901         exit(2);
18902     }
18903
18904     exit(0);
18905 #else
18906 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18907     if (argc == 2) {
18908         printf("1 0 0\n");
18909         exit(0);
18910     }
18911     printf("You have Berkeley DB Version 1.\n");
18912     exit(0);    /* DB version < 2: the coast is clear. */
18913 #else
18914     exit(1);    /* <db.h> not Berkeley DB? */
18915 #endif
18916 #endif
18917 }
18918 EOCP
18919         set try
18920         if eval $compile_ok && $run ./try; then
18921                 echo 'Looks OK.' >&4
18922                 set `$run ./try 1`
18923                 db_version_major=$1
18924                 db_version_minor=$2
18925                 db_version_patch=$3
18926         else
18927                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18928                 i_db=$undef
18929                 case " $libs " in
18930                 *"-ldb "*)
18931                         : Remove db from list of libraries to use
18932                         echo "Removing unusable -ldb from library list" >&4
18933                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18934                         shift
18935                         libs="$*"
18936                         echo "libs = $libs" >&4
18937                         ;;
18938                 esac
18939         fi
18940         $rm_try
18941         ;;
18942 esac
18943
18944 case "$i_db" in
18945 define)
18946         : Check the return type needed for hash
18947         echo " "
18948         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18949         $cat >try.c <<EOCP
18950 #$d_const HASCONST
18951 #ifndef HASCONST
18952 #define const
18953 #endif
18954 #include <sys/types.h>
18955 #include <db.h>
18956
18957 #ifndef DB_VERSION_MAJOR
18958 u_int32_t hash_cb (ptr, size)
18959 const void *ptr;
18960 size_t size;
18961 {
18962 }
18963 HASHINFO info;
18964 int main()
18965 {
18966         info.hash = hash_cb;
18967 }
18968 #endif
18969 EOCP
18970         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18971                 if $contains warning try.out >>/dev/null 2>&1 ; then
18972                         db_hashtype='int'
18973                 else
18974                         db_hashtype='u_int32_t'
18975                 fi
18976         else
18977                 : XXX Maybe we should just give up here.
18978                 db_hashtype=u_int32_t
18979                 $cat try.out >&4
18980                 echo "Help:  I can't seem to compile the db test program." >&4
18981                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18982         fi
18983         $rm_try
18984         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18985         ;;
18986 *)      db_hashtype=u_int32_t
18987         ;;
18988 esac
18989 case "$i_db" in
18990 define)
18991         : Check the return type needed for prefix
18992         echo " "
18993         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18994         cat >try.c <<EOCP
18995 #$d_const HASCONST
18996 #ifndef HASCONST
18997 #define const
18998 #endif
18999 #include <sys/types.h>
19000 #include <db.h>
19001
19002 #ifndef DB_VERSION_MAJOR
19003 size_t prefix_cb (key1, key2)
19004 const DBT *key1;
19005 const DBT *key2;
19006 {
19007 }
19008 BTREEINFO info;
19009 int main()
19010 {
19011         info.prefix = prefix_cb;
19012 }
19013 #endif
19014 EOCP
19015         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19016                 if $contains warning try.out >>/dev/null 2>&1 ; then
19017                         db_prefixtype='int'
19018                 else
19019                         db_prefixtype='size_t'
19020                 fi
19021         else
19022                 db_prefixtype='size_t'
19023                 : XXX Maybe we should just give up here.
19024                 $cat try.out >&4
19025                 echo "Help:  I can't seem to compile the db test program." >&4
19026                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19027         fi
19028         $rm_try
19029         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19030         ;;
19031 *)      db_prefixtype='size_t'
19032         ;;
19033 esac
19034
19035 : How can we generate normalized random numbers ?
19036 echo " "
19037 echo "Looking for a random number function..." >&4
19038 case "$randfunc" in
19039 '')
19040         if set drand48 val -f; eval $csym; $val; then
19041                 dflt="drand48"
19042                 echo "Good, found drand48()." >&4
19043         elif set random val -f; eval $csym; $val; then
19044                 dflt="random"
19045                 echo "OK, found random()." >&4
19046         else
19047                 dflt="rand"
19048                 echo "Yick, looks like I have to use rand()." >&4
19049         fi
19050         echo " "
19051         ;;
19052 *)
19053         dflt="$randfunc"
19054         ;;
19055 esac
19056 cont=true
19057
19058 case "$ccflags" in
19059 *-Dmy_rand=*|*-Dmy_srand=*)
19060         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19061         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19062         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19063         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19064         ;;
19065 esac
19066
19067 while $test "$cont"; do
19068         rp="Use which function to generate random numbers?"
19069         . ./myread
19070         if $test "$ans" = "$dflt"; then
19071                 : null
19072         else
19073                 randbits=''
19074         fi
19075         randfunc="$ans"
19076         if set $ans val -f; eval $csym; $val; then
19077                 cont=''
19078         else
19079                 dflt=y
19080                 rp="I cannot find function $ans. Use that name anyway?"
19081                 . ./myread
19082                 dflt=rand
19083                 case "$ans" in
19084                         [yY]*) cont='';;
19085                 esac
19086         fi
19087         case "$cont" in
19088         '')
19089                 case "$randfunc" in
19090                 drand48)
19091                         drand01="drand48()"
19092                         seedfunc="srand48"
19093                         randbits=48
19094                         randseedtype=long
19095                         ;;
19096                 rand|random)
19097                         case "$randbits" in
19098                         '')
19099 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19100                                 $cat >try.c <<EOCP
19101 #$i_unistd I_UNISTD
19102 #$i_stdlib I_STDLIB
19103 #include <stdio.h>
19104 #ifdef I_UNISTD
19105 #  include <unistd.h>
19106 #endif
19107 #ifdef I_STDLIB
19108 #  include <stdlib.h>
19109 #endif
19110 int main()
19111 {
19112         register int i;
19113         register unsigned long tmp;
19114         register unsigned long max = 0L;
19115
19116         for (i = 1000; i; i--) {
19117                 tmp = (unsigned long) $randfunc();
19118                 if (tmp > max) max = tmp;
19119         }
19120         for (i = 0; max; i++)
19121                 max /= 2;
19122         printf("%d\n",i);
19123 }
19124 EOCP
19125                                 set try
19126                                 if eval $compile_ok; then
19127                                         dflt=`try`
19128                                 else
19129                                         dflt='?'
19130                                         echo "(I can't seem to compile the test program...)"
19131                                 fi
19132                                 ;;
19133                         *)
19134                                 dflt="$randbits"
19135                                 ;;
19136                         esac
19137                         rp="How many bits does your $randfunc() function produce?"
19138                         . ./myread
19139                         randbits="$ans"
19140                         $rm_try
19141                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19142                         seedfunc="s$randfunc"
19143                         randseedtype=unsigned
19144                         ;;
19145                 *)
19146                         dflt="31"
19147                         rp="How many bits does your $randfunc() function produce?"
19148                         . ./myread
19149                         randbits="$ans"
19150                         seedfunc="s$randfunc"
19151                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19152                         if set $seedfunc val -f; eval $csym; $val; then
19153                                 echo "(Using $seedfunc() to seed random generator)"
19154                         else
19155                                 echo "(Warning: no $seedfunc() to seed random generator)"
19156                                 seedfunc=rand
19157                         fi
19158                         randseedtype=unsigned
19159                         ;;
19160                 esac
19161                 ;;
19162         esac
19163 done
19164
19165 : Determine if this is an EBCDIC system
19166 echo " "
19167 echo "Determining whether or not we are on an EBCDIC system..." >&4
19168 $cat >try.c <<'EOM'
19169 int main()
19170 {
19171   if ('M'==0xd4) return 0;
19172   return 1;
19173 }
19174 EOM
19175
19176 val=$undef
19177 set try
19178 if eval $compile_ok; then
19179         if $run ./try; then
19180                 echo "You seem to speak EBCDIC." >&4
19181                 val="$define"
19182         else
19183                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19184         fi
19185 else
19186         echo "I'm unable to compile the test program." >&4
19187         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19188 fi
19189 $rm_try
19190 set ebcdic
19191 eval $setvar
19192
19193 : Check how to flush
19194 echo " "
19195 $cat >&4 <<EOM
19196 Checking how to flush all pending stdio output...
19197 EOM
19198 # I only know how to find the first 32 possibly open files on SunOS.
19199 # See also hints/sunos_4_1.sh and util.c  --AD
19200 case "$osname" in
19201 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19202 esac
19203 $cat >>try.c <<EOCP
19204 #include <stdio.h>
19205 #$i_stdlib I_STDLIB
19206 #ifdef I_STDLIB
19207 #include <stdlib.h>
19208 #endif
19209 #$i_unistd I_UNISTD
19210 #ifdef I_UNISTD
19211 # include <unistd.h>
19212 #endif
19213 #$d_sysconf HAS_SYSCONF
19214 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19215 #ifdef HAS_STDIO_STREAM_ARRAY
19216 # define STDIO_STREAM_ARRAY $stdio_stream_array
19217 #endif
19218 int main() {
19219   FILE* p;
19220   unlink("try.out");
19221   p = fopen("try.out", "w");
19222 #ifdef TRY_FPUTC
19223   fputc('x', p);
19224 #else
19225 # ifdef TRY_FPRINTF
19226   fprintf(p, "x");
19227 # endif
19228 #endif
19229 #ifdef TRY_FFLUSH_NULL
19230   fflush(NULL);
19231 #endif
19232 #ifdef TRY_FFLUSH_ALL
19233   {
19234     long open_max = -1;
19235 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19236     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19237 # else
19238 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19239     open_max = sysconf(_SC_OPEN_MAX);
19240 #  else
19241 #   ifdef FOPEN_MAX
19242     open_max = FOPEN_MAX;
19243 #   else
19244 #    ifdef OPEN_MAX
19245     open_max = OPEN_MAX;
19246 #    else
19247 #     ifdef _NFILE
19248     open_max = _NFILE;
19249 #     endif
19250 #    endif
19251 #   endif
19252 #  endif
19253 # endif
19254 # ifdef HAS_STDIO_STREAM_ARRAY
19255     if (open_max > 0) {
19256       long i;
19257       for (i = 0; i < open_max; i++)
19258             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19259                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19260                 STDIO_STREAM_ARRAY[i]._flag)
19261                 fflush(&STDIO_STREAM_ARRAY[i]);
19262     }
19263   }
19264 # endif
19265 #endif
19266   _exit(42);
19267 }
19268 EOCP
19269 : first we have to find out how _not_ to flush
19270 $to try.c
19271 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19272     output=''
19273     set try -DTRY_FPUTC
19274     if eval $compile; then
19275             $run ./try 2>/dev/null
19276             code="$?"
19277             $from try.out
19278             if $test ! -s try.out -a "X$code" = X42; then
19279                 output=-DTRY_FPUTC
19280             fi
19281     fi
19282     case "$output" in
19283     '')
19284             set try -DTRY_FPRINTF
19285             if eval $compile; then
19286                     $run ./try 2>/dev/null
19287                     code="$?"
19288                     $from try.out
19289                     if $test ! -s try.out -a "X$code" = X42; then
19290                         output=-DTRY_FPRINTF
19291                     fi
19292             fi
19293         ;;
19294     esac
19295 fi
19296 : check for fflush NULL behaviour
19297 case "$fflushNULL" in
19298 '')     set try -DTRY_FFLUSH_NULL $output
19299         if eval $compile; then
19300                 $run ./try 2>/dev/null
19301                 code="$?"
19302                 $from try.out
19303                 if $test -s try.out -a "X$code" = X42; then
19304                         fflushNULL="`$cat try.out`"
19305                 else
19306                         if $test "X$code" != X42; then
19307                                 $cat >&4 <<EOM
19308 (If this test failed, don't worry, we'll try another method shortly.)
19309 EOM
19310                         fi
19311                 fi
19312         fi
19313         $rm -f core try.core core.try.*
19314         case "$fflushNULL" in
19315         x)      $cat >&4 <<EOM
19316 Your fflush(NULL) works okay for output streams.
19317 Let's see if it clobbers input pipes...
19318 EOM
19319 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19320 # bug that improperly flushes the input end of pipes.  So we avoid the
19321 # autoflush on fork/system/exec support for now. :-(
19322 $cat >tryp.c <<EOCP
19323 #include <stdio.h>
19324 int
19325 main(int argc, char **argv)
19326 {
19327     char buf[1024];
19328     int i;
19329     char *bp = buf;
19330     while (1) {
19331         while ((i = getc(stdin)) != -1
19332                && (*bp++ = i) != '\n'
19333                && bp < &buf[1024])
19334         /* DO NOTHING */ ;
19335         *bp = '\0';
19336         fprintf(stdout, "%s", buf);
19337         fflush(NULL);
19338         if (i == -1)
19339             return 0;
19340         bp = buf;
19341     }
19342 }
19343 EOCP
19344                 fflushNULL="$define"
19345                 set tryp
19346                 if eval $compile; then
19347                     $rm -f tryp.out
19348                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19349                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19350                        $cat >&4 <<EOM
19351 fflush(NULL) seems to behave okay with input streams.
19352 EOM
19353                         fflushNULL="$define"
19354                     else
19355                         $cat >&4 <<EOM
19356 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19357 EOM
19358                         fflushNULL="$undef"
19359                     fi
19360                 fi
19361                 $rm -f core tryp.c tryp.core core.tryp.*
19362                 ;;
19363         '')     $cat >&4 <<EOM
19364 Your fflush(NULL) isn't working (contrary to ANSI C).
19365 EOM
19366                 fflushNULL="$undef"
19367                 ;;
19368         *)      $cat >&4 <<EOM
19369 Cannot figure out whether your fflush(NULL) works or not.
19370 I'm assuming it doesn't (contrary to ANSI C).
19371 EOM
19372                 fflushNULL="$undef"
19373                 ;;
19374         esac
19375         ;;
19376 $define|true|[yY]*)
19377         fflushNULL="$define"
19378         ;;
19379 *)
19380         fflushNULL="$undef"
19381         ;;
19382 esac
19383 : check explicit looping only if NULL did not work, and if the pipe
19384 : bug does not show up on an explicit flush too
19385 case "$fflushNULL" in
19386 "$undef")
19387         $cat >tryp.c <<EOCP
19388 #include <stdio.h>
19389 int
19390 main(int argc, char **argv)
19391 {
19392     char buf[1024];
19393     int i;
19394     char *bp = buf;
19395     while (1) {
19396         while ((i = getc(stdin)) != -1
19397                && (*bp++ = i) != '\n'
19398                && bp < &buf[1024])
19399         /* DO NOTHING */ ;
19400         *bp = '\0';
19401         fprintf(stdout, "%s", buf);
19402         fflush(stdin);
19403         if (i == -1)
19404             return 0;
19405         bp = buf;
19406     }
19407 }
19408 EOCP
19409         set tryp
19410         if eval $compile; then
19411             $rm -f tryp.out
19412             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19413             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19414                $cat >&4 <<EOM
19415 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19416 EOM
19417                 : now check for fflushall behaviour
19418                 case "$fflushall" in
19419                 '')     set try -DTRY_FFLUSH_ALL $output
19420                         if eval $compile; then
19421                                 $cat >&4 <<EOM
19422 (Now testing the other method--but note that this also may fail.)
19423 EOM
19424                                 $run ./try 2>/dev/null
19425                                 code=$?
19426                                 $from try.out
19427                                 if $test -s try.out -a "X$code" = X42; then
19428                                         fflushall="`$cat try.out`"
19429                                 fi
19430                         fi
19431                         $rm_try
19432                         case "$fflushall" in
19433                         x)      $cat >&4 <<EOM
19434 Whew. Flushing explicitly all the stdio streams works.
19435 EOM
19436                                 fflushall="$define"
19437                                 ;;
19438                         '')     $cat >&4 <<EOM
19439 Sigh. Flushing explicitly all the stdio streams doesn't work.
19440 EOM
19441                                 fflushall="$undef"
19442                                 ;;
19443                         *)      $cat >&4 <<EOM
19444 Cannot figure out whether flushing stdio streams explicitly works or not.
19445 I'm assuming it doesn't.
19446 EOM
19447                                 fflushall="$undef"
19448                                 ;;
19449                         esac
19450                         ;;
19451                 "$define"|true|[yY]*)
19452                         fflushall="$define"
19453                         ;;
19454                 *)
19455                         fflushall="$undef"
19456                         ;;
19457                 esac
19458             else
19459                 $cat >&4 <<EOM
19460 All is futile.  Even fflush(stdin) clobbers input pipes!
19461 EOM
19462                 fflushall="$undef"
19463             fi
19464         else
19465             fflushall="$undef"
19466         fi
19467         $rm -f core tryp.c tryp.core core.tryp.*
19468         ;;
19469 *)      fflushall="$undef"
19470         ;;
19471 esac
19472
19473 case "$fflushNULL$fflushall" in
19474 undefundef)
19475         $cat <<EOM
19476 OK, I give up.  I cannot figure out how to flush pending stdio output.
19477 We won't be flushing handles at all before fork/exec/popen.
19478 EOM
19479         ;;
19480 esac
19481 $rm_try tryp
19482
19483 : Store the full pathname to the ar program for use in the C program
19484 : Respect a hint or command line value for full_ar.
19485 case "$full_ar" in
19486 '') full_ar=$ar ;;
19487 esac
19488
19489 : Store the full pathname to the sed program for use in the C program
19490 full_sed=$sed
19491
19492 : see what type gids are declared as in the kernel
19493 echo " "
19494 echo "Looking for the type for group ids returned by getgid()."
19495 set gid_t gidtype xxx stdio.h sys/types.h
19496 eval $typedef
19497 case "$gidtype" in
19498 xxx)
19499         xxx=`./findhdr sys/user.h`
19500         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19501         case $1 in
19502         unsigned) dflt="$1 $2" ;;
19503         *) dflt="$1" ;;
19504         esac
19505         ;;
19506 *) dflt="$gidtype";;
19507 esac
19508 case "$gidtype" in
19509 gid_t) echo "gid_t found." ;;
19510 *)      rp="What is the type for group ids returned by getgid()?"
19511         . ./myread
19512         gidtype="$ans"
19513         ;;
19514 esac
19515
19516 : Check the size of GID
19517 echo " "
19518 case "$gidtype" in
19519 *_t) zzz="$gidtype"     ;;
19520 *)   zzz="gid"          ;;
19521 esac
19522 echo "Checking the size of $zzz..." >&4
19523 cat > try.c <<EOCP
19524 #include <sys/types.h>
19525 #include <stdio.h>
19526 #$i_stdlib I_STDLIB
19527 #ifdef I_STDLIB
19528 #include <stdlib.h>
19529 #endif
19530 int main() {
19531     printf("%d\n", (int)sizeof($gidtype));
19532     exit(0);
19533 }
19534 EOCP
19535 set try
19536 if eval $compile_ok; then
19537         yyy=`$run ./try`
19538         case "$yyy" in
19539         '')     gidsize=4
19540                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19541                 ;;
19542         *)      gidsize=$yyy
19543                 echo "Your $zzz is $gidsize bytes long."
19544                 ;;
19545         esac
19546 else
19547         gidsize=4
19548         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19549 fi
19550
19551
19552 : Check if GID is signed
19553 echo " "
19554 case "$gidtype" in
19555 *_t) zzz="$gidtype"     ;;
19556 *)   zzz="gid"          ;;
19557 esac
19558 echo "Checking the sign of $zzz..." >&4
19559 cat > try.c <<EOCP
19560 #include <sys/types.h>
19561 #include <stdio.h>
19562 int main() {
19563         $gidtype foo = -1;
19564         if (foo < 0)
19565                 printf("-1\n");
19566         else
19567                 printf("1\n");
19568 }
19569 EOCP
19570 set try
19571 if eval $compile; then
19572         yyy=`$run ./try`
19573         case "$yyy" in
19574         '')     gidsign=1
19575                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19576                 ;;
19577         *)      gidsign=$yyy
19578                 case "$gidsign" in
19579                  1) echo "Your $zzz is unsigned." ;;
19580                 -1) echo "Your $zzz is signed."   ;;
19581                 esac
19582                 ;;
19583         esac
19584 else
19585         gidsign=1
19586         echo "(I can't compile the test program--guessing unsigned.)" >&4
19587 fi
19588
19589
19590 : Check 64bit sizes
19591 echo " "
19592
19593 if $test X"$quadtype" != X; then
19594
19595 echo "Checking how to print 64-bit integers..." >&4
19596
19597 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19598         $cat >try.c <<'EOCP'
19599 #include <sys/types.h>
19600 #include <stdio.h>
19601 int main() {
19602   int q = 12345678901;
19603   printf("%ld\n", q);
19604 }
19605 EOCP
19606         set try
19607         if eval $compile; then
19608                 yyy=`$run ./try`
19609                 case "$yyy" in
19610                 12345678901)
19611                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19612                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19613                         echo "We will use %d."
19614                         ;;
19615                 esac
19616         fi
19617 fi
19618
19619 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19620         $cat >try.c <<'EOCP'
19621 #include <sys/types.h>
19622 #include <stdio.h>
19623 int main() {
19624   long q = 12345678901;
19625   printf("%ld\n", q);
19626 }
19627 EOCP
19628         set try
19629         if eval $compile; then
19630                 yyy=`$run ./try`
19631                 case "$yyy" in
19632                 12345678901)
19633                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19634                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19635                         echo "We will use %ld."
19636                         ;;
19637                 esac
19638         fi
19639 fi
19640
19641 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19642         $cat >try.c <<'EOCP'
19643 #include <sys/types.h>
19644 #include <inttypes.h>
19645 #include <stdio.h>
19646 int main() {
19647   int64_t q = 12345678901;
19648   printf("%" PRId64 "\n", q);
19649 }
19650 EOCP
19651         set try
19652         if eval $compile; then
19653                 yyy=`$run ./try`
19654                 case "$yyy" in
19655                 12345678901)
19656                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19657                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19658                         echo "We will use the C9X style."
19659                         ;;
19660                 esac
19661         fi
19662 fi
19663
19664 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19665         $cat >try.c <<EOCP
19666 #include <sys/types.h>
19667 #include <stdio.h>
19668 int main() {
19669   $quadtype q = 12345678901;
19670   printf("%Ld\n", q);
19671 }
19672 EOCP
19673         set try
19674         if eval $compile; then
19675                 yyy=`$run ./try`
19676                 case "$yyy" in
19677                 12345678901)
19678                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19679                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19680                         echo "We will use %Ld."
19681                         ;;
19682                 esac
19683         fi
19684 fi
19685
19686 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19687         $cat >try.c <<'EOCP'
19688 #include <sys/types.h>
19689 #include <stdio.h>
19690 int main() {
19691   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19692   printf("%lld\n", q);
19693 }
19694 EOCP
19695         set try
19696         if eval $compile; then
19697                 yyy=`$run ./try`
19698                 case "$yyy" in
19699                 12345678901)
19700                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19701                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19702                         echo "We will use the %lld style."
19703                         ;;
19704                 esac
19705         fi
19706 fi
19707
19708 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19709         $cat >try.c <<EOCP
19710 #include <sys/types.h>
19711 #include <stdio.h>
19712 int main() {
19713   $quadtype q = 12345678901;
19714   printf("%qd\n", q);
19715 }
19716 EOCP
19717         set try
19718         if eval $compile; then
19719                 yyy=`$run ./try`
19720                 case "$yyy" in
19721                 12345678901)
19722                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19723                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19724                         echo "We will use %qd."
19725                         ;;
19726                 esac
19727         fi
19728 fi
19729
19730 if $test X"$sPRId64" = X; then
19731         echo "Cannot figure out how to print 64-bit integers." >&4
19732 fi
19733 $rm_try
19734
19735 fi
19736
19737 case "$sPRId64" in
19738 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19739         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19740         ;;
19741 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19742         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19743         ;;
19744 esac
19745
19746 : Check format strings for internal types
19747 echo " "
19748 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19749
19750 if $test X"$ivsize" = X8; then
19751         ivdformat="$sPRId64"
19752         uvuformat="$sPRIu64"
19753         uvoformat="$sPRIo64"
19754         uvxformat="$sPRIx64"
19755         uvXUformat="$sPRIXU64"
19756 else
19757         if $test X"$ivsize" = X"$longsize"; then
19758                 ivdformat='"ld"'
19759                 uvuformat='"lu"'
19760                 uvoformat='"lo"'
19761                 uvxformat='"lx"'
19762                 uvXUformat='"lX"'
19763         else
19764                 if $test X"$ivsize" = X"$intsize"; then
19765                         ivdformat='"d"'
19766                         uvuformat='"u"'
19767                         uvoformat='"o"'
19768                         uvxformat='"x"'
19769                         uvXUformat='"X"'
19770                 else
19771                         : far out
19772                         if $test X"$ivsize" = X"$shortsize"; then
19773                                 ivdformat='"hd"'
19774                                 uvuformat='"hu"'
19775                                 uvoformat='"ho"'
19776                                 uvxformat='"hx"'
19777                                 uvXUformat='"hX"'
19778                         fi
19779                 fi
19780         fi
19781 fi
19782
19783 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19784         nveformat="$sPRIeldbl"
19785         nvfformat="$sPRIfldbl"
19786         nvgformat="$sPRIgldbl"
19787         nvEUformat="$sPRIEUldbl"
19788         nvFUformat="$sPRIFUldbl"
19789         nvGUformat="$sPRIGUldbl"
19790 else
19791         nveformat='"e"'
19792         nvfformat='"f"'
19793         nvgformat='"g"'
19794         nvEUformat='"E"'
19795         nvFUformat='"F"'
19796         nvGUformat='"G"'
19797 fi
19798
19799 case "$ivdformat" in
19800 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19801     exit 1
19802     ;;
19803 esac
19804
19805 : Check format string for GID
19806
19807 echo " "
19808 $echo "Checking the format string to be used for gids..." >&4
19809
19810 case "$gidsign" in
19811 -1)     if $test X"$gidsize" = X"$ivsize"; then
19812                 gidformat="$ivdformat"
19813         else
19814                 if $test X"$gidsize" = X"$longsize"; then
19815                         gidformat='"ld"'
19816                 else
19817                         if $test X"$gidsize" = X"$intsize"; then
19818                                 gidformat='"d"'
19819                         else
19820                                 if $test X"$gidsize" = X"$shortsize"; then
19821                                         gidformat='"hd"'
19822                                 fi
19823                         fi
19824                 fi
19825         fi
19826         ;;
19827 *)      if $test X"$gidsize" = X"$uvsize"; then
19828                 gidformat="$uvuformat"
19829         else
19830                 if $test X"$gidsize" = X"$longsize"; then
19831                         gidformat='"lu"'
19832                 else
19833                         if $test X"$gidsize" = X"$intsize"; then
19834                                 gidformat='"u"'
19835                         else
19836                                 if $test X"$gidsize" = X"$shortsize"; then
19837                                         gidformat='"hu"'
19838                                 fi
19839                         fi
19840                 fi
19841         fi
19842         ;;
19843 esac
19844
19845 : see if getgroups exists
19846 set getgroups d_getgrps
19847 eval $inlibc
19848
19849 : see if setgroups exists
19850 set setgroups d_setgrps
19851 eval $inlibc
19852
19853 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19854 echo " "
19855 case "$d_getgrps$d_setgrps" in
19856 *define*)
19857         case "$groupstype" in
19858         '') dflt="$gidtype" ;;
19859         *)  dflt="$groupstype" ;;
19860         esac
19861         $cat <<EOM
19862 What type of pointer is the second argument to getgroups() and setgroups()?
19863 Usually this is the same as group ids, $gidtype, but not always.
19864
19865 EOM
19866         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19867         . ./myread
19868         groupstype="$ans"
19869         ;;
19870 *)  groupstype="$gidtype";;
19871 esac
19872
19873 : MAD = Misc Attribute Definition
19874
19875 if $test $patchlevel -lt 9; then
19876 : MAD is not available in 5.8.x or earlier.
19877     ans=n;
19878 else
19879     case "$mad" in
19880     $define|true|[yY]*) dflt='y' ;;
19881     *)                  dflt='n' ;;
19882     esac
19883     cat <<EOM
19884
19885 Would you like to build with Misc Attribute Decoration? This is development
19886 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19887 overhead on the interpreter.
19888
19889 If this doesn't make any sense to you, just accept the default '$dflt'.
19890 EOM
19891     rp='Build Perl with MAD?'
19892     . ./myread
19893 fi
19894 case "$ans" in
19895 y|Y)    val="$define"
19896         madlyh='madly.h madly.act madly.tab'
19897         madlysrc='madly.c'
19898         madlyobj="madly$_o" ;;
19899 *)      val="$undef"
19900         madlyh=''
19901         madlysrc=''
19902         madlyobj='' ;;
19903 esac
19904 set mad
19905 eval $setvar
19906
19907 : check whether make sets MAKE
19908 echo " "
19909 echo "Checking if your $make program sets \$(MAKE)..." >&4
19910 case "$make_set_make" in
19911 '')
19912         $sed 's/^X //' > testmake.mak << 'EOF'
19913 Xall:
19914 X       @echo 'maketemp="$(MAKE)"'
19915 EOF
19916         case "`$make -f testmake.mak 2>/dev/null`" in
19917         *maketemp=*) make_set_make='#' ;;
19918         *)      make_set_make="MAKE=$make" ;;
19919         esac
19920         $rm -f testmake.mak
19921         ;;
19922 esac
19923 case "$make_set_make" in
19924 '#') echo "Yup, it does.";;
19925 *) echo "Nope, it doesn't.";;
19926 esac
19927
19928 : see what type is used for mode_t
19929 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19930 set mode_t modetype int stdio.h sys/types.h
19931 eval $typedef_ask
19932
19933 : see if we need va_copy
19934 echo " "
19935 case "$i_stdarg" in
19936 "$define")
19937         $cat >try.c <<EOCP
19938 #include <stdarg.h>
19939 #include <stdio.h>
19940 #$i_stdlib I_STDLIB
19941 #ifdef I_STDLIB
19942 #include <stdlib.h>
19943 #endif
19944 #include <signal.h>
19945
19946 int
19947 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19948 {
19949   return vfprintf(f, fmt, *valp);
19950 }
19951
19952 int
19953 myvfprintf(FILE *f, const  char *fmt, va_list val)
19954 {
19955   return ivfprintf(f, fmt, &val);
19956 }
19957
19958 int
19959 myprintf(char *fmt, ...)
19960 {
19961   va_list val;
19962   va_start(val, fmt);
19963   return myvfprintf(stdout, fmt, val);
19964 }
19965
19966 int
19967 main(int ac, char **av)
19968 {
19969   signal(SIGSEGV, exit);
19970
19971   myprintf("%s%cs all right, then\n", "that", '\'');
19972   exit(0);
19973 }
19974 EOCP
19975         set try
19976         if eval $compile && $run ./try 2>&1 >/dev/null; then
19977                 case "`$run ./try`" in
19978                 "that's all right, then")
19979                         okay=yes
19980                         ;;
19981                 esac
19982         fi
19983         case "$okay" in
19984         yes)    echo "It seems that you don't need va_copy()." >&4
19985                 need_va_copy="$undef"
19986                 ;;
19987         *)      echo "It seems that va_copy() or similar will be needed." >&4
19988                 need_va_copy="$define"
19989                 ;;
19990         esac
19991         $rm_try
19992         ;;
19993 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19994         ;;
19995 esac
19996
19997 : see what type is used for size_t
19998 rp="What is the type used for the length parameter for string functions?"
19999 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20000 eval $typedef_ask
20001
20002 : check for type of arguments to gethostbyaddr. 
20003 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20004         case "$d_gethbyaddr" in
20005         $define)
20006                 $cat <<EOM
20007
20008 Checking to see what type of arguments are accepted by gethostbyaddr().
20009 EOM
20010                 hdrs="$define sys/types.h
20011                         $d_socket sys/socket.h 
20012                         $i_niin netinet/in.h 
20013                         $i_netdb netdb.h
20014                         $i_unistd unistd.h"
20015                 : The first arg can 'char *' or 'void *'
20016                 : The second arg is some of integral type
20017                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20018                         for yyy in size_t long int; do
20019                                 case "$netdb_host_type" in
20020                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20021                                         if ./protochk "$try" $hdrs; then
20022                                                 echo "Your system accepts $xxx for the first arg."
20023                                                 echo "...and $yyy for the second arg."
20024                                                 netdb_host_type="$xxx"
20025                                                 netdb_hlen_type="$yyy"
20026                                         fi
20027                                         ;;
20028                                 esac
20029                         done
20030                 done
20031                 : In case none of those worked, prompt the user.
20032                 case "$netdb_host_type" in
20033                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20034                         dflt='char *'
20035                         . ./myread
20036                         netdb_host_type=$ans
20037                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20038                         dflt="$sizetype"
20039                         . ./myread
20040                         netdb_hlen_type=$ans
20041                         ;;
20042                 esac
20043                 ;;
20044         *)      : no gethostbyaddr, so pick harmless defaults
20045                 netdb_host_type='char *'
20046                 netdb_hlen_type="$sizetype"
20047                 ;;
20048         esac
20049         # Remove the "const" if needed. -- but then we'll have a 
20050         # prototype clash!
20051         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20052 fi
20053
20054 : check for type of argument to gethostbyname. 
20055 if test "X$netdb_name_type" = X ; then
20056         case "$d_gethbyname" in
20057         $define)
20058                 $cat <<EOM
20059
20060 Checking to see what type of argument is accepted by gethostbyname().
20061 EOM
20062                 hdrs="$define sys/types.h
20063                         $d_socket sys/socket.h 
20064                         $i_niin netinet/in.h 
20065                         $i_netdb netdb.h
20066                         $i_unistd unistd.h"
20067                 for xxx in "const char *" "char *"; do
20068                         case "$netdb_name_type" in
20069                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20070                                 if ./protochk "$try" $hdrs; then
20071                                         echo "Your system accepts $xxx."
20072                                         netdb_name_type="$xxx"
20073                                 fi
20074                                 ;;
20075                         esac
20076                 done
20077                 : In case none of those worked, prompt the user.
20078                 case "$netdb_name_type" in
20079                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20080                         dflt='char *'
20081                         . ./myread
20082                         netdb_name_type=$ans
20083                         ;;
20084                 esac
20085                 ;;
20086         *)      : no gethostbyname, so pick harmless default
20087                 netdb_name_type='char *'
20088                 ;;
20089         esac
20090 fi
20091
20092 : check for type of 1st argument to getnetbyaddr. 
20093 if test "X$netdb_net_type" = X ; then
20094         case "$d_getnbyaddr" in
20095         $define)
20096                 $cat <<EOM
20097
20098 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20099 EOM
20100                 hdrs="$define sys/types.h
20101                         $d_socket sys/socket.h 
20102                         $i_niin netinet/in.h 
20103                         $i_netdb netdb.h
20104                         $i_unistd unistd.h"
20105                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20106                         case "$netdb_net_type" in
20107                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20108                                 if ./protochk "$try" $hdrs; then
20109                                         echo "Your system accepts $xxx."
20110                                         netdb_net_type="$xxx"
20111                                 fi
20112                                 ;;
20113                         esac
20114                 done
20115                 : In case none of those worked, prompt the user.
20116                 case "$netdb_net_type" in
20117                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20118                         dflt='long'
20119                         . ./myread
20120                         netdb_net_type=$ans
20121                         ;;
20122                 esac
20123                 ;;
20124         *)      : no getnetbyaddr, so pick harmless default
20125                 netdb_net_type='long'
20126                 ;;
20127         esac
20128 fi
20129 : locate the preferred pager for this system
20130 fn=f/
20131 case "$pager" in
20132 '')
20133         dflt=''
20134         case "$pg" in
20135         /*) dflt=$pg;;
20136         [a-zA-Z]:/*) dflt=$pg;;
20137         esac
20138         case "$more" in
20139         /*) dflt=$more;;
20140         [a-zA-Z]:/*) dflt=$more;;
20141         esac
20142         case "$less" in
20143         /*) dflt=$less;;
20144         [a-zA-Z]:/*) dflt=$less;;
20145         esac
20146         case "$dflt" in
20147         '') dflt=/usr/ucb/more;;
20148         esac
20149         ;;
20150 *)      dflt="$pager"
20151         fn="f/($pager)"
20152         ;;
20153 esac
20154 echo " "
20155 rp='What pager is used on your system?'
20156 . ./getfile
20157 pager="$ans"
20158
20159 : see what type pids are declared as in the kernel
20160 rp="What is the type of process ids on this system?"
20161 set pid_t pidtype int stdio.h sys/types.h
20162 eval $typedef_ask
20163
20164 : see if ar generates random libraries by itself
20165 echo " "
20166 echo "Checking how to generate random libraries on your machine..." >&4
20167 echo 'int bar1() { return bar2(); }' > bar1.c
20168 echo 'int bar2() { return 2; }' > bar2.c
20169 $cat > foo.c <<EOP
20170 #$i_stdlib I_STDLIB
20171 #ifdef I_STDLIB
20172 #include <stdlib.h>
20173 #endif
20174 int main() { printf("%d\n", bar1()); exit(0); }
20175 EOP
20176 $cc $ccflags -c bar1.c >/dev/null 2>&1
20177 $cc $ccflags -c bar2.c >/dev/null 2>&1
20178 $cc $ccflags -c foo.c >/dev/null 2>&1
20179 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20180 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20181         $run ./foobar >/dev/null 2>&1; then
20182         echo "$ar appears to generate random libraries itself."
20183         orderlib=false
20184         if [ "X$ranlib" = "X" ]; then
20185             ranlib=":"
20186         fi
20187 elif $ar s bar$_a >/dev/null 2>&1 &&
20188         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20189         $run ./foobar >/dev/null 2>&1; then
20190                 echo "a table of contents needs to be added with '$ar s'."
20191                 orderlib=false
20192                 ranlib="$ar s"
20193 elif $ar ts bar$_a >/dev/null 2>&1 &&
20194         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20195         $run ./foobar >/dev/null 2>&1; then
20196                 echo "a table of contents needs to be added with '$ar ts'."
20197                 orderlib=false
20198                 ranlib="$ar ts"
20199 else
20200         case "$ranlib" in
20201         :) ranlib='';;
20202         '')
20203                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20204                 $test -f $ranlib || ranlib=''
20205                 ;;
20206         esac
20207         if $test -n "$ranlib"; then
20208                 echo "your system has '$ranlib'; we'll use that."
20209                 orderlib=false
20210         else
20211                 echo "your system doesn't seem to support random libraries"
20212                 echo "so we'll use lorder and tsort to order the libraries."
20213                 orderlib=true
20214                 ranlib=":"
20215         fi
20216 fi
20217 $rm -f foo* bar*
20218
20219 : see if this is a values.h system
20220 set values.h i_values
20221 eval $inhdr
20222
20223 : Check the max offset that gmtime and localtime accept
20224 echo "Checking max offsets that gmtime () accepts"
20225
20226 case $i_values in
20227     define) yyy="#include <values.h>" ;;
20228     *)      yyy="" ;;
20229     esac
20230
20231 case "$sGMTIME_min/$sGMTIME_max" in
20232     0/0|/)
20233         $cat >try.c <<EOCP
20234 #include <sys/types.h>
20235 #include <stdio.h>
20236 #include <time.h>
20237 $yyy
20238
20239 int i;
20240 struct tm *tmp;
20241 time_t pt;
20242
20243 void gm_check (time_t t, int min_year, int max_year)
20244 {
20245     tmp = gmtime (&t);
20246     if ( tmp == NULL ||
20247         /* Check tm_year overflow */
20248          tmp->tm_year < min_year || tmp->tm_year > max_year)
20249         tmp = NULL;
20250     else
20251         pt = t;
20252     } /* gm_check */
20253
20254 int check_max ()
20255 {
20256     tmp = NULL;
20257     pt  = 0;
20258 #ifdef MAXLONG
20259     gm_check (MAXLONG, 69, 0x7fffffff);
20260 #endif
20261     if (tmp == NULL || tmp->tm_year < 0) {
20262         for (i = 63; i >= 0; i--) {
20263             time_t x = pt | ((time_t)1 << i);
20264             if (x < 0 || x < pt) continue;
20265             gm_check (x, 69, 0x7fffffff);
20266             }
20267         }
20268     printf ("sGMTIME_max=%ld\n", pt);
20269     return (0);
20270     } /* check_max */
20271
20272 int check_min ()
20273 {
20274     tmp = NULL;
20275     pt  = 0;
20276 #ifdef MINLONG
20277     gm_check (MINLONG, -1900, 70);
20278 #endif
20279     if (tmp == NULL) {
20280         for (i = 36; i >= 0; i--) {
20281             time_t x = pt - ((time_t)1 << i);
20282             if (x > 0) continue;
20283             gm_check (x, -1900, 70);
20284             }
20285         }
20286     printf ("sGMTIME_min=%ld\n", pt);
20287     return (0);
20288     } /* check_min */
20289
20290 int main (int argc, char *argv[])
20291 {
20292     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20293     check_max ();
20294     check_min ();
20295     return (0);
20296     } /* main */
20297 EOCP
20298         set try
20299         if eval $compile; then
20300             eval `$run ./try`
20301         else
20302             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20303             fi
20304         $rm_try
20305         ;;
20306     esac
20307
20308 echo "Checking max offsets that localtime () accepts"
20309
20310 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20311     0/0|/)
20312         $cat >try.c <<EOCP
20313 #include <sys/types.h>
20314 #include <stdio.h>
20315 #include <time.h>
20316 $yyy
20317
20318 int i;
20319 struct tm *tmp;
20320 time_t pt;
20321
20322 void local_check (time_t t, int min_year, int max_year)
20323 {
20324     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20325         tmp = NULL;
20326     else
20327         tmp = localtime (&t);
20328     if ( tmp == NULL ||
20329         /* Check tm_year overflow */
20330          tmp->tm_year < min_year || tmp->tm_year > max_year)
20331         tmp = NULL;
20332     else
20333         pt = t;
20334     } /* local_check */
20335
20336 int check_max ()
20337 {
20338     tmp = NULL;
20339     pt  = 0;
20340 #ifdef MAXLONG
20341     local_check (MAXLONG, 69, 0x7fffffff);
20342 #endif
20343     if (tmp == NULL || tmp->tm_year < 0) {
20344         for (i = 63; i >= 0; i--) {
20345             time_t x = pt | ((time_t)1 << i);
20346             if (x < 0 || x < pt) continue;
20347             local_check (x, 69, 0x7fffffff);
20348             }
20349         }
20350     printf ("sLOCALTIME_max=%ld\n", pt);
20351     return (0);
20352    } /* check_max */
20353
20354 int check_min ()
20355 {
20356     tmp = NULL;
20357     pt  = 0;
20358 #ifdef MINLONG
20359     local_check (MINLONG, -1900, 70);
20360 #endif
20361     if (tmp == NULL) {
20362         for (i = 36; i >= 0; i--) {
20363             time_t x = pt - ((time_t)1 << i);
20364             if (x > 0) continue;
20365             local_check (x, -1900, 70);
20366             }
20367         }
20368     printf ("sLOCALTIME_min=%ld\n", pt);
20369     return (0);
20370     } /* check_min */
20371
20372 int main (int argc, char *argv[])
20373 {
20374     check_max ();
20375     check_min ();
20376     return (0);
20377     } /* main */
20378 EOCP
20379         set try
20380         if eval $compile; then
20381             eval `$run ./try`
20382         else
20383             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20384             fi
20385         $rm_try
20386         ;;
20387     esac
20388
20389 : check for type of arguments to select.
20390 case "$selecttype" in
20391 '') case "$d_select" in
20392         $define)
20393                 echo " "
20394                 $cat <<EOM
20395 Checking to see what type of arguments are accepted by select().
20396 EOM
20397                 hdrs="$define sys/types.h
20398                         $i_systime sys/time.h
20399                         $i_sysselct sys/select.h
20400                         $d_socket sys/socket.h"
20401                 : The first arg can be int, unsigned, or size_t
20402                 : The last arg may or may not be 'const'
20403                 val=''
20404                 : void pointer has been seen but using that
20405                 : breaks the selectminbits test
20406                 for xxx in 'fd_set *' 'int *'; do
20407                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20408                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20409                                         case "$val" in
20410                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20411                                                 if ./protochk "$try" $hdrs; then
20412                                                         echo "Your system accepts $xxx."
20413                                                         val="$xxx"
20414                                                 fi
20415                                                 ;;
20416                                         esac
20417                                 done
20418                         done
20419                 done
20420                 case "$val" in
20421                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20422                         case "$d_fd_set" in
20423                                 $define) dflt="fd_set *" ;;
20424                                 *)              dflt="int *" ;;
20425                         esac
20426                         . ./myread
20427                         val=$ans
20428                         ;;
20429                 esac
20430                 selecttype="$val"
20431                 ;;
20432         *)      : no select, so pick a harmless default
20433                 selecttype='int *'
20434                 ;;
20435         esac
20436         ;;
20437 esac
20438
20439 : check for the select 'width'
20440 case "$selectminbits" in
20441 '') safebits=`expr $ptrsize \* 8`
20442     case "$d_select" in
20443         $define)
20444                 $cat <<EOM
20445
20446 Checking to see on how many bits at a time your select() operates...
20447 EOM
20448                 $cat >try.c <<EOCP
20449 #include <sys/types.h>
20450 #$i_time I_TIME
20451 #$i_systime I_SYS_TIME
20452 #$i_systimek I_SYS_TIME_KERNEL
20453 #ifdef I_TIME
20454 #   include <time.h>
20455 #endif
20456 #ifdef I_SYS_TIME
20457 #   ifdef I_SYS_TIME_KERNEL
20458 #       define KERNEL
20459 #   endif
20460 #   include <sys/time.h>
20461 #   ifdef I_SYS_TIME_KERNEL
20462 #       undef KERNEL
20463 #   endif
20464 #endif
20465 #$i_sysselct I_SYS_SELECT
20466 #ifdef I_SYS_SELECT
20467 #include <sys/select.h>
20468 #endif
20469 #$d_socket HAS_SOCKET
20470 #ifdef HAS_SOCKET
20471 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20472 #endif
20473 #include <stdio.h>
20474 #$i_stdlib I_STDLIB
20475 #ifdef I_STDLIB
20476 #include <stdlib.h>
20477 #endif
20478 $selecttype b;
20479 #define S sizeof(*(b))
20480 #define MINBITS 64
20481 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20482 #define NBITS  (NBYTES * 8)
20483 int main() {
20484     char *s = (char *)malloc(NBYTES);
20485     struct timeval t;
20486     int i;
20487     FILE* fp;
20488     int fd;
20489
20490     if (!s)
20491         exit(1);
20492     fclose(stdin);
20493     fp = fopen("try.c", "r");
20494     if (fp == 0)
20495       exit(2);
20496     fd = fileno(fp);
20497     if (fd < 0)
20498       exit(3);
20499     b = ($selecttype)s;
20500     for (i = 0; i < NBITS; i++)
20501         FD_SET(i, b);
20502     t.tv_sec  = 0;
20503     t.tv_usec = 0;
20504     select(fd + 1, b, 0, 0, &t);
20505     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20506     free(s);
20507     printf("%d\n", i + 1);
20508     return 0;
20509 }
20510 EOCP
20511                 set try
20512                 if eval $compile_ok; then
20513                         selectminbits=`$run ./try`
20514                         case "$selectminbits" in
20515                         '')     cat >&4 <<EOM
20516 Cannot figure out on how many bits at a time your select() operates.
20517 I'll play safe and guess it is $safebits bits.
20518 EOM
20519                                 selectminbits=$safebits
20520                                 bits="$safebits bits"
20521                                 ;;
20522                         1)      bits="1 bit" ;;
20523                         *)      bits="$selectminbits bits" ;;
20524                         esac
20525                         echo "Your select() operates on $bits at a time." >&4
20526                 else
20527                         rp='What is the minimum number of bits your select() operates on?'
20528                         case "$byteorder" in
20529                         12345678)       dflt=64 ;;
20530                         1234)           dflt=32 ;;
20531                         *)              dflt=1  ;;
20532                         esac
20533                         . ./myread
20534                         val=$ans
20535                         selectminbits="$val"
20536                 fi
20537                 $rm_try
20538                 ;;
20539         *)      : no select, so pick a harmless default
20540                 selectminbits=$safebits
20541                 ;;
20542         esac
20543         ;;
20544 esac
20545
20546 : Trace out the files included by signal.h, then look for SIGxxx names.
20547 if [ "X$fieldn" = X ]; then
20548         : Just make some guesses.  We check them later.
20549         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20550 else
20551         xxx=`echo '#include <signal.h>' |
20552         $cppstdin $cppminus $cppflags 2>/dev/null |
20553         $grep '^[       ]*#.*include' |
20554         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20555                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20556 fi
20557 xxxfiles=''
20558 for xx in $xxx /dev/null ; do
20559         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20560 done
20561 case "$xxxfiles" in
20562 '')     xxxfiles=`./findhdr signal.h` ;;
20563 esac
20564 xxx=`awk '
20565 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20566         print substr($2, 4, 20)
20567 }
20568 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20569         print substr($3, 4, 20)
20570 }' $xxxfiles`
20571 : Append some common names just in case the awk scan failed.
20572 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20573 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20574 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20575 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20576 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20577
20578 : generate a few handy files for later
20579 $cat > signal.c <<EOCP
20580 #include <sys/types.h>
20581 #include <signal.h>
20582 #$i_stdlib I_STDLIB
20583 #ifdef I_STDLIB
20584 #include <stdlib.h>
20585 #endif
20586 #include <stdio.h>
20587 int main() {
20588
20589 /* Strange style to avoid deeply-nested #if/#else/#endif */
20590 #ifndef NSIG
20591 #  ifdef _NSIG
20592 #    define NSIG (_NSIG)
20593 #  endif
20594 #endif
20595
20596 #ifndef NSIG
20597 #  ifdef SIGMAX
20598 #    define NSIG (SIGMAX+1)
20599 #  endif
20600 #endif
20601
20602 #ifndef NSIG
20603 #  ifdef SIG_MAX
20604 #    define NSIG (SIG_MAX+1)
20605 #  endif
20606 #endif
20607
20608 #ifndef NSIG
20609 #  ifdef _SIG_MAX
20610 #    define NSIG (_SIG_MAX+1)
20611 #  endif
20612 #endif
20613
20614 #ifndef NSIG
20615 #  ifdef MAXSIG
20616 #    define NSIG (MAXSIG+1)
20617 #  endif
20618 #endif
20619
20620 #ifndef NSIG
20621 #  ifdef MAX_SIG
20622 #    define NSIG (MAX_SIG+1)
20623 #  endif
20624 #endif
20625
20626 #ifndef NSIG
20627 #  ifdef SIGARRAYSIZE
20628 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20629 #  endif
20630 #endif
20631
20632 #ifndef NSIG
20633 #  ifdef _sys_nsig
20634 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20635 #  endif
20636 #endif
20637
20638 /* Default to some arbitrary number that's big enough to get most
20639    of the common signals.
20640 */
20641 #ifndef NSIG
20642 #    define NSIG 50
20643 #endif
20644
20645 printf("NSIG %d\n", NSIG);
20646
20647 #ifndef JUST_NSIG
20648
20649 EOCP
20650
20651 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20652 {
20653         printf "#ifdef SIG"; printf $1; printf "\n"
20654         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20655         printf $1; printf ");\n"
20656         printf "#endif\n"
20657 }
20658 END {
20659         printf "#endif /* JUST_NSIG */\n";
20660         printf "exit(0);\n}\n";
20661 }
20662 ' >>signal.c
20663 $cat >signal.awk <<'EOP'
20664 BEGIN { ndups = 0 }
20665 $1 ~ /^NSIG$/ { nsig = $2 }
20666 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20667     if ($2 > maxsig) { maxsig = $2 }
20668     if (sig_name[$2]) {
20669         dup_name[ndups] = $1
20670         dup_num[ndups] = $2
20671         ndups++
20672     }
20673     else {
20674         sig_name[$2] = $1
20675         sig_num[$2] = $2
20676     }
20677 }
20678 END {
20679     if (nsig == 0) {
20680         nsig = maxsig + 1
20681     }
20682     printf("NSIG %d\n", nsig);
20683     for (n = 1; n < nsig; n++) {
20684         if (sig_name[n]) {
20685             printf("%s %d\n", sig_name[n], sig_num[n])
20686         }
20687         else {
20688             printf("NUM%d %d\n", n, n)
20689         }
20690     }
20691     for (n = 0; n < ndups; n++) {
20692         printf("%s %d\n", dup_name[n], dup_num[n])
20693     }
20694 }
20695 EOP
20696 $cat >signal_cmd <<EOS
20697 $startsh
20698 if $test -s signal.lst; then
20699     echo "Using your existing signal.lst file"
20700         exit 0
20701 fi
20702 xxx="$xxx"
20703 EOS
20704 $cat >>signal_cmd <<'EOS'
20705
20706 set signal
20707 if eval $compile_ok; then
20708         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20709                 $uniq | $awk -f signal.awk >signal.lst
20710 else
20711         echo "(I can't seem be able to compile the whole test program)" >&4
20712         echo "(I'll try it in little pieces.)" >&4
20713         set signal -DJUST_NSIG
20714         if eval $compile_ok; then
20715                 $run ./signal$_exe > signal.nsg
20716                 $cat signal.nsg
20717         else
20718                 echo "I can't seem to figure out how many signals you have." >&4
20719                 echo "Guessing 50." >&4
20720                 echo 'NSIG 50' > signal.nsg
20721         fi
20722         : Now look at all the signal names, one at a time.
20723         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20724                 $cat > signal.c <<EOCP
20725 #include <sys/types.h>
20726 #include <signal.h>
20727 #include <stdio.h>
20728 int main() {
20729 printf("$xx %d\n", SIG${xx});
20730 return 0;
20731 }
20732 EOCP
20733                 set signal
20734                 if eval $compile; then
20735                         echo "SIG${xx} found."
20736                         $run ./signal$_exe  >> signal.ls1
20737                 else
20738                         echo "SIG${xx} NOT found."
20739                 fi
20740         done
20741         if $test -s signal.ls1; then
20742                 $cat signal.nsg signal.ls1 |
20743                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20744         fi
20745
20746 fi
20747 if $test -s signal.lst; then
20748         :
20749 else
20750         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20751         echo 'kill -l' >signal
20752         set X `csh -f <signal`
20753         $rm -f signal
20754         shift
20755         case $# in
20756         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20757         esac
20758         echo $@ | $tr ' ' $trnl | \
20759             $awk '{ printf "%s %d\n", $1, ++s; }
20760                   END { printf "NSIG %d\n", ++s }' >signal.lst
20761 fi
20762 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20763 EOS
20764 chmod a+x signal_cmd
20765 $eunicefix signal_cmd
20766
20767 : generate list of signal names
20768 echo " "
20769 case "$sig_name_init" in
20770 '') doinit=yes ;;
20771 *)  case "$sig_num_init" in
20772     ''|*,*) doinit=yes ;;
20773     esac ;;
20774 esac
20775 case "$doinit" in
20776 yes)
20777         echo "Generating a list of signal names and numbers..." >&4
20778         . ./signal_cmd
20779         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20780         sig_name=`$awk 'BEGIN { printf "ZERO " }
20781                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20782         sig_num=`$awk  'BEGIN { printf "0 " }
20783                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20784         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20785                              !/^NSIG/   { printf "\"%s\", ", $1 }
20786                              END        { printf "0\n" }' signal.lst`
20787         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20788                              !/^NSIG/   { printf "%d, ", $2}
20789                              END        { printf "0\n"}' signal.lst`
20790         ;;
20791 esac
20792 echo "The following $sig_count signals are available:"
20793 echo " "
20794 echo $sig_name | $awk \
20795 'BEGIN { linelen = 0 }
20796 {
20797         for (i = 1; i <= NF; i++) {
20798                 name = "SIG" $i " "
20799                 linelen = linelen + length(name)
20800                 if (linelen > 70) {
20801                         printf "\n"
20802                         linelen = length(name)
20803                 }
20804                 printf "%s", name
20805         }
20806         printf "\n"
20807 }'
20808 sig_size=`echo $sig_name | awk '{print NF}'`
20809 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20810
20811 : Check size of size
20812 echo " "
20813 case "$sizetype" in
20814 *_t) zzz="$sizetype"    ;;
20815 *)   zzz="filesize"     ;;
20816 esac
20817 echo "Checking the size of $zzz..." >&4
20818 cat > try.c <<EOCP
20819 #include <sys/types.h>
20820 #include <stdio.h>
20821 #$i_stdlib I_STDLIB
20822 #ifdef I_STDLIB
20823 #include <stdlib.h>
20824 #endif
20825 int main() {
20826     printf("%d\n", (int)sizeof($sizetype));
20827     exit(0);
20828 }
20829 EOCP
20830 set try
20831 if eval $compile_ok; then
20832         yyy=`$run ./try`
20833         case "$yyy" in
20834         '')     sizesize=4
20835                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20836                 ;;
20837         *)      sizesize=$yyy
20838                 echo "Your $zzz size is $sizesize bytes."
20839                 ;;
20840         esac
20841 else
20842         sizesize=4
20843         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20844 fi
20845
20846
20847 : check for socklen_t
20848 echo " "
20849 echo "Checking to see if you have socklen_t..." >&4
20850 $cat >try.c <<EOCP
20851 #include <sys/types.h>
20852 #$d_socket HAS_SOCKET
20853 #ifdef HAS_SOCKET
20854 #include <sys/socket.h>
20855 #endif
20856 int main() { socklen_t x = 16; }
20857 EOCP
20858 set try
20859 if eval $compile; then
20860         val="$define"
20861         echo "You have socklen_t."
20862 else
20863         val="$undef"
20864         echo "You do not have socklen_t."
20865         case "$sizetype" in
20866         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20867         esac
20868 fi
20869 $rm_try
20870 set d_socklen_t
20871 eval $setvar
20872
20873 : see if this is a socks.h system
20874 set socks.h i_socks
20875 eval $inhdr
20876
20877 : check for type of the size argument to socket calls
20878 case "$d_socket" in
20879 "$define")
20880         $cat <<EOM
20881
20882 Checking to see what type is the last argument of accept().
20883 EOM
20884         yyy=''
20885         case "$d_socklen_t" in
20886         "$define") yyy="$yyy socklen_t"
20887         esac
20888         yyy="$yyy $sizetype int long unsigned"
20889         for xxx in $yyy; do
20890                 case "$socksizetype" in
20891                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20892                         case "$usesocks" in
20893                         "$define")
20894                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20895                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20896                                         socksizetype="$xxx"
20897                                 fi
20898                                 ;;
20899                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20900                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20901                                         socksizetype="$xxx"
20902                                 fi
20903                                 ;;
20904                         esac
20905                         ;;
20906                 esac
20907         done
20908 : In case none of those worked, prompt the user.
20909         case "$socksizetype" in
20910         '')     rp='What is the type for socket address structure sizes?'
20911                 dflt='int'
20912                 . ./myread
20913                 socksizetype=$ans
20914                 ;;
20915         esac
20916         ;;
20917 *)      : no sockets, so pick relatively harmless default
20918         socksizetype='int'
20919         ;;
20920 esac
20921
20922 : see what type is used for signed size_t
20923 set ssize_t ssizetype int stdio.h sys/types.h
20924 eval $typedef
20925 dflt="$ssizetype"
20926 $cat > try.c <<EOM
20927 #include <stdio.h>
20928 #$i_stdlib I_STDLIB
20929 #ifdef I_STDLIB
20930 #include <stdlib.h>
20931 #endif
20932 #include <sys/types.h>
20933 #define Size_t $sizetype
20934 #define SSize_t $dflt
20935 int main()
20936 {
20937         if (sizeof(Size_t) == sizeof(SSize_t))
20938                 printf("$dflt\n");
20939         else if (sizeof(Size_t) == sizeof(int))
20940                 printf("int\n");
20941         else
20942                 printf("long\n");
20943         exit(0);
20944 }
20945 EOM
20946 echo " "
20947 set try
20948 if eval $compile_ok && $run ./try > /dev/null; then
20949         ssizetype=`$run ./try`
20950         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20951 else
20952         $cat >&4 <<EOM
20953 Help! I can't compile and run the ssize_t test program: please enlighten me!
20954 (This is probably a misconfiguration in your system or libraries, and
20955 you really ought to fix it.  Still, I'll try anyway.)
20956
20957 I need a type that is the same size as $sizetype, but is guaranteed to
20958 be signed.  Common values are ssize_t, int and long.
20959
20960 EOM
20961         rp="What signed type is the same size as $sizetype?"
20962         . ./myread
20963         ssizetype="$ans"
20964 fi
20965 $rm_try
20966
20967 : see what type of char stdio uses.
20968 echo " "
20969 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
20970 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20971         echo "Your stdio uses unsigned chars." >&4
20972         stdchar="unsigned char"
20973 else
20974         echo "Your stdio uses signed chars." >&4
20975         stdchar="char"
20976 fi
20977 $rm -f stdioh
20978
20979 : see what type uids are declared as in the kernel
20980 echo " "
20981 echo "Looking for the type for user ids returned by getuid()."
20982 set uid_t uidtype xxx stdio.h sys/types.h
20983 eval $typedef
20984 case "$uidtype" in
20985 xxx)
20986         xxx=`./findhdr sys/user.h`
20987         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20988         case $1 in
20989         unsigned) dflt="$1 $2" ;;
20990         *) dflt="$1" ;;
20991         esac
20992         ;;
20993 *) dflt="$uidtype";;
20994 esac
20995 case "$uidtype" in
20996 uid_t)  echo "uid_t found." ;;
20997 *)      rp="What is the type for user ids returned by getuid()?"
20998         . ./myread
20999         uidtype="$ans"
21000         ;;
21001 esac
21002
21003 : Check size of UID
21004 echo " "
21005 case "$uidtype" in
21006 *_t) zzz="$uidtype"     ;;
21007 *)   zzz="uid"          ;;
21008 esac
21009 echo "Checking the size of $zzz..." >&4
21010 cat > try.c <<EOCP
21011 #include <sys/types.h>
21012 #include <stdio.h>
21013 #$i_stdlib I_STDLIB
21014 #ifdef I_STDLIB
21015 #include <stdlib.h>
21016 #endif
21017 int main() {
21018     printf("%d\n", (int)sizeof($uidtype));
21019     exit(0);
21020 }
21021 EOCP
21022 set try
21023 if eval $compile_ok; then
21024         yyy=`$run ./try`
21025         case "$yyy" in
21026         '')     uidsize=4
21027                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21028                 ;;
21029         *)      uidsize=$yyy
21030                 echo "Your $zzz is $uidsize bytes long."
21031                 ;;
21032         esac
21033 else
21034         uidsize=4
21035         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21036 fi
21037
21038 : Check if UID is signed
21039 echo " "
21040 case "$uidtype" in
21041 *_t) zzz="$uidtype"     ;;
21042 *)   zzz="uid"          ;;
21043 esac
21044 echo "Checking the sign of $zzz..." >&4
21045 cat > try.c <<EOCP
21046 #include <sys/types.h>
21047 #include <stdio.h>
21048 int main() {
21049         $uidtype foo = -1;
21050         if (foo < 0)
21051                 printf("-1\n");
21052         else
21053                 printf("1\n");
21054 }
21055 EOCP
21056 set try
21057 if eval $compile; then
21058         yyy=`$run ./try`
21059         case "$yyy" in
21060         '')     uidsign=1
21061                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21062                 ;;
21063         *)      uidsign=$yyy
21064                 case "$uidsign" in
21065                  1) echo "Your $zzz is unsigned." ;;
21066                 -1) echo "Your $zzz is signed."   ;;
21067                 esac
21068                 ;;
21069         esac
21070 else
21071         uidsign=1
21072         echo "(I can't compile the test program--guessing unsigned.)" >&4
21073 fi
21074
21075
21076 : Check format string for UID
21077 echo " "
21078 $echo "Checking the format string to be used for uids..." >&4
21079
21080 case "$uidsign" in
21081 -1)     if $test X"$uidsize" = X"$ivsize"; then
21082                 uidformat="$ivdformat"
21083         else
21084                 if $test X"$uidsize" = X"$longsize"; then
21085                         uidformat='"ld"'
21086                 else
21087                         if $test X"$uidsize" = X"$intsize"; then
21088                                 uidformat='"d"'
21089                         else
21090                                 if $test X"$uidsize" = X"$shortsize"; then
21091                                         uidformat='"hd"'
21092                                 fi
21093                         fi
21094                 fi
21095         fi
21096         ;;
21097 *)      if $test X"$uidsize" = X"$uvsize"; then
21098                 uidformat="$uvuformat"
21099         else
21100                 if $test X"$uidsize" = X"$longsize"; then
21101                         uidformat='"lu"'
21102                 else
21103                         if $test X"$uidsize" = X"$intsize"; then
21104                                 uidformat='"u"'
21105                         else
21106                                 if $test X"$uidsize" = X"$shortsize"; then
21107                                         uidformat='"hu"'
21108                                 fi
21109                         fi
21110                 fi
21111         fi
21112         ;;
21113 esac
21114
21115 : Check if site customization support was requested
21116 case "$usesitecustomize" in
21117     $define|true|[Yy]*)
21118         usesitecustomize="$define"
21119         ;;
21120     *)
21121         usesitecustomize="$undef"
21122         ;;
21123     esac
21124
21125 : determine compiler compiler
21126 case "$yacc" in
21127 '')
21128         dflt=yacc;;
21129 *)
21130         dflt="$yacc";;
21131 esac
21132 echo " "
21133 comp='yacc'
21134 if $test -f "$byacc$_exe"; then
21135         dflt="$byacc"
21136         comp="byacc or $comp"
21137 fi
21138 if $test -f "$bison$_exe"; then
21139         comp="$comp or bison -y"
21140 fi
21141 rp="Which compiler compiler ($comp) shall I use?"
21142 . ./myread
21143 yacc="$ans"
21144 case "$yacc" in
21145 *bis*)
21146         case "$yacc" in
21147         *-y*) ;;
21148         *)
21149                 yacc="$yacc -y"
21150                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21151                 ;;
21152         esac
21153         ;;
21154 esac
21155
21156 : see if this is a assert.h system
21157 set assert.h i_assert
21158 eval $inhdr
21159
21160 : see if this is a fp.h system
21161 set fp.h i_fp
21162 eval $inhdr
21163
21164 : see if this is a fp_class.h system
21165 set fp_class.h i_fp_class
21166 eval $inhdr
21167
21168 : see if gdbm.h is available
21169 set gdbm.h t_gdbm
21170 eval $inhdr
21171 case "$t_gdbm" in
21172 $define)
21173         : see if gdbm_open exists
21174         set gdbm_open d_gdbm_open
21175         eval $inlibc
21176         case "$d_gdbm_open" in
21177         $undef)
21178                 t_gdbm="$undef"
21179                 echo "We won't be including <gdbm.h>"
21180                 ;;
21181         esac
21182         ;;
21183 esac
21184 val="$t_gdbm"
21185 set i_gdbm
21186 eval $setvar
21187
21188 : see if this is a ieeefp.h system
21189 case "$i_ieeefp" in
21190 '' ) set ieeefp.h i_ieeefp
21191      eval $inhdr
21192      ;;
21193 esac
21194
21195 : see if this is a libutil.h system
21196 set libutil.h i_libutil
21197 eval $inhdr
21198
21199 : see if mach cthreads are available
21200 if test "X$usethreads" = "X$define"; then
21201         set mach/cthreads.h i_machcthr
21202         eval $inhdr
21203 else
21204         i_machcthr="$undef"
21205 fi
21206
21207 : see if this is a mntent.h system
21208 set mntent.h i_mntent
21209 eval $inhdr
21210
21211 : see if net/errno.h is available
21212 val=''
21213 set net/errno.h val
21214 eval $inhdr
21215
21216 : Unfortunately, it causes problems on some systems.  Arrgh.
21217 case "$val" in
21218 $define)
21219         cat > try.c <<'EOM'
21220 #include <stdio.h>
21221 #include <errno.h>
21222 #include <net/errno.h>
21223 int func()
21224 {
21225         return ENOTSOCK;
21226 }
21227 EOM
21228         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21229                 echo "We'll be including <net/errno.h>." >&4
21230         else
21231                 echo "We won't be including <net/errno.h>." >&4
21232                 val="$undef"
21233         fi
21234         $rm_try
21235         ;;
21236 esac
21237 set i_neterrno
21238 eval $setvar
21239
21240 : see if netinet/tcp.h is available
21241 set netinet/tcp.h i_netinettcp
21242 eval $inhdr
21243
21244 : see if this is a poll.h system
21245 set poll.h i_poll
21246 eval $inhdr
21247
21248 : see if this is a prot.h system
21249 set prot.h i_prot
21250 eval $inhdr
21251
21252 : Preprocessor symbols
21253 echo " "
21254 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21255 $cat <<'EOSH' > Cppsym.know
21256 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21257 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21258 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21259 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21260 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21261 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21262 bull c cadmus clipper CMU COFF COMPILER_VERSION
21263 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21264 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21265 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21266 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21267 GLIBC GLIBC_MINOR
21268 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21269 H3050R H3050RX hbullx20 hcx host_mips
21270 hp200 hp300 hp700 HP700 hp800 hp9000
21271 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21272 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21273 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21274 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21275 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21276 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21277 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21278 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21279 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21280 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21281 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21282 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21283 MATH_HAS_NO_SIDE_EFFECTS
21284 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21285 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21286 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21287 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21288 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21289 NetBSD news1500 news1700 news1800 news1900 news3700
21290 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21291 ns32016 ns32332 ns32k nsc32000
21292 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21293 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21294 pc532 pdp11 PGC PIC plexus PORTAR posix
21295 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21296 POSIX_C_SOURCE POSIX_SOURCE POWER
21297 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21298 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21299 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21300 sony sony_news sonyrisc sparc sparclite spectrum
21301 stardent stdc STDC_EXT stratos sun sun3 sun386
21302 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21303 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21304 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21305 sysV68 sysV88 Tek4132 Tek4300 titan
21306 TM3200 TM5400 TM5600
21307 tower tower32 tower32_200 tower32_600 tower32_700
21308 tower32_800 tower32_850 tss
21309 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21310 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21311 unix UNIX95 UNIX99 unixpc unos
21312 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21313 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21314 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21315 USGr4 USGr4_2
21316 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21317 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21318 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21319 z8000
21320 EOSH
21321 # Maybe put other stuff here too.
21322 cat <<EOSH >>Cppsym.know
21323 $osname
21324 EOSH
21325 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21326 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21327 $cat Cppsym.know > Cppsym.c
21328 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21329 $rm -f Cppsym.a Cppsym.b Cppsym.c
21330 cat <<EOSH > Cppsym
21331 $startsh
21332 if $test \$# -gt 0; then
21333     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21334     if $test -s Cppsym.got; then
21335         $rm -f Cppsym.got
21336         exit 0
21337     fi
21338     $rm -f Cppsym.got
21339     exit 1
21340 else
21341     $tr " " "$trnl" | ./Cppsym.try
21342     exit 0
21343 fi
21344 EOSH
21345 chmod +x Cppsym
21346 $eunicefix Cppsym
21347 cat <<EOSH > Cppsym.try
21348 $startsh
21349 cat <<'EOCP' > try.c
21350 #include <stdio.h>
21351 #if cpp_stuff == 1
21352 #define STRINGIFY(a)    "a"
21353 #endif
21354 #if cpp_stuff == 42
21355 #define StGiFy(a)  #a
21356 #define STRINGIFY(a)    StGiFy(a)
21357 #endif
21358 #if $cpp_stuff != 1 && $cpp_stuff != 42
21359 #   include "Bletch: How does this C preprocessor stringify macros?"
21360 #endif
21361 int main() {
21362 EOCP
21363 $awk \\
21364 EOSH
21365 cat <<'EOSH' >> Cppsym.try
21366 'length($1) > 0 {
21367     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21368     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21369     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21370     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21371 }'       >> try.c
21372 echo 'return 0;}' >> try.c
21373 EOSH
21374 cat <<EOSH >> Cppsym.try
21375 ccflags="$ccflags"
21376 case "$osname-$gccversion" in
21377 irix-) ccflags="\$ccflags -woff 1178" ;;
21378 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21379 esac
21380 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21381 EOSH
21382 chmod +x Cppsym.try
21383 $eunicefix Cppsym.try
21384 ./Cppsym < Cppsym.know > Cppsym.true
21385 : Add in any linux cpp "predefined macros":
21386 case "$osname::$gccversion" in
21387   *linux*::*.*)
21388     tHdrH=_tmpHdr
21389     rm -f $tHdrH'.h' $tHdrH
21390     touch $tHdrH'.h'
21391     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21392        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21393        if [ -s $tHdrH'_cppsym.real' ]; then
21394           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21395        fi
21396     fi
21397     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21398   ;;
21399 esac
21400 : now check the C compiler for additional symbols
21401 postprocess_cc_v=''
21402 case "$osname" in
21403 aix) postprocess_cc_v="|$tr , ' '" ;;
21404 esac
21405 $cat >ccsym <<EOS
21406 $startsh
21407 $cat >tmp.c <<EOF
21408 extern int foo;
21409 EOF
21410 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21411 do
21412         case "\$i" in
21413         -D*) echo "\$i" | $sed 's/^-D//';;
21414         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21415         esac
21416 done
21417 $rm_try
21418 EOS
21419 postprocess_cc_v=''
21420 chmod +x ccsym
21421 $eunicefix ccsym
21422 ./ccsym > ccsym1.raw
21423 if $test -s ccsym1.raw; then
21424        $sort ccsym1.raw | $uniq >ccsym.raw
21425 else
21426        mv ccsym1.raw ccsym.raw
21427 fi
21428
21429 $awk '/\=/ { print $0; next }
21430         { print $0"=1" }' ccsym.raw >ccsym.list
21431 $comm -13 Cppsym.true ccsym.list >ccsym.own
21432 $comm -12 Cppsym.true ccsym.list >ccsym.com
21433 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21434 also=''
21435 if $test -z ccsym.raw; then
21436         echo "Your C compiler doesn't seem to define any symbols!" >&4
21437         echo " "
21438         echo "However, your C preprocessor defines the following symbols:"
21439         $cat Cppsym.true
21440         ccsymbols=''
21441         cppsymbols=`$cat Cppsym.true`
21442         cppsymbols=`echo $cppsymbols`
21443         cppccsymbols="$cppsymbols"
21444 else
21445         if $test -s ccsym.com; then
21446                 echo "Your C compiler and pre-processor define these symbols:"
21447                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21448                 also='also '
21449                 symbols='ones'
21450                 cppccsymbols=`$cat ccsym.com`
21451                 cppccsymbols=`echo $cppccsymbols`
21452                 $test "$silent" || sleep 1
21453         fi
21454         if $test -s ccsym.cpp; then
21455                 $test "$also" && echo " "
21456                 echo "Your C pre-processor ${also}defines the following symbols:"
21457                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21458                 also='further '
21459                 cppsymbols=`$cat ccsym.cpp`
21460                 cppsymbols=`echo $cppsymbols`
21461                 $test "$silent" || sleep 1
21462         fi
21463         if $test -s ccsym.own; then
21464                 $test "$also" && echo " "
21465                 echo "Your C compiler ${also}defines the following cpp symbols:"
21466                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21467                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21468                 ccsymbols=`$cat ccsym.own`
21469                 ccsymbols=`echo $ccsymbols`
21470                 $test "$silent" || sleep 1
21471         fi
21472 fi
21473
21474 : see if this is a termio system
21475 val="$undef"
21476 val2="$undef"
21477 val3="$undef"
21478 if $test `./findhdr termios.h`; then
21479         set tcsetattr i_termios
21480         eval $inlibc
21481         val3="$i_termios"
21482 fi
21483 echo " "
21484 case "$val3" in
21485 "$define") echo "You have POSIX termios.h... good!" >&4;;
21486 *) if ./Cppsym pyr; then
21487                 case "`/bin/universe`" in
21488                 ucb) if $test `./findhdr sgtty.h`; then
21489                                 val2="$define"
21490                                 echo "<sgtty.h> found." >&4
21491                         else
21492                                 echo "System is pyramid with BSD universe."
21493                                 ./warn "<sgtty.h> not found--you could have problems."
21494                         fi;;
21495                 *) if $test `./findhdr termio.h`; then
21496                                 val="$define"
21497                                 echo "<termio.h> found." >&4
21498                         else
21499                                 echo "System is pyramid with USG universe."
21500                                 ./warn "<termio.h> not found--you could have problems."
21501                         fi;;
21502                 esac
21503         elif ./usg; then
21504                 if $test `./findhdr termio.h`; then
21505                         echo "<termio.h> found." >&4
21506                         val="$define"
21507                 elif $test `./findhdr sgtty.h`; then
21508                         echo "<sgtty.h> found." >&4
21509                         val2="$define"
21510                 else
21511                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21512                 fi
21513         else
21514                 if $test `./findhdr sgtty.h`; then
21515                         echo "<sgtty.h> found." >&4
21516                         val2="$define"
21517                 elif $test `./findhdr termio.h`; then
21518                         echo "<termio.h> found." >&4
21519                         val="$define"
21520                 else
21521                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21522                 fi
21523         fi;;
21524 esac
21525 set i_termio; eval $setvar
21526 val=$val2; set i_sgtty; eval $setvar
21527 val=$val3; set i_termios; eval $setvar
21528
21529 : see if stddef is available
21530 set stddef.h i_stddef
21531 eval $inhdr
21532
21533 : see if sys/access.h is available
21534 set sys/access.h i_sysaccess
21535 eval $inhdr
21536
21537 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21538 set sys/filio.h i_sysfilio
21539 eval $inhdr
21540 echo " "
21541 if $test `./findhdr sys/ioctl.h`; then
21542         val="$define"
21543         echo '<sys/ioctl.h> found.' >&4
21544 else
21545         val="$undef"
21546         if $test $i_sysfilio = "$define"; then
21547             echo '<sys/ioctl.h> NOT found.' >&4
21548         else
21549                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21550                 $test $i_termio = "$define" && xxx="termio.h"
21551                 $test $i_termios = "$define" && xxx="termios.h"
21552 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21553         fi
21554 fi
21555 set i_sysioctl
21556 eval $setvar
21557
21558 : see if socket ioctl defs are in sys/sockio.h
21559 echo " "
21560 xxx=`./findhdr sys/sockio.h`
21561 if $test "$xxx"; then
21562         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21563                 val="$define"
21564                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21565         else
21566                 val="$undef"
21567                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21568         fi
21569 else
21570         val="$undef"
21571         $cat <<EOM
21572 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21573 EOM
21574 fi
21575 set i_syssockio
21576 eval $setvar
21577
21578 : see if this is a syslog.h system
21579 set syslog.h i_syslog
21580 eval $inhdr
21581
21582 : see if this is a sys/mode.h system
21583 set sys/mode.h i_sysmode
21584 eval $inhdr
21585
21586 : see if there is a sys/poll.h file
21587 set sys/poll.h i_syspoll
21588 eval $inhdr
21589
21590 : see if sys/resource.h has to be included
21591 set sys/resource.h i_sysresrc
21592 eval $inhdr
21593
21594 : see if sys/security.h is available
21595 set sys/security.h i_syssecrt
21596 eval $inhdr
21597
21598 : see if this is a sys/statvfs.h system
21599 set sys/statvfs.h i_sysstatvfs
21600 eval $inhdr
21601
21602 : see if this is a sys/un.h system
21603 set sys/un.h i_sysun
21604 eval $inhdr
21605
21606 : see if this is a sys/utsname.h system
21607 set sys/utsname.h i_sysutsname
21608 eval $inhdr
21609
21610 : see if this is a syswait system
21611 set sys/wait.h i_syswait
21612 eval $inhdr
21613
21614 : see if this is a ustat.h system
21615 set ustat.h i_ustat
21616 eval $inhdr
21617
21618 : see if this is an utime system
21619 set utime.h i_utime
21620 eval $inhdr
21621
21622 : see if this is a vfork system
21623 case "$d_vfork" in
21624 "$define")
21625         set vfork.h i_vfork
21626         eval $inhdr
21627         ;;
21628 *)
21629         i_vfork="$undef"
21630         ;;
21631 esac
21632
21633 : Check extensions
21634 echo " "
21635 echo "Looking for extensions..." >&4
21636 : If we are using the old config.sh, known_extensions may contain
21637 : old or inaccurate or duplicate values.
21638 known_extensions=''
21639 nonxs_extensions=''
21640 : We do not use find because it might not be available.
21641 : We do not just use MANIFEST because the user may have dropped
21642 : some additional extensions into the source tree and expect them
21643 : to be built.
21644
21645 : Function to recursively find available extensions, ignoring DynaLoader
21646 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21647 find_extensions='
21648     for xxx in *; do
21649         case "$xxx" in
21650             DynaLoader|dynaload) ;;
21651             *)
21652             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21653             leaf=`echo $xxx | $sed -e s/.*-//`;
21654             if $test -d File-Glob; then
21655                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21656                     known_extensions="$known_extensions $this_ext";
21657                 elif $test -d $xxx; then
21658                     nonxs_extensions="$nonxs_extensions $this_ext";
21659                 fi
21660             else
21661                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21662                     known_extensions="$known_extensions $1$this_ext";
21663                 elif $test -f $xxx/Makefile.PL; then
21664                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21665                 else
21666                     if $test -d $xxx -a $# -lt 10; then
21667                         set $1$xxx/ $*;
21668                         cd "$xxx";
21669                         eval $find_extensions;
21670                         cd ..;
21671                         shift;
21672                     fi;
21673                 fi;
21674             fi
21675             ;;
21676         esac;
21677     done'
21678 tdir=`pwd`
21679 cd "$rsrc/ext"
21680 set X
21681 shift
21682 eval $find_extensions
21683 if $test -d File-Glob; then
21684     : All ext/ flattened
21685 else
21686     # Special case:  Add in modules that nest beyond the first level.
21687     # Currently threads/shared and Hash/Util/FieldHash, since they are
21688     # not picked up by the recursive find above (and adding in general
21689     # recursive finding breaks SDBM_File/sdbm).
21690     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21691     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21692 fi
21693 set X $known_extensions
21694 shift
21695 known_extensions="$*"
21696 set X $nonxs_extensions
21697 shift
21698 nonxs_extensions="$*"
21699 cd "$tdir"
21700
21701 : Now see which are supported on this system.
21702 avail_ext=''
21703 for xxx in $known_extensions ; do
21704         case "$xxx" in
21705         DB_File|db_file)
21706                 case "$i_db" in
21707                 $define) avail_ext="$avail_ext $xxx" ;;
21708                 esac
21709                 ;;
21710         GDBM_File|gdbm_fil)
21711                 case "$i_gdbm" in
21712                 $define) avail_ext="$avail_ext $xxx" ;;
21713                 esac
21714                 ;;
21715         I18N/Langinfo|i18n_lan)
21716                 case "$i_langinfo$d_nl_langinfo" in
21717                 $define$define) avail_ext="$avail_ext $xxx" ;;
21718                 esac
21719                 ;;
21720         IPC/SysV|ipc/sysv)
21721                 : XXX Do we need a useipcsysv variable here
21722                 case "${d_msg}${d_sem}${d_shm}" in
21723                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21724                 esac
21725                 ;;
21726         NDBM_File|ndbm_fil)
21727                 case "$i_ndbm" in
21728                 $define)
21729                     case "$osname-$use64bitint" in
21730                     hpux-define)
21731                         case "$libs" in
21732                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21733                         esac
21734                         ;;
21735                     *) avail_ext="$avail_ext $xxx" ;;
21736                     esac
21737                     ;;
21738                 esac
21739                 ;;
21740         ODBM_File|odbm_fil)
21741                 case "${i_dbm}${i_rpcsvcdbm}" in
21742                 *"${define}"*)
21743                     case "$d_cplusplus" in
21744                     define) ;; # delete as a function name will not work
21745                     *)  case "$osname-$use64bitint" in
21746                         hpux-define)
21747                             case "$libs" in
21748                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21749                             esac
21750                             ;;
21751                         *) avail_ext="$avail_ext $xxx" ;;
21752                         esac
21753                         ;;
21754                     esac
21755                     ;;
21756                 esac
21757                 ;;
21758         Opcode|opcode)
21759                 case "$useopcode" in
21760                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21761                 esac
21762                 ;;
21763         POSIX|posix)
21764                 case "$useposix" in
21765                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21766                 esac
21767                 ;;
21768         Socket|socket)
21769                 case "$d_socket" in
21770                 true|$define|y)
21771                     case "$osname" in
21772                     beos) ;; # not unless BONE
21773                     *) avail_ext="$avail_ext $xxx" ;;
21774                     esac
21775                     ;;
21776                 esac
21777                 ;;
21778         Sys/Syslog|sys/syslog)
21779                 : XXX syslog requires socket
21780                 case "$d_socket" in
21781                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21782                 esac
21783                 ;;
21784         Thread|thread)
21785                 case "$usethreads" in
21786                 true|$define|y)
21787                         case "$use5005threads" in
21788                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21789                         esac
21790                 esac
21791                 ;;
21792         threads|threads/shared)
21793                 # threads and threads::shared are special cases.
21794                 # To stop people from asking "Perl 5.8.0 was supposed
21795                 # to have this new fancy threads implementation but my
21796                 # perl doesn't have it" and from people trying to
21797                 # (re)install the threads module using CPAN.pm and
21798                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21799                 # the threads.pm and threads/shared.pm will always be
21800                 # there, croaking informatively ("you need to rebuild
21801                 # all of Perl with threads, sorry") when threads haven't
21802                 # been compiled in.
21803                 # --jhi
21804                 avail_ext="$avail_ext $xxx"
21805                 ;;
21806         VMS*)
21807                 ;;
21808         Win32*)
21809                 case "$osname" in
21810                 cygwin) avail_ext="$avail_ext $xxx" ;;
21811                 esac
21812                 ;;
21813         XS/APItest|xs/apitest)
21814                 # This is just for testing.  Skip it unless we have dynamic loading.
21815
21816                 case "$usedl" in
21817                 $define) avail_ext="$avail_ext $xxx" ;;
21818                 esac
21819                 ;;
21820         XS/Typemap|xs/typemap)
21821                 # This is just for testing.  Skip it unless we have dynamic loading.
21822                 case "$usedl" in
21823                 $define) avail_ext="$avail_ext $xxx" ;;
21824                 esac
21825                 ;;
21826         *)      avail_ext="$avail_ext $xxx"
21827                 ;;
21828         esac
21829 done
21830
21831 set X $avail_ext
21832 shift
21833 avail_ext="$*"
21834
21835 case "$onlyextensions" in
21836 '') ;;
21837 *)  keepextensions=''
21838     echo "You have requested that only certains extensions be included..." >&4
21839     for i in $onlyextensions; do
21840         case " $avail_ext " in
21841         *" $i "*)
21842             echo "Keeping extension $i."
21843             keepextensions="$keepextensions $i"
21844             ;;
21845         *) echo "Ignoring extension $i." ;;
21846         esac
21847     done
21848     avail_ext="$keepextensions"
21849     ;;
21850 esac
21851
21852 case "$noextensions" in
21853 '') ;;
21854 *)  keepextensions=''
21855     echo "You have requested that certain extensions be ignored..." >&4
21856     for i in $avail_ext; do
21857         case " $noextensions " in
21858         *" $i "*) echo "Ignoring extension $i." ;;
21859         *) echo "Keeping extension $i.";
21860            keepextensions="$keepextensions $i"
21861            ;;
21862         esac
21863     done
21864     avail_ext="$keepextensions"
21865     ;;
21866 esac
21867
21868 : Now see which nonxs extensions are supported on this system.
21869 : For now assume all are.
21870 nonxs_ext=''
21871 for xxx in $nonxs_extensions ; do
21872         case "$xxx" in
21873         *)      nonxs_ext="$nonxs_ext $xxx"
21874                 ;;
21875         esac
21876 done
21877
21878 set X $nonxs_ext
21879 shift
21880 nonxs_ext="$*"
21881
21882 case $usedl in
21883 $define)
21884         $cat <<EOM
21885 A number of extensions are supplied with $package.  You may choose to
21886 compile these extensions for dynamic loading (the default), compile
21887 them into the $package executable (static loading), or not include
21888 them at all.  Answer "none" to include no extensions.
21889 Note that DynaLoader is always built and need not be mentioned here.
21890
21891 EOM
21892         case "$dynamic_ext" in
21893         '')
21894                 : Exclude those listed in static_ext
21895                 dflt=''
21896                 for xxx in $avail_ext; do
21897                         case " $static_ext " in
21898                         *" $xxx "*) ;;
21899                         *) dflt="$dflt $xxx" ;;
21900                         esac
21901                 done
21902                 set X $dflt
21903                 shift
21904                 dflt="$*"
21905                 ;;
21906         *)      dflt="$dynamic_ext"
21907                 # Perhaps we are reusing an old out-of-date config.sh.
21908                 case "$hint" in
21909                 previous)
21910                         if test X"$dynamic_ext" != X"$avail_ext"; then
21911                                 $cat <<EOM
21912 NOTICE:  Your previous config.sh list may be incorrect.
21913 The extensions now available to you are
21914         ${avail_ext}
21915 but the default list from your previous config.sh is
21916         ${dynamic_ext}
21917
21918 EOM
21919                         fi
21920                         ;;
21921                 esac
21922                 ;;
21923         esac
21924         case "$dflt" in
21925         '')     dflt=none;;
21926         esac
21927         rp="What extensions do you wish to load dynamically?"
21928         . ./myread
21929         case "$ans" in
21930         none) dynamic_ext=' ' ;;
21931         *) dynamic_ext="$ans" ;;
21932         esac
21933
21934         case "$static_ext" in
21935         '')
21936                 : Exclude those already listed in dynamic linking
21937                 dflt=''
21938                 for xxx in $avail_ext; do
21939                         case " $dynamic_ext " in
21940                         *" $xxx "*) ;;
21941                         *) dflt="$dflt $xxx" ;;
21942                         esac
21943                 done
21944                 set X $dflt
21945                 shift
21946                 dflt="$*"
21947                 ;;
21948         *)  dflt="$static_ext"
21949                 ;;
21950         esac
21951
21952         case "$dflt" in
21953         '')     dflt=none;;
21954         esac
21955         rp="What extensions do you wish to load statically?"
21956         . ./myread
21957         case "$ans" in
21958         none) static_ext=' ' ;;
21959         *) static_ext="$ans" ;;
21960         esac
21961         ;;
21962 *)
21963         $cat <<EOM
21964 A number of extensions are supplied with $package.  Answer "none"
21965 to include no extensions.
21966 Note that DynaLoader is always built and need not be mentioned here.
21967
21968 EOM
21969         case "$static_ext" in
21970         '') dflt="$avail_ext" ;;
21971         *)      dflt="$static_ext"
21972                 # Perhaps we are reusing an old out-of-date config.sh.
21973                 case "$hint" in
21974                 previous)
21975                         if test X"$static_ext" != X"$avail_ext"; then
21976                                 $cat <<EOM
21977 NOTICE:  Your previous config.sh list may be incorrect.
21978 The extensions now available to you are
21979         ${avail_ext}
21980 but the default list from your previous config.sh is
21981         ${static_ext}
21982
21983 EOM
21984                         fi
21985                         ;;
21986                 esac
21987                 ;;
21988         esac
21989         : Exclude those that are not xs extensions
21990         case "$dflt" in
21991         '')     dflt=none;;
21992         esac
21993         rp="What extensions do you wish to include?"
21994         . ./myread
21995         case "$ans" in
21996         none) static_ext=' ' ;;
21997         *) static_ext="$ans" ;;
21998         esac
21999         ;;
22000 esac
22001 #
22002 # Encode is a special case.  If we are building Encode as a static
22003 # extension, we need to explicitly list its subextensions as well.
22004 # For other nested extensions, this is handled automatically by
22005 # the appropriate Makefile.PL.
22006 case " $static_ext " in
22007         *" Encode "*) # Add the subextensions of Encode
22008         cd "$rsrc/ext"
22009         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22010                 static_ext="$static_ext Encode/$xxx"
22011         done
22012         cd "$tdir"
22013         ;;
22014 esac
22015
22016 set X $dynamic_ext $static_ext $nonxs_ext
22017 shift
22018 extensions="$*"
22019
22020 # Sanity check:  We require an extension suitable for use with
22021 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22022 # should show up as failures in the test suite, but it's helpful to
22023 # catch them now.) The 'extensions' list is normally sorted
22024 # alphabetically, so we need to accept either
22025 #    DB_File ... Fcntl ... IO  ....
22026 # or something like
22027 #    Fcntl ... NDBM_File ... IO  ....
22028 case " $extensions"  in
22029 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22030 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22031 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22032 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22033    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22034    ;;
22035 esac
22036
22037 : Remove libraries needed only for extensions
22038 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22039 : The exception is SunOS 4.x, which needs them.
22040 case "${osname}X${osvers}" in
22041 sunos*X4*)
22042     perllibs="$libs"
22043     ;;
22044 *) case "$usedl" in
22045     $define|true|[yY]*)
22046             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22047             shift
22048             perllibs="$*"
22049             ;;
22050     *)  perllibs="$libs"
22051             ;;
22052     esac
22053     ;;
22054 esac
22055
22056 : Remove build directory name from cppstdin so it can be used from
22057 : either the present location or the final installed location.
22058 echo " "
22059 : Get out of the UU directory to get correct path name.
22060 cd ..
22061 case "$cppstdin" in
22062 `pwd`/cppstdin)
22063         echo "Stripping down cppstdin path name"
22064         cppstdin=cppstdin
22065         ;;
22066 esac
22067 cd UU
22068
22069 : end of configuration questions
22070 echo " "
22071 echo "End of configuration questions."
22072 echo " "
22073
22074 : back to where it started
22075 if test -d ../UU; then
22076         cd ..
22077 fi
22078
22079 : configuration may be unconditionally patched via a 'config.arch' file
22080 if $test -f config.arch; then
22081         echo "I see a config.arch file, loading it." >&4
22082         . ./config.arch
22083 fi
22084
22085 : configuration may be patched via a 'config.over' file
22086 if $test -f config.over; then
22087         echo " "
22088         dflt=y
22089         rp='I see a config.over file.  Do you wish to load it?'
22090         . UU/myread
22091         case "$ans" in
22092         n*) echo "OK, I'll ignore it.";;
22093         *)      . ./config.over
22094                 echo "Configuration override changes have been loaded."
22095                 ;;
22096         esac
22097 fi
22098
22099 : in case they want portability, strip down executable paths
22100 case "$d_portable" in
22101 "$define")
22102         echo " "
22103         echo "Stripping down executable paths..." >&4
22104         for file in $loclist $trylist; do
22105                 eval temp=\$$file
22106                 eval $file=`basename $temp`
22107         done
22108         ;;
22109 esac
22110
22111 : create config.sh file
22112 echo " "
22113 echo "Creating config.sh..." >&4
22114 $spitshell <<EOT >config.sh
22115 $startsh
22116 #
22117 # This file was produced by running the Configure script. It holds all the
22118 # definitions figured out by Configure. Should you modify one of these values,
22119 # do not forget to propagate your changes by running "Configure -der". You may
22120 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22121 #
22122
22123 # Package name      : $package
22124 # Source directory  : $src
22125 # Configuration time: $cf_time
22126 # Configured by     : $cf_by
22127 # Target system     : $myuname
22128
22129 EOT
22130 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22131 $spitshell <<EOT >>config.sh
22132
22133 Author='$Author'
22134 Date='$Date'
22135 Header='$Header'
22136 Id='$Id'
22137 Locker='$Locker'
22138 Log='$Log'
22139 RCSfile='$RCSfile'
22140 Revision='$Revision'
22141 Source='$Source'
22142 State='$State'
22143 _a='$_a'
22144 _exe='$_exe'
22145 _o='$_o'
22146 afs='$afs'
22147 afsroot='$afsroot'
22148 alignbytes='$alignbytes'
22149 ansi2knr='$ansi2knr'
22150 aphostname='$aphostname'
22151 api_revision='$api_revision'
22152 api_subversion='$api_subversion'
22153 api_version='$api_version'
22154 api_versionstring='$api_versionstring'
22155 ar='$ar'
22156 archlib='$archlib'
22157 archlibexp='$archlibexp'
22158 archname64='$archname64'
22159 archname='$archname'
22160 archobjs='$archobjs'
22161 asctime_r_proto='$asctime_r_proto'
22162 awk='$awk'
22163 baserev='$baserev'
22164 bash='$bash'
22165 bin='$bin'
22166 bin_ELF='$bin_ELF'
22167 binexp='$binexp'
22168 bison='$bison'
22169 byacc='$byacc'
22170 byteorder='$byteorder'
22171 c='$c'
22172 castflags='$castflags'
22173 cat='$cat'
22174 cc='$cc'
22175 cccdlflags='$cccdlflags'
22176 ccdlflags='$ccdlflags'
22177 ccflags='$ccflags'
22178 ccflags_uselargefiles='$ccflags_uselargefiles'
22179 ccname='$ccname'
22180 ccsymbols='$ccsymbols'
22181 ccversion='$ccversion'
22182 cf_by='$cf_by'
22183 cf_email='$cf_email'
22184 cf_time='$cf_time'
22185 chgrp='$chgrp'
22186 chmod='$chmod'
22187 chown='$chown'
22188 clocktype='$clocktype'
22189 comm='$comm'
22190 compress='$compress'
22191 contains='$contains'
22192 cp='$cp'
22193 cpio='$cpio'
22194 cpp='$cpp'
22195 cpp_stuff='$cpp_stuff'
22196 cppccsymbols='$cppccsymbols'
22197 cppflags='$cppflags'
22198 cpplast='$cpplast'
22199 cppminus='$cppminus'
22200 cpprun='$cpprun'
22201 cppstdin='$cppstdin'
22202 cppsymbols='$cppsymbols'
22203 crypt_r_proto='$crypt_r_proto'
22204 cryptlib='$cryptlib'
22205 csh='$csh'
22206 ctermid_r_proto='$ctermid_r_proto'
22207 ctime_r_proto='$ctime_r_proto'
22208 d_Gconvert='$d_Gconvert'
22209 d_PRIEUldbl='$d_PRIEUldbl'
22210 d_PRIFUldbl='$d_PRIFUldbl'
22211 d_PRIGUldbl='$d_PRIGUldbl'
22212 d_PRIXU64='$d_PRIXU64'
22213 d_PRId64='$d_PRId64'
22214 d_PRIeldbl='$d_PRIeldbl'
22215 d_PRIfldbl='$d_PRIfldbl'
22216 d_PRIgldbl='$d_PRIgldbl'
22217 d_PRIi64='$d_PRIi64'
22218 d_PRIo64='$d_PRIo64'
22219 d_PRIu64='$d_PRIu64'
22220 d_PRIx64='$d_PRIx64'
22221 d_SCNfldbl='$d_SCNfldbl'
22222 d__fwalk='$d__fwalk'
22223 d_access='$d_access'
22224 d_accessx='$d_accessx'
22225 d_aintl='$d_aintl'
22226 d_alarm='$d_alarm'
22227 d_archlib='$d_archlib'
22228 d_asctime64='$d_asctime64'
22229 d_asctime_r='$d_asctime_r'
22230 d_atolf='$d_atolf'
22231 d_atoll='$d_atoll'
22232 d_attribute_deprecated='$d_attribute_deprecated'
22233 d_attribute_format='$d_attribute_format'
22234 d_attribute_malloc='$d_attribute_malloc'
22235 d_attribute_nonnull='$d_attribute_nonnull'
22236 d_attribute_noreturn='$d_attribute_noreturn'
22237 d_attribute_pure='$d_attribute_pure'
22238 d_attribute_unused='$d_attribute_unused'
22239 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22240 d_bcmp='$d_bcmp'
22241 d_bcopy='$d_bcopy'
22242 d_bsd='$d_bsd'
22243 d_bsdgetpgrp='$d_bsdgetpgrp'
22244 d_bsdsetpgrp='$d_bsdsetpgrp'
22245 d_builtin_choose_expr='$d_builtin_choose_expr'
22246 d_builtin_expect='$d_builtin_expect'
22247 d_bzero='$d_bzero'
22248 d_c99_variadic_macros='$d_c99_variadic_macros'
22249 d_casti32='$d_casti32'
22250 d_castneg='$d_castneg'
22251 d_charvspr='$d_charvspr'
22252 d_chown='$d_chown'
22253 d_chroot='$d_chroot'
22254 d_chsize='$d_chsize'
22255 d_class='$d_class'
22256 d_clearenv='$d_clearenv'
22257 d_closedir='$d_closedir'
22258 d_cmsghdr_s='$d_cmsghdr_s'
22259 d_const='$d_const'
22260 d_copysignl='$d_copysignl'
22261 d_cplusplus='$d_cplusplus'
22262 d_crypt='$d_crypt'
22263 d_crypt_r='$d_crypt_r'
22264 d_csh='$d_csh'
22265 d_ctermid='$d_ctermid'
22266 d_ctermid_r='$d_ctermid_r'
22267 d_ctime64='$d_ctime64'
22268 d_ctime_r='$d_ctime_r'
22269 d_cuserid='$d_cuserid'
22270 d_dbl_dig='$d_dbl_dig'
22271 d_dbminitproto='$d_dbminitproto'
22272 d_difftime64='$d_difftime64'
22273 d_difftime='$d_difftime'
22274 d_dir_dd_fd='$d_dir_dd_fd'
22275 d_dirfd='$d_dirfd'
22276 d_dirnamlen='$d_dirnamlen'
22277 d_dlerror='$d_dlerror'
22278 d_dlopen='$d_dlopen'
22279 d_dlsymun='$d_dlsymun'
22280 d_dosuid='$d_dosuid'
22281 d_drand48_r='$d_drand48_r'
22282 d_drand48proto='$d_drand48proto'
22283 d_dup2='$d_dup2'
22284 d_eaccess='$d_eaccess'
22285 d_endgrent='$d_endgrent'
22286 d_endgrent_r='$d_endgrent_r'
22287 d_endhent='$d_endhent'
22288 d_endhostent_r='$d_endhostent_r'
22289 d_endnent='$d_endnent'
22290 d_endnetent_r='$d_endnetent_r'
22291 d_endpent='$d_endpent'
22292 d_endprotoent_r='$d_endprotoent_r'
22293 d_endpwent='$d_endpwent'
22294 d_endpwent_r='$d_endpwent_r'
22295 d_endsent='$d_endsent'
22296 d_endservent_r='$d_endservent_r'
22297 d_eofnblk='$d_eofnblk'
22298 d_eunice='$d_eunice'
22299 d_faststdio='$d_faststdio'
22300 d_fchdir='$d_fchdir'
22301 d_fchmod='$d_fchmod'
22302 d_fchown='$d_fchown'
22303 d_fcntl='$d_fcntl'
22304 d_fcntl_can_lock='$d_fcntl_can_lock'
22305 d_fd_macros='$d_fd_macros'
22306 d_fd_set='$d_fd_set'
22307 d_fds_bits='$d_fds_bits'
22308 d_fgetpos='$d_fgetpos'
22309 d_finite='$d_finite'
22310 d_finitel='$d_finitel'
22311 d_flexfnam='$d_flexfnam'
22312 d_flock='$d_flock'
22313 d_flockproto='$d_flockproto'
22314 d_fork='$d_fork'
22315 d_fp_class='$d_fp_class'
22316 d_fpathconf='$d_fpathconf'
22317 d_fpclass='$d_fpclass'
22318 d_fpclassify='$d_fpclassify'
22319 d_fpclassl='$d_fpclassl'
22320 d_fpos64_t='$d_fpos64_t'
22321 d_frexpl='$d_frexpl'
22322 d_fs_data_s='$d_fs_data_s'
22323 d_fseeko='$d_fseeko'
22324 d_fsetpos='$d_fsetpos'
22325 d_fstatfs='$d_fstatfs'
22326 d_fstatvfs='$d_fstatvfs'
22327 d_fsync='$d_fsync'
22328 d_ftello='$d_ftello'
22329 d_ftime='$d_ftime'
22330 d_futimes='$d_futimes'
22331 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22332 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22333 d_getaddrinfo='$d_getaddrinfo'
22334 d_getcwd='$d_getcwd'
22335 d_getespwnam='$d_getespwnam'
22336 d_getfsstat='$d_getfsstat'
22337 d_getgrent='$d_getgrent'
22338 d_getgrent_r='$d_getgrent_r'
22339 d_getgrgid_r='$d_getgrgid_r'
22340 d_getgrnam_r='$d_getgrnam_r'
22341 d_getgrps='$d_getgrps'
22342 d_gethbyaddr='$d_gethbyaddr'
22343 d_gethbyname='$d_gethbyname'
22344 d_gethent='$d_gethent'
22345 d_gethname='$d_gethname'
22346 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22347 d_gethostbyname_r='$d_gethostbyname_r'
22348 d_gethostent_r='$d_gethostent_r'
22349 d_gethostprotos='$d_gethostprotos'
22350 d_getitimer='$d_getitimer'
22351 d_getlogin='$d_getlogin'
22352 d_getlogin_r='$d_getlogin_r'
22353 d_getmnt='$d_getmnt'
22354 d_getmntent='$d_getmntent'
22355 d_getnameinfo='$d_getnameinfo'
22356 d_getnbyaddr='$d_getnbyaddr'
22357 d_getnbyname='$d_getnbyname'
22358 d_getnent='$d_getnent'
22359 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22360 d_getnetbyname_r='$d_getnetbyname_r'
22361 d_getnetent_r='$d_getnetent_r'
22362 d_getnetprotos='$d_getnetprotos'
22363 d_getpagsz='$d_getpagsz'
22364 d_getpbyname='$d_getpbyname'
22365 d_getpbynumber='$d_getpbynumber'
22366 d_getpent='$d_getpent'
22367 d_getpgid='$d_getpgid'
22368 d_getpgrp2='$d_getpgrp2'
22369 d_getpgrp='$d_getpgrp'
22370 d_getppid='$d_getppid'
22371 d_getprior='$d_getprior'
22372 d_getprotobyname_r='$d_getprotobyname_r'
22373 d_getprotobynumber_r='$d_getprotobynumber_r'
22374 d_getprotoent_r='$d_getprotoent_r'
22375 d_getprotoprotos='$d_getprotoprotos'
22376 d_getprpwnam='$d_getprpwnam'
22377 d_getpwent='$d_getpwent'
22378 d_getpwent_r='$d_getpwent_r'
22379 d_getpwnam_r='$d_getpwnam_r'
22380 d_getpwuid_r='$d_getpwuid_r'
22381 d_getsbyname='$d_getsbyname'
22382 d_getsbyport='$d_getsbyport'
22383 d_getsent='$d_getsent'
22384 d_getservbyname_r='$d_getservbyname_r'
22385 d_getservbyport_r='$d_getservbyport_r'
22386 d_getservent_r='$d_getservent_r'
22387 d_getservprotos='$d_getservprotos'
22388 d_getspnam='$d_getspnam'
22389 d_getspnam_r='$d_getspnam_r'
22390 d_gettimeod='$d_gettimeod'
22391 d_gmtime64='$d_gmtime64'
22392 d_gmtime_r='$d_gmtime_r'
22393 d_gnulibc='$d_gnulibc'
22394 d_grpasswd='$d_grpasswd'
22395 d_hasmntopt='$d_hasmntopt'
22396 d_htonl='$d_htonl'
22397 d_ilogbl='$d_ilogbl'
22398 d_inc_version_list='$d_inc_version_list'
22399 d_index='$d_index'
22400 d_inetaton='$d_inetaton'
22401 d_inetntop='$d_inetntop'
22402 d_inetpton='$d_inetpton'
22403 d_int64_t='$d_int64_t'
22404 d_isascii='$d_isascii'
22405 d_isfinite='$d_isfinite'
22406 d_isinf='$d_isinf'
22407 d_isnan='$d_isnan'
22408 d_isnanl='$d_isnanl'
22409 d_killpg='$d_killpg'
22410 d_lchown='$d_lchown'
22411 d_ldbl_dig='$d_ldbl_dig'
22412 d_libm_lib_version='$d_libm_lib_version'
22413 d_link='$d_link'
22414 d_localtime64='$d_localtime64'
22415 d_localtime_r='$d_localtime_r'
22416 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22417 d_locconv='$d_locconv'
22418 d_lockf='$d_lockf'
22419 d_longdbl='$d_longdbl'
22420 d_longlong='$d_longlong'
22421 d_lseekproto='$d_lseekproto'
22422 d_lstat='$d_lstat'
22423 d_madvise='$d_madvise'
22424 d_malloc_good_size='$d_malloc_good_size'
22425 d_malloc_size='$d_malloc_size'
22426 d_mblen='$d_mblen'
22427 d_mbstowcs='$d_mbstowcs'
22428 d_mbtowc='$d_mbtowc'
22429 d_memchr='$d_memchr'
22430 d_memcmp='$d_memcmp'
22431 d_memcpy='$d_memcpy'
22432 d_memmove='$d_memmove'
22433 d_memset='$d_memset'
22434 d_mkdir='$d_mkdir'
22435 d_mkdtemp='$d_mkdtemp'
22436 d_mkfifo='$d_mkfifo'
22437 d_mkstemp='$d_mkstemp'
22438 d_mkstemps='$d_mkstemps'
22439 d_mktime64='$d_mktime64'
22440 d_mktime='$d_mktime'
22441 d_mmap='$d_mmap'
22442 d_modfl='$d_modfl'
22443 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22444 d_modflproto='$d_modflproto'
22445 d_mprotect='$d_mprotect'
22446 d_msg='$d_msg'
22447 d_msg_ctrunc='$d_msg_ctrunc'
22448 d_msg_dontroute='$d_msg_dontroute'
22449 d_msg_oob='$d_msg_oob'
22450 d_msg_peek='$d_msg_peek'
22451 d_msg_proxy='$d_msg_proxy'
22452 d_msgctl='$d_msgctl'
22453 d_msgget='$d_msgget'
22454 d_msghdr_s='$d_msghdr_s'
22455 d_msgrcv='$d_msgrcv'
22456 d_msgsnd='$d_msgsnd'
22457 d_msync='$d_msync'
22458 d_munmap='$d_munmap'
22459 d_mymalloc='$d_mymalloc'
22460 d_ndbm='$d_ndbm'
22461 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22462 d_nice='$d_nice'
22463 d_nl_langinfo='$d_nl_langinfo'
22464 d_nv_preserves_uv='$d_nv_preserves_uv'
22465 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22466 d_off64_t='$d_off64_t'
22467 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22468 d_oldpthreads='$d_oldpthreads'
22469 d_oldsock='$d_oldsock'
22470 d_open3='$d_open3'
22471 d_pathconf='$d_pathconf'
22472 d_pause='$d_pause'
22473 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22474 d_phostname='$d_phostname'
22475 d_pipe='$d_pipe'
22476 d_poll='$d_poll'
22477 d_portable='$d_portable'
22478 d_printf_format_null='$d_printf_format_null'
22479 d_procselfexe='$d_procselfexe'
22480 d_pseudofork='$d_pseudofork'
22481 d_pthread_atfork='$d_pthread_atfork'
22482 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22483 d_pthread_yield='$d_pthread_yield'
22484 d_pwage='$d_pwage'
22485 d_pwchange='$d_pwchange'
22486 d_pwclass='$d_pwclass'
22487 d_pwcomment='$d_pwcomment'
22488 d_pwexpire='$d_pwexpire'
22489 d_pwgecos='$d_pwgecos'
22490 d_pwpasswd='$d_pwpasswd'
22491 d_pwquota='$d_pwquota'
22492 d_qgcvt='$d_qgcvt'
22493 d_quad='$d_quad'
22494 d_random_r='$d_random_r'
22495 d_readdir64_r='$d_readdir64_r'
22496 d_readdir='$d_readdir'
22497 d_readdir_r='$d_readdir_r'
22498 d_readlink='$d_readlink'
22499 d_readv='$d_readv'
22500 d_recvmsg='$d_recvmsg'
22501 d_rename='$d_rename'
22502 d_rewinddir='$d_rewinddir'
22503 d_rmdir='$d_rmdir'
22504 d_safebcpy='$d_safebcpy'
22505 d_safemcpy='$d_safemcpy'
22506 d_sanemcmp='$d_sanemcmp'
22507 d_sbrkproto='$d_sbrkproto'
22508 d_scalbnl='$d_scalbnl'
22509 d_sched_yield='$d_sched_yield'
22510 d_scm_rights='$d_scm_rights'
22511 d_seekdir='$d_seekdir'
22512 d_select='$d_select'
22513 d_sem='$d_sem'
22514 d_semctl='$d_semctl'
22515 d_semctl_semid_ds='$d_semctl_semid_ds'
22516 d_semctl_semun='$d_semctl_semun'
22517 d_semget='$d_semget'
22518 d_semop='$d_semop'
22519 d_sendmsg='$d_sendmsg'
22520 d_setegid='$d_setegid'
22521 d_seteuid='$d_seteuid'
22522 d_setgrent='$d_setgrent'
22523 d_setgrent_r='$d_setgrent_r'
22524 d_setgrps='$d_setgrps'
22525 d_sethent='$d_sethent'
22526 d_sethostent_r='$d_sethostent_r'
22527 d_setitimer='$d_setitimer'
22528 d_setlinebuf='$d_setlinebuf'
22529 d_setlocale='$d_setlocale'
22530 d_setlocale_r='$d_setlocale_r'
22531 d_setnent='$d_setnent'
22532 d_setnetent_r='$d_setnetent_r'
22533 d_setpent='$d_setpent'
22534 d_setpgid='$d_setpgid'
22535 d_setpgrp2='$d_setpgrp2'
22536 d_setpgrp='$d_setpgrp'
22537 d_setprior='$d_setprior'
22538 d_setproctitle='$d_setproctitle'
22539 d_setprotoent_r='$d_setprotoent_r'
22540 d_setpwent='$d_setpwent'
22541 d_setpwent_r='$d_setpwent_r'
22542 d_setregid='$d_setregid'
22543 d_setresgid='$d_setresgid'
22544 d_setresuid='$d_setresuid'
22545 d_setreuid='$d_setreuid'
22546 d_setrgid='$d_setrgid'
22547 d_setruid='$d_setruid'
22548 d_setsent='$d_setsent'
22549 d_setservent_r='$d_setservent_r'
22550 d_setsid='$d_setsid'
22551 d_setvbuf='$d_setvbuf'
22552 d_sfio='$d_sfio'
22553 d_shm='$d_shm'
22554 d_shmat='$d_shmat'
22555 d_shmatprototype='$d_shmatprototype'
22556 d_shmctl='$d_shmctl'
22557 d_shmdt='$d_shmdt'
22558 d_shmget='$d_shmget'
22559 d_sigaction='$d_sigaction'
22560 d_signbit='$d_signbit'
22561 d_sigprocmask='$d_sigprocmask'
22562 d_sigsetjmp='$d_sigsetjmp'
22563 d_sitearch='$d_sitearch'
22564 d_snprintf='$d_snprintf'
22565 d_sockatmark='$d_sockatmark'
22566 d_sockatmarkproto='$d_sockatmarkproto'
22567 d_socket='$d_socket'
22568 d_socklen_t='$d_socklen_t'
22569 d_sockpair='$d_sockpair'
22570 d_socks5_init='$d_socks5_init'
22571 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22572 d_sqrtl='$d_sqrtl'
22573 d_srand48_r='$d_srand48_r'
22574 d_srandom_r='$d_srandom_r'
22575 d_sresgproto='$d_sresgproto'
22576 d_sresuproto='$d_sresuproto'
22577 d_statblks='$d_statblks'
22578 d_statfs_f_flags='$d_statfs_f_flags'
22579 d_statfs_s='$d_statfs_s'
22580 d_statvfs='$d_statvfs'
22581 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22582 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22583 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22584 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22585 d_stdio_stream_array='$d_stdio_stream_array'
22586 d_stdiobase='$d_stdiobase'
22587 d_stdstdio='$d_stdstdio'
22588 d_strchr='$d_strchr'
22589 d_strcoll='$d_strcoll'
22590 d_strctcpy='$d_strctcpy'
22591 d_strerrm='$d_strerrm'
22592 d_strerror='$d_strerror'
22593 d_strerror_r='$d_strerror_r'
22594 d_strftime='$d_strftime'
22595 d_strlcat='$d_strlcat'
22596 d_strlcpy='$d_strlcpy'
22597 d_strtod='$d_strtod'
22598 d_strtol='$d_strtol'
22599 d_strtold='$d_strtold'
22600 d_strtoll='$d_strtoll'
22601 d_strtoq='$d_strtoq'
22602 d_strtoul='$d_strtoul'
22603 d_strtoull='$d_strtoull'
22604 d_strtouq='$d_strtouq'
22605 d_strxfrm='$d_strxfrm'
22606 d_suidsafe='$d_suidsafe'
22607 d_symlink='$d_symlink'
22608 d_syscall='$d_syscall'
22609 d_syscallproto='$d_syscallproto'
22610 d_sysconf='$d_sysconf'
22611 d_sysernlst='$d_sysernlst'
22612 d_syserrlst='$d_syserrlst'
22613 d_system='$d_system'
22614 d_tcgetpgrp='$d_tcgetpgrp'
22615 d_tcsetpgrp='$d_tcsetpgrp'
22616 d_telldir='$d_telldir'
22617 d_telldirproto='$d_telldirproto'
22618 d_time='$d_time'
22619 d_timegm='$d_timegm'
22620 d_times='$d_times'
22621 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22622 d_tm_tm_zone='$d_tm_tm_zone'
22623 d_tmpnam_r='$d_tmpnam_r'
22624 d_truncate='$d_truncate'
22625 d_ttyname_r='$d_ttyname_r'
22626 d_tzname='$d_tzname'
22627 d_u32align='$d_u32align'
22628 d_ualarm='$d_ualarm'
22629 d_umask='$d_umask'
22630 d_uname='$d_uname'
22631 d_union_semun='$d_union_semun'
22632 d_unordered='$d_unordered'
22633 d_unsetenv='$d_unsetenv'
22634 d_usleep='$d_usleep'
22635 d_usleepproto='$d_usleepproto'
22636 d_ustat='$d_ustat'
22637 d_vendorarch='$d_vendorarch'
22638 d_vendorbin='$d_vendorbin'
22639 d_vendorlib='$d_vendorlib'
22640 d_vendorscript='$d_vendorscript'
22641 d_vfork='$d_vfork'
22642 d_void_closedir='$d_void_closedir'
22643 d_voidsig='$d_voidsig'
22644 d_voidtty='$d_voidtty'
22645 d_volatile='$d_volatile'
22646 d_vprintf='$d_vprintf'
22647 d_vsnprintf='$d_vsnprintf'
22648 d_wait4='$d_wait4'
22649 d_waitpid='$d_waitpid'
22650 d_wcstombs='$d_wcstombs'
22651 d_wctomb='$d_wctomb'
22652 d_writev='$d_writev'
22653 d_xenix='$d_xenix'
22654 date='$date'
22655 db_hashtype='$db_hashtype'
22656 db_prefixtype='$db_prefixtype'
22657 db_version_major='$db_version_major'
22658 db_version_minor='$db_version_minor'
22659 db_version_patch='$db_version_patch'
22660 defvoidused='$defvoidused'
22661 direntrytype='$direntrytype'
22662 dlext='$dlext'
22663 dlsrc='$dlsrc'
22664 doublesize='$doublesize'
22665 drand01='$drand01'
22666 drand48_r_proto='$drand48_r_proto'
22667 dtrace='$dtrace'
22668 dynamic_ext='$dynamic_ext'
22669 eagain='$eagain'
22670 ebcdic='$ebcdic'
22671 echo='$echo'
22672 egrep='$egrep'
22673 emacs='$emacs'
22674 endgrent_r_proto='$endgrent_r_proto'
22675 endhostent_r_proto='$endhostent_r_proto'
22676 endnetent_r_proto='$endnetent_r_proto'
22677 endprotoent_r_proto='$endprotoent_r_proto'
22678 endpwent_r_proto='$endpwent_r_proto'
22679 endservent_r_proto='$endservent_r_proto'
22680 eunicefix='$eunicefix'
22681 exe_ext='$exe_ext'
22682 expr='$expr'
22683 extensions='$extensions'
22684 extern_C='$extern_C'
22685 extras='$extras'
22686 fflushNULL='$fflushNULL'
22687 fflushall='$fflushall'
22688 find='$find'
22689 firstmakefile='$firstmakefile'
22690 flex='$flex'
22691 fpossize='$fpossize'
22692 fpostype='$fpostype'
22693 freetype='$freetype'
22694 from='$from'
22695 full_ar='$full_ar'
22696 full_csh='$full_csh'
22697 full_sed='$full_sed'
22698 gccansipedantic='$gccansipedantic'
22699 gccosandvers='$gccosandvers'
22700 gccversion='$gccversion'
22701 getgrent_r_proto='$getgrent_r_proto'
22702 getgrgid_r_proto='$getgrgid_r_proto'
22703 getgrnam_r_proto='$getgrnam_r_proto'
22704 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22705 gethostbyname_r_proto='$gethostbyname_r_proto'
22706 gethostent_r_proto='$gethostent_r_proto'
22707 getlogin_r_proto='$getlogin_r_proto'
22708 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22709 getnetbyname_r_proto='$getnetbyname_r_proto'
22710 getnetent_r_proto='$getnetent_r_proto'
22711 getprotobyname_r_proto='$getprotobyname_r_proto'
22712 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22713 getprotoent_r_proto='$getprotoent_r_proto'
22714 getpwent_r_proto='$getpwent_r_proto'
22715 getpwnam_r_proto='$getpwnam_r_proto'
22716 getpwuid_r_proto='$getpwuid_r_proto'
22717 getservbyname_r_proto='$getservbyname_r_proto'
22718 getservbyport_r_proto='$getservbyport_r_proto'
22719 getservent_r_proto='$getservent_r_proto'
22720 getspnam_r_proto='$getspnam_r_proto'
22721 gidformat='$gidformat'
22722 gidsign='$gidsign'
22723 gidsize='$gidsize'
22724 gidtype='$gidtype'
22725 glibpth='$glibpth'
22726 gmake='$gmake'
22727 gmtime_r_proto='$gmtime_r_proto'
22728 gnulibc_version='$gnulibc_version'
22729 grep='$grep'
22730 groupcat='$groupcat'
22731 groupstype='$groupstype'
22732 gzip='$gzip'
22733 h_fcntl='$h_fcntl'
22734 h_sysfile='$h_sysfile'
22735 hint='$hint'
22736 hostcat='$hostcat'
22737 html1dir='$html1dir'
22738 html1direxp='$html1direxp'
22739 html3dir='$html3dir'
22740 html3direxp='$html3direxp'
22741 i16size='$i16size'
22742 i16type='$i16type'
22743 i32size='$i32size'
22744 i32type='$i32type'
22745 i64size='$i64size'
22746 i64type='$i64type'
22747 i8size='$i8size'
22748 i8type='$i8type'
22749 i_arpainet='$i_arpainet'
22750 i_assert='$i_assert'
22751 i_bsdioctl='$i_bsdioctl'
22752 i_crypt='$i_crypt'
22753 i_db='$i_db'
22754 i_dbm='$i_dbm'
22755 i_dirent='$i_dirent'
22756 i_dld='$i_dld'
22757 i_dlfcn='$i_dlfcn'
22758 i_fcntl='$i_fcntl'
22759 i_float='$i_float'
22760 i_fp='$i_fp'
22761 i_fp_class='$i_fp_class'
22762 i_gdbm='$i_gdbm'
22763 i_gdbm_ndbm='$i_gdbm_ndbm'
22764 i_gdbmndbm='$i_gdbmndbm'
22765 i_grp='$i_grp'
22766 i_ieeefp='$i_ieeefp'
22767 i_inttypes='$i_inttypes'
22768 i_langinfo='$i_langinfo'
22769 i_libutil='$i_libutil'
22770 i_limits='$i_limits'
22771 i_locale='$i_locale'
22772 i_machcthr='$i_machcthr'
22773 i_malloc='$i_malloc'
22774 i_mallocmalloc='$i_mallocmalloc'
22775 i_math='$i_math'
22776 i_memory='$i_memory'
22777 i_mntent='$i_mntent'
22778 i_ndbm='$i_ndbm'
22779 i_netdb='$i_netdb'
22780 i_neterrno='$i_neterrno'
22781 i_netinettcp='$i_netinettcp'
22782 i_niin='$i_niin'
22783 i_poll='$i_poll'
22784 i_prot='$i_prot'
22785 i_pthread='$i_pthread'
22786 i_pwd='$i_pwd'
22787 i_rpcsvcdbm='$i_rpcsvcdbm'
22788 i_sfio='$i_sfio'
22789 i_sgtty='$i_sgtty'
22790 i_shadow='$i_shadow'
22791 i_socks='$i_socks'
22792 i_stdarg='$i_stdarg'
22793 i_stddef='$i_stddef'
22794 i_stdlib='$i_stdlib'
22795 i_string='$i_string'
22796 i_sunmath='$i_sunmath'
22797 i_sysaccess='$i_sysaccess'
22798 i_sysdir='$i_sysdir'
22799 i_sysfile='$i_sysfile'
22800 i_sysfilio='$i_sysfilio'
22801 i_sysin='$i_sysin'
22802 i_sysioctl='$i_sysioctl'
22803 i_syslog='$i_syslog'
22804 i_sysmman='$i_sysmman'
22805 i_sysmode='$i_sysmode'
22806 i_sysmount='$i_sysmount'
22807 i_sysndir='$i_sysndir'
22808 i_sysparam='$i_sysparam'
22809 i_syspoll='$i_syspoll'
22810 i_sysresrc='$i_sysresrc'
22811 i_syssecrt='$i_syssecrt'
22812 i_sysselct='$i_sysselct'
22813 i_syssockio='$i_syssockio'
22814 i_sysstat='$i_sysstat'
22815 i_sysstatfs='$i_sysstatfs'
22816 i_sysstatvfs='$i_sysstatvfs'
22817 i_systime='$i_systime'
22818 i_systimek='$i_systimek'
22819 i_systimes='$i_systimes'
22820 i_systypes='$i_systypes'
22821 i_sysuio='$i_sysuio'
22822 i_sysun='$i_sysun'
22823 i_sysutsname='$i_sysutsname'
22824 i_sysvfs='$i_sysvfs'
22825 i_syswait='$i_syswait'
22826 i_termio='$i_termio'
22827 i_termios='$i_termios'
22828 i_time='$i_time'
22829 i_unistd='$i_unistd'
22830 i_ustat='$i_ustat'
22831 i_utime='$i_utime'
22832 i_values='$i_values'
22833 i_varargs='$i_varargs'
22834 i_varhdr='$i_varhdr'
22835 i_vfork='$i_vfork'
22836 ignore_versioned_solibs='$ignore_versioned_solibs'
22837 inc_version_list='$inc_version_list'
22838 inc_version_list_init='$inc_version_list_init'
22839 incpath='$incpath'
22840 inews='$inews'
22841 initialinstalllocation='$initialinstalllocation'
22842 installarchlib='$installarchlib'
22843 installbin='$installbin'
22844 installhtml1dir='$installhtml1dir'
22845 installhtml3dir='$installhtml3dir'
22846 installman1dir='$installman1dir'
22847 installman3dir='$installman3dir'
22848 installprefix='$installprefix'
22849 installprefixexp='$installprefixexp'
22850 installprivlib='$installprivlib'
22851 installscript='$installscript'
22852 installsitearch='$installsitearch'
22853 installsitebin='$installsitebin'
22854 installsitehtml1dir='$installsitehtml1dir'
22855 installsitehtml3dir='$installsitehtml3dir'
22856 installsitelib='$installsitelib'
22857 installsiteman1dir='$installsiteman1dir'
22858 installsiteman3dir='$installsiteman3dir'
22859 installsitescript='$installsitescript'
22860 installstyle='$installstyle'
22861 installusrbinperl='$installusrbinperl'
22862 installvendorarch='$installvendorarch'
22863 installvendorbin='$installvendorbin'
22864 installvendorhtml1dir='$installvendorhtml1dir'
22865 installvendorhtml3dir='$installvendorhtml3dir'
22866 installvendorlib='$installvendorlib'
22867 installvendorman1dir='$installvendorman1dir'
22868 installvendorman3dir='$installvendorman3dir'
22869 installvendorscript='$installvendorscript'
22870 intsize='$intsize'
22871 issymlink='$issymlink'
22872 ivdformat='$ivdformat'
22873 ivsize='$ivsize'
22874 ivtype='$ivtype'
22875 known_extensions='$known_extensions'
22876 ksh='$ksh'
22877 ld='$ld'
22878 lddlflags='$lddlflags'
22879 ldflags='$ldflags'
22880 ldflags_uselargefiles='$ldflags_uselargefiles'
22881 ldlibpthname='$ldlibpthname'
22882 less='$less'
22883 lib_ext='$lib_ext'
22884 libc='$libc'
22885 libperl='$libperl'
22886 libpth='$libpth'
22887 libs='$libs'
22888 libsdirs='$libsdirs'
22889 libsfiles='$libsfiles'
22890 libsfound='$libsfound'
22891 libspath='$libspath'
22892 libswanted='$libswanted'
22893 libswanted_uselargefiles='$libswanted_uselargefiles'
22894 line='$line'
22895 lint='$lint'
22896 lkflags='$lkflags'
22897 ln='$ln'
22898 lns='$lns'
22899 localtime_r_proto='$localtime_r_proto'
22900 locincpth='$locincpth'
22901 loclibpth='$loclibpth'
22902 longdblsize='$longdblsize'
22903 longlongsize='$longlongsize'
22904 longsize='$longsize'
22905 lp='$lp'
22906 lpr='$lpr'
22907 ls='$ls'
22908 lseeksize='$lseeksize'
22909 lseektype='$lseektype'
22910 mad='$mad'
22911 madlyh='$madlyh'
22912 madlyobj='$madlyobj'
22913 madlysrc='$madlysrc'
22914 mail='$mail'
22915 mailx='$mailx'
22916 make='$make'
22917 make_set_make='$make_set_make'
22918 mallocobj='$mallocobj'
22919 mallocsrc='$mallocsrc'
22920 malloctype='$malloctype'
22921 man1dir='$man1dir'
22922 man1direxp='$man1direxp'
22923 man1ext='$man1ext'
22924 man3dir='$man3dir'
22925 man3direxp='$man3direxp'
22926 man3ext='$man3ext'
22927 mips_type='$mips_type'
22928 mistrustnm='$mistrustnm'
22929 mkdir='$mkdir'
22930 mmaptype='$mmaptype'
22931 modetype='$modetype'
22932 more='$more'
22933 multiarch='$multiarch'
22934 mv='$mv'
22935 myarchname='$myarchname'
22936 mydomain='$mydomain'
22937 myhostname='$myhostname'
22938 myuname='$myuname'
22939 n='$n'
22940 need_va_copy='$need_va_copy'
22941 netdb_hlen_type='$netdb_hlen_type'
22942 netdb_host_type='$netdb_host_type'
22943 netdb_name_type='$netdb_name_type'
22944 netdb_net_type='$netdb_net_type'
22945 nm='$nm'
22946 nm_opt='$nm_opt'
22947 nm_so_opt='$nm_so_opt'
22948 nonxs_ext='$nonxs_ext'
22949 nroff='$nroff'
22950 nvEUformat='$nvEUformat'
22951 nvFUformat='$nvFUformat'
22952 nvGUformat='$nvGUformat'
22953 nv_overflows_integers_at='$nv_overflows_integers_at'
22954 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22955 nveformat='$nveformat'
22956 nvfformat='$nvfformat'
22957 nvgformat='$nvgformat'
22958 nvsize='$nvsize'
22959 nvtype='$nvtype'
22960 o_nonblock='$o_nonblock'
22961 obj_ext='$obj_ext'
22962 old_pthread_create_joinable='$old_pthread_create_joinable'
22963 optimize='$optimize'
22964 orderlib='$orderlib'
22965 osname='$osname'
22966 osvers='$osvers'
22967 otherlibdirs='$otherlibdirs'
22968 package='$package'
22969 pager='$pager'
22970 passcat='$passcat'
22971 patchlevel='$patchlevel'
22972 path_sep='$path_sep'
22973 perl5='$perl5'
22974 perl='$perl'
22975 perl_patchlevel='$perl_patchlevel'
22976 perladmin='$perladmin'
22977 perllibs='$perllibs'
22978 perlpath='$perlpath'
22979 pg='$pg'
22980 phostname='$phostname'
22981 pidtype='$pidtype'
22982 plibpth='$plibpth'
22983 pmake='$pmake'
22984 pr='$pr'
22985 prefix='$prefix'
22986 prefixexp='$prefixexp'
22987 privlib='$privlib'
22988 privlibexp='$privlibexp'
22989 procselfexe='$procselfexe'
22990 prototype='$prototype'
22991 ptrsize='$ptrsize'
22992 quadkind='$quadkind'
22993 quadtype='$quadtype'
22994 randbits='$randbits'
22995 randfunc='$randfunc'
22996 random_r_proto='$random_r_proto'
22997 randseedtype='$randseedtype'
22998 ranlib='$ranlib'
22999 rd_nodata='$rd_nodata'
23000 readdir64_r_proto='$readdir64_r_proto'
23001 readdir_r_proto='$readdir_r_proto'
23002 revision='$revision'
23003 rm='$rm'
23004 rm_try='$rm_try'
23005 rmail='$rmail'
23006 run='$run'
23007 runnm='$runnm'
23008 sGMTIME_max='$sGMTIME_max'
23009 sGMTIME_min='$sGMTIME_min'
23010 sLOCALTIME_max='$sLOCALTIME_max'
23011 sLOCALTIME_min='$sLOCALTIME_min'
23012 sPRIEUldbl='$sPRIEUldbl'
23013 sPRIFUldbl='$sPRIFUldbl'
23014 sPRIGUldbl='$sPRIGUldbl'
23015 sPRIXU64='$sPRIXU64'
23016 sPRId64='$sPRId64'
23017 sPRIeldbl='$sPRIeldbl'
23018 sPRIfldbl='$sPRIfldbl'
23019 sPRIgldbl='$sPRIgldbl'
23020 sPRIi64='$sPRIi64'
23021 sPRIo64='$sPRIo64'
23022 sPRIu64='$sPRIu64'
23023 sPRIx64='$sPRIx64'
23024 sSCNfldbl='$sSCNfldbl'
23025 sched_yield='$sched_yield'
23026 scriptdir='$scriptdir'
23027 scriptdirexp='$scriptdirexp'
23028 sed='$sed'
23029 seedfunc='$seedfunc'
23030 selectminbits='$selectminbits'
23031 selecttype='$selecttype'
23032 sendmail='$sendmail'
23033 setgrent_r_proto='$setgrent_r_proto'
23034 sethostent_r_proto='$sethostent_r_proto'
23035 setlocale_r_proto='$setlocale_r_proto'
23036 setnetent_r_proto='$setnetent_r_proto'
23037 setprotoent_r_proto='$setprotoent_r_proto'
23038 setpwent_r_proto='$setpwent_r_proto'
23039 setservent_r_proto='$setservent_r_proto'
23040 sh='$sh'
23041 shar='$shar'
23042 sharpbang='$sharpbang'
23043 shmattype='$shmattype'
23044 shortsize='$shortsize'
23045 shrpenv='$shrpenv'
23046 shsharp='$shsharp'
23047 sig_count='$sig_count'
23048 sig_name='$sig_name'
23049 sig_name_init='$sig_name_init'
23050 sig_num='$sig_num'
23051 sig_num_init='$sig_num_init'
23052 sig_size='$sig_size'
23053 signal_t='$signal_t'
23054 sitearch='$sitearch'
23055 sitearchexp='$sitearchexp'
23056 sitebin='$sitebin'
23057 sitebinexp='$sitebinexp'
23058 sitehtml1dir='$sitehtml1dir'
23059 sitehtml1direxp='$sitehtml1direxp'
23060 sitehtml3dir='$sitehtml3dir'
23061 sitehtml3direxp='$sitehtml3direxp'
23062 sitelib='$sitelib'
23063 sitelib_stem='$sitelib_stem'
23064 sitelibexp='$sitelibexp'
23065 siteman1dir='$siteman1dir'
23066 siteman1direxp='$siteman1direxp'
23067 siteman3dir='$siteman3dir'
23068 siteman3direxp='$siteman3direxp'
23069 siteprefix='$siteprefix'
23070 siteprefixexp='$siteprefixexp'
23071 sitescript='$sitescript'
23072 sitescriptexp='$sitescriptexp'
23073 sizesize='$sizesize'
23074 sizetype='$sizetype'
23075 sleep='$sleep'
23076 smail='$smail'
23077 so='$so'
23078 sockethdr='$sockethdr'
23079 socketlib='$socketlib'
23080 socksizetype='$socksizetype'
23081 sort='$sort'
23082 spackage='$spackage'
23083 spitshell='$spitshell'
23084 srand48_r_proto='$srand48_r_proto'
23085 srandom_r_proto='$srandom_r_proto'
23086 src='$src'
23087 ssizetype='$ssizetype'
23088 startperl='$startperl'
23089 startsh='$startsh'
23090 static_ext='$static_ext'
23091 stdchar='$stdchar'
23092 stdio_base='$stdio_base'
23093 stdio_bufsiz='$stdio_bufsiz'
23094 stdio_cnt='$stdio_cnt'
23095 stdio_filbuf='$stdio_filbuf'
23096 stdio_ptr='$stdio_ptr'
23097 stdio_stream_array='$stdio_stream_array'
23098 strerror_r_proto='$strerror_r_proto'
23099 strings='$strings'
23100 submit='$submit'
23101 subversion='$subversion'
23102 sysman='$sysman'
23103 tail='$tail'
23104 tar='$tar'
23105 targetarch='$targetarch'
23106 tbl='$tbl'
23107 tee='$tee'
23108 test='$test'
23109 timeincl='$timeincl'
23110 timetype='$timetype'
23111 tmpnam_r_proto='$tmpnam_r_proto'
23112 to='$to'
23113 touch='$touch'
23114 tr='$tr'
23115 trnl='$trnl'
23116 troff='$troff'
23117 ttyname_r_proto='$ttyname_r_proto'
23118 u16size='$u16size'
23119 u16type='$u16type'
23120 u32size='$u32size'
23121 u32type='$u32type'
23122 u64size='$u64size'
23123 u64type='$u64type'
23124 u8size='$u8size'
23125 u8type='$u8type'
23126 uidformat='$uidformat'
23127 uidsign='$uidsign'
23128 uidsize='$uidsize'
23129 uidtype='$uidtype'
23130 uname='$uname'
23131 uniq='$uniq'
23132 uquadtype='$uquadtype'
23133 use5005threads='$use5005threads'
23134 use64bitall='$use64bitall'
23135 use64bitint='$use64bitint'
23136 usecrosscompile='$usecrosscompile'
23137 usedevel='$usedevel'
23138 usedl='$usedl'
23139 usedtrace='$usedtrace'
23140 usefaststdio='$usefaststdio'
23141 useithreads='$useithreads'
23142 uselargefiles='$uselargefiles'
23143 uselongdouble='$uselongdouble'
23144 usemallocwrap='$usemallocwrap'
23145 usemorebits='$usemorebits'
23146 usemultiplicity='$usemultiplicity'
23147 usemymalloc='$usemymalloc'
23148 usenm='$usenm'
23149 useopcode='$useopcode'
23150 useperlio='$useperlio'
23151 useposix='$useposix'
23152 usereentrant='$usereentrant'
23153 userelocatableinc='$userelocatableinc'
23154 usesfio='$usesfio'
23155 useshrplib='$useshrplib'
23156 usesitecustomize='$usesitecustomize'
23157 usesocks='$usesocks'
23158 usethreads='$usethreads'
23159 usevendorprefix='$usevendorprefix'
23160 usevfork='$usevfork'
23161 usrinc='$usrinc'
23162 uuname='$uuname'
23163 uvXUformat='$uvXUformat'
23164 uvoformat='$uvoformat'
23165 uvsize='$uvsize'
23166 uvtype='$uvtype'
23167 uvuformat='$uvuformat'
23168 uvxformat='$uvxformat'
23169 vendorarch='$vendorarch'
23170 vendorarchexp='$vendorarchexp'
23171 vendorbin='$vendorbin'
23172 vendorbinexp='$vendorbinexp'
23173 vendorhtml1dir='$vendorhtml1dir'
23174 vendorhtml1direxp='$vendorhtml1direxp'
23175 vendorhtml3dir='$vendorhtml3dir'
23176 vendorhtml3direxp='$vendorhtml3direxp'
23177 vendorlib='$vendorlib'
23178 vendorlib_stem='$vendorlib_stem'
23179 vendorlibexp='$vendorlibexp'
23180 vendorman1dir='$vendorman1dir'
23181 vendorman1direxp='$vendorman1direxp'
23182 vendorman3dir='$vendorman3dir'
23183 vendorman3direxp='$vendorman3direxp'
23184 vendorprefix='$vendorprefix'
23185 vendorprefixexp='$vendorprefixexp'
23186 vendorscript='$vendorscript'
23187 vendorscriptexp='$vendorscriptexp'
23188 version='$version'
23189 version_patchlevel_string='$version_patchlevel_string'
23190 versiononly='$versiononly'
23191 vi='$vi'
23192 voidflags='$voidflags'
23193 xlibpth='$xlibpth'
23194 yacc='$yacc'
23195 yaccflags='$yaccflags'
23196 zcat='$zcat'
23197 zip='$zip'
23198 EOT
23199
23200 : Add in command line options if available
23201 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23202
23203 : add special variables
23204 $test -f $src/patchlevel.h && \
23205 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23206 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23207 echo "PERL_CONFIG_SH=true" >>config.sh
23208
23209 : propagate old symbols
23210 if $test -f UU/config.sh; then
23211         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23212         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23213                 config.sh config.sh UU/oldconfig.sh |\
23214                 $sort | $uniq -u >UU/oldsyms
23215         set X `cat UU/oldsyms`
23216         shift
23217         case $# in
23218         0) ;;
23219         *)
23220                 cat <<EOM
23221 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23222 EOM
23223                 echo ": Variables propagated from previous config.sh file." >>config.sh
23224                 for sym in `cat UU/oldsyms`; do
23225                         echo "    Propagating $hint variable "'$'"$sym..."
23226                         eval 'tmp="$'"${sym}"'"'
23227                         echo "$tmp" | \
23228                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23229                 done
23230                 ;;
23231         esac
23232 fi
23233
23234 : Finish up by extracting the .SH files
23235 case "$alldone" in
23236 exit)
23237         $rm -rf UU
23238         echo "Extraction done."
23239         exit 0
23240         ;;
23241 cont)
23242         ;;
23243 '')
23244         dflt=''
23245         nostick=true
23246         $cat <<EOM
23247
23248 If you'd like to make any changes to the config.sh file before I begin
23249 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23250
23251 EOM
23252         rp="Press return or use a shell escape to edit config.sh:"
23253         . UU/myread
23254         nostick=''
23255         case "$ans" in
23256         '') ;;
23257         *) : in case they cannot read
23258                 sh 1>&4 -c "$ans";;
23259         esac
23260         ;;
23261 esac
23262
23263 : if this fails, just run all the .SH files by hand
23264 . ./config.sh
23265
23266 echo " "
23267 exec 1>&4
23268 pwd=`pwd`
23269 . ./UU/extract
23270 cd "$pwd"
23271
23272 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23273         dflt=y
23274         case "$silent" in
23275         true) ;;
23276         *)
23277                 $cat <<EOM
23278
23279 Now you need to generate make dependencies by running "$make depend".
23280 You might prefer to run it in background: "$make depend > makedepend.out &"
23281 It can take a while, so you might not want to run it right now.
23282
23283 EOM
23284                 ;;
23285         esac
23286         rp="Run $make depend now?"
23287         . UU/myread
23288         case "$ans" in
23289         y*)
23290                 $make depend && echo "Now you must run '$make'."
23291                 ;;
23292         *)
23293                 echo "You must run '$make depend' then '$make'."
23294                 ;;
23295         esac
23296 elif test -f [Mm]akefile; then
23297         echo " "
23298         echo "Now you must run a $make."
23299 else
23300         echo "Configure done."
23301 fi
23302
23303 if $test -f Policy.sh; then
23304     $cat <<EOM
23305
23306 If you compile $package on a different machine or from a different object
23307 directory, copy the Policy.sh file from this object directory to the
23308 new one before you run Configure -- this will help you with most of
23309 the policy defaults.
23310
23311 EOM
23312 fi
23313 if $test -f config.msg; then
23314     echo "Hmm.  I also noted the following information while running:"
23315     echo " "
23316     $cat config.msg >&4
23317     $rm -f config.msg
23318 fi
23319 $rm -f kit*isdone ark*isdone
23320 $rm -rf UU
23321
23322 : End of Configure
23323