Fix for non-regexps being upgraded to SVt_REGEXP
[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 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
32 #
33 # Generated on Tue Feb  9 16:39:40 CET 2010 [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 run=''
212 targetarch=''
213 to=''
214 usecrosscompile=''
215 extern_C=''
216 mistrustnm=''
217 usedevel=''
218 perllibs=''
219 dynamic_ext=''
220 extensions=''
221 known_extensions=''
222 nonxs_ext=''
223 static_ext=''
224 useopcode=''
225 useposix=''
226 extras=''
227 d_bsd=''
228 d_eunice=''
229 d_xenix=''
230 eunicefix=''
231 ar=''
232 awk=''
233 bash=''
234 bison=''
235 byacc=''
236 cat=''
237 chgrp=''
238 chmod=''
239 chown=''
240 comm=''
241 compress=''
242 cp=''
243 cpio=''
244 cpp=''
245 csh=''
246 date=''
247 echo=''
248 egrep=''
249 emacs=''
250 expr=''
251 find=''
252 flex=''
253 gmake=''
254 grep=''
255 gzip=''
256 inews=''
257 ksh=''
258 less=''
259 line=''
260 lint=''
261 ln=''
262 lp=''
263 lpr=''
264 ls=''
265 mail=''
266 mailx=''
267 make=''
268 mkdir=''
269 more=''
270 mv=''
271 nm=''
272 nroff=''
273 perl=''
274 pg=''
275 pmake=''
276 pr=''
277 rm=''
278 rmail=''
279 sed=''
280 sendmail=''
281 shar=''
282 sleep=''
283 smail=''
284 sort=''
285 submit=''
286 tail=''
287 tar=''
288 tbl=''
289 tee=''
290 test=''
291 touch=''
292 tr=''
293 troff=''
294 uname=''
295 uniq=''
296 uuname=''
297 vi=''
298 zcat=''
299 zip=''
300 full_ar=''
301 full_sed=''
302 libswanted=''
303 hint=''
304 myuname=''
305 osname=''
306 osvers=''
307 Author=''
308 Date=''
309 Header=''
310 Id=''
311 Locker=''
312 Log=''
313 RCSfile=''
314 Revision=''
315 Source=''
316 State=''
317 _a=''
318 _exe=''
319 _o=''
320 archobjs=''
321 exe_ext=''
322 firstmakefile=''
323 lib_ext=''
324 obj_ext=''
325 path_sep=''
326 rm_try=''
327 afs=''
328 afsroot=''
329 alignbytes=''
330 ansi2knr=''
331 archlib=''
332 archlibexp=''
333 d_archlib=''
334 installarchlib=''
335 archname=''
336 myarchname=''
337 d_atolf=''
338 d_atoll=''
339 baserev=''
340 bin=''
341 binexp=''
342 initialinstalllocation=''
343 installbin=''
344 userelocatableinc=''
345 byteorder=''
346 cc=''
347 ccflags=''
348 cppflags=''
349 ldflags=''
350 lkflags=''
351 locincpth=''
352 optimize=''
353 cf_email=''
354 cf_by=''
355 cf_time=''
356 charbits=''
357 charsize=''
358 contains=''
359 cpp_stuff=''
360 cpplast=''
361 cppminus=''
362 cpprun=''
363 cppstdin=''
364 d__fwalk=''
365 d_access=''
366 d_accessx=''
367 d_aintl=''
368 d_alarm=''
369 asctime_r_proto=''
370 d_asctime_r=''
371 d_attribute_deprecated=''
372 d_attribute_format=''
373 d_attribute_malloc=''
374 d_attribute_nonnull=''
375 d_attribute_noreturn=''
376 d_attribute_pure=''
377 d_attribute_unused=''
378 d_attribute_warn_unused_result=''
379 d_printf_format_null=''
380 d_bcmp=''
381 d_bcopy=''
382 d_builtin_choose_expr=''
383 d_builtin_expect=''
384 d_bzero=''
385 d_c99_variadic_macros=''
386 d_casti32=''
387 castflags=''
388 d_castneg=''
389 d_chown=''
390 d_chroot=''
391 d_chsize=''
392 d_class=''
393 d_clearenv=''
394 d_closedir=''
395 d_void_closedir=''
396 d_cmsghdr_s=''
397 d_const=''
398 d_copysignl=''
399 d_cplusplus=''
400 cryptlib=''
401 d_crypt=''
402 crypt_r_proto=''
403 d_crypt_r=''
404 d_csh=''
405 full_csh=''
406 d_ctermid=''
407 ctermid_r_proto=''
408 d_ctermid_r=''
409 ctime_r_proto=''
410 d_ctime_r=''
411 d_cuserid=''
412 d_dbl_dig=''
413 d_dbminitproto=''
414 d_difftime=''
415 d_dir_dd_fd=''
416 d_dirfd=''
417 d_dlerror=''
418 d_dlopen=''
419 d_dlsymun=''
420 d_dosuid=''
421 d_suidsafe=''
422 d_drand48_r=''
423 drand48_r_proto=''
424 d_drand48proto=''
425 d_dup2=''
426 d_eaccess=''
427 d_endgrent=''
428 d_endgrent_r=''
429 endgrent_r_proto=''
430 d_endhent=''
431 d_endhostent_r=''
432 endhostent_r_proto=''
433 d_endnent=''
434 d_endnetent_r=''
435 endnetent_r_proto=''
436 d_endpent=''
437 d_endprotoent_r=''
438 endprotoent_r_proto=''
439 d_endpwent=''
440 d_endpwent_r=''
441 endpwent_r_proto=''
442 d_endsent=''
443 d_endservent_r=''
444 endservent_r_proto=''
445 d_faststdio=''
446 d_fchdir=''
447 d_fchmod=''
448 d_fchown=''
449 d_fcntl=''
450 d_fcntl_can_lock=''
451 d_fd_macros=''
452 d_fd_set=''
453 d_fds_bits=''
454 d_fgetpos=''
455 d_finite=''
456 d_finitel=''
457 d_flexfnam=''
458 d_flock=''
459 d_flockproto=''
460 d_fork=''
461 d_fp_class=''
462 d_fpclass=''
463 d_fpclassify=''
464 d_fpclassl=''
465 d_fpos64_t=''
466 d_frexpl=''
467 d_fs_data_s=''
468 d_fseeko=''
469 d_fsetpos=''
470 d_fstatfs=''
471 d_fsync=''
472 d_ftello=''
473 d_ftime=''
474 d_gettimeod=''
475 d_futimes=''
476 d_Gconvert=''
477 d_getaddrinfo=''
478 d_getcwd=''
479 d_getespwnam=''
480 d_getfsstat=''
481 d_getgrent=''
482 d_getgrent_r=''
483 getgrent_r_proto=''
484 d_getgrgid_r=''
485 getgrgid_r_proto=''
486 d_getgrnam_r=''
487 getgrnam_r_proto=''
488 d_getgrps=''
489 d_gethbyaddr=''
490 d_gethbyname=''
491 d_gethent=''
492 aphostname=''
493 d_gethname=''
494 d_phostname=''
495 d_uname=''
496 d_gethostbyaddr_r=''
497 gethostbyaddr_r_proto=''
498 d_gethostbyname_r=''
499 gethostbyname_r_proto=''
500 d_gethostent_r=''
501 gethostent_r_proto=''
502 d_gethostprotos=''
503 d_getitimer=''
504 d_getlogin=''
505 d_getlogin_r=''
506 getlogin_r_proto=''
507 d_getmnt=''
508 d_getmntent=''
509 d_getnameinfo=''
510 d_getnbyaddr=''
511 d_getnbyname=''
512 d_getnent=''
513 d_getnetbyaddr_r=''
514 getnetbyaddr_r_proto=''
515 d_getnetbyname_r=''
516 getnetbyname_r_proto=''
517 d_getnetent_r=''
518 getnetent_r_proto=''
519 d_getnetprotos=''
520 d_getpagsz=''
521 d_getpent=''
522 d_getpgid=''
523 d_getpgrp2=''
524 d_bsdgetpgrp=''
525 d_getpgrp=''
526 d_getppid=''
527 d_getprior=''
528 d_getpbyname=''
529 d_getpbynumber=''
530 d_getprotobyname_r=''
531 getprotobyname_r_proto=''
532 d_getprotobynumber_r=''
533 getprotobynumber_r_proto=''
534 d_getprotoent_r=''
535 getprotoent_r_proto=''
536 d_getprotoprotos=''
537 d_getprpwnam=''
538 d_getpwent=''
539 d_getpwent_r=''
540 getpwent_r_proto=''
541 d_getpwnam_r=''
542 getpwnam_r_proto=''
543 d_getpwuid_r=''
544 getpwuid_r_proto=''
545 d_getsent=''
546 d_getservbyname_r=''
547 getservbyname_r_proto=''
548 d_getservbyport_r=''
549 getservbyport_r_proto=''
550 d_getservent_r=''
551 getservent_r_proto=''
552 d_getservprotos=''
553 d_getspnam=''
554 d_getspnam_r=''
555 getspnam_r_proto=''
556 d_getsbyname=''
557 d_getsbyport=''
558 d_gmtime_r=''
559 gmtime_r_proto=''
560 d_gnulibc=''
561 gnulibc_version=''
562 d_hasmntopt=''
563 d_htonl=''
564 d_ilogbl=''
565 d_inetaton=''
566 d_inetntop=''
567 d_inetpton=''
568 d_int64_t=''
569 d_isascii=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_procselfexe=''
632 procselfexe=''
633 d_old_pthread_create_joinable=''
634 old_pthread_create_joinable=''
635 d_pthread_atfork=''
636 d_pthread_attr_setscope=''
637 d_pthread_yield=''
638 d_sched_yield=''
639 sched_yield=''
640 d_qgcvt=''
641 d_random_r=''
642 random_r_proto=''
643 d_readdir64_r=''
644 readdir64_r_proto=''
645 d_readdir=''
646 d_rewinddir=''
647 d_seekdir=''
648 d_telldir=''
649 d_readdir_r=''
650 readdir_r_proto=''
651 d_readlink=''
652 d_readv=''
653 d_recvmsg=''
654 d_rename=''
655 d_rmdir=''
656 d_safebcpy=''
657 d_safemcpy=''
658 d_sanemcmp=''
659 d_sbrkproto=''
660 d_scalbnl=''
661 d_select=''
662 d_sem=''
663 d_semctl=''
664 d_semget=''
665 d_semop=''
666 d_sendmsg=''
667 d_setegid=''
668 d_seteuid=''
669 d_setgrent=''
670 d_setgrent_r=''
671 setgrent_r_proto=''
672 d_setgrps=''
673 d_sethent=''
674 d_sethostent_r=''
675 sethostent_r_proto=''
676 d_setitimer=''
677 d_setlinebuf=''
678 d_setlocale=''
679 d_setlocale_r=''
680 setlocale_r_proto=''
681 d_setnent=''
682 d_setnetent_r=''
683 setnetent_r_proto=''
684 d_setpent=''
685 d_setpgid=''
686 d_setpgrp2=''
687 d_bsdsetpgrp=''
688 d_setpgrp=''
689 d_setprior=''
690 d_setproctitle=''
691 d_setprotoent_r=''
692 setprotoent_r_proto=''
693 d_setpwent=''
694 d_setpwent_r=''
695 setpwent_r_proto=''
696 d_setregid=''
697 d_setresgid=''
698 d_setresuid=''
699 d_setreuid=''
700 d_setrgid=''
701 d_setruid=''
702 d_setsent=''
703 d_setservent_r=''
704 setservent_r_proto=''
705 d_setsid=''
706 d_setvbuf=''
707 d_sfio=''
708 usesfio=''
709 d_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_msg_ctrunc=''
726 d_msg_dontroute=''
727 d_msg_oob=''
728 d_msg_peek=''
729 d_msg_proxy=''
730 d_oldsock=''
731 d_scm_rights=''
732 d_socket=''
733 d_sockpair=''
734 sockethdr=''
735 socketlib=''
736 d_socklen_t=''
737 d_socks5_init=''
738 d_sprintf_returns_strlen=''
739 d_sqrtl=''
740 d_srand48_r=''
741 srand48_r_proto=''
742 d_srandom_r=''
743 srandom_r_proto=''
744 d_sresgproto=''
745 d_sresuproto=''
746 d_statblks=''
747 d_statfs_f_flags=''
748 d_statfs_s=''
749 d_fstatvfs=''
750 d_statvfs=''
751 d_stdio_cnt_lval=''
752 d_stdio_ptr_lval=''
753 d_stdio_ptr_lval_nochange_cnt=''
754 d_stdio_ptr_lval_sets_cnt=''
755 d_stdiobase=''
756 d_stdstdio=''
757 stdio_base=''
758 stdio_bufsiz=''
759 stdio_cnt=''
760 stdio_filbuf=''
761 stdio_ptr=''
762 d_index=''
763 d_strchr=''
764 d_strcoll=''
765 d_strctcpy=''
766 d_strerrm=''
767 d_strerror=''
768 d_sysernlst=''
769 d_syserrlst=''
770 d_strerror_r=''
771 strerror_r_proto=''
772 d_strftime=''
773 d_strlcat=''
774 d_strlcpy=''
775 d_strtod=''
776 d_strtol=''
777 d_strtold=''
778 d_strtoll=''
779 d_strtoq=''
780 d_strtoul=''
781 d_strtoull=''
782 d_strtouq=''
783 d_strxfrm=''
784 d_symlink=''
785 d_syscall=''
786 d_syscallproto=''
787 d_sysconf=''
788 d_system=''
789 d_tcgetpgrp=''
790 d_tcsetpgrp=''
791 d_telldirproto=''
792 d_time=''
793 timetype=''
794 d_asctime64=''
795 d_ctime64=''
796 d_difftime64=''
797 d_gmtime64=''
798 d_localtime64=''
799 d_mktime64=''
800 d_timegm=''
801 clocktype=''
802 d_times=''
803 d_tmpnam_r=''
804 tmpnam_r_proto=''
805 d_truncate=''
806 d_ttyname_r=''
807 ttyname_r_proto=''
808 d_tzname=''
809 d_u32align=''
810 d_ualarm=''
811 d_umask=''
812 d_semctl_semid_ds=''
813 d_semctl_semun=''
814 d_union_semun=''
815 d_unordered=''
816 d_unsetenv=''
817 d_usleep=''
818 d_usleepproto=''
819 d_ustat=''
820 d_pseudofork=''
821 d_vfork=''
822 usevfork=''
823 d_voidsig=''
824 signal_t=''
825 d_volatile=''
826 d_charvspr=''
827 d_vprintf=''
828 d_wait4=''
829 d_waitpid=''
830 d_wcstombs=''
831 d_wctomb=''
832 d_writev=''
833 dlext=''
834 bin_ELF=''
835 cccdlflags=''
836 ccdlflags=''
837 dlsrc=''
838 ld=''
839 lddlflags=''
840 usedl=''
841 doublesize=''
842 ebcdic=''
843 fflushNULL=''
844 fflushall=''
845 fpossize=''
846 fpostype=''
847 gccansipedantic=''
848 gccosandvers=''
849 gccversion=''
850 gidformat=''
851 gidsign=''
852 gidsize=''
853 gidtype=''
854 groupstype=''
855 h_fcntl=''
856 h_sysfile=''
857 html1dir=''
858 html1direxp=''
859 installhtml1dir=''
860 html3dir=''
861 html3direxp=''
862 installhtml3dir=''
863 i_arpainet=''
864 i_assert=''
865 i_crypt=''
866 db_hashtype=''
867 db_prefixtype=''
868 db_version_major=''
869 db_version_minor=''
870 db_version_patch=''
871 i_db=''
872 i_dbm=''
873 i_rpcsvcdbm=''
874 d_dirnamlen=''
875 direntrytype=''
876 i_dirent=''
877 i_dld=''
878 i_dlfcn=''
879 i_fcntl=''
880 i_float=''
881 i_fp=''
882 i_fp_class=''
883 i_gdbm=''
884 d_grpasswd=''
885 i_grp=''
886 i_ieeefp=''
887 i_inttypes=''
888 i_langinfo=''
889 i_libutil=''
890 i_limits=''
891 i_locale=''
892 i_machcthr=''
893 i_malloc=''
894 i_mallocmalloc=''
895 i_math=''
896 i_memory=''
897 i_mntent=''
898 d_gdbm_ndbm_h_uses_prototypes=''
899 d_gdbmndbm_h_uses_prototypes=''
900 d_ndbm=''
901 d_ndbm_h_uses_prototypes=''
902 i_gdbm_ndbm=''
903 i_gdbmndbm=''
904 i_ndbm=''
905 i_netdb=''
906 i_neterrno=''
907 i_netinettcp=''
908 i_niin=''
909 i_sysin=''
910 i_poll=''
911 i_prot=''
912 i_pthread=''
913 d_pwage=''
914 d_pwchange=''
915 d_pwclass=''
916 d_pwcomment=''
917 d_pwexpire=''
918 d_pwgecos=''
919 d_pwpasswd=''
920 d_pwquota=''
921 i_pwd=''
922 i_sfio=''
923 i_shadow=''
924 i_socks=''
925 i_stddef=''
926 i_stdlib=''
927 i_string=''
928 strings=''
929 i_sunmath=''
930 i_sysaccess=''
931 i_sysdir=''
932 i_sysfile=''
933 d_voidtty=''
934 i_bsdioctl=''
935 i_sysfilio=''
936 i_sysioctl=''
937 i_syssockio=''
938 i_syslog=''
939 i_sysmman=''
940 i_sysmode=''
941 i_sysmount=''
942 i_sysndir=''
943 i_sysparam=''
944 i_syspoll=''
945 i_sysresrc=''
946 i_syssecrt=''
947 i_sysselct=''
948 i_sysstat=''
949 i_sysstatfs=''
950 i_sysstatvfs=''
951 i_systimes=''
952 i_systypes=''
953 i_sysuio=''
954 i_sysun=''
955 i_sysutsname=''
956 i_sysvfs=''
957 i_syswait=''
958 i_sgtty=''
959 i_termio=''
960 i_termios=''
961 d_tm_tm_gmtoff=''
962 d_tm_tm_zone=''
963 i_systime=''
964 i_systimek=''
965 i_time=''
966 timeincl=''
967 i_unistd=''
968 i_ustat=''
969 i_utime=''
970 i_values=''
971 i_stdarg=''
972 i_varargs=''
973 i_varhdr=''
974 i_vfork=''
975 d_inc_version_list=''
976 inc_version_list=''
977 inc_version_list_init=''
978 installprefix=''
979 installprefixexp=''
980 installstyle=''
981 installusrbinperl=''
982 intsize=''
983 longsize=''
984 shortsize=''
985 issymlink=''
986 libc=''
987 ldlibpthname=''
988 libperl=''
989 shrpenv=''
990 useshrplib=''
991 glibpth=''
992 libpth=''
993 loclibpth=''
994 plibpth=''
995 xlibpth=''
996 ignore_versioned_solibs=''
997 libs=''
998 libsdirs=''
999 libsfiles=''
1000 libsfound=''
1001 libspath=''
1002 lns=''
1003 d_PRIEUldbl=''
1004 d_PRIFUldbl=''
1005 d_PRIGUldbl=''
1006 d_PRIeldbl=''
1007 d_PRIfldbl=''
1008 d_PRIgldbl=''
1009 d_SCNfldbl=''
1010 sPRIEUldbl=''
1011 sPRIFUldbl=''
1012 sPRIGUldbl=''
1013 sPRIeldbl=''
1014 sPRIfldbl=''
1015 sPRIgldbl=''
1016 sSCNfldbl=''
1017 lseeksize=''
1018 lseektype=''
1019 mad=''
1020 madlyh=''
1021 madlyobj=''
1022 madlysrc=''
1023 make_set_make=''
1024 d_mymalloc=''
1025 freetype=''
1026 mallocobj=''
1027 mallocsrc=''
1028 malloctype=''
1029 usemallocwrap=''
1030 usemymalloc=''
1031 installman1dir=''
1032 man1dir=''
1033 man1direxp=''
1034 man1ext=''
1035 installman3dir=''
1036 man3dir=''
1037 man3direxp=''
1038 man3ext=''
1039 modetype=''
1040 multiarch=''
1041 mydomain=''
1042 myhostname=''
1043 phostname=''
1044 c=''
1045 n=''
1046 d_eofnblk=''
1047 eagain=''
1048 o_nonblock=''
1049 rd_nodata=''
1050 need_va_copy=''
1051 netdb_hlen_type=''
1052 netdb_host_type=''
1053 netdb_name_type=''
1054 netdb_net_type=''
1055 groupcat=''
1056 hostcat=''
1057 passcat=''
1058 orderlib=''
1059 ranlib=''
1060 d_perl_otherlibdirs=''
1061 otherlibdirs=''
1062 package=''
1063 spackage=''
1064 pager=''
1065 api_revision=''
1066 api_subversion=''
1067 api_version=''
1068 api_versionstring=''
1069 patchlevel=''
1070 perl_patchlevel=''
1071 revision=''
1072 subversion=''
1073 version=''
1074 version_patchlevel_string=''
1075 perl5=''
1076 perladmin=''
1077 perlpath=''
1078 d_nv_preserves_uv=''
1079 d_nv_zero_is_allbits_zero=''
1080 i16size=''
1081 i16type=''
1082 i32size=''
1083 i32type=''
1084 i64size=''
1085 i64type=''
1086 i8size=''
1087 i8type=''
1088 ivsize=''
1089 ivtype=''
1090 nv_overflows_integers_at=''
1091 nv_preserves_uv_bits=''
1092 nvsize=''
1093 nvtype=''
1094 u16size=''
1095 u16type=''
1096 u32size=''
1097 u32type=''
1098 u64size=''
1099 u64type=''
1100 u8size=''
1101 u8type=''
1102 uvsize=''
1103 uvtype=''
1104 ivdformat=''
1105 nvEUformat=''
1106 nvFUformat=''
1107 nvGUformat=''
1108 nveformat=''
1109 nvfformat=''
1110 nvgformat=''
1111 uvXUformat=''
1112 uvoformat=''
1113 uvuformat=''
1114 uvxformat=''
1115 pidtype=''
1116 prefix=''
1117 prefixexp=''
1118 installprivlib=''
1119 privlib=''
1120 privlibexp=''
1121 prototype=''
1122 ptrsize=''
1123 d_PRIXU64=''
1124 d_PRId64=''
1125 d_PRIi64=''
1126 d_PRIo64=''
1127 d_PRIu64=''
1128 d_PRIx64=''
1129 sPRIXU64=''
1130 sPRId64=''
1131 sPRIi64=''
1132 sPRIo64=''
1133 sPRIu64=''
1134 sPRIx64=''
1135 d_quad=''
1136 quadkind=''
1137 quadtype=''
1138 uquadtype=''
1139 drand01=''
1140 randbits=''
1141 randfunc=''
1142 randseedtype=''
1143 seedfunc=''
1144 installscript=''
1145 scriptdir=''
1146 scriptdirexp=''
1147 selectminbits=''
1148 selecttype=''
1149 sh=''
1150 sig_count=''
1151 sig_name=''
1152 sig_name_init=''
1153 sig_num=''
1154 sig_num_init=''
1155 sig_size=''
1156 d_sitearch=''
1157 installsitearch=''
1158 sitearch=''
1159 sitearchexp=''
1160 installsitebin=''
1161 sitebin=''
1162 sitebinexp=''
1163 installsitehtml1dir=''
1164 sitehtml1dir=''
1165 sitehtml1direxp=''
1166 installsitehtml3dir=''
1167 sitehtml3dir=''
1168 sitehtml3direxp=''
1169 installsitelib=''
1170 sitelib=''
1171 sitelib_stem=''
1172 sitelibexp=''
1173 installsiteman1dir=''
1174 siteman1dir=''
1175 siteman1direxp=''
1176 installsiteman3dir=''
1177 siteman3dir=''
1178 siteman3direxp=''
1179 siteprefix=''
1180 siteprefixexp=''
1181 installsitescript=''
1182 sitescript=''
1183 sitescriptexp=''
1184 sizesize=''
1185 sizetype=''
1186 so=''
1187 socksizetype=''
1188 sharpbang=''
1189 shsharp=''
1190 spitshell=''
1191 src=''
1192 ssizetype=''
1193 startperl=''
1194 startsh=''
1195 stdchar=''
1196 d_stdio_stream_array=''
1197 stdio_stream_array=''
1198 sysman=''
1199 sGMTIME_max=''
1200 sGMTIME_min=''
1201 sLOCALTIME_max=''
1202 sLOCALTIME_min=''
1203 trnl=''
1204 uidformat=''
1205 uidsign=''
1206 uidsize=''
1207 uidtype=''
1208 archname64=''
1209 use64bitall=''
1210 use64bitint=''
1211 dtrace=''
1212 usedtrace=''
1213 usefaststdio=''
1214 ccflags_uselargefiles=''
1215 ldflags_uselargefiles=''
1216 libswanted_uselargefiles=''
1217 uselargefiles=''
1218 uselongdouble=''
1219 usemorebits=''
1220 usemultiplicity=''
1221 nm_opt=''
1222 nm_so_opt=''
1223 runnm=''
1224 usenm=''
1225 useperlio=''
1226 usesocks=''
1227 d_oldpthreads=''
1228 use5005threads=''
1229 useithreads=''
1230 usereentrant=''
1231 usethreads=''
1232 incpath=''
1233 mips_type=''
1234 usrinc=''
1235 vaproto=''
1236 d_vendorarch=''
1237 installvendorarch=''
1238 vendorarch=''
1239 vendorarchexp=''
1240 d_vendorbin=''
1241 installvendorbin=''
1242 vendorbin=''
1243 vendorbinexp=''
1244 installvendorhtml1dir=''
1245 vendorhtml1dir=''
1246 vendorhtml1direxp=''
1247 installvendorhtml3dir=''
1248 vendorhtml3dir=''
1249 vendorhtml3direxp=''
1250 d_vendorlib=''
1251 installvendorlib=''
1252 vendorlib=''
1253 vendorlib_stem=''
1254 vendorlibexp=''
1255 installvendorman1dir=''
1256 vendorman1dir=''
1257 vendorman1direxp=''
1258 installvendorman3dir=''
1259 vendorman3dir=''
1260 vendorman3direxp=''
1261 usevendorprefix=''
1262 vendorprefix=''
1263 vendorprefixexp=''
1264 d_vendorscript=''
1265 installvendorscript=''
1266 vendorscript=''
1267 vendorscriptexp=''
1268 versiononly=''
1269 defvoidused=''
1270 voidflags=''
1271 yacc=''
1272 yaccflags=''
1273 CONFIG=''
1274
1275 : Detect odd OSs
1276 define='define'
1277 undef='undef'
1278 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1279 rmlist=''
1280
1281 : We must find out about Eunice early
1282 eunicefix=':'
1283 if test -f /etc/unixtovms; then
1284         eunicefix=/etc/unixtovms
1285 fi
1286 if test -f /etc/unixtovms.exe; then
1287         eunicefix=/etc/unixtovms.exe
1288 fi
1289
1290 : Set executable suffix now -- needed before hints available
1291 if test -f "/libs/version.library"; then
1292 : Amiga OS
1293     _exe=""
1294 elif test -f "/system/gnu_library/bin/ar.pm"; then
1295 : Stratus VOS
1296     _exe=".pm"
1297 elif test -n "$DJGPP"; then
1298 : DOS DJGPP
1299     _exe=".exe"
1300 elif test -d c:/. -o -n "$is_os2" ; then
1301 : OS/2 or cygwin
1302     _exe=".exe"
1303 fi
1304
1305 groupstype=''
1306 i_whoami=''
1307 : Trailing extension.  Override this in a hint file, if needed.
1308 : Extra object files, if any, needed on this platform.
1309 archobjs=''
1310 archname=''
1311 libnames=''
1312 : change the next line if compiling for Xenix/286 on Xenix/386
1313 xlibpth='/usr/lib/386 /lib/386'
1314 : Possible local library directories to search.
1315 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1316 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1317
1318 : general looking path for locating libraries
1319 glibpth="/lib /usr/lib $xlibpth"
1320 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1321 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1322 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1323 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1324
1325 : Private path used by Configure to find libraries.  Its value
1326 : is prepended to libpth. This variable takes care of special
1327 : machines, like the mips.  Usually, it should be empty.
1328 plibpth=''
1329
1330 : default library list
1331 libswanted=''
1332 : some systems want to use only the non-versioned libso:s
1333 ignore_versioned_solibs=''
1334 : set usethreads on the Configure command line to enable threads.
1335 usereentrant='undef'
1336 : full support for void wanted by default
1337 defvoidused=15
1338
1339 : Possible local include directories to search.
1340 : Set locincpth to "" in a hint file to defeat local include searches.
1341 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1342 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1343 :
1344 : no include file wanted by default
1345 inclwanted=''
1346
1347 : Enable -DEBUGGING and -DDEBUGGING from the command line
1348 EBUGGING=''
1349 DEBUGGING=old
1350
1351 ccname=''
1352 ccversion=''
1353 perllibs=''
1354 : set useposix=false in your hint file to disable the POSIX extension.
1355 useposix=true
1356 : set useopcode=false in your hint file to disable the Opcode extension.
1357 useopcode=true
1358 archname64=''
1359 ccflags_uselargefiles=''
1360 ldflags_uselargefiles=''
1361 libswanted_uselargefiles=''
1362 : set usemultiplicity on the Configure command line to enable multiplicity.
1363 : set usesocks on the Configure command line to enable socks.
1364 : List of libraries we want.
1365 : If anyone needs extra -lxxx, put those in a hint file.
1366 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1367 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1368 : We probably want to search /usr/shlib before most other libraries.
1369 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1370 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1371 glibpth="/usr/shlib $glibpth"
1372 : Do not use vfork unless overridden by a hint file.
1373 usevfork=false
1374
1375 : Find the basic shell for Bourne shell scripts
1376 case "$sh" in
1377 '')
1378         case "$SYSTYPE" in
1379         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1380         *) xxx='/bin/sh';;
1381         esac
1382         if test -f "$xxx"; then
1383                 sh="$xxx"
1384         else
1385                 : Build up a list and do a single loop so we can 'break' out.
1386                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1387                 for xxx in sh bash ksh pdksh ash; do
1388                         for p in $pth; do
1389                                 try="$try ${p}/${xxx}"
1390                         done
1391                 done
1392                 for xxx in $try; do
1393                         if test -f "$xxx"; then
1394                                 sh="$xxx";
1395                                 break
1396                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1397                                 sh="$xxx";
1398                                 break
1399                         elif test -f "$xxx.exe"; then
1400                                 sh="$xxx";
1401                                 break
1402                         fi
1403                 done
1404         fi
1405         ;;
1406 esac
1407
1408 case "$sh" in
1409 '')     cat >&2 <<EOM
1410 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1411
1412 Usually it's in /bin/sh.  How did you even get this far?
1413 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1414 we'll try to straighten this all out.
1415 EOM
1416         exit 1
1417         ;;
1418 esac
1419
1420 : see if sh knows # comments
1421 if `$sh -c '#' >/dev/null 2>&1`; then
1422         shsharp=true
1423         spitshell=cat
1424         xcat=/bin/cat
1425         test -f $xcat$_exe || xcat=/usr/bin/cat
1426         if test ! -f $xcat$_exe; then
1427                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1428                         if test -f $p/cat$_exe; then
1429                                 xcat=$p/cat
1430                                 break
1431                         fi
1432                 done
1433                 if test ! -f $xcat$_exe; then
1434                         echo "Can't find cat anywhere!"
1435                         exit 1
1436                 fi
1437         fi
1438         echo "#!$xcat" >sharp
1439         $eunicefix sharp
1440         chmod +x sharp
1441         ./sharp > today 2>/dev/null
1442         if test -s today; then
1443                 sharpbang='#!'
1444         else
1445                 echo "#! $xcat" > sharp
1446                 $eunicefix sharp
1447                 chmod +x sharp
1448                 ./sharp > today 2>/dev/null
1449                 if test -s today; then
1450                         sharpbang='#! '
1451                 else
1452                         sharpbang=': use '
1453                 fi
1454         fi
1455 else
1456         echo " "
1457         echo "Your $sh doesn't grok # comments--I will strip them later on."
1458         shsharp=false
1459         cd ..
1460         echo "exec grep -v '^[  ]*#'" >spitshell
1461         chmod +x spitshell
1462         $eunicefix spitshell
1463         spitshell=`pwd`/spitshell
1464         cd UU
1465         echo "I presume that if # doesn't work, #! won't work either!"
1466         sharpbang=': use '
1467 fi
1468 rm -f sharp today
1469
1470 : figure out how to guarantee sh startup
1471 case "$startsh" in
1472 '') startsh=${sharpbang}${sh} ;;
1473 *)
1474 esac
1475 cat >sharp <<EOSS
1476 $startsh
1477 set abc
1478 test "$?abc" != 1
1479 EOSS
1480
1481 chmod +x sharp
1482 $eunicefix sharp
1483 if ./sharp; then
1484         : echo "Yup, it does."
1485 else
1486         echo "Hmm... '$startsh' does not guarantee sh startup..."
1487         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1488 fi
1489 rm -f sharp
1490
1491 : Save command line options in file UU/cmdline.opt for later use in
1492 : generating config.sh.
1493 cat > cmdline.opt <<EOSH
1494 : Configure command line arguments.
1495 config_arg0='$0'
1496 config_args='$*'
1497 config_argc=$#
1498 EOSH
1499 argn=1
1500 args_exp=''
1501 args_sep=''
1502 for arg in "$@"; do
1503         cat >>cmdline.opt <<EOSH
1504 config_arg$argn='$arg'
1505 EOSH
1506         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1507 $arg
1508 EOC
1509         arg_exp=`cat cmdl.opt`
1510         args_exp="$args_exp$args_sep'$arg_exp'"
1511         argn=`expr $argn + 1`
1512         args_sep=' '
1513 done
1514 rm -f cmdl.opt
1515
1516 : produce awk script to parse command line options
1517 cat >options.awk <<'EOF'
1518 BEGIN {
1519         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1520
1521         len = length(optstr);
1522         for (i = 1; i <= len; i++) {
1523                 c = substr(optstr, i, 1);
1524                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1525                 if (a == ":") {
1526                         arg[c] = 1;
1527                         i++;
1528                 }
1529                 opt[c] = 1;
1530         }
1531 }
1532 {
1533         expect = 0;
1534         str = $0;
1535         if (substr(str, 1, 1) != "-") {
1536                 printf("'%s'\n", str);
1537                 next;
1538         }
1539         len = length($0);
1540         for (i = 2; i <= len; i++) {
1541                 c = substr(str, i, 1);
1542                 if (!opt[c]) {
1543                         printf("-%s\n", substr(str, i));
1544                         next;
1545                 }
1546                 printf("-%s\n", c);
1547                 if (arg[c]) {
1548                         if (i < len)
1549                                 printf("'%s'\n", substr(str, i + 1));
1550                         else
1551                                 expect = 1;
1552                         next;
1553                 }
1554         }
1555 }
1556 END {
1557         if (expect)
1558                 print "?";
1559 }
1560 EOF
1561
1562 : process the command line options
1563 set X `for arg in "$@"; do echo "X$arg"; done |
1564         sed -e s/X// | awk -f options.awk`
1565 eval "set $*"
1566 shift
1567 rm -f options.awk
1568
1569 : set up default values
1570 fastread=''
1571 reuseval=false
1572 config_sh=''
1573 alldone=''
1574 error=''
1575 silent=''
1576 extractsh=''
1577 override=''
1578 knowitall=''
1579 rm -f optdef.sh posthint.sh
1580 cat >optdef.sh <<EOS
1581 $startsh
1582 EOS
1583
1584
1585 : option parsing
1586 while test $# -gt 0; do
1587         case "$1" in
1588         -d) shift; fastread=yes;;
1589         -e) shift; alldone=cont;;
1590         -f)
1591                 shift
1592                 cd ..
1593                 if test -r "$1"; then
1594                         config_sh="$1"
1595                 else
1596                         echo "$me: cannot read config file $1." >&2
1597                         error=true
1598                 fi
1599                 cd UU
1600                 shift;;
1601         --help|\
1602         -h) shift; error=true;;
1603         -r) shift; reuseval=true;;
1604         -s) shift; silent=true; realsilent=true;;
1605         -E) shift; alldone=exit;;
1606         -K) shift; knowitall=true;;
1607         -O) shift; override=true;;
1608         -S) shift; silent=true; extractsh=true;;
1609         -D)
1610                 shift
1611                 case "$1" in
1612                 *=)
1613                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1614                         echo "$me: ignoring -D $1" >&2
1615                         ;;
1616                 *=*) echo "$1" | \
1617                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1618                 *) echo "$1='define'" >> optdef.sh;;
1619                 esac
1620                 shift
1621                 ;;
1622         -U)
1623                 shift
1624                 case "$1" in
1625                 *=) echo "$1" >> optdef.sh;;
1626                 *=*)
1627                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1628                         echo "$me: ignoring -U $1" >&2
1629                         ;;
1630                 *) echo "$1='undef'" >> optdef.sh;;
1631                 esac
1632                 shift
1633                 ;;
1634         -A)
1635             shift
1636             xxx=''
1637             yyy="$1"
1638             zzz=''
1639             uuu=undef
1640             case "$yyy" in
1641             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1642                  case "$zzz" in
1643                  *:*) zzz='' ;;
1644                  *)   xxx=append
1645                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1646                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1647                  esac
1648                  ;;
1649             esac
1650             case "$xxx" in
1651             '')  case "$yyy" in
1652                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1653                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1654                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1655                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1656                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1657                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1658                  esac
1659                  ;;
1660             esac
1661             case "$xxx" in
1662             append)
1663                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1664             clear)
1665                 echo "$yyy=''"                  >> posthint.sh ;;
1666             define)
1667                 case "$zzz" in
1668                 '') zzz=define ;;
1669                 esac
1670                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1671             eval)
1672                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1673             prepend)
1674                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1675             undef)
1676                 case "$zzz" in
1677                 '') zzz="$uuu" ;;
1678                 esac
1679                 echo "$yyy=$zzz"                >> posthint.sh ;;
1680             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1681             esac
1682             shift
1683             ;;
1684         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1685             exit 0;;
1686         --) break;;
1687         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1688         *) break;;
1689         esac
1690 done
1691
1692 case "$error" in
1693 true)
1694         cat >&2 <<EOM
1695 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1696                  [-U symbol] [-U symbol=] [-A command:symbol...]
1697   -d : use defaults for all answers.
1698   -e : go on without questioning past the production of config.sh.
1699   -f : specify an alternate default configuration file.
1700   -h : print this help message and exit (with an error status).
1701   -r : reuse C symbols value if possible (skips costly nm extraction).
1702   -s : silent mode, only echoes questions and essential information.
1703   -D : define symbol to have some value:
1704          -D symbol         symbol gets the value 'define'
1705          -D symbol=value   symbol gets the value 'value'
1706        common used examples (see INSTALL for more info):
1707          -Duse64bitint            use 64bit integers
1708          -Duse64bitall            use 64bit integers and pointers
1709          -Dusethreads             use thread support
1710          -Dinc_version_list=none  do not include older perl trees in @INC
1711          -DEBUGGING=none          DEBUGGING options
1712          -Dcc=gcc                 choose your compiler
1713          -Dprefix=/opt/perl5      choose your destination
1714   -E : stop at the end of questions, after having produced config.sh.
1715   -K : do not use unless you know what you are doing.
1716   -O : let -D and -U override definitions from loaded configuration file.
1717   -S : perform variable substitutions on all .SH files (can mix with -f)
1718   -U : undefine symbol:
1719          -U symbol    symbol gets the value 'undef'
1720          -U symbol=   symbol gets completely empty
1721        e.g.:  -Uversiononly
1722   -A : manipulate symbol after the platform specific hints have been applied:
1723          -A append:symbol=value   append value to symbol
1724          -A symbol=value          like append:, but with a separating space
1725          -A define:symbol=value   define symbol to have value
1726          -A clear:symbol          define symbol to be ''
1727          -A define:symbol         define symbol to be 'define'
1728          -A eval:symbol=value     define symbol to be eval of value
1729          -A prepend:symbol=value  prepend value to symbol
1730          -A undef:symbol          define symbol to be 'undef'
1731          -A undef:symbol=         define symbol to be ''
1732        e.g.:  -A prepend:libswanted='cl pthread '
1733               -A ccflags=-DSOME_MACRO
1734   -V : print version number and exit (with a zero status).
1735 EOM
1736         exit 1
1737         ;;
1738 esac
1739
1740 : Sanity checks
1741 case "$fastread$alldone" in
1742 yescont|yesexit) ;;
1743 *)
1744         case "$extractsh" in
1745         true) ;;
1746         *)
1747                 if test ! -t 0; then
1748                         echo "Say 'sh Configure', not 'sh <Configure'"
1749                         exit 1
1750                 fi
1751                 ;;
1752         esac
1753         ;;
1754 esac
1755
1756 exec 4>&1
1757 case "$silent" in
1758 true) exec 1>/dev/null;;
1759 esac
1760
1761 : run the defines and the undefines, if any, but leave the file out there...
1762 touch optdef.sh
1763 . ./optdef.sh
1764 : create the posthint manipulation script and leave the file out there...
1765 touch posthint.sh
1766
1767 : set package name
1768 package='perl5'
1769 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1770 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1771 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1772 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1773 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1774 esac
1775
1776 : Some greps do not return status, grrr.
1777 echo "grimblepritz" >grimble
1778 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1779         contains=contains
1780 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1781         contains=grep
1782 else
1783         contains=contains
1784 fi
1785 rm -f grimble
1786 : the following should work in any shell
1787 case "$contains" in
1788 contains*)
1789         echo " "
1790         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1791         cat >contains <<'EOSS'
1792 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1793 EOSS
1794 chmod +x contains
1795 esac
1796
1797 : Find the path to the source tree
1798 case "$src" in
1799 '') case "$0" in
1800     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1801          case "$src" in
1802          /*)    ;;
1803          .)     ;;
1804          *)     src=`cd ../$src && pwd` ;;
1805          esac
1806          ;;
1807     *)   src='.';;
1808     esac;;
1809 esac
1810 case "$src" in
1811 '')     src=/
1812         rsrc=/
1813         ;;
1814 /*)     rsrc="$src";;
1815 *)      rsrc="../$src";;
1816 esac
1817 if test -f $rsrc/Configure && \
1818         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1819 then
1820    : found it, so we are ok.
1821 else
1822         rsrc=''
1823         for src in . .. ../.. ../../.. ../../../..; do
1824                 if test -f ../$src/Configure && \
1825                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1826                 then
1827                         rsrc=../$src
1828                         break
1829                 fi
1830         done
1831 fi
1832 case "$rsrc" in
1833 '')
1834         cat <<EOM >&4
1835
1836 Sorry, I can't seem to locate the source dir for $package.  Please start
1837 Configure with an explicit path -- i.e. /some/path/Configure.
1838
1839 EOM
1840         exit 1
1841         ;;
1842 ../.)   rsrc='..';;
1843 *)
1844         echo " "
1845         echo "Sources for $package found in \"$src\"." >&4
1846         ;;
1847 esac
1848
1849 : script used to extract .SH files with variable substitutions
1850 cat >extract <<'EOS'
1851 PERL_CONFIG_SH=true
1852 echo "Doing variable substitutions on .SH files..."
1853 if test -f MANIFEST; then
1854         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1855 else
1856         echo "(Looking for .SH files under the source directory.)"
1857         set x `(cd "$src"; find . -name "*.SH" -print)`
1858 fi
1859 shift
1860 case $# in
1861 0) set x `(cd "$src"; echo *.SH)`; shift;;
1862 esac
1863 if test ! -f "$src/$1"; then
1864         shift
1865 fi
1866 mkdir_p='
1867 name=$1;
1868 create="";
1869 while test $name; do
1870         if test ! -d "$name"; then
1871                 create="$name $create";
1872                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1873                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1874         else
1875                 name="";
1876         fi;
1877 done;
1878 for file in $create; do
1879         mkdir $file;
1880 done
1881 '
1882 for file in $*; do
1883         case "$src" in
1884         ".")
1885                 case "$file" in
1886                 */*)
1887                         dir=`expr X$file : 'X\(.*\)/'`
1888                         file=`expr X$file : 'X.*/\(.*\)'`
1889                         (cd "$dir" && . ./$file)
1890                         ;;
1891                 *)
1892                         . ./$file
1893                         ;;
1894                 esac
1895                 ;;
1896         *)
1897                 case "$file" in
1898                 */*)
1899                         dir=`expr X$file : 'X\(.*\)/'`
1900                         file=`expr X$file : 'X.*/\(.*\)'`
1901                         (set x $dir; shift; eval $mkdir_p)
1902                         sh <"$src/$dir/$file"
1903                         ;;
1904                 *)
1905                         sh <"$src/$file"
1906                         ;;
1907                 esac
1908                 ;;
1909         esac
1910 done
1911 if test -f "$src/config_h.SH"; then
1912         if test ! -f config.h; then
1913         : oops, they left it out of MANIFEST, probably, so do it anyway.
1914         . "$src/config_h.SH"
1915         fi
1916 fi
1917 EOS
1918
1919 : extract files and exit if asked to do so
1920 case "$extractsh" in
1921 true)
1922         case "$realsilent" in
1923         true) ;;
1924         *) exec 1>&4;;
1925         esac
1926         case "$config_sh" in
1927         '') config_sh='config.sh';;
1928         esac
1929         echo " "
1930         echo "Fetching answers from $config_sh..."
1931         cd ..
1932         . $config_sh
1933         test "$override" && . ./optdef.sh
1934         echo " "
1935         . UU/extract
1936         rm -rf UU
1937         echo "Extraction done."
1938         exit 0
1939         ;;
1940 esac
1941
1942 : Eunice requires " " instead of "", can you believe it
1943 echo " "
1944 : Here we go...
1945 echo "Beginning of configuration questions for $package."
1946
1947 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1948
1949 : first determine how to suppress newline on echo command
1950 echo " "
1951 echo "Checking echo to see how to suppress newlines..."
1952 (echo "hi there\c" ; echo " ") >.echotmp
1953 if $contains c .echotmp >/dev/null 2>&1 ; then
1954         echo "...using -n."
1955         n='-n'
1956         c=''
1957 else
1958         cat <<'EOM'
1959 ...using \c
1960 EOM
1961         n=''
1962         c='\c'
1963 fi
1964 echo $n "The star should be here-->$c"
1965 echo '*'
1966 rm -f .echotmp
1967
1968 : Now test for existence of everything in MANIFEST
1969 echo " "
1970 if test -f "$rsrc/MANIFEST"; then
1971         echo "First let's make sure your kit is complete.  Checking..." >&4
1972         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1973                 (split -l 50 2>/dev/null || split -50)
1974         rm -f missing
1975         tmppwd=`pwd`
1976         for filelist in x??; do
1977                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1978                         >/dev/null 2>>"$tmppwd/missing")
1979         done
1980         if test -s missing; then
1981                 cat missing >&4
1982                 cat >&4 <<'EOM'
1983
1984 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1985
1986 You have the option of continuing the configuration process, despite the
1987 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1988 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1989 and contact the author (perlbug@perl.org).
1990
1991 EOM
1992                 echo $n "Continue? [n] $c" >&4
1993                 read ans
1994                 case "$ans" in
1995                 y*)
1996                         echo "Continuing..." >&4
1997                         rm -f missing
1998                         ;;
1999                 *)
2000                         echo "ABORTING..." >&4
2001                         kill $$
2002                         ;;
2003                 esac
2004         else
2005                 echo "Looks good..."
2006         fi
2007 else
2008         echo "There is no MANIFEST file.  I hope your kit is complete !"
2009 fi
2010 rm -f missing x??
2011
2012 : Find the appropriate value for a newline for tr
2013 echo " "
2014 if test -n "$DJGPP"; then
2015        trnl='\012'
2016 fi
2017 if test X"$trnl" = X; then
2018         case "`echo foo|tr '\n' x 2>/dev/null`" in
2019         foox) trnl='\n' ;;
2020         esac
2021 fi
2022 if test X"$trnl" = X; then
2023         case "`echo foo|tr '\012' x 2>/dev/null`" in
2024         foox) trnl='\012' ;;
2025         esac
2026 fi
2027 if test X"$trnl" = X; then
2028        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2029        fooxy) trnl='\n\r' ;;
2030        esac
2031 fi
2032 if test X"$trnl" = X; then
2033         cat <<EOM >&2
2034
2035 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2036
2037 EOM
2038         exit 1
2039 fi
2040
2041 : compute the number of columns on the terminal for proper question formatting
2042 case "$COLUMNS" in
2043 '') COLUMNS='80';;
2044 esac
2045
2046 : set up the echo used in my read
2047 myecho="case \"\$xxxm\" in
2048 '') echo $n \"\$rp $c\" >&4;;
2049 *) case \"\$rp\" in
2050         '') echo $n \"[\$xxxm] $c\";;
2051         *)
2052                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2053                         echo \"\$rp\" >&4
2054                         echo $n \"[\$xxxm] $c\" >&4
2055                 else
2056                         echo $n \"\$rp [\$xxxm] $c\" >&4
2057                 fi
2058                 ;;
2059         esac;;
2060 esac"
2061
2062 : now set up to do reads with possible shell escape and default assignment
2063 cat <<EOSC >myread
2064 $startsh
2065 xxxm=\$dflt
2066 $myecho
2067 ans='!'
2068 case "\$fastread" in
2069 yes) case "\$dflt" in
2070         '') ;;
2071         *) ans='';
2072                 case "\$silent-\$rp" in
2073                 true-) ;;
2074                 *) echo " " >&4;;
2075                 esac;;
2076         esac;;
2077 *) case "\$silent" in
2078         true) case "\$rp" in
2079                 '') ans='';;
2080                 esac;;
2081         esac;;
2082 esac
2083 while expr "X\$ans" : "X!" >/dev/null; do
2084         read answ
2085         set x \$xxxm
2086         shift
2087         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2088         case  "\$answ" in
2089         "!")
2090                 sh 1>&4
2091                 echo " "
2092                 $myecho
2093                 ;;
2094         !*)
2095                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2096                 shift
2097                 sh 1>&4 -c "\$*"
2098                 echo " "
2099                 $myecho
2100                 ;;
2101         "\$ans")
2102                 case "\$ans" in
2103                 \\&*)
2104                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2105                         shift
2106                         case "\$1" in
2107                         -d)
2108                                 fastread=yes
2109                                 echo "(OK, I'll run with -d after this question.)" >&4
2110                                 ;;
2111                         -*)
2112                                 echo "*** Sorry, \$1 not supported yet." >&4
2113                                 ;;
2114                         esac
2115                         $myecho
2116                         ans=!
2117                         ;;
2118                 esac;;
2119         *)
2120                 case "\$aok" in
2121                 y)
2122                         echo "*** Substitution done -- please confirm."
2123                         xxxm="\$ans"
2124                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2125                         xxxm="\$ans"
2126                         ans=!
2127                         ;;
2128                 *)
2129                         echo "*** Error -- try again."
2130                         ans=!
2131                         ;;
2132                 esac
2133                 $myecho
2134                 ;;
2135         esac
2136         case "\$ans\$xxxm\$nostick" in
2137         '')
2138                 ans=!
2139                 $myecho
2140                 ;;
2141         esac
2142 done
2143 case "\$ans" in
2144 '') ans="\$xxxm";;
2145 esac
2146 EOSC
2147
2148 : create .config dir to save info across Configure sessions
2149 test -d ../.config || mkdir ../.config
2150 cat >../.config/README <<EOF
2151 This directory created by Configure to save information that should
2152 persist across sessions for $package.
2153
2154 You may safely delete it if you wish.
2155 EOF
2156
2157 : See if we are using a devel version and want that
2158 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2159 case "$usedevel" in
2160 $define|true|[yY]*)
2161     usedevel="$define" ;;
2162 *) case "$xversion" in
2163    *[13579])
2164         cat >&4 <<EOH
2165 *** WHOA THERE!!! ***
2166
2167     This is an UNSTABLE DEVELOPMENT release.
2168     The version of this $package distribution is $xversion, that is, odd,
2169     (as opposed to even) and that signifies a development release.
2170     If you want a maintenance release, you want an even-numbered version.
2171
2172     Do ***NOT*** install this into production use.
2173     Data corruption and crashes are possible.
2174
2175     It is most seriously suggested that you do not continue any further
2176     unless you want to help in developing and debugging Perl.
2177
2178     If you *still* want to build perl, you can answer 'y' now,
2179     or pass -Dusedevel to Configure.
2180
2181 EOH
2182         rp='Do you really want to continue?'
2183         dflt='n'
2184         . ./myread
2185         case "$ans" in
2186         [yY]) echo >&4 "Okay, continuing."
2187               usedevel="$define" ;;
2188         *) echo >&4 "Okay, bye."
2189            exit 1
2190            ;;
2191         esac
2192         ;;
2193     esac
2194     usedevel="$undef"
2195     ;;
2196 esac
2197 case "$usedevel" in
2198 $define|true|[yY]*)
2199         case "$versiononly" in
2200         '') versiononly="$define" ;;
2201         esac
2202         case "$installusrbinperl" in
2203         '') installusrbinperl="$undef" ;;
2204         esac
2205         ;;
2206 esac
2207
2208 : general instructions
2209 needman=true
2210 firsttime=true
2211 user=`(logname) 2>/dev/null`
2212 case "$user" in
2213 '') user=`whoami 2>&1`;;
2214 esac
2215 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2216         firsttime=false
2217         echo " "
2218         rp='Would you like to see the instructions?'
2219         dflt=n
2220         . ./myread
2221         case "$ans" in
2222         [yY]*) ;;
2223         *) needman=false;;
2224         esac
2225 fi
2226 if $needman; then
2227         cat <<EOH
2228
2229 This installation shell script will examine your system and ask you questions
2230 to determine how the perl5 package should be installed. If you get
2231 stuck on a question, you may use a ! shell escape to start a subshell or
2232 execute a command.  Many of the questions will have default answers in square
2233 brackets; typing carriage return will give you the default.
2234
2235 On some of the questions which ask for file or directory names you are allowed
2236 to use the ~name construct to specify the login directory belonging to "name",
2237 even if you don't have a shell which knows about that.  Questions where this is
2238 allowed will be marked "(~name ok)".
2239
2240 EOH
2241         rp=''
2242         dflt='Type carriage return to continue'
2243         . ./myread
2244         cat <<'EOH'
2245
2246 The prompter used in this script allows you to use shell variables and
2247 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2248 in the default answer, as if the default line was a set of arguments given to a
2249 script shell.  This means you may also use $* to repeat the whole default line,
2250 so you do not have to re-type everything to add something to the default.
2251
2252 Everytime there is a substitution, you will have to confirm.  If there is an
2253 error (e.g. an unmatched backtick), the default answer will remain unchanged
2254 and you will be prompted again.
2255
2256 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2257 the questions and use the computed defaults (or the previous answers if there
2258 was already a config.sh file). Type 'Configure -h' for a list of options.
2259 You may also start interactively and then answer '& -d' at any prompt to turn
2260 on the non-interactive behaviour for the remainder of the execution.
2261
2262 EOH
2263         . ./myread
2264         cat <<EOH
2265
2266 Much effort has been expended to ensure that this shell script will run on any
2267 Unix system.  If despite that it blows up on yours, your best bet is to edit
2268 Configure and run it again.  If you can't run Configure for some reason,
2269 you'll have to generate a config.sh file by hand.  Whatever problems you
2270 have, let me (perlbug@perl.org) know how I blew it.
2271
2272 This installation script affects things in two ways:
2273
2274 1) it may do direct variable substitutions on some of the files included
2275    in this kit.
2276 2) it builds a config.h file for inclusion in C programs.  You may edit
2277    any of these files as the need arises after running this script.
2278
2279 If you make a mistake on a question, there is no easy way to back up to it
2280 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2281 files.  Configure will offer to let you do this before it runs the SH files.
2282
2283 EOH
2284         dflt='Type carriage return to continue'
2285         . ./myread
2286         case "$firsttime" in
2287         true) echo $user >>../.config/instruct;;
2288         esac
2289 fi
2290
2291 : find out where common programs are
2292 echo " "
2293 echo "Locating common programs..." >&4
2294 cat <<EOSC >loc
2295 $startsh
2296 case \$# in
2297 0) exit 1;;
2298 esac
2299 thing=\$1
2300 shift
2301 dflt=\$1
2302 shift
2303 for dir in \$*; do
2304         case "\$thing" in
2305         .)
2306         if test -d \$dir/\$thing; then
2307                 echo \$dir
2308                 exit 0
2309         fi
2310         ;;
2311         *)
2312         for thisthing in \$dir/\$thing; do
2313                 : just loop through to pick last item
2314         done
2315         if test -f \$thisthing; then
2316                 echo \$thisthing
2317                 exit 0
2318         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2319                 echo \$thisthing
2320                 exit 0
2321         elif test -f \$dir/\$thing.exe; then
2322                 if test -n "$DJGPP"; then
2323                         echo \$dir/\$thing.exe
2324                 elif test "$eunicefix" != ":"; then
2325                         : on Eunice apparently
2326                         echo \$dir/\$thing
2327                 fi
2328                 exit 0
2329         fi
2330         ;;
2331         esac
2332 done
2333 echo \$dflt
2334 exit 1
2335 EOSC
2336 chmod +x loc
2337 $eunicefix loc
2338 loclist="
2339 awk
2340 cat
2341 chmod
2342 comm
2343 cp
2344 echo
2345 expr
2346 grep
2347 ls
2348 mkdir
2349 rm
2350 sed
2351 sort
2352 touch
2353 tr
2354 uniq
2355 "
2356 trylist="
2357 ar
2358 bison
2359 byacc
2360 cpp
2361 csh
2362 date
2363 egrep
2364 gmake
2365 gzip
2366 less
2367 ln
2368 make
2369 more
2370 nm
2371 nroff
2372 pg
2373 test
2374 uname
2375 zip
2376 "
2377 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2378 pth="$pth /lib /usr/lib"
2379 for file in $loclist; do
2380         eval xxx=\$$file
2381         case "$xxx" in
2382         /*|?:[\\/]*)
2383                 if test -f "$xxx"; then
2384                         : ok
2385                 else
2386                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2387                         xxx=`./loc $file $file $pth`
2388                 fi
2389                 ;;
2390         '') xxx=`./loc $file $file $pth`;;
2391         *) xxx=`./loc $xxx $xxx $pth`;;
2392         esac
2393         eval $file=$xxx$_exe
2394         eval _$file=$xxx
2395         case "$xxx" in
2396         /*)
2397                 echo $file is in $xxx.
2398                 ;;
2399         ?:[\\/]*)
2400                 echo $file is in $xxx.
2401                 ;;
2402         *)
2403                 echo "I don't know where '$file' is, and my life depends on it." >&4
2404                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2405                 exit 1
2406                 ;;
2407         esac
2408 done
2409 echo " "
2410 echo "Don't worry if any of the following aren't found..."
2411 say=offhand
2412 for file in $trylist; do
2413         eval xxx=\$$file
2414         case "$xxx" in
2415         /*|?:[\\/]*)
2416                 if test -f "$xxx"; then
2417                         : ok
2418                 else
2419                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2420                         xxx=`./loc $file $file $pth`
2421                 fi
2422                 ;;
2423         '') xxx=`./loc $file $file $pth`;;
2424         *) xxx=`./loc $xxx $xxx $pth`;;
2425         esac
2426         eval $file=$xxx$_exe
2427         eval _$file=$xxx
2428         case "$xxx" in
2429         /*)
2430                 echo $file is in $xxx.
2431                 ;;
2432         ?:[\\/]*)
2433                 echo $file is in $xxx.
2434                 ;;
2435         *)
2436                 echo "I don't see $file out there, $say."
2437                 say=either
2438                 ;;
2439         esac
2440 done
2441 case "$egrep" in
2442 egrep)
2443         echo "Substituting grep for egrep."
2444         egrep=$grep
2445         _egrep=$grep
2446         ;;
2447 esac
2448 case "$less" in
2449 '')     ;;
2450 *)      if $less -R </dev/null >/dev/null; then
2451                echo "Substituting less -R for less."
2452                less="$less -R"
2453                _less=$less
2454         fi
2455         ;;
2456 esac
2457 case "$ln" in
2458 ln)
2459         echo "Substituting cp for ln."
2460         ln=$cp
2461         _ln=$cp
2462         ;;
2463 esac
2464 case "$make" in
2465 make)
2466         case "$gmake" in
2467         gmake)
2468         echo "I can't find make or gmake, and my life depends on it." >&4
2469         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2470         exit 1
2471         ;;
2472         esac
2473         ;;
2474 esac
2475 case "$gmake" in
2476 gmake)  ;;
2477 *)      # We can't have osname yet.
2478         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2479                 # Assume that gmake, if found, is definitely GNU make
2480                 # and prefer it over the system make.
2481                 echo "Substituting gmake for make."
2482                 make=$gmake
2483                 _make=$gmake
2484         fi
2485         ;;
2486 esac
2487 case "$test" in
2488 test)
2489         echo "Hopefully test is built into your sh."
2490         ;;
2491 *)
2492         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2493                 echo "Using the test built into your sh."
2494                 test=test
2495                 _test=test
2496         fi
2497         ;;
2498 esac
2499 case "$echo" in
2500 echo)
2501         echo "Hopefully echo is built into your sh."
2502         ;;
2503 '') ;;
2504 *)
2505         echo " "
2506 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2507         $echo $n "hi there$c" >foo1
2508         echo $n "hi there$c" >foo2
2509         if cmp foo1 foo2 >/dev/null 2>&1; then
2510                 echo "They are compatible.  In fact, they may be identical."
2511         else
2512                 case "$n" in
2513                 '-n') n='' c='\c';;
2514                 *) n='-n' c='';;
2515                 esac
2516                 cat <<FOO
2517 They are not compatible!  You are probably running ksh on a non-USG system.
2518 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2519 have echo built in and we may have to run some Bourne shell scripts.  That
2520 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2521
2522 FOO
2523                 $echo $n "The star should be here-->$c"
2524                 $echo "*"
2525         fi
2526         $rm -f foo1 foo2
2527         ;;
2528 esac
2529
2530 # This question was auctioned at YAPC::Europe-2007 in Vienna
2531 # I never promised you could answer it. I only auctioned the question.
2532 cat <<FOO
2533 The following message is sponsored by
2534
2535   Dresden.pm<--The stars should be here.
2536
2537 Dear Perl user, system administrator or package
2538 maintainer, the Perl community sends greetings to
2539 you. Do you (emblematical) greet back [Y/n]? n
2540
2541 FOO
2542
2543 : Check what type of C compiler we use
2544 cat <<EOS >trygcc
2545 $startsh
2546 EOS
2547 cat <<'EOSC' >>trygcc
2548 case "$cc" in
2549 '') ;;
2550 *)  $rm -f try try.*
2551     $cat >try.c <<EOM
2552 int main(int argc, char *argv[]) {
2553   return 0;
2554 }
2555 EOM
2556     if $cc -o try $ccflags $ldflags try.c; then
2557        :
2558     else
2559         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2560         despair=yes
2561         trygcc=yes
2562         case "$cc" in
2563         *gcc*) trygcc=no ;;
2564         esac
2565         # Skip this test because it gives a false match on output like:
2566         #    ./trygcc: line 23: cc: command not found
2567         # case "`$cc -v -c try.c 2>&1`" in
2568         # *gcc*) trygcc=no ;;
2569         # esac
2570         if $test X"$trygcc" = Xyes; then
2571             if gcc -o try -c try.c; then
2572                 echo " "
2573                 echo "You seem to have a working gcc, though." >&4
2574                 # Switching compilers may undo the work of hints files.
2575                 # The most common problem is -D_REENTRANT for threads.
2576                 # This heuristic catches that case, but gets false positives
2577                 # if -Dusethreads was not actually specified.  Better to
2578                 # bail out here with a useful message than fail 
2579                 # mysteriously later. Should we perhaps just try to
2580                 # re-invoke Configure -Dcc=gcc config_args ?
2581                 if $test -f usethreads.cbu; then
2582                         $cat >&4 <<EOM 
2583
2584 *** However, any setting of the C compiler flags (e.g. for thread support)
2585 *** will be lost.  It may be necessary for you to restart Configure and
2586 *** add -Dcc=gcc to your Configure command line.
2587
2588 EOM
2589                         rp="Would you like to go ahead and try gcc anyway?"
2590                         dflt=n
2591                 else
2592                         rp="Would you like to use it?"
2593                         dflt=y
2594                 fi
2595                 if $test -f myread; then
2596                     . ./myread
2597                 else
2598                     if $test -f UU/myread; then
2599                         . ./UU/myread
2600                     else
2601                         echo "Cannot find myread, sorry.  Aborting." >&2
2602                         exit 1
2603                     fi
2604                 fi  
2605                 case "$ans" in
2606                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2607                 esac
2608             fi
2609         fi
2610     fi
2611     $rm -f try try.*
2612     ;;
2613 esac
2614 EOSC
2615
2616 cat <<EOS >checkcc
2617 $startsh
2618 EOS
2619 cat <<'EOSC' >>checkcc
2620 case "$cc" in        
2621 '') ;;
2622 *)  $rm -f try try.*              
2623     $cat >try.c <<EOM
2624 int main(int argc, char *argv[]) {
2625   return 0;
2626 }
2627 EOM
2628     if $cc -o try $ccflags $ldflags try.c; then
2629        :
2630     else
2631         if $test X"$despair" = Xyes; then
2632            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2633         fi
2634         $cat >&4 <<EOM         
2635 You need to find a working C compiler.
2636 Either (purchase and) install the C compiler supplied by your OS vendor,
2637 or for a free C compiler try http://gcc.gnu.org/
2638 I cannot continue any further, aborting.
2639 EOM
2640         exit 1
2641     fi
2642     $rm -f try try.*
2643     ;;
2644 esac
2645 EOSC
2646
2647 : determine whether symbolic links are supported
2648 echo " "
2649 $touch blurfl
2650 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2651         echo "Symbolic links are supported." >&4
2652         lns="$ln -s"
2653 else
2654         echo "Symbolic links are NOT supported." >&4
2655         lns="$ln"
2656 fi
2657 $rm -f blurfl sym
2658
2659 : determine whether symbolic links are supported
2660 echo " "
2661 case "$lns" in
2662 *"ln"*" -s")
2663         echo "Checking how to test for symbolic links..." >&4
2664         $lns blurfl sym
2665         if $test "X$issymlink" = X; then
2666                 case "$newsh" in
2667                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2668                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2669                 esac
2670                 if test $? = 0; then
2671                         issymlink="test -h"
2672                 else
2673                         echo "Your builtin 'test -h' may be broken." >&4
2674                         case "$test" in
2675                         /*)     ;;
2676                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2677                                 for p in $pth
2678                                 do
2679                                         if test -f "$p/$test"; then
2680                                                 test="$p/$test"
2681                                                 break
2682                                         fi
2683                                 done
2684                                 ;;
2685                         esac
2686                         case "$test" in
2687                         /*)
2688                                 echo "Trying external '$test -h'." >&4
2689                                 issymlink="$test -h"
2690                                 if $test ! -h sym >/dev/null 2>&1; then
2691                                         echo "External '$test -h' is broken, too." >&4
2692                                         issymlink=''
2693                                 fi
2694                                 ;;
2695                         *)      issymlink='' ;;
2696                         esac
2697                 fi              
2698         fi
2699         if $test "X$issymlink" = X; then
2700                 if $test -L sym 2>/dev/null; then
2701                         issymlink="$test -L"
2702                         echo "The builtin '$test -L' worked." >&4
2703                 fi
2704         fi
2705         if $test "X$issymlink" != X; then
2706                 echo "You can test for symbolic links with '$issymlink'." >&4
2707         else
2708                 echo "I do not know how you can test for symbolic links." >&4
2709         fi
2710         $rm -f blurfl sym
2711         ;;
2712 *)      echo "No symbolic links, so not testing for their testing..." >&4
2713         ;;
2714 esac
2715 echo " "
2716
2717 : Make symlinks util
2718 case "$mksymlinks" in
2719 $define|true|[yY]*)
2720         case "$src" in
2721         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2722                 exit 1
2723                 ;;
2724         *)      case "$lns:$issymlink" in
2725                 *"ln"*" -s:"*"test -"?)
2726                         echo "Creating the symbolic links..." >&4
2727                         echo "(First creating the subdirectories...)" >&4
2728                         cd ..
2729                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2730                                 read directory
2731                                 test -z "$directory" && break
2732                                 mkdir -p $directory
2733                         done
2734                         # Sanity check 1.
2735                         if test ! -d t/base; then
2736                                 echo "Failed to create the subdirectories.  Aborting." >&4
2737                                 exit 1
2738                         fi
2739                         echo "(Then creating the symlinks...)" >&4
2740                         awk '{print $1}' $src/MANIFEST | while true; do
2741                                 read filename
2742                                 test -z "$filename" && break
2743                                 if test -f $filename; then
2744                                         if $issymlink $filename; then
2745                                                 rm -f $filename
2746                                         fi
2747                                 fi
2748                                 if test -f $filename; then
2749                                         echo "$filename already exists, not symlinking."
2750                                 else
2751                                         ln -s $src/$filename $filename
2752                                 fi
2753                         done
2754                         # Sanity check 2.
2755                         if test ! -f t/base/lex.t; then
2756                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2757                                 exit 1
2758                         fi
2759                         cd UU
2760                         ;;
2761                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2762                         ;;
2763                 esac
2764                 ;;
2765         esac
2766         ;;
2767 esac
2768
2769 : Check for Cross-Compilation
2770 case "$usecrosscompile" in
2771 $define|true|[yY]*)
2772         $echo "Cross-compiling..."
2773         croak=''
2774         case "$cc" in
2775         *-*-gcc) # A cross-compiling gcc, probably.
2776             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2777             ar=$targetarch-ar
2778             # leave out ld, choosing it is more complex
2779             nm=$targetarch-nm
2780             ranlib=$targetarch-ranlib
2781             $echo 'extern int foo;' > try.c
2782             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2783             shift
2784             if $test $# -gt 0; then
2785                 incpth="$incpth $*"
2786                 incpth="`$echo $incpth|$sed 's/^ //'`"
2787                 echo "Guessing incpth '$incpth'." >&4
2788                 for i in $*; do
2789                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2790                     if $test -d $j; then
2791                         libpth="$libpth $j"
2792                     fi
2793                 done   
2794                 libpth="`$echo $libpth|$sed 's/^ //'`"
2795                 echo "Guessing libpth '$libpth'." >&4
2796             fi
2797             $rm -f try.c
2798             ;;
2799         esac
2800         case "$targetarch" in
2801         '') echo "Targetarch not defined." >&4; croak=y ;;
2802         *)  echo "Using targetarch $targetarch." >&4 ;;
2803         esac
2804         case "$incpth" in
2805         '') echo "Incpth not defined." >&4; croak=y ;;
2806         *)  echo "Using incpth '$incpth'." >&4 ;;
2807         esac
2808         case "$libpth" in
2809         '') echo "Libpth not defined." >&4; croak=y ;;
2810         *)  echo "Using libpth '$libpth'." >&4 ;;
2811         esac
2812         case "$usrinc" in
2813         '') for i in $incpth; do
2814                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2815                     usrinc=$i
2816                     echo "Guessing usrinc $usrinc." >&4
2817                     break
2818                 fi
2819             done
2820             case "$usrinc" in
2821             '') echo "Usrinc not defined." >&4; croak=y ;;
2822             esac
2823             ;;
2824         *)  echo "Using usrinc $usrinc." >&4 ;;
2825         esac
2826         case "$targethost" in
2827         '') echo "Targethost not defined." >&4; croak=y ;;
2828         *)  echo "Using targethost $targethost." >&4
2829         esac
2830         locincpth=' '
2831         loclibpth=' '
2832         case "$croak" in
2833         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2834         esac
2835         case "$src" in
2836         /*) run=$src/Cross/run
2837             targetmkdir=$src/Cross/mkdir
2838             to=$src/Cross/to
2839             from=$src/Cross/from
2840             ;;
2841         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2842             run=$pwd/Cross/run
2843             targetmkdir=$pwd/Cross/mkdir
2844             to=$pwd/Cross/to
2845             from=$pwd/Cross/from
2846             ;;
2847         esac
2848         case "$targetrun" in
2849         '') targetrun=ssh ;;
2850         esac
2851         case "$targetto" in
2852         '') targetto=scp ;;
2853         esac
2854         case "$targetfrom" in
2855         '') targetfrom=scp ;;
2856         esac
2857         run=$run-$targetrun
2858         to=$to-$targetto
2859         from=$from-$targetfrom
2860         case "$targetdir" in
2861         '')  targetdir=/tmp
2862              echo "Guessing targetdir $targetdir." >&4
2863              ;;
2864         esac
2865         case "$targetuser" in
2866         '')  targetuser=root
2867              echo "Guessing targetuser $targetuser." >&4
2868              ;;
2869         esac
2870         case "$targetfrom" in
2871         scp)    q=-q ;;
2872         *)      q='' ;;
2873         esac
2874         case "$targetrun" in
2875         ssh|rsh)
2876             cat >$run <<EOF
2877 #!/bin/sh
2878 case "\$1" in
2879 -cwd)
2880   shift
2881   cwd=\$1
2882   shift
2883   ;;
2884 esac
2885 case "\$cwd" in
2886 '') cwd=$targetdir ;;
2887 esac
2888 exe=\$1
2889 shift
2890 if $test ! -f \$exe.xok; then
2891   $to \$exe
2892   $touch \$exe.xok
2893 fi
2894 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2895 EOF
2896             ;;
2897         *)  echo "Unknown targetrun '$targetrun'" >&4
2898             exit 1
2899             ;;
2900         esac
2901         case "$targetmkdir" in
2902         */Cross/mkdir)
2903             cat >$targetmkdir <<EOF
2904 #!/bin/sh
2905 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2906 EOF
2907             $chmod a+rx $targetmkdir
2908             ;;
2909         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2910             exit 1
2911             ;;
2912         esac
2913         case "$targetto" in
2914         scp|rcp)
2915             cat >$to <<EOF
2916 #!/bin/sh
2917 for f in \$@
2918 do
2919   case "\$f" in
2920   /*)
2921     $targetmkdir \`dirname \$f\`
2922     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2923     ;;
2924   *)
2925     $targetmkdir $targetdir/\`dirname \$f\`
2926     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2927     ;;
2928   esac
2929 done
2930 exit 0
2931 EOF
2932             ;;
2933         cp) cat >$to <<EOF
2934 #!/bin/sh
2935 for f in \$@
2936 do
2937   case "\$f" in
2938   /*)
2939     $mkdir -p $targetdir/\`dirname \$f\`
2940     $cp \$f $targetdir/\$f || exit 1
2941     ;;
2942   *)
2943     $targetmkdir $targetdir/\`dirname \$f\`
2944     $cp \$f $targetdir/\$f || exit 1
2945     ;;
2946   esac
2947 done
2948 exit 0
2949 EOF
2950             ;;
2951         *)  echo "Unknown targetto '$targetto'" >&4
2952             exit 1
2953             ;;
2954         esac
2955         case "$targetfrom" in
2956         scp|rcp)
2957           cat >$from <<EOF
2958 #!/bin/sh
2959 for f in \$@
2960 do
2961   $rm -f \$f
2962   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2963 done
2964 exit 0
2965 EOF
2966             ;;
2967         cp) cat >$from <<EOF
2968 #!/bin/sh
2969 for f in \$@
2970 do
2971   $rm -f \$f
2972   cp $targetdir/\$f . || exit 1
2973 done
2974 exit 0
2975 EOF
2976             ;;
2977         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2978             exit 1
2979             ;;
2980         esac
2981         if $test ! -f $run; then
2982             echo "Target 'run' script '$run' not found." >&4
2983         else
2984             $chmod a+rx $run
2985         fi
2986         if $test ! -f $to; then
2987             echo "Target 'to' script '$to' not found." >&4
2988         else
2989             $chmod a+rx $to
2990         fi
2991         if $test ! -f $from; then
2992             echo "Target 'from' script '$from' not found." >&4
2993         else
2994             $chmod a+rx $from
2995         fi
2996         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2997             exit 1
2998         fi
2999         cat >&4 <<EOF
3000 Using '$run' for remote execution,
3001 and '$from' and '$to'
3002 for remote file transfer.
3003 EOF
3004         ;;
3005 *)      run=''
3006         to=:
3007         from=:
3008         usecrosscompile='undef'
3009         targetarch=''
3010         ;;
3011 esac
3012
3013 : see whether [:lower:] and [:upper:] are supported character classes
3014 echo " "
3015 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3016 ABYZ)
3017         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3018         up='[:upper:]'
3019         low='[:lower:]'
3020         ;;
3021 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3022         # (0xd9 and 0xe2), therefore that is a nice testing point.
3023         if test "X$up" = X -o "X$low" = X; then
3024             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3025             rs) up='[A-Z]'
3026                 low='[a-z]'
3027                 ;;
3028             esac
3029         fi
3030         if test "X$up" = X -o "X$low" = X; then
3031             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3032             rs) up='A-Z'
3033                 low='a-z'
3034                 ;;
3035             esac
3036         fi
3037         if test "X$up" = X -o "X$low" = X; then
3038             case "`echo RS | od -x 2>/dev/null`" in
3039             *D9E2*|*d9e2*)
3040                 echo "Hey, this might be EBCDIC." >&4
3041                 if test "X$up" = X -o "X$low" = X; then
3042                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3043                     rs) up='[A-IJ-RS-Z]'
3044                         low='[a-ij-rs-z]'
3045                         ;;
3046                     esac
3047                 fi
3048                 if test "X$up" = X -o "X$low" = X; then
3049                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3050                     rs) up='A-IJ-RS-Z'
3051                         low='a-ij-rs-z'
3052                         ;;
3053                     esac
3054                 fi
3055                 ;;
3056             esac
3057         fi
3058 esac
3059 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3060 rs)
3061     echo "Using $up and $low to convert case." >&4
3062     ;;
3063 *)
3064     echo "I don't know how to translate letters from upper to lower case." >&4
3065     echo "Your tr is not acting any way I know of." >&4
3066     exit 1
3067     ;;
3068 esac
3069 : set up the translation script tr, must be called with ./tr of course
3070 cat >tr <<EOSC
3071 $startsh
3072 case "\$1\$2" in
3073 '[A-Z][a-z]') exec $tr '$up' '$low';;
3074 '[a-z][A-Z]') exec $tr '$low' '$up';;
3075 esac
3076 exec $tr "\$@"
3077 EOSC
3078 chmod +x tr
3079 $eunicefix tr
3080
3081 : Try to determine whether config.sh was made on this system
3082 case "$config_sh" in
3083 '')
3084 myuname=`$uname -a 2>/dev/null`
3085 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3086 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3087 # because the A-Z/a-z are not consecutive.
3088 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3089         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3090 newmyuname="$myuname"
3091 dflt=n
3092 case "$knowitall" in
3093 '')
3094         if test -f ../config.sh; then
3095                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3096                         eval "`grep myuname= ../config.sh`"
3097                 fi
3098                 if test "X$myuname" = "X$newmyuname"; then
3099                         dflt=y
3100                 fi
3101         fi
3102         ;;
3103 *) dflt=y;;
3104 esac
3105
3106 : Get old answers from old config file if Configure was run on the
3107 : same system, otherwise use the hints.
3108 hint=default
3109 cd ..
3110 if test -f config.sh; then
3111         echo " "
3112         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3113         . UU/myread
3114         case "$ans" in
3115         n*|N*) echo "OK, I'll ignore it."
3116                 mv config.sh config.sh.old
3117                 myuname="$newmyuname"
3118                 ;;
3119         *)  echo "Fetching default answers from your old config.sh file..." >&4
3120                 tmp_n="$n"
3121                 tmp_c="$c"
3122                 tmp_sh="$sh"
3123                 . ./config.sh
3124                 cp config.sh UU
3125                 n="$tmp_n"
3126                 c="$tmp_c"
3127                 : Older versions did not always set $sh.  Catch re-use of such
3128                 : an old config.sh.
3129                 case "$sh" in
3130                 '') sh="$tmp_sh" ;;
3131                 esac
3132                 hint=previous
3133                 ;;
3134         esac
3135 fi
3136 . ./UU/checkcc
3137 if test ! -f config.sh; then
3138         $cat <<EOM
3139
3140 First time through, eh?  I have some defaults handy for some systems
3141 that need some extra help getting the Configure answers right:
3142
3143 EOM
3144         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3145         dflt=''
3146         : Half the following guesses are probably wrong... If you have better
3147         : tests or hints, please send them to perlbug@perl.org
3148         : The metaconfig authors would also appreciate a copy...
3149         $test -f /irix && osname=irix
3150         $test -f /xenix && osname=sco_xenix
3151         $test -f /dynix && osname=dynix
3152         $test -f /dnix && osname=dnix
3153         $test -f /lynx.os && osname=lynxos
3154         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3155         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3156         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3157         $test -f /bin/mips && /bin/mips && osname=mips
3158         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3159                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3160         $test -d /usr/apollo/bin && osname=apollo
3161         $test -f /etc/saf/_sactab && osname=svr4
3162         $test -d /usr/include/minix && osname=minix
3163         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3164         if $test -d /MachTen -o -d /MachTen_Folder; then
3165                 osname=machten
3166                 if $test -x /sbin/version; then
3167                         osvers=`/sbin/version | $awk '{print $2}' |
3168                         $sed -e 's/[A-Za-z]$//'`
3169                 elif $test -x /usr/etc/version; then
3170                         osvers=`/usr/etc/version | $awk '{print $2}' |
3171                         $sed -e 's/[A-Za-z]$//'`
3172                 else
3173                         osvers="$2.$3"
3174                 fi
3175         fi
3176
3177         $test -f /sys/posix.dll &&
3178                 $test -f /usr/bin/what &&
3179                 set X `/usr/bin/what /sys/posix.dll` &&
3180                 $test "$3" = UWIN &&
3181                 osname=uwin &&
3182                 osvers="$5"
3183
3184         if $test -f $uname; then
3185                 set X $myuname
3186                 shift
3187
3188                 case "$5" in
3189                 fps*) osname=fps ;;
3190                 mips*)
3191                         case "$4" in
3192                         umips) osname=umips ;;
3193                         *) osname=mips ;;
3194                         esac;;
3195                 [23]100) osname=mips ;;
3196                 next*) osname=next ;;
3197                 i386*)
3198                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3199                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3200                                 osname='sco'
3201                                 osvers=$tmp
3202                         elif $test -f /etc/kconfig; then
3203                                 osname=isc
3204                                 if test "$lns" = "$ln -s"; then
3205                                         osvers=4
3206                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3207                                         osvers=3
3208                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3209                                         osvers=2
3210                                 fi
3211                         fi
3212                         tmp=''
3213                         ;;
3214                 pc*)
3215                         if test -n "$DJGPP"; then
3216                                 osname=dos
3217                                 osvers=djgpp
3218                         fi
3219                         ;;
3220                 esac
3221
3222                 case "$1" in
3223                 aix) osname=aix
3224                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3225                         case "$tmp" in
3226                         # oslevel can fail with:
3227                         # oslevel: Unable to acquire lock.
3228                         *not\ found) osvers="$4"."$3" ;;
3229                         '<3240'|'<>3240') osvers=3.2.0 ;;
3230                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3231                         '=3250'|'>3250') osvers=3.2.5 ;;
3232                         *) osvers=$tmp;;
3233                         esac
3234                         ;;
3235                 bsd386) osname=bsd386
3236                         osvers=`$uname -r`
3237                         ;;
3238                 cygwin*) osname=cygwin
3239                         osvers="$3"
3240                         ;;
3241                 *dc.osx) osname=dcosx
3242                         osvers="$3"
3243                         ;;
3244                 dnix) osname=dnix
3245                         osvers="$3"
3246                         ;;
3247                 domainos) osname=apollo
3248                         osvers="$3"
3249                         ;;
3250                 dgux)   osname=dgux
3251                         osvers="$3"
3252                         ;;
3253                 dragonfly) osname=dragonfly
3254                         osvers="$3"
3255                         ;;
3256                 dynixptx*) osname=dynixptx
3257                         osvers=`echo "$4"|sed 's/^v//'`
3258                         ;;
3259                 freebsd) osname=freebsd
3260                         osvers="$3" ;;
3261                 genix)  osname=genix ;;
3262                 gnu)    osname=gnu
3263                         osvers="$3" ;;
3264                 hp*)    osname=hpux
3265                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3266                         ;;
3267                 irix*)  osname=irix
3268                         case "$3" in
3269                         4*) osvers=4 ;;
3270                         5*) osvers=5 ;;
3271                         *)      osvers="$3" ;;
3272                         esac
3273                         ;;
3274                 linux)  osname=linux
3275                         case "$3" in
3276                         *)      osvers="$3" ;;
3277                         esac
3278                         ;;
3279                 MiNT)   osname=mint
3280                         ;;
3281                 netbsd*) osname=netbsd
3282                         osvers="$3"
3283                         ;;
3284                 news-os) osvers="$3"
3285                         case "$3" in
3286                         4*) osname=newsos4 ;;
3287                         *) osname=newsos ;;
3288                         esac
3289                         ;;
3290                 next*) osname=next ;;
3291                 nonstop-ux) osname=nonstopux ;;
3292                 openbsd) osname=openbsd
3293                         osvers="$3"
3294                         ;;
3295                 os2)    osname=os2
3296                         osvers="$4"
3297                         ;;
3298                 POSIX-BC | posix-bc ) osname=posix-bc
3299                         osvers="$3"
3300                         ;;
3301                 powerux | power_ux | powermax_os | powermaxos | \
3302                 powerunix | power_unix) osname=powerux
3303                         osvers="$3"
3304                         ;;
3305                 qnx) osname=qnx
3306                         osvers="$4"
3307                         ;;
3308                 solaris) osname=solaris
3309                         case "$3" in
3310                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3311                         *)      osvers="$3" ;;
3312                         esac
3313                         ;;
3314                 sunos) osname=sunos
3315                         case "$3" in
3316                         5*) osname=solaris
3317                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3318                         *)      osvers="$3" ;;
3319                         esac
3320                         ;;
3321                 titanos) osname=titanos
3322                         case "$3" in
3323                         1*) osvers=1 ;;
3324                         2*) osvers=2 ;;
3325                         3*) osvers=3 ;;
3326                         4*) osvers=4 ;;
3327                         *)      osvers="$3" ;;
3328                         esac
3329                         ;;
3330                 ultrix) osname=ultrix
3331                         osvers="$3"
3332                         ;;
3333                 osf1|mls+)      case "$5" in
3334                                 alpha)
3335                                         osname=dec_osf
3336                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3337                                         case "$osvers" in
3338                                         [1-9].[0-9]*) ;;
3339                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3340                                         esac
3341                                         ;;
3342                         hp*)    osname=hp_osf1  ;;
3343                         mips)   osname=mips_osf1 ;;
3344                         esac
3345                         ;;
3346                 # UnixWare 7.1.2 is known as Open UNIX 8
3347                 openunix|unixware) osname=svr5
3348                         osvers="$4"
3349                         ;;
3350                 uts)    osname=uts
3351                         osvers="$3"
3352                         ;;
3353                 vos) osvers="$3"
3354                         ;;
3355                 $2) case "$osname" in
3356                         *isc*) ;;
3357                         *freebsd*) ;;
3358                         svr*)
3359                                 : svr4.x or possibly later
3360                                 case "svr$3" in
3361                                 ${osname}*)
3362                                         osname=svr$3
3363                                         osvers=$4
3364                                         ;;
3365                                 esac
3366                                 case "$osname" in
3367                                 svr4.0)
3368                                         : Check for ESIX
3369                                         if test -f /stand/boot ; then
3370                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3371                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3372                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3373                                                         if test -n "$isesix"; then
3374                                                                 osname=esix4
3375                                                         fi
3376                                                 fi
3377                                         fi
3378                                         ;;
3379                                 esac
3380                                 ;;
3381                         *)      if test -f /etc/systemid; then
3382                                         osname=sco
3383                                         set `echo $3 | $sed 's/\./ /g'` $4
3384                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3385                                                 osvers=$1.$2.$3
3386                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3387                                                 osvers=$1.$2
3388                                         elif $test -f $src/hints/sco_$1.sh; then
3389                                                 osvers=$1
3390                                         fi
3391                                 else
3392                                         case "$osname" in
3393                                         '') : Still unknown.  Probably a generic Sys V.
3394                                                 osname="sysv"
3395                                                 osvers="$3"
3396                                                 ;;
3397                                         esac
3398                                 fi
3399                                 ;;
3400                         esac
3401                         ;;
3402                 *)      case "$osname" in
3403                         '') : Still unknown.  Probably a generic BSD.
3404                                 osname="$1"
3405                                 osvers="$3"
3406                                 ;;
3407                         esac
3408                         ;;
3409                 esac
3410         else
3411                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3412                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3413                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3414                                 osname=news_os
3415                         fi
3416                         $rm -f UU/kernel.what
3417                 elif test -d c:/. -o -n "$is_os2" ; then
3418                         set X $myuname
3419                         osname=os2
3420                         osvers="$5"
3421                 fi
3422         fi
3423
3424         case "$targetarch" in
3425         '') ;;
3426         *)  hostarch=$osname
3427             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3428             osvers=''
3429             ;;
3430         esac
3431
3432         : Now look for a hint file osname_osvers, unless one has been
3433         : specified already.
3434         case "$hintfile" in
3435         ''|' ')
3436                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3437                 : Also try without trailing minor version numbers.
3438                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3439                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3440                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3441                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3442                 case "$file" in
3443                 '') dflt=none ;;
3444                 *)  case "$osvers" in
3445                         '') dflt=$file
3446                                 ;;
3447                         *)  if $test -f $src/hints/$file.sh ; then
3448                                         dflt=$file
3449                                 elif $test -f $src/hints/$xfile.sh ; then
3450                                         dflt=$xfile
3451                                 elif $test -f $src/hints/$xxfile.sh ; then
3452                                         dflt=$xxfile
3453                                 elif $test -f $src/hints/$xxxfile.sh ; then
3454                                         dflt=$xxxfile
3455                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3456                                         dflt=$xxxxfile
3457                                 elif $test -f "$src/hints/${osname}.sh" ; then
3458                                         dflt="${osname}"
3459                                 else
3460                                         dflt=none
3461                                 fi
3462                                 ;;
3463                         esac
3464                         ;;
3465                 esac
3466                 if $test -f Policy.sh ; then
3467                         case "$dflt" in
3468                         *Policy*) ;;
3469                         none) dflt="Policy" ;;
3470                         *) dflt="Policy $dflt" ;;
3471                         esac
3472                 fi
3473                 ;;
3474         *)
3475                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3476                 ;;
3477         esac
3478
3479         if $test -f Policy.sh ; then
3480                 $cat <<EOM
3481
3482 There's also a Policy hint file available, which should make the
3483 site-specific (policy) questions easier to answer.
3484 EOM
3485
3486         fi
3487
3488         $cat <<EOM
3489
3490 You may give one or more space-separated answers, or "none" if appropriate.
3491 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3492 previous run of Configure, you may specify it as well as or instead of
3493 OS-specific hints.  If hints are provided for your OS, you should use them:
3494 although Perl can probably be built without hints on many platforms, using
3495 hints often improve performance and may enable features that Configure can't
3496 set up on its own. If there are no hints that match your OS, specify "none";
3497 DO NOT give a wrong version or a wrong OS.
3498
3499 EOM
3500
3501         rp="Which of these apply, if any?"
3502         . UU/myread
3503         tans=$ans
3504         for file in $tans; do
3505                 if $test X$file = XPolicy -a -f Policy.sh; then
3506                         . Policy.sh
3507                         $cat Policy.sh >> UU/config.sh
3508                 elif $test -f $src/hints/$file.sh; then
3509                         . $src/hints/$file.sh
3510                         $cat $src/hints/$file.sh >> UU/config.sh
3511                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3512                         : nothing
3513                 else
3514                         : Give one chance to correct a possible typo.
3515                         echo "$file.sh does not exist"
3516                         dflt=$file
3517                         rp="hint to use instead?"
3518                         . UU/myread
3519                         for file in $ans; do
3520                                 if $test -f "$src/hints/$file.sh"; then
3521                                         . $src/hints/$file.sh
3522                                         $cat $src/hints/$file.sh >> UU/config.sh
3523                                 elif $test X$ans = X -o X$ans = Xnone ; then
3524                                         : nothing
3525                                 else
3526                                         echo "$file.sh does not exist -- ignored."
3527                                 fi
3528                         done
3529                 fi
3530         done
3531
3532         hint=recommended
3533         : Remember our hint file for later.
3534         if $test -f "$src/hints/$file.sh" ; then
3535                 hintfile="$file"
3536         else
3537                 hintfile=''
3538         fi
3539 fi
3540 cd UU
3541 ;;
3542 *)
3543         echo " "
3544         echo "Fetching default answers from $config_sh..." >&4
3545         tmp_n="$n"
3546         tmp_c="$c"
3547         cd ..
3548         cp $config_sh config.sh 2>/dev/null
3549         chmod +w config.sh
3550         . ./config.sh
3551         cd UU
3552         cp ../config.sh .
3553         n="$tmp_n"
3554         c="$tmp_c"
3555         hint=previous
3556         ;;
3557 esac
3558 test "$override" && . ./optdef.sh
3559
3560 : Restore computed paths
3561 for file in $loclist $trylist; do
3562         eval $file="\$_$file"
3563 done
3564
3565 cat << EOM
3566
3567 Configure uses the operating system name and version to set some defaults.
3568 The default value is probably right if the name rings a bell. Otherwise,
3569 since spelling matters for me, either accept the default or answer "none"
3570 to leave it blank.
3571
3572 EOM
3573 case "$osname" in
3574         ''|' ')
3575                 case "$hintfile" in
3576                 ''|' '|none) dflt=none ;;
3577                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3578                 esac
3579                 ;;
3580         *) dflt="$osname" ;;
3581 esac
3582 rp="Operating system name?"
3583 . ./myread
3584 case "$ans" in
3585 none)  osname='' ;;
3586 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3587 esac
3588 echo " "
3589 case "$osvers" in
3590         ''|' ')
3591                 case "$hintfile" in
3592                 ''|' '|none) dflt=none ;;
3593                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3594                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3595                         case "$dflt" in
3596                         ''|' ') dflt=none ;;
3597                         esac
3598                         ;;
3599                 esac
3600                 ;;
3601         *) dflt="$osvers" ;;
3602 esac
3603 rp="Operating system version?"
3604 . ./myread
3605 case "$ans" in
3606 none)  osvers='' ;;
3607 *) osvers="$ans" ;;
3608 esac
3609
3610
3611 . ./posthint.sh
3612
3613 : who configured the system
3614 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3615 case "$cf_by" in
3616 "")
3617         cf_by=`(logname) 2>/dev/null`
3618         case "$cf_by" in
3619         "")
3620                 cf_by=`(whoami) 2>/dev/null`
3621                 case "$cf_by" in
3622                 "") cf_by=unknown ;;
3623                 esac ;;
3624         esac ;;
3625 esac
3626
3627 : decide how portable to be.  Allow command line overrides.
3628 case "$d_portable" in
3629 "$undef") ;;
3630 *)      d_portable="$define" ;;
3631 esac
3632
3633 : set up shell script to do ~ expansion
3634 cat >filexp <<EOSS
3635 $startsh
3636 : expand filename
3637 case "\$1" in
3638  \~/*|\~)
3639         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3640         ;;
3641  \~*)
3642         if $test -f /bin/csh; then
3643                 /bin/csh -f -c "glob \$1"
3644                 failed=\$?
3645                 echo ""
3646                 exit \$failed
3647         else
3648                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3649                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3650                 if $test ! -d "\$dir"; then
3651                         me=\`basename \$0\`
3652                         echo "\$me: can't locate home directory for: \$name" >&2
3653                         exit 1
3654                 fi
3655                 case "\$1" in
3656                 */*)
3657                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3658                         ;;
3659                 *)
3660                         echo \$dir
3661                         ;;
3662                 esac
3663         fi
3664         ;;
3665 *)
3666         echo \$1
3667         ;;
3668 esac
3669 EOSS
3670 chmod +x filexp
3671 $eunicefix filexp
3672
3673 : now set up to get a file name
3674 cat <<EOS >getfile
3675 $startsh
3676 EOS
3677 cat <<'EOSC' >>getfile
3678 tilde=''
3679 fullpath=''
3680 already=''
3681 skip=''
3682 none_ok=''
3683 exp_file=''
3684 nopath_ok=''
3685 orig_rp="$rp"
3686 orig_dflt="$dflt"
3687 case "$gfpth" in
3688 '') gfpth='.' ;;
3689 esac
3690
3691 case "$fn" in
3692 *\(*)
3693         : getfile will accept an answer from the comma-separated list
3694         : enclosed in parentheses even if it does not meet other criteria.
3695         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3696         fn=`echo $fn | sed 's/(.*)//'`
3697         ;;
3698 esac
3699
3700 case "$fn" in
3701 *:*)
3702         loc_file=`expr $fn : '.*:\(.*\)'`
3703         fn=`expr $fn : '\(.*\):.*'`
3704         ;;
3705 esac
3706
3707 case "$fn" in
3708 *~*) tilde=true;;
3709 esac
3710 case "$fn" in
3711 */*) fullpath=true;;
3712 esac
3713 case "$fn" in
3714 *+*) skip=true;;
3715 esac
3716 case "$fn" in
3717 *n*) none_ok=true;;
3718 esac
3719 case "$fn" in
3720 *e*) exp_file=true;;
3721 esac
3722 case "$fn" in
3723 *p*) nopath_ok=true;;
3724 esac
3725
3726 case "$fn" in
3727 *f*) type='File';;
3728 *d*) type='Directory';;
3729 *l*) type='Locate';;
3730 esac
3731
3732 what="$type"
3733 case "$what" in
3734 Locate) what='File';;
3735 esac
3736
3737 case "$exp_file" in
3738 '')
3739         case "$d_portable" in
3740         "$define") ;;
3741         *) exp_file=true;;
3742         esac
3743         ;;
3744 esac
3745
3746 cd ..
3747 while test "$type"; do
3748         redo=''
3749         rp="$orig_rp"
3750         dflt="$orig_dflt"
3751         case "$tilde" in
3752         true) rp="$rp (~name ok)";;
3753         esac
3754         . UU/myread
3755         if test -f UU/getfile.ok && \
3756                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3757         then
3758                 value="$ans"
3759                 ansexp="$ans"
3760                 break
3761         fi
3762         case "$ans" in
3763         none)
3764                 value=''
3765                 ansexp=''
3766                 case "$none_ok" in
3767                 true) type='';;
3768                 esac
3769                 ;;
3770         *)
3771                 case "$tilde" in
3772                 '') value="$ans"
3773                         ansexp="$ans";;
3774                 *)
3775                         value=`UU/filexp $ans`
3776                         case $? in
3777                         0)
3778                                 if test "$ans" != "$value"; then
3779                                         echo "(That expands to $value on this system.)"
3780                                 fi
3781                                 ;;
3782                         *) value="$ans";;
3783                         esac
3784                         ansexp="$value"
3785                         case "$exp_file" in
3786                         '') value="$ans";;
3787                         esac
3788                         ;;
3789                 esac
3790                 case "$fullpath" in
3791                 true)
3792                         case "$ansexp" in
3793                         /*) value="$ansexp" ;;
3794                         [a-zA-Z]:/*) value="$ansexp" ;;
3795                         *)
3796                                 redo=true
3797                                 case "$already" in
3798                                 true)
3799                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3800                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3801                                         ;;
3802                                 *)
3803                                 echo "Please give a full path name, starting with slash." >&4
3804                                         case "$tilde" in
3805                                         true)
3806                                 echo "Note that using ~name is ok provided it expands well." >&4
3807                                                 already=true
3808                                                 ;;
3809                                         esac
3810                                 esac
3811                                 ;;
3812                         esac
3813                         ;;
3814                 esac
3815                 case "$redo" in
3816                 '')
3817                         case "$type" in
3818                         File)
3819                                 for fp in $gfpth; do
3820                                         if test "X$fp" = X.; then
3821                                             pf="$ansexp"
3822                                         else    
3823                                             pf="$fp/$ansexp"
3824                                         fi
3825                                         if test -f "$pf"; then
3826                                                 type=''
3827                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3828                                         then
3829                                                 echo "($value is not a plain file, but that's ok.)"
3830                                                 type=''
3831                                         fi
3832                                         if test X"$type" = X; then
3833                                             value="$pf"
3834                                             break
3835                                         fi
3836                                 done
3837                                 ;;
3838                         Directory)
3839                                 for fp in $gfpth; do
3840                                         if test "X$fp" = X.; then
3841                                             dir="$ans"
3842                                             direxp="$ansexp"
3843                                         else    
3844                                             dir="$fp/$ansexp"
3845                                             direxp="$fp/$ansexp"
3846                                         fi
3847                                         if test -d "$direxp"; then
3848                                                 type=''
3849                                                 value="$dir"
3850                                                 break
3851                                         fi
3852                                 done
3853                                 ;;
3854                         Locate)
3855                                 if test -d "$ansexp"; then
3856                                         echo "(Looking for $loc_file in directory $value.)"
3857                                         value="$value/$loc_file"
3858                                         ansexp="$ansexp/$loc_file"
3859                                 fi
3860                                 if test -f "$ansexp"; then
3861                                         type=''
3862                                 fi
3863                                 case "$nopath_ok" in
3864                                 true)   case "$value" in
3865                                         */*) ;;
3866                                         *)      echo "Assuming $value will be in people's path."
3867                                                 type=''
3868                                                 ;;
3869                                         esac
3870                                         ;;
3871                                 esac
3872                                 ;;
3873                         esac
3874
3875                         case "$skip" in
3876                         true) type='';
3877                         esac
3878
3879                         case "$type" in
3880                         '') ;;
3881                         *)
3882                                 if test "$fastread" = yes; then
3883                                         dflt=y
3884                                 else
3885                                         dflt=n
3886                                 fi
3887                                 rp="$what $value doesn't exist.  Use that name anyway?"
3888                                 . UU/myread
3889                                 dflt=''
3890                                 case "$ans" in
3891                                 y*) type='';;
3892                                 *) echo " ";;
3893                                 esac
3894                                 ;;
3895                         esac
3896                         ;;
3897                 esac
3898                 ;;
3899         esac
3900 done
3901 cd UU
3902 ans="$value"
3903 rp="$orig_rp"
3904 dflt="$orig_dflt"
3905 rm -f getfile.ok
3906 test "X$gfpthkeep" != Xy && gfpth=""
3907 EOSC
3908
3909 : determine root of directory hierarchy where package will be installed.
3910 case "$prefix" in
3911 '')
3912         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3913         ;;
3914 *?/)
3915         dflt=`echo "$prefix" | sed 's/.$//'`
3916         ;;
3917 *)
3918         dflt="$prefix"
3919         ;;
3920 esac
3921 $cat <<EOM
3922
3923 By default, $package will be installed in $dflt/bin, manual pages
3924 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3925 installation directories. Typically this is something like /usr/local.
3926 If you wish to have binaries under /usr/bin but other parts of the
3927 installation under /usr/local, that's ok: you will be prompted
3928 separately for each of the installation directories, the prefix being
3929 only used to set the defaults.
3930
3931 EOM
3932 fn=d~
3933 rp='Installation prefix to use?'
3934 . ./getfile
3935 oldprefix=''
3936 case "$prefix" in
3937 '') ;;
3938 *)
3939         case "$ans" in
3940         "$prefix") ;;
3941         *) oldprefix="$prefix";;
3942         esac
3943         ;;
3944 esac
3945 prefix="$ans"
3946 prefixexp="$ansexp"
3947
3948 : allow them to override the AFS root
3949 case "$afsroot" in
3950 '')     afsroot=/afs ;;
3951 *)      afsroot=$afsroot ;;
3952 esac
3953
3954 : is AFS running?
3955 echo " "
3956 case "$afs" in
3957 $define|true)   afs=true ;;
3958 $undef|false)   afs=false ;;
3959 *)      if $test -d $afsroot; then
3960                 afs=true
3961         else
3962                 afs=false
3963         fi
3964         ;;
3965 esac
3966 if $afs; then
3967         echo "AFS may be running... I'll be extra cautious then..." >&4
3968 else
3969         echo "AFS does not seem to be running..." >&4
3970 fi
3971
3972 : determine installation prefix for where package is to be installed.
3973 if $afs; then 
3974 $cat <<EOM
3975
3976 Since you are running AFS, I need to distinguish the directory in which
3977 files will reside from the directory in which they are installed (and from
3978 which they are presumably copied to the former directory by occult means).
3979
3980 EOM
3981         case "$installprefix" in
3982         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3983         *) dflt="$installprefix";;
3984         esac
3985 else
3986 $cat <<EOM
3987
3988 In some special cases, particularly when building $package for distribution,
3989 it is convenient to distinguish the directory in which files should be
3990 installed from the directory ($prefix) in which they will
3991 eventually reside.  For most users, these two directories are the same.
3992
3993 EOM
3994         case "$installprefix" in
3995         '') dflt=$prefix ;;
3996         *) dflt=$installprefix;;
3997         esac
3998 fi
3999 fn=d~
4000 rp='What installation prefix should I use for installing files?'
4001 . ./getfile
4002 installprefix="$ans"
4003 installprefixexp="$ansexp"
4004
4005 : Perform the prefixexp/installprefixexp correction if necessary
4006 cat <<EOS >installprefix
4007 $startsh
4008 EOS
4009 cat <<'EOSC' >>installprefix
4010 : Change installation prefix, if necessary.
4011 if $test X"$prefix" != X"$installprefix"; then
4012     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4013 else
4014     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4015 fi
4016 EOSC
4017 chmod +x installprefix
4018 $eunicefix installprefix
4019
4020 : Set variables such as privlib and privlibexp from the output of ./getfile
4021 : performing the prefixexp/installprefixexp correction if necessary.
4022 cat <<EOS >setprefixvar
4023 $startsh
4024 EOS
4025 cat <<'EOSC' >>setprefixvar
4026 eval "${prefixvar}=\"\$ans\""
4027 eval "${prefixvar}exp=\"\$ansexp\""
4028 . ./installprefix
4029 EOSC
4030 chmod +x setprefixvar
4031 $eunicefix setprefixvar
4032
4033 : set up the script used to warn in case of inconsistency
4034 cat <<EOS >whoa
4035 $startsh
4036 EOS
4037 cat <<'EOSC' >>whoa
4038 dflt=y
4039 case "$hint" in
4040     recommended)
4041         case "$hintfile" in
4042         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4043                 ;;
4044         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4045                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4046                 ;;
4047         esac
4048         ;;
4049     *)  echo " "
4050         echo "*** WHOA THERE!!! ***" >&4
4051         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4052         ;;
4053 esac
4054 rp="    Keep the $hint value?"
4055 . ./myread
4056 case "$ans" in
4057 y) td=$was; tu=$was;;
4058 esac
4059 EOSC
4060
4061 : function used to set '$1' to '$val'
4062 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4063 case "$val$was" in
4064 $define$undef) . ./whoa; eval "$var=\$td";;
4065 $undef$define) . ./whoa; eval "$var=\$tu";;
4066 *) eval "$var=$val";;
4067 esac'
4068
4069 : Check is we will use socks
4070 case "$usesocks" in
4071 $define|true|[yY]*)     dflt='y';;
4072 *) dflt='n';;
4073 esac
4074 cat <<EOM
4075
4076 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4077 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4078 to use the PerlIO abstraction layer, this will be implicitly selected.
4079
4080 If this doesn't make any sense to you, just accept the default '$dflt'.
4081 EOM
4082 rp='Build Perl for SOCKS?'
4083 . ./myread
4084 case "$ans" in
4085 y|Y)    val="$define" ;;
4086 *)      val="$undef" ;;
4087 esac
4088 set usesocks
4089 eval $setvar
4090
4091 case "$usesocks" in
4092 $define|true|[yY]*) useperlio="$define";;
4093 esac
4094
4095 : Check if we want perlio
4096 case "$useperlio" in
4097 $define|true|[yY]*|'')  dflt='y';;
4098 *) dflt='n';;
4099 esac
4100 cat <<EOM
4101
4102 Previous version of $package used the standard IO mechanisms as
4103 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4104 alternate IO mechanisms via the PerlIO abstraction layer, but the
4105 stdio mechanism is still available if needed.  The abstraction layer
4106 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4107 Using PerlIO with sfio may cause problems with some extension modules.
4108
4109 If this doesn't make any sense to you, just accept the default '$dflt'.
4110 EOM
4111 rp='Use the PerlIO abstraction layer?'
4112 . ./myread
4113 case "$ans" in
4114 y|Y)
4115         val="$define"
4116         ;;
4117 *)
4118         echo "Ok, doing things the stdio way."
4119         val="$undef"
4120         ;;
4121 esac
4122 set useperlio
4123 eval $setvar
4124
4125 case "$usesocks" in
4126 $define|true|[yY]*)
4127         case "$useperlio" in
4128         $define|true|[yY]*) ;;
4129         *)      cat >&4 <<EOM
4130
4131 You are using the SOCKS proxy protocol library which means that you
4132 should also use the PerlIO layer.  You may be headed for trouble.
4133
4134 EOM
4135                 ;;
4136         esac
4137         ;;
4138 esac
4139
4140 : get the patchlevel
4141 echo " "
4142 echo "Getting the current patchlevel..." >&4
4143 if $test -r $rsrc/patchlevel.h;then
4144         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4145         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4146         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4147         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4148         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4149         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4150         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4151 else
4152         revision=0
4153         patchlevel=0
4154         subversion=0
4155         api_revision=0
4156         api_version=0
4157         api_subversion=0
4158         perl_patchlevel=0
4159         $echo "(You do not have patchlevel.h.  Eek.)"
4160 fi
4161 if $test -r $rsrc/.patch ; then
4162         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4163                 perl_patchlevel=`cat $rsrc/.patch`
4164         fi
4165 fi
4166 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4167 version_patchlevel_string="version $patchlevel subversion $subversion"
4168 case "$perl_patchlevel" in
4169 0|'') ;;
4170 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4171     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4172     ;;
4173 esac
4174
4175 $echo "(You have $package $version_patchlevel_string.)"
4176
4177 case "$osname" in
4178 dos|vms)
4179         : XXX Should be a Configure test for double-dots in filenames.
4180         version=`echo $revision $patchlevel $subversion | \
4181                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4182         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4183                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4184         ;;
4185 *)
4186         version=`echo $revision $patchlevel $subversion | \
4187                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4188         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4189                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4190         ;;
4191 esac
4192 : Special case the 5.005_xx maintenance series, which used 5.005
4193 : without any subversion label as a subdirectory in $sitelib
4194 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4195         api_versionstring='5.005'
4196 fi
4197
4198 : Do we want threads support and if so, what type
4199 case "$usethreads" in
4200 $define|true|[yY]*)     dflt='y';;
4201 *)     # Catch case where user specified ithreads or 5005threads but
4202        # forgot -Dusethreads (A.D. 4/2002)
4203        case "$useithreads$use5005threads" in
4204        *$define*)
4205                 case "$useperlio" in
4206                 "$define")      dflt='y' ;;
4207                 *)              dflt='n' ;;
4208                 esac
4209                 ;;
4210        *)       dflt='n';;
4211        esac
4212        ;;
4213 esac
4214 cat <<EOM
4215
4216 Perl can be built to take advantage of threads on some systems.
4217 To do so, Configure can be run with -Dusethreads.
4218
4219 Note that Perl built with threading support runs slightly slower
4220 and uses more memory than plain Perl. The current implementation
4221 is believed to be stable, but it is fairly new, and so should be
4222 treated with caution.
4223
4224 If this doesn't make any sense to you, just accept the default '$dflt'.
4225 EOM
4226 rp='Build a threading Perl?'
4227 . ./myread
4228 case "$ans" in
4229 y|Y)    val="$define" ;;
4230 *)      val="$undef" ;;
4231 esac
4232 set usethreads
4233 eval $setvar
4234
4235 if $test $patchlevel -lt 9; then
4236     case "$usethreads" in
4237     $define)
4238         $cat <<EOM
4239
4240 Since release 5.6, Perl has had two different threading implementations,
4241 the newer interpreter-based version (ithreads) with one interpreter per
4242 thread, and the older 5.005 version (5005threads).
4243 The 5005threads version is effectively unmaintained and will probably be
4244 removed in Perl 5.10, so there should be no need to build a Perl using it
4245 unless needed for backwards compatibility with some existing 5.005threads
4246 code.
4247
4248 EOM
4249         : Default to ithreads unless overridden on command line or with
4250         : old config.sh
4251         dflt='y'
4252         case "$use5005threads" in
4253                 $define|true|[yY]*) dflt='n';;
4254         esac
4255         case "$useithreads" in
4256                 $undef|false|[nN]*) dflt='n';;
4257         esac
4258         rp='Use the newer interpreter-based ithreads?'
4259         . ./myread
4260         case "$ans" in
4261         y|Y)    val="$define" ;;
4262         *)      val="$undef" ;;
4263         esac
4264         set useithreads
4265         eval $setvar
4266         : Now set use5005threads to the opposite value.
4267         case "$useithreads" in
4268         $define) val="$undef" ;;
4269         *) val="$define" ;;
4270         esac
4271         set use5005threads
4272         eval $setvar
4273         ;;
4274     *)
4275         useithreads="$undef"
4276         use5005threads="$undef"
4277         ;;
4278     esac
4279
4280     case "$useithreads$use5005threads" in
4281     "$define$define")
4282         $cat >&4 <<EOM
4283
4284 You cannot have both the ithreads and the 5.005 threads enabled
4285 at the same time.  Disabling the 5.005 threads since they are
4286 much less stable than the ithreads.
4287
4288 EOM
4289         use5005threads="$undef"
4290         ;;
4291     esac
4292
4293 else
4294 : perl-5.9.x and later
4295
4296     if test X"$usethreads" = "X$define"; then
4297         case "$use5005threads" in
4298             $define|true|[yY]*)
4299                 $cat >&4 <<EOM
4300
4301 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4302
4303 EOM
4304             ;;
4305         esac
4306     fi
4307
4308     use5005threads="$undef"
4309     useithreads="$usethreads"
4310 fi
4311
4312 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4313         cat >&4 <<EOF
4314 ***
4315 *** To build with ithreads you must also use the PerlIO layer.
4316 *** Cannot continue, aborting.
4317 ***
4318 EOF
4319         exit 1
4320 fi
4321
4322 case "$d_oldpthreads" in
4323 '')     : Configure tests would be welcome here.  For now, assume undef.
4324         val="$undef" ;;
4325 *)      val="$d_oldpthreads" ;;
4326 esac
4327 set d_oldpthreads
4328 eval $setvar
4329
4330
4331 : Look for a hint-file generated 'call-back-unit'.  If the
4332 : user has specified that a threading perl is to be built,
4333 : we may need to set or change some other defaults.
4334 if $test -f usethreads.cbu; then
4335     echo "Your platform has some specific hints regarding threaded builds, using them..."
4336     . ./usethreads.cbu
4337 else
4338     case "$usethreads" in
4339         "$define"|true|[yY]*)
4340                 $cat <<EOM
4341 (Your platform does not have any specific hints for threaded builds.
4342  Assuming POSIX threads, then.)
4343 EOM
4344         ;;
4345     esac
4346 fi
4347
4348 : Check if multiplicity is required
4349 cat <<EOM
4350
4351 Perl can be built so that multiple Perl interpreters can coexist
4352 within the same Perl executable.
4353 EOM
4354
4355 case "$useithreads" in
4356 $define)
4357         cat <<EOM
4358 This multiple interpreter support is required for interpreter-based threads.
4359 EOM
4360         val="$define"
4361         ;;
4362 *)      case "$usemultiplicity" in
4363         $define|true|[yY]*)     dflt='y';;
4364         *) dflt='n';;
4365         esac
4366         echo " "
4367         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4368         rp='Build Perl for multiplicity?'
4369         . ./myread
4370         case "$ans" in
4371         y|Y)    val="$define" ;;
4372         *)      val="$undef" ;;
4373         esac
4374         ;;
4375 esac
4376 set usemultiplicity
4377 eval $setvar
4378
4379 : Check if morebits is requested
4380 case "$usemorebits" in
4381 "$define"|true|[yY]*)
4382         use64bitint="$define"
4383         uselongdouble="$define"
4384         usemorebits="$define"
4385         ;;
4386 *)      usemorebits="$undef"
4387         ;;
4388 esac
4389
4390 : Determine the C compiler to be used
4391 echo " "
4392 case "$cc" in
4393 '') dflt=cc;;
4394 *) dflt="$cc";;
4395 esac
4396 rp="Use which C compiler?"
4397 . ./myread
4398 cc="$ans"
4399
4400 : See whether they have no cc but they do have gcc
4401 . ./trygcc
4402 if $test -f cc.cbu; then
4403     . ./cc.cbu
4404 fi
4405 . ./checkcc
4406
4407 : make some quick guesses about what we are up against
4408 echo " "
4409 $echo $n "Hmm...  $c"
4410 echo exit 1 >bsd
4411 echo exit 1 >usg
4412 echo exit 1 >v7
4413 echo exit 1 >osf1
4414 echo exit 1 >eunice
4415 echo exit 1 >xenix
4416 echo exit 1 >venix
4417 echo exit 1 >os2
4418 d_bsd="$undef"
4419 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4420 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4421 then
4422         echo "Looks kind of like an OSF/1 system, but we'll see..."
4423         echo exit 0 >osf1
4424 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4425         xxx=`./loc addbib blurfl $pth`
4426         if $test -f $xxx; then
4427         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4428                 echo exit 0 >bsd
4429                 echo exit 0 >usg
4430         else
4431                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4432                         echo "Looks kind of like an extended USG system, but we'll see..."
4433                 else
4434                         echo "Looks kind of like a USG system, but we'll see..."
4435                 fi
4436                 echo exit 0 >usg
4437         fi
4438 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4439         echo "Looks kind of like a BSD system, but we'll see..."
4440         d_bsd="$define"
4441         echo exit 0 >bsd
4442 else
4443         echo "Looks kind of like a Version 7 system, but we'll see..."
4444         echo exit 0 >v7
4445 fi
4446 case "$eunicefix" in
4447 *unixtovms*)
4448         $cat <<'EOI'
4449 There is, however, a strange, musty smell in the air that reminds me of
4450 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4451 EOI
4452         echo exit 0 >eunice
4453         d_eunice="$define"
4454 : it so happens the Eunice I know will not run shell scripts in Unix format
4455         ;;
4456 *)
4457         echo " "
4458         echo "Congratulations.  You aren't running Eunice."
4459         d_eunice="$undef"
4460         ;;
4461 esac
4462 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4463 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4464 : semicolon as a patch separator
4465 case "$p_" in
4466 :) ;;
4467 *)
4468         $cat <<'EOI'
4469 I have the feeling something is not exactly right, however...don't tell me...
4470 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4471 (Or you may be running DOS with DJGPP.)
4472 EOI
4473         echo exit 0 >os2
4474         ;;
4475 esac
4476 if test -f /xenix; then
4477         echo "Actually, this looks more like a XENIX system..."
4478         echo exit 0 >xenix
4479         d_xenix="$define"
4480 else
4481         echo " "
4482         echo "It's not Xenix..."
4483         d_xenix="$undef"
4484 fi
4485 chmod +x xenix
4486 $eunicefix xenix
4487 if test -f /venix; then
4488         echo "Actually, this looks more like a VENIX system..."
4489         echo exit 0 >venix
4490 else
4491         echo " "
4492         if ./xenix; then
4493                 : null
4494         else
4495                 echo "Nor is it Venix..."
4496         fi
4497 fi
4498 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4499 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4500 $rm -f foo
4501
4502 : Check if we are using GNU gcc and what its version is
4503 echo " "
4504 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4505 $cat >try.c <<EOM
4506 #include <stdio.h>
4507 int main() {
4508 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4509 #ifdef __VERSION__
4510         printf("%s\n", __VERSION__);
4511 #else
4512         printf("%s\n", "1");
4513 #endif
4514 #endif
4515         return(0);
4516 }
4517 EOM
4518 if $cc -o try $ccflags $ldflags try.c; then
4519         gccversion=`$run ./try`
4520         case "$gccversion" in
4521         '') echo "You are not using GNU cc." ;;
4522         *)  echo "You are using GNU cc $gccversion."
4523             ccname=gcc
4524             ;;
4525         esac
4526 else
4527         echo " "
4528         echo "*** WHOA THERE!!! ***" >&4
4529         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4530         case "$knowitall" in
4531         '')
4532         echo "    You'd better start hunting for one and let me know about it." >&4
4533                 exit 1
4534                 ;;
4535         esac
4536 fi
4537 $rm -f try try.*
4538 case "$gccversion" in
4539 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4540 esac
4541 case "$gccversion" in
4542 '') gccosandvers='' ;;
4543 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4544    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4545    gccshortvers=''
4546    case "$gccosandvers" in
4547    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4548    $osname$osvers) ;; # looking good
4549    $osname*) cat <<EOM >&4
4550
4551 *** WHOA THERE!!! ***
4552
4553     Your gcc has not been compiled for the exact release of
4554     your operating system ($gccosandvers versus $osname$osvers).
4555
4556     In general it is a good idea to keep gcc synchronized with
4557     the operating system because otherwise serious problems
4558     may ensue when trying to compile software, like Perl.
4559
4560     I'm trying to be optimistic here, though, and will continue.
4561     If later during the configuration and build icky compilation
4562     problems appear (headerfile conflicts being the most common
4563     manifestation), I suggest reinstalling the gcc to match
4564     your operating system release.
4565
4566 EOM
4567       ;;
4568    *) gccosandvers='' ;; # failed to parse, better be silent
4569    esac
4570    ;;
4571 esac
4572 case "$ccname" in
4573 '') ccname="$cc" ;;
4574 esac
4575
4576 # gcc 3.* complain about adding -Idirectories that they already know about,
4577 # so we will take those off from locincpth.
4578 case "$gccversion" in
4579 3*)
4580     echo "main(){}">try.c
4581     for incdir in $locincpth; do
4582        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4583              grep '^c[cp]p*[01]: warning: changing search order '`
4584        if test "X$warn" != X; then
4585            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4586        fi
4587     done
4588     $rm -f try try.*
4589 esac
4590
4591 : What should the include directory be ?
4592 echo " "
4593 $echo $n "Hmm...  $c"
4594 dflt='/usr/include'
4595 incpath=''
4596 mips_type=''
4597 if $test -f /bin/mips && /bin/mips; then
4598         echo "Looks like a MIPS system..."
4599         $cat >usr.c <<'EOCP'
4600 #ifdef SYSTYPE_BSD43
4601 /bsd43
4602 #endif
4603 EOCP
4604         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4605                 dflt='/bsd43/usr/include'
4606                 incpath='/bsd43'
4607                 mips_type='BSD 4.3'
4608         else
4609                 mips_type='System V'
4610         fi
4611         $rm -f usr.c usr.out
4612         echo "and you're compiling with the $mips_type compiler and libraries."
4613         xxx_prompt=y
4614         echo "exit 0" >mips
4615 else
4616         echo "Doesn't look like a MIPS system."
4617         xxx_prompt=n
4618         echo "exit 1" >mips
4619 fi
4620 chmod +x mips
4621 $eunicefix mips
4622 case "$usrinc" in
4623 '') ;;
4624 *) dflt="$usrinc";;
4625 esac
4626 case "$xxx_prompt" in
4627 y)      fn=d/
4628         echo " "
4629         rp='Where are the include files you want to use?'
4630         . ./getfile
4631         usrinc="$ans"
4632         ;;
4633 *)      usrinc="$dflt"
4634         ;;
4635 esac
4636
4637 : see how we invoke the C preprocessor
4638 echo " "
4639 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4640 cat <<'EOT' >testcpp.c
4641 #define ABC abc
4642 #define XYZ xyz
4643 ABC.XYZ
4644 EOT
4645 cd ..
4646 if test ! -f cppstdin; then
4647         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4648                 # AIX cc -E doesn't show the absolute headerfile
4649                 # locations but we'll cheat by using the -M flag.
4650                 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
4651         else
4652                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4653         fi
4654 else
4655         echo "Keeping your $hint cppstdin wrapper."
4656 fi
4657 chmod 755 cppstdin
4658 wrapper=`pwd`/cppstdin
4659 ok='false'
4660 cd UU
4661
4662 if $test "X$cppstdin" != "X" && \
4663         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4664         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4665 then
4666         echo "You used to use $cppstdin $cppminus so we'll use that again."
4667         case "$cpprun" in
4668         '') echo "But let's see if we can live without a wrapper..." ;;
4669         *)
4670                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4671                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4672                 then
4673                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4674                         ok='true'
4675                 else
4676                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4677                 fi
4678                 ;;
4679         esac
4680 else
4681         case "$cppstdin" in
4682         '') ;;
4683         *)
4684                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4685                 ;;
4686         esac
4687 fi
4688
4689 if $ok; then
4690         : nothing
4691 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4692         $cc -E <testcpp.c >testcpp.out 2>&1; \
4693         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4694         echo "Yup, it does."
4695         x_cpp="$cc -E"
4696         x_minus='';
4697 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4698         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4699         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4700         echo "Yup, it does."
4701         x_cpp="$cc -E"
4702         x_minus='-';
4703 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4704         $cc -P <testcpp.c >testcpp.out 2>&1; \
4705         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4706         echo "Yipee, that works!"
4707         x_cpp="$cc -P"
4708         x_minus='';
4709 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4710         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4711         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4712         echo "At long last!"
4713         x_cpp="$cc -P"
4714         x_minus='-';
4715 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4716         $cpp <testcpp.c >testcpp.out 2>&1; \
4717         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4718         echo "It works!"
4719         x_cpp="$cpp"
4720         x_minus='';
4721 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4722         $cpp - <testcpp.c >testcpp.out 2>&1; \
4723         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4724         echo "Hooray, it works!  I was beginning to wonder."
4725         x_cpp="$cpp"
4726         x_minus='-';
4727 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4728         $wrapper <testcpp.c >testcpp.out 2>&1; \
4729         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4730         x_cpp="$wrapper"
4731         x_minus=''
4732         echo "Eureka!"
4733 else
4734         dflt=''
4735         rp="No dice.  I can't find a C preprocessor.  Name one:"
4736         . ./myread
4737         x_cpp="$ans"
4738         x_minus=''
4739         $x_cpp <testcpp.c >testcpp.out 2>&1
4740         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4741                 echo "OK, that will do." >&4
4742         else
4743 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4744                 exit 1
4745         fi
4746 fi
4747
4748 case "$ok" in
4749 false)
4750         cppstdin="$x_cpp"
4751         cppminus="$x_minus"
4752         cpprun="$x_cpp"
4753         cpplast="$x_minus"
4754         set X $x_cpp
4755         shift
4756         case "$1" in
4757         "$cpp")
4758                 echo "Perhaps can we force $cc -E using a wrapper..."
4759                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4760                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4761                 then
4762                         echo "Yup, we can."
4763                         cppstdin="$wrapper"
4764                         cppminus='';
4765                 else
4766                         echo "Nope, we'll have to live without it..."
4767                 fi
4768                 ;;
4769         esac
4770         case "$cpprun" in
4771         "$wrapper")
4772                 cpprun=''
4773                 cpplast=''
4774                 ;;
4775         esac
4776         ;;
4777 esac
4778
4779 case "$cppstdin" in
4780 "$wrapper"|'cppstdin') ;;
4781 *) $rm -f $wrapper;;
4782 esac
4783 $rm -f testcpp.c testcpp.out
4784
4785 : Set private lib path
4786 case "$plibpth" in
4787 '') if ./mips; then
4788                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4789         fi;;
4790 esac
4791 case "$libpth" in
4792 ' ') dlist='';;
4793 '') dlist="$loclibpth $plibpth $glibpth";;
4794 *) dlist="$libpth";;
4795 esac
4796
4797 : Now check and see which directories actually exist, avoiding duplicates
4798 libpth=''
4799 for xxx in $dlist
4800 do
4801     if $test -d $xxx; then
4802                 case " $libpth " in
4803                 *" $xxx "*) ;;
4804                 *) libpth="$libpth $xxx";;
4805                 esac
4806     fi
4807 done
4808 $cat <<'EOM'
4809
4810 Some systems have incompatible or broken versions of libraries.  Among
4811 the directories listed in the question below, please remove any you
4812 know not to be holding relevant libraries, and add any that are needed.
4813 Say "none" for none.
4814
4815 EOM
4816 case "$libpth" in
4817 '') dflt='none';;
4818 *)
4819         set X $libpth
4820         shift
4821         dflt=${1+"$@"}
4822         ;;
4823 esac
4824 rp="Directories to use for library searches?"
4825 . ./myread
4826 case "$ans" in
4827 none) libpth=' ';;
4828 *) libpth="$ans";;
4829 esac
4830
4831 : compute shared library extension
4832 case "$so" in
4833 '')
4834         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4835                 dflt='sl'
4836         else
4837                 dflt='so'
4838         fi
4839         ;;
4840 *) dflt="$so";;
4841 esac
4842 $cat <<EOM
4843
4844 On some systems, shared libraries may be available.  Answer 'none' if
4845 you want to suppress searching of shared libraries for the remainder
4846 of this configuration.
4847
4848 EOM
4849 rp='What is the file extension used for shared libraries?'
4850 . ./myread
4851 so="$ans"
4852
4853 : Define several unixisms.
4854 : Hints files or command line option can be used to override them.
4855 : The convoluted testing is in case hints files set either the old
4856 : or the new name.
4857 case "$_exe" in
4858 '')     case "$exe_ext" in
4859         '')     ;;
4860         *)      _exe="$exe_ext" ;;
4861         esac
4862         ;;
4863 esac
4864 case "$_a" in
4865 '')     case "$lib_ext" in
4866     '') _a='.a';;
4867         *)      _a="$lib_ext" ;;
4868         esac
4869         ;;
4870 esac
4871 case "$_o" in
4872 '') case "$obj_ext" in
4873         '')     _o='.o';;
4874         *)      _o="$obj_ext";;
4875         esac
4876         ;;
4877 esac
4878 case "$p_" in
4879 '') case "$path_sep" in
4880         '')     p_=':';;
4881         *)      p_="$path_sep";;
4882         esac
4883         ;;
4884 esac
4885 exe_ext=$_exe
4886 lib_ext=$_a
4887 obj_ext=$_o
4888 path_sep=$p_
4889
4890 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4891
4892 : Which makefile gets called first.  This is used by make depend.
4893 case "$firstmakefile" in
4894 '') firstmakefile='makefile';;
4895 esac
4896
4897 : Check for uselongdouble support
4898 case "$ccflags" in
4899 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4900 esac
4901
4902 case "$uselongdouble" in
4903 $define|true|[yY]*)     dflt='y';;
4904 *) dflt='n';;
4905 esac
4906 cat <<EOM
4907
4908 Perl can be built to take advantage of long doubles which
4909 (if available) may give more accuracy and range for floating point numbers.
4910
4911 If this doesn't make any sense to you, just accept the default '$dflt'.
4912 EOM
4913 rp='Try to use long doubles if available?'
4914 . ./myread
4915 case "$ans" in
4916 y|Y)    val="$define"   ;;
4917 *)      val="$undef"    ;;
4918 esac
4919 set uselongdouble
4920 eval $setvar
4921
4922 case "$uselongdouble" in
4923 true|[yY]*) uselongdouble="$define" ;;
4924 esac
4925
4926 : Look for a hint-file generated 'call-back-unit'.  If the
4927 : user has specified that long doubles should be used,
4928 : we may need to set or change some other defaults.
4929 if $test -f uselongdouble.cbu; then
4930     echo "Your platform has some specific hints regarding long doubles, using them..."
4931     . ./uselongdouble.cbu
4932 else
4933     case "$uselongdouble" in
4934         $define)
4935                 $cat <<EOM
4936 (Your platform does not have any specific hints for long doubles.)
4937 EOM
4938         ;;
4939     esac
4940 fi
4941
4942 : Looking for optional libraries
4943 echo " "
4944 echo "Checking for optional libraries..." >&4
4945 case "$libs" in
4946 ' '|'') dflt='';;
4947 *) dflt="$libs";;
4948 esac
4949 case "$libswanted" in
4950 '') libswanted='c_s';;
4951 esac
4952 case "$usesocks" in
4953 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4954 esac
4955 libsfound=''
4956 libsfiles=''
4957 libsdirs=''
4958 libspath=''
4959 for thisdir in $libpth $xlibpth; do
4960   test -d $thisdir && libspath="$libspath $thisdir"
4961 done
4962 for thislib in $libswanted; do
4963         for thisdir in $libspath; do
4964             xxx=''
4965             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4966                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4967                 $test -f "$xxx" && eval $libscheck
4968                 $test -f "$xxx" && libstyle=shared
4969             fi
4970             if test ! -f "$xxx"; then
4971                 xxx=$thisdir/lib$thislib.$so
4972                 $test -f "$xxx" && eval $libscheck
4973                 $test -f "$xxx" && libstyle=shared
4974             fi
4975             if test ! -f "$xxx"; then
4976                 xxx=$thisdir/lib$thislib$_a
4977                 $test -f "$xxx" && eval $libscheck
4978                 $test -f "$xxx" && libstyle=static
4979             fi
4980             if test ! -f "$xxx"; then
4981                 xxx=$thisdir/$thislib$_a
4982                 $test -f "$xxx" && eval $libscheck
4983                 $test -f "$xxx" && libstyle=static
4984             fi
4985             if test ! -f "$xxx"; then
4986                 xxx=$thisdir/lib${thislib}_s$_a
4987                 $test -f "$xxx" && eval $libscheck
4988                 $test -f "$xxx" && libstyle=static
4989                 $test -f "$xxx" && thislib=${thislib}_s
4990             fi
4991             if test ! -f "$xxx"; then
4992                 xxx=$thisdir/Slib$thislib$_a
4993                 $test -f "$xxx" && eval $libscheck
4994                 $test -f "$xxx" && libstyle=static
4995             fi
4996             if $test -f "$xxx"; then
4997                 case "$libstyle" in
4998                 shared) echo "Found -l$thislib (shared)." ;;
4999                 static) echo "Found -l$thislib." ;;
5000                 *)      echo "Found -l$thislib ($libstyle)." ;;
5001                 esac
5002                 case " $dflt " in
5003                 *"-l$thislib "*);;
5004                 *) dflt="$dflt -l$thislib"
5005                    libsfound="$libsfound $xxx"
5006                    yyy=`basename $xxx`
5007                    libsfiles="$libsfiles $yyy"
5008                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5009                    case " $libsdirs " in
5010                    *" $yyy "*) ;;
5011                    *) libsdirs="$libsdirs $yyy" ;;
5012                    esac
5013                    ;;
5014                 esac
5015                 break
5016             fi
5017         done
5018         if $test ! -f "$xxx"; then
5019             echo "No -l$thislib."
5020         fi
5021 done
5022 set X $dflt
5023 shift
5024 dflt="$*"
5025 case "$libs" in
5026 '') dflt="$dflt";;
5027 *) dflt="$libs";;
5028 esac
5029 case "$dflt" in
5030 ' '|'') dflt='none';;
5031 esac
5032
5033 $cat <<EOM
5034
5035 In order to compile $package on your machine, a number of libraries
5036 are usually needed.  Include any other special libraries here as well.
5037 Say "none" for none.  The default list is almost always right.
5038 EOM
5039
5040 echo " "
5041 rp="What libraries to use?"
5042 . ./myread
5043 case "$ans" in
5044 none) libs=' ';;
5045 *) libs="$ans";;
5046 esac
5047
5048 : determine optimization, if desired, or use for debug flag also
5049 case "$optimize" in
5050 ' '|$undef) dflt='none';;
5051 '') dflt='-O';;
5052 *) dflt="$optimize";;
5053 esac
5054 $cat <<EOH
5055
5056 By default, $package compiles with the -O flag to use the optimizer.
5057 Alternately, you might want to use the symbolic debugger, which uses
5058 the -g flag (on traditional Unix systems).  Either flag can be
5059 specified here.  To use neither flag, specify the word "none".
5060
5061 EOH
5062 rp="What optimizer/debugger flag should be used?"
5063 . ./myread
5064 optimize="$ans"
5065 case "$optimize" in
5066 'none') optimize=" ";;
5067 esac
5068
5069 : Check what DEBUGGING is required from the command line
5070 : -DEBUGGING      or -DDEBUGGING or
5071 : -DEBUGGING=both                       = -g + -DDEBUGGING
5072 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5073 : -DEBUGGING=none or -UDEBUGGING        =
5074 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5075 case "$EBUGGING" in
5076 '')     ;;
5077 *)      DEBUGGING=$EBUGGING ;;
5078 esac
5079
5080 case "$DEBUGGING" in
5081 -g|both|$define)
5082     case "$optimize" in
5083         *-g*) ;;
5084         *)    optimize="$optimize -g" ;;
5085     esac ;;
5086 none|$undef)
5087     case "$optimize" in
5088         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5089                 shift
5090                 optimize="$*"
5091                 ;;
5092     esac ;;
5093 esac
5094
5095 dflt=''
5096 case "$DEBUGGING" in
5097 both|$define) dflt='-DDEBUGGING'
5098 esac
5099
5100 : argument order is deliberate, as the flag will start with - which set could
5101 : think is an option
5102 checkccflag='check=$1; flag=$2; callback=$3;
5103 echo " ";
5104 echo "Checking if your compiler accepts $flag" 2>&1;
5105 echo "int main(void) { return 0; }" > gcctest.c;
5106 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5107     echo "Yes, it does." 2>&1;
5108     if $test -s gcctest.out ; then
5109         echo "But your platform does not like it:";
5110         cat gcctest.out;
5111     else
5112         case "$ccflags" in
5113         *$check*)
5114             echo "Leaving current flags $ccflags alone." 2>&1
5115             ;;
5116         *) dflt="$dflt $flag";
5117             eval $callback
5118             ;;
5119         esac
5120     fi
5121 else
5122     echo "Nope, it does not, but that is ok." 2>&1;
5123 fi
5124 '
5125
5126 : We will not override a previous value, but we might want to
5127 : augment a hint file
5128 case "$hint" in
5129 default|recommended)
5130         case "$gccversion" in
5131         1*) dflt="$dflt -fpcc-struct-return" ;;
5132         esac
5133         case "$optimize:$DEBUGGING" in
5134         *-g*:old) dflt="$dflt -DDEBUGGING";;
5135         esac
5136         case "$gccversion" in
5137         2*) if $test -d /etc/conf/kconfig.d &&
5138                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5139                 then
5140                         # Interactive Systems (ISC) POSIX mode.
5141                         dflt="$dflt -posix"
5142                 fi
5143                 ;;
5144         esac
5145         case "$gccversion" in
5146         1*) ;;
5147         2.[0-8]*) ;;
5148         ?*)     set strict-aliasing -fno-strict-aliasing
5149                 eval $checkccflag
5150                 ;;
5151         esac
5152         # For gcc, adding -pipe speeds up compilations for some, but apparently
5153         # some assemblers can't read from stdin.  (It also slows down compilations
5154         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5155         case "$gccversion" in
5156         ?*)     set pipe -pipe
5157                 eval $checkccflag
5158                 ;;
5159         esac
5160
5161         # on x86_64 (at least) we require an extra library (libssp) in the
5162         # link command line. This library is not named, so I infer that it is
5163         # an implementation detail that may change. Hence the safest approach
5164         # is to add the flag to the flags passed to the compiler at link time,
5165         # as that way the compiler can do the right implementation dependant
5166         # thing. (NWC)
5167         case "$gccversion" in
5168         ?*)     set stack-protector -fstack-protector
5169                 eval $checkccflag
5170                 ;;
5171         esac
5172         ;;
5173 esac
5174
5175 case "$mips_type" in
5176 *BSD*|'') inclwanted="$locincpth $usrinc";;
5177 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5178 esac
5179 for thisincl in $inclwanted; do
5180         if $test -d $thisincl; then
5181                 if $test x$thisincl != x$usrinc; then
5182                         case "$dflt" in
5183                         *" -I$thisincl "*);;
5184                         *) dflt="$dflt -I$thisincl ";;
5185                         esac
5186                 fi
5187         fi
5188 done
5189
5190 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5191         xxx=true;
5192 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5193         xxx=true;
5194 else
5195         xxx=false;
5196 fi;
5197 if $xxx; then
5198         case "$dflt" in
5199         *$2*);;
5200         *) dflt="$dflt -D$2";;
5201         esac;
5202 fi'
5203
5204 set signal.h LANGUAGE_C; eval $inctest
5205
5206 case "$usesocks" in
5207 $define)
5208         ccflags="$ccflags -DSOCKS"
5209         ;;
5210 esac
5211
5212 case "$hint" in
5213 default|recommended) dflt="$ccflags $dflt" ;;
5214 *) dflt="$ccflags";;
5215 esac
5216
5217 case "$dflt" in
5218 ''|' ') dflt=none;;
5219 esac
5220
5221 $cat <<EOH
5222
5223 Your C compiler may want other flags.  For this question you should include
5224 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5225 but you should NOT include libraries or ld flags like -lwhatever.  If you
5226 want $package to honor its debug switch, you should include -DDEBUGGING here.
5227 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5228
5229 To use no flags, specify the word "none".
5230
5231 EOH
5232 set X $dflt
5233 shift
5234 dflt=${1+"$@"}
5235 rp="Any additional cc flags?"
5236 . ./myread
5237 case "$ans" in
5238 none) ccflags='';;
5239 *) ccflags="$ans";;
5240 esac
5241
5242 : the following weeds options from ccflags that are of no interest to cpp
5243 case "$cppflags" in
5244 '') cppflags="$ccflags" ;;
5245 *)  cppflags="$cppflags $ccflags" ;;
5246 esac
5247 case "$gccversion" in
5248 1*) cppflags="$cppflags -D__GNUC__"
5249 esac
5250 case "$mips_type" in
5251 '');;
5252 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5253 esac
5254 case "$cppflags" in
5255 '');;
5256 *)
5257         echo " "
5258         echo "Let me guess what the preprocessor flags are..." >&4
5259         set X $cppflags
5260         shift
5261         cppflags=''
5262         $cat >cpp.c <<'EOM'
5263 #define BLURFL foo
5264
5265 BLURFL xx LFRULB
5266 EOM
5267         previous=''
5268         for flag in $*
5269         do
5270                 case "$flag" in
5271                 -*) ftry="$flag";;
5272                 *) ftry="$previous $flag";;
5273                 esac
5274                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5275                         >cpp1.out 2>/dev/null && \
5276                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5277                         >cpp2.out 2>/dev/null && \
5278                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5279                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5280                 then
5281                         cppflags="$cppflags $ftry"
5282                         previous=''
5283                 else
5284                         previous="$flag"
5285                 fi
5286         done
5287         set X $cppflags
5288         shift
5289         cppflags=${1+"$@"}
5290         case "$cppflags" in
5291         *-*)  echo "They appear to be: $cppflags";;
5292         esac
5293         $rm -f cpp.c cpp?.out
5294         ;;
5295 esac
5296
5297 : flags used in final linking phase
5298 case "$ldflags" in
5299 '') if ./venix; then
5300                 dflt='-i -z'
5301         else
5302                 dflt=''
5303         fi
5304         case "$ccflags" in
5305         *-posix*) dflt="$dflt -posix" ;;
5306         esac
5307         ;;
5308 *) dflt="$ldflags";;
5309 esac
5310 # See note above about -fstack-protector
5311 case "$ccflags" in
5312 *-fstack-protector*) 
5313         case "$dflt" in
5314         *-fstack-protector*) ;; # Don't add it again
5315         *) dflt="$dflt -fstack-protector" ;; 
5316         esac
5317         ;;
5318 esac
5319
5320 : Try to guess additional flags to pick up local libraries.
5321 for thislibdir in $libpth; do
5322         case " $loclibpth " in
5323         *" $thislibdir "*)
5324                 case "$dflt " in
5325                 *"-L$thislibdir "*) ;;
5326                 *)  dflt="$dflt -L$thislibdir" ;;
5327                 esac
5328                 ;;
5329         esac
5330 done
5331
5332 case "$dflt" in
5333 '') dflt='none' ;;
5334 esac
5335
5336 $cat <<EOH
5337
5338 Your C linker may need flags.  For this question you should
5339 include -L/whatever and any other flags used by the C linker, but you
5340 should NOT include libraries like -lwhatever.
5341
5342 Make sure you include the appropriate -L/path flags if your C linker
5343 does not normally search all of the directories you specified above,
5344 namely
5345         $libpth
5346 To use no flags, specify the word "none".
5347
5348 EOH
5349
5350 rp="Any additional ld flags (NOT including libraries)?"
5351 . ./myread
5352 case "$ans" in
5353 none) ldflags='';;
5354 *) ldflags="$ans";;
5355 esac
5356 rmlist="$rmlist pdp11"
5357
5358 : coherency check
5359 echo " "
5360 echo "Checking your choice of C compiler and flags for coherency..." >&4
5361 $cat > try.c <<'EOF'
5362 #include <stdio.h>
5363 int main() { printf("Ok\n"); return(0); }
5364 EOF
5365 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5366 shift
5367 $cat >try.msg <<'EOM'
5368 I've tried to compile and run the following simple program:
5369
5370 EOM
5371 $cat try.c >> try.msg
5372
5373 $cat >> try.msg <<EOM
5374
5375 I used the command:
5376
5377         $*
5378         $run ./try
5379
5380 and I got the following output:
5381
5382 EOM
5383 dflt=y
5384 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5385         if $sh -c "$run ./try " >>try.msg 2>&1; then
5386                 xxx=`$run ./try`
5387                 case "$xxx" in
5388                 "Ok") dflt=n ;;
5389                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5390                         case " $libs " in
5391                         *" -lsfio "*)
5392                                 cat >> try.msg <<'EOQS'
5393 If $libs contains -lsfio, and sfio is mis-configured, then it
5394 sometimes (apparently) runs and exits with a 0 status, but with no
5395 output!  It may have to do with sfio's use of _exit vs. exit.
5396
5397 EOQS
5398                                 rp="You have a big problem.  Shall I abort Configure"
5399                                 dflt=y
5400                                 ;;
5401                         esac
5402                         ;;
5403                 esac
5404         else
5405                 echo "The program compiled OK, but exited with status $?." >>try.msg
5406                 rp="You have a problem.  Shall I abort Configure"
5407                 dflt=y
5408         fi
5409 else
5410         echo "I can't compile the test program." >>try.msg
5411         rp="You have a BIG problem.  Shall I abort Configure"
5412         dflt=y
5413 fi
5414 case "$dflt" in
5415 y)
5416         $cat try.msg >&4
5417         case "$knowitall" in
5418         '')
5419                 echo "(The supplied flags or libraries might be incorrect.)"
5420                 ;;
5421         *) dflt=n;;
5422         esac
5423         echo " "
5424         . ./myread
5425         case "$ans" in
5426         n*|N*) ;;
5427         *)      echo "Ok.  Stopping Configure." >&4
5428                 exit 1
5429                 ;;
5430         esac
5431         ;;
5432 n) echo "OK, that should do.";;
5433 esac
5434 $rm_try gcctest gcctest.out
5435
5436 : define a shorthand compile call
5437 compile='
5438 mc_file=$1;
5439 shift;
5440 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5441 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5442 exit 1;
5443 fi;
5444 esac;
5445 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5446 : define a shorthand compile call for compilations that should be ok.
5447 compile_ok='
5448 mc_file=$1;
5449 shift;
5450 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5451
5452 : determine filename position in cpp output
5453 echo " "
5454 echo "Computing filename position in cpp output for #include directives..." >&4
5455 case "$osname" in
5456 vos) testaccess=-e ;;
5457 *)   testaccess=-r ;;
5458 esac
5459 echo '#include <stdio.h>' > foo.c
5460 $cat >fieldn <<EOF
5461 $startsh
5462 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5463 $grep '^[       ]*#.*stdio\.h' | \
5464 while read cline; do
5465         pos=1
5466         set \$cline
5467         while $test \$# -gt 0; do
5468                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5469                         echo "\$pos"
5470                         exit 0
5471                 fi
5472                 shift
5473                 pos=\`expr \$pos + 1\`
5474         done
5475 done
5476 EOF
5477 chmod +x fieldn
5478 fieldn=`./fieldn`
5479 $rm -f foo.c fieldn
5480 case $fieldn in
5481 '') pos='???';;
5482 1) pos=first;;
5483 2) pos=second;;
5484 3) pos=third;;
5485 *) pos="${fieldn}th";;
5486 esac
5487 echo "Your cpp writes the filename in the $pos field of the line."
5488
5489 case "$osname" in
5490 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5491 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5492 *)   cppfilter='' ;;
5493 esac
5494 : locate header file
5495 $cat >findhdr <<EOF
5496 $startsh
5497 wanted=\$1
5498 name=''
5499 for usrincdir in $usrinc
5500 do
5501         if test -f \$usrincdir/\$wanted; then
5502                 echo "\$usrincdir/\$wanted"
5503                 exit 0
5504         fi
5505 done
5506 awkprg='{ print \$$fieldn }'
5507 echo "#include <\$wanted>" > foo\$\$.c
5508 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5509 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5510 while read cline; do
5511         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5512         case "\$name" in
5513         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5514         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5515         *) exit 2;;
5516         esac;
5517 done;
5518 #
5519 # status = 0: grep returned 0 lines, case statement not executed
5520 # status = 1: headerfile found
5521 # status = 2: while loop executed, no headerfile found
5522 #
5523 status=\$?
5524 $rm -f foo\$\$.c;
5525 if test \$status -eq 1; then
5526         exit 0;
5527 fi
5528 exit 1
5529 EOF
5530 chmod +x findhdr
5531
5532 : define an alternate in-header-list? function
5533 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5534 cont=true; xxf="echo \"<\$1> found.\" >&4";
5535 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5536 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5537 esac;
5538 case $# in 4) instead=instead;; *) instead="at last";; esac;
5539 while $test "$cont"; do
5540         xxx=`./findhdr $1`
5541         var=$2; eval "was=\$$2";
5542         if $test "$xxx" && $test -r "$xxx";
5543         then eval $xxf;
5544         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5545                 cont="";
5546         else eval $xxnf;
5547         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5548         set $yyy; shift; shift; yyy=$@;
5549         case $# in 0) cont="";;
5550         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5551                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5552         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5553                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5554         esac;
5555 done;
5556 while $test "$yyy";
5557 do set $yyy; var=$2; eval "was=\$$2";
5558         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5559         set $yyy; shift; shift; yyy=$@;
5560 done'
5561
5562 : see if stdlib is available
5563 set stdlib.h i_stdlib
5564 eval $inhdr
5565
5566 : check for lengths of integral types
5567 echo " "
5568 case "$intsize" in
5569 '')
5570         echo "Checking to see how big your integers are..." >&4
5571         $cat >try.c <<EOCP
5572 #include <stdio.h>
5573 #$i_stdlib I_STDLIB
5574 #ifdef I_STDLIB
5575 #include <stdlib.h>
5576 #endif
5577 int main()
5578 {
5579         printf("intsize=%d;\n", (int)sizeof(int));
5580         printf("longsize=%d;\n", (int)sizeof(long));
5581         printf("shortsize=%d;\n", (int)sizeof(short));
5582         exit(0);
5583 }
5584 EOCP
5585         set try
5586         if eval $compile_ok && $run ./try > /dev/null; then
5587                 eval `$run ./try`
5588                 echo "Your integers are $intsize bytes long."
5589                 echo "Your long integers are $longsize bytes long."
5590                 echo "Your short integers are $shortsize bytes long."
5591         else
5592                 $cat >&4 <<EOM
5593 !
5594 Help! I can't compile and run the intsize test program: please enlighten me!
5595 (This is probably a misconfiguration in your system or libraries, and
5596 you really ought to fix it.  Still, I'll try anyway.)
5597 !
5598 EOM
5599                 dflt=4
5600                 rp="What is the size of an integer (in bytes)?"
5601                 . ./myread
5602                 intsize="$ans"
5603                 dflt=$intsize
5604                 rp="What is the size of a long integer (in bytes)?"
5605                 . ./myread
5606                 longsize="$ans"
5607                 dflt=2
5608                 rp="What is the size of a short integer (in bytes)?"
5609                 . ./myread
5610                 shortsize="$ans"
5611         fi
5612         ;;
5613 esac
5614 $rm_try
5615
5616 : check for long long
5617 echo " "
5618 echo "Checking to see if you have long long..." >&4
5619 echo 'int main() { long long x = 7; return 0; }' > try.c
5620 set try
5621 if eval $compile; then
5622         val="$define"
5623         echo "You have long long."
5624 else
5625         val="$undef"
5626         echo "You do not have long long."
5627 fi
5628 $rm_try
5629 set d_longlong
5630 eval $setvar
5631
5632 : check for length of long long
5633 case "${d_longlong}${longlongsize}" in
5634 $define)
5635         echo " "
5636         echo "Checking to see how big your long longs are..." >&4
5637         $cat >try.c <<'EOCP'
5638 #include <stdio.h>
5639 int main()
5640 {
5641     printf("%d\n", (int)sizeof(long long));
5642     return(0);
5643 }
5644 EOCP
5645         set try
5646         if eval $compile_ok; then
5647                 longlongsize=`$run ./try`
5648                 echo "Your long longs are $longlongsize bytes long."
5649         else
5650                 dflt='8'
5651                 echo " "
5652                 echo "(I can't seem to compile the test program.  Guessing...)"
5653                 rp="What is the size of a long long (in bytes)?"
5654                 . ./myread
5655                 longlongsize="$ans"
5656         fi
5657         if $test "X$longsize" = "X$longlongsize"; then
5658                 echo "(That isn't any different from an ordinary long.)"
5659         fi
5660         ;;
5661 esac
5662 $rm_try
5663
5664 : see if inttypes.h is available
5665 : we want a real compile instead of Inhdr because some systems
5666 : have an inttypes.h which includes non-existent headers
5667 echo " "
5668 $cat >try.c <<EOCP
5669 #include <inttypes.h>
5670 int main() {
5671         static int32_t foo32 = 0x12345678;
5672 }
5673 EOCP
5674 set try
5675 if eval $compile; then
5676         echo "<inttypes.h> found." >&4
5677         val="$define"
5678 else
5679         echo "<inttypes.h> NOT found." >&4
5680         val="$undef"
5681 fi
5682 $rm_try
5683 set i_inttypes
5684 eval $setvar
5685
5686 : check for int64_t
5687 echo " "
5688 echo "Checking to see if you have int64_t..." >&4
5689 $cat >try.c <<EOCP
5690 #include <sys/types.h>
5691 #$i_inttypes I_INTTYPES
5692 #ifdef I_INTTYPES
5693 #include <inttypes.h>
5694 #endif
5695 int main() { int64_t x = 7; }
5696 EOCP
5697 set try
5698 if eval $compile; then
5699         val="$define"
5700         echo "You have int64_t."
5701 else
5702         val="$undef"
5703         echo "You do not have int64_t."
5704 fi
5705 $rm_try
5706 set d_int64_t
5707 eval $setvar
5708
5709 : Check if 64bit ints have a quad type
5710 echo " "
5711 echo "Checking which 64-bit integer type we could use..." >&4
5712
5713 case "$intsize" in
5714 8) val=int
5715    set quadtype
5716    eval $setvar
5717    val='"unsigned int"'
5718    set uquadtype
5719    eval $setvar
5720    quadkind=1
5721    ;;
5722 *) case "$longsize" in
5723    8) val=long
5724       set quadtype
5725       eval $setvar
5726       val='"unsigned long"'
5727       set uquadtype
5728       eval $setvar
5729       quadkind=2
5730       ;;
5731    *) case "$d_longlong:$longlongsize" in
5732       define:8)
5733         val='"long long"'
5734         set quadtype
5735         eval $setvar
5736         val='"unsigned long long"'
5737         set uquadtype
5738         eval $setvar
5739         quadkind=3
5740         ;;
5741       *) case "$d_int64_t" in
5742          define)
5743            val=int64_t
5744            set quadtype
5745            eval $setvar
5746            val=uint64_t
5747            set uquadtype
5748            eval $setvar
5749            quadkind=4
5750            ;;
5751          esac
5752          ;;
5753       esac
5754       ;;
5755    esac
5756    ;;
5757 esac
5758
5759 case "$quadtype" in
5760 '')     echo "Alas, no 64-bit integer types in sight." >&4
5761         d_quad="$undef"
5762         ;;
5763 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5764         d_quad="$define"
5765         ;;
5766 esac
5767
5768 : Do we want 64bit support
5769 case "$uselonglong" in
5770 "$define"|true|[yY]*)
5771         cat <<EOM >&4
5772
5773 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5774 EOM
5775         use64bitint="$define"
5776         ;;
5777 esac
5778 case "$use64bits" in
5779 "$define"|true|[yY]*)
5780         cat <<EOM >&4
5781
5782 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5783 EOM
5784         use64bitint="$define"
5785         ;;
5786 esac
5787 case "$use64bitints" in
5788 "$define"|true|[yY]*)
5789         cat <<EOM >&4
5790
5791 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5792 EOM
5793         use64bitint="$define"
5794         ;;
5795 esac
5796 case "$use64bitsint" in
5797 "$define"|true|[yY]*)
5798         cat <<EOM >&4
5799
5800 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5801 EOM
5802         use64bitint="$define"
5803         ;;
5804 esac
5805 case "$uselonglongs" in
5806 "$define"|true|[yY]*)
5807         cat <<EOM >&4
5808
5809 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5810 EOM
5811         use64bitint="$define"
5812         ;;
5813 esac
5814 case "$use64bitsall" in
5815 "$define"|true|[yY]*)
5816         cat <<EOM >&4
5817
5818 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5819 EOM
5820         use64bitall="$define"
5821         ;;
5822 esac
5823
5824 case "$ccflags" in
5825 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5826 esac
5827 case "$use64bitall" in
5828 "$define"|true|[yY]*) use64bitint="$define" ;;
5829 esac
5830
5831 case "$longsize" in
5832 8) cat <<EOM
5833
5834 You have natively 64-bit long integers.
5835 EOM
5836    val="$define"
5837    ;;
5838 *) case "$use64bitint" in
5839    "$define"|true|[yY]*) dflt='y';;
5840    *) dflt='n';;
5841    esac
5842    case "$d_quad" in
5843    "$define") ;;
5844    *) dflt='n' ;;
5845    esac
5846    cat <<EOM
5847
5848 Perl can be built to take advantage of 64-bit integer types
5849 on some systems.  To do so, Configure can be run with -Duse64bitint.
5850 Choosing this option will most probably introduce binary incompatibilities.
5851
5852 If this doesn't make any sense to you, just accept the default '$dflt'.
5853 (The default has been chosen based on your configuration.)
5854 EOM
5855    rp='Try to use 64-bit integers, if available?'
5856    . ./myread
5857    case "$ans" in
5858    [yY]*) val="$define" ;;
5859    *)     val="$undef"  ;;
5860    esac
5861    ;;
5862 esac
5863 set use64bitint
5864 eval $setvar
5865
5866 case "$use64bitall" in
5867 "$define"|true|[yY]*) dflt='y' ;;
5868 *) case "$longsize" in
5869    8) dflt='y' ;;
5870    *) dflt='n' ;;
5871    esac
5872    ;;
5873 esac
5874 cat <<EOM
5875
5876 You may also choose to try maximal 64-bitness.  It means using as much
5877 64-bitness as possible on the platform.  This in turn means even more
5878 binary incompatibilities.  On the other hand, your platform may not
5879 have any more 64-bitness available than what you already have chosen.
5880
5881 If this doesn't make any sense to you, just accept the default '$dflt'.
5882 (The default has been chosen based on your configuration.)
5883 EOM
5884 rp='Try to use maximal 64-bit support, if available?'
5885 . ./myread
5886 case "$ans" in
5887 [yY]*) val="$define" ;;
5888 *)     val="$undef"  ;;
5889 esac
5890 set use64bitall
5891 eval $setvar
5892 case "$use64bitall" in
5893 "$define")
5894         case "$use64bitint" in
5895         "$undef")
5896                 cat <<EOM
5897
5898 Since you have chosen a maximally 64-bit build, I'm also turning on
5899 the use of 64-bit integers.
5900 EOM
5901                 use64bitint="$define" ;;
5902         esac
5903         ;;
5904 esac
5905
5906 : Look for a hint-file generated 'call-back-unit'.  If the
5907 : user has specified that a 64-bit perl is to be built,
5908 : we may need to set or change some other defaults.
5909 if $test -f use64bitint.cbu; then
5910         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5911         . ./use64bitint.cbu
5912 fi
5913 case "$use64bitint" in
5914 "$define"|true|[yY]*)
5915         case "$longsize" in
5916         4) case "$archname64" in
5917            '') archname64=64int ;;
5918            esac
5919            ;;
5920         esac
5921         ;;
5922 esac
5923
5924 : Look for a hint-file generated 'call-back-unit'.  If the
5925 : user has specified that a maximally 64-bit perl is to be built,
5926 : we may need to set or change some other defaults.
5927 if $test -f use64bitall.cbu; then
5928         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5929         . ./use64bitall.cbu
5930 fi
5931 case "$use64bitall" in
5932 "$define"|true|[yY]*)
5933         case "$longsize" in
5934         4) case "$archname64" in
5935            ''|64int) archname64=64all ;;
5936            esac
5937            ;;
5938         esac
5939         ;;
5940 esac
5941
5942 case "$d_quad:$use64bitint" in
5943 $undef:$define)
5944         cat >&4 <<EOF
5945
5946 *** You have chosen to use 64-bit integers,
5947 *** but none can be found.
5948 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5949 *** Cannot continue, aborting.
5950
5951 EOF
5952         exit 1
5953         ;;
5954 esac
5955
5956 : check for length of double
5957 echo " "
5958 case "$doublesize" in
5959 '')
5960         echo "Checking to see how big your double precision numbers are..." >&4
5961         $cat >try.c <<EOCP
5962 #include <stdio.h>
5963 #$i_stdlib I_STDLIB
5964 #ifdef I_STDLIB
5965 #include <stdlib.h>
5966 #endif
5967 int main()
5968 {
5969     printf("%d\n", (int)sizeof(double));
5970     exit(0);
5971 }
5972 EOCP
5973         set try
5974         if eval $compile_ok; then
5975                 doublesize=`$run ./try`
5976                 echo "Your double is $doublesize bytes long."
5977         else
5978                 dflt='8'
5979                 echo "(I can't seem to compile the test program.  Guessing...)"
5980                 rp="What is the size of a double precision number (in bytes)?"
5981                 . ./myread
5982                 doublesize="$ans"
5983         fi
5984         ;;
5985 esac
5986 $rm_try
5987
5988 : check for long doubles
5989 echo " "
5990 echo "Checking to see if you have long double..." >&4
5991 echo 'int main() { long double x = 7.0; }' > try.c
5992 set try
5993 if eval $compile; then
5994         val="$define"
5995         echo "You have long double."
5996 else
5997         val="$undef"
5998         echo "You do not have long double."
5999 fi
6000 $rm_try
6001 set d_longdbl
6002 eval $setvar
6003
6004 : check for length of long double
6005 case "${d_longdbl}${longdblsize}" in
6006 $define)
6007         echo " "
6008         echo "Checking to see how big your long doubles are..." >&4
6009         $cat >try.c <<'EOCP'
6010 #include <stdio.h>
6011 int main()
6012 {
6013         printf("%d\n", sizeof(long double));
6014 }
6015 EOCP
6016         set try
6017         set try
6018         if eval $compile; then
6019                 longdblsize=`$run ./try`
6020                 echo "Your long doubles are $longdblsize bytes long."
6021         else
6022                 dflt='8'
6023                 echo " "
6024                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6025                 rp="What is the size of a long double (in bytes)?"
6026                 . ./myread
6027                 longdblsize="$ans"
6028         fi
6029         if $test "X$doublesize" = "X$longdblsize"; then
6030                 echo "That isn't any different from an ordinary double."
6031                 echo "I'll keep your setting anyway, but you may see some"
6032                 echo "harmless compilation warnings."
6033         fi
6034         ;;
6035 esac
6036 $rm_try
6037
6038 : determine the architecture name
6039 echo " "
6040 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6041         tarch=`arch`"-$osname"
6042 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6043         if uname -m > tmparch 2>&1 ; then
6044                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6045                         -e 's/$/'"-$osname/" tmparch`
6046         else
6047                 tarch="$osname"
6048         fi
6049         $rm -f tmparch
6050 else
6051         tarch="$osname"
6052 fi
6053 case "$myarchname" in
6054 ''|"$tarch") ;;
6055 *)
6056         echo "(Your architecture name used to be $myarchname.)"
6057         archname=''
6058         ;;
6059 esac
6060 case "$targetarch" in
6061 '') ;;
6062 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6063 esac
6064 myarchname="$tarch"
6065 case "$archname" in
6066 '') dflt="$tarch";;
6067 *) dflt="$archname";;
6068 esac
6069 rp='What is your architecture name'
6070 . ./myread
6071 archname="$ans"
6072 case "$usethreads" in
6073 $define)
6074         echo "Threads selected." >&4
6075         case "$archname" in
6076         *-thread*) echo "...and architecture name already has -thread." >&4
6077                 ;;
6078         *)      archname="$archname-thread"
6079                 echo "...setting architecture name to $archname." >&4
6080                 ;;
6081         esac
6082         ;;
6083 esac
6084 case "$usemultiplicity" in
6085 $define)
6086         echo "Multiplicity selected." >&4
6087         case "$archname" in
6088         *-multi*) echo "...and architecture name already has -multi." >&4
6089                 ;;
6090         *)      archname="$archname-multi"
6091                 echo "...setting architecture name to $archname." >&4
6092                 ;;
6093         esac
6094         ;;
6095 esac
6096 case "$use64bitint$use64bitall" in
6097 *"$define"*)
6098         case "$archname64" in
6099         '')
6100                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6101                 ;;
6102         *)
6103                 case "$use64bitint" in
6104                 "$define") echo "64 bit integers selected." >&4 ;;
6105                 esac
6106                 case "$use64bitall" in
6107                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6108                 esac
6109                 case "$archname" in
6110                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6111                         ;;
6112                 *)      archname="$archname-$archname64"
6113                         echo "...setting architecture name to $archname." >&4
6114                         ;;
6115                 esac
6116                 ;;
6117         esac
6118 esac
6119 case "$uselongdouble" in
6120 $define)
6121         echo "Long doubles selected." >&4
6122         case "$longdblsize" in
6123         $doublesize)
6124                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6125                 ;;
6126         *)
6127                 case "$archname" in
6128                 *-ld*) echo "...and architecture name already has -ld." >&4
6129                         ;;
6130                 *)      archname="$archname-ld"
6131                         echo "...setting architecture name to $archname." >&4
6132                         ;;
6133                 esac
6134                 ;;
6135         esac
6136         ;;
6137 esac
6138 case "$useperlio" in
6139 $define)
6140         echo "Perlio selected." >&4
6141         ;;
6142 *)
6143         echo "Perlio not selected, using stdio." >&4
6144         case "$archname" in
6145         *-stdio*) echo "...and architecture name already has -stdio." >&4
6146                 ;;
6147         *)      archname="$archname-stdio"
6148                 echo "...setting architecture name to $archname." >&4
6149                 ;;
6150         esac
6151         ;;
6152 esac
6153 if $test -f archname.cbu; then
6154         echo "Your platform has some specific hints for architecture name, using them..."
6155         . ./archname.cbu
6156 fi
6157
6158 : set the prefixit variable, to compute a suitable default value
6159 prefixit='case "$3" in
6160 ""|none)
6161         case "$oldprefix" in
6162         "") eval "$1=\"\$$2\"";;
6163         *)
6164                 case "$3" in
6165                 "") eval "$1=";;
6166                 none)
6167                         eval "tp=\"\$$2\"";
6168                         case "$tp" in
6169                         ""|" ") eval "$1=\"\$$2\"";;
6170                         *) eval "$1=";;
6171                         esac;;
6172                 esac;;
6173         esac;;
6174 *)
6175         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6176         case "$tp" in
6177         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6178         /*-$oldprefix/*|\~*-$oldprefix/*)
6179                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6180         *) eval "$1=\"\$$2\"";;
6181         esac;;
6182 esac'
6183
6184 : determine installation style
6185 : For now, try to deduce it from prefix unless it is already set.
6186 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6187 case "$installstyle" in
6188 '')     case "$prefix" in
6189                 *perl*) dflt='lib';;
6190                 *) dflt='lib/perl5' ;;
6191         esac
6192         ;;
6193 *)      dflt="$installstyle" ;;
6194 esac
6195 : Probably not worth prompting for this since we prompt for all
6196 : the directories individually, and the prompt would be too long and
6197 : confusing anyway.
6198 installstyle=$dflt
6199
6200 : determine where public executables go
6201 echo " "
6202 set dflt bin bin
6203 eval $prefixit
6204 fn=d~
6205 rp='Pathname where the public executables will reside?'
6206 . ./getfile
6207 if $test "X$ansexp" != "X$binexp"; then
6208         installbin=''
6209 fi
6210 prefixvar=bin
6211 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6212 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6213 :     this via initialinstalllocation
6214 . ./setprefixvar
6215
6216 case "$userelocatableinc" in
6217 $define|true|[yY]*)     dflt='y' ;;
6218 *)                      dflt='n' ;;
6219 esac
6220 cat <<EOM
6221
6222 Would you like to build Perl so that the installation is relocatable, so that
6223 library paths in @INC are determined relative to the path of the perl binary?
6224 This is not advised for system Perl installs, or if you need to run setid
6225 scripts or scripts under taint mode.
6226
6227 If this doesn't make any sense to you, just accept the default '$dflt'.
6228 EOM
6229 rp='Use relocatable @INC?'
6230 . ./myread
6231 case "$ans" in
6232 y|Y)    val="$define" ;;
6233 *)      val="$undef"  ;;
6234 esac
6235 set userelocatableinc
6236 eval $setvar
6237
6238 initialinstalllocation="$binexp"
6239 : Default prefix is now "up one level from where the binaries are"
6240 case "$userelocatableinc" in
6241 $define|true|[yY]*)
6242     bin=".../"
6243     binexp=".../"
6244     prefix=".../.."
6245     prefixexp=".../.."
6246     installprefixexp=".../.."
6247     ;;
6248 esac
6249
6250 : determine where private library files go
6251 : Usual default is /usr/local/lib/perl5/$version.
6252 : Also allow things like /opt/perl/lib/$version, since
6253 : /opt/perl/lib/perl5... would be redundant.
6254 : The default "style" setting is made in installstyle.U
6255 case "$installstyle" in
6256 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6257 *)       set dflt privlib lib/$version ;;
6258 esac
6259 eval $prefixit
6260 $cat <<EOM
6261
6262 There are some auxiliary files for $package that need to be put into a
6263 private library directory that is accessible by everyone.
6264
6265 EOM
6266 fn=$binexp
6267 fn=d~+
6268 rp='Pathname where the private library files will reside?'
6269 . ./getfile
6270 prefixvar=privlib
6271 . ./setprefixvar
6272
6273 : set the prefixup variable, to restore leading tilda escape
6274 prefixup='case "$prefixexp" in
6275 "$prefix") ;;
6276 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6277 esac'
6278
6279 : determine where public architecture dependent libraries go
6280 set archlib archlib
6281 eval $prefixit
6282 : privlib default is /usr/local/lib/$package/$version
6283 : archlib default is /usr/local/lib/$package/$version/$archname
6284 : privlib may have an optional trailing /share.
6285 tdflt=`echo $privlib | $sed 's,/share$,,'`
6286 tdflt=$tdflt/$archname
6287 case "$archlib" in
6288 '')     dflt=$tdflt
6289         ;;
6290 *)      dflt="$archlib"
6291     ;;
6292 esac
6293 $cat <<EOM
6294
6295 $spackage contains architecture-dependent library files.  If you are
6296 sharing libraries in a heterogeneous environment, you might store
6297 these files in a separate location.  Otherwise, you can just include
6298 them with the rest of the public library files.
6299
6300 EOM
6301 fn=$binexp
6302 fn=d+~
6303 rp='Where do you want to put the public architecture-dependent libraries?'
6304 . ./getfile
6305 prefixvar=archlib
6306 . ./setprefixvar
6307 if $test X"$archlib" = X"$privlib"; then
6308         d_archlib="$undef"
6309 else
6310         d_archlib="$define"
6311 fi
6312
6313 : see if setuid scripts can be secure
6314 $cat <<EOM
6315
6316 Some kernels have a bug that prevents setuid #! scripts from being
6317 secure.  Some sites have disabled setuid #! scripts because of this.
6318
6319 First let's decide if your kernel supports secure setuid #! scripts.
6320 (If setuid #! scripts would be secure but have been disabled anyway,
6321 don't say that they are secure if asked.)
6322
6323 EOM
6324
6325 val="$undef"
6326 if $test -d /dev/fd; then
6327         echo "#!$ls" >reflect
6328         chmod +x,u+s reflect
6329         ./reflect >flect 2>&1
6330         if $contains "/dev/fd" flect >/dev/null; then
6331                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6332                 val="$define"
6333         else
6334                 $cat <<EOM
6335 If you are not sure if they are secure, I can check but I'll need a
6336 username and password different from the one you are using right now.
6337 If you don't have such a username or don't want me to test, simply
6338 enter 'none'.
6339
6340 EOM
6341                 rp='Other username to test security of setuid scripts with?'
6342                 dflt='none'
6343                 . ./myread
6344                 case "$ans" in
6345                 n|none)
6346                         case "$d_suidsafe" in
6347                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6348                                 dflt=n;;
6349                         "$undef")
6350                                 echo "Well, the $hint value is *not* secure." >&4
6351                                 dflt=n;;
6352                         *)      echo "Well, the $hint value *is* secure." >&4
6353                                 dflt=y;;
6354                         esac
6355                         ;;
6356                 *)
6357                         $rm -f reflect flect
6358                         echo "#!$ls" >reflect
6359                         chmod +x,u+s reflect
6360                         echo >flect
6361                         chmod a+w flect
6362                         echo '"su" will (probably) prompt you for '"$ans's password."
6363                         su $ans -c './reflect >flect'
6364                         if $contains "/dev/fd" flect >/dev/null; then
6365                                 echo "Okay, it looks like setuid scripts are secure." >&4
6366                                 dflt=y
6367                         else
6368                                 echo "I don't think setuid scripts are secure." >&4
6369                                 dflt=n
6370                         fi
6371                         ;;
6372                 esac
6373                 rp='Does your kernel have *secure* setuid scripts?'
6374                 . ./myread
6375                 case "$ans" in
6376                 [yY]*)  val="$define";;
6377                 *)      val="$undef";;
6378                 esac
6379         fi
6380 else
6381         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6382         echo "(That's for file descriptors, not floppy disks.)"
6383         val="$undef"
6384 fi
6385 set d_suidsafe
6386 eval $setvar
6387
6388 $rm -f reflect flect
6389
6390 : now see if they want to do setuid emulation
6391 if $test $patchlevel -lt 11; then
6392 echo " "
6393 val="$undef"
6394 case "$d_suidsafe" in
6395 "$define")
6396         val="$undef"
6397         echo "No need to emulate SUID scripts since they are secure here." >&4
6398         ;;
6399 *)
6400         $cat <<EOM
6401 Some systems have disabled setuid scripts, especially systems where
6402 setuid scripts cannot be secure.  On systems where setuid scripts have
6403 been disabled, the setuid/setgid bits on scripts are currently
6404 useless.  It is possible for $package to detect those bits and emulate
6405 setuid/setgid in a secure fashion.  This emulation will only work if
6406 setuid scripts have been disabled in your kernel.
6407
6408 EOM
6409         case "$d_dosuid" in
6410         "$define") dflt=y ;;
6411         *) dflt=n ;;
6412         esac
6413         rp="Do you want to do setuid/setgid emulation?"
6414         . ./myread
6415         case "$ans" in
6416         [yY]*)  val="$define";;
6417         *)      val="$undef";;
6418         esac
6419         ;;
6420 esac
6421 set d_dosuid
6422 eval $setvar
6423 else
6424     case "$d_dosuid" in
6425         "$define")
6426         cat >&4 <<EOH
6427
6428 SUID emulation has been removed for 5.12
6429 Please re-run Configure without -Dd_dosuid
6430
6431 EOH
6432         exit 1;
6433         ;;
6434     esac
6435     d_dosuid=undef
6436 fi
6437
6438 : Find perl5.005 or later.
6439 echo "Looking for a previously installed perl5.005 or later... "
6440 case "$perl5" in
6441 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6442                 : Check if this perl is recent and can load a simple module
6443                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6444                         perl5=$tdir/perl
6445                         break;
6446                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6447                         perl5=$tdir/perl5
6448                         break;
6449                 fi
6450         done
6451         ;;
6452 *)      perl5="$perl5"
6453         ;;
6454 esac
6455 case "$perl5" in
6456 '')     echo "None found.  That's ok.";;
6457 *)      echo "Using $perl5." ;;
6458 esac
6459
6460 : Set the siteprefix variables
6461 $cat <<EOM
6462
6463 After $package is installed, you may wish to install various
6464 add-on modules and utilities.  Typically, these add-ons will
6465 be installed under $prefix with the rest
6466 of this package.  However, you may wish to install such add-ons
6467 elsewhere under a different prefix.
6468
6469 If you do not wish to put everything under a single prefix, that's
6470 ok.  You will be prompted for the individual locations; this siteprefix
6471 is only used to suggest the defaults.
6472
6473 The default should be fine for most people.
6474
6475 EOM
6476 fn=d~+
6477 rp='Installation prefix to use for add-on modules and utilities?'
6478 : XXX Here might be another good place for an installstyle setting.
6479 case "$siteprefix" in
6480 '') dflt=$prefix ;;
6481 *)  dflt=$siteprefix ;;
6482 esac
6483 . ./getfile
6484 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6485 oldsiteprefix=''
6486 case "$siteprefix" in
6487 '') ;;
6488 *)      case "$ans" in
6489         "$prefix") ;;
6490         *) oldsiteprefix="$prefix";;
6491         esac
6492         ;;
6493 esac
6494 siteprefix="$ans"
6495 siteprefixexp="$ansexp"
6496
6497 : determine where site specific libraries go.
6498 : Usual default is /usr/local/lib/perl5/site_perl/$version
6499 : The default "style" setting is made in installstyle.U
6500 : XXX No longer works with Prefixit stuff.
6501 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6502 case "$sitelib" in
6503 '') case "$installstyle" in
6504         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6505         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6506         esac
6507         ;;
6508 *)      dflt="$sitelib"
6509         ;;
6510 esac
6511 $cat <<EOM
6512
6513 The installation process will create a directory for
6514 site-specific extensions and modules.  Most users find it convenient
6515 to place all site-specific files in this directory rather than in the
6516 main distribution directory.
6517
6518 EOM
6519 fn=d~+
6520 rp='Pathname for the site-specific library files?'
6521 . ./getfile
6522 prefixvar=sitelib
6523 . ./setprefixvar
6524 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6525
6526 : Determine list of previous versions to include in @INC
6527 $cat > getverlist <<EOPL
6528 #!$perl5 -w
6529 use File::Basename;
6530 \$api_versionstring = "$api_versionstring";
6531 \$version = "$version";
6532 \$stem = "$sitelib_stem";
6533 \$archname = "$archname";
6534 EOPL
6535         $cat >> getverlist <<'EOPL'
6536 # The list found is store twice for each entry: the original name, and
6537 # the binary broken down version as pack "sss", so sorting is easy and
6538 # unambiguous. This will work for all versions that have a maximum of
6539 # three digit groups, separate by '.'s or '_'s. Names are extended with
6540 # ".0.0" to ensure at least three elements for the pack.
6541 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6542
6543 # Can't have leading @ because metaconfig interprets it as a command!
6544 ;@inc_version_list=();
6545 # XXX Redo to do opendir/readdir?
6546 if (-d $stem) {
6547     chdir($stem);
6548     ;@candidates = map {
6549         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6550     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6551 }
6552 else {
6553     ;@candidates = ();
6554 }
6555
6556 ($pversion, $aversion, $vsn5005) = map {
6557     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6558 foreach $d (@candidates) {
6559     if ($d->[1] lt $pversion) {
6560         if ($d->[1] ge $aversion) {
6561             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6562         }
6563         elsif ($d->[1] ge $vsn5005) {
6564             unshift(@inc_version_list, grep { -d } $d->[0]);
6565         }
6566     }
6567     else {
6568         # Skip newer version.  I.e. don't look in
6569         # 5.7.0 if we're installing 5.6.1.
6570     }
6571 }
6572
6573 if (@inc_version_list) {
6574     print join(' ', @inc_version_list);
6575 }
6576 else {
6577     # Blank space to preserve value for next Configure run.
6578     print " ";
6579 }
6580 EOPL
6581 chmod +x getverlist
6582 case "$inc_version_list" in
6583 '')     if test -x "$perl5$exe_ext"; then
6584                 dflt=`$perl5 getverlist`
6585         else
6586                 dflt='none'
6587         fi
6588         ;;
6589 $undef) dflt='none' ;;
6590 *)  eval dflt=\"$inc_version_list\" ;;
6591 esac
6592 case "$dflt" in
6593 ''|' ') dflt=none ;;
6594 esac
6595 case "$dflt" in
6596 5.005) dflt=none ;;
6597 esac
6598 $cat <<EOM
6599
6600 In order to ease the process of upgrading, this version of perl
6601 can be configured to use modules built and installed with earlier
6602 versions of perl that were installed under $prefix.  Specify here
6603 the list of earlier versions that this version of perl should check.
6604 If Configure detected no earlier versions of perl installed under
6605 $prefix, then the list will be empty.  Answer 'none' to tell perl
6606 to not search earlier versions.
6607
6608 The default should almost always be sensible, so if you're not sure,
6609 just accept the default.
6610 EOM
6611
6612 rp='List of earlier versions to include in @INC?'
6613 . ./myread
6614 case "$ans" in
6615 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6616 *) inc_version_list="$ans" ;;
6617 esac
6618 case "$inc_version_list" in
6619 ''|' ')
6620         inc_version_list_init='0'
6621         d_inc_version_list="$undef"
6622         ;;
6623 *)      inc_version_list_init=`echo $inc_version_list |
6624                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6625         d_inc_version_list="$define"
6626         ;;
6627 esac
6628 $rm -f getverlist
6629
6630 : see if malloc/malloc.h has to be included
6631 set malloc/malloc.h i_mallocmalloc
6632 eval $inhdr
6633
6634 : see if this is a malloc.h system
6635 : we want a real compile instead of Inhdr because some systems have a
6636 : malloc.h that just gives a compile error saying to use stdlib.h instead
6637 echo " "
6638 $cat >try.c <<EOCP
6639 #include <stdlib.h>
6640 #include <malloc.h>
6641 #$i_mallocmalloc I_MALLOCMALLOC
6642 #ifdef I_MALLOCMALLOC
6643 # include <malloc/malloc.h>
6644 #endif
6645
6646 int main () { return 0; }
6647 EOCP
6648 set try
6649 if eval $compile; then
6650     echo "<malloc.h> found." >&4
6651     val="$define"
6652 else
6653     echo "<malloc.h> NOT found." >&4
6654     val="$undef"
6655 fi
6656 $rm_try
6657 set i_malloc
6658 eval $setvar
6659
6660 : check for void type
6661 echo " "
6662 echo "Checking to see how well your C compiler groks the void type..." >&4
6663 case "$voidflags" in
6664 '')
6665         $cat >try.c <<EOCP
6666 #$i_stdlib I_STDLIB
6667 #ifdef I_STDLIB
6668 #include <stdlib.h>
6669 #endif
6670 #if TRY & 1
6671 void sub() {
6672 #else
6673 sub() {
6674 #endif
6675         extern void moo();      /* function returning void */
6676         void (*goo)();          /* ptr to func returning void */
6677 #if TRY & 8
6678         void *hue;              /* generic ptr */
6679 #endif
6680 #if TRY & 2
6681         void (*foo[10])();
6682 #endif
6683
6684 #if TRY & 4
6685         if(goo == moo) {
6686                 exit(0);
6687         }
6688 #endif
6689         exit(0);
6690 }
6691 int main() { sub(); }
6692 EOCP
6693         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6694                 voidflags=$defvoidused
6695         echo "Good.  It appears to support void to the level $package wants.">&4
6696                 if $contains warning .out >/dev/null 2>&1; then
6697                         echo "However, you might get some warnings that look like this:"
6698                         $cat .out
6699                 fi
6700         else
6701 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6702                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6703                         echo "It supports 1..."
6704                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6705                                 echo "It also supports 2..."
6706                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6707                                         voidflags=7
6708                                         echo "And it supports 4 but not 8 definitely."
6709                                 else
6710                                         echo "It doesn't support 4..."
6711                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6712                                                 voidflags=11
6713                                                 echo "But it supports 8."
6714                                         else
6715                                                 voidflags=3
6716                                                 echo "Neither does it support 8."
6717                                         fi
6718                                 fi
6719                         else
6720                                 echo "It does not support 2..."
6721                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6722                                         voidflags=13
6723                                         echo "But it supports 4 and 8."
6724                                 else
6725                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6726                                                 voidflags=5
6727                                                 echo "And it supports 4 but has not heard about 8."
6728                                         else
6729                                                 echo "However it supports 8 but not 4."
6730                                         fi
6731                                 fi
6732                         fi
6733                 else
6734                         echo "There is no support at all for void."
6735                         voidflags=0
6736                 fi
6737         fi
6738 esac
6739 case "$voidflags" in
6740 "$defvoidused") ;;
6741 *)      $cat >&4 <<'EOM'
6742   Support flag bits are:
6743     1: basic void declarations.
6744     2: arrays of pointers to functions returning void.
6745     4: operations between pointers to and addresses of void functions.
6746     8: generic void pointers.
6747 EOM
6748         dflt="$voidflags";
6749         rp="Your void support flags add up to what?"
6750         . ./myread
6751         voidflags="$ans"
6752         ;;
6753 esac
6754 $rm_try
6755
6756 : check for length of pointer
6757 echo " "
6758 case "$ptrsize" in
6759 '')
6760         echo "Checking to see how big your pointers are..." >&4
6761         if test "$voidflags" -gt 7; then
6762                 echo '#define VOID_PTR char *' > try.c
6763         else
6764                 echo '#define VOID_PTR void *' > try.c
6765         fi
6766         $cat >>try.c <<EOCP
6767 #include <stdio.h>
6768 #$i_stdlib I_STDLIB
6769 #ifdef I_STDLIB
6770 #include <stdlib.h>
6771 #endif
6772 int main()
6773 {
6774     printf("%d\n", (int)sizeof(VOID_PTR));
6775     exit(0);
6776 }
6777 EOCP
6778         set try
6779         if eval $compile_ok; then
6780                 ptrsize=`$run ./try`
6781                 echo "Your pointers are $ptrsize bytes long."
6782         else
6783                 dflt='4'
6784                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6785                 rp="What is the size of a pointer (in bytes)?"
6786                 . ./myread
6787                 ptrsize="$ans"
6788         fi
6789         ;;
6790 esac
6791 $rm_try
6792 case "$use64bitall" in
6793 "$define"|true|[yY]*)
6794         case "$ptrsize" in
6795         4)      cat <<EOM >&4
6796
6797 *** You have chosen a maximally 64-bit build,
6798 *** but your pointers are only 4 bytes wide.
6799 *** Please rerun Configure without -Duse64bitall.
6800 EOM
6801                 case "$d_quad" in
6802                 define)
6803                         cat <<EOM >&4
6804 *** Since you have quads, you could possibly try with -Duse64bitint.
6805 EOM
6806                         ;;
6807                 esac
6808                 cat <<EOM >&4
6809 *** Cannot continue, aborting.
6810
6811 EOM
6812
6813                 exit 1
6814                 ;;
6815         esac
6816         ;;
6817 esac
6818
6819
6820 : determine whether to use malloc wrapping
6821 echo " "
6822 case "$usemallocwrap" in
6823 [yY]*|true|$define)     dflt='y' ;;
6824 [nN]*|false|$undef)     dflt='n' ;;
6825 *)      case "$usedevel" in
6826         [yY]*|true|$define)     dflt='y' ;;
6827         *) dflt='n' ;;
6828         esac
6829         ;;
6830 esac
6831 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6832 . ./myread
6833 usemallocwrap="$ans"
6834 case "$ans" in
6835 y*|true)
6836         usemallocwrap="$define" ;;
6837 *)
6838         usemallocwrap="$undef" ;;
6839 esac
6840
6841 : determine which malloc to compile in
6842 echo " "
6843 case "$usemymalloc" in
6844 [yY]*|true|$define)     dflt='y' ;;
6845 [nN]*|false|$undef)     dflt='n' ;;
6846 *)      case "$ptrsize" in
6847         4) dflt='y' ;;
6848         *) dflt='n' ;;
6849         esac
6850         ;;
6851 esac
6852 rp="Do you wish to attempt to use the malloc that comes with $package?"
6853 . ./myread
6854 usemymalloc="$ans"
6855 case "$ans" in
6856 y*|true)
6857         usemymalloc='y'
6858         mallocsrc='malloc.c'
6859         mallocobj="malloc$_o"
6860         d_mymalloc="$define"
6861         case "$libs" in
6862         *-lmalloc*)
6863                 : Remove malloc from list of libraries to use
6864                 echo "Removing unneeded -lmalloc from library list" >&4
6865                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6866                 shift
6867                 libs="$*"
6868                 echo "libs = $libs" >&4
6869                 ;;
6870         esac
6871         ;;
6872 *)
6873         usemymalloc='n'
6874         mallocsrc=''
6875         mallocobj=''
6876         d_mymalloc="$undef"
6877         ;;
6878 esac
6879
6880 : compute the return types of malloc and free
6881 echo " "
6882 $cat >malloc.c <<END
6883 #$i_malloc I_MALLOC
6884 #$i_stdlib I_STDLIB
6885 #include <stdio.h>
6886 #include <sys/types.h>
6887 #ifdef I_MALLOC
6888 #include <malloc.h>
6889 #endif
6890 #ifdef I_STDLIB
6891 #include <stdlib.h>
6892 #endif
6893 #ifdef TRY_MALLOC
6894 void *malloc();
6895 #endif
6896 #ifdef TRY_FREE
6897 void free();
6898 #endif
6899 END
6900 case "$malloctype" in
6901 '')
6902         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6903                 malloctype='void *'
6904         else
6905                 malloctype='char *'
6906         fi
6907         ;;
6908 esac
6909 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6910
6911 case "$freetype" in
6912 '')
6913         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6914                 freetype='void'
6915         else
6916                 freetype='int'
6917         fi
6918         ;;
6919 esac
6920 echo "Your system uses $freetype free(), it would seem." >&4
6921 $rm -f malloc.[co]
6922 : determine where site specific architecture-dependent libraries go.
6923 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6924 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6925 : sitelib may have an optional trailing /share.
6926 case "$sitearch" in
6927 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6928         dflt="$dflt/$archname"
6929         ;;
6930 *)      dflt="$sitearch"
6931         ;;
6932 esac
6933 set sitearch sitearch none
6934 eval $prefixit
6935 $cat <<EOM
6936
6937 The installation process will also create a directory for
6938 architecture-dependent site-specific extensions and modules.
6939
6940 EOM
6941 fn=d~+
6942 rp='Pathname for the site-specific architecture-dependent library files?'
6943 . ./getfile
6944 prefixvar=sitearch
6945 . ./setprefixvar
6946 if $test X"$sitearch" = X"$sitelib"; then
6947         d_sitearch="$undef"
6948 else
6949         d_sitearch="$define"
6950 fi
6951
6952 : Set the vendorprefix variables
6953 $cat <<EOM
6954
6955 The installation process will also create a directory for
6956 vendor-supplied add-ons.  Vendors who supply perl with their system
6957 may find it convenient to place all vendor-supplied files in this
6958 directory rather than in the main distribution directory.  This will
6959 ease upgrades between binary-compatible maintenance versions of perl.
6960
6961 Of course you may also use these directories in whatever way you see
6962 fit.  For example, you might use them to access modules shared over a
6963 company-wide network.
6964
6965 The default answer should be fine for most people.
6966 This causes further questions about vendor add-ons to be skipped
6967 and no vendor-specific directories will be configured for perl.
6968
6969 EOM
6970 rp='Do you want to configure vendor-specific add-on directories?'
6971 case "$usevendorprefix" in
6972 define|true|[yY]*) dflt=y ;;
6973 *)      : User may have set vendorprefix directly on Configure command line.
6974         case "$vendorprefix" in
6975         ''|' ') dflt=n ;;
6976         *)      dflt=y ;;
6977         esac
6978         ;;
6979 esac
6980 . ./myread
6981 case "$ans" in
6982 [yY]*)  fn=d~+
6983         rp='Installation prefix to use for vendor-supplied add-ons?'
6984         case "$vendorprefix" in
6985         '') dflt='' ;;
6986         *)  dflt=$vendorprefix ;;
6987         esac
6988         . ./getfile
6989         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6990         oldvendorprefix=''
6991         case "$vendorprefix" in
6992         '') ;;
6993         *)      case "$ans" in
6994                 "$prefix") ;;
6995                 *) oldvendorprefix="$prefix";;
6996                 esac
6997                 ;;
6998         esac
6999         usevendorprefix="$define"
7000         vendorprefix="$ans"
7001         vendorprefixexp="$ansexp"
7002         ;;
7003 *)      usevendorprefix="$undef"
7004         vendorprefix=''
7005         vendorprefixexp=''
7006         ;;
7007 esac
7008
7009 : Set the vendorlib variables
7010 case "$vendorprefix" in
7011 '')     d_vendorlib="$undef"
7012         vendorlib=''
7013         vendorlibexp=''
7014         ;;
7015 *)      d_vendorlib="$define"
7016         : determine where vendor-supplied modules go.
7017         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7018         case "$vendorlib" in
7019         '')
7020                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7021                 case "$installstyle" in
7022                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7023                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7024                 esac
7025                 ;;
7026         *)      dflt="$vendorlib"
7027                 ;;
7028         esac
7029         fn=d~+
7030         rp='Pathname for the vendor-supplied library files?'
7031         . ./getfile
7032         vendorlib="$ans"
7033         vendorlibexp="$ansexp"
7034         ;;
7035 esac
7036 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7037 prefixvar=vendorlib
7038 . ./installprefix
7039
7040 : Set the vendorarch variables
7041 case "$vendorprefix" in
7042 '')     d_vendorarch="$undef"
7043         vendorarch=''
7044         vendorarchexp=''
7045         ;;
7046 *)      d_vendorarch="$define"
7047         : determine where vendor-supplied architecture-dependent libraries go.
7048         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7049         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7050         : vendorlib may have an optional trailing /share.
7051         case "$vendorarch" in
7052         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7053                 dflt="$dflt/$archname"
7054                 ;;
7055         *)      dflt="$vendorarch" ;;
7056         esac
7057         fn=d~+
7058         rp='Pathname for vendor-supplied architecture-dependent files?'
7059         . ./getfile
7060         vendorarch="$ans"
7061         vendorarchexp="$ansexp"
7062         ;;
7063 esac
7064 prefixvar=vendorarch
7065 . ./installprefix
7066 if $test X"$vendorarch" = X"$vendorlib"; then
7067         d_vendorarch="$undef"
7068 else
7069         d_vendorarch="$define"
7070 fi
7071
7072 : Final catch-all directories to search
7073 $cat <<EOM
7074
7075 Lastly, you can have perl look in other directories for extensions and
7076 modules in addition to those already specified.
7077 These directories will be searched after 
7078         $sitearch 
7079         $sitelib 
7080 EOM
7081 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7082 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7083 echo ' '
7084 case "$otherlibdirs" in
7085 ''|' ') dflt='none' ;;
7086 *)      dflt="$otherlibdirs" ;;
7087 esac
7088 $cat <<EOM
7089 Enter a colon-separated set of extra paths to include in perl's @INC
7090 search path, or enter 'none' for no extra paths.
7091
7092 EOM
7093
7094 rp='Colon-separated list of additional directories for perl to search?'
7095 . ./myread
7096 case "$ans" in
7097 ' '|''|none)    otherlibdirs=' ' ;;     
7098 *)      otherlibdirs="$ans" ;;
7099 esac
7100 case "$otherlibdirs" in
7101 ' ') val=$undef ;;
7102 *)      val=$define ;;
7103 esac
7104 set d_perl_otherlibdirs
7105 eval $setvar
7106
7107 : Cruising for prototypes
7108 echo " "
7109 echo "Checking out function prototypes..." >&4
7110 $cat >prototype.c <<EOCP
7111 #$i_stdlib I_STDLIB
7112 #ifdef I_STDLIB
7113 #include <stdlib.h>
7114 #endif
7115 int main(int argc, char *argv[]) {
7116         exit(0);}
7117 EOCP
7118 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7119         echo "Your C compiler appears to support function prototypes."
7120         val="$define"
7121 else
7122         echo "Your C compiler doesn't seem to understand function prototypes."
7123         val="$undef"
7124 fi
7125 set prototype
7126 eval $setvar
7127 $rm -f prototype*
7128
7129 : Check if ansi2knr is required
7130 case "$prototype" in
7131 "$define") ;;
7132 *)      ansi2knr='ansi2knr'
7133         echo " "
7134         cat <<EOM >&4
7135
7136 $me:  FATAL ERROR:
7137 This version of $package can only be compiled by a compiler that 
7138 understands function prototypes.  Unfortunately, your C compiler 
7139         $cc $ccflags
7140 doesn't seem to understand them.  Sorry about that.
7141
7142 If GNU cc is available for your system, perhaps you could try that instead.  
7143
7144 Eventually, we hope to support building Perl with pre-ANSI compilers.
7145 If you would like to help in that effort, please contact <perlbug@perl.org>.
7146
7147 Aborting Configure now.
7148 EOM
7149         exit 2
7150         ;;
7151 esac
7152
7153 : DTrace support
7154 dflt_dtrace='/usr/sbin/dtrace'
7155 cat <<EOM
7156
7157 Perl can be built to support DTrace on platforms that support it.
7158 DTrace is a diagnosis and performance analysis tool from Sun.
7159
7160 If this doesn't make any sense to you, just accept the default '$dflt'.
7161 EOM
7162
7163 while $test 1 ; do
7164         case "$usedtrace" in
7165         $define|true|[yY]*)
7166                 dflt='y'
7167                 ;;
7168         ?*)
7169                 dflt='y'
7170                 dflt_dtrace=$usedtrace
7171                 ;;
7172         *)
7173                 dflt='n'
7174                 ;;
7175         esac
7176
7177         rp='Support DTrace if available?'
7178         . ./myread
7179         case "$ans" in
7180         y|Y)    val="$define" ;;
7181         *)      val="$undef" ;;
7182         esac
7183         set usedtrace
7184         eval $setvar
7185
7186         test "X$usedtrace" != "X$define" && break
7187
7188         echo " "
7189         rp='Where is the dtrace executable?'
7190         dflt=$dflt_dtrace
7191         . ./getfile
7192         val="$ans"
7193         set dtrace
7194         eval $setvar
7195
7196         if $test -f $dtrace
7197         then
7198                 if $dtrace -h -s ../perldtrace.d \
7199                         -o perldtrace.tmp >/dev/null 2>&1 \
7200                         && rm -f perldtrace.tmp
7201                 then
7202                         echo " "
7203                         echo "Good: your $dtrace knows about the -h flag."
7204                 else
7205                         cat >&2 <<EOM
7206
7207 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7208 ***
7209 *** Your installed dtrace doesn't support the -h switch to compile a D
7210 *** program into a C header. Can't continue.
7211
7212 EOM
7213                         exit 1
7214                 fi
7215                 break;
7216         fi
7217
7218         case "$fastread" in
7219         yes)
7220                 cat >&2 <<EOM
7221
7222 *** $me:  Fatal Error:  $dtrace not found.
7223 *** Can't continue.
7224
7225 EOM
7226                 exit 1
7227                 ;;
7228         *)
7229                 echo "*** $dtrace was not found."
7230                 echo " "
7231                 ;;
7232         esac
7233 done
7234
7235 : See if we want extra modules installed
7236 echo " "
7237 case "$extras" in
7238 '') dflt='n';;
7239 *) dflt='y';;
7240 esac
7241 cat <<EOM
7242 Perl can be built with extra modules or bundles of modules which
7243 will be fetched from the CPAN and installed alongside Perl.
7244
7245 Notice that you will need access to the CPAN; either via the Internet,
7246 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7247 be asked later to configure the CPAN.pm module which will in turn do
7248 the installation of the rest of the extra modules or bundles.)
7249
7250 Notice also that if the modules require any external software such as
7251 libraries and headers (the libz library and the zlib.h header for the
7252 Compress::Zlib module, for example) you MUST have any such software
7253 already installed, this configuration process will NOT install such
7254 things for you.
7255
7256 If this doesn't make any sense to you, just accept the default '$dflt'.
7257 EOM
7258 rp='Install any extra modules (y or n)?'
7259 . ./myread
7260 case "$ans" in
7261 y|Y)
7262         cat <<EOM
7263
7264 Please list any extra modules or bundles to be installed from CPAN,
7265 with spaces between the names.  The names can be in any format the
7266 'install' command of CPAN.pm will understand.  (Answer 'none',
7267 without the quotes, to install no extra modules or bundles.)
7268 EOM
7269         rp='Extras?'
7270         dflt="$extras"
7271         . ./myread
7272         extras="$ans"
7273 esac
7274 case "$extras" in
7275 ''|'none')
7276         val=''
7277         $rm -f ../extras.lst
7278         ;;
7279 *)      echo "(Saving the list of extras for later...)"
7280         echo "$extras" > ../extras.lst
7281         val="'$extras'"
7282         ;;
7283 esac
7284 set extras
7285 eval $setvar
7286 echo " "
7287
7288 : determine where html pages for programs go
7289 set html1dir html1dir none
7290 eval $prefixit
7291 $cat <<EOM
7292
7293 If you wish to install html files for programs in $spackage, indicate
7294 the appropriate directory here.  To skip installing html files,
7295 answer "none".
7296 EOM
7297 case "$html1dir" in
7298 ''|none|$undef|' ') dflt=none ;;
7299 *) dflt=$html1dir ;;
7300 esac
7301 fn=dn+~
7302 rp="Directory for the main $spackage html pages?"
7303 . ./getfile
7304 prefixvar=html1dir
7305 . ./setprefixvar
7306 : Use ' ' for none so value is preserved next time through Configure
7307 $test X"$html1dir" = "X" && html1dir=' '
7308
7309 : determine where html pages for libraries and modules go
7310 set html3dir html3dir none
7311 eval $prefixit
7312 $cat <<EOM
7313
7314 If you wish to install html files for modules associated with $spackage,
7315 indicate the appropriate directory here.  To skip installing html files,
7316 answer "none".
7317 EOM
7318 : There is no obvious default.  If they have specified html1dir, then
7319 : try to key off that, possibly changing .../html1 into .../html3.
7320 case "$html3dir" in
7321 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7322 *) dflt=$html3dir ;;
7323 esac
7324 fn=dn+~
7325 rp="Directory for the $spackage module html pages?"
7326 . ./getfile
7327 prefixvar=html3dir
7328 . ./setprefixvar
7329 : Use ' ' for none so value is preserved next time through Configure
7330 $test X"$html3dir" = "X" && html3dir=' '
7331
7332 : determine whether to install perl also as /usr/bin/perl
7333
7334 echo " "
7335 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7336         $cat <<EOM
7337 Many scripts expect perl to be installed as /usr/bin/perl.
7338
7339 If you want to, I can install the perl you are about to compile
7340 as /usr/bin/perl (in addition to $bin/perl).
7341 EOM
7342         if test -f /usr/bin/perl; then
7343             $cat <<EOM
7344
7345 However, please note that because you already have a /usr/bin/perl,
7346 overwriting that with a new Perl would very probably cause problems.
7347 Therefore I'm assuming you don't want to do that (unless you insist).
7348
7349 EOM
7350             case "$installusrbinperl" in
7351             "$define"|[yY]*)    dflt='y';;
7352             *)                  dflt='n';;
7353             esac
7354         else
7355             $cat <<EOM
7356
7357 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7358
7359 EOM
7360             case "$installusrbinperl" in
7361             "$undef"|[nN]*)     dflt='n';;
7362             *)                  dflt='y';;
7363             esac
7364         fi
7365         rp="Do you want to install perl as /usr/bin/perl?"
7366         . ./myread
7367         case "$ans" in
7368         [yY]*)  val="$define";;
7369         *)      val="$undef" ;;
7370         esac
7371 else
7372         val="$undef"
7373 fi
7374 set installusrbinperl
7375 eval $setvar
7376
7377 : Check if we are using the GNU C library
7378 echo " "
7379 echo "Checking for GNU C Library..." >&4
7380 cat >try.c <<'EOCP'
7381 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7382    alone are insufficient to distinguish different versions, such as
7383    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7384    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7385 */
7386 #include <stdio.h>
7387 int main(void)
7388 {
7389 #ifdef __GLIBC__
7390 #   ifdef __GLIBC_MINOR__
7391 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7392 #           include <gnu/libc-version.h>
7393             printf("%s\n",  gnu_get_libc_version());
7394 #       else
7395             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7396 #       endif
7397 #   else
7398         printf("%d\n",  __GLIBC__);
7399 #   endif
7400     return 0;
7401 #else
7402     return 1;
7403 #endif
7404 }
7405 EOCP
7406 set try
7407 if eval $compile_ok && $run ./try > glibc.ver; then
7408         val="$define"
7409         gnulibc_version=`$cat glibc.ver`
7410         echo "You are using the GNU C Library version $gnulibc_version"
7411 else
7412         val="$undef"
7413         gnulibc_version=''
7414         echo "You are not using the GNU C Library"
7415 fi
7416 $rm_try glibc.ver
7417 set d_gnulibc
7418 eval $setvar
7419
7420 : see if nm is to be used to determine whether a symbol is defined or not
7421 case "$usenm" in
7422 '')
7423         dflt=''
7424         case "$d_gnulibc" in
7425         "$define")
7426                 echo " "
7427                 echo "nm probably won't work on the GNU C Library." >&4
7428                 dflt=n
7429                 ;;
7430         esac
7431         case "$dflt" in
7432         '') 
7433                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7434                         echo " "
7435                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7436                         echo "'nm' won't be sufficient on this sytem." >&4
7437                         dflt=n
7438                 fi
7439                 ;;
7440         esac
7441         case "$dflt" in
7442         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7443                 if $test $dflt -gt 20; then
7444                         dflt=y
7445                 else
7446                         dflt=n
7447                 fi
7448                 ;;
7449         esac
7450         ;;
7451 *)
7452         case "$usenm" in
7453         true|$define) dflt=y;;
7454         *) dflt=n;;
7455         esac
7456         ;;
7457 esac
7458 $cat <<EOM
7459
7460 I can use $nm to extract the symbols from your C libraries. This
7461 is a time consuming task which may generate huge output on the disk (up
7462 to 3 megabytes) but that should make the symbols extraction faster. The
7463 alternative is to skip the 'nm' extraction part and to compile a small
7464 test program instead to determine whether each symbol is present. If
7465 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7466 this may be the best solution.
7467
7468 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7469
7470 EOM
7471 rp="Shall I use $nm to extract C symbols from the libraries?"
7472 . ./myread
7473 case "$ans" in
7474 [Nn]*) usenm=false;;
7475 *) usenm=true;;
7476 esac
7477
7478 runnm=$usenm
7479 case "$reuseval" in
7480 true) runnm=false;;
7481 esac
7482
7483 : nm options which may be necessary
7484 case "$nm_opt" in
7485 '') if $test -f /mach_boot; then
7486                 nm_opt=''       # Mach
7487         elif $test -d /usr/ccs/lib; then
7488                 nm_opt='-p'     # Solaris (and SunOS?)
7489         elif $test -f /dgux; then
7490                 nm_opt='-p'     # DG-UX
7491         elif $test -f /lib64/rld; then
7492                 nm_opt='-p'     # 64-bit Irix
7493         else
7494                 nm_opt=''
7495         fi;;
7496 esac
7497
7498 : nm options which may be necessary for shared libraries but illegal
7499 : for archive libraries.  Thank you, Linux.
7500 case "$nm_so_opt" in
7501 '')     case "$myuname" in
7502         *linux*|gnu*)
7503                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7504                         nm_so_opt='--dynamic'
7505                 fi
7506                 ;;
7507         esac
7508         ;;
7509 esac
7510
7511 : Figure out where the libc is located
7512 case "$runnm" in
7513 true)
7514 : get list of predefined functions in a handy place
7515 echo " "
7516 case "$libc" in
7517 '') libc=unknown
7518         case "$libs" in
7519         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7520         esac
7521         ;;
7522 esac
7523 case "$libs" in
7524 '') ;;
7525 *)  for thislib in $libs; do
7526         case "$thislib" in
7527         -lc|-lc_s)
7528                 : Handle C library specially below.
7529                 ;;
7530         -l*)
7531                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7532                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7533                         :
7534                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7535                         :
7536                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7537                         :
7538                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7539                         :
7540                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7541                         :
7542                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7543                         :
7544                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7545                         :
7546                 else
7547                         try=''
7548                 fi
7549                 libnames="$libnames $try"
7550                 ;;
7551         *) libnames="$libnames $thislib" ;;
7552         esac
7553         done
7554         ;;
7555 esac
7556 xxx=normal
7557 case "$libc" in
7558 unknown)
7559         set /lib/libc.$so
7560         for xxx in $libpth; do
7561                 $test -r $1 || set $xxx/libc.$so
7562                 : The messy sed command sorts on library version numbers.
7563                 $test -r $1 || \
7564                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7565                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7566                                 h
7567                                 s/[0-9][0-9]*/0000&/g
7568                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7569                                 G
7570                                 s/\n/ /' | \
7571                          $sort | $sed -e 's/^.* //'`
7572                 eval set \$$#
7573         done
7574         $test -r $1 || set /usr/ccs/lib/libc.$so
7575         $test -r $1 || set /lib/libsys_s$_a
7576         ;;
7577 *)
7578         set blurfl
7579         ;;
7580 esac
7581 if $test -r "$1"; then
7582         echo "Your (shared) C library seems to be in $1."
7583         libc="$1"
7584 elif $test -r /lib/libc && $test -r /lib/clib; then
7585         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7586         xxx=apollo
7587         libc='/lib/clib /lib/libc'
7588         if $test -r /lib/syslib; then
7589                 echo "(Your math library is in /lib/syslib.)"
7590                 libc="$libc /lib/syslib"
7591         fi
7592 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7593         echo "Your C library seems to be in $libc, as you said before."
7594 elif $test -r $incpath/usr/lib/libc$_a; then
7595         libc=$incpath/usr/lib/libc$_a;
7596         echo "Your C library seems to be in $libc.  That's fine."
7597 elif $test -r /lib/libc$_a; then
7598         libc=/lib/libc$_a;
7599         echo "Your C library seems to be in $libc.  You're normal."
7600 else
7601         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7602                 :
7603         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7604                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7605         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7606                 :
7607         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7608                 :
7609         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7610                 :
7611         else
7612                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7613         fi
7614         if $test -r "$tans"; then
7615                 echo "Your C library seems to be in $tans, of all places."
7616                 libc=$tans
7617         else
7618                 libc='blurfl'
7619         fi
7620 fi
7621 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7622         dflt="$libc"
7623         cat <<EOM
7624
7625 If the guess above is wrong (which it might be if you're using a strange
7626 compiler, or your machine supports multiple models), you can override it here.
7627
7628 EOM
7629 else
7630         dflt=''
7631         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7632         cat >&4 <<EOM
7633 I can't seem to find your C library.  I've looked in the following places:
7634
7635 EOM
7636         $sed 's/^/      /' libpath
7637         cat <<EOM
7638
7639 None of these seems to contain your C library. I need to get its name...
7640
7641 EOM
7642 fi
7643 fn=f
7644 rp='Where is your C library?'
7645 . ./getfile
7646 libc="$ans"
7647
7648 echo " "
7649 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7650 set X `cat libnames`
7651 shift
7652 xxx=files
7653 case $# in 1) xxx=file; esac
7654 echo "Extracting names from the following $xxx for later perusal:" >&4
7655 echo " "
7656 $sed 's/^/      /' libnames >&4
7657 echo " "
7658 $echo $n "This may take a while...$c" >&4
7659
7660 for file in $*; do
7661         case $file in
7662         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7663         *) $nm $nm_opt $file 2>/dev/null;;
7664         esac
7665 done >libc.tmp
7666
7667 $echo $n ".$c"
7668 $grep fprintf libc.tmp > libc.ptf
7669 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7670 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7671 xxx='[ADTSIW]'
7672 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7673         eval $xscan;\
7674         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7675                 eval $xrun
7676 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7677         eval $xscan;\
7678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7679                 eval $xrun
7680 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7681         eval $xscan;\
7682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7683                 eval $xrun
7684 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7685         eval $xscan;\
7686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7687                 eval $xrun
7688 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7689         eval $xscan;\
7690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7691                 eval $xrun
7692 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7693         eval $xscan;\
7694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7695                 eval $xrun
7696 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7697                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7698         eval $xscan;\
7699         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7700                 eval $xrun
7701 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7702         eval $xscan;\
7703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7704                 eval $xrun
7705 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7706         eval $xscan;\
7707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7708                 eval $xrun
7709 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7710         eval $xscan;\
7711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7712                 eval $xrun
7713 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7714         eval $xscan;\
7715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7716                 eval $xrun
7717 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7718         eval $xscan;\
7719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7720                 eval $xrun
7721 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7722         eval $xscan;\
7723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7724                 eval $xrun
7725 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7726         eval $xscan;\
7727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7728                 eval $xrun
7729 else
7730         $nm -p $* 2>/dev/null >libc.tmp
7731         $grep fprintf libc.tmp > libc.ptf
7732         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7733                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7734         then
7735                 nm_opt='-p'
7736                 eval $xrun
7737         else
7738                 echo " "
7739                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7740                 com=''
7741                 if $ar t $libc > libc.tmp && \
7742                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7743                 then
7744                         for thisname in $libnames $libc; do
7745                                 $ar t $thisname >>libc.tmp
7746                         done
7747                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7748                         echo "Ok." >&4
7749                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7750                         for thisname in $libnames $libc; do
7751                                 $ar tv $thisname >>libc.tmp
7752                                 emximp -o tmp.imp $thisname \
7753                                     2>/dev/null && \
7754                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7755                                     < tmp.imp >>libc.tmp
7756                                 $rm -f tmp.imp
7757                         done
7758                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7759                         echo "Ok." >&4
7760                 else
7761                         echo "$ar didn't seem to work right." >&4
7762                         echo "Maybe this is a Cray...trying bld instead..." >&4
7763                         if  bld t $libc | \
7764                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7765                                 $test -s libc.list
7766                         then
7767                                 for thisname in $libnames; do
7768                                         bld t $libnames | \
7769                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7770                                         $ar t $thisname >>libc.tmp
7771                                 done
7772                                 echo "Ok." >&4
7773                         else
7774                                 echo "That didn't work either.  Giving up." >&4
7775                                 exit 1
7776                         fi
7777                 fi
7778         fi
7779 fi
7780 nm_extract="$com"
7781 case "$PASE" in
7782 define)
7783     echo " "
7784     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7785     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7786     ;;
7787 *)  if $test -f /lib/syscalls.exp; then
7788         echo " "
7789         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7790         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7791                 /lib/syscalls.exp >>libc.list
7792     fi
7793     ;;
7794 esac
7795 ;;
7796 esac
7797 $rm -f libnames libpath
7798
7799 : see if dld is available
7800 set dld.h i_dld
7801 eval $inhdr
7802
7803 : Check if we are using C++
7804 echo " "
7805 echo "Checking for C++..." >&4
7806 $cat >try.c <<'EOCP'
7807 #include <stdio.h>
7808 int main(void)
7809 {
7810 #ifdef __cplusplus
7811     return 0;
7812 #else
7813     return 1;
7814 #endif
7815 }
7816 EOCP
7817 set try
7818 if eval $compile_ok && $run ./try; then
7819         val="$define"
7820         echo "You are using a C++ compiler."
7821 else
7822         val="$undef"
7823         echo "You are not using a C++ compiler."
7824 fi
7825 $rm_try cplusplus$$
7826 set d_cplusplus
7827 eval $setvar
7828
7829 : is a C symbol defined?
7830 csym='tlook=$1;
7831 case "$3" in
7832 -v) tf=libc.tmp; tdc="";;
7833 -a) tf=libc.tmp; tdc="[]";;
7834 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7835 esac;
7836 case "$d_cplusplus" in
7837     $define)    extern_C="extern \"C\"" ;;
7838     *)          extern_C="extern"       ;;
7839 esac;
7840 tx=yes;
7841 case "$reuseval-$4" in
7842 true-) ;;
7843 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7844 esac;
7845 case "$tx" in
7846 yes)
7847         tval=false;
7848         if $test "$runnm" = true; then
7849                 if $contains $tlook $tf >/dev/null 2>&1; then
7850                         tval=true;
7851                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7852                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7853                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7854                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7855                         $rm_try;
7856                 fi;
7857         else
7858                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7859                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7860                 $rm_try;
7861         fi;
7862         ;;
7863 *)
7864         case "$tval" in
7865         $define) tval=true;;
7866         *) tval=false;;
7867         esac;
7868         ;;
7869 esac;
7870 eval "$2=$tval"'
7871
7872 : define an is-in-libc? function
7873 inlibc='echo " "; td=$define; tu=$undef;
7874 sym=$1; var=$2; eval "was=\$$2";
7875 tx=yes;
7876 case "$reuseval$was" in
7877 true) ;;
7878 true*) tx=no;;
7879 esac;
7880 case "$tx" in
7881 yes)
7882         set $sym tres -f;
7883         eval $csym;
7884         case "$tres" in
7885         true)
7886                 echo "$sym() found." >&4;
7887                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7888         *)
7889                 echo "$sym() NOT found." >&4;
7890                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7891         esac;;
7892 *)
7893         case "$was" in
7894         $define) echo "$sym() found." >&4;;
7895         *) echo "$sym() NOT found." >&4;;
7896         esac;;
7897 esac'
7898
7899 : see if dlopen exists
7900 xxx_runnm="$runnm"
7901 xxx_ccflags="$ccflags"
7902 runnm=false
7903 : with g++ one needs -shared to get is-in-libc to work for dlopen
7904 case "$gccversion" in
7905 '')     ;;
7906 *)      case "$d_cplusplus" in
7907         "$define") ccflags="$ccflags -shared" ;;
7908         esac
7909         ;;
7910 esac
7911 set dlopen d_dlopen
7912 eval $inlibc
7913 runnm="$xxx_runnm"
7914 ccflags="$xxx_ccflags"
7915
7916 : see if this is a unistd.h system
7917 set unistd.h i_unistd
7918 eval $inhdr
7919
7920 : determine which dynamic loading, if any, to compile in
7921 echo " "
7922 dldir="ext/DynaLoader"
7923 case "$usedl" in
7924 $define|y|true)
7925         dflt='y'
7926         usedl="$define"
7927         ;;
7928 $undef|n|false)
7929         dflt='n'
7930         usedl="$undef"
7931         ;;
7932 *)
7933         dflt='n'
7934         case "$d_dlopen" in
7935             $define) dflt='y' ;;
7936         esac
7937         case "$i_dld" in
7938             $define) dflt='y' ;;
7939         esac
7940         : Does a dl_xxx.xs file exist for this operating system
7941         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7942         ;;
7943 esac
7944 rp="Do you wish to use dynamic loading?"
7945 . ./myread
7946 usedl="$ans"
7947 bin_ELF="$undef"
7948 case "$ans" in
7949 y*) usedl="$define"
7950         case "$dlsrc" in
7951         '')
7952                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7953                         dflt="$dldir/dl_${osname}.xs"
7954                 elif $test "$d_dlopen" = "$define" ; then
7955                         dflt="$dldir/dl_dlopen.xs"
7956                 elif $test "$i_dld" = "$define" ; then
7957                         dflt="$dldir/dl_dld.xs"
7958                 else
7959                         dflt=''
7960                 fi
7961                 ;;
7962         *)      dflt="$dldir/$dlsrc"
7963                 ;;
7964         esac
7965     echo "The following dynamic loading files are available:"
7966         : Can not go over to $dldir because getfile has path hard-coded in.
7967         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7968         rp="Source file to use for dynamic loading"
7969         fn="fne"
7970         gfpth="$src"
7971         . ./getfile
7972         usedl="$define"
7973         : emulate basename
7974         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7975
7976         $cat << EOM
7977
7978 Some systems may require passing special flags to $cc -c to
7979 compile modules that will be used to create a shared library.
7980 To use no flags, say "none".
7981
7982 EOM
7983     case "$cccdlflags" in
7984     '') case "$gccversion" in
7985                 '') case "$osname" in
7986                         hpux)   dflt='+z' ;;
7987                         next)   dflt='none' ;;
7988                         irix*)  dflt='-KPIC' ;;
7989                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7990                         sunos)  dflt='-pic' ;;
7991                         *)      dflt='none' ;;
7992                     esac
7993                         ;;
7994                 *)  case "$osname" in
7995                         darwin) dflt='none' ;;
7996                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7997                         *)      dflt='-fpic' ;;
7998                     esac ;;
7999             esac ;;
8000         ' ') dflt='none' ;;
8001     *)  dflt="$cccdlflags" ;;
8002     esac
8003     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8004     . ./myread
8005     case "$ans" in
8006     none) cccdlflags=' ' ;;
8007     *) cccdlflags="$ans" ;;
8008     esac
8009
8010     cat << EOM
8011
8012 Some systems use ld to create libraries that can be dynamically loaded,
8013 while other systems (such as those using ELF) use $cc.
8014
8015 EOM
8016         case "$ld" in
8017         '')     $cat >try.c <<EOM
8018 /* Test for whether ELF binaries are produced */
8019 #include <fcntl.h>
8020 #$i_stdlib I_STDLIB
8021 #ifdef I_STDLIB
8022 #include <stdlib.h>
8023 #endif
8024 #$i_unistd I_UNISTD
8025 #ifdef I_UNISTD
8026 #include <unistd.h>
8027 #endif
8028 int main() {
8029         char b[4];
8030         int i = open("a.out",O_RDONLY);
8031         if(i == -1)
8032                 exit(1); /* fail */
8033         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8034                 exit(0); /* succeed (yes, it's ELF) */
8035         else
8036                 exit(1); /* fail */
8037 }
8038 EOM
8039                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8040                         cat <<EOM
8041 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8042 EOM
8043                         dflt="$cc"
8044                         bin_ELF="$define"
8045                 else
8046                         echo "I'll use ld to build dynamic libraries."
8047                         dflt='ld'
8048                 fi
8049                 $rm_try
8050                 ;;
8051         *)      dflt="$ld"
8052                 ;;
8053         esac
8054
8055     rp="What command should be used to create dynamic libraries?"
8056     . ./myread
8057         ld="$ans"
8058
8059     cat << EOM
8060
8061 Some systems may require passing special flags to $ld to create a
8062 library that can be dynamically loaded.  If your ld flags include
8063 -L/other/path options to locate libraries outside your loader's normal
8064 search path, you may need to specify those -L options here as well.  To
8065 use no flags, say "none".
8066
8067 EOM
8068     case "$lddlflags" in
8069     '') case "$osname" in
8070                         beos) dflt='-nostart' ;;
8071                         haiku) dflt='-shared' ;;
8072                         hpux) dflt='-b';
8073                               case "$gccversion" in
8074                               '') dflt="$dflt +vnocompatwarnings" ;;
8075                               esac
8076                               ;;
8077                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8078                         next)  dflt='none' ;;
8079                         solaris) dflt='-G' ;;
8080                         sunos) dflt='-assert nodefinitions' ;;
8081                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8082                 *)     dflt='none' ;;
8083                         esac
8084                         ;;
8085     *) dflt="$lddlflags" ;;
8086     esac
8087
8088         : Try to guess additional flags to pick up local libraries.
8089         : Be careful not to append to a plain 'none'
8090         case "$dflt" in
8091         none) dflt='' ;;
8092         esac
8093         for thisflag in $ldflags; do
8094                 case "$thisflag" in
8095                 -L*|-R*|-Wl,-R*)
8096                         case " $dflt " in
8097                         *" $thisflag "*) ;;
8098                         *) dflt="$dflt $thisflag" ;;
8099                         esac
8100                         ;;
8101                 esac
8102         done
8103
8104         case "$dflt" in
8105         ''|' ') dflt='none' ;;
8106         esac
8107
8108         case "$ldflags" in
8109         *-fstack-protector*)
8110             case "$dflt" in
8111                         *-fstack-protector*) ;; # Don't add it again
8112                         *) dflt="$dflt -fstack-protector" ;; 
8113                 esac
8114                 ;;
8115         esac
8116
8117
8118     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8119     . ./myread
8120     case "$ans" in
8121     none) lddlflags=' ' ;;
8122     *) lddlflags="$ans" ;;
8123     esac
8124
8125         cat <<EOM
8126
8127 Some systems may require passing special flags to $cc to indicate that
8128 the resulting executable will use dynamic linking.  To use no flags,
8129 say "none".
8130
8131 EOM
8132     case "$ccdlflags" in
8133     '') case "$osname" in
8134             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8135             next|sunos) dflt='none' ;;
8136             *)          dflt='none' ;;
8137             esac ;;
8138     ' ')  dflt='none' ;;
8139     *)  dflt="$ccdlflags" ;;
8140     esac
8141     rp="Any special flags to pass to $cc to use dynamic linking?"
8142     . ./myread
8143     case "$ans" in
8144     none) ccdlflags=' ' ;;
8145     *) ccdlflags="$ans" ;;
8146     esac
8147     ;;
8148 *)  usedl="$undef"
8149         ld='ld'
8150     dlsrc='dl_none.xs'
8151     lddlflags=''
8152     ccdlflags=''
8153     ;;
8154 esac
8155
8156 : Do we want a shared libperl?
8157 also=''
8158 case "$usedl" in
8159 $undef)
8160         # No dynamic loading being used, so don't bother even to prompt.
8161         useshrplib='false'
8162         ;;
8163 *)      case "$useshrplib" in
8164         '')     case "$osname" in
8165                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8166                         dflt=y
8167                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8168                         ;;
8169                 next*)
8170                         case "$osvers" in
8171                         4*)     dflt=y
8172                                 also='Building a shared libperl is needed for MAB support.'
8173                                 ;;
8174                         *)      dflt=n
8175                                 ;;
8176                         esac
8177                         ;;
8178                 *)      dflt=n
8179                         ;;
8180                 esac
8181                 ;;
8182         $define|true|[Yy]*)
8183                 dflt=y
8184                 ;;
8185         *)      dflt=n
8186                 ;;
8187         esac
8188         $cat << EOM
8189
8190 The perl executable is normally obtained by linking perlmain.c with
8191 libperl${_a}, any static extensions (usually just DynaLoader), and
8192 any other libraries needed on this system (such as -lm, etc.).  Since
8193 your system supports dynamic loading, it is probably possible to build
8194 a shared libperl.$so.  If you will have more than one executable linked
8195 to libperl.$so, this will significantly reduce the size of each
8196 executable, but it may have a noticeable effect on performance.  The
8197 default is probably sensible for your system.
8198 $also
8199
8200 EOM
8201         rp="Build a shared libperl.$so (y/n)"
8202         . ./myread
8203         case "$ans" in
8204         true|$define|[Yy]*)
8205                 useshrplib='true'  ;;
8206         *)      useshrplib='false' ;;
8207         esac
8208         ;;
8209 esac
8210
8211 case "$useshrplib" in
8212 true)
8213         case "$userelocatableinc" in
8214         true|define)
8215                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8216                 echo "See INSTALL for an explanation why that won't work." >&4
8217                 exit 4
8218                 ;;
8219         esac
8220         case "$libperl" in
8221         '')
8222                 # Figure out a good name for libperl.so.  Since it gets stored in
8223                 # a version-specific architecture-dependent library, the version
8224                 # number isn't really that important, except for making cc/ld happy.
8225                 #
8226                 # A name such as libperl.so.10.1
8227                 majmin="libperl.$so.$patchlevel.$subversion"
8228                 # A name such as libperl.so.100
8229                 majonly=`echo $patchlevel $subversion |
8230                         $awk '{printf "%d%02d", $1, $2}'`
8231                 majonly=libperl.$so.$majonly
8232                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8233                 # rely on figuring it out from the naming of libc.
8234                 case "${osname}${osvers}" in
8235                 next4*)
8236                         dflt=libperl.5.$so
8237                         # XXX How handle the --version stuff for MAB?
8238                         ;;
8239                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8240                         dflt=libperl.$so
8241                         ;;
8242                 cygwin*) # ld links now against the dll directly
8243                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8244                         majonly=`echo $patchlevel $subversion |
8245                                 $awk '{printf "%03d%03d", $1, $2}'`
8246                         majonly=cygperl5.$majonly.$so
8247                         dflt=$majmin
8248                         ;;
8249                 *)      # Try to guess based on whether libc has major.minor.
8250                         case "$libc" in
8251                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8252                         *libc.$so.[0-9]*) dflt=$majonly ;;
8253                         *)      dflt=libperl.$so ;;
8254                         esac
8255                         ;;
8256                 esac
8257                 ;;
8258         *)      dflt=$libperl
8259                 ;;
8260         esac
8261         cat << EOM
8262
8263 I need to select a good name for the shared libperl.  If your system uses
8264 library names with major and minor numbers, then you might want something
8265 like $majmin.  Alternatively, if your system uses a single version
8266 number for shared libraries, then you might want to use $majonly.
8267 Or, your system might be quite happy with a simple libperl.$so.
8268
8269 Since the shared libperl will get installed into a version-specific
8270 architecture-dependent directory, the version number of the shared perl
8271 library probably isn't important, so the default should be o.k.
8272
8273 EOM
8274         rp='What name do you want to give to the shared libperl?'
8275         . ./myread
8276         libperl=$ans
8277         echo "Ok, I'll use $libperl"
8278         ;;
8279 *)
8280         libperl="libperl${_a}"
8281         ;;
8282 esac
8283
8284 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8285 case "$shrpdir" in
8286 '') ;;
8287 *)      $cat >&4 <<EOM
8288 WARNING:  Use of the shrpdir variable for the installation location of
8289 the shared $libperl is not supported.  It was never documented and
8290 will not work in this version.  Let me (perlbug@perl.org)
8291 know of any problems this may cause.
8292
8293 EOM
8294         case "$shrpdir" in
8295         "$archlibexp/CORE")
8296                 $cat >&4 <<EOM
8297 But your current setting of $shrpdir is
8298 the default anyway, so it's harmless.
8299 EOM
8300                 ;;
8301         *)
8302                 $cat >&4 <<EOM
8303 Further, your current attempted setting of $shrpdir
8304 conflicts with the value of $archlibexp/CORE
8305 that installperl will use.
8306 EOM
8307                 ;;
8308         esac
8309         ;;
8310 esac
8311
8312 # How will the perl executable find the installed shared $libperl?
8313 # Add $xxx to ccdlflags.
8314 # If we can't figure out a command-line option, use $shrpenv to
8315 # set env LD_RUN_PATH.  The main perl makefile uses this.
8316 shrpdir=$archlibexp/CORE
8317 xxx=''
8318 tmp_shrpenv=''
8319 if "$useshrplib"; then
8320     case "$osname" in
8321         aix)
8322                 # We'll set it in Makefile.SH...
8323                 ;;
8324         solaris)
8325                 xxx="-R $shrpdir"
8326                 ;;
8327         freebsd|netbsd|openbsd|interix|dragonfly)
8328                 xxx="-Wl,-R$shrpdir"
8329                 ;;
8330         bsdos|linux|irix*|dec_osf|gnu*)
8331                 xxx="-Wl,-rpath,$shrpdir"
8332                 ;;
8333         next)
8334                 # next doesn't like the default...
8335                 ;;
8336         beos)
8337                 # beos doesn't like the default, either.
8338                 ;;
8339         haiku)
8340                 # Haiku doesn't like the default, either.
8341                 ;;
8342         hpux*)
8343                 # hpux doesn't like the default, either.
8344                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8345                 ;;
8346         cygwin)
8347                 # cygwin needs only ldlibpth
8348                 ;;
8349         *)
8350                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8351                 ;;
8352         esac
8353         case "$xxx" in
8354         '') ;;
8355         *)
8356                 # Only add $xxx if it isn't already in ccdlflags.
8357                 case " $ccdlflags " in
8358                 *" $xxx "*)     ;;
8359                 *)      ccdlflags="$ccdlflags $xxx"
8360                         cat <<EOM >&4
8361
8362 Adding $xxx to the flags
8363 passed to $ld so that the perl executable will find the
8364 installed shared $libperl.
8365
8366 EOM
8367                         ;;
8368                 esac
8369                 ;;
8370         esac
8371 fi
8372 # Fix ccdlflags in AIX for building external extensions.
8373 # (For building Perl itself bare -bE:perl.exp is needed,
8374 #  Makefile.SH takes care of this.)
8375 case "$osname" in
8376 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8377 esac
8378 # Respect a hint or command-line value.
8379 case "$shrpenv" in
8380 '') shrpenv="$tmp_shrpenv" ;;
8381 esac
8382 case "$ldlibpthname" in
8383 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8384 none)   ldlibpthname='' ;;
8385 esac
8386
8387 : determine where manual pages are on this system
8388 echo " "
8389 case "$sysman" in
8390 '') 
8391         syspath='/usr/share/man/man1 /usr/man/man1'
8392         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8393         syspath="$syspath /usr/man/u_man/man1"
8394         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8395         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8396         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8397         sysman=`./loc . /usr/man/man1 $syspath`
8398         ;;
8399 esac
8400 if $test -d "$sysman"; then
8401         echo "System manual is in $sysman." >&4
8402 else
8403         echo "Could not find manual pages in source form." >&4
8404 fi
8405
8406 : determine where manual pages go
8407 set man1dir man1dir none
8408 eval $prefixit
8409 $cat <<EOM
8410
8411 $spackage has manual pages available in source form.
8412 EOM
8413 case "$nroff" in
8414 nroff)
8415         echo "However, you don't have nroff, so they're probably useless to you."
8416         case "$man1dir" in
8417         '') man1dir="none";;
8418         esac;;
8419 esac
8420 echo "If you don't want the manual sources installed, answer 'none'."
8421 case "$man1dir" in
8422 ' ') dflt=none
8423         ;;
8424 '')
8425         lookpath="$prefixexp/share/man/man1"
8426         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8427         lookpath="$lookpath $prefixexp/man/p_man/man1"
8428         lookpath="$lookpath $prefixexp/man/u_man/man1"
8429         lookpath="$lookpath $prefixexp/man/man.1"
8430         case "$sysman" in
8431         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8432         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8433         esac
8434         set dflt
8435         eval $prefixup
8436         ;;
8437 *)  dflt="$man1dir"
8438         ;;
8439 esac
8440 echo " "
8441 fn=dn+~
8442 rp="Where do the main $spackage manual pages (source) go?"
8443 . ./getfile
8444 if $test "X$man1direxp" != "X$ansexp"; then
8445         installman1dir=''
8446 fi
8447 prefixvar=man1dir
8448 . ./setprefixvar
8449
8450 case "$man1dir" in
8451 '')     man1dir=' '
8452         installman1dir='';;
8453 esac
8454
8455 : What suffix to use on installed man pages
8456
8457 case "$man1dir" in
8458 ' ')
8459         man1ext='0'
8460         ;;
8461 *)
8462         rp="What suffix should be used for the main $spackage man pages?"
8463         case "$man1ext" in
8464         '')     case "$man1dir" in
8465                 *1)  dflt=1 ;;
8466                 *1p) dflt=1p ;;
8467                 *1pm) dflt=1pm ;;
8468                 *l) dflt=l;;
8469                 *n) dflt=n;;
8470                 *o) dflt=o;;
8471                 *p) dflt=p;;
8472                 *C) dflt=C;;
8473                 *L) dflt=L;;
8474                 *L1) dflt=L1;;
8475                 *) dflt=1;;
8476                 esac
8477                 ;;
8478         *)      dflt="$man1ext";;
8479         esac
8480         . ./myread
8481         man1ext="$ans"
8482         ;;
8483 esac
8484
8485 : see if we can have long filenames
8486 echo " "
8487 first=123456789abcdef
8488 $rm -f $first
8489 if (echo hi >$first) 2>/dev/null; then
8490         if $test -f 123456789abcde; then
8491                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8492                 val="$undef"
8493         else
8494                 echo 'You can have filenames longer than 14 characters.'>&4
8495                 val="$define"
8496         fi
8497 else
8498         $cat <<'EOM'
8499 You can't have filenames longer than 14 chars.
8500 You can't even think about them!
8501 EOM
8502         val="$undef"
8503 fi
8504 set d_flexfnam
8505 eval $setvar
8506 $rm -rf 123456789abcde*
8507
8508 : determine where library module manual pages go
8509 set man3dir man3dir none
8510 eval $prefixit
8511 $cat <<EOM
8512
8513 $spackage has manual pages for many of the library modules.
8514 EOM
8515
8516 case "$nroff" in
8517 nroff)
8518         $cat <<'EOM'
8519 However, you don't have nroff, so they're probably useless to you.
8520 EOM
8521         case "$man3dir" in
8522         '') man3dir="none";;
8523         esac;;
8524 esac
8525
8526 case "$d_flexfnam" in
8527 undef)
8528         $cat <<'EOM'
8529 However, your system can't handle the long file names like File::Basename.3.
8530 EOM
8531         case "$man3dir" in
8532         '') man3dir="none";;
8533         esac;;
8534 esac
8535
8536 echo "If you don't want the manual sources installed, answer 'none'."
8537 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8538 case "$man3dir" in
8539 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8540         if $test -d "$privlib/man/man3"; then
8541                 cat <<EOM >&4
8542
8543 WARNING:  Previous versions of perl installed man3 pages into
8544 $privlib/man/man3.  This version will suggest a
8545 new default of $dflt.
8546 EOM
8547                 tdflt=$dflt
8548                 dflt='n'
8549                 rp='Do you wish to preserve the old behavior?(y/n)'
8550                 . ./myread
8551                 case "$ans" in
8552                 y*) dflt="$privlib/man/man3" ;;
8553                 *)  dflt=$tdflt ;;
8554                 esac
8555     fi
8556         ;;
8557 *)      dflt="$man3dir" ;;
8558 esac
8559 case "$dflt" in
8560 ' ') dflt=none ;;
8561 esac
8562 echo " "
8563 fn=dn+~
8564 rp="Where do the $package library man pages (source) go?"
8565 . ./getfile
8566 prefixvar=man3dir
8567 . ./setprefixvar
8568
8569 case "$man3dir" in
8570 '')     man3dir=' '
8571         installman3dir='';;
8572 esac
8573
8574 : What suffix to use on installed man pages
8575 case "$man3dir" in
8576 ' ')
8577         man3ext='0'
8578         ;;
8579 *)
8580         rp="What suffix should be used for the $package library man pages?"
8581         case "$man3ext" in
8582         '')     case "$man3dir" in
8583                 *3)  dflt=3 ;;
8584                 *3p) dflt=3p ;;
8585                 *3pm) dflt=3pm ;;
8586                 *l) dflt=l;;
8587                 *n) dflt=n;;
8588                 *o) dflt=o;;
8589                 *p) dflt=p;;
8590                 *C) dflt=C;;
8591                 *L) dflt=L;;
8592                 *L3) dflt=L3;;
8593                 *) dflt=3;;
8594                 esac
8595                 ;;
8596         *)      dflt="$man3ext";;
8597         esac
8598         . ./myread
8599         man3ext="$ans"
8600         ;;
8601 esac
8602
8603 : see if we have to deal with yellow pages, now NIS.
8604 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8605         if $test -f /usr/etc/nibindd; then
8606                 echo " "
8607                 echo "I'm fairly confident you're on a NeXT."
8608                 echo " "
8609                 rp='Do you get the hosts file via NetInfo?'
8610                 dflt=y
8611                 case "$hostcat" in
8612                 nidump*) ;;
8613                 '') ;;
8614                 *) dflt=n;;
8615                 esac
8616                 . ./myread
8617                 case "$ans" in
8618                 y*) hostcat='nidump hosts .';;
8619                 *)      case "$hostcat" in
8620                         nidump*) hostcat='';;
8621                         esac
8622                         ;;
8623                 esac
8624         fi
8625         case "$hostcat" in
8626         nidump*) ;;
8627         *)
8628                 case "$hostcat" in
8629                 *ypcat*) dflt=y;;
8630                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8631                                 dflt=y
8632                         else
8633                                 dflt=n
8634                         fi;;
8635                 *) dflt=n;;
8636                 esac
8637                 echo " "
8638                 rp='Are you getting the hosts file via yellow pages?'
8639                 . ./myread
8640                 case "$ans" in
8641                 y*) hostcat='ypcat hosts';;
8642                 *) hostcat='cat /etc/hosts';;
8643                 esac
8644                 ;;
8645         esac
8646 fi
8647 case "$hostcat" in
8648 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8649 esac
8650 case "$groupcat" in
8651 '') test -f /etc/group && groupcat='cat /etc/group';;
8652 esac
8653 case "$passcat" in
8654 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8655 esac
8656
8657 : now get the host name
8658 echo " "
8659 echo "Figuring out host name..." >&4
8660 case "$myhostname" in
8661 '') cont=true
8662         echo 'Maybe "hostname" will work...'
8663         if tans=`sh -c hostname 2>&1` ; then
8664                 myhostname=$tans
8665                 phostname=hostname
8666                 cont=''
8667         fi
8668         ;;
8669 *) cont='';;
8670 esac
8671 if $test "$cont"; then
8672         if ./xenix; then
8673                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8674                 if tans=`cat /etc/systemid 2>&1` ; then
8675                         myhostname=$tans
8676                         phostname='cat /etc/systemid'
8677                         echo "Whadyaknow.  Xenix always was a bit strange..."
8678                         cont=''
8679                 fi
8680         elif $test -r /etc/systemid; then
8681                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8682         fi
8683 fi
8684 if $test "$cont"; then
8685         echo 'No, maybe "uuname -l" will work...'
8686         if tans=`sh -c 'uuname -l' 2>&1` ; then
8687                 myhostname=$tans
8688                 phostname='uuname -l'
8689         else
8690                 echo 'Strange.  Maybe "uname -n" will work...'
8691                 if tans=`sh -c 'uname -n' 2>&1` ; then
8692                         myhostname=$tans
8693                         phostname='uname -n'
8694                 else
8695                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8696                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8697                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8698                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8699                         else
8700                                 case "$myhostname" in
8701                                 '') echo "Does this machine have an identity crisis or something?"
8702                                         phostname='';;
8703                                 *)
8704                                         echo "Well, you said $myhostname before..."
8705                                         phostname='echo $myhostname';;
8706                                 esac
8707                         fi
8708                 fi
8709         fi
8710 fi
8711 case "$myhostname" in
8712 '') myhostname=noname ;;
8713 esac
8714 : you do not want to know about this
8715 set $myhostname
8716 myhostname=$1
8717
8718 : verify guess
8719 if $test "$myhostname" ; then
8720         dflt=y
8721         rp='Your host name appears to be "'$myhostname'".'" Right?"
8722         . ./myread
8723         case "$ans" in
8724         y*) ;;
8725         *) myhostname='';;
8726         esac
8727 fi
8728
8729 : bad guess or no guess
8730 while $test "X$myhostname" = X ; do
8731         dflt=''
8732         rp="Please type the (one word) name of your host:"
8733         . ./myread
8734         myhostname="$ans"
8735 done
8736
8737 : translate upper to lower if necessary
8738 case "$myhostname" in
8739 *[A-Z]*)
8740         echo "(Normalizing case in your host name)"
8741         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8742         ;;
8743 esac
8744
8745 case "$myhostname" in
8746 *.*)
8747         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8748         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8749         echo "(Trimming domain name from host name--host name is now $myhostname)"
8750         ;;
8751 *) case "$mydomain" in
8752         '')
8753                 {
8754                         test "X$hostcat" = "Xypcat hosts" &&
8755                         ypmatch "$myhostname" hosts 2>/dev/null |\
8756                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8757                         $test -s hosts
8758                 } || {
8759                         test "X$hostcat" != "X" &&
8760                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8761                                         /[       ]$myhostname[  . ]/p" > hosts
8762                 }
8763                 tmp_re="[       . ]"
8764                 if $test -f hosts; then
8765                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8766                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8767                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8768                                 hosts | $sort | $uniq | \
8769                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8770                         case `$echo X$dflt` in
8771                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8772                                 dflt=.
8773                                 ;;
8774                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8775                                 ;;
8776                         esac
8777                 else
8778                         echo "(I cannot locate a hosts database anywhere)"
8779                         dflt=.
8780                 fi
8781                 case "$dflt" in
8782                 .)
8783                         tans=`./loc resolv.conf X /etc /usr/etc`
8784                         if $test -f "$tans"; then
8785                                 echo "(Attempting domain name extraction from $tans)"
8786                                 dflt=.`$sed -n -e 's/   / /g' \
8787                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8788                                   -e 1q 2>/dev/null`
8789                                 case "$dflt" in
8790                                 .) dflt=.`$sed -n -e 's/        / /g' \
8791                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8792                                      -e 1q 2>/dev/null`
8793                                         ;;
8794                                 esac
8795                         fi
8796                         ;;
8797                 esac
8798                 case "$dflt" in
8799                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8800                         dflt=.`sh -c domainname 2>/dev/null`
8801                         case "$dflt" in
8802                         '') dflt='.';;
8803                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8804                         esac
8805                         ;;
8806                 esac
8807                 case "$dflt$osname" in
8808                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8809                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8810                         ;;
8811                 esac
8812                 case "$dflt" in
8813                 .) echo "(Lost all hope -- silly guess then)"
8814                         dflt='.nonet'
8815                         ;;
8816                 esac
8817                 $rm -f hosts
8818                 ;;
8819         *) dflt="$mydomain";;
8820         esac;;
8821 esac
8822 echo " "
8823 rp="What is your domain name?"
8824 . ./myread
8825 tans="$ans"
8826 case "$ans" in
8827 '') ;;
8828 .*) ;;
8829 *) tans=".$tans";;
8830 esac
8831 mydomain="$tans"
8832
8833 : translate upper to lower if necessary
8834 case "$mydomain" in
8835 *[A-Z]*)
8836         echo "(Normalizing case in your domain name)"
8837         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8838         ;;
8839 esac
8840
8841 : a little sanity check here
8842 case "$phostname" in
8843 '') ;;
8844 *)
8845         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8846         $myhostname$mydomain|$myhostname) ;;
8847         *)
8848                 case "$phostname" in
8849                 sed*)
8850                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8851                         ;;
8852                 *)
8853                         echo "(That doesn't agree with your $phostname command, by the way.)"
8854                         ;;
8855                 esac
8856         ;;
8857         esac
8858         ;;
8859 esac
8860
8861 : determine the e-mail address of the user who is running us
8862 $cat <<EOM
8863
8864 I need to get your e-mail address in Internet format if possible, i.e.
8865 something like user@host.domain. Please answer accurately since I have
8866 no easy means to double check it. The default value provided below
8867 is most probably close to reality but may not be valid from outside
8868 your organization...
8869
8870 EOM
8871 cont=x
8872 while test "$cont"; do
8873         case "$cf_email" in
8874         '') dflt="$cf_by@$myhostname$mydomain";;
8875         *) dflt="$cf_email";;
8876         esac
8877         rp='What is your e-mail address?'
8878         . ./myread
8879         cf_email="$ans"
8880         case "$cf_email" in
8881         *@*.*) cont='' ;;
8882         *)
8883                 rp='Address does not look like an Internet one.  Use it anyway?'
8884                 case "$fastread" in
8885                 yes) dflt=y ;;
8886                 *) dflt=n ;;
8887                 esac
8888                 . ./myread
8889                 case "$ans" in
8890                 y*) cont='' ;;
8891                 *) echo " " ;;
8892                 esac
8893                 ;;
8894         esac
8895 done
8896
8897 : Ask e-mail of administrator
8898 $cat <<EOM
8899
8900 If you or somebody else will be maintaining perl at your site, please
8901 fill in the correct e-mail address here so that they may be contacted
8902 if necessary. Currently, the "perlbug" program included with perl
8903 will send mail to this address in addition to perlbug@perl.org. You may
8904 enter "none" for no administrator.
8905
8906 EOM
8907 case "$perladmin" in
8908 '') dflt="$cf_email";;
8909 *) dflt="$perladmin";;
8910 esac
8911 rp='Perl administrator e-mail address'
8912 . ./myread
8913 perladmin="$ans"
8914
8915 : determine whether to only install version-specific parts.
8916 echo " "
8917 $cat <<EOM
8918 Do you want to install only the version-specific parts of the perl
8919 distribution?  Usually you do *not* want to do this.
8920 EOM
8921 case "$versiononly" in
8922 "$define"|[Yy]*|true) dflt='y' ;;
8923 *) dflt='n';
8924 esac
8925 rp="Do you want to install only the version-specific parts of perl?"
8926 . ./myread
8927 case "$ans" in
8928 [yY]*)  val="$define";;
8929 *)      val="$undef" ;;
8930 esac
8931 set versiononly
8932 eval $setvar
8933
8934 case "$versiononly" in
8935 "$define") inc_version_list=''
8936            inc_version_list_init=0
8937            ;;
8938 esac
8939
8940 : figure out how to guarantee perl startup
8941 : XXX Note that this currently takes advantage of the bug that binexp ignores
8942 :     the Configure -Dinstallprefix setting, which in turn means that under
8943 :     relocatable @INC, initialinstalllocation is what binexp started as.
8944 case "$startperl" in
8945 '')
8946         case "$sharpbang" in
8947         *!)
8948                 $cat <<EOH
8949
8950 I can use the #! construct to start perl on your system. This will
8951 make startup of perl scripts faster, but may cause problems if you
8952 want to share those scripts and perl is not in a standard place
8953 ($initialinstalllocation/perl) on all your platforms. The alternative
8954 is to force a shell by starting the script with a single ':' character.
8955
8956 EOH
8957                 case "$versiononly" in
8958                 "$define")      dflt="$initialinstalllocation/perl$version";;
8959                 *)              dflt="$initialinstalllocation/perl";;
8960                 esac
8961                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8962                 . ./myread
8963                 case "$ans" in
8964                 none)   startperl=": # use perl";;
8965                 *)      startperl="#!$ans"
8966                         if $test 30 -lt `echo "$ans" | wc -c`; then
8967                                 $cat >&4 <<EOM
8968
8969 WARNING:  Some systems limit the #! command to 32 characters.
8970 If you experience difficulty running Perl scripts with #!, try
8971 installing Perl in a directory with a shorter pathname.
8972
8973 EOM
8974                         fi ;;
8975                 esac
8976                 ;;
8977         *) startperl=": # use perl"
8978                 ;;
8979         esac
8980         ;;
8981 esac
8982 echo "I'll use $startperl to start perl scripts."
8983
8984 : figure best path for perl in scripts
8985 case "$perlpath" in
8986 '')
8987         case "$versiononly" in
8988         "$define")      perlpath="$initialinstalllocation/perl$version";;
8989         *)              perlpath="$initialinstalllocation/perl";;
8990         esac
8991         case "$startperl" in
8992         *!*) ;;
8993         *)
8994                 $cat <<EOH
8995
8996 I will use the "eval 'exec'" idiom to start Perl on your system.
8997 I can use the full path of your Perl binary for this purpose, but
8998 doing so may cause problems if you want to share those scripts and
8999 Perl is not always in a standard place ($initialinstalllocation/perl).
9000
9001 EOH
9002                 dflt="$initialinstalllocation/perl"
9003                 rp="What path shall I use in \"eval 'exec'\"?"
9004                 . ./myread
9005                 perlpath="$ans"
9006                 ;;
9007         esac
9008         ;;
9009 esac
9010 case "$startperl" in
9011 *!*)    ;;
9012 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9013 esac
9014
9015 : determine where public executable scripts go
9016 set scriptdir scriptdir
9017 eval $prefixit
9018 case "$scriptdir" in
9019 '')
9020         dflt="$bin"
9021         : guess some guesses
9022         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9023         $test -d /usr/share/bin     && dflt=/usr/share/bin
9024         $test -d /usr/local/script  && dflt=/usr/local/script
9025         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9026         $test -d $prefixexp/script  && dflt=$prefixexp/script
9027         set dflt
9028         eval $prefixup
9029         ;;
9030 *)  dflt="$scriptdir"
9031         ;;
9032 esac
9033 $cat <<EOM
9034
9035 Some installations have a separate directory just for executable scripts so
9036 that they can mount it across multiple architectures but keep the scripts in
9037 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9038 Or you might just lump your scripts in with all your other executables.
9039
9040 EOM
9041 fn=d~
9042 rp='Where do you keep publicly executable scripts?'
9043 . ./getfile
9044 if $test "X$ansexp" != "X$scriptdirexp"; then
9045         installscript=''
9046 fi
9047 installscriptdir=''
9048 prefixvar=scriptdir
9049 . ./setprefixvar
9050 : A little fix up for an irregularly named variable.
9051 installscript="$installscriptdir"
9052
9053 : determine where add-on public executables go
9054 case "$sitebin" in
9055 '')     dflt=$siteprefix/bin ;;
9056 *)      dflt=$sitebin ;;
9057 esac
9058 fn=d~
9059 rp='Pathname where the add-on public executables should be installed?'
9060 . ./getfile
9061 prefixvar=sitebin
9062 . ./setprefixvar
9063
9064 : determine where add-on html pages go
9065 : There is no standard location, so try to copy the previously-selected
9066 : directory structure for the core html pages.
9067 case "$sitehtml1dir" in
9068 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9069 *)     dflt=$sitehtml1dir ;;
9070 esac
9071 case "$dflt" in
9072 ''|' ') dflt=none ;;
9073 esac
9074 fn=dn+~
9075 rp='Pathname where the site-specific html pages should be installed?'
9076 . ./getfile
9077 prefixvar=sitehtml1dir
9078 . ./setprefixvar
9079
9080 : determine where add-on library html pages go
9081 : There is no standard location, so try to copy the previously-selected
9082 : directory structure for the core html pages.
9083 case "$sitehtml3dir" in
9084 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9085 *)     dflt=$sitehtml3dir ;;
9086 esac
9087 case "$dflt" in
9088 ''|' ') dflt=none ;;
9089 esac
9090 fn=dn+~
9091 rp='Pathname where the site-specific library html pages should be installed?'
9092 . ./getfile
9093 prefixvar=sitehtml3dir
9094 . ./setprefixvar
9095
9096 : determine where add-on manual pages go
9097 case "$siteman1dir" in
9098 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9099 *)      dflt=$siteman1dir ;;
9100 esac
9101 case "$dflt" in
9102 ''|' ') dflt=none ;;
9103 esac
9104 fn=dn+~
9105 rp='Pathname where the site-specific manual pages should be installed?'
9106 . ./getfile
9107 prefixvar=siteman1dir
9108 . ./setprefixvar
9109
9110 : determine where add-on library man pages go
9111 case "$siteman3dir" in
9112 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9113 *)      dflt=$siteman3dir ;;
9114 esac
9115 case "$dflt" in
9116 ''|' ') dflt=none ;;
9117 esac
9118 fn=dn+~
9119 rp='Pathname where the site-specific library manual pages should be installed?'
9120 . ./getfile
9121 prefixvar=siteman3dir
9122 . ./setprefixvar
9123
9124 : determine where add-on public executable scripts go
9125 case "$sitescript" in
9126 '')     dflt=$siteprefix/script
9127         $test -d $dflt || dflt=$sitebin ;;
9128 *)  dflt="$sitescript" ;;
9129 esac
9130 fn=d~+
9131 rp='Pathname where add-on public executable scripts should be installed?'
9132 . ./getfile
9133 prefixvar=sitescript
9134 . ./setprefixvar
9135
9136 : Check if faststdio is requested and available
9137 case "$usefaststdio" in
9138 $define|true|[yY]*|'')
9139         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9140         case "$xversion" in
9141         [68])   dflt='y' ;;
9142         *)      dflt='n' ;;
9143         esac
9144         ;;
9145 *) dflt='n';;
9146 esac
9147 cat <<EOM
9148
9149 Perl can be built to use 'fast stdio', which means using the stdio
9150 library but also directly manipulating the stdio buffers to enable
9151 faster I/O.  Using stdio is better for backward compatibility (especially
9152 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9153 interface has been preferred instead of stdio.
9154
9155 If this doesn't make any sense to you, just accept the default '$dflt'.
9156 EOM
9157 rp='Use the "fast stdio" if available?'
9158 . ./myread
9159 case "$ans" in
9160 y|Y)    val="$define" ;;
9161 *)      val="$undef" ;;
9162 esac
9163 set usefaststdio
9164 eval $setvar
9165
9166
9167 : define an is-a-typedef? function
9168 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9169 case "$inclist" in
9170 "") inclist="sys/types.h";;
9171 esac;
9172 eval "varval=\$$var";
9173 case "$varval" in
9174 "")
9175         $rm -f temp.c;
9176         for inc in $inclist; do
9177                 echo "#include <$inc>" >>temp.c;
9178         done;
9179         echo "#ifdef $type" >> temp.c;
9180         echo "printf(\"We have $type\");" >> temp.c;
9181         echo "#endif" >> temp.c;
9182         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9183         if $contains $type temp.E >/dev/null 2>&1; then
9184                 eval "$var=\$type";
9185         else
9186                 eval "$var=\$def";
9187         fi;
9188         $rm -f temp.?;;
9189 *) eval "$var=\$varval";;
9190 esac'
9191
9192 : define an is-a-typedef? function that prompts if the type is not available.
9193 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9194 case "$inclist" in
9195 "") inclist="sys/types.h";;
9196 esac;
9197 eval "varval=\$$var";
9198 case "$varval" in
9199 "")
9200         $rm -f temp.c;
9201         for inc in $inclist; do
9202                 echo "#include <$inc>" >>temp.c;
9203         done;
9204         echo "#ifdef $type" >> temp.c;
9205         echo "printf(\"We have $type\");" >> temp.c;
9206         echo "#endif" >> temp.c;
9207         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9208         echo " " ;
9209         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9210         if $contains $type temp.E >/dev/null 2>&1; then
9211                 echo "$type found." >&4;
9212                 eval "$var=\$type";
9213         else
9214                 echo "$type NOT found." >&4;
9215                 dflt="$def";
9216                 . ./myread ;
9217                 eval "$var=\$ans";
9218         fi;
9219         $rm -f temp.?;;
9220 *) eval "$var=\$varval";;
9221 esac'
9222
9223 : see what type lseek is declared as in the kernel
9224 rp="What is the type used for lseek's offset on this system?"
9225 set off_t lseektype long stdio.h sys/types.h
9226 eval $typedef_ask
9227
9228 echo " "
9229 echo "Checking to see how big your file offsets are..." >&4
9230 $cat >try.c <<EOCP
9231 #include <sys/types.h>
9232 #include <stdio.h>
9233 int main()
9234 {
9235     printf("%d\n", (int)sizeof($lseektype));
9236     return(0);
9237 }
9238 EOCP
9239 set try
9240 if eval $compile_ok; then
9241         lseeksize=`$run ./try`
9242         echo "Your file offsets are $lseeksize bytes long."
9243 else
9244         dflt=$longsize
9245         echo " "
9246         echo "(I can't seem to compile the test program.  Guessing...)"
9247         rp="What is the size of your file offsets (in bytes)?"
9248         . ./myread
9249         lseeksize="$ans"
9250 fi
9251 $rm_try
9252
9253 : see what type file positions are declared as in the library
9254 rp="What is the type for file position used by fsetpos()?"
9255 set fpos_t fpostype long stdio.h sys/types.h
9256 eval $typedef_ask
9257
9258 : Check size for Fpos_t
9259 echo " "
9260 case "$fpostype" in
9261 *_t) zzz="$fpostype"    ;;
9262 *)   zzz="fpos_t"       ;;
9263 esac
9264 echo "Checking the size of $zzz..." >&4
9265 cat > try.c <<EOCP
9266 #include <sys/types.h>
9267 #include <stdio.h>
9268 #$i_stdlib I_STDLIB
9269 #ifdef I_STDLIB
9270 #include <stdlib.h>
9271 #endif
9272 int main() {
9273     printf("%d\n", (int)sizeof($fpostype));
9274     exit(0);
9275 }
9276 EOCP
9277 set try
9278 if eval $compile_ok; then
9279         yyy=`$run ./try`
9280         case "$yyy" in
9281         '')     fpossize=4
9282                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9283                 ;;
9284         *)      fpossize=$yyy
9285                 echo "Your $zzz is $fpossize bytes long."
9286                 ;;
9287         esac
9288 else
9289         dflt="$longsize"
9290         echo " " >&4
9291         echo "(I can't compile the test program.  Guessing...)" >&4
9292         rp="What is the size of your file positions (in bytes)?"
9293         . ./myread
9294         fpossize="$ans"
9295 fi
9296
9297 : Check for large file support
9298 # Backward compatibility (uselfs is deprecated).
9299 case "$uselfs" in
9300 "$define"|true|[yY]*)
9301         cat <<EOM >&4
9302
9303 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9304 EOM
9305         uselargefiles="$define"
9306         ;;
9307 esac
9308
9309 case "$lseeksize:$fpossize" in
9310 8:8) cat <<EOM
9311
9312 You can have files larger than 2 gigabytes.
9313 EOM
9314    val="$define" ;;
9315 *)    case "$uselargefiles" in
9316    "$undef"|false|[nN]*) dflt='n' ;;
9317    *)   dflt='y' ;;
9318    esac
9319    cat <<EOM
9320
9321 Perl can be built to understand large files (files larger than 2 gigabytes)
9322 on some systems.  To do so, Configure can be run with -Duselargefiles.
9323
9324 If this doesn't make any sense to you, just accept the default '$dflt'.
9325 EOM
9326    rp='Try to understand large files, if available?'
9327    . ./myread
9328    case "$ans" in
9329    y|Y)         val="$define" ;;
9330    *)           val="$undef"  ;;
9331    esac
9332    ;;
9333 esac
9334 set uselargefiles
9335 eval $setvar
9336 : Look for a hint-file generated 'call-back-unit'.  If the
9337 : user has specified that a large files perl is to be built,
9338 : we may need to set or change some other defaults.
9339 if $test -f uselargefiles.cbu; then
9340         echo "Your platform has some specific hints regarding large file builds, using them..."
9341         . ./uselargefiles.cbu
9342 fi
9343 case "$uselargefiles" in
9344 "$define")
9345         if $test -f uselargefiles.cbu; then
9346                 echo " "
9347                 echo "Rechecking to see how big your file offsets are..." >&4
9348                 $cat >try.c <<EOCP
9349 #include <sys/types.h>
9350 #include <stdio.h>
9351 int main()
9352 {
9353     printf("%d\n", (int)sizeof($lseektype));
9354     return(0);
9355 }
9356 EOCP
9357                 set try
9358                 if eval $compile_ok; then
9359                         lseeksize=`$run ./try`
9360                         $echo "Your file offsets are now $lseeksize bytes long."
9361                 else
9362                         dflt="$lseeksize"
9363                         echo " "
9364                         echo "(I can't seem to compile the test program.  Guessing...)"
9365                         rp="What is the size of your file offsets (in bytes)?"
9366                         . ./myread
9367                         lseeksize="$ans"
9368                 fi
9369                 case "$fpostype" in
9370                 *_t) zzz="$fpostype"    ;;
9371                 *)   zzz="fpos_t"       ;;
9372                 esac
9373                 $echo $n "Rechecking the size of $zzz...$c" >&4
9374                 $cat > try.c <<EOCP
9375 #include <sys/types.h>
9376 #include <stdio.h>
9377 #$i_stdlib I_STDLIB
9378 #ifdef I_STDLIB
9379 #include <stdlib.h>
9380 #endif
9381 int main() {
9382     printf("%d\n", (int)sizeof($fpostype));
9383     return(0);
9384 }
9385 EOCP
9386                 set try
9387                 if eval $compile_ok; then
9388                         yyy=`$run ./try`
9389                         dflt="$lseeksize"
9390                         case "$yyy" in
9391                         '')     echo " "
9392                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9393                                 ;;
9394                         *)      fpossize=$yyy
9395                                 echo " $fpossize bytes." >&4
9396                                 ;;
9397                         esac
9398                 else
9399                         dflt="$fpossize"
9400                         echo " "
9401                         echo "(I can't compile the test program.  Guessing...)" >&4
9402                         rp="What is the size of your file positions (in bytes)?"
9403                         . ./myread
9404                         fpossize="$ans"
9405                 fi
9406                 $rm_try
9407         fi
9408         ;;
9409 esac
9410
9411 : Set the vendorbin variables
9412 case "$vendorprefix" in
9413 '')     d_vendorbin="$undef"
9414         vendorbin=''
9415         vendorbinexp=''
9416         ;;
9417 *)      d_vendorbin="$define"
9418         : determine where vendor-supplied executables go.
9419         case "$vendorbin" in
9420         '') dflt=$vendorprefix/bin ;;
9421         *)      dflt="$vendorbin" ;;
9422         esac
9423         fn=d~+
9424         rp='Pathname for the vendor-supplied executables directory?'
9425         . ./getfile
9426         vendorbin="$ans"
9427         vendorbinexp="$ansexp"
9428         ;;
9429 esac
9430 prefixvar=vendorbin
9431 . ./installprefix
9432
9433 : Set the vendorhtml1dir variables
9434 case "$vendorprefix" in
9435 '')     vendorhtml1dir=''
9436         vendorhtml1direxp=''
9437         ;;
9438 *)      : determine where vendor-supplied html pages go.
9439         : There is no standard location, so try to copy the previously-selected
9440         : directory structure for the core html pages.
9441         : XXX Better default suggestions would be welcome.
9442         case "$vendorhtml1dir" in
9443         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9444         *)      dflt=$vendorhtml1dir ;;
9445         esac
9446         case "$dflt" in
9447         ''|' ') dflt=none ;;
9448         esac
9449         fn=dn+~
9450         rp='Pathname for the vendor-supplied html pages?'
9451         . ./getfile
9452         vendorhtml1dir="$ans"
9453         vendorhtml1direxp="$ansexp"
9454         ;;
9455 esac
9456 : Use ' ' for none so value is preserved next time through Configure
9457 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9458 prefixvar=vendorhtml1dir
9459 . ./installprefix
9460
9461 : Set the vendorhtml3dir variables
9462 case "$vendorprefix" in
9463 '')     vendorhtml3dir=''
9464         vendorhtml3direxp=''
9465         ;;
9466 *)      : determine where vendor-supplied module html pages go.
9467         : There is no standard location, so try to copy the previously-selected
9468         : directory structure for the core html pages.
9469         : XXX Better default suggestions would be welcome.
9470         case "$vendorhtml3dir" in
9471         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9472         *)      dflt=$vendorhtml3dir ;;
9473         esac
9474         case "$dflt" in
9475         ''|' ') dflt=none ;;
9476         esac
9477         fn=dn+~
9478         rp='Pathname for the vendor-supplied html pages?'
9479         . ./getfile
9480         vendorhtml3dir="$ans"
9481         vendorhtml3direxp="$ansexp"
9482         ;;
9483 esac
9484 : Use ' ' for none so value is preserved next time through Configure
9485 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9486 prefixvar=vendorhtml3dir
9487 . ./installprefix
9488
9489 : Set the vendorman1dir variables
9490 case "$vendorprefix" in
9491 '')     vendorman1dir=''
9492         vendorman1direxp=''
9493         ;;
9494 *)      : determine where vendor-supplied manual pages go.
9495         case "$vendorman1dir" in
9496         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9497         *)      dflt=$vendorman1dir ;;
9498         esac
9499         case "$dflt" in
9500         ''|' ') dflt=none ;;
9501         esac
9502         fn=nd~+
9503         rp='Pathname for the vendor-supplied manual section 1 pages?'
9504         . ./getfile
9505         vendorman1dir="$ans"
9506         vendorman1direxp="$ansexp"
9507         ;;
9508 esac
9509 : Use ' ' for none so value is preserved next time through Configure
9510 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9511 prefixvar=vendorman1dir
9512 . ./installprefix
9513
9514 : Set the vendorman3dir variables
9515 case "$vendorprefix" in
9516 '')     vendorman3dir=''
9517         vendorman3direxp=''
9518         ;;
9519 *)      : determine where vendor-supplied module manual pages go.
9520         case "$vendorman3dir" in
9521         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9522         *)      dflt=$vendorman3dir ;;
9523         esac
9524         case "$dflt" in
9525         ''|' ') dflt=none ;;
9526         esac
9527         fn=nd~+
9528         rp='Pathname for the vendor-supplied manual section 3 pages?'
9529         . ./getfile
9530         vendorman3dir="$ans"
9531         vendorman3direxp="$ansexp"
9532         ;;
9533 esac
9534 : Use ' ' for none so value is preserved next time through Configure
9535 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9536 prefixvar=vendorman3dir
9537 . ./installprefix
9538
9539 : Set the vendorscript variables
9540 case "$vendorprefix" in
9541 '')     d_vendorscript="$undef"
9542         vendorscript=''
9543         vendorscriptexp=''
9544         ;;
9545 *)      d_vendorscript="$define"
9546         : determine where vendor-supplied scripts go.
9547         case "$vendorscript" in
9548         '')     dflt=$vendorprefix/script
9549                 $test -d $dflt || dflt=$vendorbin ;;
9550         *)  dflt="$vendorscript" ;;
9551         esac
9552         $cat <<EOM
9553
9554 The installation process will create a directory for
9555 vendor-supplied scripts.
9556
9557 EOM
9558         fn=d~+
9559         rp='Pathname for the vendor-supplied scripts directory?'
9560         . ./getfile
9561         vendorscript="$ans"
9562         vendorscriptexp="$ansexp"
9563         ;;
9564 esac
9565 prefixvar=vendorscript
9566 . ./installprefix
9567
9568 : script used to emit important warnings
9569 cat >warn <<EOS
9570 $startsh
9571 if test \$# -gt 0; then
9572         echo "\$@" >msg
9573 else
9574         cat >msg
9575 fi
9576 echo "*** WARNING:" >&4
9577 sed -e 's/^/*** /' <msg >&4
9578 echo "*** " >&4
9579 cat msg >>config.msg
9580 echo " " >>config.msg
9581 rm -f msg
9582 EOS
9583 chmod +x warn
9584 $eunicefix warn
9585
9586 : see which of string.h or strings.h is needed
9587 echo " "
9588 strings=`./findhdr string.h`
9589 if $test "$strings" && $test -r "$strings"; then
9590         echo "Using <string.h> instead of <strings.h>." >&4
9591         val="$define"
9592 else
9593         val="$undef"
9594         strings=`./findhdr strings.h`
9595         if $test "$strings" && $test -r "$strings"; then
9596                 echo "Using <strings.h> instead of <string.h>." >&4
9597         else
9598                 ./warn "No string header found -- You'll surely have problems."
9599         fi
9600 fi
9601 set i_string
9602 eval $setvar
9603 case "$i_string" in
9604 "$undef") strings=`./findhdr strings.h`;;
9605 *)        strings=`./findhdr string.h`;;
9606 esac
9607
9608 : see if qgcvt exists
9609 set qgcvt d_qgcvt
9610 eval $inlibc
9611
9612 : Check print/scan long double stuff
9613 echo " "
9614
9615 if $test X"$d_longdbl" = X"$define"; then
9616
9617 echo "Checking how to print long doubles..." >&4
9618
9619 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9620         $cat >try.c <<'EOCP'
9621 #include <sys/types.h>
9622 #include <stdio.h>
9623 int main() {
9624   double d = 123.456;
9625   printf("%.3f\n", d);
9626 }
9627 EOCP
9628         set try
9629         if eval $compile; then
9630                 yyy=`$run ./try`
9631                 case "$yyy" in
9632                 123.456)
9633                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9634                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9635                         echo "We will use %f."
9636                         ;;
9637                 esac
9638         fi
9639 fi
9640
9641 if $test X"$sPRIfldbl" = X; then
9642         $cat >try.c <<'EOCP'
9643 #include <sys/types.h>
9644 #include <stdio.h>
9645 int main() {
9646   long double d = 123.456;
9647   printf("%.3Lf\n", d);
9648 }
9649 EOCP
9650         set try
9651         if eval $compile; then
9652                 yyy=`$run ./try`
9653                 case "$yyy" in
9654                 123.456)
9655                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9656                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9657                         echo "We will use %Lf."
9658                         ;;
9659                 esac
9660         fi
9661 fi
9662
9663 if $test X"$sPRIfldbl" = X; then
9664         $cat >try.c <<'EOCP'
9665 #include <sys/types.h>
9666 #include <stdio.h>
9667 int main() {
9668   long double d = 123.456;
9669   printf("%.3llf\n", d);
9670 }
9671 EOCP
9672         set try
9673         if eval $compile; then
9674                 yyy=`$run ./try`
9675                 case "$yyy" in
9676                 123.456)
9677                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9678                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9679                         echo "We will use %llf."
9680                         ;;
9681                 esac
9682         fi
9683 fi
9684
9685 if $test X"$sPRIfldbl" = X; then
9686         $cat >try.c <<'EOCP'
9687 #include <sys/types.h>
9688 #include <stdio.h>
9689 int main() {
9690   long double d = 123.456;
9691   printf("%.3lf\n", d);
9692 }
9693 EOCP
9694         set try
9695         if eval $compile; then
9696                 yyy=`$run ./try`
9697                 case "$yyy" in
9698                 123.456)
9699                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9700                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9701                         echo "We will use %lf."
9702                         ;;
9703                 esac
9704         fi
9705 fi
9706
9707 if $test X"$sPRIfldbl" = X; then
9708         echo "Cannot figure out how to print long doubles." >&4
9709 else
9710         sSCNfldbl=$sPRIfldbl    # expect consistency
9711 fi
9712
9713 $rm_try
9714
9715 fi # d_longdbl
9716
9717 case "$sPRIfldbl" in
9718 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9719         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9720         d_SCNfldbl="$undef";
9721         ;;
9722 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9723         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9724         d_SCNfldbl="$define";
9725         ;;
9726 esac
9727
9728 : Check how to convert floats to strings.
9729
9730 if test "X$d_Gconvert" = X; then
9731
9732 echo " "
9733 echo "Checking for an efficient way to convert floats to strings."
9734 echo " " > try.c
9735 case "$uselongdouble" in
9736 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9737 esac
9738 case "$d_longdbl" in
9739 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9740 esac
9741 case "$d_PRIgldbl" in
9742 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9743 esac
9744 $cat >>try.c <<EOP
9745 #ifdef TRY_gconvert
9746 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9747 char *myname = "gconvert";
9748 #endif
9749 #ifdef TRY_gcvt
9750 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9751 char *myname = "gcvt";
9752 #endif
9753 #ifdef TRY_qgcvt
9754 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9755 char *myname = "qgcvt";
9756 #define DOUBLETYPE long double
9757 #endif
9758 #ifdef TRY_sprintf
9759 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9760 #ifdef HAS_PRIgldbl
9761 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9762 #else
9763 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9764 #endif
9765 #else
9766 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9767 #endif
9768 char *myname = "sprintf";
9769 #endif
9770
9771 #ifndef DOUBLETYPE
9772 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9773 #define DOUBLETYPE long double
9774 #else
9775 #define DOUBLETYPE double
9776 #endif
9777 #endif
9778
9779 #include <stdio.h>
9780
9781 #$i_stdlib I_STDLIB
9782 #ifdef I_STDLIB
9783 #include <stdlib.h>
9784 #endif
9785 #$i_string I_STRING
9786 #ifdef I_STRING
9787 #  include <string.h>
9788 #else
9789 #  include <strings.h>
9790 #endif
9791
9792 int checkit(char *expect, char *got)
9793 {
9794     if (strcmp(expect, got)) {
9795                 printf("%s oddity:  Expected %s, got %s\n",
9796                         myname, expect, got);
9797                 exit(1);
9798         }
9799 }
9800
9801 int main()
9802 {
9803         char buf[64];
9804         buf[63] = '\0';
9805
9806         /* This must be 1st test on (which?) platform */
9807         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9808         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9809         checkit("0.1", buf);
9810
9811         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9812         checkit("0.01", buf);
9813
9814         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9815         checkit("0.001", buf);
9816
9817         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9818         checkit("0.0001", buf);
9819
9820         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9821         if (strlen(buf) > 5)
9822             checkit("9e-005", buf); /* for Microsoft ?? */
9823         else
9824             checkit("9e-05", buf);
9825
9826         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9827         checkit("1", buf);
9828
9829         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9830         checkit("1.1", buf);
9831
9832         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9833         checkit("1.01", buf);
9834
9835         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9836         checkit("1.001", buf);
9837
9838         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9839         checkit("1.0001", buf);
9840
9841         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9842         checkit("1.00001", buf);
9843
9844         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9845         checkit("1.000001", buf);
9846
9847         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9848         checkit("0", buf);
9849
9850         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9851         checkit("-1", buf);
9852
9853         /* Some Linux gcvt's give 1.e+5 here. */
9854         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9855         checkit("100000", buf);
9856
9857         /* Some Linux gcvt's give -1.e+5 here. */
9858         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9859         checkit("-100000", buf);
9860
9861         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9862         checkit("123.456", buf);
9863
9864         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9865         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9866         /* 34 should be enough to scare even long double
9867          * places into using the e notation. */
9868         if (strlen(buf) > 5)
9869             checkit("1e+034", buf); /* for Microsoft */
9870         else
9871             checkit("1e+34", buf);
9872
9873         /* For Perl, if you add additional tests here, also add them to
9874          * t/base/num.t for benefit of platforms not using Configure or
9875          * overriding d_Gconvert */
9876
9877         exit(0);
9878 }
9879 EOP
9880 : first add preferred functions to our list
9881 xxx_list=""
9882 for xxx_convert in $gconvert_preference; do
9883     case $xxx_convert in
9884     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9885     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9886     esac
9887 done
9888 : then add any others
9889 for xxx_convert in gconvert gcvt sprintf; do
9890     case "$xxx_list" in
9891     *$xxx_convert*) ;;
9892     *) xxx_list="$xxx_list $xxx_convert" ;;
9893     esac
9894 done
9895
9896 case "$d_longdbl$uselongdouble" in
9897 "$define$define")
9898     : again, add prefered functions to our list first
9899     xxx_ld_list=""
9900     for xxx_convert in $gconvert_ld_preference; do
9901         case $xxx_convert in
9902         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9903         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9904         esac
9905     done
9906     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9907     for xxx_convert in qgcvt sprintf $xxx_list; do
9908         case "$xxx_ld_list" in
9909         $xxx_convert*|*" $xxx_convert"*) ;;
9910         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9911         esac
9912     done
9913     : if sprintf cannot do long doubles, move it to the end
9914     if test "$d_PRIgldbl" != "$define"; then
9915         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9916     fi
9917     : if no qgcvt, remove it
9918     if test "$d_qgcvt" != "$define"; then
9919         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9920     fi
9921     : use the ld_list
9922     xxx_list="$xxx_ld_list"
9923     ;;
9924 esac
9925
9926 for xxx_convert in $xxx_list; do
9927         echo "Trying $xxx_convert..."
9928         $rm -f try try$_o core
9929         set try -DTRY_$xxx_convert
9930         if eval $compile; then
9931                 echo "$xxx_convert() found." >&4
9932                 if $run ./try; then
9933                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9934                         break;
9935                 else
9936                         echo "...But $xxx_convert didn't work as I expected."
9937                         xxx_convert=''
9938                 fi
9939         else
9940                 echo "$xxx_convert NOT found." >&4
9941         fi
9942 done
9943
9944 if test X$xxx_convert = X; then
9945     echo "*** WHOA THERE!!! ***" >&4
9946     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9947     xxx_convert=sprintf
9948 fi
9949
9950 case "$xxx_convert" in
9951 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9952 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9953 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9954 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9955    "$define$define$define")
9956       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9957    "$define$define$undef")
9958       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9959    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9960    esac
9961    ;;
9962 esac
9963
9964 fi
9965 $rm_try
9966
9967 : see if _fwalk exists
9968 set fwalk d__fwalk
9969 eval $inlibc
9970
9971 : Initialize h_fcntl
9972 h_fcntl=false
9973
9974 : Initialize h_sysfile
9975 h_sysfile=false
9976
9977 : access call always available on UNIX
9978 set access d_access
9979 eval $inlibc
9980
9981 : locate the flags for 'access()'
9982 case "$d_access" in
9983 "$define")
9984         echo " "
9985         $cat >access.c <<EOCP
9986 #include <sys/types.h>
9987 #ifdef I_FCNTL
9988 #include <fcntl.h>
9989 #endif
9990 #ifdef I_SYS_FILE
9991 #include <sys/file.h>
9992 #endif
9993 #ifdef I_UNISTD
9994 #include <unistd.h>
9995 #endif
9996 #$i_stdlib I_STDLIB
9997 #ifdef I_STDLIB
9998 #include <stdlib.h>
9999 #endif
10000 int main() {
10001         exit(R_OK);
10002 }
10003 EOCP
10004         : check sys/file.h first, no particular reason here
10005         if $test `./findhdr sys/file.h` && \
10006                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10007                 h_sysfile=true;
10008                 echo "<sys/file.h> defines the *_OK access constants." >&4
10009         elif $test `./findhdr fcntl.h` && \
10010                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10011                 h_fcntl=true;
10012                 echo "<fcntl.h> defines the *_OK access constants." >&4
10013         elif $test `./findhdr unistd.h` && \
10014                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10015                 echo "<unistd.h> defines the *_OK access constants." >&4
10016         else
10017                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10018         fi
10019         ;;
10020 esac
10021 $rm -f access*
10022
10023 : see if accessx exists
10024 set accessx d_accessx
10025 eval $inlibc
10026
10027 : see if aintl exists
10028 set aintl d_aintl
10029 eval $inlibc
10030
10031 : see if alarm exists
10032 set alarm d_alarm
10033 eval $inlibc
10034
10035 : see if 64bit time functions exists
10036
10037 set ctime64 d_ctime64
10038 eval $inlibc
10039
10040 set localtime64 d_localtime64
10041 eval $inlibc
10042
10043 set gmtime64 d_gmtime64
10044 eval $inlibc
10045
10046 set mktime64 d_mktime64
10047 eval $inlibc
10048
10049 set difftime64 d_difftime64
10050 eval $inlibc
10051
10052 set asctime64 d_asctime64
10053 eval $inlibc
10054
10055 : see if POSIX threads are available
10056 set pthread.h i_pthread
10057 eval $inhdr
10058
10059 : define a fucntion to check prototypes
10060 $cat > protochk <<EOSH
10061 $startsh
10062 cc="$cc"
10063 optimize="$optimize"
10064 ccflags="$ccflags"
10065 prototype="$prototype"
10066 define="$define"
10067 rm_try="$rm_try"
10068 usethreads=$usethreads
10069 i_pthread=$i_pthread
10070 pthread_h_first=$pthread_h_first
10071 EOSH
10072
10073 $cat >> protochk <<'EOSH'
10074
10075 $rm_try
10076 foo="$1"
10077 shift
10078 while test $# -ge 2; do
10079         case "$1" in
10080                 $define) echo "#include <$2>" >> try.c ;;
10081                 literal) echo "$2" >> try.c ;;
10082         esac
10083     # Extra magic for the benefit of systems that need pthread.h
10084     # to be included early to correctly detect threadsafe functions.
10085     # Such functions must guarantee themselves, though, that the usethreads
10086     # and i_pthread have been defined, before calling protochk.
10087     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10088         echo "#include <pthread.h>" >> try.c
10089         pthread_h_done=yes
10090     fi
10091     shift 2
10092 done
10093 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10094 cat >> try.c <<'EOCP'
10095 #ifdef CAN_PROTOTYPE
10096 #define _(args) args
10097 #else
10098 #define _(args) ()
10099 #endif
10100 EOCP
10101 echo "$foo" >> try.c
10102 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10103 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10104 status=$?
10105 $rm_try
10106 exit $status
10107 EOSH
10108 chmod +x protochk
10109 $eunicefix protochk
10110
10111 : Define hasproto macro for Configure internal use
10112 hasproto='varname=$1; func=$2; shift; shift;
10113 while $test $# -ge 2; do
10114         case "$1" in
10115         $define) echo "#include <$2>";;
10116         esac ;
10117     shift 2;
10118 done > try.c;
10119 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10120 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10121         echo "$func() prototype found.";
10122         val="$define";
10123 else
10124         echo "$func() prototype NOT found.";
10125         val="$undef";
10126 fi;
10127 set $varname;
10128 eval $setvar;
10129 $rm_try tryout.c'
10130
10131 : see if sys/types.h has to be included
10132 set sys/types.h i_systypes
10133 eval $inhdr
10134
10135 : see if sys/select.h has to be included
10136 set sys/select.h i_sysselct
10137 eval $inhdr
10138
10139 : Define hasfield macro for Configure internal use
10140 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10141 while $test $# -ge 2; do
10142         case "$1" in
10143         $define) echo "#include <$2>";;
10144         esac ;
10145     shift 2;
10146 done > try.c;
10147 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10148 set try;
10149 if eval $compile; then
10150         val="$define";
10151 else
10152         val="$undef";
10153 fi;
10154 set $varname;
10155 eval $setvar;
10156 $rm_try'
10157
10158 : see if we should include time.h, sys/time.h, or both
10159 echo " "
10160 if test "X$timeincl" = X; then
10161         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10162         $echo $n "I'm now running the test program...$c"
10163         $cat >try.c <<EOCP
10164 #include <sys/types.h>
10165 #ifdef I_TIME
10166 #include <time.h>
10167 #endif
10168 #ifdef I_SYSTIME
10169 #ifdef SYSTIMEKERNEL
10170 #define KERNEL
10171 #endif
10172 #include <sys/time.h>
10173 #endif
10174 #ifdef I_SYSSELECT
10175 #include <sys/select.h>
10176 #endif
10177 #$i_stdlib I_STDLIB
10178 #ifdef I_STDLIB
10179 #include <stdlib.h>
10180 #endif
10181 int main()
10182 {
10183         struct tm foo;
10184 #ifdef S_TIMEVAL
10185         struct timeval bar;
10186 #endif
10187 #ifdef S_TIMEZONE
10188         struct timezone tzp;
10189 #endif
10190         if (foo.tm_sec == foo.tm_sec)
10191                 exit(0);
10192 #ifdef S_TIMEVAL
10193         if (bar.tv_sec == bar.tv_sec)
10194                 exit(0);
10195 #endif
10196         exit(1);
10197 }
10198 EOCP
10199         flags=''
10200         for s_timezone in '-DS_TIMEZONE' ''; do
10201         sysselect=''
10202         for s_timeval in '-DS_TIMEVAL' ''; do
10203         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10204         for i_time in '' '-DI_TIME'; do
10205         for i_systime in '-DI_SYSTIME' ''; do
10206                 case "$flags" in
10207                 '') $echo $n ".$c"
10208                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10209                         if eval $compile; then
10210                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10211                                 shift
10212                                 flags="$*"
10213                                 echo " "
10214                                 $echo $n "Succeeded with $flags$c"
10215                         fi
10216                         ;;
10217                 esac
10218         done
10219         done
10220         done
10221         done
10222         done
10223         timeincl=''
10224         echo " "
10225         case "$flags" in
10226         *SYSTIMEKERNEL*) i_systimek="$define"
10227                 timeincl=`./findhdr sys/time.h`
10228                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10229         *) i_systimek="$undef";;
10230         esac
10231         case "$flags" in
10232         *I_TIME*) i_time="$define"
10233                 timeincl=`./findhdr time.h`" $timeincl"
10234                 echo "We'll include <time.h>." >&4;;
10235         *) i_time="$undef";;
10236         esac
10237         case "$flags" in
10238         *I_SYSTIME*) i_systime="$define"
10239                 timeincl=`./findhdr sys/time.h`" $timeincl"
10240                 echo "We'll include <sys/time.h>." >&4;;
10241         *) i_systime="$undef";;
10242         esac
10243         $rm_try
10244 fi
10245 : see if struct tm knows about tm_zone
10246 case "$i_systime$i_time" in
10247 *$define*)
10248         echo " "
10249         echo "Checking to see if your struct tm has tm_zone field..." >&4
10250         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10251         eval $hasfield
10252         ;;
10253 *)      val="$undef"
10254         set d_tm_tm_zone
10255         eval $setvar
10256         ;;
10257 esac
10258 case "$d_tm_tm_zone" in
10259 "$define")      echo "Yes, it does."   ;;
10260 *)              echo "No, it doesn't." ;;
10261 esac
10262 : see if struct tm knows about tm_gmtoff
10263 case "$i_systime$i_time" in
10264 *$define*)
10265         echo " "
10266         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10267         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10268         eval $hasfield
10269         ;;
10270 *)      val="$undef"
10271         set d_tm_tm_gmtoff
10272         eval $setvar
10273         ;;
10274 esac
10275 case "$d_tm_tm_gmtoff" in
10276 "$define")      echo "Yes, it does."   ;;
10277 *)              echo "No, it doesn't." ;;
10278 esac
10279
10280 : see if asctime_r exists
10281 set asctime_r d_asctime_r
10282 eval $inlibc
10283 case "$d_asctime_r" in
10284 "$define")
10285         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10286         case "$d_asctime_r_proto:$usethreads" in
10287         ":define")      d_asctime_r_proto=define
10288                 set d_asctime_r_proto asctime_r $hdrs
10289                 eval $hasproto ;;
10290         *)      ;;
10291         esac
10292         case "$d_asctime_r_proto" in
10293         define)
10294         case "$asctime_r_proto" in
10295         ''|0) try='char* asctime_r(const struct tm*, char*);'
10296         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10297         esac
10298         case "$asctime_r_proto" in
10299         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10300         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10301         esac
10302         case "$asctime_r_proto" in
10303         ''|0) try='int asctime_r(const struct tm*, char*);'
10304         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10305         esac
10306         case "$asctime_r_proto" in
10307         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10308         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10309         esac
10310         case "$asctime_r_proto" in
10311         ''|0)   d_asctime_r=undef
10312                 asctime_r_proto=0
10313                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10314         * )     case "$asctime_r_proto" in
10315                 REENTRANT_PROTO*) ;;
10316                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10317                 esac
10318                 echo "Prototype: $try" ;;
10319         esac
10320         ;;
10321         *)      case "$usethreads" in
10322                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10323                 esac
10324                 d_asctime_r=undef
10325                 asctime_r_proto=0
10326                 ;;
10327         esac
10328         ;;
10329 *)      asctime_r_proto=0
10330         ;;
10331 esac
10332
10333 : see if atolf exists
10334 set atolf d_atolf
10335 eval $inlibc
10336
10337 : see if atoll exists
10338 set atoll d_atoll
10339 eval $inlibc
10340
10341 : Look for GCC-style attribute format
10342 case "$d_attribute_format" in
10343 '')
10344 echo " "
10345 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10346 $cat >attrib.c <<'EOCP'
10347 #include <stdio.h>
10348 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10349 EOCP
10350 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10351         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10352                 echo "Your C compiler doesn't support __attribute__((format))."
10353                 val="$undef"
10354         else
10355                 echo "Your C compiler supports __attribute__((format))."
10356                 val="$define"
10357         fi
10358 else
10359         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10360         val="$undef"
10361 fi
10362 ;;
10363 *) val="$d_attribute_format" ;;
10364 esac
10365 set d_attribute_format
10366 eval $setvar
10367 $rm -f attrib*
10368
10369 : Look for GCC-style attribute format with null format allowed
10370 case "$d_printf_format_null" in
10371 '') case "$d_attribute_format" in
10372     $define)
10373         echo " "
10374         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10375 $cat >attrib.c <<EOCP
10376 #include <stdio.h>
10377 #$i_stdlib I_STDLIB
10378 #ifdef I_STDLIB
10379 #include <stdlib.h>
10380 #endif
10381 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10382 int null_printf (char* pat,...) { return (int)pat; }
10383 int main () { exit(null_printf(NULL)); }
10384 EOCP
10385         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10386             : run the executable in case it produces a run-time warning
10387             if $run ./attrib >>attrib.out 2>&1; then
10388                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10389                     echo "Your C compiler doesn't allow __printf__ format to be null."
10390                     val="$undef"
10391                 else
10392                     echo "Your C compiler allows __printf__ format to be null."
10393                     val="$define"
10394                 fi
10395             else
10396             echo "Your C compiler executable failed with __printf__ format null."
10397             val="$undef"
10398         fi
10399     else
10400         echo "Your C compiler fails with __printf__ format null."
10401         val="$undef"
10402     fi
10403     ;;
10404     *)  val="$undef" ;;
10405     esac
10406 ;;
10407 *)  val="$d_printf_format_null" ;;
10408 esac
10409 set d_printf_format_null
10410 eval $setvar
10411 $rm -f attrib*
10412
10413 : Look for GCC-style attribute malloc
10414 case "$d_attribute_malloc" in
10415 '')
10416 echo " "
10417 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10418 $cat >attrib.c <<'EOCP'
10419 #include <stdio.h>
10420 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10421 EOCP
10422 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10423         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10424                 echo "Your C compiler doesn't support __attribute__((malloc))."
10425                 val="$undef"
10426         else
10427                 echo "Your C compiler supports __attribute__((malloc))."
10428                 val="$define"
10429         fi
10430 else
10431         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10432         val="$undef"
10433 fi
10434 ;;
10435 *) val="$d_attribute_malloc" ;;
10436 esac
10437 set d_attribute_malloc
10438 eval $setvar
10439 $rm -f attrib*
10440
10441 : Look for GCC-style attribute nonnull
10442 case "$d_attribute_nonnull" in
10443 '')
10444 echo " "
10445 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10446 $cat >attrib.c <<'EOCP'
10447 #include <stdio.h>
10448 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10449 EOCP
10450 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10451         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10452                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10453                 val="$undef"
10454         else
10455                 echo "Your C compiler supports __attribute__((nonnull))."
10456                 val="$define"
10457         fi
10458 else
10459         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10460         val="$undef"
10461 fi
10462 ;;
10463 *) val="$d_attribute_nonnull" ;;
10464 esac
10465 set d_attribute_nonnull
10466 eval $setvar
10467 $rm -f attrib*
10468
10469 : Look for GCC-style attribute noreturn
10470 case "$d_attribute_noreturn" in
10471 '')
10472 echo " "
10473 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10474 $cat >attrib.c <<'EOCP'
10475 #include <stdio.h>
10476 void fall_over_dead( void ) __attribute__((noreturn));
10477 EOCP
10478 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10479         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10480                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10481                 val="$undef"
10482         else
10483                 echo "Your C compiler supports __attribute__((noreturn))."
10484                 val="$define"
10485         fi
10486 else
10487         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10488         val="$undef"
10489 fi
10490 ;;
10491 *) val="$d_attribute_noreturn" ;;
10492 esac
10493 set d_attribute_noreturn
10494 eval $setvar
10495 $rm -f attrib*
10496
10497 : Look for GCC-style attribute pure
10498 case "$d_attribute_pure" in
10499 '')
10500 echo " "
10501 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10502 $cat >attrib.c <<'EOCP'
10503 #include <stdio.h>
10504 int square( int n ) __attribute__((pure));
10505 EOCP
10506 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10507         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10508                 echo "Your C compiler doesn't support __attribute__((pure))."
10509                 val="$undef"
10510         else
10511                 echo "Your C compiler supports __attribute__((pure))."
10512                 val="$define"
10513         fi
10514 else
10515         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10516         val="$undef"
10517 fi
10518 ;;
10519 *) val="$d_attribute_pure" ;;
10520 esac
10521 set d_attribute_pure
10522 eval $setvar
10523 $rm -f attrib*
10524
10525 : Look for GCC-style attribute unused
10526 case "$d_attribute_unused" in
10527 '')
10528 echo " "
10529 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10530 $cat >attrib.c <<'EOCP'
10531 #include <stdio.h>
10532 int do_something( int dummy __attribute__((unused)), int n );
10533 EOCP
10534 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10535         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10536                 echo "Your C compiler doesn't support __attribute__((unused))."
10537                 val="$undef"
10538         else
10539                 echo "Your C compiler supports __attribute__((unused))."
10540                 val="$define"
10541         fi
10542 else
10543         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10544         val="$undef"
10545 fi
10546 ;;
10547 *) val="$d_attribute_unused" ;;
10548 esac
10549 set d_attribute_unused
10550 eval $setvar
10551 $rm -f attrib*
10552
10553 : Look for GCC-style attribute deprecated
10554 case "$d_attribute_deprecated" in
10555 '')
10556 echo " "
10557 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10558 $cat >attrib.c <<'EOCP'
10559 #include <stdio.h>
10560 int I_am_deprecated(void) __attribute__((deprecated));
10561 EOCP
10562 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10563         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10564                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10565                 val="$undef"
10566         else
10567                 echo "Your C compiler supports __attribute__((deprecated))."
10568                 val="$define"
10569         fi
10570 else
10571         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10572         val="$undef"
10573 fi
10574 ;;
10575 *) val="$d_attribute_deprecated" ;;
10576 esac
10577 set d_attribute_deprecated
10578 eval $setvar
10579 $rm -f attrib*
10580
10581 : Look for GCC-style attribute warn_unused_result
10582 case "$d_attribute_warn_unused_result" in
10583 '')
10584 echo " "
10585 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10586 $cat >attrib.c <<'EOCP'
10587 #include <stdio.h>
10588 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10589 EOCP
10590 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10591         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10592                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10593                 val="$undef"
10594         else
10595                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10596                 val="$define"
10597         fi
10598 else
10599         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10600         val="$undef"
10601 fi
10602 ;;
10603 *) val="$d_attribute_warn_unused_result" ;;
10604 esac
10605 set d_attribute_warn_unused_result
10606 eval $setvar
10607 $rm -f attrib*
10608
10609 : see if bcmp exists
10610 set bcmp d_bcmp
10611 eval $inlibc
10612
10613 : see if bcopy exists
10614 set bcopy d_bcopy
10615 eval $inlibc
10616
10617 : see if getpgrp exists
10618 set getpgrp d_getpgrp
10619 eval $inlibc
10620
10621 case "$d_getpgrp" in
10622 "$define")
10623         echo " "
10624         echo "Checking to see which flavor of getpgrp is in use..."
10625         $cat >try.c <<EOP
10626 #$i_unistd I_UNISTD
10627 #include <sys/types.h>
10628 #ifdef I_UNISTD
10629 #  include <unistd.h>
10630 #endif
10631 #$i_stdlib I_STDLIB
10632 #ifdef I_STDLIB
10633 #include <stdlib.h>
10634 #endif
10635 int main()
10636 {
10637         if (getuid() == 0) {
10638                 printf("(I see you are running Configure as super-user...)\n");
10639                 setuid(1);
10640         }
10641 #ifdef TRY_BSD_PGRP
10642         if (getpgrp(1) == 0)
10643                 exit(0);
10644 #else
10645         if (getpgrp() > 0)
10646                 exit(0);
10647 #endif
10648         exit(1);
10649 }
10650 EOP
10651         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10652                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10653                 val="$define"
10654         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10655                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10656                 val="$undef"
10657         else
10658                 echo "I can't seem to compile and run the test program."
10659                 if ./usg; then
10660                         xxx="a USG one, i.e. you use getpgrp()."
10661                 else
10662                         # SVR4 systems can appear rather BSD-ish.
10663                         case "$i_unistd" in
10664                         $undef)
10665                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10666                                 val="$define"
10667                                 ;;
10668                         $define)
10669                                 xxx="probably a USG one, i.e. you use getpgrp()."
10670                                 val="$undef"
10671                                 ;;
10672                         esac
10673                 fi
10674                 echo "Assuming your getpgrp is $xxx" >&4
10675         fi
10676         ;;
10677 *) val="$undef";;
10678 esac
10679 set d_bsdgetpgrp
10680 eval $setvar
10681 $rm_try
10682
10683 : see if setpgrp exists
10684 set setpgrp d_setpgrp
10685 eval $inlibc
10686
10687 case "$d_setpgrp" in
10688 "$define")
10689         echo " "
10690         echo "Checking to see which flavor of setpgrp is in use..."
10691         $cat >try.c <<EOP
10692 #$i_unistd I_UNISTD
10693 #include <sys/types.h>
10694 #ifdef I_UNISTD
10695 #  include <unistd.h>
10696 #endif
10697 #$i_stdlib I_STDLIB
10698 #ifdef I_STDLIB
10699 #include <stdlib.h>
10700 #endif
10701 int main()
10702 {
10703         if (getuid() == 0) {
10704                 printf("(I see you are running Configure as super-user...)\n");
10705                 setuid(1);
10706         }
10707 #ifdef TRY_BSD_PGRP
10708         if (-1 == setpgrp(1, 1))
10709                 exit(0);
10710 #else
10711         if (setpgrp() != -1)
10712                 exit(0);
10713 #endif
10714         exit(1);
10715 }
10716 EOP
10717         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10718                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10719                 val="$define"
10720         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10721                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10722                 val="$undef"
10723         else
10724                 echo "(I can't seem to compile and run the test program.)"
10725                 if ./usg; then
10726                         xxx="a USG one, i.e. you use setpgrp()."
10727                 else
10728                         # SVR4 systems can appear rather BSD-ish.
10729                         case "$i_unistd" in
10730                         $undef)
10731                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10732                                 val="$define"
10733                                 ;;
10734                         $define)
10735                                 xxx="probably a USG one, i.e. you use setpgrp()."
10736                                 val="$undef"
10737                                 ;;
10738                         esac
10739                 fi
10740                 echo "Assuming your setpgrp is $xxx" >&4
10741         fi
10742         ;;
10743 *) val="$undef";;
10744 esac
10745 set d_bsdsetpgrp
10746 eval $setvar
10747 $rm_try
10748
10749 : Look for GCC-style __builtin_choose_expr
10750 case "$d_builtin_choose_expr" in
10751 '')
10752     echo " "
10753     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10754     $cat >try.c <<'EOCP'
10755 #include <assert.h>
10756 #include <stdlib.h>
10757 #include <stdio.h>
10758
10759 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10760
10761 int main(void) {
10762     assert( SYRINX(1) == 2112 );
10763     assert( SYRINX(1) != 5150 );
10764     assert( SYRINX(0) == 5150 );
10765     assert( SYRINX(0) != 2112 );
10766     puts( "All good!" );
10767     exit(0);
10768 }
10769
10770 EOCP
10771     set try
10772     if eval $compile && $run ./try; then
10773         echo "Your C compiler supports __builtin_choose_expr."
10774         val="$define"
10775     else
10776         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10777         val="$undef"
10778     fi
10779 ;;
10780 *) val="$d_builtin_choose_expr" ;;
10781 esac
10782
10783 set d_builtin_choose_expr
10784 eval $setvar
10785 $rm_try
10786
10787 : Look for GCC-style __builtin_expect
10788 case "$d_builtin_expect" in
10789 '')
10790     echo " "
10791     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10792     $cat >try.c <<'EOCP'
10793 int main(void) {
10794     int n = 50;
10795     if ( __builtin_expect(n, 0) ) n = 1;
10796     /* Remember shell exit code truth is 0, C truth is non-zero */
10797     return !(n == 1);
10798 }
10799 EOCP
10800     set try
10801     if eval $compile && $run ./try; then
10802         echo "Your C compiler supports __builtin_expect."
10803         val="$define"
10804     else
10805         echo "Your C compiler doesn't seem to understand __builtin_expect."
10806         val="$undef"
10807     fi
10808     ;;
10809 *) val="$d_builtin_expect" ;;
10810 esac
10811
10812 set d_builtin_expect
10813 eval $setvar
10814 $rm_try
10815
10816 : see if bzero exists
10817 set bzero d_bzero
10818 eval $inlibc
10819
10820 : see if stdarg is available
10821 echo " "
10822 if $test `./findhdr stdarg.h`; then
10823         echo "<stdarg.h> found." >&4
10824         valstd="$define"
10825 else
10826         echo "<stdarg.h> NOT found." >&4
10827         valstd="$undef"
10828 fi
10829
10830 : see if varags is available
10831 echo " "
10832 if $test `./findhdr varargs.h`; then
10833         echo "<varargs.h> found." >&4
10834 else
10835         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10836 fi
10837
10838 : set up the varargs testing programs
10839 $cat > varargs.c <<EOP
10840 #ifdef I_STDARG
10841 #include <stdarg.h>
10842 #endif
10843 #ifdef I_VARARGS
10844 #include <varargs.h>
10845 #endif
10846
10847 #ifdef I_STDARG
10848 int f(char *p, ...)
10849 #else
10850 int f(va_alist)
10851 va_dcl
10852 #endif
10853 {
10854         va_list ap;
10855 #ifndef I_STDARG
10856         char *p;
10857 #endif
10858 #ifdef I_STDARG
10859         va_start(ap,p);
10860 #else
10861         va_start(ap);
10862         p = va_arg(ap, char *);
10863 #endif
10864         va_end(ap);
10865         return 0;
10866 }
10867 EOP
10868 $cat > varargs <<EOP
10869 $startsh
10870 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10871         echo "true"
10872 else
10873         echo "false"
10874 fi
10875 $rm -f varargs$_o
10876 EOP
10877 chmod +x varargs
10878
10879 : now check which varargs header should be included
10880 echo " "
10881 i_varhdr=''
10882 case "$valstd" in
10883 "$define")
10884         if `./varargs I_STDARG`; then
10885                 val='stdarg.h'
10886         elif `./varargs I_VARARGS`; then
10887                 val='varargs.h'
10888         fi
10889         ;;
10890 *)
10891         if `./varargs I_VARARGS`; then
10892                 val='varargs.h'
10893         fi
10894         ;;
10895 esac
10896 case "$val" in
10897 '')
10898 echo "I could not find the definition for va_dcl... You have problems..." >&4
10899         val="$undef"; set i_stdarg; eval $setvar
10900         val="$undef"; set i_varargs; eval $setvar
10901         ;;
10902 *)
10903         set i_varhdr
10904         eval $setvar
10905         case "$i_varhdr" in
10906         stdarg.h)
10907                 val="$define"; set i_stdarg; eval $setvar
10908                 val="$undef"; set i_varargs; eval $setvar
10909                 ;;
10910         varargs.h)
10911                 val="$undef"; set i_stdarg; eval $setvar
10912                 val="$define"; set i_varargs; eval $setvar
10913                 ;;
10914         esac
10915         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10916 esac
10917 $rm -f varargs*
10918
10919 : see if the Compiler supports C99 variadic macros
10920 case "$i_stdarg$i_stdlib" in
10921     "$define$define")
10922     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10923     $cat >try.c <<EOCP
10924 #include <stdio.h>
10925 #include <stdarg.h>
10926
10927 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10928
10929 int main() {
10930   char buf[20];
10931   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10932   puts(buf);
10933   return 0;
10934 }
10935 EOCP
10936     set try
10937     if eval $compile && $run ./try 2>&1 >/dev/null; then
10938         case "`$run ./try`" in
10939             "123 456 789")
10940             echo "You have C99 variadic macros." >&4
10941             d_c99_variadic_macros="$define"
10942             ;;
10943             *)
10944             echo "You don't have functional C99 variadic macros." >&4
10945             d_c99_variadic_macros="$undef"
10946             ;;
10947         esac
10948     else
10949         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10950         d_c99_variadic_macros="$undef"
10951     fi
10952     $rm_try
10953     ;;
10954     *)
10955     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10956     d_c99_variadic_macros="$undef"
10957     ;;
10958 esac
10959
10960 : see if signal is declared as pointer to function returning int or void
10961 echo " "
10962 xxx=`./findhdr signal.h`
10963 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10964 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10965         echo "You have int (*signal())() instead of void." >&4
10966         val="$undef"
10967 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10968         echo "You have void (*signal())()." >&4
10969         val="$define"
10970 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10971         echo "You have int (*signal())() instead of void." >&4
10972         val="$undef"
10973 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10974         echo "You have void (*signal())()." >&4
10975         val="$define"
10976 else
10977         case "$d_voidsig" in
10978         '')
10979         echo "I can't determine whether signal handler returns void or int..." >&4
10980                 dflt=void
10981                 rp="What type does your signal handler return?"
10982                 . ./myread
10983                 case "$ans" in
10984                 v*) val="$define";;
10985                 *) val="$undef";;
10986                 esac;;
10987         "$define")
10988                 echo "As you already told me, signal handler returns void." >&4
10989                 val="$define"
10990                 ;;
10991         *)      echo "As you already told me, signal handler returns int." >&4
10992                 val="$undef"
10993                 ;;
10994         esac
10995 fi
10996 set d_voidsig
10997 eval $setvar
10998 case "$d_voidsig" in
10999 "$define") signal_t="void";;
11000 *) signal_t="int";;
11001 esac
11002 $rm -f $$.tmp
11003
11004 : check for ability to cast large floats to 32-bit ints.
11005 echo " "
11006 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11007 if $test "$intsize" -ge 4; then
11008         xxx=int
11009 else
11010         xxx=long
11011 fi
11012 $cat >try.c <<EOCP
11013 #include <stdio.h>
11014 #$i_stdlib I_STDLIB
11015 #ifdef I_STDLIB
11016 #include <stdlib.h>
11017 #endif
11018 #include <sys/types.h>
11019 #include <signal.h>
11020 $signal_t blech(int s) { exit(3); }
11021 int main()
11022 {
11023         $xxx i32;
11024         double f, g;
11025         int result = 0;
11026         char str[16];
11027         signal(SIGFPE, blech);
11028
11029         /* Don't let compiler optimize the test away.  Store the number
11030            in a writable string for gcc to pass to sscanf under HP-UX.
11031         */
11032         sprintf(str, "2147483647");
11033         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11034         g = 10 * f;
11035         i32  = ($xxx) g;
11036
11037         /* x86 processors will probably give 0x8000 0000, which is a
11038            sign change.  We don't want that.  We want to mimic SPARC
11039            behavior here, which is to preserve the sign and give
11040            back 0x7fff ffff.
11041         */
11042         if (i32 != ($xxx) f)
11043                 result |= 1;
11044         exit(result);
11045 }
11046 EOCP
11047 set try
11048 if eval $compile_ok; then
11049         $run ./try
11050         yyy=$?
11051 else
11052         echo "(I can't seem to compile the test program--assuming it can't)"
11053         yyy=1
11054 fi
11055 case "$yyy" in
11056 0)      val="$define"
11057         echo "Yup, it can."
11058         ;;
11059 *)      val="$undef"
11060         echo "Nope, it can't."
11061         ;;
11062 esac
11063 set d_casti32
11064 eval $setvar
11065 $rm_try
11066
11067 : check for ability to cast negative floats to unsigned
11068 echo " "
11069 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11070 $cat >try.c <<EOCP
11071 #include <stdio.h>
11072 #$i_stdlib I_STDLIB
11073 #ifdef I_STDLIB
11074 #include <stdlib.h>
11075 #endif
11076 #include <sys/types.h>
11077 #include <signal.h>
11078 $signal_t blech(int s) { exit(7); }
11079 $signal_t blech_in_list(int s) { exit(4); }
11080 unsigned long dummy_long(unsigned long p) { return p; }
11081 unsigned int dummy_int(unsigned int p) { return p; }
11082 unsigned short dummy_short(unsigned short p) { return p; }
11083 int main()
11084 {
11085         double f;
11086         unsigned long along;
11087         unsigned int aint;
11088         unsigned short ashort;
11089         int result = 0;
11090         char str[16];
11091
11092         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11093            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11094            optimized the whole file away
11095         */
11096         /* Store the number in a writable string for gcc to pass to
11097            sscanf under HP-UX.
11098         */
11099         sprintf(str, "-123");
11100         sscanf(str, "%lf", &f);  /* f = -123.; */
11101
11102         signal(SIGFPE, blech);
11103         along = (unsigned long)f;
11104         aint = (unsigned int)f;
11105         ashort = (unsigned short)f;
11106         if (along != (unsigned long)-123)
11107                 result |= 1;
11108         if (aint != (unsigned int)-123)
11109                 result |= 1;
11110         if (ashort != (unsigned short)-123)
11111                 result |= 1;
11112         sprintf(str, "1073741824.");
11113         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11114         f = f + f;
11115         along = 0;
11116         along = (unsigned long)f;
11117         if (along != 0x80000000)
11118                 result |= 2;
11119         f -= 1.;
11120         along = 0;
11121         along = (unsigned long)f;
11122         if (along != 0x7fffffff)
11123                 result |= 1;
11124         f += 2.;
11125         along = 0;
11126         along = (unsigned long)f;
11127         if (along != 0x80000001)
11128                 result |= 2;
11129         if (result)
11130                 exit(result);
11131         signal(SIGFPE, blech_in_list);
11132         sprintf(str, "123.");
11133         sscanf(str, "%lf", &f);  /* f = 123.; */
11134         along = dummy_long((unsigned long)f);
11135         aint = dummy_int((unsigned int)f);
11136         ashort = dummy_short((unsigned short)f);
11137         if (along != (unsigned long)123)
11138                 result |= 4;
11139         if (aint != (unsigned int)123)
11140                 result |= 4;
11141         if (ashort != (unsigned short)123)
11142                 result |= 4;
11143         exit(result);
11144
11145 }
11146 EOCP
11147 set try
11148 if eval $compile_ok; then
11149         $run ./try
11150         castflags=$?
11151 else
11152         echo "(I can't seem to compile the test program--assuming it can't)"
11153         castflags=7
11154 fi
11155 case "$castflags" in
11156 0)      val="$define"
11157         echo "Yup, it can."
11158         ;;
11159 *)      val="$undef"
11160         echo "Nope, it can't."
11161         ;;
11162 esac
11163 set d_castneg
11164 eval $setvar
11165 $rm_try
11166
11167 : see if vprintf exists
11168 echo " "
11169 if set vprintf val -f d_vprintf; eval $csym; $val; then
11170         echo 'vprintf() found.' >&4
11171         val="$define"
11172         $cat >try.c <<EOF
11173 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11174 #$i_varargs I_VARARGS
11175
11176 #$i_stdlib I_STDLIB
11177 #$i_unistd I_UNISTD
11178
11179 #ifdef I_STDARG
11180 #  include <stdarg.h>
11181 #else /* I_VARARGS */
11182 #  include <varargs.h>
11183 #endif
11184
11185 #ifdef I_UNISTD
11186 #  include <unistd.h>
11187 #endif
11188
11189 #ifdef I_STDLIB
11190 #  include <stdlib.h>
11191 #endif
11192
11193 #include <stdio.h> /* vsprintf prototype */
11194
11195 #ifdef I_STDARG
11196 void xxx(int n, ...)
11197 {
11198     va_list args;
11199     char buf[10];
11200     va_start(args, n);
11201     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11202 }
11203 int main() { xxx(1, "foo"); }
11204
11205 #else /* I_VARARGS */
11206
11207 xxx(va_alist)
11208 va_dcl
11209 {
11210     va_list args;
11211     char buf[10];
11212     va_start(args);
11213     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11214 }
11215 int main() { xxx("foo"); }
11216
11217 #endif
11218
11219 EOF
11220         set try
11221         if eval $compile_ok; then
11222                 if $run ./try; then
11223                         echo "Your vsprintf() returns (int)." >&4
11224                         val2="$undef"
11225                 else
11226                         echo "Your vsprintf() returns (char*)." >&4
11227                         val2="$define"
11228                 fi
11229         else
11230                 echo 'I am unable to compile the vsprintf() test program.' >&4
11231                 # We shouldn't get here.  If we do, assume the standard signature,
11232                 # not the old BSD one.
11233                 echo 'Guessing that vsprintf() returns (int).' >&4
11234                 val2="$undef"
11235         fi
11236 else
11237         echo 'vprintf() NOT found.' >&4
11238         val="$undef"
11239         val2="$undef"
11240 fi
11241 $rm_try
11242 set d_vprintf
11243 eval $setvar
11244 val=$val2
11245 set d_charvspr
11246 eval $setvar
11247
11248 : see if chown exists
11249 set chown d_chown
11250 eval $inlibc
11251
11252 : see if chroot exists
11253 set chroot d_chroot
11254 eval $inlibc
11255
11256 : see if chsize exists
11257 set chsize d_chsize
11258 eval $inlibc
11259
11260 : see if class exists
11261 set class d_class
11262 eval $inlibc
11263
11264 : see if clearenv exists
11265 set clearenv d_clearenv
11266 eval $inlibc
11267
11268 : Define hasstruct macro for Configure internal use
11269 hasstruct='varname=$1; struct=$2; shift; shift;
11270 while $test $# -ge 2; do
11271         case "$1" in
11272         $define) echo "#include <$2>";;
11273         esac ;
11274     shift 2;
11275 done > try.c;
11276 echo "int main () { struct $struct foo; }" >> try.c;
11277 set try;
11278 if eval $compile; then
11279         val="$define";
11280 else
11281         val="$undef";
11282 fi;
11283 set $varname;
11284 eval $setvar;
11285 $rm_try'
11286
11287 : see whether socket exists
11288 socketlib=''
11289 sockethdr=''
11290 echo " "
11291 $echo $n "Hmm... $c" >&4
11292 if set socket val -f d_socket; eval $csym; $val; then
11293         echo "Looks like you have Berkeley networking support." >&4
11294         d_socket="$define"
11295         if set setsockopt val -f; eval $csym; $val; then
11296                 d_oldsock="$undef"
11297         else
11298                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11299                 d_oldsock="$define"
11300         fi
11301 else
11302         if $contains socklib libc.list >/dev/null 2>&1; then
11303                 echo "Looks like you have Berkeley networking support." >&4
11304                 d_socket="$define"
11305                 : we will have to assume that it supports the 4.2 BSD interface
11306                 d_oldsock="$undef"
11307         else
11308                 echo "You don't have Berkeley networking in libc$_a..." >&4
11309                 if test "X$d_socket" = "X$define"; then
11310                    echo "...but you seem to believe that you have sockets." >&4
11311                 else
11312                         for net in net socket
11313                         do
11314                                 if test -f /usr/lib/lib$net$_a; then
11315                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11316                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11317                                         if $contains socket libc.list >/dev/null 2>&1; then
11318                                                 d_socket="$define"
11319                                                 socketlib="-l$net"
11320                                                 case "$net" in
11321                                                 net)
11322                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11323                                                         sockethdr="-I/usr/netinclude"
11324                                                         ;;
11325                                                 esac
11326                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11327                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11328                                                         d_oldsock="$undef"
11329                                                 else
11330                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11331                                                         d_oldsock="$define"
11332                                                 fi
11333                                                 break
11334                                         fi
11335                                 fi
11336                         done
11337                         if test "X$d_socket" != "X$define"; then
11338                            echo "or anywhere else I see." >&4
11339                            d_socket="$undef"
11340                            d_oldsock="$undef"
11341                         fi
11342                 fi
11343         fi
11344 fi
11345
11346 : see if socketpair exists
11347 set socketpair d_sockpair
11348 eval $inlibc
11349
11350
11351 echo " "
11352 echo "Checking the availability of certain socket constants..." >&4
11353 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11354         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11355         $cat >try.c <<EOF
11356 #include <sys/types.h>
11357 #include <sys/socket.h>
11358 int main() {
11359     int i = $ENUM;
11360 }
11361 EOF
11362         val="$undef"
11363         set try; if eval $compile; then
11364                 val="$define"
11365         fi
11366         set d_${enum}; eval $setvar
11367         $rm_try
11368 done
11369
11370 : see if this is a sys/uio.h system
11371 set sys/uio.h i_sysuio
11372 eval $inhdr
11373
11374 : Check for cmsghdr support
11375 echo " "
11376 echo "Checking to see if your system supports struct cmsghdr..." >&4
11377 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11378 eval $hasstruct
11379 case "$d_cmsghdr_s" in
11380 "$define")      echo "Yes, it does."   ;;
11381 *)              echo "No, it doesn't." ;;
11382 esac
11383
11384
11385 : check for const keyword
11386 echo " "
11387 echo 'Checking to see if your C compiler knows about "const"...' >&4
11388 $cat >const.c <<'EOCP'
11389 typedef struct spug { int drokk; } spug;
11390 int main()
11391 {
11392         const char *foo;
11393         const spug y = { 0 };
11394 }
11395 EOCP
11396 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11397         val="$define"
11398         echo "Yup, it does."
11399 else
11400         val="$undef"
11401         echo "Nope, it doesn't."
11402 fi
11403 set d_const
11404 eval $setvar
11405
11406 : see if copysignl exists
11407 set copysignl d_copysignl
11408 eval $inlibc
11409
11410 : see if crypt exists
11411 echo " "
11412 set crypt d_crypt
11413 eval $inlibc
11414 case "$d_crypt" in
11415 $define) cryptlib='' ;;
11416 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11417                 echo 'crypt() found.' >&4
11418                 val="$define"
11419                 cryptlib=''
11420         else
11421                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11422                 if $test -z "$cryptlib"; then
11423                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11424                 else
11425                         cryptlib=-lcrypt
11426                 fi
11427                 if $test -z "$cryptlib"; then
11428                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11429                 else
11430                         cryptlib=-lcrypt
11431                 fi
11432                 if $test -z "$cryptlib"; then
11433                         cryptlib=`./loc libcrypt$_a "" $libpth`
11434                 else
11435                         cryptlib=-lcrypt
11436                 fi
11437                 if $test -z "$cryptlib"; then
11438                         echo 'crypt() NOT found.' >&4
11439                         val="$undef"
11440                 else
11441                         val="$define"
11442                 fi
11443         fi
11444         set d_crypt
11445         eval $setvar
11446         ;;
11447 esac
11448
11449 : see if this is a crypt.h system
11450 set crypt.h i_crypt
11451 eval $inhdr
11452
11453 : see if crypt_r exists
11454 set crypt_r d_crypt_r
11455 eval $inlibc
11456 case "$d_crypt_r" in
11457 "$define")
11458         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11459         case "$d_crypt_r_proto:$usethreads" in
11460         ":define")      d_crypt_r_proto=define
11461                 set d_crypt_r_proto crypt_r $hdrs
11462                 eval $hasproto ;;
11463         *)      ;;
11464         esac
11465         case "$d_crypt_r_proto" in
11466         define)
11467         case "$crypt_r_proto" in
11468         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11469         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11470         esac
11471         case "$crypt_r_proto" in
11472         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11473         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11474         esac
11475         case "$crypt_r_proto" in
11476         ''|0)   d_crypt_r=undef
11477                 crypt_r_proto=0
11478                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11479         * )     case "$crypt_r_proto" in
11480                 REENTRANT_PROTO*) ;;
11481                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11482                 esac
11483                 echo "Prototype: $try" ;;
11484         esac
11485         ;;
11486         *)      case "$usethreads" in
11487                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11488                 esac
11489                 d_crypt_r=undef
11490                 crypt_r_proto=0
11491                 ;;
11492         esac
11493         ;;
11494 *)      crypt_r_proto=0
11495         ;;
11496 esac
11497
11498 : get csh whereabouts
11499 case "$csh" in
11500 'csh') val="$undef" ;;
11501 *) val="$define" ;;
11502 esac
11503 set d_csh
11504 eval $setvar
11505 : Respect a hint or command line value for full_csh.
11506 case "$full_csh" in
11507 '') full_csh=$csh ;;
11508 esac
11509
11510 : see if ctermid exists
11511 set ctermid d_ctermid
11512 eval $inlibc
11513
11514 : see if ctermid_r exists
11515 set ctermid_r d_ctermid_r
11516 eval $inlibc
11517 case "$d_ctermid_r" in
11518 "$define")
11519         hdrs="$i_systypes sys/types.h define stdio.h "
11520         case "$d_ctermid_r_proto:$usethreads" in
11521         ":define")      d_ctermid_r_proto=define
11522                 set d_ctermid_r_proto ctermid_r $hdrs
11523                 eval $hasproto ;;
11524         *)      ;;
11525         esac
11526         case "$d_ctermid_r_proto" in
11527         define)
11528         case "$ctermid_r_proto" in
11529         ''|0) try='char* ctermid_r(char*);'
11530         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11531         esac
11532         case "$ctermid_r_proto" in
11533         ''|0)   d_ctermid_r=undef
11534                 ctermid_r_proto=0
11535                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11536         * )     case "$ctermid_r_proto" in
11537                 REENTRANT_PROTO*) ;;
11538                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11539                 esac
11540                 echo "Prototype: $try" ;;
11541         esac
11542         ;;
11543         *)      case "$usethreads" in
11544                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11545                 esac
11546                 d_ctermid_r=undef
11547                 ctermid_r_proto=0
11548                 ;;
11549         esac
11550         ;;
11551 *)      ctermid_r_proto=0
11552         ;;
11553 esac
11554
11555 : see if ctime_r exists
11556 set ctime_r d_ctime_r
11557 eval $inlibc
11558 case "$d_ctime_r" in
11559 "$define")
11560         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11561         case "$d_ctime_r_proto:$usethreads" in
11562         ":define")      d_ctime_r_proto=define
11563                 set d_ctime_r_proto ctime_r $hdrs
11564                 eval $hasproto ;;
11565         *)      ;;
11566         esac
11567         case "$d_ctime_r_proto" in
11568         define)
11569         case "$ctime_r_proto" in
11570         ''|0) try='char* ctime_r(const time_t*, char*);'
11571         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11572         esac
11573         case "$ctime_r_proto" in
11574         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11575         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11576         esac
11577         case "$ctime_r_proto" in
11578         ''|0) try='int ctime_r(const time_t*, char*);'
11579         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11580         esac
11581         case "$ctime_r_proto" in
11582         ''|0) try='int ctime_r(const time_t*, char*, int);'
11583         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11584         esac
11585         case "$ctime_r_proto" in
11586         ''|0)   d_ctime_r=undef
11587                 ctime_r_proto=0
11588                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11589         * )     case "$ctime_r_proto" in
11590                 REENTRANT_PROTO*) ;;
11591                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11592                 esac
11593                 echo "Prototype: $try" ;;
11594         esac
11595         ;;
11596         *)      case "$usethreads" in
11597                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11598                 esac
11599                 d_ctime_r=undef
11600                 ctime_r_proto=0
11601                 ;;
11602         esac
11603         ;;
11604 *)      ctime_r_proto=0
11605         ;;
11606 esac
11607
11608 : see if cuserid exists
11609 set cuserid d_cuserid
11610 eval $inlibc
11611
11612 : see if this is a limits.h system
11613 set limits.h i_limits
11614 eval $inhdr
11615
11616 : see if this is a float.h system
11617 set float.h i_float
11618 eval $inhdr
11619
11620 : See if number of significant digits in a double precision number is known
11621 echo " "
11622 $cat >dbl_dig.c <<EOM
11623 #$i_limits I_LIMITS
11624 #$i_float I_FLOAT
11625 #ifdef I_LIMITS
11626 #include <limits.h>
11627 #endif
11628 #ifdef I_FLOAT
11629 #include <float.h>
11630 #endif
11631 #ifdef DBL_DIG
11632 printf("Contains DBL_DIG");
11633 #endif
11634 EOM
11635 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11636 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11637         echo "DBL_DIG found." >&4
11638         val="$define"
11639 else
11640         echo "DBL_DIG NOT found." >&4
11641         val="$undef"
11642 fi
11643 $rm -f dbl_dig.?
11644 set d_dbl_dig
11645 eval $setvar
11646
11647 : see if dbm.h is available
11648 : see if dbmclose exists
11649 set dbmclose d_dbmclose
11650 eval $inlibc
11651
11652 case "$d_dbmclose" in
11653 $define)
11654         set dbm.h i_dbm
11655         eval $inhdr
11656         case "$i_dbm" in
11657         $define)
11658                 val="$undef"
11659                 set i_rpcsvcdbm
11660                 eval $setvar
11661                 ;;
11662         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11663                 eval $inhdr
11664                 ;;
11665         esac
11666         ;;
11667 *)      echo "We won't be including <dbm.h>"
11668         val="$undef"
11669         set i_dbm
11670         eval $setvar
11671         val="$undef"
11672         set i_rpcsvcdbm
11673         eval $setvar
11674         ;;
11675 esac
11676
11677 : see if prototype for dbminit is available
11678 echo " "
11679 set d_dbminitproto dbminit $i_dbm dbm.h
11680 eval $hasproto
11681
11682 : see if difftime exists
11683 set difftime d_difftime
11684 eval $inlibc
11685
11686 : see if this is a dirent system
11687 echo " "
11688 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11689         val="$define"
11690         echo "<dirent.h> found." >&4
11691 else
11692         val="$undef"
11693         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11694                 echo "<sys/dir.h> found." >&4
11695                 echo " "
11696         else
11697                 xinc=`./findhdr sys/ndir.h`
11698         fi
11699         echo "<dirent.h> NOT found." >&4
11700 fi
11701 set i_dirent
11702 eval $setvar
11703
11704 : Look for type of directory structure.
11705 echo " "
11706 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11707
11708 case "$direntrytype" in
11709 ''|' ')
11710         case "$i_dirent" in
11711         $define) guess1='struct dirent' ;;
11712         *) guess1='struct direct'  ;;
11713         esac
11714         ;;
11715 *)      guess1="$direntrytype"
11716         ;;
11717 esac
11718
11719 case "$guess1" in
11720 'struct dirent') guess2='struct direct' ;;
11721 *) guess2='struct dirent' ;;
11722 esac
11723
11724 if $contains "$guess1" try.c >/dev/null 2>&1; then
11725         direntrytype="$guess1"
11726         echo "Your directory entries are $direntrytype." >&4
11727 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11728         direntrytype="$guess2"
11729         echo "Your directory entries seem to be $direntrytype." >&4
11730 else
11731         echo "I don't recognize your system's directory entries." >&4
11732         rp="What type is used for directory entries on this system?"
11733         dflt="$guess1"
11734         . ./myread
11735         direntrytype="$ans"
11736 fi
11737 $rm_try
11738
11739 : see if the directory entry stores field length
11740 echo " "
11741 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11742 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11743         echo "Good, your directory entry keeps length information in d_namlen." >&4
11744         val="$define"
11745 else
11746         echo "Your directory entry does not know about the d_namlen field." >&4
11747         val="$undef"
11748 fi
11749 set d_dirnamlen
11750 eval $setvar
11751 $rm_try
11752
11753 : Look for DIR.dd_fd
11754 case "$i_dirent" in
11755 "$define")
11756     echo "Checking to see if DIR has a dd_fd member variable" >&4
11757     $cat >try.c <<EOCP
11758 #$i_stdlib I_STDLIB
11759 #ifdef I_STDLIB
11760 #include <stdlib.h>
11761 #endif
11762 #include <dirent.h>
11763
11764 int main() {
11765     DIR dir;
11766     dir.dd_fd = 1;
11767     return 0;
11768 }
11769 EOCP
11770     val=$undef
11771     set try
11772     if eval $compile; then
11773         echo "Yes, it does."
11774         val="$define"
11775     else
11776         echo "No, it does not."
11777         val="$undef"
11778     fi
11779     ;;
11780 *)
11781     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11782     val="$undef"
11783     ;;
11784 esac
11785 set d_dir_dd_fd
11786 eval $setvar
11787 $rm_try
11788
11789 : see if this is an sysdir system
11790 set sys/dir.h i_sysdir
11791 eval $inhdr
11792
11793 : see if this is an sysndir system
11794 set sys/ndir.h i_sysndir
11795 eval $inhdr
11796
11797 : Look for dirfd
11798 echo " "
11799 $cat >dirfd.c <<EOM
11800 #include <stdio.h>
11801 #$i_stdlib I_STDLIB
11802 #ifdef I_STDLIB
11803 #include <stdlib.h>
11804 #endif
11805 #$i_dirent I_DIRENT             /**/
11806 #$i_sysdir I_SYS_DIR            /**/
11807 #$i_sysndir I_SYS_NDIR          /**/
11808 #$i_systypes I_SYS_TYPES        /**/
11809 #if defined(I_SYS_TYPES)
11810 #include <sys/types.h>
11811 #endif
11812 #if defined(I_DIRENT)
11813 #include <dirent.h>
11814 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11815 #include <sys/dir.h>
11816 #endif
11817 #else
11818 #ifdef I_SYS_NDIR
11819 #include <sys/ndir.h>
11820 #else
11821 #ifdef I_SYS_DIR
11822 #ifdef hp9000s500
11823 #include <ndir.h>       /* may be wrong in the future */
11824 #else
11825 #include <sys/dir.h>
11826 #endif
11827 #endif
11828 #endif
11829 #endif 
11830 int main() {
11831         DIR *dirp = opendir(".");
11832         if (dirfd(dirp) >= 0)
11833                 exit(0);
11834         else
11835                 exit(1);
11836 }
11837 EOM
11838 val=$undef
11839 set dirfd
11840 if eval $compile; then
11841         val="$define"
11842 fi
11843 case "$val" in
11844 $define)        echo "dirfd() found." >&4       ;;
11845 *)              echo "dirfd() NOT found." >&4   ;;
11846 esac
11847 set d_dirfd
11848 eval $setvar
11849 $rm -f dirfd*
11850
11851 : see if dlerror exists
11852 xxx_runnm="$runnm"
11853 runnm=false
11854 set dlerror d_dlerror
11855 eval $inlibc
11856 runnm="$xxx_runnm"
11857
11858 : see if dlfcn is available
11859 set dlfcn.h i_dlfcn
11860 eval $inhdr
11861
11862 : Check what extension to use for shared libs
11863 case "$usedl" in
11864 $define|y|true)
11865         $cat << EOM
11866
11867 On a few systems, the dynamically loaded modules that perl generates and uses
11868 will need a different extension than shared libs. The default will probably
11869 be appropriate.
11870
11871 EOM
11872         case "$dlext" in
11873         '')     dflt="$so" ;;
11874         *)      dflt="$dlext" ;;
11875         esac
11876         rp='What is the extension of dynamically loaded modules'
11877         . ./myread
11878         dlext="$ans"
11879         ;;
11880 *)
11881         dlext="none"
11882         ;;
11883 esac
11884
11885 : Check if dlsym need a leading underscore
11886 echo " "
11887 val="$undef"
11888
11889 case "$dlsrc" in
11890 dl_dlopen.xs)
11891         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11892         $cat >dyna.c <<'EOM'
11893 fred () { }
11894 EOM
11895
11896 $cat >fred.c<<EOM
11897
11898 #include <stdio.h>
11899 #$i_stdlib I_STDLIB
11900 #ifdef I_STDLIB
11901 #include <stdlib.h>
11902 #endif
11903 #$i_dlfcn I_DLFCN
11904 #ifdef I_DLFCN
11905 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11906 #else
11907 #include <sys/types.h>
11908 #include <nlist.h>
11909 #include <link.h>
11910 #endif
11911
11912 extern int fred() ;
11913
11914 int main()
11915 {
11916     void * handle ;
11917     void * symbol ;
11918 #ifndef RTLD_LAZY
11919     int mode = 1 ;
11920 #else
11921     int mode = RTLD_LAZY ;
11922 #endif
11923     handle = dlopen("./dyna.$dlext", mode) ;
11924     if (handle == NULL) {
11925         printf ("1\n") ;
11926         fflush (stdout) ;
11927         exit(0);
11928     }
11929     symbol = dlsym(handle, "fred") ;
11930     if (symbol == NULL) {
11931         /* try putting a leading underscore */
11932         symbol = dlsym(handle, "_fred") ;
11933         if (symbol == NULL) {
11934             printf ("2\n") ;
11935             fflush (stdout) ;
11936             exit(0);
11937         }
11938         printf ("3\n") ;
11939     }
11940     else
11941         printf ("4\n") ;
11942     fflush (stdout) ;
11943     exit(0);
11944 }
11945 EOM
11946         : Call the object file tmp-dyna.o in case dlext=o.
11947         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11948                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11949                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11950                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11951                 xxx=`$run ./fred`
11952                 case $xxx in
11953                 1)      echo "Test program failed using dlopen." >&4
11954                         echo "Perhaps you should not use dynamic loading." >&4;;
11955                 2)      echo "Test program failed using dlsym." >&4
11956                         echo "Perhaps you should not use dynamic loading." >&4;;
11957                 3)      echo "dlsym needs a leading underscore" >&4
11958                         val="$define" ;;
11959                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11960                 esac
11961         else
11962                 echo "I can't compile and run the test program." >&4
11963                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11964         fi
11965         ;;
11966 esac
11967
11968 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11969
11970 set d_dlsymun
11971 eval $setvar
11972
11973 : see if drand48_r exists
11974 set drand48_r d_drand48_r
11975 eval $inlibc
11976 case "$d_drand48_r" in
11977 "$define")
11978         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11979         case "$d_drand48_r_proto:$usethreads" in
11980         ":define")      d_drand48_r_proto=define
11981                 set d_drand48_r_proto drand48_r $hdrs
11982                 eval $hasproto ;;
11983         *)      ;;
11984         esac
11985         case "$d_drand48_r_proto" in
11986         define)
11987         case "$drand48_r_proto" in
11988         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11989         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11990         esac
11991         case "$drand48_r_proto" in
11992         ''|0)   d_drand48_r=undef
11993                 drand48_r_proto=0
11994                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11995         * )     case "$drand48_r_proto" in
11996                 REENTRANT_PROTO*) ;;
11997                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11998                 esac
11999                 echo "Prototype: $try" ;;
12000         esac
12001         ;;
12002         *)      case "$usethreads" in
12003                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12004                 esac
12005                 d_drand48_r=undef
12006                 drand48_r_proto=0
12007                 ;;
12008         esac
12009         ;;
12010 *)      drand48_r_proto=0
12011         ;;
12012 esac
12013
12014 : see if prototype for drand48 is available
12015 echo " "
12016 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12017 eval $hasproto
12018
12019 : see if dup2 exists
12020 set dup2 d_dup2
12021 eval $inlibc
12022
12023 : see if eaccess exists
12024 set eaccess d_eaccess
12025 eval $inlibc
12026
12027 : see if endgrent exists
12028 set endgrent d_endgrent
12029 eval $inlibc
12030
12031 : see if this is an grp system
12032 set grp.h i_grp
12033 eval $inhdr
12034
12035 case "$i_grp" in
12036 $define)
12037         xxx=`./findhdr grp.h`
12038         $cppstdin $cppflags $cppminus < $xxx >$$.h
12039
12040         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12041                 val="$define"
12042         else
12043                 val="$undef"
12044         fi
12045         set d_grpasswd
12046         eval $setvar
12047
12048         $rm -f $$.h
12049         ;;
12050 *)
12051         val="$undef";
12052         set d_grpasswd; eval $setvar
12053         ;;
12054 esac
12055
12056 : see if endgrent_r exists
12057 set endgrent_r d_endgrent_r
12058 eval $inlibc
12059 case "$d_endgrent_r" in
12060 "$define")
12061         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12062         case "$d_endgrent_r_proto:$usethreads" in
12063         ":define")      d_endgrent_r_proto=define
12064                 set d_endgrent_r_proto endgrent_r $hdrs
12065                 eval $hasproto ;;
12066         *)      ;;
12067         esac
12068         case "$d_endgrent_r_proto" in
12069         define)
12070         case "$endgrent_r_proto" in
12071         ''|0) try='int endgrent_r(FILE**);'
12072         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12073         esac
12074         case "$endgrent_r_proto" in
12075         ''|0) try='void endgrent_r(FILE**);'
12076         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12077         esac
12078         case "$endgrent_r_proto" in
12079         ''|0)   d_endgrent_r=undef
12080                 endgrent_r_proto=0
12081                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12082         * )     case "$endgrent_r_proto" in
12083                 REENTRANT_PROTO*) ;;
12084                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12085                 esac
12086                 echo "Prototype: $try" ;;
12087         esac
12088         ;;
12089         *)      case "$usethreads" in
12090                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12091                 esac
12092                 d_endgrent_r=undef
12093                 endgrent_r_proto=0
12094                 ;;
12095         esac
12096         ;;
12097 *)      endgrent_r_proto=0
12098         ;;
12099 esac
12100
12101 : see if endhostent exists
12102 set endhostent d_endhent
12103 eval $inlibc
12104
12105 : see if this is a netdb.h system
12106 set netdb.h i_netdb
12107 eval $inhdr
12108
12109 : see if endhostent_r exists
12110 set endhostent_r d_endhostent_r
12111 eval $inlibc
12112 case "$d_endhostent_r" in
12113 "$define")
12114         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12115         case "$d_endhostent_r_proto:$usethreads" in
12116         ":define")      d_endhostent_r_proto=define
12117                 set d_endhostent_r_proto endhostent_r $hdrs
12118                 eval $hasproto ;;
12119         *)      ;;
12120         esac
12121         case "$d_endhostent_r_proto" in
12122         define)
12123         case "$endhostent_r_proto" in
12124         ''|0) try='int endhostent_r(struct hostent_data*);'
12125         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12126         esac
12127         case "$endhostent_r_proto" in
12128         ''|0) try='void endhostent_r(struct hostent_data*);'
12129         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12130         esac
12131         case "$endhostent_r_proto" in
12132         ''|0)   d_endhostent_r=undef
12133                 endhostent_r_proto=0
12134                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12135         * )     case "$endhostent_r_proto" in
12136                 REENTRANT_PROTO*) ;;
12137                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12138                 esac
12139                 echo "Prototype: $try" ;;
12140         esac
12141         ;;
12142         *)      case "$usethreads" in
12143                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12144                 esac
12145                 d_endhostent_r=undef
12146                 endhostent_r_proto=0
12147                 ;;
12148         esac
12149         ;;
12150 *)      endhostent_r_proto=0
12151         ;;
12152 esac
12153
12154 : see if endnetent exists
12155 set endnetent d_endnent
12156 eval $inlibc
12157
12158 : see if endnetent_r exists
12159 set endnetent_r d_endnetent_r
12160 eval $inlibc
12161 case "$d_endnetent_r" in
12162 "$define")
12163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12164         case "$d_endnetent_r_proto:$usethreads" in
12165         ":define")      d_endnetent_r_proto=define
12166                 set d_endnetent_r_proto endnetent_r $hdrs
12167                 eval $hasproto ;;
12168         *)      ;;
12169         esac
12170         case "$d_endnetent_r_proto" in
12171         define)
12172         case "$endnetent_r_proto" in
12173         ''|0) try='int endnetent_r(struct netent_data*);'
12174         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12175         esac
12176         case "$endnetent_r_proto" in
12177         ''|0) try='void endnetent_r(struct netent_data*);'
12178         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12179         esac
12180         case "$endnetent_r_proto" in
12181         ''|0)   d_endnetent_r=undef
12182                 endnetent_r_proto=0
12183                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12184         * )     case "$endnetent_r_proto" in
12185                 REENTRANT_PROTO*) ;;
12186                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12187                 esac
12188                 echo "Prototype: $try" ;;
12189         esac
12190         ;;
12191         *)      case "$usethreads" in
12192                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12193                 esac
12194                 d_endnetent_r=undef
12195                 endnetent_r_proto=0
12196                 ;;
12197         esac
12198         ;;
12199 *)      endnetent_r_proto=0
12200         ;;
12201 esac
12202
12203 : see if endprotoent exists
12204 set endprotoent d_endpent
12205 eval $inlibc
12206
12207 : see if endprotoent_r exists
12208 set endprotoent_r d_endprotoent_r
12209 eval $inlibc
12210 case "$d_endprotoent_r" in
12211 "$define")
12212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12213         case "$d_endprotoent_r_proto:$usethreads" in
12214         ":define")      d_endprotoent_r_proto=define
12215                 set d_endprotoent_r_proto endprotoent_r $hdrs
12216                 eval $hasproto ;;
12217         *)      ;;
12218         esac
12219         case "$d_endprotoent_r_proto" in
12220         define)
12221         case "$endprotoent_r_proto" in
12222         ''|0) try='int endprotoent_r(struct protoent_data*);'
12223         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12224         esac
12225         case "$endprotoent_r_proto" in
12226         ''|0) try='void endprotoent_r(struct protoent_data*);'
12227         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12228         esac
12229         case "$endprotoent_r_proto" in
12230         ''|0)   d_endprotoent_r=undef
12231                 endprotoent_r_proto=0
12232                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12233         * )     case "$endprotoent_r_proto" in
12234                 REENTRANT_PROTO*) ;;
12235                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12236                 esac
12237                 echo "Prototype: $try" ;;
12238         esac
12239         ;;
12240         *)      case "$usethreads" in
12241                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12242                 esac
12243                 d_endprotoent_r=undef
12244                 endprotoent_r_proto=0
12245                 ;;
12246         esac
12247         ;;
12248 *)      endprotoent_r_proto=0
12249         ;;
12250 esac
12251
12252 : see if endpwent exists
12253 set endpwent d_endpwent
12254 eval $inlibc
12255
12256 : see if this is a pwd.h system
12257 set pwd.h i_pwd
12258 eval $inhdr
12259
12260 case "$i_pwd" in
12261 $define)
12262         xxx=`./findhdr pwd.h`
12263         $cppstdin $cppflags $cppminus < $xxx >$$.h
12264
12265         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12266                 val="$define"
12267         else
12268                 val="$undef"
12269         fi
12270         set d_pwquota
12271         eval $setvar
12272
12273         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12274                 val="$define"
12275         else
12276                 val="$undef"
12277         fi
12278         set d_pwage
12279         eval $setvar
12280
12281         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12282                 val="$define"
12283         else
12284                 val="$undef"
12285         fi
12286         set d_pwchange
12287         eval $setvar
12288
12289         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12290                 val="$define"
12291         else
12292                 val="$undef"
12293         fi
12294         set d_pwclass
12295         eval $setvar
12296
12297         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12298                 val="$define"
12299         else
12300                 val="$undef"
12301         fi
12302         set d_pwexpire
12303         eval $setvar
12304
12305         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12306                 val="$define"
12307         else
12308                 val="$undef"
12309         fi
12310         set d_pwcomment
12311         eval $setvar
12312
12313         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12314                 val="$define"
12315         else
12316                 val="$undef"
12317         fi
12318         set d_pwgecos
12319         eval $setvar
12320
12321         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12322                 val="$define"
12323         else
12324                 val="$undef"
12325         fi
12326         set d_pwpasswd
12327         eval $setvar
12328
12329         $rm -f $$.h
12330         ;;
12331 *)
12332         val="$undef"; 
12333         set d_pwquota; eval $setvar
12334         set d_pwage; eval $setvar
12335         set d_pwchange; eval $setvar
12336         set d_pwclass; eval $setvar
12337         set d_pwexpire; eval $setvar
12338         set d_pwcomment; eval $setvar
12339         set d_pwgecos; eval $setvar
12340         set d_pwpasswd; eval $setvar
12341         ;;
12342 esac
12343
12344 : see if endpwent_r exists
12345 set endpwent_r d_endpwent_r
12346 eval $inlibc
12347 case "$d_endpwent_r" in
12348 "$define")
12349         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12350         case "$d_endpwent_r_proto:$usethreads" in
12351         ":define")      d_endpwent_r_proto=define
12352                 set d_endpwent_r_proto endpwent_r $hdrs
12353                 eval $hasproto ;;
12354         *)      ;;
12355         esac
12356         case "$d_endpwent_r_proto" in
12357         define)
12358         case "$endpwent_r_proto" in
12359         ''|0) try='int endpwent_r(FILE**);'
12360         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12361         esac
12362         case "$endpwent_r_proto" in
12363         ''|0) try='void endpwent_r(FILE**);'
12364         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12365         esac
12366         case "$endpwent_r_proto" in
12367         ''|0)   d_endpwent_r=undef
12368                 endpwent_r_proto=0
12369                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12370         * )     case "$endpwent_r_proto" in
12371                 REENTRANT_PROTO*) ;;
12372                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12373                 esac
12374                 echo "Prototype: $try" ;;
12375         esac
12376         ;;
12377         *)      case "$usethreads" in
12378                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12379                 esac
12380                 d_endpwent_r=undef
12381                 endpwent_r_proto=0
12382                 ;;
12383         esac
12384         ;;
12385 *)      endpwent_r_proto=0
12386         ;;
12387 esac
12388
12389 : see if endservent exists
12390 set endservent d_endsent
12391 eval $inlibc
12392
12393 : see if endservent_r exists
12394 set endservent_r d_endservent_r
12395 eval $inlibc
12396 case "$d_endservent_r" in
12397 "$define")
12398         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12399         case "$d_endservent_r_proto:$usethreads" in
12400         ":define")      d_endservent_r_proto=define
12401                 set d_endservent_r_proto endservent_r $hdrs
12402                 eval $hasproto ;;
12403         *)      ;;
12404         esac
12405         case "$d_endservent_r_proto" in
12406         define)
12407         case "$endservent_r_proto" in
12408         ''|0) try='int endservent_r(struct servent_data*);'
12409         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12410         esac
12411         case "$endservent_r_proto" in
12412         ''|0) try='void endservent_r(struct servent_data*);'
12413         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12414         esac
12415         case "$endservent_r_proto" in
12416         ''|0)   d_endservent_r=undef
12417                 endservent_r_proto=0
12418                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12419         * )     case "$endservent_r_proto" in
12420                 REENTRANT_PROTO*) ;;
12421                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12422                 esac
12423                 echo "Prototype: $try" ;;
12424         esac
12425         ;;
12426         *)      case "$usethreads" in
12427                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12428                 esac
12429                 d_endservent_r=undef
12430                 endservent_r_proto=0
12431                 ;;
12432         esac
12433         ;;
12434 *)      endservent_r_proto=0
12435         ;;
12436 esac
12437
12438 : Locate the flags for 'open()'
12439 echo " "
12440 $cat >try.c <<EOCP
12441 #include <sys/types.h>
12442 #ifdef I_FCNTL
12443 #include <fcntl.h>
12444 #endif
12445 #ifdef I_SYS_FILE
12446 #include <sys/file.h>
12447 #endif
12448 #$i_stdlib I_STDLIB
12449 #ifdef I_STDLIB
12450 #include <stdlib.h>
12451 #endif
12452 int main() {
12453         if(O_RDONLY);
12454 #ifdef O_TRUNC
12455         exit(0);
12456 #else
12457         exit(1);
12458 #endif
12459 }
12460 EOCP
12461 : check sys/file.h first to get FREAD on Sun
12462 if $test `./findhdr sys/file.h` && \
12463                 set try -DI_SYS_FILE && eval $compile; then
12464         h_sysfile=true;
12465         echo "<sys/file.h> defines the O_* constants..." >&4
12466         if $run ./try; then
12467                 echo "and you have the 3 argument form of open()." >&4
12468                 val="$define"
12469         else
12470                 echo "but not the 3 argument form of open().  Oh, well." >&4
12471                 val="$undef"
12472         fi
12473 elif $test `./findhdr fcntl.h` && \
12474                 set try -DI_FCNTL && eval $compile; then
12475         h_fcntl=true;
12476         echo "<fcntl.h> defines the O_* constants..." >&4
12477         if $run ./try; then
12478                 echo "and you have the 3 argument form of open()." >&4
12479                 val="$define"
12480         else
12481                 echo "but not the 3 argument form of open().  Oh, well." >&4
12482                 val="$undef"
12483         fi
12484 else
12485         val="$undef"
12486         echo "I can't find the O_* constant definitions!  You got problems." >&4
12487 fi
12488 set d_open3
12489 eval $setvar
12490 $rm_try
12491
12492 : see if this is a sys/file.h system
12493 val=''
12494 set sys/file.h val
12495 eval $inhdr
12496
12497 : do we need to include sys/file.h ?
12498 case "$val" in
12499 "$define")
12500         echo " "
12501         if $h_sysfile; then
12502                 val="$define"
12503                 echo "We'll be including <sys/file.h>." >&4
12504         else
12505                 val="$undef"
12506                 echo "We won't be including <sys/file.h>." >&4
12507         fi
12508         ;;
12509 *)
12510         h_sysfile=false
12511         ;;
12512 esac
12513 set i_sysfile
12514 eval $setvar
12515
12516 : see if fcntl.h is there
12517 val=''
12518 set fcntl.h val
12519 eval $inhdr
12520
12521 : see if we can include fcntl.h
12522 case "$val" in
12523 "$define")
12524         echo " "
12525         if $h_fcntl; then
12526                 val="$define"
12527                 echo "We'll be including <fcntl.h>." >&4
12528         else
12529                 val="$undef"
12530                 if $h_sysfile; then
12531         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12532                 else
12533                         echo "We won't be including <fcntl.h>." >&4
12534                 fi
12535         fi
12536         ;;
12537 *)
12538         h_fcntl=false
12539         val="$undef"
12540         ;;
12541 esac
12542 set i_fcntl
12543 eval $setvar
12544
12545 : see if fork exists
12546 set fork d_fork
12547 eval $inlibc
12548
12549 : see if pipe exists
12550 set pipe d_pipe
12551 eval $inlibc
12552
12553 : check for non-blocking I/O stuff
12554 case "$h_sysfile" in
12555 true) echo "#include <sys/file.h>" > head.c;;
12556 *)
12557        case "$h_fcntl" in
12558        true) echo "#include <fcntl.h>" > head.c;;
12559        *) echo "#include <sys/fcntl.h>" > head.c;;
12560        esac
12561        ;;
12562 esac
12563 echo " "
12564 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12565 case "$o_nonblock" in
12566 '')
12567         $cat head.c > try.c
12568         $cat >>try.c <<EOCP
12569 #include <stdio.h>
12570 #$i_stdlib I_STDLIB
12571 #ifdef I_STDLIB
12572 #include <stdlib.h>
12573 #endif
12574 #$i_fcntl I_FCNTL
12575 #ifdef I_FCNTL
12576 #include <fcntl.h>
12577 #endif
12578 int main() {
12579 #ifdef O_NONBLOCK
12580         printf("O_NONBLOCK\n");
12581         exit(0);
12582 #endif
12583 #ifdef O_NDELAY
12584         printf("O_NDELAY\n");
12585         exit(0);
12586 #endif
12587 #ifdef FNDELAY
12588         printf("FNDELAY\n");
12589         exit(0);
12590 #endif
12591         exit(0);
12592 }
12593 EOCP
12594         set try
12595         if eval $compile_ok; then
12596                 o_nonblock=`$run ./try`
12597                 case "$o_nonblock" in
12598                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12599                 *) echo "Seems like we can use $o_nonblock.";;
12600                 esac
12601         else
12602                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12603         fi
12604         ;;
12605 *) echo "Using $hint value $o_nonblock.";;
12606 esac
12607 $rm_try
12608
12609 echo " "
12610 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12611 case "$eagain" in
12612 '')
12613         case "$d_fork:$d_pipe" in
12614         define:define)
12615         $cat head.c > try.c
12616         $cat >>try.c <<EOCP
12617 #include <errno.h>
12618 #include <sys/types.h>
12619 #include <signal.h>
12620 #include <stdio.h>
12621 #$i_stdlib I_STDLIB
12622 #ifdef I_STDLIB
12623 #include <stdlib.h>
12624 #endif
12625 #$i_fcntl I_FCNTL
12626 #ifdef I_FCNTL
12627 #include <fcntl.h>
12628 #endif
12629 #define MY_O_NONBLOCK $o_nonblock
12630 #ifndef errno  /* XXX need better Configure test */
12631 extern int errno;
12632 #endif
12633 #$i_unistd I_UNISTD
12634 #ifdef I_UNISTD
12635 #include <unistd.h>
12636 #endif
12637 #$i_string I_STRING
12638 #ifdef I_STRING
12639 #include <string.h>
12640 #else
12641 #include <strings.h>
12642 #endif
12643 $signal_t blech(int x) { exit(3); }
12644 EOCP
12645         $cat >> try.c <<'EOCP'
12646 int main()
12647 {
12648         int pd[2];
12649         int pu[2];
12650         char buf[1];
12651         char string[100];
12652
12653         pipe(pd);       /* Down: child -> parent */
12654         pipe(pu);       /* Up: parent -> child */
12655         if (0 != fork()) {
12656                 int ret;
12657                 close(pd[1]);   /* Parent reads from pd[0] */
12658                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12659 #ifdef F_SETFL
12660                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12661                         exit(1);
12662 #else
12663                 exit(4);
12664 #endif
12665                 signal(SIGALRM, blech);
12666                 alarm(5);
12667                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12668                         exit(2);
12669                 sprintf(string, "%d\n", ret);
12670                 write(2, string, strlen(string));
12671                 alarm(0);
12672 #ifdef EAGAIN
12673                 if (errno == EAGAIN) {
12674                         printf("EAGAIN\n");
12675                         goto ok;
12676                 }
12677 #endif
12678 #ifdef EWOULDBLOCK
12679                 if (errno == EWOULDBLOCK)
12680                         printf("EWOULDBLOCK\n");
12681 #endif
12682         ok:
12683                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12684                 sleep(2);                               /* Give it time to close our pipe */
12685                 alarm(5);
12686                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12687                 alarm(0);
12688                 sprintf(string, "%d\n", ret);
12689                 write(4, string, strlen(string));
12690                 exit(0);
12691         }
12692
12693         close(pd[0]);                   /* We write to pd[1] */
12694         close(pu[1]);                   /* We read from pu[0] */
12695         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12696         close(pd[1]);                   /* Pipe pd is now fully closed! */
12697         exit(0);                                /* Bye bye, thank you for playing! */
12698 }
12699 EOCP
12700         set try
12701         if eval $compile_ok; then
12702                 echo "$startsh" >mtry
12703                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12704                 chmod +x mtry
12705                 ./mtry >/dev/null 2>&1
12706                 case $? in
12707                 0) eagain=`$cat try.out`;;
12708                 1) echo "Could not perform non-blocking setting!";;
12709                 2) echo "I did a successful read() for something that was not there!";;
12710                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12711                 4) echo "Could not find F_SETFL!";;
12712                 *) echo "Something terribly wrong happened during testing.";;
12713                 esac
12714                 rd_nodata=`$cat try.ret`
12715                 echo "A read() system call with no data present returns $rd_nodata."
12716                 case "$rd_nodata" in
12717                 0|-1) ;;
12718                 *)
12719                         echo "(That's peculiar, fixing that to be -1.)"
12720                         rd_nodata=-1
12721                         ;;
12722                 esac
12723                 case "$eagain" in
12724                 '')
12725                         echo "Forcing errno EAGAIN on read() with no data available."
12726                         eagain=EAGAIN
12727                         ;;
12728                 *)
12729                         echo "Your read() sets errno to $eagain when no data is available."
12730                         ;;
12731                 esac
12732                 status=`$cat try.err`
12733                 case "$status" in
12734                 0) echo "And it correctly returns 0 to signal EOF.";;
12735                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12736                 *) echo "However, your read() returns '$status' on EOF??";;
12737                 esac
12738                 val="$define"
12739                 if test "$status" = "$rd_nodata"; then
12740                         echo "WARNING: you can't distinguish between EOF and no data!"
12741                         val="$undef"
12742                 fi
12743         else
12744                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12745                 eagain=EAGAIN
12746         fi
12747         ;;
12748         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12749                 eagain=EAGAIN
12750                 val="$define"
12751                 ;;
12752         esac
12753         set d_eofnblk
12754         eval $setvar
12755         ;;
12756 *)
12757         echo "Using $hint value $eagain."
12758         echo "Your read() returns $rd_nodata when no data is present."
12759         case "$d_eofnblk" in
12760         "$define") echo "And you can see EOF because read() returns 0.";;
12761         "$undef") echo "But you can't see EOF status from read() returned value.";;
12762         *)
12763                 echo "(Assuming you can't see EOF status from read anyway.)"
12764                 d_eofnblk=$undef
12765                 ;;
12766         esac
12767         ;;
12768 esac
12769 $rm_try head.c mtry
12770
12771 : see if _ptr and _cnt from stdio act std
12772 echo " "
12773
12774 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12775         echo "(Looks like you have stdio.h from BSD.)"
12776         case "$stdio_ptr" in
12777         '') stdio_ptr='((fp)->_p)'
12778                 ptr_lval=$define
12779                 ;;
12780         *)      ptr_lval=$d_stdio_ptr_lval;;
12781         esac
12782         case "$stdio_cnt" in
12783         '') stdio_cnt='((fp)->_r)'
12784                 cnt_lval=$define
12785                 ;;
12786         *)      cnt_lval=$d_stdio_cnt_lval;;
12787         esac
12788         case "$stdio_base" in
12789         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12790         esac
12791         case "$stdio_bufsiz" in
12792         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12793         esac
12794 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12795         echo "(Looks like you have stdio.h from Linux.)"
12796         case "$stdio_ptr" in
12797         '') stdio_ptr='((fp)->_IO_read_ptr)'
12798                 ptr_lval=$define
12799                 ;;
12800         *)      ptr_lval=$d_stdio_ptr_lval;;
12801         esac
12802         case "$stdio_cnt" in
12803         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12804                 cnt_lval=$undef
12805                 ;;
12806         *)      cnt_lval=$d_stdio_cnt_lval;;
12807         esac
12808         case "$stdio_base" in
12809         '') stdio_base='((fp)->_IO_read_base)';;
12810         esac
12811         case "$stdio_bufsiz" in
12812         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12813         esac
12814 else
12815         case "$stdio_ptr" in
12816         '') stdio_ptr='((fp)->_ptr)'
12817                 ptr_lval=$define
12818                 ;;
12819         *)      ptr_lval=$d_stdio_ptr_lval;;
12820         esac
12821         case "$stdio_cnt" in
12822         '') stdio_cnt='((fp)->_cnt)'
12823                 cnt_lval=$define
12824                 ;;
12825         *)      cnt_lval=$d_stdio_cnt_lval;;
12826         esac
12827         case "$stdio_base" in
12828         '') stdio_base='((fp)->_base)';;
12829         esac
12830         case "$stdio_bufsiz" in
12831         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12832         esac
12833 fi
12834
12835 : test whether _ptr and _cnt really work
12836 echo "Checking how std your stdio is..." >&4
12837 $cat >try.c <<EOP
12838 #include <stdio.h>
12839 #$i_stdlib I_STDLIB
12840 #ifdef I_STDLIB
12841 #include <stdlib.h>
12842 #endif
12843 #define FILE_ptr(fp)    $stdio_ptr
12844 #define FILE_cnt(fp)    $stdio_cnt
12845 int main() {
12846         FILE *fp = fopen("try.c", "r");
12847         char c = getc(fp);
12848         if (
12849                 18 <= FILE_cnt(fp) &&
12850                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12851         )
12852                 exit(0);
12853         exit(1);
12854 }
12855 EOP
12856 val="$undef"
12857 set try
12858 if eval $compile && $to try.c; then
12859         if $run ./try; then
12860                 echo "Your stdio acts pretty std."
12861                 val="$define"
12862         else
12863                 echo "Your stdio isn't very std."
12864         fi
12865 else
12866         echo "Your stdio doesn't appear very std."
12867 fi
12868 $rm_try
12869
12870 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12871 # direct buffer manipulation no longer works.  The Configure tests
12872 # should be changed to correctly detect this, but until then,
12873 # the following check should at least let perl compile and run.
12874 # (This quick fix should be updated before 5.8.1.)
12875 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12876 # A. Dougherty, June 3, 2002.
12877 case "$d_gnulibc" in
12878 $define)
12879         case "$gnulibc_version" in
12880         2.[01]*)  ;;
12881         2.2) ;;
12882         2.2.[0-9]) ;;
12883         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12884                 val="$undef"
12885                 ;;
12886         esac
12887         ;;
12888 esac
12889 set d_stdstdio
12890 eval $setvar
12891
12892 : Can _ptr be used as an lvalue?
12893 case "$d_stdstdio$ptr_lval" in
12894 $define$define) val=$define ;;
12895 *) val=$undef ;;
12896 esac
12897 set d_stdio_ptr_lval
12898 eval $setvar
12899
12900 : Can _cnt be used as an lvalue?
12901 case "$d_stdstdio$cnt_lval" in
12902 $define$define) val=$define ;;
12903 *) val=$undef ;;
12904 esac
12905 set d_stdio_cnt_lval
12906 eval $setvar
12907
12908
12909 : test whether setting _ptr sets _cnt as a side effect
12910 d_stdio_ptr_lval_sets_cnt="$undef"
12911 d_stdio_ptr_lval_nochange_cnt="$undef"
12912 case "$d_stdio_ptr_lval$d_stdstdio" in
12913 $define$define)
12914         echo "Checking to see what happens if we set the stdio ptr..." >&4
12915 $cat >try.c <<EOP
12916 #include <stdio.h>
12917 /* Can we scream? */
12918 /* Eat dust sed :-) */
12919 /* In the buffer space, no one can hear you scream. */
12920 #$i_stdlib I_STDLIB
12921 #ifdef I_STDLIB
12922 #include <stdlib.h>
12923 #endif
12924 #define FILE_ptr(fp)    $stdio_ptr
12925 #define FILE_cnt(fp)    $stdio_cnt
12926 #include <sys/types.h>
12927 int main() {
12928         FILE *fp = fopen("try.c", "r");
12929         int c;
12930         char *ptr;
12931         size_t cnt;
12932         if (!fp) {
12933             puts("Fail even to read");
12934             exit(1);
12935         }
12936         c = getc(fp); /* Read away the first # */
12937         if (c == EOF) {
12938             puts("Fail even to read");
12939             exit(1);
12940         }
12941         if (!(
12942                 18 <= FILE_cnt(fp) &&
12943                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12944         )) {
12945                 puts("Fail even to read");
12946                 exit (1);
12947         }
12948         ptr = (char*) FILE_ptr(fp);
12949         cnt = (size_t)FILE_cnt(fp);
12950
12951         FILE_ptr(fp) += 42;
12952
12953         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12954                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12955                 exit (1);
12956         }
12957         if (FILE_cnt(fp) <= 20) {
12958                 printf ("Fail (<20 chars to test)");
12959                 exit (1);
12960         }
12961         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12962                 puts("Fail compare");
12963                 exit (1);
12964         }
12965         if (cnt == FILE_cnt(fp)) {
12966                 puts("Pass_unchanged");
12967                 exit (0);
12968         }
12969         if (FILE_cnt(fp) == (cnt - 42)) {
12970                 puts("Pass_changed");
12971                 exit (0);
12972         }
12973         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12974         return 1;
12975
12976 }
12977 EOP
12978         set try
12979         if eval $compile && $to try.c; then
12980                 case `$run ./try` in
12981                 Pass_changed)
12982                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12983                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12984                 Pass_unchanged)
12985                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12986                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12987                 Fail*)
12988                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12989                 *)
12990                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12991         esac
12992         else
12993                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12994         fi
12995         $rm_try
12996         ;;
12997 esac
12998
12999 : see if _base is also standard
13000 val="$undef"
13001 case "$d_stdstdio" in
13002 $define)
13003         $cat >try.c <<EOP
13004 #include <stdio.h>
13005 #$i_stdlib I_STDLIB
13006 #ifdef I_STDLIB
13007 #include <stdlib.h>
13008 #endif
13009 #define FILE_base(fp)   $stdio_base
13010 #define FILE_bufsiz(fp) $stdio_bufsiz
13011 int main() {
13012         FILE *fp = fopen("try.c", "r");
13013         char c = getc(fp);
13014         if (
13015                 19 <= FILE_bufsiz(fp) &&
13016                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13017         )
13018                 exit(0);
13019         exit(1);
13020 }
13021 EOP
13022         set try
13023         if eval $compile && $to try.c; then
13024                 if $run ./try; then
13025                         echo "And its _base field acts std."
13026                         val="$define"
13027                 else
13028                         echo "But its _base field isn't std."
13029                 fi
13030         else
13031                 echo "However, it seems to be lacking the _base field."
13032         fi
13033         $rm_try
13034         ;;
13035 esac
13036 set d_stdiobase
13037 eval $setvar
13038
13039 : see if fast_stdio exists
13040 val="$undef"
13041 case "$d_stdstdio:$d_stdio_ptr_lval" in
13042 "$define:$define")
13043         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13044         *$define*)
13045                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13046                 val="$define"
13047                 ;;
13048         esac
13049         ;;
13050 esac
13051 set d_faststdio
13052 eval $setvar
13053
13054
13055
13056 : see if fchdir exists
13057 set fchdir d_fchdir
13058 eval $inlibc
13059
13060 : see if fchmod exists
13061 set fchmod d_fchmod
13062 eval $inlibc
13063
13064 : see if fchown exists
13065 set fchown d_fchown
13066 eval $inlibc
13067
13068 : see if this is an fcntl system
13069 set fcntl d_fcntl
13070 eval $inlibc
13071
13072 : See if fcntl-based locking works.
13073 echo " "
13074 $cat >try.c <<EOCP
13075 #$i_stdlib I_STDLIB
13076 #ifdef I_STDLIB
13077 #include <stdlib.h>
13078 #endif
13079 #include <unistd.h>
13080 #include <fcntl.h>
13081 #include <signal.h>
13082 $signal_t blech(int x) { exit(3); }
13083 int main() {
13084 #if defined(F_SETLK) && defined(F_SETLKW)
13085      struct flock flock;
13086      int retval, fd;
13087      fd = open("try.c", O_RDONLY);
13088      flock.l_type = F_RDLCK;
13089      flock.l_whence = SEEK_SET;
13090      flock.l_start = flock.l_len = 0;
13091      signal(SIGALRM, blech);
13092      alarm(10);
13093      retval = fcntl(fd, F_SETLK, &flock);
13094      close(fd);
13095      (retval < 0 ? exit(2) : exit(0));
13096 #else
13097      exit(2);
13098 #endif
13099 }
13100 EOCP
13101 echo "Checking if fcntl-based file locking works... "
13102 case "$d_fcntl" in
13103 "$define")
13104         set try
13105         if eval $compile_ok; then
13106                 if $run ./try; then
13107                         echo "Yes, it seems to work."
13108                         val="$define"
13109                 else
13110                         echo "Nope, it didn't work."
13111                         val="$undef"
13112                         case "$?" in
13113                         3) $cat >&4 <<EOM
13114 ***
13115 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13116 *** This is (almost) impossible.
13117 *** If your NFS lock daemons are not feeling well, something like
13118 *** this may happen, please investigate.  Cannot continue, aborting.
13119 ***
13120 EOM
13121                                 exit 1
13122                                 ;;
13123                         esac
13124                 fi
13125         else
13126                 echo "I'm unable to compile the test program, so I'll assume not."
13127                 val="$undef"
13128         fi
13129         ;;
13130 *) val="$undef";
13131         echo "Nope, since you don't even have fcntl()."
13132         ;;
13133 esac
13134 set d_fcntl_can_lock
13135 eval $setvar
13136 $rm_try
13137
13138 : check for fd_set items
13139 $cat <<EOM
13140
13141 Checking to see how well your C compiler handles fd_set and friends ...
13142 EOM
13143 $cat >try.c <<EOCP
13144 #$i_stdlib I_STDLIB
13145 #ifdef I_STDLIB
13146 #include <stdlib.h>
13147 #endif
13148 #$i_systime I_SYS_TIME
13149 #$i_sysselct I_SYS_SELECT
13150 #$d_socket HAS_SOCKET
13151 #include <sys/types.h>
13152 #ifdef HAS_SOCKET
13153 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13154 #endif
13155 #ifdef I_SYS_TIME
13156 #include <sys/time.h>
13157 #endif
13158 #ifdef I_SYS_SELECT
13159 #include <sys/select.h>
13160 #endif
13161 int main() {
13162         fd_set fds;
13163
13164 #ifdef TRYBITS
13165         if(fds.fds_bits);
13166 #endif
13167
13168 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13169         exit(0);
13170 #else
13171         exit(1);
13172 #endif
13173 }
13174 EOCP
13175 set try -DTRYBITS
13176 if eval $compile; then
13177         d_fds_bits="$define"
13178         d_fd_set="$define"
13179         echo "Well, your system knows about the normal fd_set typedef..." >&4
13180         if $run ./try; then
13181                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13182                 d_fd_macros="$define"
13183         else
13184                 $cat >&4 <<'EOM'
13185 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13186 EOM
13187                 d_fd_macros="$undef"
13188         fi
13189 else
13190         $cat <<'EOM'
13191 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13192 EOM
13193         set try
13194         if eval $compile; then
13195                 d_fds_bits="$undef"
13196                 d_fd_set="$define"
13197                 echo "Well, your system has some sort of fd_set available..." >&4
13198                 if $run ./try; then
13199                         echo "and you have the normal fd_set macros." >&4
13200                         d_fd_macros="$define"
13201                 else
13202                         $cat <<'EOM'
13203 but not the normal fd_set macros!  Gross!  More work for me...
13204 EOM
13205                         d_fd_macros="$undef"
13206                 fi
13207         else
13208         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13209                 d_fd_set="$undef"
13210                 d_fds_bits="$undef"
13211                 d_fd_macros="$undef"
13212         fi
13213 fi
13214 $rm_try
13215
13216 : see if fgetpos exists
13217 set fgetpos d_fgetpos
13218 eval $inlibc
13219
13220 : see if finite exists
13221 set finite d_finite
13222 eval $inlibc
13223
13224 : see if finitel exists
13225 set finitel d_finitel
13226 eval $inlibc
13227
13228 : see if flock exists
13229 set flock d_flock
13230 eval $inlibc
13231
13232 : see if prototype for flock is available
13233 echo " "
13234 set d_flockproto flock $i_sysfile sys/file.h
13235 eval $hasproto
13236
13237 : see if fp_class exists
13238 set fp_class d_fp_class
13239 eval $inlibc
13240
13241 : see if pathconf exists
13242 set pathconf d_pathconf
13243 eval $inlibc
13244
13245 : see if fpathconf exists
13246 set fpathconf d_fpathconf
13247 eval $inlibc
13248
13249 : see if fpclass exists
13250 set fpclass d_fpclass
13251 eval $inlibc
13252
13253 : see if fpclassify exists
13254 set fpclassify d_fpclassify
13255 eval $inlibc
13256
13257 : see if fpclassl exists
13258 set fpclassl d_fpclassl
13259 eval $inlibc
13260
13261 : check for fpos64_t
13262 echo " "
13263 echo "Checking to see if you have fpos64_t..." >&4
13264 $cat >try.c <<EOCP
13265 #include <stdio.h>
13266 int main() { fpos64_t x = 7; }
13267 EOCP
13268 set try
13269 if eval $compile; then
13270         val="$define"
13271         echo "You have fpos64_t."
13272 else
13273         val="$undef"
13274         echo "You do not have fpos64_t."
13275         case "$fpossize" in
13276         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13277         esac
13278 fi
13279 $rm_try
13280 set d_fpos64_t
13281 eval $setvar
13282
13283 : see if frexpl exists
13284 set frexpl d_frexpl
13285 eval $inlibc
13286
13287 : see if this is a sys/param system
13288 set sys/param.h i_sysparam
13289 eval $inhdr
13290
13291 : see if this is a sys/mount.h system
13292 set sys/mount.h i_sysmount
13293 eval $inhdr
13294
13295 : Check for fs_data_s
13296 echo " "
13297 echo "Checking to see if your system supports struct fs_data..." >&4
13298 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13299 eval $hasstruct
13300 case "$d_fs_data_s" in
13301 "$define")      echo "Yes, it does."   ;;
13302 *)              echo "No, it doesn't." ;;
13303 esac
13304
13305 : see if fseeko exists
13306 set fseeko d_fseeko
13307 eval $inlibc
13308 case "$longsize" in
13309 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13310 esac
13311
13312 : see if fsetpos exists
13313 set fsetpos d_fsetpos
13314 eval $inlibc
13315
13316 : see if fstatfs exists
13317 set fstatfs d_fstatfs
13318 eval $inlibc
13319
13320 : see if statvfs exists
13321 set statvfs d_statvfs
13322 eval $inlibc
13323
13324 : see if fstatvfs exists
13325 set fstatvfs d_fstatvfs
13326 eval $inlibc
13327
13328
13329 : see if fsync exists
13330 set fsync d_fsync
13331 eval $inlibc
13332
13333 : see if ftello exists
13334 set ftello d_ftello
13335 eval $inlibc
13336 case "$longsize" in
13337 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13338 esac
13339
13340 : check for a working futimes
13341 d_futimes="$undef"
13342 echo " "
13343 echo "Checking if you have a working futimes()" >&4
13344 $cat >try.c <<EOCP
13345 #include <stdio.h>
13346 #include <sys/time.h>
13347 #include <errno.h>
13348 #include <fcntl.h>
13349
13350 int main ()
13351 {
13352     int fd, rv;
13353     fd = open ("try.c", O_RDWR);
13354     if (-1 == fd) exit (1);
13355     rv = futimes (fd, NULL);
13356     exit (rv == -1 ? errno : 0);
13357 }
13358 EOCP
13359 set try
13360 if eval $compile; then
13361     `$run ./try`
13362     rc=$?
13363     case "$rc" in
13364         0)  echo "Yes, you have" >&4
13365             d_futimes="$define"
13366             ;;
13367         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13368             ;;
13369     esac
13370 else
13371     echo "No, it does not (probably harmless)" >&4
13372 fi
13373 $rm_try
13374
13375 : see if ndbm.h is available
13376 set ndbm.h i_ndbm
13377 eval $inhdr
13378 : Compatibility location for RedHat 7.1
13379 set gdbm/ndbm.h i_gdbmndbm
13380 eval $inhdr
13381 : Compatibility location for Debian 4.0
13382 set gdbm-ndbm.h i_gdbm_ndbm
13383 eval $inhdr
13384
13385 val="$undef"
13386 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13387         : see if dbm_open exists
13388         set dbm_open d_dbm_open
13389         eval $inlibc
13390         case "$d_dbm_open" in
13391         $undef)
13392                 i_ndbm="$undef"
13393                 i_gdbmndbm="$undef"
13394                 i_gdbm_ndbm="$undef"
13395                 echo "We won't be including <ndbm.h>"
13396                 val="$undef"
13397                 ;;
13398         *) val="$define"
13399            ;;
13400         esac
13401 fi
13402 set d_ndbm
13403 eval $setvar
13404
13405 ndbm_hdr_protochk='name=$1; hdr=$2;
13406 eval "ihdr=\$""i_$name";
13407 val="$undef";
13408 if $test "$ihdr" = "$define"; then
13409         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13410         case "$d_cplusplus" in
13411         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13412         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13413         esac;
13414         case "$val" in
13415         $define) $echo "Your <$hdr> seems to have prototypes";;
13416         *) $echo "Your <$hdr> does not seem to have prototypes";;
13417         esac;
13418 fi;
13419 set "d_${name}_h_uses_prototypes";
13420 eval $setvar'
13421
13422 set ndbm ndbm.h
13423 eval $ndbm_hdr_protochk
13424 set gdbmndbm gdbm/ndbm.h
13425 eval $ndbm_hdr_protochk
13426 set gdbm_ndbm gdbm-ndbm.h
13427 eval $ndbm_hdr_protochk
13428
13429 : see if getaddrinfo exists
13430 set getaddrinfo d_getaddrinfo
13431 eval $inlibc
13432
13433 : see if getcwd exists
13434 set getcwd d_getcwd
13435 eval $inlibc
13436
13437 : see if getespwnam exists
13438 set getespwnam d_getespwnam
13439 eval $inlibc
13440
13441 : see if getfsstat exists
13442 set getfsstat d_getfsstat
13443 eval $inlibc
13444
13445 : see if getgrent exists
13446 set getgrent d_getgrent
13447 eval $inlibc
13448
13449 : see if getgrent_r exists
13450 set getgrent_r d_getgrent_r
13451 eval $inlibc
13452 case "$d_getgrent_r" in
13453 "$define")
13454         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13455         case "$d_getgrent_r_proto:$usethreads" in
13456         ":define")      d_getgrent_r_proto=define
13457                 set d_getgrent_r_proto getgrent_r $hdrs
13458                 eval $hasproto ;;
13459         *)      ;;
13460         esac
13461         case "$d_getgrent_r_proto" in
13462         define)
13463         case "$getgrent_r_proto" in
13464         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13465         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13466         esac
13467         case "$getgrent_r_proto" in
13468         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13469         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13470         esac
13471         case "$getgrent_r_proto" in
13472         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13473         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13474         esac
13475         case "$getgrent_r_proto" in
13476         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13477         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13478         esac
13479         case "$getgrent_r_proto" in
13480         ''|0) try='int getgrent_r(struct group*, char*, int);'
13481         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13482         esac
13483         case "$getgrent_r_proto" in
13484         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13485         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13486         esac
13487         case "$getgrent_r_proto" in
13488         ''|0)   d_getgrent_r=undef
13489                 getgrent_r_proto=0
13490                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13491         * )     case "$getgrent_r_proto" in
13492                 REENTRANT_PROTO*) ;;
13493                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13494                 esac
13495                 echo "Prototype: $try" ;;
13496         esac
13497         ;;
13498         *)      case "$usethreads" in
13499                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13500                 esac
13501                 d_getgrent_r=undef
13502                 getgrent_r_proto=0
13503                 ;;
13504         esac
13505         ;;
13506 *)      getgrent_r_proto=0
13507         ;;
13508 esac
13509
13510 : see if getgrgid_r exists
13511 set getgrgid_r d_getgrgid_r
13512 eval $inlibc
13513 case "$d_getgrgid_r" in
13514 "$define")
13515         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13516         case "$d_getgrgid_r_proto:$usethreads" in
13517         ":define")      d_getgrgid_r_proto=define
13518                 set d_getgrgid_r_proto getgrgid_r $hdrs
13519                 eval $hasproto ;;
13520         *)      ;;
13521         esac
13522         case "$d_getgrgid_r_proto" in
13523         define)
13524         case "$getgrgid_r_proto" in
13525         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13526         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13527         esac
13528         case "$getgrgid_r_proto" in
13529         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13530         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13531         esac
13532         case "$getgrgid_r_proto" in
13533         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13534         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13535         esac
13536         case "$getgrgid_r_proto" in
13537         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13538         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13539         esac
13540         case "$getgrgid_r_proto" in
13541         ''|0)   d_getgrgid_r=undef
13542                 getgrgid_r_proto=0
13543                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13544         * )     case "$getgrgid_r_proto" in
13545                 REENTRANT_PROTO*) ;;
13546                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13547                 esac
13548                 echo "Prototype: $try" ;;
13549         esac
13550         ;;
13551         *)      case "$usethreads" in
13552                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13553                 esac
13554                 d_getgrgid_r=undef
13555                 getgrgid_r_proto=0
13556                 ;;
13557         esac
13558         ;;
13559 *)      getgrgid_r_proto=0
13560         ;;
13561 esac
13562
13563 : see if getgrnam_r exists
13564 set getgrnam_r d_getgrnam_r
13565 eval $inlibc
13566 case "$d_getgrnam_r" in
13567 "$define")
13568         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13569         case "$d_getgrnam_r_proto:$usethreads" in
13570         ":define")      d_getgrnam_r_proto=define
13571                 set d_getgrnam_r_proto getgrnam_r $hdrs
13572                 eval $hasproto ;;
13573         *)      ;;
13574         esac
13575         case "$d_getgrnam_r_proto" in
13576         define)
13577         case "$getgrnam_r_proto" in
13578         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13579         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13580         esac
13581         case "$getgrnam_r_proto" in
13582         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13583         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13584         esac
13585         case "$getgrnam_r_proto" in
13586         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13587         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13588         esac
13589         case "$getgrnam_r_proto" in
13590         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13591         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13592         esac
13593         case "$getgrnam_r_proto" in
13594         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13595         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13596         esac
13597         case "$getgrnam_r_proto" in
13598         ''|0)   d_getgrnam_r=undef
13599                 getgrnam_r_proto=0
13600                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13601         * )     case "$getgrnam_r_proto" in
13602                 REENTRANT_PROTO*) ;;
13603                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13604                 esac
13605                 echo "Prototype: $try" ;;
13606         esac
13607         ;;
13608         *)      case "$usethreads" in
13609                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13610                 esac
13611                 d_getgrnam_r=undef
13612                 getgrnam_r_proto=0
13613                 ;;
13614         esac
13615         ;;
13616 *)      getgrnam_r_proto=0
13617         ;;
13618 esac
13619
13620 : see if gethostbyaddr exists
13621 set gethostbyaddr d_gethbyaddr
13622 eval $inlibc
13623
13624 : see if gethostbyname exists
13625 set gethostbyname d_gethbyname
13626 eval $inlibc
13627
13628 : see if gethostent exists
13629 set gethostent d_gethent
13630 eval $inlibc
13631
13632 : see how we will look up host name
13633 echo " "
13634 call=''
13635 if set gethostname val -f d_gethname; eval $csym; $val; then
13636         echo 'gethostname() found.' >&4
13637         d_gethname="$define"
13638         call=gethostname
13639 fi
13640 if set uname val -f d_uname; eval $csym; $val; then
13641         if ./xenix; then
13642                 $cat <<'EOM'
13643 uname() was found, but you're running xenix, and older versions of xenix
13644 have a broken uname(). If you don't really know whether your xenix is old
13645 enough to have a broken system call, use the default answer.
13646
13647 EOM
13648                 dflt=y
13649                 case "$d_uname" in
13650                 "$define") dflt=n;;
13651                 esac
13652                 rp='Is your uname() broken?'
13653                 . ./myread
13654                 case "$ans" in
13655                 n*) d_uname="$define"; call=uname;;
13656                 esac
13657         else
13658                 echo 'uname() found.' >&4
13659                 d_uname="$define"
13660                 case "$call" in
13661                 '') call=uname ;;
13662                 esac
13663         fi
13664 fi
13665 case "$d_gethname" in
13666 '') d_gethname="$undef";;
13667 esac
13668 case "$d_uname" in
13669 '') d_uname="$undef";;
13670 esac
13671 case "$d_uname$d_gethname" in
13672 *define*)
13673         dflt=n
13674         cat <<EOM
13675
13676 Every now and then someone has a $call() that lies about the hostname
13677 but can't be fixed for political or economic reasons.  If you wish, I can
13678 pretend $call() isn't there and maybe compute hostname at run-time
13679 thanks to the '$phostname' command.
13680
13681 EOM
13682         rp="Shall I ignore $call() from now on?"
13683         . ./myread
13684         case "$ans" in
13685         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13686         esac;;
13687 esac
13688 case "$phostname" in
13689 '') aphostname='';;
13690 *) case "$aphostname" in
13691         /*) ;;
13692         *) set X $phostname
13693                 shift
13694                 file=$1
13695                 shift
13696                 file=`./loc $file $file $pth`
13697                 aphostname=`echo $file $*`
13698                 ;;
13699         esac
13700         ;;
13701 esac
13702 case "$d_uname$d_gethname" in
13703 *define*) ;;
13704 *)
13705         case "$phostname" in
13706         '')
13707                 echo "There will be no way for $package to get your hostname." >&4;;
13708         *)
13709         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13710                 ;;
13711         esac;;
13712 esac
13713 case "$d_phostname" in
13714 '') d_phostname="$undef";;
13715 esac
13716
13717 : see if gethostbyaddr_r exists
13718 set gethostbyaddr_r d_gethostbyaddr_r
13719 eval $inlibc
13720 case "$d_gethostbyaddr_r" in
13721 "$define")
13722         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13723         case "$d_gethostbyaddr_r_proto:$usethreads" in
13724         ":define")      d_gethostbyaddr_r_proto=define
13725                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13726                 eval $hasproto ;;
13727         *)      ;;
13728         esac
13729         case "$d_gethostbyaddr_r_proto" in
13730         define)
13731         case "$gethostbyaddr_r_proto" in
13732         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13733         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13734         esac
13735         case "$gethostbyaddr_r_proto" in
13736         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13738         esac
13739         case "$gethostbyaddr_r_proto" in
13740         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13741         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13742         esac
13743         case "$gethostbyaddr_r_proto" in
13744         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13745         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13746         esac
13747         case "$gethostbyaddr_r_proto" in
13748         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13749         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13750         esac
13751         case "$gethostbyaddr_r_proto" in
13752         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13753         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13754         esac
13755         case "$gethostbyaddr_r_proto" in
13756         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13757         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13758         esac
13759         case "$gethostbyaddr_r_proto" in
13760         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13761         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13762         esac
13763         case "$gethostbyaddr_r_proto" in
13764         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13765         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13766         esac
13767         case "$gethostbyaddr_r_proto" in
13768         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13769         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13770         esac
13771         case "$gethostbyaddr_r_proto" in
13772         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13773         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13774         esac
13775         case "$gethostbyaddr_r_proto" in
13776         ''|0)   d_gethostbyaddr_r=undef
13777                 gethostbyaddr_r_proto=0
13778                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13779         * )     case "$gethostbyaddr_r_proto" in
13780                 REENTRANT_PROTO*) ;;
13781                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13782                 esac
13783                 echo "Prototype: $try" ;;
13784         esac
13785         ;;
13786         *)      case "$usethreads" in
13787                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13788                 esac
13789                 d_gethostbyaddr_r=undef
13790                 gethostbyaddr_r_proto=0
13791                 ;;
13792         esac
13793         ;;
13794 *)      gethostbyaddr_r_proto=0
13795         ;;
13796 esac
13797
13798 : see if gethostbyname_r exists
13799 set gethostbyname_r d_gethostbyname_r
13800 eval $inlibc
13801 case "$d_gethostbyname_r" in
13802 "$define")
13803         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13804         case "$d_gethostbyname_r_proto:$usethreads" in
13805         ":define")      d_gethostbyname_r_proto=define
13806                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13807                 eval $hasproto ;;
13808         *)      ;;
13809         esac
13810         case "$d_gethostbyname_r_proto" in
13811         define)
13812         case "$gethostbyname_r_proto" in
13813         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13814         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13815         esac
13816         case "$gethostbyname_r_proto" in
13817         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13818         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13819         esac
13820         case "$gethostbyname_r_proto" in
13821         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13822         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13823         esac
13824         case "$gethostbyname_r_proto" in
13825         ''|0)   d_gethostbyname_r=undef
13826                 gethostbyname_r_proto=0
13827                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13828         * )     case "$gethostbyname_r_proto" in
13829                 REENTRANT_PROTO*) ;;
13830                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13831                 esac
13832                 echo "Prototype: $try" ;;
13833         esac
13834         ;;
13835         *)      case "$usethreads" in
13836                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13837                 esac
13838                 d_gethostbyname_r=undef
13839                 gethostbyname_r_proto=0
13840                 ;;
13841         esac
13842         ;;
13843 *)      gethostbyname_r_proto=0
13844         ;;
13845 esac
13846
13847 : see if gethostent_r exists
13848 set gethostent_r d_gethostent_r
13849 eval $inlibc
13850 case "$d_gethostent_r" in
13851 "$define")
13852         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13853         case "$d_gethostent_r_proto:$usethreads" in
13854         ":define")      d_gethostent_r_proto=define
13855                 set d_gethostent_r_proto gethostent_r $hdrs
13856                 eval $hasproto ;;
13857         *)      ;;
13858         esac
13859         case "$d_gethostent_r_proto" in
13860         define)
13861         case "$gethostent_r_proto" in
13862         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13863         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13864         esac
13865         case "$gethostent_r_proto" in
13866         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13867         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13868         esac
13869         case "$gethostent_r_proto" in
13870         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13871         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13872         esac
13873         case "$gethostent_r_proto" in
13874         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13875         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13876         esac
13877         case "$gethostent_r_proto" in
13878         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13879         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13880         esac
13881         case "$gethostent_r_proto" in
13882         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13883         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13884         esac
13885         case "$gethostent_r_proto" in
13886         ''|0)   d_gethostent_r=undef
13887                 gethostent_r_proto=0
13888                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13889         * )     case "$gethostent_r_proto" in
13890                 REENTRANT_PROTO*) ;;
13891                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13892                 esac
13893                 echo "Prototype: $try" ;;
13894         esac
13895         ;;
13896         *)      case "$usethreads" in
13897                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13898                 esac
13899                 d_gethostent_r=undef
13900                 gethostent_r_proto=0
13901                 ;;
13902         esac
13903         ;;
13904 *)      gethostent_r_proto=0
13905         ;;
13906 esac
13907
13908 : see if prototypes for various gethostxxx netdb.h functions are available
13909 echo " "
13910 set d_gethostprotos gethostent $i_netdb netdb.h
13911 eval $hasproto
13912
13913 : see if getitimer exists
13914 set getitimer d_getitimer
13915 eval $inlibc
13916
13917 : see if getlogin exists
13918 set getlogin d_getlogin
13919 eval $inlibc
13920
13921 : see if getlogin_r exists
13922 set getlogin_r d_getlogin_r
13923 eval $inlibc
13924 case "$d_getlogin_r" in
13925 "$define")
13926         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13927         case "$d_getlogin_r_proto:$usethreads" in
13928         ":define")      d_getlogin_r_proto=define
13929                 set d_getlogin_r_proto getlogin_r $hdrs
13930                 eval $hasproto ;;
13931         *)      ;;
13932         esac
13933         case "$d_getlogin_r_proto" in
13934         define)
13935         case "$getlogin_r_proto" in
13936         ''|0) try='int getlogin_r(char*, size_t);'
13937         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13938         esac
13939         case "$getlogin_r_proto" in
13940         ''|0) try='int getlogin_r(char*, int);'
13941         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13942         esac
13943         case "$getlogin_r_proto" in
13944         ''|0) try='char* getlogin_r(char*, size_t);'
13945         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13946         esac
13947         case "$getlogin_r_proto" in
13948         ''|0) try='char* getlogin_r(char*, int);'
13949         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13950         esac
13951         case "$getlogin_r_proto" in
13952         ''|0)   d_getlogin_r=undef
13953                 getlogin_r_proto=0
13954                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13955         * )     case "$getlogin_r_proto" in
13956                 REENTRANT_PROTO*) ;;
13957                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13958                 esac
13959                 echo "Prototype: $try" ;;
13960         esac
13961         ;;
13962         *)      case "$usethreads" in
13963                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13964                 esac
13965                 d_getlogin_r=undef
13966                 getlogin_r_proto=0
13967                 ;;
13968         esac
13969         ;;
13970 *)      getlogin_r_proto=0
13971         ;;
13972 esac
13973
13974 : see if getmnt exists
13975 set getmnt d_getmnt
13976 eval $inlibc
13977
13978 : see if getmntent exists
13979 set getmntent d_getmntent
13980 eval $inlibc
13981
13982 : see if getnameinfo exists
13983 set getnameinfo d_getnameinfo
13984 eval $inlibc
13985
13986 : see if getnetbyaddr exists
13987 set getnetbyaddr d_getnbyaddr
13988 eval $inlibc
13989
13990 : see if getnetbyname exists
13991 set getnetbyname d_getnbyname
13992 eval $inlibc
13993
13994 : see if getnetent exists
13995 set getnetent d_getnent
13996 eval $inlibc
13997
13998 : see if getnetbyaddr_r exists
13999 set getnetbyaddr_r d_getnetbyaddr_r
14000 eval $inlibc
14001 case "$d_getnetbyaddr_r" in
14002 "$define")
14003         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14004         case "$d_getnetbyaddr_r_proto:$usethreads" in
14005         ":define")      d_getnetbyaddr_r_proto=define
14006                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14007                 eval $hasproto ;;
14008         *)      ;;
14009         esac
14010         case "$d_getnetbyaddr_r_proto" in
14011         define)
14012         case "$getnetbyaddr_r_proto" in
14013         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14014         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14015         esac
14016         case "$getnetbyaddr_r_proto" in
14017         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14018         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14019         esac
14020         case "$getnetbyaddr_r_proto" in
14021         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14022         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14023         esac
14024         case "$getnetbyaddr_r_proto" in
14025         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14026         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14027         esac
14028         case "$getnetbyaddr_r_proto" in
14029         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14030         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14031         esac
14032         case "$getnetbyaddr_r_proto" in
14033         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14034         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14035         esac
14036         case "$getnetbyaddr_r_proto" in
14037         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14038         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14039         esac
14040         case "$getnetbyaddr_r_proto" in
14041         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14042         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14043         esac
14044         case "$getnetbyaddr_r_proto" in
14045         ''|0)   d_getnetbyaddr_r=undef
14046                 getnetbyaddr_r_proto=0
14047                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14048         * )     case "$getnetbyaddr_r_proto" in
14049                 REENTRANT_PROTO*) ;;
14050                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14051                 esac
14052                 echo "Prototype: $try" ;;
14053         esac
14054         ;;
14055         *)      case "$usethreads" in
14056                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14057                 esac
14058                 d_getnetbyaddr_r=undef
14059                 getnetbyaddr_r_proto=0
14060                 ;;
14061         esac
14062         ;;
14063 *)      getnetbyaddr_r_proto=0
14064         ;;
14065 esac
14066
14067 : see if getnetbyname_r exists
14068 set getnetbyname_r d_getnetbyname_r
14069 eval $inlibc
14070 case "$d_getnetbyname_r" in
14071 "$define")
14072         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14073         case "$d_getnetbyname_r_proto:$usethreads" in
14074         ":define")      d_getnetbyname_r_proto=define
14075                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14076                 eval $hasproto ;;
14077         *)      ;;
14078         esac
14079         case "$d_getnetbyname_r_proto" in
14080         define)
14081         case "$getnetbyname_r_proto" in
14082         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14083         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14084         esac
14085         case "$getnetbyname_r_proto" in
14086         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14087         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14088         esac
14089         case "$getnetbyname_r_proto" in
14090         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14091         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14092         esac
14093         case "$getnetbyname_r_proto" in
14094         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14095         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14096         esac
14097         case "$getnetbyname_r_proto" in
14098         ''|0)   d_getnetbyname_r=undef
14099                 getnetbyname_r_proto=0
14100                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14101         * )     case "$getnetbyname_r_proto" in
14102                 REENTRANT_PROTO*) ;;
14103                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14104                 esac
14105                 echo "Prototype: $try" ;;
14106         esac
14107         ;;
14108         *)      case "$usethreads" in
14109                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14110                 esac
14111                 d_getnetbyname_r=undef
14112                 getnetbyname_r_proto=0
14113                 ;;
14114         esac
14115         ;;
14116 *)      getnetbyname_r_proto=0
14117         ;;
14118 esac
14119
14120 : see if getnetent_r exists
14121 set getnetent_r d_getnetent_r
14122 eval $inlibc
14123 case "$d_getnetent_r" in
14124 "$define")
14125         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14126         case "$d_getnetent_r_proto:$usethreads" in
14127         ":define")      d_getnetent_r_proto=define
14128                 set d_getnetent_r_proto getnetent_r $hdrs
14129                 eval $hasproto ;;
14130         *)      ;;
14131         esac
14132         case "$d_getnetent_r_proto" in
14133         define)
14134         case "$getnetent_r_proto" in
14135         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14136         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14137         esac
14138         case "$getnetent_r_proto" in
14139         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14140         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14141         esac
14142         case "$getnetent_r_proto" in
14143         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14144         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14145         esac
14146         case "$getnetent_r_proto" in
14147         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14148         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14149         esac
14150         case "$getnetent_r_proto" in
14151         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14152         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14153         esac
14154         case "$getnetent_r_proto" in
14155         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14156         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14157         esac
14158         case "$getnetent_r_proto" in
14159         ''|0)   d_getnetent_r=undef
14160                 getnetent_r_proto=0
14161                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14162         * )     case "$getnetent_r_proto" in
14163                 REENTRANT_PROTO*) ;;
14164                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14165                 esac
14166                 echo "Prototype: $try" ;;
14167         esac
14168         ;;
14169         *)      case "$usethreads" in
14170                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14171                 esac
14172                 d_getnetent_r=undef
14173                 getnetent_r_proto=0
14174                 ;;
14175         esac
14176         ;;
14177 *)      getnetent_r_proto=0
14178         ;;
14179 esac
14180
14181 : see if prototypes for various getnetxxx netdb.h functions are available
14182 echo " "
14183 set d_getnetprotos getnetent $i_netdb netdb.h
14184 eval $hasproto
14185
14186 : see if getpagesize exists
14187 set getpagesize d_getpagsz
14188 eval $inlibc
14189
14190 : Optional checks for getprotobyname and getprotobynumber
14191
14192 : see if getprotobyname exists
14193 set getprotobyname d_getpbyname
14194 eval $inlibc
14195
14196 : see if getprotobynumber exists
14197 set getprotobynumber d_getpbynumber
14198 eval $inlibc
14199
14200 : see if getprotoent exists
14201 set getprotoent d_getpent
14202 eval $inlibc
14203
14204 : see if getpgid exists
14205 set getpgid d_getpgid
14206 eval $inlibc
14207
14208 : see if getpgrp2 exists
14209 set getpgrp2 d_getpgrp2
14210 eval $inlibc
14211
14212 : see if getppid exists
14213 set getppid d_getppid
14214 eval $inlibc
14215
14216 : see if getpriority exists
14217 set getpriority d_getprior
14218 eval $inlibc
14219
14220 : see if getprotobyname_r exists
14221 set getprotobyname_r d_getprotobyname_r
14222 eval $inlibc
14223 case "$d_getprotobyname_r" in
14224 "$define")
14225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14226         case "$d_getprotobyname_r_proto:$usethreads" in
14227         ":define")      d_getprotobyname_r_proto=define
14228                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14229                 eval $hasproto ;;
14230         *)      ;;
14231         esac
14232         case "$d_getprotobyname_r_proto" in
14233         define)
14234         case "$getprotobyname_r_proto" in
14235         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14236         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14237         esac
14238         case "$getprotobyname_r_proto" in
14239         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14240         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14241         esac
14242         case "$getprotobyname_r_proto" in
14243         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14244         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14245         esac
14246         case "$getprotobyname_r_proto" in
14247         ''|0)   d_getprotobyname_r=undef
14248                 getprotobyname_r_proto=0
14249                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14250         * )     case "$getprotobyname_r_proto" in
14251                 REENTRANT_PROTO*) ;;
14252                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14253                 esac
14254                 echo "Prototype: $try" ;;
14255         esac
14256         ;;
14257         *)      case "$usethreads" in
14258                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14259                 esac
14260                 d_getprotobyname_r=undef
14261                 getprotobyname_r_proto=0
14262                 ;;
14263         esac
14264         ;;
14265 *)      getprotobyname_r_proto=0
14266         ;;
14267 esac
14268
14269 : see if getprotobynumber_r exists
14270 set getprotobynumber_r d_getprotobynumber_r
14271 eval $inlibc
14272 case "$d_getprotobynumber_r" in
14273 "$define")
14274         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14275         case "$d_getprotobynumber_r_proto:$usethreads" in
14276         ":define")      d_getprotobynumber_r_proto=define
14277                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14278                 eval $hasproto ;;
14279         *)      ;;
14280         esac
14281         case "$d_getprotobynumber_r_proto" in
14282         define)
14283         case "$getprotobynumber_r_proto" in
14284         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14285         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14286         esac
14287         case "$getprotobynumber_r_proto" in
14288         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14289         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14290         esac
14291         case "$getprotobynumber_r_proto" in
14292         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14293         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14294         esac
14295         case "$getprotobynumber_r_proto" in
14296         ''|0)   d_getprotobynumber_r=undef
14297                 getprotobynumber_r_proto=0
14298                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14299         * )     case "$getprotobynumber_r_proto" in
14300                 REENTRANT_PROTO*) ;;
14301                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14302                 esac
14303                 echo "Prototype: $try" ;;
14304         esac
14305         ;;
14306         *)      case "$usethreads" in
14307                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14308                 esac
14309                 d_getprotobynumber_r=undef
14310                 getprotobynumber_r_proto=0
14311                 ;;
14312         esac
14313         ;;
14314 *)      getprotobynumber_r_proto=0
14315         ;;
14316 esac
14317
14318 : see if getprotoent_r exists
14319 set getprotoent_r d_getprotoent_r
14320 eval $inlibc
14321 case "$d_getprotoent_r" in
14322 "$define")
14323         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14324         case "$d_getprotoent_r_proto:$usethreads" in
14325         ":define")      d_getprotoent_r_proto=define
14326                 set d_getprotoent_r_proto getprotoent_r $hdrs
14327                 eval $hasproto ;;
14328         *)      ;;
14329         esac
14330         case "$d_getprotoent_r_proto" in
14331         define)
14332         case "$getprotoent_r_proto" in
14333         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14334         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14335         esac
14336         case "$getprotoent_r_proto" in
14337         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14338         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14339         esac
14340         case "$getprotoent_r_proto" in
14341         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14342         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14343         esac
14344         case "$getprotoent_r_proto" in
14345         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14346         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14347         esac
14348         case "$getprotoent_r_proto" in
14349         ''|0)   d_getprotoent_r=undef
14350                 getprotoent_r_proto=0
14351                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14352         * )     case "$getprotoent_r_proto" in
14353                 REENTRANT_PROTO*) ;;
14354                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14355                 esac
14356                 echo "Prototype: $try" ;;
14357         esac
14358         ;;
14359         *)      case "$usethreads" in
14360                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14361                 esac
14362                 d_getprotoent_r=undef
14363                 getprotoent_r_proto=0
14364                 ;;
14365         esac
14366         ;;
14367 *)      getprotoent_r_proto=0
14368         ;;
14369 esac
14370
14371 : see if prototypes for various getprotoxxx netdb.h functions are available
14372 echo " "
14373 set d_getprotoprotos getprotoent $i_netdb netdb.h
14374 eval $hasproto
14375
14376 : see if getprpwnam exists
14377 set getprpwnam d_getprpwnam
14378 eval $inlibc
14379
14380 : see if getpwent exists
14381 set getpwent d_getpwent
14382 eval $inlibc
14383
14384 : see if getpwent_r exists
14385 set getpwent_r d_getpwent_r
14386 eval $inlibc
14387 case "$d_getpwent_r" in
14388 "$define")
14389         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14390         case "$d_getpwent_r_proto:$usethreads" in
14391         ":define")      d_getpwent_r_proto=define
14392                 set d_getpwent_r_proto getpwent_r $hdrs
14393                 eval $hasproto ;;
14394         *)      ;;
14395         esac
14396         case "$d_getpwent_r_proto" in
14397         define)
14398         case "$getpwent_r_proto" in
14399         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14400         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14401         esac
14402         case "$getpwent_r_proto" in
14403         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14404         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14405         esac
14406         case "$getpwent_r_proto" in
14407         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14408         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14409         esac
14410         case "$getpwent_r_proto" in
14411         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14412         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14413         esac
14414         case "$getpwent_r_proto" in
14415         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14416         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14417         esac
14418         case "$getpwent_r_proto" in
14419         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14420         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14421         esac
14422         case "$getpwent_r_proto" in
14423         ''|0)   d_getpwent_r=undef
14424                 getpwent_r_proto=0
14425                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14426         * )     case "$getpwent_r_proto" in
14427                 REENTRANT_PROTO*) ;;
14428                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14429                 esac
14430                 echo "Prototype: $try" ;;
14431         esac
14432         ;;
14433         *)      case "$usethreads" in
14434                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14435                 esac
14436                 d_getpwent_r=undef
14437                 getpwent_r_proto=0
14438                 ;;
14439         esac
14440         ;;
14441 *)      getpwent_r_proto=0
14442         ;;
14443 esac
14444
14445 : see if getpwnam_r exists
14446 set getpwnam_r d_getpwnam_r
14447 eval $inlibc
14448 case "$d_getpwnam_r" in
14449 "$define")
14450         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14451         case "$d_getpwnam_r_proto:$usethreads" in
14452         ":define")      d_getpwnam_r_proto=define
14453                 set d_getpwnam_r_proto getpwnam_r $hdrs
14454                 eval $hasproto ;;
14455         *)      ;;
14456         esac
14457         case "$d_getpwnam_r_proto" in
14458         define)
14459         case "$getpwnam_r_proto" in
14460         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14461         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14462         esac
14463         case "$getpwnam_r_proto" in
14464         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14465         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14466         esac
14467         case "$getpwnam_r_proto" in
14468         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14469         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14470         esac
14471         case "$getpwnam_r_proto" in
14472         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14473         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14474         esac
14475         case "$getpwnam_r_proto" in
14476         ''|0)   d_getpwnam_r=undef
14477                 getpwnam_r_proto=0
14478                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14479         * )     case "$getpwnam_r_proto" in
14480                 REENTRANT_PROTO*) ;;
14481                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14482                 esac
14483                 echo "Prototype: $try" ;;
14484         esac
14485         ;;
14486         *)      case "$usethreads" in
14487                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14488                 esac
14489                 d_getpwnam_r=undef
14490                 getpwnam_r_proto=0
14491                 ;;
14492         esac
14493         ;;
14494 *)      getpwnam_r_proto=0
14495         ;;
14496 esac
14497
14498 : see if getpwuid_r exists
14499 set getpwuid_r d_getpwuid_r
14500 eval $inlibc
14501 case "$d_getpwuid_r" in
14502 "$define")
14503         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14504         case "$d_getpwuid_r_proto:$usethreads" in
14505         ":define")      d_getpwuid_r_proto=define
14506                 set d_getpwuid_r_proto getpwuid_r $hdrs
14507                 eval $hasproto ;;
14508         *)      ;;
14509         esac
14510         case "$d_getpwuid_r_proto" in
14511         define)
14512         case "$getpwuid_r_proto" in
14513         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14514         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14515         esac
14516         case "$getpwuid_r_proto" in
14517         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14518         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14519         esac
14520         case "$getpwuid_r_proto" in
14521         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14522         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14523         esac
14524         case "$getpwuid_r_proto" in
14525         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14526         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14527         esac
14528         case "$getpwuid_r_proto" in
14529         ''|0)   d_getpwuid_r=undef
14530                 getpwuid_r_proto=0
14531                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14532         * )     case "$getpwuid_r_proto" in
14533                 REENTRANT_PROTO*) ;;
14534                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14535                 esac
14536                 echo "Prototype: $try" ;;
14537         esac
14538         ;;
14539         *)      case "$usethreads" in
14540                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14541                 esac
14542                 d_getpwuid_r=undef
14543                 getpwuid_r_proto=0
14544                 ;;
14545         esac
14546         ;;
14547 *)      getpwuid_r_proto=0
14548         ;;
14549 esac
14550
14551 : Optional checks for getsbyname and getsbyport
14552
14553 : see if getservbyname exists
14554 set getservbyname d_getsbyname
14555 eval $inlibc
14556
14557 : see if getservbyport exists
14558 set getservbyport d_getsbyport
14559 eval $inlibc
14560
14561 : see if getservent exists
14562 set getservent d_getsent
14563 eval $inlibc
14564
14565 : see if getservbyname_r exists
14566 set getservbyname_r d_getservbyname_r
14567 eval $inlibc
14568 case "$d_getservbyname_r" in
14569 "$define")
14570         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14571         case "$d_getservbyname_r_proto:$usethreads" in
14572         ":define")      d_getservbyname_r_proto=define
14573                 set d_getservbyname_r_proto getservbyname_r $hdrs
14574                 eval $hasproto ;;
14575         *)      ;;
14576         esac
14577         case "$d_getservbyname_r_proto" in
14578         define)
14579         case "$getservbyname_r_proto" in
14580         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14581         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14582         esac
14583         case "$getservbyname_r_proto" in
14584         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14585         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14586         esac
14587         case "$getservbyname_r_proto" in
14588         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14589         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14590         esac
14591         case "$getservbyname_r_proto" in
14592         ''|0)   d_getservbyname_r=undef
14593                 getservbyname_r_proto=0
14594                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14595         * )     case "$getservbyname_r_proto" in
14596                 REENTRANT_PROTO*) ;;
14597                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14598                 esac
14599                 echo "Prototype: $try" ;;
14600         esac
14601         ;;
14602         *)      case "$usethreads" in
14603                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14604                 esac
14605                 d_getservbyname_r=undef
14606                 getservbyname_r_proto=0
14607                 ;;
14608         esac
14609         ;;
14610 *)      getservbyname_r_proto=0
14611         ;;
14612 esac
14613
14614 : see if getservbyport_r exists
14615 set getservbyport_r d_getservbyport_r
14616 eval $inlibc
14617 case "$d_getservbyport_r" in
14618 "$define")
14619         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14620         case "$d_getservbyport_r_proto:$usethreads" in
14621         ":define")      d_getservbyport_r_proto=define
14622                 set d_getservbyport_r_proto getservbyport_r $hdrs
14623                 eval $hasproto ;;
14624         *)      ;;
14625         esac
14626         case "$d_getservbyport_r_proto" in
14627         define)
14628         case "$getservbyport_r_proto" in
14629         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14630         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14631         esac
14632         case "$getservbyport_r_proto" in
14633         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14634         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14635         esac
14636         case "$getservbyport_r_proto" in
14637         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14638         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14639         esac
14640         case "$getservbyport_r_proto" in
14641         ''|0)   d_getservbyport_r=undef
14642                 getservbyport_r_proto=0
14643                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14644         * )     case "$getservbyport_r_proto" in
14645                 REENTRANT_PROTO*) ;;
14646                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14647                 esac
14648                 echo "Prototype: $try" ;;
14649         esac
14650         ;;
14651         *)      case "$usethreads" in
14652                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14653                 esac
14654                 d_getservbyport_r=undef
14655                 getservbyport_r_proto=0
14656                 ;;
14657         esac
14658         ;;
14659 *)      getservbyport_r_proto=0
14660         ;;
14661 esac
14662
14663 : see if getservent_r exists
14664 set getservent_r d_getservent_r
14665 eval $inlibc
14666 case "$d_getservent_r" in
14667 "$define")
14668         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14669         case "$d_getservent_r_proto:$usethreads" in
14670         ":define")      d_getservent_r_proto=define
14671                 set d_getservent_r_proto getservent_r $hdrs
14672                 eval $hasproto ;;
14673         *)      ;;
14674         esac
14675         case "$d_getservent_r_proto" in
14676         define)
14677         case "$getservent_r_proto" in
14678         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14679         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14680         esac
14681         case "$getservent_r_proto" in
14682         ''|0) try='int getservent_r(struct servent*, char*, int);'
14683         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14684         esac
14685         case "$getservent_r_proto" in
14686         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14687         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14688         esac
14689         case "$getservent_r_proto" in
14690         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14691         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14692         esac
14693         case "$getservent_r_proto" in
14694         ''|0)   d_getservent_r=undef
14695                 getservent_r_proto=0
14696                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14697         * )     case "$getservent_r_proto" in
14698                 REENTRANT_PROTO*) ;;
14699                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14700                 esac
14701                 echo "Prototype: $try" ;;
14702         esac
14703         ;;
14704         *)      case "$usethreads" in
14705                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14706                 esac
14707                 d_getservent_r=undef
14708                 getservent_r_proto=0
14709                 ;;
14710         esac
14711         ;;
14712 *)      getservent_r_proto=0
14713         ;;
14714 esac
14715
14716 : see if prototypes for various getservxxx netdb.h functions are available
14717 echo " "
14718 set d_getservprotos getservent $i_netdb netdb.h
14719 eval $hasproto
14720
14721 : see if getspnam exists
14722 set getspnam d_getspnam
14723 eval $inlibc
14724
14725 : see if this is a shadow.h system
14726 set shadow.h i_shadow
14727 eval $inhdr
14728
14729 : see if getspnam_r exists
14730 set getspnam_r d_getspnam_r
14731 eval $inlibc
14732 case "$d_getspnam_r" in
14733 "$define")
14734         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14735         case "$d_getspnam_r_proto:$usethreads" in
14736         ":define")      d_getspnam_r_proto=define
14737                 set d_getspnam_r_proto getspnam_r $hdrs
14738                 eval $hasproto ;;
14739         *)      ;;
14740         esac
14741         case "$d_getspnam_r_proto" in
14742         define)
14743         case "$getspnam_r_proto" in
14744         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14745         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14746         esac
14747         case "$getspnam_r_proto" in
14748         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14749         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14750         esac
14751         case "$getspnam_r_proto" in
14752         ''|0)   d_getspnam_r=undef
14753                 getspnam_r_proto=0
14754                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14755         * )     case "$getspnam_r_proto" in
14756                 REENTRANT_PROTO*) ;;
14757                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14758                 esac
14759                 echo "Prototype: $try" ;;
14760         esac
14761         ;;
14762         *)      case "$usethreads" in
14763                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14764                 esac
14765                 d_getspnam_r=undef
14766                 getspnam_r_proto=0
14767                 ;;
14768         esac
14769         ;;
14770 *)      getspnam_r_proto=0
14771         ;;
14772 esac
14773
14774 : see if gettimeofday or ftime exists
14775 set gettimeofday d_gettimeod
14776 eval $inlibc
14777 case "$d_gettimeod" in
14778 "$undef")
14779         set ftime d_ftime 
14780         eval $inlibc
14781         ;;
14782 *)
14783         val="$undef"; set d_ftime; eval $setvar
14784         ;;
14785 esac
14786 case "$d_gettimeod$d_ftime" in
14787 "$undef$undef")
14788         echo " "
14789         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14790         ;;
14791 esac
14792
14793 : see if gmtime_r exists
14794 set gmtime_r d_gmtime_r
14795 eval $inlibc
14796 case "$d_gmtime_r" in
14797 "$define")
14798         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14799         case "$d_gmtime_r_proto:$usethreads" in
14800         ":define")      d_gmtime_r_proto=define
14801                 set d_gmtime_r_proto gmtime_r $hdrs
14802                 eval $hasproto ;;
14803         *)      ;;
14804         esac
14805         case "$d_gmtime_r_proto" in
14806         define)
14807         case "$gmtime_r_proto" in
14808         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14809         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14810         esac
14811         case "$gmtime_r_proto" in
14812         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14813         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14814         esac
14815         case "$gmtime_r_proto" in
14816         ''|0)   d_gmtime_r=undef
14817                 gmtime_r_proto=0
14818                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14819         * )     case "$gmtime_r_proto" in
14820                 REENTRANT_PROTO*) ;;
14821                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14822                 esac
14823                 echo "Prototype: $try" ;;
14824         esac
14825         ;;
14826         *)      case "$usethreads" in
14827                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14828                 esac
14829                 d_gmtime_r=undef
14830                 gmtime_r_proto=0
14831                 ;;
14832         esac
14833         ;;
14834 *)      gmtime_r_proto=0
14835         ;;
14836 esac
14837
14838 : see if hasmntopt exists
14839 set hasmntopt d_hasmntopt
14840 eval $inlibc
14841
14842 : see if this is a netinet/in.h or sys/in.h system
14843 set netinet/in.h i_niin sys/in.h i_sysin
14844 eval $inhdr
14845
14846 : see if arpa/inet.h has to be included
14847 set arpa/inet.h i_arpainet
14848 eval $inhdr
14849
14850 : see if htonl --and friends-- exists
14851 val=''
14852 set htonl val
14853 eval $inlibc
14854
14855 : Maybe they are macros.
14856 case "$val" in
14857 $undef)
14858         $cat >htonl.c <<EOM
14859 #include <stdio.h>
14860 #include <sys/types.h>
14861 #$i_niin I_NETINET_IN
14862 #$i_sysin I_SYS_IN
14863 #$i_arpainet I_ARPA_INET
14864 #ifdef I_NETINET_IN
14865 #include <netinet/in.h>
14866 #endif
14867 #ifdef I_SYS_IN
14868 #include <sys/in.h>
14869 #endif
14870 #ifdef I_ARPA_INET
14871 #include <arpa/inet.h>
14872 #endif
14873 #ifdef htonl
14874 printf("Defined as a macro.");
14875 #endif
14876 EOM
14877         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14878         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14879                 val="$define"
14880                 echo "But it seems to be defined as a macro." >&4
14881         fi
14882         $rm -f htonl.?
14883         ;;
14884 esac
14885 set d_htonl
14886 eval $setvar
14887
14888 : see if ilogbl exists
14889 set ilogbl d_ilogbl
14890 eval $inlibc
14891
14892 : index or strchr
14893 echo " "
14894 if set index val -f; eval $csym; $val; then
14895         if set strchr val -f d_strchr; eval $csym; $val; then
14896                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14897                         val="$define"
14898                         vali="$undef"
14899                         echo "strchr() found." >&4
14900                 else
14901                         val="$undef"
14902                         vali="$define"
14903                         echo "index() found." >&4
14904                 fi
14905         else
14906                 val="$undef"
14907                 vali="$define"
14908                 echo "index() found." >&4
14909         fi
14910 else
14911         if set strchr val -f d_strchr; eval $csym; $val; then
14912                 val="$define"
14913                 vali="$undef"
14914                 echo "strchr() found." >&4
14915         else
14916                 echo "No index() or strchr() found!" >&4
14917                 val="$undef"
14918                 vali="$undef"
14919         fi
14920 fi
14921 set d_strchr; eval $setvar
14922 val="$vali"
14923 set d_index; eval $setvar
14924
14925 : check whether inet_aton exists
14926 set inet_aton d_inetaton
14927 eval $inlibc
14928
14929 : see if inet_ntop exists
14930 set inet_ntop d_inetntop
14931 eval $inlibc
14932
14933 : see if inet_pton exists
14934 set inet_pton d_inetpton
14935 eval $inlibc
14936
14937 : Look for isascii
14938 echo " "
14939 $cat >isascii.c <<EOCP
14940 #include <stdio.h>
14941 #include <ctype.h>
14942 #$i_stdlib I_STDLIB
14943 #ifdef I_STDLIB
14944 #include <stdlib.h>
14945 #endif
14946 int main() {
14947         int c = 'A';
14948         if (isascii(c))
14949                 exit(0);
14950         else
14951                 exit(1);
14952 }
14953 EOCP
14954 set isascii
14955 if eval $compile; then
14956         echo "isascii() found." >&4
14957         val="$define"
14958 else
14959         echo "isascii() NOT found." >&4
14960         val="$undef"
14961 fi
14962 set d_isascii
14963 eval $setvar
14964 $rm -f isascii*
14965
14966 : see if isfinite exists
14967 set isfinite d_isfinite
14968 eval $inlibc
14969
14970 : see if isinf exists
14971 set isinf d_isinf
14972 eval $inlibc
14973
14974 : see if isnan exists
14975 set isnan d_isnan
14976 eval $inlibc
14977
14978 : see if isnanl exists
14979 set isnanl d_isnanl
14980 eval $inlibc
14981
14982 : see if killpg exists
14983 set killpg d_killpg
14984 eval $inlibc
14985
14986 : see if lchown exists
14987 echo " "
14988 $cat > try.c <<'EOCP'
14989 /* System header to define __stub macros and hopefully few prototypes,
14990     which can conflict with char lchown(); below.  */
14991 #include <assert.h>
14992 /* Override any gcc2 internal prototype to avoid an error.  */
14993 /* We use char because int might match the return type of a gcc2
14994    builtin and then its argument prototype would still apply.  */
14995 char lchown();
14996 int main() {
14997     /*  The GNU C library defines this for functions which it implements
14998         to always fail with ENOSYS.  Some functions are actually named
14999         something starting with __ and the normal name is an alias.  */
15000 #if defined (__stub_lchown) || defined (__stub___lchown)
15001 choke me
15002 #else
15003 lchown();
15004 #endif
15005 ; return 0; }
15006 EOCP
15007 set try
15008 if eval $compile; then
15009     $echo "lchown() found." >&4
15010     val="$define"
15011 else
15012     $echo "lchown() NOT found." >&4
15013     val="$undef"
15014 fi
15015 set d_lchown
15016 eval $setvar
15017
15018 : See if number of significant digits in a double precision number is known
15019 echo " "
15020 $cat >ldbl_dig.c <<EOM
15021 #$i_limits I_LIMITS
15022 #$i_float I_FLOAT
15023 #ifdef I_LIMITS
15024 #include <limits.h>
15025 #endif
15026 #ifdef I_FLOAT
15027 #include <float.h>
15028 #endif
15029 #ifdef LDBL_DIG
15030 printf("Contains LDBL_DIG");
15031 #endif
15032 EOM
15033 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15034 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15035         echo "LDBL_DIG found." >&4
15036         val="$define"
15037 else
15038         echo "LDBL_DIG NOT found." >&4
15039         val="$undef"
15040 fi
15041 $rm -f ldbl_dig.?
15042 set d_ldbl_dig
15043 eval $setvar
15044
15045 : see if this is a math.h system
15046 set math.h i_math
15047 eval $inhdr
15048
15049 : check to see if math.h defines _LIB_VERSION
15050 d_libm_lib_version="$undef"
15051 case $i_math in
15052     $define)
15053         echo " "
15054         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15055         $cat >try.c <<EOCP
15056 #include <unistd.h>
15057 #include <math.h>
15058 int main (int argc, char *argv[])
15059 {
15060     printf ("%d\n", _LIB_VERSION);
15061     return (0);
15062     } /* main */
15063 EOCP
15064         set try
15065         if eval $compile; then
15066             foo=`$run ./try`
15067             echo "Yes, it does ($foo)" >&4
15068             d_libm_lib_version="$define"
15069         else
15070             echo "No, it does not (probably harmless)" >&4
15071             fi
15072         $rm_try
15073         ;;
15074
15075     esac
15076
15077 : see if link exists
15078 set link d_link
15079 eval $inlibc
15080
15081 : see if localtime_r exists
15082 set localtime_r d_localtime_r
15083 eval $inlibc
15084 case "$d_localtime_r" in
15085 "$define")
15086         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15087         case "$d_localtime_r_proto:$usethreads" in
15088         ":define")      d_localtime_r_proto=define
15089                 set d_localtime_r_proto localtime_r $hdrs
15090                 eval $hasproto ;;
15091         *)      ;;
15092         esac
15093         case "$d_localtime_r_proto" in
15094         define)
15095         case "$localtime_r_proto" in
15096         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15097         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15098         esac
15099         case "$localtime_r_proto" in
15100         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15101         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15102         esac
15103         case "$localtime_r_proto" in
15104         ''|0)   d_localtime_r=undef
15105                 localtime_r_proto=0
15106                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15107         * )     case "$localtime_r_proto" in
15108                 REENTRANT_PROTO*) ;;
15109                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15110                 esac
15111                 echo "Prototype: $try" ;;
15112         esac
15113         ;;
15114         *)      case "$usethreads" in
15115                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15116                 esac
15117                 d_localtime_r=undef
15118                 localtime_r_proto=0
15119                 ;;
15120         esac
15121         ;;
15122 *)      localtime_r_proto=0
15123         ;;
15124 esac
15125
15126 : see if localtime_r calls tzset
15127 case "$localtime_r_proto" in
15128 REENTRANT_PROTO*)
15129         $cat >try.c <<EOCP
15130 /*  Does our libc's localtime_r call tzset ?
15131  *  return 0 if so, 1 otherwise.
15132  */
15133 #$i_systypes    I_SYS_TYPES
15134 #$i_unistd      I_UNISTD
15135 #$i_time        I_TIME
15136 #$i_stdlib      I_STDLIB
15137 #$i_string      I_STRING
15138 #$i_malloc      I_MALLOC
15139 #ifdef I_SYS_TYPES
15140 #  include <sys/types.h>
15141 #endif
15142 #ifdef I_UNISTD
15143 #  include <unistd.h>
15144 #endif
15145 #ifdef I_TIME
15146 #  include <time.h>
15147 #endif
15148 #ifdef I_STDLIB
15149 #include <stdlib.h>
15150 #endif
15151 #ifdef I_STRING
15152 #  include <string.h>
15153 #else
15154 #  include <strings.h>
15155 #endif
15156 #ifdef I_MALLOC
15157 #  include <malloc.h>
15158 #endif
15159 int main()
15160 {
15161     time_t t = time(0L);
15162     char w_tz[]="TZ" "=GMT+5",
15163          e_tz[]="TZ" "=GMT-5",
15164         *tz_e = (char*)malloc(16),
15165         *tz_w = (char*)malloc(16);
15166     struct tm tm_e, tm_w;
15167     memset(&tm_e,'\0',sizeof(struct tm));
15168     memset(&tm_w,'\0',sizeof(struct tm));
15169     strcpy(tz_e,e_tz);
15170     strcpy(tz_w,w_tz);
15171
15172     putenv(tz_e);
15173     localtime_r(&t, &tm_e);
15174
15175     putenv(tz_w);
15176     localtime_r(&t, &tm_w);
15177
15178     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15179         return 1;
15180     return 0;
15181 }
15182 EOCP
15183         set try
15184         if eval $compile; then
15185             if $run ./try; then
15186                 d_localtime_r_needs_tzset=undef;
15187             else
15188                 d_localtime_r_needs_tzset=define;
15189             fi;
15190         else
15191             d_localtime_r_needs_tzset=undef;
15192         fi;
15193      ;;
15194   *)
15195      d_localtime_r_needs_tzset=undef;
15196      ;;
15197 esac
15198 $rm_try
15199
15200 : see if localeconv exists
15201 set localeconv d_locconv
15202 eval $inlibc
15203
15204 : see if lockf exists
15205 set lockf d_lockf
15206 eval $inlibc
15207
15208 : see if prototype for lseek is available
15209 echo " "
15210 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15211 eval $hasproto
15212
15213 : see if lstat exists
15214 set lstat d_lstat
15215 eval $inlibc
15216
15217 : see if madvise exists
15218 set madvise d_madvise
15219 eval $inlibc
15220
15221 : see if malloc_size exists
15222 set malloc_size d_malloc_size
15223 eval $inlibc
15224
15225 : see if malloc_size_good exists
15226 set malloc_good_size d_malloc_good_size
15227 eval $inlibc
15228
15229 : see if mblen exists
15230 set mblen d_mblen
15231 eval $inlibc
15232
15233 : see if mbstowcs exists
15234 set mbstowcs d_mbstowcs
15235 eval $inlibc
15236
15237 : see if mbtowc exists
15238 set mbtowc d_mbtowc
15239 eval $inlibc
15240
15241 : see if memchr exists
15242 set memchr d_memchr
15243 eval $inlibc
15244
15245 : see if memcmp exists
15246 set memcmp d_memcmp
15247 eval $inlibc
15248
15249 : see if memcpy exists
15250 set memcpy d_memcpy
15251 eval $inlibc
15252
15253 : see if memmove exists
15254 set memmove d_memmove
15255 eval $inlibc
15256
15257 : see if memset exists
15258 set memset d_memset
15259 eval $inlibc
15260
15261 : see if mkdir exists
15262 set mkdir d_mkdir
15263 eval $inlibc
15264
15265 : see if mkdtemp exists
15266 set mkdtemp d_mkdtemp
15267 eval $inlibc
15268
15269 : see if mkfifo exists
15270 set mkfifo d_mkfifo
15271 eval $inlibc
15272
15273 : see if mkstemp exists
15274 set mkstemp d_mkstemp
15275 eval $inlibc
15276
15277 : see if mkstemps exists
15278 set mkstemps d_mkstemps
15279 eval $inlibc
15280
15281 : see if mktime exists
15282 set mktime d_mktime
15283 eval $inlibc
15284
15285 : see if this is a sys/mman.h system
15286 set sys/mman.h i_sysmman
15287 eval $inhdr
15288
15289 : see if mmap exists
15290 set mmap d_mmap
15291 eval $inlibc
15292 : see what shmat returns
15293 : default to something harmless
15294 mmaptype='void *'
15295 case "$i_sysmman$d_mmap" in
15296 "$define$define")
15297         $cat >mmap.c <<'END'
15298 #include <sys/mman.h>
15299 void *mmap();
15300 END
15301         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15302                 mmaptype='void *'
15303         else
15304                 mmaptype='caddr_t'
15305         fi
15306         echo "and it returns ($mmaptype)." >&4
15307         ;;
15308 esac
15309
15310
15311
15312 : see if sqrtl exists
15313 set sqrtl d_sqrtl
15314 eval $inlibc
15315
15316 : see if scalbnl exists
15317 set scalbnl d_scalbnl
15318 eval $inlibc
15319
15320 : see if modfl exists
15321 set modfl d_modfl
15322 eval $inlibc
15323
15324 : see if prototype for modfl is available
15325 echo " "
15326 set d_modflproto modfl $i_math math.h
15327 eval $hasproto
15328
15329 d_modfl_pow32_bug="$undef"
15330
15331 case "$d_longdbl$d_modfl" in
15332 $define$define)
15333         $cat <<EOM
15334 Checking to see whether your modfl() is okay for large values...
15335 EOM
15336 $cat >try.c <<EOCP
15337 #include <math.h>
15338 #include <stdio.h>
15339 EOCP
15340 if $test "X$d_modflproto" != "X$define"; then
15341         $cat >>try.c <<EOCP
15342 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15343 long double modfl (long double, long double *);
15344 EOCP
15345 fi
15346 $cat >>try.c <<EOCP
15347 int main() {
15348     long double nv = 4294967303.15;
15349     long double v, w;
15350     v = modfl(nv, &w);
15351 #ifdef __GLIBC__
15352     printf("glibc");
15353 #endif
15354     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15355     return 0;
15356 }
15357 EOCP
15358         case "$osname:$gccversion" in
15359         aix:)   saveccflags="$ccflags"
15360                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15361         esac
15362         set try
15363         if eval $compile; then
15364                 foo=`$run ./try`
15365                 case "$foo" in
15366                 *" 4294967303.150000 1.150000 4294967302.000000")
15367                         echo >&4 "Your modfl() is broken for large values."
15368                         d_modfl_pow32_bug="$define"
15369                         case "$foo" in
15370                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15371                         ;;
15372                         esac
15373                         ;;
15374                 *" 4294967303.150000 0.150000 4294967303.000000")
15375                         echo >&4 "Your modfl() seems okay for large values."
15376                         ;;
15377                 *)      echo >&4 "I don't understand your modfl() at all."
15378                         d_modfl="$undef"
15379                         ;;
15380                 esac
15381                 $rm_try
15382         else
15383                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15384                 d_modfl="$undef"
15385         fi
15386         case "$osname:$gccversion" in
15387         aix:)   ccflags="$saveccflags" ;; # restore
15388         esac
15389         ;;
15390 esac
15391
15392 if $test "$uselongdouble" = "$define"; then
15393     message=""
15394     if $test "$d_sqrtl" != "$define"; then
15395         message="$message sqrtl"
15396     fi
15397     if $test "$d_modfl" != "$define"; then
15398         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15399             echo "You have both aintl and copysignl, so I can emulate modfl."
15400         else
15401             message="$message modfl"
15402         fi
15403     fi
15404     if $test "$d_frexpl" != "$define"; then
15405         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15406             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15407         else
15408             message="$message frexpl"
15409         fi
15410     fi
15411
15412     if $test "$message" != ""; then
15413         $cat <<EOM >&4
15414
15415 *** You requested the use of long doubles but you do not seem to have
15416 *** the following mathematical functions needed for long double support:
15417 ***    $message
15418 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15419 *** Cannot continue, aborting.
15420
15421 EOM
15422
15423         exit 1
15424     fi
15425 fi
15426
15427 : see if mprotect exists
15428 set mprotect d_mprotect
15429 eval $inlibc
15430
15431 : see if msgctl exists
15432 set msgctl d_msgctl
15433 eval $inlibc
15434
15435 : see if msgget exists
15436 set msgget d_msgget
15437 eval $inlibc
15438
15439 : see if msgsnd exists
15440 set msgsnd d_msgsnd
15441 eval $inlibc
15442
15443 : see if msgrcv exists
15444 set msgrcv d_msgrcv
15445 eval $inlibc
15446
15447 : see how much of the 'msg*(2)' library is present.
15448 h_msg=true
15449 echo " "
15450 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15451 *"$undef"*) h_msg=false;;
15452 esac
15453 case "$osname" in
15454 freebsd)
15455     case "`ipcs 2>&1`" in
15456     "SVID messages"*"not configured"*)
15457         echo "Your $osname does not have the msg*(2) configured." >&4
15458         h_msg=false
15459         val="$undef"
15460         set msgctl d_msgctl
15461         eval $setvar
15462         set msgget d_msgget
15463         eval $setvar
15464         set msgsnd d_msgsnd
15465         eval $setvar
15466         set msgrcv d_msgrcv
15467         eval $setvar
15468         ;;
15469     esac
15470     ;;
15471 esac
15472 : we could also check for sys/ipc.h ...
15473 if $h_msg && $test `./findhdr sys/msg.h`; then
15474         echo "You have the full msg*(2) library." >&4
15475         val="$define"
15476 else
15477         echo "You don't have the full msg*(2) library." >&4
15478         val="$undef"
15479 fi
15480 set d_msg
15481 eval $setvar
15482
15483 : Check for msghdr_s
15484 echo " "
15485 echo "Checking to see if your system supports struct msghdr..." >&4
15486 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15487 eval $hasstruct
15488 case "$d_msghdr_s" in
15489 "$define")      echo "Yes, it does."   ;;
15490 *)              echo "No, it doesn't." ;;
15491 esac
15492
15493
15494 : see if msync exists
15495 set msync d_msync
15496 eval $inlibc
15497
15498 : see if munmap exists
15499 set munmap d_munmap
15500 eval $inlibc
15501
15502 : see if nice exists
15503 set nice d_nice
15504 eval $inlibc
15505
15506 : see if this is a langinfo.h system
15507 set langinfo.h i_langinfo
15508 eval $inhdr
15509
15510 : see if nl_langinfo exists
15511 set nl_langinfo d_nl_langinfo
15512 eval $inlibc
15513
15514 : check for volatile keyword
15515 echo " "
15516 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15517 $cat >try.c <<'EOCP'
15518 int main()
15519 {
15520         typedef struct _goo_struct goo_struct;
15521         goo_struct * volatile goo = ((goo_struct *)0);
15522         struct _goo_struct {
15523                 long long_int;
15524                 int reg_int;
15525                 char char_var;
15526         };
15527         typedef unsigned short foo_t;
15528         char *volatile foo;
15529         volatile int bar;
15530         volatile foo_t blech;
15531         foo = foo;
15532 }
15533 EOCP
15534 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15535         val="$define"
15536         echo "Yup, it does."
15537 else
15538         val="$undef"
15539         echo "Nope, it doesn't."
15540 fi
15541 set d_volatile
15542 eval $setvar
15543 $rm_try
15544
15545 : Check basic sizes
15546 echo " "
15547 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15548
15549 case "$use64bitint:$d_quad:$quadtype" in
15550 define:define:?*)
15551         ivtype="$quadtype"
15552         uvtype="$uquadtype"
15553         ivsize=8
15554         uvsize=8
15555         ;;
15556 *)      ivtype="long"
15557         uvtype="unsigned long"
15558         ivsize=$longsize
15559         uvsize=$longsize
15560         ;;
15561 esac
15562
15563 case "$uselongdouble:$d_longdbl" in
15564 define:define)
15565         nvtype="long double"
15566         nvsize=$longdblsize
15567         ;;
15568 *)      nvtype=double
15569         nvsize=$doublesize
15570         ;;
15571 esac
15572
15573 $echo "(IV will be "$ivtype", $ivsize bytes)"
15574 $echo "(UV will be "$uvtype", $uvsize bytes)"
15575 $echo "(NV will be "$nvtype", $nvsize bytes)"
15576
15577 $cat >try.c <<EOCP
15578 #$i_inttypes I_INTTYPES
15579 #ifdef I_INTTYPES
15580 #include <inttypes.h>
15581 #endif
15582 #include <stdio.h>
15583 int main() {
15584 #ifdef INT8
15585    int8_t i =  INT8_MAX;
15586   uint8_t u = UINT8_MAX;
15587   printf("int8_t\n");
15588 #endif
15589 #ifdef INT16
15590    int16_t i =  INT16_MAX;
15591   uint16_t i = UINT16_MAX;
15592   printf("int16_t\n");
15593 #endif
15594 #ifdef INT32
15595    int32_t i =  INT32_MAX;
15596   uint32_t u = UINT32_MAX;
15597   printf("int32_t\n");
15598 #endif
15599 }
15600 EOCP
15601
15602 i8type="signed char"
15603 u8type="unsigned char"
15604 i8size=1
15605 u8size=1
15606
15607 case "$i16type" in
15608 '')     case "$shortsize" in
15609         2)      i16type=short
15610                 u16type="unsigned short"
15611                 i16size=$shortsize
15612                 u16size=$shortsize
15613                 ;;
15614         esac
15615         ;;
15616 esac
15617 case "$i16type" in
15618 '')     set try -DINT16
15619         if eval $compile; then
15620                 case "`$run ./try`" in
15621                 int16_t)
15622                         i16type=int16_t
15623                         u16type=uint16_t
15624                         i16size=2
15625                         u16size=2
15626                         ;;
15627                 esac
15628         fi
15629         ;;
15630 esac
15631 case "$i16type" in
15632 '')     if $test $shortsize -ge 2; then
15633                 i16type=short
15634                 u16type="unsigned short"
15635                 i16size=$shortsize
15636                 u16size=$shortsize
15637         fi
15638         ;;
15639 esac
15640
15641 case "$i32type" in
15642 '')     case "$longsize" in
15643         4)      i32type=long
15644                 u32type="unsigned long"
15645                 i32size=$longsize
15646                 u32size=$longsize
15647                 ;;
15648         *)      case "$intsize" in
15649                 4)      i32type=int
15650                         u32type="unsigned int"
15651                         i32size=$intsize
15652                         u32size=$intsize
15653                         ;;
15654                 esac
15655                 ;;
15656         esac
15657         ;;
15658 esac
15659 case "$i32type" in
15660 '')     set try -DINT32
15661         if eval $compile; then
15662                 case "`$run ./try`" in
15663                 int32_t)
15664                         i32type=int32_t
15665                         u32type=uint32_t
15666                         i32size=4
15667                         u32size=4
15668                         ;;
15669                 esac
15670         fi
15671         ;;
15672 esac
15673 case "$i32type" in
15674 '')     if $test $intsize -ge 4; then
15675                 i32type=int
15676                 u32type="unsigned int"
15677                 i32size=$intsize
15678                 u32size=$intsize
15679         fi
15680         ;;
15681 esac
15682
15683 case "$i64type" in
15684 '')     case "$d_quad:$quadtype" in
15685         define:?*)
15686                 i64type="$quadtype"
15687                 u64type="$uquadtype"
15688                 i64size=8
15689                 u64size=8
15690                 ;;
15691         esac
15692         ;;
15693 esac
15694
15695 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15696 : volatile so that the compiler has to store it out to memory.
15697 if test X"$d_volatile" = X"$define"; then
15698         volatile=volatile
15699 fi
15700 $cat <<EOP >try.c
15701 #include <stdio.h>
15702 #$i_stdlib I_STDLIB
15703 #ifdef I_STDLIB
15704 #include <stdlib.h>
15705 #endif
15706 #include <sys/types.h>
15707 #include <signal.h>
15708 #ifdef SIGFPE
15709 $volatile int bletched = 0;
15710 $signal_t blech(int s) { bletched = 1; }
15711 #endif
15712 int main() {
15713     $uvtype u = 0;
15714     $nvtype d;
15715     int     n = 8 * $uvsize;
15716     int     i;
15717 #ifdef SIGFPE
15718     signal(SIGFPE, blech);
15719 #endif
15720
15721     for (i = 0; i < n; i++) {
15722       u = u << 1 | ($uvtype)1;
15723       d = ($nvtype)u;
15724       if (($uvtype)d != u)
15725         break;
15726       if (d <= 0)
15727         break;
15728       d = ($nvtype)(u - 1);
15729       if (($uvtype)d != (u - 1))
15730         break;
15731 #ifdef SIGFPE
15732       if (bletched)
15733         break;
15734 #endif
15735     }
15736     printf("%d\n", ((i == n) ? -n : i));
15737     exit(0);
15738 }
15739 EOP
15740 set try
15741
15742 d_nv_preserves_uv="$undef"
15743 if eval $compile; then
15744         nv_preserves_uv_bits="`$run ./try`"
15745 fi
15746 case "$nv_preserves_uv_bits" in
15747 \-[1-9]*)
15748         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15749         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15750         d_nv_preserves_uv="$define"
15751         ;;
15752 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15753         d_nv_preserves_uv="$undef" ;;
15754 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15755         nv_preserves_uv_bits="0" ;;
15756 esac
15757 $rm_try
15758
15759 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15760 : volatile so that the compiler has to store it out to memory.
15761 if test X"$d_volatile" = X"$define"; then
15762         volatile=volatile
15763 fi
15764 $cat <<EOP >try.c
15765 #include <stdio.h>
15766
15767 typedef $nvtype NV;
15768
15769 int
15770 main() {
15771   NV value = 2;
15772   int count = 1;
15773
15774   while(count < 256) {
15775     $volatile NV up = value + 1.0;
15776     $volatile NV negated = -value;
15777     $volatile NV down = negated - 1.0;
15778     $volatile NV got_up = up - value;
15779     int up_good = got_up == 1.0;
15780     int got_down = down - negated;
15781     int down_good = got_down == -1.0;
15782
15783     if (down_good != up_good) {
15784       fprintf(stderr,
15785               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15786               up_good, (double) got_up, down_good, (double) got_down,
15787               count, (double) value);
15788       return 1;
15789     }
15790     if (!up_good) {
15791       while (1) {
15792         if (count > 8) {
15793           count -= 8;
15794           fputs("256.0", stdout);
15795         } else {
15796           count--;
15797           fputs("2.0", stdout);
15798         }
15799         if (!count) {
15800           puts("");
15801           return 0;
15802         }
15803         fputs("*", stdout);
15804       }
15805     }
15806     value *= 2;
15807     ++count;
15808   }
15809   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15810           count, (double) value);
15811   return 1;
15812 }
15813 EOP
15814 set try
15815
15816 nv_overflows_integers_at='0'
15817 if eval $compile; then
15818     xxx="`$run ./try`"
15819     case "$?" in
15820         0)
15821             case "$xxx" in
15822                 2*)  cat >&4 <<EOM
15823 The largest integer your NVs can preserve is equal to $xxx
15824 EOM
15825                     nv_overflows_integers_at="$xxx"
15826                     ;;
15827                 *)  cat >&4 <<EOM
15828 Cannot determine the largest integer value your NVs can hold, unexpected output
15829 '$xxx'
15830 EOM
15831                     ;;
15832             esac
15833             ;;
15834         *)  cat >&4 <<EOM
15835 Cannot determine the largest integer value your NVs can hold
15836 EOM
15837             ;;
15838     esac
15839 fi
15840 $rm_try
15841
15842 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15843 : volatile so that the compiler has to store it out to memory.
15844 if test X"$d_volatile" = X"$define"; then
15845         volatile=volatile
15846 fi
15847 $cat <<EOP >try.c
15848 #include <stdio.h>
15849 #$i_stdlib I_STDLIB
15850 #ifdef I_STDLIB
15851 #include <stdlib.h>
15852 #endif
15853 #$i_string I_STRING
15854 #ifdef I_STRING
15855 #  include <string.h>
15856 #else
15857 #  include <strings.h>
15858 #endif
15859 #include <sys/types.h>
15860 #include <signal.h>
15861 #ifdef SIGFPE
15862 $volatile int bletched = 0;
15863 $signal_t blech(int s) { bletched = 1; }
15864 #endif
15865
15866 int checkit($nvtype d, char *where) {
15867     unsigned char *p = (char *)&d;
15868     unsigned char *end = p + sizeof(d);
15869     int fail = 0;
15870
15871     while (p < end)
15872         fail += *p++;
15873
15874     if (!fail)
15875         return 0;
15876
15877     p = (char *)&d;
15878     printf("No - %s: 0x", where);
15879     while (p < end)
15880         printf ("%02X", *p++);
15881     printf("\n");
15882     return 1;
15883 }
15884
15885 int main(int argc, char **argv) {
15886     $nvtype d = 0.0;
15887     int fail = 0;
15888     fail += checkit(d, "0.0");
15889
15890     /* The compiler shouldn't be assuming that bletched is 0  */
15891     d = bletched;
15892
15893     fail += checkit(d, "bleched");
15894
15895 #ifdef SIGFPE
15896     signal(SIGFPE, blech);
15897 #endif
15898
15899     /* Paranoia - the compiler should have no way of knowing that ANSI says
15900        that argv[argc] will always be NULL.  Actually, if it did assume this it
15901        would be buggy, as this is C and main() can be called from elsewhere in
15902        the program.  */
15903     d = argv[argc] ? 1 : 0;
15904
15905     if (d) {
15906         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15907     }
15908
15909     fail += checkit(d, "ternary");
15910
15911     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15912
15913     if (d != 0.0) {
15914         printf("No - memset doesn't give 0.0\n");
15915         /* This might just blow up:  */
15916         printf("(gives %g)\n", d);
15917         return 1;
15918     }
15919
15920 #ifdef SIGFPE
15921     if (bletched) {
15922         printf("No - something bleched\n");
15923         return 1;
15924     }
15925 #endif
15926     if (fail) {
15927       printf("No - %d fail(s)\n", fail);
15928       return 1;
15929     }
15930     printf("Yes\n");
15931     return 0;
15932 }
15933 EOP
15934 set try
15935
15936 d_nv_zero_is_allbits_zero="$undef"
15937 if eval $compile; then
15938     xxx="`$run ./try`"
15939     case "$?" in
15940         0)
15941             case "$xxx" in
15942                 Yes)  cat >&4 <<EOM
15943 0.0 is represented as all bits zero in memory
15944 EOM
15945                     d_nv_zero_is_allbits_zero="$define"
15946                     ;;
15947                 *)  cat >&4 <<EOM
15948 0.0 is not represented as all bits zero in memory
15949 EOM
15950                     d_nv_zero_is_allbits_zero="$undef"
15951                     ;;
15952             esac
15953             ;;
15954         *)  cat >&4 <<EOM
15955 0.0 is not represented as all bits zero in memory
15956 EOM
15957             d_nv_zero_is_allbits_zero="$undef"
15958             ;;
15959     esac
15960 fi
15961 $rm_try
15962
15963 : check for off64_t
15964 echo " "
15965 echo "Checking to see if you have off64_t..." >&4
15966 $cat >try.c <<EOCP
15967 #include <sys/types.h>
15968 #include <unistd.h>
15969 int main() { off64_t x = 7; }
15970 EOCP
15971 set try
15972 if eval $compile; then
15973         val="$define"
15974         echo "You have off64_t."
15975 else
15976         val="$undef"
15977         echo "You do not have off64_t."
15978         case "$lseeksize" in
15979         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15980         esac
15981 fi
15982 $rm_try
15983 set d_off64_t
15984 eval $setvar
15985
15986 : how to create joinable pthreads
15987 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15988         echo " "
15989         echo "Checking what constant to use for creating joinable pthreads..." >&4
15990         $cat >try.c <<'EOCP'
15991 #include <pthread.h>
15992 int main() {
15993     int detachstate = JOINABLE;
15994 }
15995 EOCP
15996         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15997         if eval $compile; then
15998                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15999                 val="$undef" # Yes, undef.
16000                 set d_old_pthread_create_joinable
16001                 eval $setvar
16002                 val=""
16003                 set old_pthread_create_joinable
16004                 eval $setvar
16005         else
16006                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16007                 if eval $compile; then
16008                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16009                         val="$define"
16010                         set d_old_pthread_create_joinable
16011                         eval $setvar
16012                         val=PTHREAD_CREATE_UNDETACHED
16013                         set old_pthread_create_joinable
16014                         eval $setvar
16015                 else
16016                         set try -DJOINABLE=__UNDETACHED
16017                         if eval $compile; then
16018                                 echo "You seem to use __UNDETACHED." >&4
16019                                 val="$define"
16020                                 set d_old_pthread_create_joinable
16021                                 eval $setvar
16022                                 val=__UNDETACHED
16023                                 set old_pthread_create_joinable
16024                                 eval $setvar
16025                         else
16026                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16027                                 val="$define"
16028                                 set d_old_pthread_create_joinable
16029                                 eval $setvar
16030                                 val=0
16031                                 set old_pthread_create_joinable
16032                                 eval $setvar
16033                         fi
16034                 fi
16035         fi
16036         $rm_try
16037 else
16038     d_old_pthread_create_joinable="$undef"
16039     old_pthread_create_joinable=""
16040 fi
16041
16042 : see if pause exists
16043 set pause d_pause
16044 eval $inlibc
16045
16046 : see if poll exists
16047 set poll d_poll
16048 eval $inlibc
16049
16050 : see if readlink exists
16051 set readlink d_readlink
16052 eval $inlibc
16053
16054 : Check if exe is symlink to abs path of executing program
16055 echo " "
16056 procselfexe=''
16057 val="$undef"
16058 case "$d_readlink" in
16059 "$define")
16060         if $issymlink /proc/self/exe ; then
16061                 $ls -l /proc/self/exe > reflect
16062                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16063                         echo "You have Linux-like /proc/self/exe."
16064                         procselfexe='"/proc/self/exe"'
16065                         val="$define"
16066                 fi
16067         fi
16068         if $issymlink /proc/curproc/file ; then
16069                 $ls -l /proc/curproc/file > reflect
16070                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16071                         echo "You have BSD-like /proc/curproc/file."
16072                         procselfexe='"/proc/curproc/file"'
16073                         val="$define"
16074                 fi
16075         fi
16076         ;;
16077 esac
16078 $rm -f reflect
16079 set d_procselfexe
16080 eval $setvar
16081
16082 : backward compatibility for d_hvfork
16083 if test X$d_hvfork != X; then
16084         d_vfork="$d_hvfork"
16085         d_hvfork=''
16086 fi
16087 : see if there is a vfork
16088 val=''
16089 set vfork val
16090 eval $inlibc
16091
16092 d_pseudofork=$undef
16093
16094 : Ok, but do we want to use it. vfork is reportedly unreliable in
16095 : perl on Solaris 2.x, and probably elsewhere.
16096 case "$val" in
16097 $define)
16098         echo " "
16099         case "$usevfork" in
16100         false) dflt='n';;
16101         *) dflt='y';;
16102         esac
16103         cat <<'EOM'
16104
16105 Perl can only use a vfork() that doesn't suffer from strict
16106 restrictions on calling functions or modifying global data in
16107 the child.  For example, glibc-2.1 contains such a vfork()
16108 that is unsuitable.  If your system provides a proper fork()
16109 call, chances are that you do NOT want perl to use vfork().
16110
16111 EOM
16112         rp="Do you still want to use vfork()?"
16113         . ./myread
16114         case "$ans" in
16115         y|Y) ;;
16116         *)
16117                 echo "Ok, we won't use vfork()."
16118                 val="$undef"
16119                 ;;
16120         esac
16121         ;;
16122 esac
16123 set d_vfork
16124 eval $setvar
16125 case "$d_vfork" in
16126 $define) usevfork='true';;
16127 *) usevfork='false';;
16128 esac
16129
16130 : see whether the pthread_atfork exists
16131 $cat >try.c <<EOP
16132 #include <pthread.h>
16133 #include <stdio.h>
16134 int main() {
16135 #ifdef  PTHREAD_ATFORK
16136         pthread_atfork(NULL,NULL,NULL);
16137 #endif
16138 }
16139 EOP
16140
16141 : see if pthread_atfork exists
16142 set try -DPTHREAD_ATFORK
16143 if eval $compile; then
16144     val="$define"
16145 else
16146     val="$undef"
16147 fi
16148 case "$usethreads" in
16149 $define)
16150         case "$val" in
16151         $define) echo 'pthread_atfork found.' >&4        ;;
16152         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16153         esac
16154 esac
16155 set d_pthread_atfork
16156 eval $setvar
16157
16158 : see if pthread_attr_setscope exists
16159 set pthread_attr_setscope d_pthread_attr_setscope
16160 eval $inlibc
16161
16162 : see whether the various POSIXish _yields exist
16163 $cat >try.c <<EOP
16164 #include <pthread.h>
16165 #include <stdio.h>
16166 int main() {
16167 #ifdef SCHED_YIELD
16168         sched_yield();
16169 #else
16170 #ifdef PTHREAD_YIELD
16171         pthread_yield();
16172 #else
16173 #ifdef PTHREAD_YIELD_NULL
16174         pthread_yield(NULL);
16175 #endif
16176 #endif
16177 #endif
16178 }
16179 EOP
16180 : see if sched_yield exists
16181 set try -DSCHED_YIELD
16182 if eval $compile; then
16183     val="$define"
16184     sched_yield='sched_yield()'
16185 else
16186     val="$undef"
16187 fi
16188 case "$usethreads" in
16189 $define)
16190         case "$val" in
16191         $define) echo 'sched_yield() found.' >&4        ;;
16192         *)       echo 'sched_yield() NOT found.' >&4    ;;
16193         esac
16194 esac
16195 set d_sched_yield
16196 eval $setvar
16197
16198 : see if pthread_yield exists
16199 set try -DPTHREAD_YIELD
16200 if eval $compile; then
16201     val="$define"
16202     case "$sched_yield" in
16203     '') sched_yield='pthread_yield()' ;;
16204     esac
16205 else
16206     set try -DPTHREAD_YIELD_NULL
16207     if eval $compile; then
16208         val="$define"
16209         case "$sched_yield" in
16210         '') sched_yield='pthread_yield(NULL)' ;;
16211         esac
16212     else
16213         val="$undef"
16214     fi
16215 fi
16216 case "$usethreads" in
16217 $define)
16218         case "$val" in
16219         $define) echo 'pthread_yield() found.' >&4      ;;
16220         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16221         esac
16222         ;;
16223 esac
16224 set d_pthread_yield
16225 eval $setvar
16226 case "$sched_yield" in
16227 '') sched_yield=undef ;;
16228 esac
16229 $rm_try
16230
16231 : see if random_r exists
16232 set random_r d_random_r
16233 eval $inlibc
16234 case "$d_random_r" in
16235 "$define")
16236         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16237         case "$d_random_r_proto:$usethreads" in
16238         ":define")      d_random_r_proto=define
16239                 set d_random_r_proto random_r $hdrs
16240                 eval $hasproto ;;
16241         *)      ;;
16242         esac
16243         case "$d_random_r_proto" in
16244         define)
16245         case "$random_r_proto" in
16246         ''|0) try='int random_r(int*, struct random_data*);'
16247         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16248         esac
16249         case "$random_r_proto" in
16250         ''|0) try='int random_r(long*, struct random_data*);'
16251         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16252         esac
16253         case "$random_r_proto" in
16254         ''|0) try='int random_r(struct random_data*, int32_t*);'
16255         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16256         esac
16257         case "$random_r_proto" in
16258         ''|0)   d_random_r=undef
16259                 random_r_proto=0
16260                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16261         * )     case "$random_r_proto" in
16262                 REENTRANT_PROTO*) ;;
16263                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16264                 esac
16265                 echo "Prototype: $try" ;;
16266         esac
16267         ;;
16268         *)      case "$usethreads" in
16269                 define) echo "random_r has no prototype, not using it." >&4 ;;
16270                 esac
16271                 d_random_r=undef
16272                 random_r_proto=0
16273                 ;;
16274         esac
16275         ;;
16276 *)      random_r_proto=0
16277         ;;
16278 esac
16279
16280 : see if readdir and friends exist
16281 set readdir d_readdir
16282 eval $inlibc
16283 set seekdir d_seekdir
16284 eval $inlibc
16285 set telldir d_telldir
16286 eval $inlibc
16287 set rewinddir d_rewinddir
16288 eval $inlibc
16289
16290 : see if readdir64_r exists
16291 set readdir64_r d_readdir64_r
16292 eval $inlibc
16293 case "$d_readdir64_r" in
16294 "$define")
16295         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16296         case "$d_readdir64_r_proto:$usethreads" in
16297         ":define")      d_readdir64_r_proto=define
16298                 set d_readdir64_r_proto readdir64_r $hdrs
16299                 eval $hasproto ;;
16300         *)      ;;
16301         esac
16302         case "$d_readdir64_r_proto" in
16303         define)
16304         case "$readdir64_r_proto" in
16305         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16306         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16307         esac
16308         case "$readdir64_r_proto" in
16309         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16310         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16311         esac
16312         case "$readdir64_r_proto" in
16313         ''|0)   d_readdir64_r=undef
16314                 readdir64_r_proto=0
16315                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16316         * )     case "$readdir64_r_proto" in
16317                 REENTRANT_PROTO*) ;;
16318                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16319                 esac
16320                 echo "Prototype: $try" ;;
16321         esac
16322         ;;
16323         *)      case "$usethreads" in
16324                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16325                 esac
16326                 d_readdir64_r=undef
16327                 readdir64_r_proto=0
16328                 ;;
16329         esac
16330         ;;
16331 *)      readdir64_r_proto=0
16332         ;;
16333 esac
16334
16335 : see if readdir_r exists
16336 set readdir_r d_readdir_r
16337 eval $inlibc
16338 case "$d_readdir_r" in
16339 "$define")
16340         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16341         case "$d_readdir_r_proto:$usethreads" in
16342         ":define")      d_readdir_r_proto=define
16343                 set d_readdir_r_proto readdir_r $hdrs
16344                 eval $hasproto ;;
16345         *)      ;;
16346         esac
16347         case "$d_readdir_r_proto" in
16348         define)
16349         case "$readdir_r_proto" in
16350         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16351         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16352         esac
16353         case "$readdir_r_proto" in
16354         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16355         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16356         esac
16357         case "$readdir_r_proto" in
16358         ''|0)   d_readdir_r=undef
16359                 readdir_r_proto=0
16360                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16361         * )     case "$readdir_r_proto" in
16362                 REENTRANT_PROTO*) ;;
16363                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16364                 esac
16365                 echo "Prototype: $try" ;;
16366         esac
16367         ;;
16368         *)      case "$usethreads" in
16369                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16370                 esac
16371                 d_readdir_r=undef
16372                 readdir_r_proto=0
16373                 ;;
16374         esac
16375         ;;
16376 *)      readdir_r_proto=0
16377         ;;
16378 esac
16379
16380 : see if readv exists
16381 set readv d_readv
16382 eval $inlibc
16383
16384 : see if recvmsg exists
16385 set recvmsg d_recvmsg
16386 eval $inlibc
16387
16388 : see if rename exists
16389 set rename d_rename
16390 eval $inlibc
16391
16392 : see if rmdir exists
16393 set rmdir d_rmdir
16394 eval $inlibc
16395
16396 : see if memory.h is available.
16397 val=''
16398 set memory.h val
16399 eval $inhdr
16400
16401 : See if it conflicts with string.h
16402 case "$val" in
16403 $define)
16404         case "$strings" in
16405         '') ;;
16406         *)
16407                 $cppstdin $cppflags $cppminus < $strings > mem.h
16408                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16409                         echo " "
16410                         echo "We won't be including <memory.h>."
16411                         val="$undef"
16412                 fi
16413                 $rm -f mem.h
16414                 ;;
16415         esac
16416 esac
16417 set i_memory
16418 eval $setvar
16419
16420 : can bcopy handle overlapping blocks?
16421 echo " "
16422 val="$undef"
16423 case "$d_memmove" in
16424 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16425 *)      case "$d_bcopy" in
16426         "$define")
16427                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16428                 $cat >try.c <<EOCP
16429 #$i_memory I_MEMORY
16430 #$i_stdlib I_STDLIB
16431 #$i_string I_STRING
16432 #$i_unistd I_UNISTD
16433 EOCP
16434         $cat >>try.c <<'EOCP'
16435 #include <stdio.h>
16436 #ifdef I_MEMORY
16437 #  include <memory.h>
16438 #endif
16439 #ifdef I_STDLIB
16440 #  include <stdlib.h>
16441 #endif
16442 #ifdef I_STRING
16443 #  include <string.h>
16444 #else
16445 #  include <strings.h>
16446 #endif
16447 #ifdef I_UNISTD
16448 #  include <unistd.h>  /* Needed for NetBSD */
16449 #endif
16450 int main()
16451 {
16452 char buf[128], abc[128];
16453 char *b;
16454 int len;
16455 int off;
16456 int align;
16457
16458 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16459    try to store the string in read-only memory. */
16460 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16461
16462 for (align = 7; align >= 0; align--) {
16463         for (len = 36; len; len--) {
16464                 b = buf+align;
16465                 bcopy(abc, b, len);
16466                 for (off = 1; off <= len; off++) {
16467                         bcopy(b, b+off, len);
16468                         bcopy(b+off, b, len);
16469                         if (bcmp(b, abc, len))
16470                                 exit(1);
16471                 }
16472         }
16473 }
16474 exit(0);
16475 }
16476 EOCP
16477                 set try
16478                 if eval $compile_ok; then
16479                         if $run ./try 2>/dev/null; then
16480                                 echo "Yes, it can."
16481                                 val="$define"
16482                         else
16483                                 echo "It can't, sorry."
16484                         fi
16485                 else
16486                         echo "(I can't compile the test program, so we'll assume not...)"
16487                 fi
16488                 ;;
16489         esac
16490         $rm_try
16491         ;;
16492 esac
16493 set d_safebcpy
16494 eval $setvar
16495
16496 : can memcpy handle overlapping blocks?
16497 echo " "
16498 val="$undef"
16499 case "$d_memmove" in
16500 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16501 *)      case "$d_memcpy" in
16502         "$define")
16503                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16504                 $cat >try.c <<EOCP
16505 #$i_memory I_MEMORY
16506 #$i_stdlib I_STDLIB
16507 #$i_string I_STRING
16508 #$i_unistd I_UNISTD
16509 EOCP
16510         $cat >>try.c <<'EOCP'
16511 #include <stdio.h>
16512 #ifdef I_MEMORY
16513 #  include <memory.h>
16514 #endif
16515 #ifdef I_STDLIB
16516 #  include <stdlib.h>
16517 #endif
16518 #ifdef I_STRING
16519 #  include <string.h>
16520 #else
16521 #  include <strings.h>
16522 #endif
16523 #ifdef I_UNISTD
16524 #  include <unistd.h>  /* Needed for NetBSD */
16525 #endif
16526 int main()
16527 {
16528 char buf[128], abc[128];
16529 char *b;
16530 int len;
16531 int off;
16532 int align;
16533
16534 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16535    try to store the string in read-only memory. */
16536 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16537
16538 for (align = 7; align >= 0; align--) {
16539         for (len = 36; len; len--) {
16540                 b = buf+align;
16541                 memcpy(b, abc, len);
16542                 for (off = 1; off <= len; off++) {
16543                         memcpy(b+off, b, len);
16544                         memcpy(b, b+off, len);
16545                         if (memcmp(b, abc, len))
16546                                 exit(1);
16547                 }
16548         }
16549 }
16550 exit(0);
16551 }
16552 EOCP
16553                 set try
16554                 if eval $compile_ok; then
16555                         if $run ./try 2>/dev/null; then
16556                                 echo "Yes, it can."
16557                                 val="$define"
16558                         else
16559                                 echo "It can't, sorry."
16560                         fi
16561                 else
16562                         echo "(I can't compile the test program, so we'll assume not...)"
16563                 fi
16564                 ;;
16565         esac
16566         $rm_try
16567         ;;
16568 esac
16569 set d_safemcpy
16570 eval $setvar
16571
16572 : can memcmp be trusted to compare relative magnitude?
16573 val="$undef"
16574 case "$d_memcmp" in
16575 "$define")
16576         echo " "
16577         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16578         $cat >try.c <<EOCP
16579 #$i_memory I_MEMORY
16580 #$i_stdlib I_STDLIB
16581 #$i_string I_STRING
16582 #$i_unistd I_UNISTD
16583 EOCP
16584         $cat >>try.c <<'EOCP'
16585 #include <stdio.h>
16586 #ifdef I_MEMORY
16587 #  include <memory.h>
16588 #endif
16589 #ifdef I_STDLIB
16590 #  include <stdlib.h>
16591 #endif
16592 #ifdef I_STRING
16593 #  include <string.h>
16594 #else
16595 #  include <strings.h>
16596 #endif
16597 #ifdef I_UNISTD
16598 #  include <unistd.h>  /* Needed for NetBSD */
16599 #endif
16600 int main()
16601 {
16602 char a = -1;
16603 char b = 0;
16604 if ((a < b) && memcmp(&a, &b, 1) < 0)
16605         exit(1);
16606 exit(0);
16607 }
16608 EOCP
16609         set try
16610         if eval $compile_ok; then
16611                 if $run ./try 2>/dev/null; then
16612                         echo "Yes, it can."
16613                         val="$define"
16614                 else
16615                         echo "No, it can't (it uses signed chars)."
16616                 fi
16617         else
16618                 echo "(I can't compile the test program, so we'll assume not...)"
16619         fi
16620         ;;
16621 esac
16622 $rm_try
16623 set d_sanemcmp
16624 eval $setvar
16625
16626 : see if prototype for sbrk is available
16627 echo " "
16628 set d_sbrkproto sbrk $i_unistd unistd.h
16629 eval $hasproto
16630
16631 : see if select exists
16632 set select d_select
16633 eval $inlibc
16634
16635 : see if semctl exists
16636 set semctl d_semctl
16637 eval $inlibc
16638
16639 : see if semget exists
16640 set semget d_semget
16641 eval $inlibc
16642
16643 : see if semop exists
16644 set semop d_semop
16645 eval $inlibc
16646
16647 : see how much of the 'sem*(2)' library is present.
16648 h_sem=true
16649 echo " "
16650 case "$d_semctl$d_semget$d_semop" in
16651 *"$undef"*) h_sem=false;;
16652 esac
16653 case "$osname" in
16654 freebsd)
16655     case "`ipcs 2>&1`" in
16656     "SVID messages"*"not configured"*)
16657         echo "Your $osname does not have the sem*(2) configured." >&4
16658         h_sem=false
16659         val="$undef"
16660         set semctl d_semctl
16661         eval $setvar
16662         set semget d_semget
16663         eval $setvar
16664         set semop d_semop
16665         eval $setvar
16666         ;;
16667     esac
16668     ;;
16669 esac
16670 : we could also check for sys/ipc.h ...
16671 if $h_sem && $test `./findhdr sys/sem.h`; then
16672         echo "You have the full sem*(2) library." >&4
16673         val="$define"
16674 else
16675         echo "You don't have the full sem*(2) library." >&4
16676         val="$undef"
16677 fi
16678 set d_sem
16679 eval $setvar
16680
16681 : see whether sys/sem.h defines union semun
16682 echo " "
16683 $cat > try.c <<'END'
16684 #include <sys/types.h>
16685 #include <sys/ipc.h>
16686 #include <sys/sem.h>
16687 int main () { union semun semun; semun.buf = 0; }
16688 END
16689 set try
16690 if eval $compile; then
16691     echo "You have union semun in <sys/sem.h>." >&4
16692     val="$define"
16693 else
16694     echo "You do not have union semun in <sys/sem.h>." >&4
16695     val="$undef"
16696 fi
16697 $rm_try
16698 set d_union_semun
16699 eval $setvar
16700
16701 : see how to do semctl IPC_STAT
16702 case "$d_sem" in
16703 $define)
16704     echo " "
16705     $cat > tryh.h <<END
16706 #ifndef S_IRUSR
16707 #   ifdef S_IREAD
16708 #       define S_IRUSR S_IREAD
16709 #       define S_IWUSR S_IWRITE
16710 #       define S_IXUSR S_IEXEC
16711 #   else
16712 #       define S_IRUSR 0400
16713 #       define S_IWUSR 0200
16714 #       define S_IXUSR 0100
16715 #   endif
16716 #   define S_IRGRP (S_IRUSR>>3)
16717 #   define S_IWGRP (S_IWUSR>>3)
16718 #   define S_IXGRP (S_IXUSR>>3)
16719 #   define S_IROTH (S_IRUSR>>6)
16720 #   define S_IWOTH (S_IWUSR>>6)
16721 #   define S_IXOTH (S_IXUSR>>6)
16722 #endif
16723 #ifndef S_IRWXU
16724 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16725 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16726 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16727 #endif
16728 END
16729     : see whether semctl IPC_STAT can use union semun
16730     case "$d_semctl_semun" in
16731     '')
16732       val="$undef"
16733       $cat > try.c <<END
16734 #include <sys/types.h>
16735 #include <sys/ipc.h>
16736 #include <sys/sem.h>
16737 #include <sys/stat.h>
16738 #include <stdio.h>
16739 #include <errno.h>
16740 #include "tryh.h"
16741 #ifndef errno
16742 extern int errno;
16743 #endif
16744 #$d_union_semun HAS_UNION_SEMUN
16745 int main() {
16746     union semun
16747 #ifndef HAS_UNION_SEMUN
16748     {
16749         int val;
16750         struct semid_ds *buf;
16751         unsigned short *array;
16752     }
16753 #endif
16754     arg;
16755     int sem, st;
16756
16757 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16758     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16759     if (sem > -1) {
16760         struct semid_ds argbuf;
16761         arg.buf = &argbuf;
16762 #       ifdef IPC_STAT
16763         st = semctl(sem, 0, IPC_STAT, arg);
16764         if (st == 0)
16765             printf("semun\n");
16766         else
16767 #       endif /* IPC_STAT */
16768             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16769 #       ifdef IPC_RMID
16770         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16771 #       endif /* IPC_RMID */
16772             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16773     } else
16774 #endif /* IPC_PRIVATE && ... */
16775         printf("semget failed: errno = %d\n", errno);
16776   return 0;
16777 }
16778 END
16779       set try
16780       if eval $compile; then
16781           xxx=`$run ./try`
16782           case "$xxx" in
16783           semun) val="$define" ;;
16784           esac
16785       fi
16786       $rm_try
16787       set d_semctl_semun
16788       eval $setvar
16789       ;;
16790     esac
16791     case "$d_semctl_semun" in
16792     $define)
16793         echo "You can use union semun for semctl IPC_STAT." >&4
16794         also='also'
16795         ;;
16796     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16797         also=''
16798         ;;
16799     esac
16800
16801     : see whether semctl IPC_STAT can use struct semid_ds pointer
16802     case "$d_semctl_semid_ds" in
16803     '')
16804       val="$undef"
16805       $cat > try.c <<'END'
16806 #include <sys/types.h>
16807 #include <sys/ipc.h>
16808 #include <sys/sem.h>
16809 #include <sys/stat.h>
16810 #include "tryh.h"
16811 #include <stdio.h>
16812 #include <errno.h>
16813 #ifndef errno
16814 extern int errno;
16815 #endif
16816 int main() {
16817     struct semid_ds arg;
16818     int sem, st;
16819
16820 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16821     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16822     if (sem > -1) {
16823 #       ifdef IPC_STAT
16824         st = semctl(sem, 0, IPC_STAT, &arg);
16825         if (st == 0)
16826             printf("semid_ds\n");
16827         else
16828 #       endif /* IPC_STAT */
16829             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16830 #       ifdef IPC_RMID
16831         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16832 #       endif /* IPC_RMID */
16833             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16834     } else
16835 #endif /* IPC_PRIVATE && ... */
16836         printf("semget failed: errno = %d\n", errno);
16837
16838     return 0;
16839 }
16840 END
16841       set try
16842       if eval $compile; then
16843           xxx=`$run ./try`
16844           case "$xxx" in
16845           semid_ds) val="$define" ;;
16846           esac
16847       fi
16848       $rm_try
16849       set d_semctl_semid_ds
16850       eval $setvar
16851       ;;
16852     esac
16853     case "$d_semctl_semid_ds" in
16854     $define)
16855         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16856         ;;
16857     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16858         ;;
16859     esac
16860     ;;
16861 *)  val="$undef"
16862
16863     # We do not have the full sem*(2) library, so assume we can not
16864     # use either.
16865
16866     set d_semctl_semun
16867     eval $setvar
16868
16869     set d_semctl_semid_ds
16870     eval $setvar
16871     ;;
16872 esac
16873 $rm_try tryh.h
16874
16875 : see if sendmsg exists
16876 set sendmsg d_sendmsg
16877 eval $inlibc
16878
16879 : see if setegid exists
16880 set setegid d_setegid
16881 eval $inlibc
16882
16883 : see if seteuid exists
16884 set seteuid d_seteuid
16885 eval $inlibc
16886
16887 : see if setgrent exists
16888 set setgrent d_setgrent
16889 eval $inlibc
16890
16891 : see if setgrent_r exists
16892 set setgrent_r d_setgrent_r
16893 eval $inlibc
16894 case "$d_setgrent_r" in
16895 "$define")
16896         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16897         case "$d_setgrent_r_proto:$usethreads" in
16898         ":define")      d_setgrent_r_proto=define
16899                 set d_setgrent_r_proto setgrent_r $hdrs
16900                 eval $hasproto ;;
16901         *)      ;;
16902         esac
16903         case "$d_setgrent_r_proto" in
16904         define)
16905         case "$setgrent_r_proto" in
16906         ''|0) try='int setgrent_r(FILE**);'
16907         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16908         esac
16909         case "$setgrent_r_proto" in
16910         ''|0) try='void setgrent_r(FILE**);'
16911         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16912         esac
16913         case "$setgrent_r_proto" in
16914         ''|0)   d_setgrent_r=undef
16915                 setgrent_r_proto=0
16916                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16917         * )     case "$setgrent_r_proto" in
16918                 REENTRANT_PROTO*) ;;
16919                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16920                 esac
16921                 echo "Prototype: $try" ;;
16922         esac
16923         ;;
16924         *)      case "$usethreads" in
16925                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16926                 esac
16927                 d_setgrent_r=undef
16928                 setgrent_r_proto=0
16929                 ;;
16930         esac
16931         ;;
16932 *)      setgrent_r_proto=0
16933         ;;
16934 esac
16935
16936 : see if sethostent exists
16937 set sethostent d_sethent
16938 eval $inlibc
16939
16940 : see if sethostent_r exists
16941 set sethostent_r d_sethostent_r
16942 eval $inlibc
16943 case "$d_sethostent_r" in
16944 "$define")
16945         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16946         case "$d_sethostent_r_proto:$usethreads" in
16947         ":define")      d_sethostent_r_proto=define
16948                 set d_sethostent_r_proto sethostent_r $hdrs
16949                 eval $hasproto ;;
16950         *)      ;;
16951         esac
16952         case "$d_sethostent_r_proto" in
16953         define)
16954         case "$sethostent_r_proto" in
16955         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16956         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16957         esac
16958         case "$sethostent_r_proto" in
16959         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16960         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16961         esac
16962         case "$sethostent_r_proto" in
16963         ''|0)   d_sethostent_r=undef
16964                 sethostent_r_proto=0
16965                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16966         * )     case "$sethostent_r_proto" in
16967                 REENTRANT_PROTO*) ;;
16968                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16969                 esac
16970                 echo "Prototype: $try" ;;
16971         esac
16972         ;;
16973         *)      case "$usethreads" in
16974                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16975                 esac
16976                 d_sethostent_r=undef
16977                 sethostent_r_proto=0
16978                 ;;
16979         esac
16980         ;;
16981 *)      sethostent_r_proto=0
16982         ;;
16983 esac
16984
16985 : see if setitimer exists
16986 set setitimer d_setitimer
16987 eval $inlibc
16988
16989 : see if setlinebuf exists
16990 set setlinebuf d_setlinebuf
16991 eval $inlibc
16992
16993 : see if setlocale exists
16994 set setlocale d_setlocale
16995 eval $inlibc
16996
16997 : see if locale.h is available
16998 set locale.h i_locale
16999 eval $inhdr
17000
17001 : see if setlocale_r exists
17002 set setlocale_r d_setlocale_r
17003 eval $inlibc
17004 case "$d_setlocale_r" in
17005 "$define")
17006         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17007         case "$d_setlocale_r_proto:$usethreads" in
17008         ":define")      d_setlocale_r_proto=define
17009                 set d_setlocale_r_proto setlocale_r $hdrs
17010                 eval $hasproto ;;
17011         *)      ;;
17012         esac
17013         case "$d_setlocale_r_proto" in
17014         define)
17015         case "$setlocale_r_proto" in
17016         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17017         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17018         esac
17019         case "$setlocale_r_proto" in
17020         ''|0)   d_setlocale_r=undef
17021                 setlocale_r_proto=0
17022                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17023         * )     case "$setlocale_r_proto" in
17024                 REENTRANT_PROTO*) ;;
17025                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17026                 esac
17027                 echo "Prototype: $try" ;;
17028         esac
17029         ;;
17030         *)      case "$usethreads" in
17031                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17032                 esac
17033                 d_setlocale_r=undef
17034                 setlocale_r_proto=0
17035                 ;;
17036         esac
17037         ;;
17038 *)      setlocale_r_proto=0
17039         ;;
17040 esac
17041
17042 : see if setnetent exists
17043 set setnetent d_setnent
17044 eval $inlibc
17045
17046 : see if setnetent_r exists
17047 set setnetent_r d_setnetent_r
17048 eval $inlibc
17049 case "$d_setnetent_r" in
17050 "$define")
17051         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17052         case "$d_setnetent_r_proto:$usethreads" in
17053         ":define")      d_setnetent_r_proto=define
17054                 set d_setnetent_r_proto setnetent_r $hdrs
17055                 eval $hasproto ;;
17056         *)      ;;
17057         esac
17058         case "$d_setnetent_r_proto" in
17059         define)
17060         case "$setnetent_r_proto" in
17061         ''|0) try='int setnetent_r(int, struct netent_data*);'
17062         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17063         esac
17064         case "$setnetent_r_proto" in
17065         ''|0) try='void setnetent_r(int, struct netent_data*);'
17066         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17067         esac
17068         case "$setnetent_r_proto" in
17069         ''|0)   d_setnetent_r=undef
17070                 setnetent_r_proto=0
17071                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17072         * )     case "$setnetent_r_proto" in
17073                 REENTRANT_PROTO*) ;;
17074                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17075                 esac
17076                 echo "Prototype: $try" ;;
17077         esac
17078         ;;
17079         *)      case "$usethreads" in
17080                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17081                 esac
17082                 d_setnetent_r=undef
17083                 setnetent_r_proto=0
17084                 ;;
17085         esac
17086         ;;
17087 *)      setnetent_r_proto=0
17088         ;;
17089 esac
17090
17091 : see if setprotoent exists
17092 set setprotoent d_setpent
17093 eval $inlibc
17094
17095 : see if setpgid exists
17096 set setpgid d_setpgid
17097 eval $inlibc
17098
17099 : see if setpgrp2 exists
17100 set setpgrp2 d_setpgrp2
17101 eval $inlibc
17102
17103 : see if setpriority exists
17104 set setpriority d_setprior
17105 eval $inlibc
17106
17107 : see if setproctitle exists
17108 set setproctitle d_setproctitle
17109 eval $inlibc
17110
17111 : see if setprotoent_r exists
17112 set setprotoent_r d_setprotoent_r
17113 eval $inlibc
17114 case "$d_setprotoent_r" in
17115 "$define")
17116         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17117         case "$d_setprotoent_r_proto:$usethreads" in
17118         ":define")      d_setprotoent_r_proto=define
17119                 set d_setprotoent_r_proto setprotoent_r $hdrs
17120                 eval $hasproto ;;
17121         *)      ;;
17122         esac
17123         case "$d_setprotoent_r_proto" in
17124         define)
17125         case "$setprotoent_r_proto" in
17126         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17127         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17128         esac
17129         case "$setprotoent_r_proto" in
17130         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17131         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17132         esac
17133         case "$setprotoent_r_proto" in
17134         ''|0)   d_setprotoent_r=undef
17135                 setprotoent_r_proto=0
17136                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17137         * )     case "$setprotoent_r_proto" in
17138                 REENTRANT_PROTO*) ;;
17139                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17140                 esac
17141                 echo "Prototype: $try" ;;
17142         esac
17143         ;;
17144         *)      case "$usethreads" in
17145                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17146                 esac
17147                 d_setprotoent_r=undef
17148                 setprotoent_r_proto=0
17149                 ;;
17150         esac
17151         ;;
17152 *)      setprotoent_r_proto=0
17153         ;;
17154 esac
17155
17156 : see if setpwent exists
17157 set setpwent d_setpwent
17158 eval $inlibc
17159
17160 : see if setpwent_r exists
17161 set setpwent_r d_setpwent_r
17162 eval $inlibc
17163 case "$d_setpwent_r" in
17164 "$define")
17165         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17166         case "$d_setpwent_r_proto:$usethreads" in
17167         ":define")      d_setpwent_r_proto=define
17168                 set d_setpwent_r_proto setpwent_r $hdrs
17169                 eval $hasproto ;;
17170         *)      ;;
17171         esac
17172         case "$d_setpwent_r_proto" in
17173         define)
17174         case "$setpwent_r_proto" in
17175         ''|0) try='int setpwent_r(FILE**);'
17176         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17177         esac
17178         case "$setpwent_r_proto" in
17179         ''|0) try='void setpwent_r(FILE**);'
17180         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17181         esac
17182         case "$setpwent_r_proto" in
17183         ''|0)   d_setpwent_r=undef
17184                 setpwent_r_proto=0
17185                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17186         * )     case "$setpwent_r_proto" in
17187                 REENTRANT_PROTO*) ;;
17188                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17189                 esac
17190                 echo "Prototype: $try" ;;
17191         esac
17192         ;;
17193         *)      case "$usethreads" in
17194                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17195                 esac
17196                 d_setpwent_r=undef
17197                 setpwent_r_proto=0
17198                 ;;
17199         esac
17200         ;;
17201 *)      setpwent_r_proto=0
17202         ;;
17203 esac
17204
17205 : see if setregid exists
17206 set setregid d_setregid
17207 eval $inlibc
17208 set setresgid d_setresgid
17209 eval $inlibc
17210
17211 : see if setreuid exists
17212 set setreuid d_setreuid
17213 eval $inlibc
17214 set setresuid d_setresuid
17215 eval $inlibc
17216
17217 : see if setrgid exists
17218 set setrgid d_setrgid
17219 eval $inlibc
17220
17221 : see if setruid exists
17222 set setruid d_setruid
17223 eval $inlibc
17224
17225 : see if setservent exists
17226 set setservent d_setsent
17227 eval $inlibc
17228
17229 : see if setservent_r exists
17230 set setservent_r d_setservent_r
17231 eval $inlibc
17232 case "$d_setservent_r" in
17233 "$define")
17234         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17235         case "$d_setservent_r_proto:$usethreads" in
17236         ":define")      d_setservent_r_proto=define
17237                 set d_setservent_r_proto setservent_r $hdrs
17238                 eval $hasproto ;;
17239         *)      ;;
17240         esac
17241         case "$d_setservent_r_proto" in
17242         define)
17243         case "$setservent_r_proto" in
17244         ''|0) try='int setservent_r(int, struct servent_data*);'
17245         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17246         esac
17247         case "$setservent_r_proto" in
17248         ''|0) try='void setservent_r(int, struct servent_data*);'
17249         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17250         esac
17251         case "$setservent_r_proto" in
17252         ''|0)   d_setservent_r=undef
17253                 setservent_r_proto=0
17254                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17255         * )     case "$setservent_r_proto" in
17256                 REENTRANT_PROTO*) ;;
17257                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17258                 esac
17259                 echo "Prototype: $try" ;;
17260         esac
17261         ;;
17262         *)      case "$usethreads" in
17263                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17264                 esac
17265                 d_setservent_r=undef
17266                 setservent_r_proto=0
17267                 ;;
17268         esac
17269         ;;
17270 *)      setservent_r_proto=0
17271         ;;
17272 esac
17273
17274 : see if setsid exists
17275 set setsid d_setsid
17276 eval $inlibc
17277
17278 : see if setvbuf exists
17279 set setvbuf d_setvbuf
17280 eval $inlibc
17281
17282 : see if sfio.h is available
17283 set sfio.h i_sfio
17284 eval $inhdr
17285
17286 : see if sfio library is available
17287 case "$i_sfio" in
17288 $define)
17289         val=''
17290         set sfreserve val
17291         eval $inlibc
17292         ;;
17293 *)
17294         val="$undef"
17295         ;;
17296 esac
17297 : Ok, but do we want to use it.
17298 case "$val" in
17299 $define)
17300         case "$usesfio" in
17301         true|$define|[yY]*) dflt='y';;
17302         *) dflt='n';;
17303         esac
17304         echo "$package can use the sfio library, but it is experimental."
17305         case "$useperlio" in
17306         "$undef")
17307             echo "For sfio also the PerlIO abstraction layer is needed."
17308             echo "Earlier you said you wouldn't want that."
17309             ;;
17310         esac
17311         rp="You seem to have sfio available, do you want to try using it?"
17312         . ./myread
17313         case "$ans" in
17314         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17315                 useperlio="$define"
17316                 val="$define"
17317                 ;;
17318         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17319                 val="$undef"
17320                 ;;
17321         esac
17322         ;;
17323 *)      case "$usesfio" in
17324         true|$define|[yY]*)
17325                 echo "Sorry, cannot find sfio on this machine." >&4
17326                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17327                 val="$undef"
17328                 ;;
17329         esac
17330         ;;
17331 esac
17332 set d_sfio
17333 eval $setvar
17334 case "$d_sfio" in
17335 $define) usesfio='true';;
17336 *) usesfio='false';;
17337 esac
17338 case "$d_sfio" in
17339 $define) ;;
17340 *)      : Remove sfio from list of libraries to use
17341         case "$libs" in
17342         *-lsfio*)
17343                 echo "Removing unneeded -lsfio from library list" >&4
17344                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17345                 shift
17346                 libs="$*"
17347                 echo "libs = $libs" >&4
17348                 ;;
17349         esac
17350 ;;
17351 esac
17352
17353
17354 : see if shmctl exists
17355 set shmctl d_shmctl
17356 eval $inlibc
17357
17358 : see if shmget exists
17359 set shmget d_shmget
17360 eval $inlibc
17361
17362 : see if shmat exists
17363 set shmat d_shmat
17364 eval $inlibc
17365 : see what shmat returns
17366 case "$d_shmat" in
17367 "$define")
17368         $cat >shmat.c <<'END'
17369 #include <sys/shm.h>
17370 void *shmat();
17371 END
17372         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17373                 shmattype='void *'
17374         else
17375                 shmattype='char *'
17376         fi
17377         echo "and it returns ($shmattype)." >&4
17378         : see if a prototype for shmat is available
17379         xxx=`./findhdr sys/shm.h`
17380         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17381         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17382                 val="$define"
17383         else
17384                 val="$undef"
17385         fi
17386         $rm -f shmat.[co]
17387         ;;
17388 *)
17389         val="$undef"
17390         ;;
17391 esac
17392 set d_shmatprototype
17393 eval $setvar
17394
17395 : see if shmdt exists
17396 set shmdt d_shmdt
17397 eval $inlibc
17398
17399 : see how much of the 'shm*(2)' library is present.
17400 h_shm=true
17401 echo " "
17402 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17403 *"$undef"*) h_shm=false;;
17404 esac
17405 case "$osname" in
17406 freebsd)
17407     case "`ipcs 2>&1`" in
17408     "SVID shared memory"*"not configured"*)
17409         echo "Your $osname does not have the shm*(2) configured." >&4
17410         h_shm=false
17411         val="$undef"
17412         set shmctl d_shmctl
17413         evat $setvar
17414         set shmget d_shmget
17415         evat $setvar
17416         set shmat d_shmat
17417         evat $setvar
17418         set shmdt d_shmdt
17419         evat $setvar
17420         ;;
17421     esac
17422     ;;
17423 esac
17424 : we could also check for sys/ipc.h ...
17425 if $h_shm && $test `./findhdr sys/shm.h`; then
17426         echo "You have the full shm*(2) library." >&4
17427         val="$define"
17428 else
17429         echo "You don't have the full shm*(2) library." >&4
17430         val="$undef"
17431 fi
17432 set d_shm
17433 eval $setvar
17434
17435 : see if we have sigaction
17436 echo " "
17437 if set sigaction val -f d_sigaction; eval $csym; $val; then
17438         echo 'sigaction() found.' >&4
17439         $cat > try.c <<EOP
17440 #include <stdio.h>
17441 #include <sys/types.h>
17442 #include <signal.h>
17443 #$i_stdlib I_STDLIB
17444 #ifdef I_STDLIB
17445 #include <stdlib.h>
17446 #endif
17447 int main()
17448 {
17449     struct sigaction act, oact;
17450     act.sa_flags = 0;
17451     oact.sa_handler = 0;
17452     /* so that act and oact are used */
17453     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17454 }
17455 EOP
17456         set try
17457         if eval $compile_ok; then
17458                 val="$define"
17459         else
17460                 echo "But you don't seem to have a useable struct sigaction." >&4
17461                 val="$undef"
17462         fi
17463 else
17464         echo 'sigaction NOT found.' >&4
17465         val="$undef"
17466 fi
17467 set d_sigaction; eval $setvar
17468 $rm_try
17469
17470 : see if this is a sunmath.h system
17471 set sunmath.h i_sunmath
17472 eval $inhdr
17473
17474 : see if signbit exists
17475 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17476 $cat >try.c <<EOCP
17477 #$i_math I_MATH
17478 #$i_sunmath I_SUNMATH
17479 #ifdef I_MATH
17480 #  include <math.h>
17481 #endif
17482 #ifdef I_SUNMATH  /* Solaris special math library */
17483 #  include <sunmath.h>
17484 #endif
17485 #define NV $nvtype
17486 int main(int argc, char **argv)
17487 {
17488     NV x = 0.0;
17489     NV y = -0.0;
17490     if ((signbit(x) == 0) && (signbit(y) != 0))
17491         return 0;
17492     else
17493         return 1;
17494 }
17495 EOCP
17496 val="$undef"
17497 set try
17498 if eval $compile; then
17499     if $run ./try; then
17500         $echo "Yes." >&4
17501         val="$define"
17502     else
17503         $echo "Signbit seems to be available, but doesn't work as I expected."
17504         $echo "I won't use it." >&4
17505         val="$undef"
17506     fi
17507 else
17508     $echo "Nope." >&4
17509     dflt="$undef"
17510 fi
17511 set d_signbit
17512 eval $setvar
17513 $rm_try
17514
17515 : see if sigprocmask exists
17516 set sigprocmask d_sigprocmask
17517 eval $inlibc
17518
17519 : see if sigsetjmp exists
17520 echo " "
17521 case "$d_sigsetjmp" in
17522 '')
17523         $cat >try.c <<EOP
17524 #include <setjmp.h>
17525 #$i_stdlib I_STDLIB
17526 #ifdef I_STDLIB
17527 #include <stdlib.h>
17528 #endif
17529 sigjmp_buf env;
17530 int set = 1;
17531 int main()
17532 {
17533         if (sigsetjmp(env,1))
17534                 exit(set);
17535         set = 0;
17536         siglongjmp(env, 1);
17537         exit(1);
17538 }
17539 EOP
17540         set try
17541         if eval $compile; then
17542                 if $run ./try >/dev/null 2>&1; then
17543                         echo "POSIX sigsetjmp found." >&4
17544                         val="$define"
17545                 else
17546                         $cat >&4 <<EOM
17547 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17548 I'll ignore them.
17549 EOM
17550                         val="$undef"
17551                 fi
17552         else
17553                 echo "sigsetjmp not found." >&4
17554                 val="$undef"
17555         fi
17556         ;;
17557 *) val="$d_sigsetjmp"
17558         case "$d_sigsetjmp" in
17559         $define) echo "POSIX sigsetjmp found." >&4;;
17560         $undef) echo "sigsetjmp not found." >&4;;
17561         esac
17562         ;;
17563 esac
17564 set d_sigsetjmp
17565 eval $setvar
17566 $rm_try
17567
17568 : see if snprintf exists
17569 set snprintf d_snprintf
17570 eval $inlibc
17571
17572 : see if vsnprintf exists
17573 set vsnprintf d_vsnprintf
17574 eval $inlibc
17575
17576 case "$d_snprintf-$d_vsnprintf" in
17577 "$define-$define")
17578     $cat <<EOM
17579 Checking whether your snprintf() and vsnprintf() work okay...
17580 EOM
17581     $cat >try.c <<'EOCP'
17582 /* v?snprintf testing logic courtesy of Russ Allbery.
17583  * According to C99:
17584  * - if the buffer is too short it still must be \0-terminated
17585  * - if the buffer is too short the potentially required length
17586  *   must be returned and not -1
17587  * - if the buffer is NULL the potentially required length
17588  *   must be returned and not -1 or core dump
17589  */
17590 #include <stdio.h>
17591 #include <stdarg.h>
17592
17593 char buf[2];
17594
17595 int test (char *format, ...)
17596 {
17597     va_list args;
17598     int count;
17599
17600     va_start (args, format);
17601     count = vsnprintf (buf, sizeof buf, format, args);
17602     va_end (args);
17603     return count;
17604 }
17605
17606 int main ()
17607 {
17608     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17609              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17610 }
17611 EOCP
17612     set try
17613     if eval $compile; then
17614         `$run ./try`
17615         case "$?" in
17616         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17617         *) cat <<EOM >&4
17618 Your snprintf() and snprintf() don't seem to be working okay.
17619 EOM
17620            d_snprintf="$undef"
17621            d_vsnprintf="$undef"
17622            ;;
17623         esac
17624     else
17625         echo "(I can't seem to compile the test program--assuming they don't)"
17626         d_snprintf="$undef"
17627         d_vsnprintf="$undef"
17628     fi
17629     $rm_try
17630     ;;
17631 esac
17632
17633 : see if sockatmark exists
17634 set sockatmark d_sockatmark
17635 eval $inlibc
17636
17637 : see if prototype for sockatmark is available
17638 echo " "
17639 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17640 eval $hasproto
17641
17642 : see if socks5_init exists
17643 set socks5_init d_socks5_init
17644 eval $inlibc
17645
17646 : see if sprintf returns the length of the string in the buffer as per ANSI
17647 $echo "Checking whether sprintf returns the length of the string..." >&4
17648 $cat <<EOP >try.c
17649 #include <stdio.h>
17650 #$i_stdlib I_STDLIB
17651 #ifdef I_STDLIB
17652 #include <stdlib.h>
17653 #endif
17654 #$i_string I_STRING
17655 #ifdef I_STRING
17656 #  include <string.h>
17657 #else
17658 #  include <strings.h>
17659 #endif
17660 #$i_math I_MATH
17661 #ifdef I_MATH
17662 #include <math.h>
17663 #endif
17664
17665 char buffer[256];
17666
17667 int check (size_t expect, int test) {
17668   size_t got = strlen(buffer);
17669   if (expect == got)
17670     return 0;
17671
17672   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17673        test, buffer);
17674   exit (test);
17675 }
17676
17677 int main(int argc, char **argv) {
17678   int test = 0;
17679
17680   check(sprintf(buffer, ""), ++test);
17681   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17682   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17683
17684   return 0;
17685 }
17686 EOP
17687 set try
17688
17689 if eval $compile; then
17690     xxx="`$run ./try`"
17691     case "$?" in
17692         0) cat >&4 <<EOM
17693 sprintf returns the length of the string (as ANSI says it should)
17694 EOM
17695         d_sprintf_returns_strlen="$define"
17696         ;;
17697         *) cat >&4 <<EOM
17698 sprintf does not return the length of the string (how old is this system?)
17699 EOM
17700         d_sprintf_returns_strlen="$undef"
17701         ;;
17702     esac
17703 else
17704     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17705     d_sprintf_returns_strlen="$undef"
17706 fi
17707 $rm_try
17708
17709 : see if srand48_r exists
17710 set srand48_r d_srand48_r
17711 eval $inlibc
17712 case "$d_srand48_r" in
17713 "$define")
17714         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17715         case "$d_srand48_r_proto:$usethreads" in
17716         ":define")      d_srand48_r_proto=define
17717                 set d_srand48_r_proto srand48_r $hdrs
17718                 eval $hasproto ;;
17719         *)      ;;
17720         esac
17721         case "$d_srand48_r_proto" in
17722         define)
17723         case "$srand48_r_proto" in
17724         ''|0) try='int srand48_r(long, struct drand48_data*);'
17725         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17726         esac
17727         case "$srand48_r_proto" in
17728         ''|0)   d_srand48_r=undef
17729                 srand48_r_proto=0
17730                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17731         * )     case "$srand48_r_proto" in
17732                 REENTRANT_PROTO*) ;;
17733                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17734                 esac
17735                 echo "Prototype: $try" ;;
17736         esac
17737         ;;
17738         *)      case "$usethreads" in
17739                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17740                 esac
17741                 d_srand48_r=undef
17742                 srand48_r_proto=0
17743                 ;;
17744         esac
17745         ;;
17746 *)      srand48_r_proto=0
17747         ;;
17748 esac
17749
17750 : see if srandom_r exists
17751 set srandom_r d_srandom_r
17752 eval $inlibc
17753 case "$d_srandom_r" in
17754 "$define")
17755         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17756         case "$d_srandom_r_proto:$usethreads" in
17757         ":define")      d_srandom_r_proto=define
17758                 set d_srandom_r_proto srandom_r $hdrs
17759                 eval $hasproto ;;
17760         *)      ;;
17761         esac
17762         case "$d_srandom_r_proto" in
17763         define)
17764         case "$srandom_r_proto" in
17765         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17766         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17767         esac
17768         case "$srandom_r_proto" in
17769         ''|0)   d_srandom_r=undef
17770                 srandom_r_proto=0
17771                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17772         * )     case "$srandom_r_proto" in
17773                 REENTRANT_PROTO*) ;;
17774                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17775                 esac
17776                 echo "Prototype: $try" ;;
17777         esac
17778         ;;
17779         *)      case "$usethreads" in
17780                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17781                 esac
17782                 d_srandom_r=undef
17783                 srandom_r_proto=0
17784                 ;;
17785         esac
17786         ;;
17787 *)      srandom_r_proto=0
17788         ;;
17789 esac
17790
17791 : see if prototype for setresgid is available
17792 echo " "
17793 set d_sresgproto setresgid $i_unistd unistd.h
17794 eval $hasproto
17795
17796 : see if prototype for setresuid is available
17797 echo " "
17798 set d_sresuproto setresuid $i_unistd unistd.h
17799 eval $hasproto
17800
17801 : see if sys/stat.h is available
17802 set sys/stat.h i_sysstat
17803 eval $inhdr
17804
17805 : see if stat knows about block sizes
17806 echo " "
17807 echo "Checking to see if your struct stat has st_blocks field..." >&4
17808 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17809 eval $hasfield
17810
17811 : see if this is a sys/vfs.h system
17812 set sys/vfs.h i_sysvfs
17813 eval $inhdr
17814
17815 : see if this is a sys/statfs.h system
17816 set sys/statfs.h i_sysstatfs
17817 eval $inhdr
17818
17819 : Check for statfs_s
17820 echo " "
17821 echo "Checking to see if your system supports struct statfs..." >&4
17822 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
17823 eval $hasstruct
17824 case "$d_statfs_s" in
17825 "$define")      echo "Yes, it does."   ;;
17826 *)              echo "No, it doesn't." ;;
17827 esac
17828
17829
17830 : see if struct statfs knows about f_flags
17831 case "$d_statfs_s" in
17832 define)
17833         echo " "
17834         echo "Checking to see if your struct statfs has f_flags field..." >&4
17835         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
17836         eval $hasfield
17837         ;;
17838 *)      val="$undef"
17839         set d_statfs_f_flags
17840         eval $setvar
17841         ;;
17842 esac
17843 case "$d_statfs_f_flags" in
17844 "$define")      echo "Yes, it does."   ;;
17845 *)              echo "No, it doesn't." ;;
17846 esac
17847
17848 : Check stream access
17849 $cat >&4 <<EOM
17850 Checking how to access stdio streams by file descriptor number...
17851 EOM
17852 case "$stdio_stream_array" in
17853 '')     $cat >try.c <<EOCP
17854 #include <stdio.h>
17855 int main() {
17856   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17857     printf("yes\n");
17858 }
17859 EOCP
17860         for s in _iob __iob __sF
17861         do
17862                 set try -DSTDIO_STREAM_ARRAY=$s
17863                 if eval $compile; then
17864                         case "`$run ./try`" in
17865                         yes)    stdio_stream_array=$s; break ;;
17866                         esac
17867                 fi
17868         done
17869         $rm_try
17870 esac
17871 case "$stdio_stream_array" in
17872 '')     $cat >&4 <<EOM
17873 I can't figure out how to access stdio streams by file descriptor number.
17874 EOM
17875         d_stdio_stream_array="$undef"
17876         ;;
17877 *)      $cat >&4 <<EOM
17878 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17879 EOM
17880         d_stdio_stream_array="$define"
17881         ;;
17882 esac
17883
17884 : see if strcoll exists
17885 set strcoll d_strcoll
17886 eval $inlibc
17887
17888 : check for structure copying
17889 echo " "
17890 echo "Checking to see if your C compiler can copy structs..." >&4
17891 $cat >try.c <<'EOCP'
17892 int main()
17893 {
17894         struct blurfl {
17895                 int dyick;
17896         } foo, bar;
17897
17898         foo = bar;
17899 }
17900 EOCP
17901 if $cc -c try.c >/dev/null 2>&1 ; then
17902         val="$define"
17903         echo "Yup, it can."
17904 else
17905         val="$undef"
17906         echo "Nope, it can't."
17907 fi
17908 set d_strctcpy
17909 eval $setvar
17910 $rm_try
17911
17912 : see if strerror and/or sys_errlist[] exist
17913 echo " "
17914 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17915     if set strerror val -f d_strerror; eval $csym; $val; then
17916                 echo 'strerror() found.' >&4
17917                 d_strerror="$define"
17918                 d_strerrm='strerror(e)'
17919                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17920                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17921                         d_syserrlst="$define"
17922                 else
17923                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17924                         d_syserrlst="$undef"
17925                 fi
17926     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17927                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17928                 echo 'strerror() found in string header.' >&4
17929                 d_strerror="$define"
17930                 d_strerrm='strerror(e)'
17931                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17932                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17933                                 d_syserrlst="$define"
17934                 else
17935                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17936                         d_syserrlst="$undef"
17937                 fi
17938     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17939                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17940                 d_strerror="$undef"
17941                 d_syserrlst="$define"
17942                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17943     else
17944                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17945                 d_strerror="$undef"
17946                 d_syserrlst="$undef"
17947                 d_strerrm='"unknown"'
17948     fi
17949 fi
17950
17951 : see if strerror_r exists
17952 set strerror_r d_strerror_r
17953 eval $inlibc
17954 case "$d_strerror_r" in
17955 "$define")
17956         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17957         case "$d_strerror_r_proto:$usethreads" in
17958         ":define")      d_strerror_r_proto=define
17959                 set d_strerror_r_proto strerror_r $hdrs
17960                 eval $hasproto ;;
17961         *)      ;;
17962         esac
17963         case "$d_strerror_r_proto" in
17964         define)
17965         case "$strerror_r_proto" in
17966         ''|0) try='int strerror_r(int, char*, size_t);'
17967         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17968         esac
17969         case "$strerror_r_proto" in
17970         ''|0) try='int strerror_r(int, char*, int);'
17971         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17972         esac
17973         case "$strerror_r_proto" in
17974         ''|0) try='char* strerror_r(int, char*, size_t);'
17975         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17976         esac
17977         case "$strerror_r_proto" in
17978         ''|0)   d_strerror_r=undef
17979                 strerror_r_proto=0
17980                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17981         * )     case "$strerror_r_proto" in
17982                 REENTRANT_PROTO*) ;;
17983                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17984                 esac
17985                 echo "Prototype: $try" ;;
17986         esac
17987         ;;
17988         *)      case "$usethreads" in
17989                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17990                 esac
17991                 d_strerror_r=undef
17992                 strerror_r_proto=0
17993                 ;;
17994         esac
17995         ;;
17996 *)      strerror_r_proto=0
17997         ;;
17998 esac
17999
18000 : see if strftime exists
18001 set strftime d_strftime
18002 eval $inlibc
18003
18004 : see if strlcat exists
18005 set strlcat d_strlcat
18006 eval $inlibc
18007
18008 : see if strlcpy exists
18009 set strlcpy d_strlcpy
18010 eval $inlibc
18011
18012 : see if strtod exists
18013 set strtod d_strtod
18014 eval $inlibc
18015
18016 : see if strtol exists
18017 set strtol d_strtol
18018 eval $inlibc
18019
18020 : see if strtold exists
18021 set strtold d_strtold
18022 eval $inlibc
18023
18024 : see if strtoll exists
18025 set strtoll d_strtoll
18026 eval $inlibc
18027
18028 case "$d_longlong-$d_strtoll" in
18029 "$define-$define")
18030         $cat <<EOM
18031 Checking whether your strtoll() works okay...
18032 EOM
18033         $cat >try.c <<'EOCP'
18034 #include <errno.h>
18035 #ifdef __hpux
18036 #define strtoll __strtoll
18037 #endif
18038 #ifdef __EMX__
18039 #define strtoll _strtoll
18040 #endif
18041 #include <stdio.h>
18042 extern long long int strtoll(char *s, char **, int);
18043 static int bad = 0;
18044 int check(char *s, long long ell, int een) {
18045         long long gll;
18046         errno = 0;
18047         gll = strtoll(s, 0, 10);
18048         if (!((gll == ell) && (errno == een)))
18049                 bad++;
18050 }
18051 int main() {
18052         check(" 1",                                      1LL, 0);
18053         check(" 0",                                      0LL, 0);
18054         check("-1",                                     -1LL, 0);
18055         check("-9223372036854775808", -9223372036854775808LL, 0);
18056         check("-9223372036854775808", -9223372036854775808LL, 0);
18057         check(" 9223372036854775807",  9223372036854775807LL, 0);
18058         check("-9223372036854775808", -9223372036854775808LL, 0);
18059         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18060         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18061         if (!bad)
18062                 printf("ok\n");
18063 }
18064 EOCP
18065         set try
18066         if eval $compile; then
18067                 yyy=`$run ./try`
18068                 case "$yyy" in
18069                 ok) echo "Your strtoll() seems to be working okay." ;;
18070                 *) cat <<EOM >&4
18071 Your strtoll() doesn't seem to be working okay.
18072 EOM
18073                    d_strtoll="$undef"
18074                    ;;
18075                 esac
18076         else
18077                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18078                 d_strtoll="$undef"
18079         fi
18080         ;;
18081 esac
18082
18083 : see if strtoq exists
18084 set strtoq d_strtoq
18085 eval $inlibc
18086
18087 : see if strtoul exists
18088 set strtoul d_strtoul
18089 eval $inlibc
18090
18091 case "$d_strtoul" in
18092 "$define")
18093         $cat <<EOM
18094 Checking whether your strtoul() works okay...
18095 EOM
18096         $cat >try.c <<'EOCP'
18097 #include <errno.h>
18098 #include <stdio.h>
18099 extern unsigned long int strtoul(char *s, char **, int);
18100 static int bad = 0;
18101 void check(char *s, unsigned long eul, int een) {
18102         unsigned long gul;
18103         errno = 0;
18104         gul = strtoul(s, 0, 10);
18105         if (!((gul == eul) && (errno == een)))
18106                 bad++;
18107 }
18108 int main() {
18109         check(" 1", 1L, 0);
18110         check(" 0", 0L, 0);
18111 EOCP
18112         case "$longsize" in
18113         8)
18114             $cat >>try.c <<'EOCP'
18115         check("18446744073709551615", 18446744073709551615UL, 0);
18116         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18117 #if 0 /* strtoul() for /^-/ strings is undefined. */
18118         check("-1", 18446744073709551615UL, 0);
18119         check("-18446744073709551614", 2, 0);
18120         check("-18446744073709551615", 1, 0);
18121         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18122         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18123 #endif
18124 EOCP
18125                 ;;
18126         4)
18127                     $cat >>try.c <<'EOCP'
18128         check("4294967295", 4294967295UL, 0);
18129         check("4294967296", 4294967295UL, ERANGE);
18130 #if 0 /* strtoul() for /^-/ strings is undefined. */
18131         check("-1", 4294967295UL, 0);
18132         check("-4294967294", 2, 0);
18133         check("-4294967295", 1, 0);
18134         check("-4294967296", 4294967295UL, ERANGE);
18135         check("-4294967297", 4294967295UL, ERANGE);
18136 #endif
18137 EOCP
18138                 ;;
18139         *)
18140 : Should we write these tests to be more portable by sprintf-ing
18141 : ~0 and then manipulating that char string as input for strtol?
18142                 ;;
18143         esac
18144         $cat >>try.c <<'EOCP'
18145         if (!bad)
18146                 printf("ok\n");
18147         return 0;
18148 }
18149 EOCP
18150         set try
18151         if eval $compile; then
18152                 case "`$run ./try`" in
18153                 ok) echo "Your strtoul() seems to be working okay." ;;
18154                 *) cat <<EOM >&4
18155 Your strtoul() doesn't seem to be working okay.
18156 EOM
18157                    d_strtoul="$undef"
18158                    ;;
18159                 esac
18160         else
18161                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18162                 d_strtoul="$undef"
18163         fi
18164         ;;
18165 esac
18166
18167 : see if strtoull exists
18168 set strtoull d_strtoull
18169 eval $inlibc
18170
18171 case "$d_longlong-$d_strtoull" in
18172 "$define-$define")
18173         $cat <<EOM
18174 Checking whether your strtoull() works okay...
18175 EOM
18176         $cat >try.c <<'EOCP'
18177 #include <errno.h>
18178 #ifdef __hpux
18179 #define strtoull __strtoull
18180 #endif
18181 #include <stdio.h>
18182 extern unsigned long long int strtoull(char *s, char **, int);
18183 static int bad = 0;
18184 int check(char *s, long long eull, int een) {
18185         long long gull;
18186         errno = 0;
18187         gull = strtoull(s, 0, 10);
18188         if (!((gull == eull) && (errno == een)))
18189                 bad++;
18190 }
18191 int main() {
18192         check(" 1",                                        1LL, 0);
18193         check(" 0",                                        0LL, 0);
18194         check("18446744073709551615",  18446744073709551615ULL, 0);
18195         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18196 #if 0 /* strtoull() for /^-/ strings is undefined. */
18197         check("-1",                    18446744073709551615ULL, 0);
18198         check("-18446744073709551614",                     2LL, 0);
18199         check("-18446744073709551615",                     1LL, 0);
18200         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18201         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18202 #endif
18203         if (!bad)
18204                 printf("ok\n");
18205 }
18206 EOCP
18207         set try
18208         if eval $compile; then
18209                 case "`$run ./try`" in
18210                 ok) echo "Your strtoull() seems to be working okay." ;;
18211                 *) cat <<EOM >&4
18212 Your strtoull() doesn't seem to be working okay.
18213 EOM
18214                    d_strtoull="$undef"
18215                    ;;
18216                 esac
18217         else
18218                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18219                 d_strtoull="$undef"
18220         fi
18221         ;;
18222 esac
18223
18224 : see if strtouq exists
18225 set strtouq d_strtouq
18226 eval $inlibc
18227
18228 case "$d_strtouq" in
18229 "$define")
18230         $cat <<EOM
18231 Checking whether your strtouq() works okay...
18232 EOM
18233         $cat >try.c <<'EOCP'
18234 #include <errno.h>
18235 #include <stdio.h>
18236 extern unsigned long long int strtouq(char *s, char **, int);
18237 static int bad = 0;
18238 void check(char *s, unsigned long long eull, int een) {
18239         unsigned long long gull;
18240         errno = 0;
18241         gull = strtouq(s, 0, 10);
18242         if (!((gull == eull) && (errno == een)))
18243                 bad++;
18244 }
18245 int main() {
18246         check(" 1",                                        1LL, 0);
18247         check(" 0",                                        0LL, 0);
18248         check("18446744073709551615",  18446744073709551615ULL, 0);
18249         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18250 #if 0 /* strtouq() for /^-/ strings is undefined. */
18251         check("-1",                    18446744073709551615ULL, 0);
18252         check("-18446744073709551614",                     2LL, 0);
18253         check("-18446744073709551615",                     1LL, 0);
18254         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18255         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18256 #endif
18257         if (!bad)
18258                 printf("ok\n");
18259         return 0;
18260 }
18261 EOCP
18262         set try
18263         if eval $compile; then
18264                 case "`$run ./try`" in
18265                 ok) echo "Your strtouq() seems to be working okay." ;;
18266                 *) cat <<EOM >&4
18267 Your strtouq() doesn't seem to be working okay.
18268 EOM
18269                    d_strtouq="$undef"
18270                    ;;
18271                 esac
18272         else
18273                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18274                 d_strtouq="$undef"
18275         fi
18276         ;;
18277 esac
18278
18279 : see if strxfrm exists
18280 set strxfrm d_strxfrm
18281 eval $inlibc
18282
18283 : see if symlink exists
18284 set symlink d_symlink
18285 eval $inlibc
18286
18287 : see if syscall exists
18288 set syscall d_syscall
18289 eval $inlibc
18290
18291 : see if prototype for syscall is available
18292 echo " "
18293 set d_syscallproto syscall $i_unistd unistd.h
18294 eval $hasproto
18295
18296 : see if sysconf exists
18297 set sysconf d_sysconf
18298 eval $inlibc
18299
18300 : see if system exists
18301 set system d_system
18302 eval $inlibc
18303
18304 : see if tcgetpgrp exists
18305 set tcgetpgrp d_tcgetpgrp
18306 eval $inlibc
18307
18308 : see if tcsetpgrp exists
18309 set tcsetpgrp d_tcsetpgrp
18310 eval $inlibc
18311
18312 : see if prototype for telldir is available
18313 echo " "
18314 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18315 eval $hasproto
18316
18317 : see if time exists
18318 echo " "
18319 if test "X$d_time" = X -o X"$timetype" = X; then
18320     if set time val -f d_time; eval $csym; $val; then
18321                 echo 'time() found.' >&4
18322                 val="$define"
18323                 rp="What is the type returned by time() on this system?"
18324                 set time_t timetype long stdio.h sys/types.h
18325                 eval $typedef_ask
18326     else
18327                 echo 'time() not found, hope that will do.' >&4
18328                 val="$undef"
18329                 timetype='int';
18330     fi
18331     set d_time
18332     eval $setvar
18333 fi
18334
18335 : see if timegm exists
18336 set timegm d_timegm
18337 eval $inlibc
18338
18339 : see if this is a sys/times.h system
18340 set sys/times.h i_systimes
18341 eval $inhdr
18342
18343 : see if times exists
18344 echo " "
18345 if set times val -f d_times; eval $csym; $val; then
18346         echo 'times() found.' >&4
18347         d_times="$define"
18348         inc=''
18349         case "$i_systimes" in
18350         "$define") inc='sys/times.h';;
18351         esac
18352         rp="What is the type returned by times() on this system?"
18353         set clock_t clocktype long stdio.h sys/types.h $inc
18354         eval $typedef_ask
18355 else
18356         echo 'times() NOT found, hope that will do.' >&4
18357         d_times="$undef"
18358         clocktype='int'
18359 fi
18360
18361 : see if tmpnam_r exists
18362 set tmpnam_r d_tmpnam_r
18363 eval $inlibc
18364 case "$d_tmpnam_r" in
18365 "$define")
18366         hdrs="$i_systypes sys/types.h define stdio.h "
18367         case "$d_tmpnam_r_proto:$usethreads" in
18368         ":define")      d_tmpnam_r_proto=define
18369                 set d_tmpnam_r_proto tmpnam_r $hdrs
18370                 eval $hasproto ;;
18371         *)      ;;
18372         esac
18373         case "$d_tmpnam_r_proto" in
18374         define)
18375         case "$tmpnam_r_proto" in
18376         ''|0) try='char* tmpnam_r(char*);'
18377         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18378         esac
18379         case "$tmpnam_r_proto" in
18380         ''|0)   d_tmpnam_r=undef
18381                 tmpnam_r_proto=0
18382                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18383         * )     case "$tmpnam_r_proto" in
18384                 REENTRANT_PROTO*) ;;
18385                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18386                 esac
18387                 echo "Prototype: $try" ;;
18388         esac
18389         ;;
18390         *)      case "$usethreads" in
18391                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18392                 esac
18393                 d_tmpnam_r=undef
18394                 tmpnam_r_proto=0
18395                 ;;
18396         esac
18397         ;;
18398 *)      tmpnam_r_proto=0
18399         ;;
18400 esac
18401
18402 : see if truncate exists
18403 set truncate d_truncate
18404 eval $inlibc
18405
18406 : see if ttyname_r exists
18407 set ttyname_r d_ttyname_r
18408 eval $inlibc
18409 case "$d_ttyname_r" in
18410 "$define")
18411         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18412         case "$d_ttyname_r_proto:$usethreads" in
18413         ":define")      d_ttyname_r_proto=define
18414                 set d_ttyname_r_proto ttyname_r $hdrs
18415                 eval $hasproto ;;
18416         *)      ;;
18417         esac
18418         case "$d_ttyname_r_proto" in
18419         define)
18420         case "$ttyname_r_proto" in
18421         ''|0) try='int ttyname_r(int, char*, size_t);'
18422         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18423         esac
18424         case "$ttyname_r_proto" in
18425         ''|0) try='int ttyname_r(int, char*, int);'
18426         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18427         esac
18428         case "$ttyname_r_proto" in
18429         ''|0) try='char* ttyname_r(int, char*, int);'
18430         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18431         esac
18432         case "$ttyname_r_proto" in
18433         ''|0)   d_ttyname_r=undef
18434                 ttyname_r_proto=0
18435                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18436         * )     case "$ttyname_r_proto" in
18437                 REENTRANT_PROTO*) ;;
18438                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18439                 esac
18440                 echo "Prototype: $try" ;;
18441         esac
18442         ;;
18443         *)      case "$usethreads" in
18444                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18445                 esac
18446                 d_ttyname_r=undef
18447                 ttyname_r_proto=0
18448                 ;;
18449         esac
18450         ;;
18451 *)      ttyname_r_proto=0
18452         ;;
18453 esac
18454
18455 : see if tzname[] exists
18456 echo " "
18457 if set tzname val -a d_tzname; eval $csym; $val; then
18458         val="$define"
18459         echo 'tzname[] found.' >&4
18460 else
18461         val="$undef"
18462         echo 'tzname[] NOT found.' >&4
18463 fi
18464 set d_tzname
18465 eval $setvar
18466
18467 : Check if is a multiplatform env
18468 case "$osname" in
18469 next|rhapsody|darwin) multiarch="$define" ;;
18470 esac
18471 case "$multiarch" in
18472 ''|[nN]*) multiarch="$undef" ;;
18473 esac
18474
18475 : check for ordering of bytes in a UV
18476 echo " "
18477 case "$usecrosscompile$multiarch" in
18478 *$define*)
18479         $cat <<EOM
18480 You seem to be either cross-compiling or doing a multiarchitecture build,
18481 skipping the byteorder check.
18482
18483 EOM
18484         byteorder='ffff'
18485         ;;
18486 *)
18487         case "$byteorder" in
18488         '')
18489                 $cat <<'EOM'
18490 In the following, larger digits indicate more significance.  A big-endian
18491 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18492 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18493 machines may have weird orders like 3412.  A Cray will report 87654321,
18494 an Alpha will report 12345678. If the test program works the default is
18495 probably right.
18496 I'm now running the test program...
18497 EOM
18498                 $cat >try.c <<EOCP
18499 #include <stdio.h>
18500 #$i_stdlib I_STDLIB
18501 #ifdef I_STDLIB
18502 #include <stdlib.h>
18503 #endif
18504 #include <sys/types.h>
18505 typedef $uvtype UV;
18506 int main()
18507 {
18508         int i;
18509         union {
18510                 UV l;
18511                 char c[$uvsize];
18512         } u;
18513
18514         if ($uvsize > 4)
18515                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18516         else
18517                 u.l = (UV)0x04030201;
18518         for (i = 0; i < $uvsize; i++)
18519                 printf("%c", u.c[i]+'0');
18520         printf("\n");
18521         exit(0);
18522 }
18523 EOCP
18524                 xxx_prompt=y
18525                 set try
18526                 if eval $compile && $run ./try > /dev/null; then
18527                         dflt=`$run ./try`
18528                         case "$dflt" in
18529                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18530                                 echo "(The test program ran ok.)"
18531                                 echo "byteorder=$dflt"
18532                                 xxx_prompt=n
18533                         ;;
18534                         ????|????????) echo "(The test program ran ok.)" ;;
18535                         *) echo "(The test program didn't run right for some reason.)" ;;
18536                         esac
18537                 else
18538                         dflt='4321'
18539                         cat <<'EOM'
18540 (I can't seem to compile the test program.  Guessing big-endian...)
18541 EOM
18542                 fi
18543                 case "$xxx_prompt" in
18544                 y)
18545                         rp="What is the order of bytes in $uvtype?"
18546                         . ./myread
18547                         byteorder="$ans"
18548                         ;;
18549                 *)      byteorder=$dflt
18550                         ;;
18551                 esac
18552                 ;;
18553         esac
18554         $rm_try
18555         ;;
18556 esac
18557
18558 : Checking 32bit aligndness
18559 $cat <<EOM
18560
18561 Checking to see whether you can access character data unalignedly...
18562 EOM
18563 case "$d_u32align" in
18564 '')   $cat >try.c <<EOCP
18565 #include <stdio.h>
18566 #$i_stdlib I_STDLIB
18567 #ifdef I_STDLIB
18568 #include <stdlib.h>
18569 #endif
18570 #define U32 $u32type
18571 #define BYTEORDER 0x$byteorder
18572 #define U8 $u8type
18573 #include <signal.h>
18574 #ifdef SIGBUS
18575 $signal_t bletch(int s) { exit(4); }
18576 #endif
18577 int main() {
18578 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18579     U8 buf[8];
18580     U32 *up;
18581     int i;
18582
18583     if (sizeof(U32) != 4) {
18584         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18585         exit(1);
18586     }
18587
18588     fflush(stdout);
18589
18590 #ifdef SIGBUS
18591     signal(SIGBUS, bletch);
18592 #endif
18593
18594     buf[0] = 0;
18595     buf[1] = 0;
18596     buf[2] = 0;
18597     buf[3] = 1;
18598     buf[4] = 0;
18599     buf[5] = 0;
18600     buf[6] = 0;
18601     buf[7] = 1;
18602
18603     for (i = 0; i < 4; i++) {
18604         up = (U32*)(buf + i);
18605         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18606                (*up == 1 << (8*(3-i)))  /* little-endian */
18607               )
18608            )
18609         {
18610             printf("read failed (%x)\n", *up);
18611             exit(2);
18612         }
18613     }
18614
18615     /* write test */
18616     for (i = 0; i < 4; i++) {
18617         up = (U32*)(buf + i);
18618         *up = 0xBeef;
18619         if (*up != 0xBeef) {
18620             printf("write failed (%x)\n", *up);
18621             exit(3);
18622         }
18623     }
18624
18625     exit(0);
18626 #else
18627     printf("1\n");
18628     exit(1);
18629 #endif
18630     return 0;
18631 }
18632 EOCP
18633 set try
18634 if eval $compile_ok; then
18635         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18636         $run ./try 2>&1 >/dev/null
18637         case "$?" in
18638         0)      cat >&4 <<EOM
18639 You can access character data pretty unalignedly.
18640 EOM
18641                 d_u32align="$undef"
18642                 ;;
18643         *)      cat >&4 <<EOM
18644 It seems that you must access character data in an aligned manner.
18645 EOM
18646                 d_u32align="$define"
18647                 ;;
18648         esac
18649 else
18650         rp='Can you access character data at unaligned addresses?'
18651         dflt='n'
18652         . ./myread
18653         case "$ans" in
18654         [yY]*)  d_u32align="$undef"  ;;
18655         *)      d_u32align="$define" ;;
18656         esac
18657 fi
18658 $rm_try
18659 ;;
18660 esac
18661
18662 : see if ualarm exists
18663 set ualarm d_ualarm
18664 eval $inlibc
18665
18666 : see if umask exists
18667 set umask d_umask
18668 eval $inlibc
18669
18670 : see if unordered exists
18671 set unordered d_unordered
18672 eval $inlibc
18673
18674 : see if unsetenv exists
18675 set unsetenv d_unsetenv
18676 eval $inlibc
18677
18678 : see if usleep exists
18679 set usleep d_usleep
18680 eval $inlibc
18681
18682 : see if prototype for usleep is available
18683 echo " "
18684 set d_usleepproto usleep $i_unistd unistd.h
18685 eval $hasproto
18686
18687 : see if ustat exists
18688 set ustat d_ustat
18689 eval $inlibc
18690
18691 : see if closedir exists
18692 set closedir d_closedir
18693 eval $inlibc
18694
18695 case "$d_closedir" in
18696 "$define")
18697         echo " "
18698         echo "Checking whether closedir() returns a status..." >&4
18699         cat > try.c <<EOM
18700 #$i_dirent I_DIRENT             /**/
18701 #$i_sysdir I_SYS_DIR            /**/
18702 #$i_sysndir I_SYS_NDIR          /**/
18703 #$i_systypes I_SYS_TYPES        /**/
18704
18705 #if defined(I_SYS_TYPES)
18706 #include <sys/types.h>
18707 #endif
18708 #if defined(I_DIRENT)
18709 #include <dirent.h>
18710 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18711 #include <sys/dir.h>
18712 #endif
18713 #else
18714 #ifdef I_SYS_NDIR
18715 #include <sys/ndir.h>
18716 #else
18717 #ifdef I_SYS_DIR
18718 #ifdef hp9000s500
18719 #include <ndir.h>       /* may be wrong in the future */
18720 #else
18721 #include <sys/dir.h>
18722 #endif
18723 #endif
18724 #endif
18725 #endif
18726 int main() { return closedir(opendir(".")); }
18727 EOM
18728         set try
18729         if eval $compile_ok; then
18730                 if $run ./try > /dev/null 2>&1 ; then
18731                         echo "Yes, it does."
18732                         val="$undef"
18733                 else
18734                         echo "No, it doesn't."
18735                         val="$define"
18736                 fi
18737         else
18738                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18739                 val="$define"
18740         fi
18741         ;;
18742 *)
18743         val="$undef";
18744         ;;
18745 esac
18746 set d_void_closedir
18747 eval $setvar
18748 $rm_try
18749
18750 : see if there is a wait4
18751 set wait4 d_wait4
18752 eval $inlibc
18753
18754 : see if waitpid exists
18755 set waitpid d_waitpid
18756 eval $inlibc
18757
18758 : see if wcstombs exists
18759 set wcstombs d_wcstombs
18760 eval $inlibc
18761
18762 : see if wctomb exists
18763 set wctomb d_wctomb
18764 eval $inlibc
18765
18766 : see if writev exists
18767 set writev d_writev
18768 eval $inlibc
18769
18770 : preserve RCS keywords in files with variable substitution, grrr
18771 Date='$Date'
18772 Id='$Id'
18773 Log='$Log'
18774 RCSfile='$RCSfile'
18775 Revision='$Revision'
18776
18777 : check for alignment requirements
18778 echo " "
18779 case "$usecrosscompile$multiarch" in
18780 *$define*)
18781         $cat <<EOM
18782 You seem to be either cross-compiling or doing a multiarchitecture build,
18783 skipping the memory alignment check.
18784
18785 EOM
18786         case "$alignbytes" in
18787         '') alignbytes=8 ;;
18788         esac
18789         ;;
18790 *)
18791         case "$alignbytes" in
18792         '') echo "Checking alignment constraints..." >&4
18793                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18794                         $cat >try.c <<'EOCP'
18795 typedef long double NV;
18796 EOCP
18797                 else
18798                         $cat >try.c <<'EOCP'
18799 typedef double NV;
18800 EOCP
18801                 fi
18802                 $cat >>try.c <<'EOCP'
18803 #include <stdio.h>
18804 struct foobar {
18805         char foo;
18806         NV bar;
18807 } try_algn;
18808 int main()
18809 {
18810     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18811     return(0);
18812 }
18813 EOCP
18814                 set try
18815                 if eval $compile_ok; then
18816                         dflt=`$run ./try`
18817                 else
18818                         dflt='8'
18819                         echo "(I can't seem to compile the test program...)"
18820                 fi
18821                 ;;
18822         *) dflt="$alignbytes"
18823                 ;;
18824         esac
18825         rp="Doubles must be aligned on a how-many-byte boundary?"
18826         . ./myread
18827         alignbytes="$ans"
18828         $rm_try
18829         ;;
18830 esac
18831
18832
18833 : set the base revision
18834 baserev=5.0
18835
18836 : check for length of character
18837 echo " "
18838 case "$charsize" in
18839 '')
18840         echo "Checking to see how big your characters are (hey, you never know)..." >&4
18841         $cat >try.c <<EOCP
18842 #include <stdio.h>
18843 #$i_stdlib I_STDLIB
18844 #ifdef I_STDLIB
18845 #include <stdlib.h>
18846 #endif
18847 int main()
18848 {
18849     printf("%d\n", (int)sizeof(char));
18850     exit(0);
18851 }
18852 EOCP
18853         set try
18854         if eval $compile_ok; then
18855                 dflt=`$run ./try`
18856         else
18857                 dflt='1'
18858                 echo "(I can't seem to compile the test program.  Guessing...)"
18859         fi
18860         ;;
18861 *)
18862         dflt="$charsize"
18863         ;;
18864 esac
18865 rp="What is the size of a character (in bytes)?"
18866 . ./myread
18867 charsize="$ans"
18868 $rm_try
18869
18870 : Check for the number of bits in a character
18871 case "$charbits" in
18872 '')     echo "Checking how long a character is (in bits)..." >&4
18873         $cat >try.c <<EOCP
18874 #include <stdio.h>
18875 int main ()
18876 {
18877     int n;
18878     unsigned char c;
18879     for (c = 1, n = 0; c; c <<= 1, n++) ;
18880     printf ("%d\n", n);
18881     return (0);
18882     }
18883 EOCP
18884         set try
18885         if eval $compile_ok; then
18886                 dflt=`$run ./try`
18887         else
18888                 dflt='8'
18889                 echo "(I can't seem to compile the test program.  Guessing...)"
18890         fi
18891         ;;
18892 *)
18893         dflt="$charbits"
18894         ;;
18895 esac
18896 rp="What is the length of a character (in bits)?"
18897 . ./myread
18898 charbits="$ans"
18899 $rm_try
18900 case "$charbits" in
18901 8)      ;;
18902 *)      cat >&4 << EOM
18903 Your system has an unsigned character size of $charbits bits, which
18904 is rather unusual (normally it is 8 bits).  Perl likely will not work
18905 correctly on your system, with subtle bugs in various places.
18906 EOM
18907         rp='Do you really want to continue?'
18908         dflt='n'
18909         . ./myread
18910         case "$ans" in
18911                 [yY])   echo >&4 "Okay, continuing."    ;;
18912                 *)      exit 1                          ;;
18913         esac
18914 esac
18915
18916 : how do we concatenate cpp tokens here?
18917 echo " "
18918 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18919 $cat >cpp_stuff.c <<'EOCP'
18920 #define RCAT(a,b)a/**/b
18921 #define ACAT(a,b)a ## b
18922 RCAT(Rei,ser)
18923 ACAT(Cir,cus)
18924 EOCP
18925 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18926 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18927         echo "Oh!  Smells like ANSI's been here." >&4
18928         echo "We can catify or stringify, separately or together!"
18929         cpp_stuff=42
18930 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18931         echo "Ah, yes!  The good old days!" >&4
18932         echo "However, in the good old days we don't know how to stringify and"
18933         echo "catify at the same time."
18934         cpp_stuff=1
18935 else
18936         $cat >&4 <<EOM
18937 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18938 You're going to have to edit the values of CAT[2-5] in config.h...
18939 EOM
18940         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18941 fi
18942 $rm -f cpp_stuff.*
18943
18944 : see if this is a db.h system
18945 set db.h i_db
18946 eval $inhdr
18947
18948 case "$i_db" in
18949 $define)
18950         : Check db version.
18951         echo " "
18952         echo "Checking Berkeley DB version ..." >&4
18953         $cat >try.c <<EOCP
18954 #$d_const HASCONST
18955 #ifndef HASCONST
18956 #define const
18957 #endif
18958 #include <sys/types.h>
18959 #include <stdio.h>
18960 #$i_stdlib I_STDLIB
18961 #ifdef I_STDLIB
18962 #include <stdlib.h>
18963 #endif
18964 #include <db.h>
18965 int main(int argc, char *argv[])
18966 {
18967 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18968     int Major, Minor, Patch ;
18969     unsigned long Version ;
18970     (void)db_version(&Major, &Minor, &Patch) ;
18971     if (argc == 2) {
18972         printf("%d %d %d %d %d %d\n",
18973                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18974                Major, Minor, Patch);
18975         exit(0);
18976     }
18977     printf("You have Berkeley DB Version 2 or greater.\n");
18978
18979     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18980                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18981     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18982                 Major, Minor, Patch) ;
18983
18984     /* check that db.h & libdb are compatible */
18985     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18986         printf("db.h and libdb are incompatible.\n") ;
18987         exit(3);
18988     }
18989
18990     printf("db.h and libdb are compatible.\n") ;
18991
18992     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18993                 + DB_VERSION_PATCH ;
18994
18995     /* needs to be >= 2.3.4 */
18996     if (Version < 2003004) {
18997     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18998         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18999         exit(2);
19000     }
19001
19002     exit(0);
19003 #else
19004 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19005     if (argc == 2) {
19006         printf("1 0 0\n");
19007         exit(0);
19008     }
19009     printf("You have Berkeley DB Version 1.\n");
19010     exit(0);    /* DB version < 2: the coast is clear. */
19011 #else
19012     exit(1);    /* <db.h> not Berkeley DB? */
19013 #endif
19014 #endif
19015 }
19016 EOCP
19017         set try
19018         if eval $compile_ok && $run ./try; then
19019                 echo 'Looks OK.' >&4
19020                 set `$run ./try 1`
19021                 db_version_major=$1
19022                 db_version_minor=$2
19023                 db_version_patch=$3
19024         else
19025                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19026                 i_db=$undef
19027                 case " $libs " in
19028                 *"-ldb "*)
19029                         : Remove db from list of libraries to use
19030                         echo "Removing unusable -ldb from library list" >&4
19031                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19032                         shift
19033                         libs="$*"
19034                         echo "libs = $libs" >&4
19035                         ;;
19036                 esac
19037         fi
19038         $rm_try
19039         ;;
19040 esac
19041
19042 case "$i_db" in
19043 define)
19044         : Check the return type needed for hash
19045         echo " "
19046         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19047         $cat >try.c <<EOCP
19048 #$d_const HASCONST
19049 #ifndef HASCONST
19050 #define const
19051 #endif
19052 #include <sys/types.h>
19053 #include <db.h>
19054
19055 #ifndef DB_VERSION_MAJOR
19056 u_int32_t hash_cb (ptr, size)
19057 const void *ptr;
19058 size_t size;
19059 {
19060 }
19061 HASHINFO info;
19062 int main()
19063 {
19064         info.hash = hash_cb;
19065 }
19066 #endif
19067 EOCP
19068         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19069                 if $contains warning try.out >>/dev/null 2>&1 ; then
19070                         db_hashtype='int'
19071                 else
19072                         db_hashtype='u_int32_t'
19073                 fi
19074         else
19075                 : XXX Maybe we should just give up here.
19076                 db_hashtype=u_int32_t
19077                 $cat try.out >&4
19078                 echo "Help:  I can't seem to compile the db test program." >&4
19079                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19080         fi
19081         $rm_try
19082         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19083         ;;
19084 *)      db_hashtype=u_int32_t
19085         ;;
19086 esac
19087 case "$i_db" in
19088 define)
19089         : Check the return type needed for prefix
19090         echo " "
19091         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19092         cat >try.c <<EOCP
19093 #$d_const HASCONST
19094 #ifndef HASCONST
19095 #define const
19096 #endif
19097 #include <sys/types.h>
19098 #include <db.h>
19099
19100 #ifndef DB_VERSION_MAJOR
19101 size_t prefix_cb (key1, key2)
19102 const DBT *key1;
19103 const DBT *key2;
19104 {
19105 }
19106 BTREEINFO info;
19107 int main()
19108 {
19109         info.prefix = prefix_cb;
19110 }
19111 #endif
19112 EOCP
19113         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19114                 if $contains warning try.out >>/dev/null 2>&1 ; then
19115                         db_prefixtype='int'
19116                 else
19117                         db_prefixtype='size_t'
19118                 fi
19119         else
19120                 db_prefixtype='size_t'
19121                 : XXX Maybe we should just give up here.
19122                 $cat try.out >&4
19123                 echo "Help:  I can't seem to compile the db test program." >&4
19124                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19125         fi
19126         $rm_try
19127         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19128         ;;
19129 *)      db_prefixtype='size_t'
19130         ;;
19131 esac
19132
19133 : How can we generate normalized random numbers ?
19134 echo " "
19135 echo "Looking for a random number function..." >&4
19136 case "$randfunc" in
19137 '')
19138         if set drand48 val -f; eval $csym; $val; then
19139                 dflt="drand48"
19140                 echo "Good, found drand48()." >&4
19141         elif set random val -f; eval $csym; $val; then
19142                 dflt="random"
19143                 echo "OK, found random()." >&4
19144         else
19145                 dflt="rand"
19146                 echo "Yick, looks like I have to use rand()." >&4
19147         fi
19148         echo " "
19149         ;;
19150 *)
19151         dflt="$randfunc"
19152         ;;
19153 esac
19154 cont=true
19155
19156 case "$ccflags" in
19157 *-Dmy_rand=*|*-Dmy_srand=*)
19158         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19159         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19160         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19161         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19162         ;;
19163 esac
19164
19165 while $test "$cont"; do
19166         rp="Use which function to generate random numbers?"
19167         . ./myread
19168         if $test "$ans" = "$dflt"; then
19169                 : null
19170         else
19171                 randbits=''
19172         fi
19173         randfunc="$ans"
19174         if set $ans val -f; eval $csym; $val; then
19175                 cont=''
19176         else
19177                 dflt=y
19178                 rp="I cannot find function $ans. Use that name anyway?"
19179                 . ./myread
19180                 dflt=rand
19181                 case "$ans" in
19182                         [yY]*) cont='';;
19183                 esac
19184         fi
19185         case "$cont" in
19186         '')
19187                 case "$randfunc" in
19188                 drand48)
19189                         drand01="drand48()"
19190                         seedfunc="srand48"
19191                         randbits=48
19192                         randseedtype=long
19193                         ;;
19194                 rand|random)
19195                         case "$randbits" in
19196                         '')
19197 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19198                                 $cat >try.c <<EOCP
19199 #$i_unistd I_UNISTD
19200 #$i_stdlib I_STDLIB
19201 #include <stdio.h>
19202 #ifdef I_UNISTD
19203 #  include <unistd.h>
19204 #endif
19205 #ifdef I_STDLIB
19206 #  include <stdlib.h>
19207 #endif
19208 int main()
19209 {
19210         register int i;
19211         register unsigned long tmp;
19212         register unsigned long max = 0L;
19213
19214         for (i = 1000; i; i--) {
19215                 tmp = (unsigned long) $randfunc();
19216                 if (tmp > max) max = tmp;
19217         }
19218         for (i = 0; max; i++)
19219                 max /= 2;
19220         printf("%d\n",i);
19221 }
19222 EOCP
19223                                 set try
19224                                 if eval $compile_ok; then
19225                                         dflt=`try`
19226                                 else
19227                                         dflt='?'
19228                                         echo "(I can't seem to compile the test program...)"
19229                                 fi
19230                                 ;;
19231                         *)
19232                                 dflt="$randbits"
19233                                 ;;
19234                         esac
19235                         rp="How many bits does your $randfunc() function produce?"
19236                         . ./myread
19237                         randbits="$ans"
19238                         $rm_try
19239                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19240                         seedfunc="s$randfunc"
19241                         randseedtype=unsigned
19242                         ;;
19243                 *)
19244                         dflt="31"
19245                         rp="How many bits does your $randfunc() function produce?"
19246                         . ./myread
19247                         randbits="$ans"
19248                         seedfunc="s$randfunc"
19249                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19250                         if set $seedfunc val -f; eval $csym; $val; then
19251                                 echo "(Using $seedfunc() to seed random generator)"
19252                         else
19253                                 echo "(Warning: no $seedfunc() to seed random generator)"
19254                                 seedfunc=rand
19255                         fi
19256                         randseedtype=unsigned
19257                         ;;
19258                 esac
19259                 ;;
19260         esac
19261 done
19262
19263 : Determine if this is an EBCDIC system
19264 echo " "
19265 echo "Determining whether or not we are on an EBCDIC system..." >&4
19266 $cat >try.c <<'EOM'
19267 int main()
19268 {
19269   if ('M'==0xd4) return 0;
19270   return 1;
19271 }
19272 EOM
19273
19274 val=$undef
19275 set try
19276 if eval $compile_ok; then
19277         if $run ./try; then
19278                 echo "You seem to speak EBCDIC." >&4
19279                 val="$define"
19280         else
19281                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19282         fi
19283 else
19284         echo "I'm unable to compile the test program." >&4
19285         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19286 fi
19287 $rm_try
19288 set ebcdic
19289 eval $setvar
19290
19291 : Check how to flush
19292 echo " "
19293 $cat >&4 <<EOM
19294 Checking how to flush all pending stdio output...
19295 EOM
19296 # I only know how to find the first 32 possibly open files on SunOS.
19297 # See also hints/sunos_4_1.sh and util.c  --AD
19298 case "$osname" in
19299 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19300 esac
19301 $cat >>try.c <<EOCP
19302 #include <stdio.h>
19303 #$i_stdlib I_STDLIB
19304 #ifdef I_STDLIB
19305 #include <stdlib.h>
19306 #endif
19307 #$i_unistd I_UNISTD
19308 #ifdef I_UNISTD
19309 # include <unistd.h>
19310 #endif
19311 #$d_sysconf HAS_SYSCONF
19312 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19313 #ifdef HAS_STDIO_STREAM_ARRAY
19314 # define STDIO_STREAM_ARRAY $stdio_stream_array
19315 #endif
19316 int main() {
19317   FILE* p;
19318   unlink("try.out");
19319   p = fopen("try.out", "w");
19320 #ifdef TRY_FPUTC
19321   fputc('x', p);
19322 #else
19323 # ifdef TRY_FPRINTF
19324   fprintf(p, "x");
19325 # endif
19326 #endif
19327 #ifdef TRY_FFLUSH_NULL
19328   fflush(NULL);
19329 #endif
19330 #ifdef TRY_FFLUSH_ALL
19331   {
19332     long open_max = -1;
19333 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19334     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19335 # else
19336 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19337     open_max = sysconf(_SC_OPEN_MAX);
19338 #  else
19339 #   ifdef FOPEN_MAX
19340     open_max = FOPEN_MAX;
19341 #   else
19342 #    ifdef OPEN_MAX
19343     open_max = OPEN_MAX;
19344 #    else
19345 #     ifdef _NFILE
19346     open_max = _NFILE;
19347 #     endif
19348 #    endif
19349 #   endif
19350 #  endif
19351 # endif
19352 # ifdef HAS_STDIO_STREAM_ARRAY
19353     if (open_max > 0) {
19354       long i;
19355       for (i = 0; i < open_max; i++)
19356             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19357                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19358                 STDIO_STREAM_ARRAY[i]._flag)
19359                 fflush(&STDIO_STREAM_ARRAY[i]);
19360     }
19361   }
19362 # endif
19363 #endif
19364   _exit(42);
19365 }
19366 EOCP
19367 : first we have to find out how _not_ to flush
19368 $to try.c
19369 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19370     output=''
19371     set try -DTRY_FPUTC
19372     if eval $compile; then
19373             $run ./try 2>/dev/null
19374             code="$?"
19375             $from try.out
19376             if $test ! -s try.out -a "X$code" = X42; then
19377                 output=-DTRY_FPUTC
19378             fi
19379     fi
19380     case "$output" in
19381     '')
19382             set try -DTRY_FPRINTF
19383             if eval $compile; then
19384                     $run ./try 2>/dev/null
19385                     code="$?"
19386                     $from try.out
19387                     if $test ! -s try.out -a "X$code" = X42; then
19388                         output=-DTRY_FPRINTF
19389                     fi
19390             fi
19391         ;;
19392     esac
19393 fi
19394 : check for fflush NULL behaviour
19395 case "$fflushNULL" in
19396 '')     set try -DTRY_FFLUSH_NULL $output
19397         if eval $compile; then
19398                 $run ./try 2>/dev/null
19399                 code="$?"
19400                 $from try.out
19401                 if $test -s try.out -a "X$code" = X42; then
19402                         fflushNULL="`$cat try.out`"
19403                 else
19404                         if $test "X$code" != X42; then
19405                                 $cat >&4 <<EOM
19406 (If this test failed, don't worry, we'll try another method shortly.)
19407 EOM
19408                         fi
19409                 fi
19410         fi
19411         $rm -f core try.core core.try.*
19412         case "$fflushNULL" in
19413         x)      $cat >&4 <<EOM
19414 Your fflush(NULL) works okay for output streams.
19415 Let's see if it clobbers input pipes...
19416 EOM
19417 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19418 # bug that improperly flushes the input end of pipes.  So we avoid the
19419 # autoflush on fork/system/exec support for now. :-(
19420 $cat >tryp.c <<EOCP
19421 #include <stdio.h>
19422 int
19423 main(int argc, char **argv)
19424 {
19425     char buf[1024];
19426     int i;
19427     char *bp = buf;
19428     while (1) {
19429         while ((i = getc(stdin)) != -1
19430                && (*bp++ = i) != '\n'
19431                && bp < &buf[1024])
19432         /* DO NOTHING */ ;
19433         *bp = '\0';
19434         fprintf(stdout, "%s", buf);
19435         fflush(NULL);
19436         if (i == -1)
19437             return 0;
19438         bp = buf;
19439     }
19440 }
19441 EOCP
19442                 fflushNULL="$define"
19443                 set tryp
19444                 if eval $compile; then
19445                     $rm -f tryp.out
19446                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19447                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19448                        $cat >&4 <<EOM
19449 fflush(NULL) seems to behave okay with input streams.
19450 EOM
19451                         fflushNULL="$define"
19452                     else
19453                         $cat >&4 <<EOM
19454 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19455 EOM
19456                         fflushNULL="$undef"
19457                     fi
19458                 fi
19459                 $rm -f core tryp.c tryp.core core.tryp.*
19460                 ;;
19461         '')     $cat >&4 <<EOM
19462 Your fflush(NULL) isn't working (contrary to ANSI C).
19463 EOM
19464                 fflushNULL="$undef"
19465                 ;;
19466         *)      $cat >&4 <<EOM
19467 Cannot figure out whether your fflush(NULL) works or not.
19468 I'm assuming it doesn't (contrary to ANSI C).
19469 EOM
19470                 fflushNULL="$undef"
19471                 ;;
19472         esac
19473         ;;
19474 $define|true|[yY]*)
19475         fflushNULL="$define"
19476         ;;
19477 *)
19478         fflushNULL="$undef"
19479         ;;
19480 esac
19481 : check explicit looping only if NULL did not work, and if the pipe
19482 : bug does not show up on an explicit flush too
19483 case "$fflushNULL" in
19484 "$undef")
19485         $cat >tryp.c <<EOCP
19486 #include <stdio.h>
19487 int
19488 main(int argc, char **argv)
19489 {
19490     char buf[1024];
19491     int i;
19492     char *bp = buf;
19493     while (1) {
19494         while ((i = getc(stdin)) != -1
19495                && (*bp++ = i) != '\n'
19496                && bp < &buf[1024])
19497         /* DO NOTHING */ ;
19498         *bp = '\0';
19499         fprintf(stdout, "%s", buf);
19500         fflush(stdin);
19501         if (i == -1)
19502             return 0;
19503         bp = buf;
19504     }
19505 }
19506 EOCP
19507         set tryp
19508         if eval $compile; then
19509             $rm -f tryp.out
19510             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19511             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19512                $cat >&4 <<EOM
19513 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19514 EOM
19515                 : now check for fflushall behaviour
19516                 case "$fflushall" in
19517                 '')     set try -DTRY_FFLUSH_ALL $output
19518                         if eval $compile; then
19519                                 $cat >&4 <<EOM
19520 (Now testing the other method--but note that this also may fail.)
19521 EOM
19522                                 $run ./try 2>/dev/null
19523                                 code=$?
19524                                 $from try.out
19525                                 if $test -s try.out -a "X$code" = X42; then
19526                                         fflushall="`$cat try.out`"
19527                                 fi
19528                         fi
19529                         $rm_try
19530                         case "$fflushall" in
19531                         x)      $cat >&4 <<EOM
19532 Whew. Flushing explicitly all the stdio streams works.
19533 EOM
19534                                 fflushall="$define"
19535                                 ;;
19536                         '')     $cat >&4 <<EOM
19537 Sigh. Flushing explicitly all the stdio streams doesn't work.
19538 EOM
19539                                 fflushall="$undef"
19540                                 ;;
19541                         *)      $cat >&4 <<EOM
19542 Cannot figure out whether flushing stdio streams explicitly works or not.
19543 I'm assuming it doesn't.
19544 EOM
19545                                 fflushall="$undef"
19546                                 ;;
19547                         esac
19548                         ;;
19549                 "$define"|true|[yY]*)
19550                         fflushall="$define"
19551                         ;;
19552                 *)
19553                         fflushall="$undef"
19554                         ;;
19555                 esac
19556             else
19557                 $cat >&4 <<EOM
19558 All is futile.  Even fflush(stdin) clobbers input pipes!
19559 EOM
19560                 fflushall="$undef"
19561             fi
19562         else
19563             fflushall="$undef"
19564         fi
19565         $rm -f core tryp.c tryp.core core.tryp.*
19566         ;;
19567 *)      fflushall="$undef"
19568         ;;
19569 esac
19570
19571 case "$fflushNULL$fflushall" in
19572 undefundef)
19573         $cat <<EOM
19574 OK, I give up.  I cannot figure out how to flush pending stdio output.
19575 We won't be flushing handles at all before fork/exec/popen.
19576 EOM
19577         ;;
19578 esac
19579 $rm_try tryp
19580
19581 : Store the full pathname to the ar program for use in the C program
19582 : Respect a hint or command line value for full_ar.
19583 case "$full_ar" in
19584 '') full_ar=$ar ;;
19585 esac
19586
19587 : Store the full pathname to the sed program for use in the C program
19588 full_sed=$sed
19589
19590 : see what type gids are declared as in the kernel
19591 echo " "
19592 echo "Looking for the type for group ids returned by getgid()."
19593 set gid_t gidtype xxx stdio.h sys/types.h
19594 eval $typedef
19595 case "$gidtype" in
19596 xxx)
19597         xxx=`./findhdr sys/user.h`
19598         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19599         case $1 in
19600         unsigned) dflt="$1 $2" ;;
19601         *) dflt="$1" ;;
19602         esac
19603         ;;
19604 *) dflt="$gidtype";;
19605 esac
19606 case "$gidtype" in
19607 gid_t) echo "gid_t found." ;;
19608 *)      rp="What is the type for group ids returned by getgid()?"
19609         . ./myread
19610         gidtype="$ans"
19611         ;;
19612 esac
19613
19614 : Check the size of GID
19615 echo " "
19616 case "$gidtype" in
19617 *_t) zzz="$gidtype"     ;;
19618 *)   zzz="gid"          ;;
19619 esac
19620 echo "Checking the size of $zzz..." >&4
19621 cat > try.c <<EOCP
19622 #include <sys/types.h>
19623 #include <stdio.h>
19624 #$i_stdlib I_STDLIB
19625 #ifdef I_STDLIB
19626 #include <stdlib.h>
19627 #endif
19628 int main() {
19629     printf("%d\n", (int)sizeof($gidtype));
19630     exit(0);
19631 }
19632 EOCP
19633 set try
19634 if eval $compile_ok; then
19635         yyy=`$run ./try`
19636         case "$yyy" in
19637         '')     gidsize=4
19638                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19639                 ;;
19640         *)      gidsize=$yyy
19641                 echo "Your $zzz is $gidsize bytes long."
19642                 ;;
19643         esac
19644 else
19645         gidsize=4
19646         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19647 fi
19648
19649
19650 : Check if GID is signed
19651 echo " "
19652 case "$gidtype" in
19653 *_t) zzz="$gidtype"     ;;
19654 *)   zzz="gid"          ;;
19655 esac
19656 echo "Checking the sign of $zzz..." >&4
19657 cat > try.c <<EOCP
19658 #include <sys/types.h>
19659 #include <stdio.h>
19660 int main() {
19661         $gidtype foo = -1;
19662         if (foo < 0)
19663                 printf("-1\n");
19664         else
19665                 printf("1\n");
19666 }
19667 EOCP
19668 set try
19669 if eval $compile; then
19670         yyy=`$run ./try`
19671         case "$yyy" in
19672         '')     gidsign=1
19673                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19674                 ;;
19675         *)      gidsign=$yyy
19676                 case "$gidsign" in
19677                  1) echo "Your $zzz is unsigned." ;;
19678                 -1) echo "Your $zzz is signed."   ;;
19679                 esac
19680                 ;;
19681         esac
19682 else
19683         gidsign=1
19684         echo "(I can't compile the test program--guessing unsigned.)" >&4
19685 fi
19686
19687
19688 : Check 64bit sizes
19689 echo " "
19690
19691 if $test X"$quadtype" != X; then
19692
19693 echo "Checking how to print 64-bit integers..." >&4
19694
19695 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19696         $cat >try.c <<'EOCP'
19697 #include <sys/types.h>
19698 #include <stdio.h>
19699 int main() {
19700   int q = 12345678901;
19701   printf("%ld\n", q);
19702 }
19703 EOCP
19704         set try
19705         if eval $compile; then
19706                 yyy=`$run ./try`
19707                 case "$yyy" in
19708                 12345678901)
19709                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19710                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19711                         echo "We will use %d."
19712                         ;;
19713                 esac
19714         fi
19715 fi
19716
19717 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19718         $cat >try.c <<'EOCP'
19719 #include <sys/types.h>
19720 #include <stdio.h>
19721 int main() {
19722   long q = 12345678901;
19723   printf("%ld\n", q);
19724 }
19725 EOCP
19726         set try
19727         if eval $compile; then
19728                 yyy=`$run ./try`
19729                 case "$yyy" in
19730                 12345678901)
19731                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19732                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19733                         echo "We will use %ld."
19734                         ;;
19735                 esac
19736         fi
19737 fi
19738
19739 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19740         $cat >try.c <<'EOCP'
19741 #include <sys/types.h>
19742 #include <inttypes.h>
19743 #include <stdio.h>
19744 int main() {
19745   int64_t q = 12345678901;
19746   printf("%" PRId64 "\n", q);
19747 }
19748 EOCP
19749         set try
19750         if eval $compile; then
19751                 yyy=`$run ./try`
19752                 case "$yyy" in
19753                 12345678901)
19754                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19755                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19756                         echo "We will use the C9X style."
19757                         ;;
19758                 esac
19759         fi
19760 fi
19761
19762 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19763         $cat >try.c <<EOCP
19764 #include <sys/types.h>
19765 #include <stdio.h>
19766 int main() {
19767   $quadtype q = 12345678901;
19768   printf("%Ld\n", q);
19769 }
19770 EOCP
19771         set try
19772         if eval $compile; then
19773                 yyy=`$run ./try`
19774                 case "$yyy" in
19775                 12345678901)
19776                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19777                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19778                         echo "We will use %Ld."
19779                         ;;
19780                 esac
19781         fi
19782 fi
19783
19784 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19785         $cat >try.c <<'EOCP'
19786 #include <sys/types.h>
19787 #include <stdio.h>
19788 int main() {
19789   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19790   printf("%lld\n", q);
19791 }
19792 EOCP
19793         set try
19794         if eval $compile; then
19795                 yyy=`$run ./try`
19796                 case "$yyy" in
19797                 12345678901)
19798                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19799                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19800                         echo "We will use the %lld style."
19801                         ;;
19802                 esac
19803         fi
19804 fi
19805
19806 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19807         $cat >try.c <<EOCP
19808 #include <sys/types.h>
19809 #include <stdio.h>
19810 int main() {
19811   $quadtype q = 12345678901;
19812   printf("%qd\n", q);
19813 }
19814 EOCP
19815         set try
19816         if eval $compile; then
19817                 yyy=`$run ./try`
19818                 case "$yyy" in
19819                 12345678901)
19820                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19821                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19822                         echo "We will use %qd."
19823                         ;;
19824                 esac
19825         fi
19826 fi
19827
19828 if $test X"$sPRId64" = X; then
19829         echo "Cannot figure out how to print 64-bit integers." >&4
19830 fi
19831 $rm_try
19832
19833 fi
19834
19835 case "$sPRId64" in
19836 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19837         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19838         ;;
19839 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19840         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19841         ;;
19842 esac
19843
19844 : Check format strings for internal types
19845 echo " "
19846 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19847
19848 if $test X"$ivsize" = X8; then
19849         ivdformat="$sPRId64"
19850         uvuformat="$sPRIu64"
19851         uvoformat="$sPRIo64"
19852         uvxformat="$sPRIx64"
19853         uvXUformat="$sPRIXU64"
19854 else
19855         if $test X"$ivsize" = X"$longsize"; then
19856                 ivdformat='"ld"'
19857                 uvuformat='"lu"'
19858                 uvoformat='"lo"'
19859                 uvxformat='"lx"'
19860                 uvXUformat='"lX"'
19861         else
19862                 if $test X"$ivsize" = X"$intsize"; then
19863                         ivdformat='"d"'
19864                         uvuformat='"u"'
19865                         uvoformat='"o"'
19866                         uvxformat='"x"'
19867                         uvXUformat='"X"'
19868                 else
19869                         : far out
19870                         if $test X"$ivsize" = X"$shortsize"; then
19871                                 ivdformat='"hd"'
19872                                 uvuformat='"hu"'
19873                                 uvoformat='"ho"'
19874                                 uvxformat='"hx"'
19875                                 uvXUformat='"hX"'
19876                         fi
19877                 fi
19878         fi
19879 fi
19880
19881 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19882         nveformat="$sPRIeldbl"
19883         nvfformat="$sPRIfldbl"
19884         nvgformat="$sPRIgldbl"
19885         nvEUformat="$sPRIEUldbl"
19886         nvFUformat="$sPRIFUldbl"
19887         nvGUformat="$sPRIGUldbl"
19888 else
19889         nveformat='"e"'
19890         nvfformat='"f"'
19891         nvgformat='"g"'
19892         nvEUformat='"E"'
19893         nvFUformat='"F"'
19894         nvGUformat='"G"'
19895 fi
19896
19897 case "$ivdformat" in
19898 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19899     exit 1
19900     ;;
19901 esac
19902
19903 : Check format string for GID
19904
19905 echo " "
19906 $echo "Checking the format string to be used for gids..." >&4
19907
19908 case "$gidsign" in
19909 -1)     if $test X"$gidsize" = X"$ivsize"; then
19910                 gidformat="$ivdformat"
19911         else
19912                 if $test X"$gidsize" = X"$longsize"; then
19913                         gidformat='"ld"'
19914                 else
19915                         if $test X"$gidsize" = X"$intsize"; then
19916                                 gidformat='"d"'
19917                         else
19918                                 if $test X"$gidsize" = X"$shortsize"; then
19919                                         gidformat='"hd"'
19920                                 fi
19921                         fi
19922                 fi
19923         fi
19924         ;;
19925 *)      if $test X"$gidsize" = X"$uvsize"; then
19926                 gidformat="$uvuformat"
19927         else
19928                 if $test X"$gidsize" = X"$longsize"; then
19929                         gidformat='"lu"'
19930                 else
19931                         if $test X"$gidsize" = X"$intsize"; then
19932                                 gidformat='"u"'
19933                         else
19934                                 if $test X"$gidsize" = X"$shortsize"; then
19935                                         gidformat='"hu"'
19936                                 fi
19937                         fi
19938                 fi
19939         fi
19940         ;;
19941 esac
19942
19943 : see if getgroups exists
19944 set getgroups d_getgrps
19945 eval $inlibc
19946
19947 : see if setgroups exists
19948 set setgroups d_setgrps
19949 eval $inlibc
19950
19951 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19952 echo " "
19953 case "$d_getgrps$d_setgrps" in
19954 *define*)
19955         case "$groupstype" in
19956         '') dflt="$gidtype" ;;
19957         *)  dflt="$groupstype" ;;
19958         esac
19959         $cat <<EOM
19960 What type of pointer is the second argument to getgroups() and setgroups()?
19961 Usually this is the same as group ids, $gidtype, but not always.
19962
19963 EOM
19964         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19965         . ./myread
19966         groupstype="$ans"
19967         ;;
19968 *)  groupstype="$gidtype";;
19969 esac
19970
19971 : MAD = Misc Attribute Definition
19972
19973 if $test $patchlevel -lt 9; then
19974 : MAD is not available in 5.8.x or earlier.
19975     ans=n;
19976 else
19977     case "$mad" in
19978     $define|true|[yY]*) dflt='y' ;;
19979     *)                  dflt='n' ;;
19980     esac
19981     cat <<EOM
19982
19983 Would you like to build with Misc Attribute Decoration? This is development
19984 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19985 overhead on the interpreter.
19986
19987 If this doesn't make any sense to you, just accept the default '$dflt'.
19988 EOM
19989     rp='Build Perl with MAD?'
19990     . ./myread
19991 fi
19992 case "$ans" in
19993 y|Y)    val="$define"
19994         madlyh='madly.h madly.act madly.tab'
19995         madlysrc='madly.c'
19996         madlyobj="madly$_o" ;;
19997 *)      val="$undef"
19998         madlyh=''
19999         madlysrc=''
20000         madlyobj='' ;;
20001 esac
20002 set mad
20003 eval $setvar
20004
20005 : check whether make sets MAKE
20006 echo " "
20007 echo "Checking if your $make program sets \$(MAKE)..." >&4
20008 case "$make_set_make" in
20009 '')
20010         $sed 's/^X //' > testmake.mak << 'EOF'
20011 Xall:
20012 X       @echo 'maketemp="$(MAKE)"'
20013 EOF
20014         case "`$make -f testmake.mak 2>/dev/null`" in
20015         *maketemp=*) make_set_make='#' ;;
20016         *)      make_set_make="MAKE=$make" ;;
20017         esac
20018         $rm -f testmake.mak
20019         ;;
20020 esac
20021 case "$make_set_make" in
20022 '#') echo "Yup, it does.";;
20023 *) echo "Nope, it doesn't.";;
20024 esac
20025
20026 : see what type is used for mode_t
20027 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20028 set mode_t modetype int stdio.h sys/types.h
20029 eval $typedef_ask
20030
20031 : see if we need va_copy
20032 echo " "
20033 case "$i_stdarg" in
20034 "$define")
20035         $cat >try.c <<EOCP
20036 #include <stdarg.h>
20037 #include <stdio.h>
20038 #$i_stdlib I_STDLIB
20039 #ifdef I_STDLIB
20040 #include <stdlib.h>
20041 #endif
20042 #include <signal.h>
20043
20044 int
20045 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20046 {
20047   return vfprintf(f, fmt, *valp);
20048 }
20049
20050 int
20051 myvfprintf(FILE *f, const  char *fmt, va_list val)
20052 {
20053   return ivfprintf(f, fmt, &val);
20054 }
20055
20056 int
20057 myprintf(char *fmt, ...)
20058 {
20059   va_list val;
20060   va_start(val, fmt);
20061   return myvfprintf(stdout, fmt, val);
20062 }
20063
20064 int
20065 main(int ac, char **av)
20066 {
20067   signal(SIGSEGV, exit);
20068
20069   myprintf("%s%cs all right, then\n", "that", '\'');
20070   exit(0);
20071 }
20072 EOCP
20073         set try
20074         if eval $compile && $run ./try 2>&1 >/dev/null; then
20075                 case "`$run ./try`" in
20076                 "that's all right, then")
20077                         okay=yes
20078                         ;;
20079                 esac
20080         fi
20081         case "$okay" in
20082         yes)    echo "It seems that you don't need va_copy()." >&4
20083                 need_va_copy="$undef"
20084                 ;;
20085         *)      echo "It seems that va_copy() or similar will be needed." >&4
20086                 need_va_copy="$define"
20087                 ;;
20088         esac
20089         $rm_try
20090         ;;
20091 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20092         ;;
20093 esac
20094
20095 : see what type is used for size_t
20096 rp="What is the type used for the length parameter for string functions?"
20097 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20098 eval $typedef_ask
20099
20100 : check for type of arguments to gethostbyaddr. 
20101 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20102         case "$d_gethbyaddr" in
20103         $define)
20104                 $cat <<EOM
20105
20106 Checking to see what type of arguments are accepted by gethostbyaddr().
20107 EOM
20108                 hdrs="$define sys/types.h
20109                         $d_socket sys/socket.h 
20110                         $i_niin netinet/in.h 
20111                         $i_netdb netdb.h
20112                         $i_unistd unistd.h"
20113                 : The first arg can 'char *' or 'void *'
20114                 : The second arg is some of integral type
20115                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20116                         for yyy in size_t long int; do
20117                                 case "$netdb_host_type" in
20118                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20119                                         if ./protochk "$try" $hdrs; then
20120                                                 echo "Your system accepts $xxx for the first arg."
20121                                                 echo "...and $yyy for the second arg."
20122                                                 netdb_host_type="$xxx"
20123                                                 netdb_hlen_type="$yyy"
20124                                         fi
20125                                         ;;
20126                                 esac
20127                         done
20128                 done
20129                 : In case none of those worked, prompt the user.
20130                 case "$netdb_host_type" in
20131                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20132                         dflt='char *'
20133                         . ./myread
20134                         netdb_host_type=$ans
20135                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20136                         dflt="$sizetype"
20137                         . ./myread
20138                         netdb_hlen_type=$ans
20139                         ;;
20140                 esac
20141                 ;;
20142         *)      : no gethostbyaddr, so pick harmless defaults
20143                 netdb_host_type='char *'
20144                 netdb_hlen_type="$sizetype"
20145                 ;;
20146         esac
20147         # Remove the "const" if needed. -- but then we'll have a 
20148         # prototype clash!
20149         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20150 fi
20151
20152 : check for type of argument to gethostbyname. 
20153 if test "X$netdb_name_type" = X ; then
20154         case "$d_gethbyname" in
20155         $define)
20156                 $cat <<EOM
20157
20158 Checking to see what type of argument is accepted by gethostbyname().
20159 EOM
20160                 hdrs="$define sys/types.h
20161                         $d_socket sys/socket.h 
20162                         $i_niin netinet/in.h 
20163                         $i_netdb netdb.h
20164                         $i_unistd unistd.h"
20165                 for xxx in "const char *" "char *"; do
20166                         case "$netdb_name_type" in
20167                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20168                                 if ./protochk "$try" $hdrs; then
20169                                         echo "Your system accepts $xxx."
20170                                         netdb_name_type="$xxx"
20171                                 fi
20172                                 ;;
20173                         esac
20174                 done
20175                 : In case none of those worked, prompt the user.
20176                 case "$netdb_name_type" in
20177                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20178                         dflt='char *'
20179                         . ./myread
20180                         netdb_name_type=$ans
20181                         ;;
20182                 esac
20183                 ;;
20184         *)      : no gethostbyname, so pick harmless default
20185                 netdb_name_type='char *'
20186                 ;;
20187         esac
20188 fi
20189
20190 : check for type of 1st argument to getnetbyaddr. 
20191 if test "X$netdb_net_type" = X ; then
20192         case "$d_getnbyaddr" in
20193         $define)
20194                 $cat <<EOM
20195
20196 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20197 EOM
20198                 hdrs="$define sys/types.h
20199                         $d_socket sys/socket.h 
20200                         $i_niin netinet/in.h 
20201                         $i_netdb netdb.h
20202                         $i_unistd unistd.h"
20203                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20204                         case "$netdb_net_type" in
20205                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20206                                 if ./protochk "$try" $hdrs; then
20207                                         echo "Your system accepts $xxx."
20208                                         netdb_net_type="$xxx"
20209                                 fi
20210                                 ;;
20211                         esac
20212                 done
20213                 : In case none of those worked, prompt the user.
20214                 case "$netdb_net_type" in
20215                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20216                         dflt='long'
20217                         . ./myread
20218                         netdb_net_type=$ans
20219                         ;;
20220                 esac
20221                 ;;
20222         *)      : no getnetbyaddr, so pick harmless default
20223                 netdb_net_type='long'
20224                 ;;
20225         esac
20226 fi
20227 : locate the preferred pager for this system
20228 fn=f/
20229 case "$pager" in
20230 '')
20231         dflt=''
20232         case "$pg" in
20233         /*) dflt=$pg;;
20234         [a-zA-Z]:/*) dflt=$pg;;
20235         esac
20236         case "$more" in
20237         /*) dflt=$more;;
20238         [a-zA-Z]:/*) dflt=$more;;
20239         esac
20240         case "$less" in
20241         /*) dflt=$less;;
20242         [a-zA-Z]:/*) dflt=$less;;
20243         esac
20244         case "$dflt" in
20245         '') dflt=/usr/ucb/more;;
20246         esac
20247         ;;
20248 *)      dflt="$pager"
20249         fn="f/($pager)"
20250         ;;
20251 esac
20252 echo " "
20253 rp='What pager is used on your system?'
20254 . ./getfile
20255 pager="$ans"
20256
20257 : see what type pids are declared as in the kernel
20258 rp="What is the type of process ids on this system?"
20259 set pid_t pidtype int stdio.h sys/types.h
20260 eval $typedef_ask
20261
20262 : see if ar generates random libraries by itself
20263 echo " "
20264 echo "Checking how to generate random libraries on your machine..." >&4
20265 echo 'int bar1() { return bar2(); }' > bar1.c
20266 echo 'int bar2() { return 2; }' > bar2.c
20267 $cat > foo.c <<EOP
20268 #$i_stdlib I_STDLIB
20269 #ifdef I_STDLIB
20270 #include <stdlib.h>
20271 #endif
20272 int main() { printf("%d\n", bar1()); exit(0); }
20273 EOP
20274 $cc $ccflags -c bar1.c >/dev/null 2>&1
20275 $cc $ccflags -c bar2.c >/dev/null 2>&1
20276 $cc $ccflags -c foo.c >/dev/null 2>&1
20277 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20278 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20279         $run ./foobar >/dev/null 2>&1; then
20280         echo "$ar appears to generate random libraries itself."
20281         orderlib=false
20282         if [ "X$ranlib" = "X" ]; then
20283             ranlib=":"
20284         fi
20285 elif $ar s bar$_a >/dev/null 2>&1 &&
20286         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20287         $run ./foobar >/dev/null 2>&1; then
20288                 echo "a table of contents needs to be added with '$ar s'."
20289                 orderlib=false
20290                 ranlib="$ar s"
20291 elif $ar ts bar$_a >/dev/null 2>&1 &&
20292         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20293         $run ./foobar >/dev/null 2>&1; then
20294                 echo "a table of contents needs to be added with '$ar ts'."
20295                 orderlib=false
20296                 ranlib="$ar ts"
20297 else
20298         case "$ranlib" in
20299         :) ranlib='';;
20300         '')
20301                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20302                 $test -f $ranlib || ranlib=''
20303                 ;;
20304         esac
20305         if $test -n "$ranlib"; then
20306                 echo "your system has '$ranlib'; we'll use that."
20307                 orderlib=false
20308         else
20309                 echo "your system doesn't seem to support random libraries"
20310                 echo "so we'll use lorder and tsort to order the libraries."
20311                 orderlib=true
20312                 ranlib=":"
20313         fi
20314 fi
20315 $rm -f foo* bar*
20316
20317 : see if this is a values.h system
20318 set values.h i_values
20319 eval $inhdr
20320
20321 : Check the max offset that gmtime and localtime accept
20322 echo "Checking max offsets that gmtime () accepts"
20323
20324 case $i_values in
20325     define) yyy="#include <values.h>" ;;
20326     *)      yyy="" ;;
20327     esac
20328
20329 case "$sGMTIME_min/$sGMTIME_max" in
20330     0/0|/)
20331         $cat >try.c <<EOCP
20332 #include <sys/types.h>
20333 #include <stdio.h>
20334 #include <time.h>
20335 $yyy
20336
20337 int i;
20338 struct tm *tmp;
20339 time_t pt;
20340
20341 void gm_check (time_t t, int min_year, int max_year)
20342 {
20343     tmp = gmtime (&t);
20344     if ( tmp == NULL ||
20345         /* Check tm_year overflow */
20346          tmp->tm_year < min_year || tmp->tm_year > max_year)
20347         tmp = NULL;
20348     else
20349         pt = t;
20350     } /* gm_check */
20351
20352 int check_max ()
20353 {
20354     tmp = NULL;
20355     pt  = 0;
20356 #ifdef MAXLONG
20357     gm_check (MAXLONG, 69, 0x7fffffff);
20358 #endif
20359     if (tmp == NULL || tmp->tm_year < 0) {
20360         for (i = 63; i >= 0; i--) {
20361             time_t x = pt | ((time_t)1 << i);
20362             if (x < 0 || x < pt) continue;
20363             gm_check (x, 69, 0x7fffffff);
20364             }
20365         }
20366     printf ("sGMTIME_max=%ld\n", pt);
20367     return (0);
20368     } /* check_max */
20369
20370 int check_min ()
20371 {
20372     tmp = NULL;
20373     pt  = 0;
20374 #ifdef MINLONG
20375     gm_check (MINLONG, -1900, 70);
20376 #endif
20377     if (tmp == NULL) {
20378         for (i = 36; i >= 0; i--) {
20379             time_t x = pt - ((time_t)1 << i);
20380             if (x > 0) continue;
20381             gm_check (x, -1900, 70);
20382             }
20383         }
20384     printf ("sGMTIME_min=%ld\n", pt);
20385     return (0);
20386     } /* check_min */
20387
20388 int main (int argc, char *argv[])
20389 {
20390     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20391     check_max ();
20392     check_min ();
20393     return (0);
20394     } /* main */
20395 EOCP
20396         set try
20397         if eval $compile; then
20398             eval `$run ./try`
20399         else
20400             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20401             fi
20402         $rm_try
20403         ;;
20404     esac
20405
20406 echo "Checking max offsets that localtime () accepts"
20407
20408 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20409     0/0|/)
20410         $cat >try.c <<EOCP
20411 #include <sys/types.h>
20412 #include <stdio.h>
20413 #include <time.h>
20414 $yyy
20415
20416 int i;
20417 struct tm *tmp;
20418 time_t pt;
20419
20420 void local_check (time_t t, int min_year, int max_year)
20421 {
20422     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20423         tmp = NULL;
20424     else
20425         tmp = localtime (&t);
20426     if ( tmp == NULL ||
20427         /* Check tm_year overflow */
20428          tmp->tm_year < min_year || tmp->tm_year > max_year)
20429         tmp = NULL;
20430     else
20431         pt = t;
20432     } /* local_check */
20433
20434 int check_max ()
20435 {
20436     tmp = NULL;
20437     pt  = 0;
20438 #ifdef MAXLONG
20439     local_check (MAXLONG, 69, 0x7fffffff);
20440 #endif
20441     if (tmp == NULL || tmp->tm_year < 0) {
20442         for (i = 63; i >= 0; i--) {
20443             time_t x = pt | ((time_t)1 << i);
20444             if (x < 0 || x < pt) continue;
20445             local_check (x, 69, 0x7fffffff);
20446             }
20447         }
20448     printf ("sLOCALTIME_max=%ld\n", pt);
20449     return (0);
20450    } /* check_max */
20451
20452 int check_min ()
20453 {
20454     tmp = NULL;
20455     pt  = 0;
20456 #ifdef MINLONG
20457     local_check (MINLONG, -1900, 70);
20458 #endif
20459     if (tmp == NULL) {
20460         for (i = 36; i >= 0; i--) {
20461             time_t x = pt - ((time_t)1 << i);
20462             if (x > 0) continue;
20463             local_check (x, -1900, 70);
20464             }
20465         }
20466     printf ("sLOCALTIME_min=%ld\n", pt);
20467     return (0);
20468     } /* check_min */
20469
20470 int main (int argc, char *argv[])
20471 {
20472     check_max ();
20473     check_min ();
20474     return (0);
20475     } /* main */
20476 EOCP
20477         set try
20478         if eval $compile; then
20479             eval `$run ./try`
20480         else
20481             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20482             fi
20483         $rm_try
20484         ;;
20485     esac
20486
20487 : check for type of arguments to select.
20488 case "$selecttype" in
20489 '') case "$d_select" in
20490         $define)
20491                 echo " "
20492                 $cat <<EOM
20493 Checking to see what type of arguments are accepted by select().
20494 EOM
20495                 hdrs="$define sys/types.h
20496                         $i_systime sys/time.h
20497                         $i_sysselct sys/select.h
20498                         $d_socket sys/socket.h"
20499                 : The first arg can be int, unsigned, or size_t
20500                 : The last arg may or may not be 'const'
20501                 val=''
20502                 : void pointer has been seen but using that
20503                 : breaks the selectminbits test
20504                 for xxx in 'fd_set *' 'int *'; do
20505                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20506                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20507                                         case "$val" in
20508                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20509                                                 if ./protochk "$try" $hdrs; then
20510                                                         echo "Your system accepts $xxx."
20511                                                         val="$xxx"
20512                                                 fi
20513                                                 ;;
20514                                         esac
20515                                 done
20516                         done
20517                 done
20518                 case "$val" in
20519                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20520                         case "$d_fd_set" in
20521                                 $define) dflt="fd_set *" ;;
20522                                 *)              dflt="int *" ;;
20523                         esac
20524                         . ./myread
20525                         val=$ans
20526                         ;;
20527                 esac
20528                 selecttype="$val"
20529                 ;;
20530         *)      : no select, so pick a harmless default
20531                 selecttype='int *'
20532                 ;;
20533         esac
20534         ;;
20535 esac
20536
20537 : check for the select 'width'
20538 case "$selectminbits" in
20539 '') safebits=`expr $ptrsize \* 8`
20540     case "$d_select" in
20541         $define)
20542                 $cat <<EOM
20543
20544 Checking to see on how many bits at a time your select() operates...
20545 EOM
20546                 $cat >try.c <<EOCP
20547 #include <sys/types.h>
20548 #$i_time I_TIME
20549 #$i_systime I_SYS_TIME
20550 #$i_systimek I_SYS_TIME_KERNEL
20551 #ifdef I_TIME
20552 #   include <time.h>
20553 #endif
20554 #ifdef I_SYS_TIME
20555 #   ifdef I_SYS_TIME_KERNEL
20556 #       define KERNEL
20557 #   endif
20558 #   include <sys/time.h>
20559 #   ifdef I_SYS_TIME_KERNEL
20560 #       undef KERNEL
20561 #   endif
20562 #endif
20563 #$i_sysselct I_SYS_SELECT
20564 #ifdef I_SYS_SELECT
20565 #include <sys/select.h>
20566 #endif
20567 #$d_socket HAS_SOCKET
20568 #ifdef HAS_SOCKET
20569 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20570 #endif
20571 #include <stdio.h>
20572 #$i_stdlib I_STDLIB
20573 #ifdef I_STDLIB
20574 #include <stdlib.h>
20575 #endif
20576 $selecttype b;
20577 #define S sizeof(*(b))
20578 #define MINBITS 64
20579 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20580 #define NBITS  (NBYTES * 8)
20581 int main() {
20582     char *s = (char *)malloc(NBYTES);
20583     struct timeval t;
20584     int i;
20585     FILE* fp;
20586     int fd;
20587
20588     if (!s)
20589         exit(1);
20590     fclose(stdin);
20591     fp = fopen("try.c", "r");
20592     if (fp == 0)
20593       exit(2);
20594     fd = fileno(fp);
20595     if (fd < 0)
20596       exit(3);
20597     b = ($selecttype)s;
20598     for (i = 0; i < NBITS; i++)
20599         FD_SET(i, b);
20600     t.tv_sec  = 0;
20601     t.tv_usec = 0;
20602     select(fd + 1, b, 0, 0, &t);
20603     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20604     free(s);
20605     printf("%d\n", i + 1);
20606     return 0;
20607 }
20608 EOCP
20609                 set try
20610                 if eval $compile_ok; then
20611                         selectminbits=`$run ./try`
20612                         case "$selectminbits" in
20613                         '')     cat >&4 <<EOM
20614 Cannot figure out on how many bits at a time your select() operates.
20615 I'll play safe and guess it is $safebits bits.
20616 EOM
20617                                 selectminbits=$safebits
20618                                 bits="$safebits bits"
20619                                 ;;
20620                         1)      bits="1 bit" ;;
20621                         *)      bits="$selectminbits bits" ;;
20622                         esac
20623                         echo "Your select() operates on $bits at a time." >&4
20624                 else
20625                         rp='What is the minimum number of bits your select() operates on?'
20626                         case "$byteorder" in
20627                         12345678)       dflt=64 ;;
20628                         1234)           dflt=32 ;;
20629                         *)              dflt=1  ;;
20630                         esac
20631                         . ./myread
20632                         val=$ans
20633                         selectminbits="$val"
20634                 fi
20635                 $rm_try
20636                 ;;
20637         *)      : no select, so pick a harmless default
20638                 selectminbits=$safebits
20639                 ;;
20640         esac
20641         ;;
20642 esac
20643
20644 : Trace out the files included by signal.h, then look for SIGxxx names.
20645 if [ "X$fieldn" = X ]; then
20646         : Just make some guesses.  We check them later.
20647         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20648 else
20649         xxx=`echo '#include <signal.h>' |
20650         $cppstdin $cppminus $cppflags 2>/dev/null |
20651         $grep '^[       ]*#.*include' |
20652         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20653                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20654 fi
20655 xxxfiles=''
20656 for xx in $xxx /dev/null ; do
20657         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20658 done
20659 case "$xxxfiles" in
20660 '')     xxxfiles=`./findhdr signal.h` ;;
20661 esac
20662 xxx=`awk '
20663 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20664         print substr($2, 4, 20)
20665 }
20666 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20667         print substr($3, 4, 20)
20668 }' $xxxfiles`
20669 : Append some common names just in case the awk scan failed.
20670 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20671 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20672 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20673 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20674 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20675
20676 : generate a few handy files for later
20677 $cat > signal.c <<EOCP
20678 #include <sys/types.h>
20679 #include <signal.h>
20680 #$i_stdlib I_STDLIB
20681 #ifdef I_STDLIB
20682 #include <stdlib.h>
20683 #endif
20684 #include <stdio.h>
20685 int main() {
20686
20687 /* Strange style to avoid deeply-nested #if/#else/#endif */
20688 #ifndef NSIG
20689 #  ifdef _NSIG
20690 #    define NSIG (_NSIG)
20691 #  endif
20692 #endif
20693
20694 #ifndef NSIG
20695 #  ifdef SIGMAX
20696 #    define NSIG (SIGMAX+1)
20697 #  endif
20698 #endif
20699
20700 #ifndef NSIG
20701 #  ifdef SIG_MAX
20702 #    define NSIG (SIG_MAX+1)
20703 #  endif
20704 #endif
20705
20706 #ifndef NSIG
20707 #  ifdef _SIG_MAX
20708 #    define NSIG (_SIG_MAX+1)
20709 #  endif
20710 #endif
20711
20712 #ifndef NSIG
20713 #  ifdef MAXSIG
20714 #    define NSIG (MAXSIG+1)
20715 #  endif
20716 #endif
20717
20718 #ifndef NSIG
20719 #  ifdef MAX_SIG
20720 #    define NSIG (MAX_SIG+1)
20721 #  endif
20722 #endif
20723
20724 #ifndef NSIG
20725 #  ifdef SIGARRAYSIZE
20726 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20727 #  endif
20728 #endif
20729
20730 #ifndef NSIG
20731 #  ifdef _sys_nsig
20732 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20733 #  endif
20734 #endif
20735
20736 /* Default to some arbitrary number that's big enough to get most
20737    of the common signals.
20738 */
20739 #ifndef NSIG
20740 #    define NSIG 50
20741 #endif
20742
20743 printf("NSIG %d\n", NSIG);
20744
20745 #ifndef JUST_NSIG
20746
20747 EOCP
20748
20749 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20750 {
20751         printf "#ifdef SIG"; printf $1; printf "\n"
20752         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20753         printf $1; printf ");\n"
20754         printf "#endif\n"
20755 }
20756 END {
20757         printf "#endif /* JUST_NSIG */\n";
20758         printf "exit(0);\n}\n";
20759 }
20760 ' >>signal.c
20761 $cat >signal.awk <<'EOP'
20762 BEGIN { ndups = 0 }
20763 $1 ~ /^NSIG$/ { nsig = $2 }
20764 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20765     if ($2 > maxsig) { maxsig = $2 }
20766     if (sig_name[$2]) {
20767         dup_name[ndups] = $1
20768         dup_num[ndups] = $2
20769         ndups++
20770     }
20771     else {
20772         sig_name[$2] = $1
20773         sig_num[$2] = $2
20774     }
20775 }
20776 END {
20777     if (nsig == 0) {
20778         nsig = maxsig + 1
20779     }
20780     printf("NSIG %d\n", nsig);
20781     for (n = 1; n < nsig; n++) {
20782         if (sig_name[n]) {
20783             printf("%s %d\n", sig_name[n], sig_num[n])
20784         }
20785         else {
20786             printf("NUM%d %d\n", n, n)
20787         }
20788     }
20789     for (n = 0; n < ndups; n++) {
20790         printf("%s %d\n", dup_name[n], dup_num[n])
20791     }
20792 }
20793 EOP
20794 $cat >signal_cmd <<EOS
20795 $startsh
20796 if $test -s signal.lst; then
20797     echo "Using your existing signal.lst file"
20798         exit 0
20799 fi
20800 xxx="$xxx"
20801 EOS
20802 $cat >>signal_cmd <<'EOS'
20803
20804 set signal
20805 if eval $compile_ok; then
20806         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20807                 $uniq | $awk -f signal.awk >signal.lst
20808 else
20809         echo "(I can't seem be able to compile the whole test program)" >&4
20810         echo "(I'll try it in little pieces.)" >&4
20811         set signal -DJUST_NSIG
20812         if eval $compile_ok; then
20813                 $run ./signal$_exe > signal.nsg
20814                 $cat signal.nsg
20815         else
20816                 echo "I can't seem to figure out how many signals you have." >&4
20817                 echo "Guessing 50." >&4
20818                 echo 'NSIG 50' > signal.nsg
20819         fi
20820         : Now look at all the signal names, one at a time.
20821         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20822                 $cat > signal.c <<EOCP
20823 #include <sys/types.h>
20824 #include <signal.h>
20825 #include <stdio.h>
20826 int main() {
20827 printf("$xx %d\n", SIG${xx});
20828 return 0;
20829 }
20830 EOCP
20831                 set signal
20832                 if eval $compile; then
20833                         echo "SIG${xx} found."
20834                         $run ./signal$_exe  >> signal.ls1
20835                 else
20836                         echo "SIG${xx} NOT found."
20837                 fi
20838         done
20839         if $test -s signal.ls1; then
20840                 $cat signal.nsg signal.ls1 |
20841                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20842         fi
20843
20844 fi
20845 if $test -s signal.lst; then
20846         :
20847 else
20848         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20849         echo 'kill -l' >signal
20850         set X `csh -f <signal`
20851         $rm -f signal
20852         shift
20853         case $# in
20854         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20855         esac
20856         echo $@ | $tr ' ' $trnl | \
20857             $awk '{ printf "%s %d\n", $1, ++s; }
20858                   END { printf "NSIG %d\n", ++s }' >signal.lst
20859 fi
20860 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20861 EOS
20862 chmod a+x signal_cmd
20863 $eunicefix signal_cmd
20864
20865 : generate list of signal names
20866 echo " "
20867 case "$sig_name_init" in
20868 '') doinit=yes ;;
20869 *)  case "$sig_num_init" in
20870     ''|*,*) doinit=yes ;;
20871     esac ;;
20872 esac
20873 case "$doinit" in
20874 yes)
20875         echo "Generating a list of signal names and numbers..." >&4
20876         . ./signal_cmd
20877         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20878         sig_name=`$awk 'BEGIN { printf "ZERO " }
20879                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20880         sig_num=`$awk  'BEGIN { printf "0 " }
20881                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20882         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20883                              !/^NSIG/   { printf "\"%s\", ", $1 }
20884                              END        { printf "0\n" }' signal.lst`
20885         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20886                              !/^NSIG/   { printf "%d, ", $2}
20887                              END        { printf "0\n"}' signal.lst`
20888         ;;
20889 esac
20890 echo "The following $sig_count signals are available:"
20891 echo " "
20892 echo $sig_name | $awk \
20893 'BEGIN { linelen = 0 }
20894 {
20895         for (i = 1; i <= NF; i++) {
20896                 name = "SIG" $i " "
20897                 linelen = linelen + length(name)
20898                 if (linelen > 70) {
20899                         printf "\n"
20900                         linelen = length(name)
20901                 }
20902                 printf "%s", name
20903         }
20904         printf "\n"
20905 }'
20906 sig_size=`echo $sig_name | awk '{print NF}'`
20907 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20908
20909 : Check size of size
20910 echo " "
20911 case "$sizetype" in
20912 *_t) zzz="$sizetype"    ;;
20913 *)   zzz="filesize"     ;;
20914 esac
20915 echo "Checking the size of $zzz..." >&4
20916 cat > try.c <<EOCP
20917 #include <sys/types.h>
20918 #include <stdio.h>
20919 #$i_stdlib I_STDLIB
20920 #ifdef I_STDLIB
20921 #include <stdlib.h>
20922 #endif
20923 int main() {
20924     printf("%d\n", (int)sizeof($sizetype));
20925     exit(0);
20926 }
20927 EOCP
20928 set try
20929 if eval $compile_ok; then
20930         yyy=`$run ./try`
20931         case "$yyy" in
20932         '')     sizesize=4
20933                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20934                 ;;
20935         *)      sizesize=$yyy
20936                 echo "Your $zzz size is $sizesize bytes."
20937                 ;;
20938         esac
20939 else
20940         sizesize=4
20941         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20942 fi
20943
20944
20945 : check for socklen_t
20946 echo " "
20947 echo "Checking to see if you have socklen_t..." >&4
20948 $cat >try.c <<EOCP
20949 #include <sys/types.h>
20950 #$d_socket HAS_SOCKET
20951 #ifdef HAS_SOCKET
20952 #include <sys/socket.h>
20953 #endif
20954 int main() { socklen_t x = 16; }
20955 EOCP
20956 set try
20957 if eval $compile; then
20958         val="$define"
20959         echo "You have socklen_t."
20960 else
20961         val="$undef"
20962         echo "You do not have socklen_t."
20963         case "$sizetype" in
20964         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20965         esac
20966 fi
20967 $rm_try
20968 set d_socklen_t
20969 eval $setvar
20970
20971 : see if this is a socks.h system
20972 set socks.h i_socks
20973 eval $inhdr
20974
20975 : check for type of the size argument to socket calls
20976 case "$d_socket" in
20977 "$define")
20978         $cat <<EOM
20979
20980 Checking to see what type is the last argument of accept().
20981 EOM
20982         yyy=''
20983         case "$d_socklen_t" in
20984         "$define") yyy="$yyy socklen_t"
20985         esac
20986         yyy="$yyy $sizetype int long unsigned"
20987         for xxx in $yyy; do
20988                 case "$socksizetype" in
20989                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20990                         case "$usesocks" in
20991                         "$define")
20992                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20993                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20994                                         socksizetype="$xxx"
20995                                 fi
20996                                 ;;
20997                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20998                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20999                                         socksizetype="$xxx"
21000                                 fi
21001                                 ;;
21002                         esac
21003                         ;;
21004                 esac
21005         done
21006 : In case none of those worked, prompt the user.
21007         case "$socksizetype" in
21008         '')     rp='What is the type for socket address structure sizes?'
21009                 dflt='int'
21010                 . ./myread
21011                 socksizetype=$ans
21012                 ;;
21013         esac
21014         ;;
21015 *)      : no sockets, so pick relatively harmless default
21016         socksizetype='int'
21017         ;;
21018 esac
21019
21020 : see what type is used for signed size_t
21021 set ssize_t ssizetype int stdio.h sys/types.h
21022 eval $typedef
21023 dflt="$ssizetype"
21024 $cat > try.c <<EOM
21025 #include <stdio.h>
21026 #$i_stdlib I_STDLIB
21027 #ifdef I_STDLIB
21028 #include <stdlib.h>
21029 #endif
21030 #include <sys/types.h>
21031 #define Size_t $sizetype
21032 #define SSize_t $dflt
21033 int main()
21034 {
21035         if (sizeof(Size_t) == sizeof(SSize_t))
21036                 printf("$dflt\n");
21037         else if (sizeof(Size_t) == sizeof(int))
21038                 printf("int\n");
21039         else
21040                 printf("long\n");
21041         exit(0);
21042 }
21043 EOM
21044 echo " "
21045 set try
21046 if eval $compile_ok && $run ./try > /dev/null; then
21047         ssizetype=`$run ./try`
21048         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21049 else
21050         $cat >&4 <<EOM
21051 Help! I can't compile and run the ssize_t test program: please enlighten me!
21052 (This is probably a misconfiguration in your system or libraries, and
21053 you really ought to fix it.  Still, I'll try anyway.)
21054
21055 I need a type that is the same size as $sizetype, but is guaranteed to
21056 be signed.  Common values are ssize_t, int and long.
21057
21058 EOM
21059         rp="What signed type is the same size as $sizetype?"
21060         . ./myread
21061         ssizetype="$ans"
21062 fi
21063 $rm_try
21064
21065 : see what type of char stdio uses.
21066 echo " "
21067 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21068 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21069         echo "Your stdio uses unsigned chars." >&4
21070         stdchar="unsigned char"
21071 else
21072         echo "Your stdio uses signed chars." >&4
21073         stdchar="char"
21074 fi
21075 $rm -f stdioh
21076
21077 : see what type uids are declared as in the kernel
21078 echo " "
21079 echo "Looking for the type for user ids returned by getuid()."
21080 set uid_t uidtype xxx stdio.h sys/types.h
21081 eval $typedef
21082 case "$uidtype" in
21083 xxx)
21084         xxx=`./findhdr sys/user.h`
21085         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21086         case $1 in
21087         unsigned) dflt="$1 $2" ;;
21088         *) dflt="$1" ;;
21089         esac
21090         ;;
21091 *) dflt="$uidtype";;
21092 esac
21093 case "$uidtype" in
21094 uid_t)  echo "uid_t found." ;;
21095 *)      rp="What is the type for user ids returned by getuid()?"
21096         . ./myread
21097         uidtype="$ans"
21098         ;;
21099 esac
21100
21101 : Check size of UID
21102 echo " "
21103 case "$uidtype" in
21104 *_t) zzz="$uidtype"     ;;
21105 *)   zzz="uid"          ;;
21106 esac
21107 echo "Checking the size of $zzz..." >&4
21108 cat > try.c <<EOCP
21109 #include <sys/types.h>
21110 #include <stdio.h>
21111 #$i_stdlib I_STDLIB
21112 #ifdef I_STDLIB
21113 #include <stdlib.h>
21114 #endif
21115 int main() {
21116     printf("%d\n", (int)sizeof($uidtype));
21117     exit(0);
21118 }
21119 EOCP
21120 set try
21121 if eval $compile_ok; then
21122         yyy=`$run ./try`
21123         case "$yyy" in
21124         '')     uidsize=4
21125                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21126                 ;;
21127         *)      uidsize=$yyy
21128                 echo "Your $zzz is $uidsize bytes long."
21129                 ;;
21130         esac
21131 else
21132         uidsize=4
21133         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21134 fi
21135
21136 : Check if UID is signed
21137 echo " "
21138 case "$uidtype" in
21139 *_t) zzz="$uidtype"     ;;
21140 *)   zzz="uid"          ;;
21141 esac
21142 echo "Checking the sign of $zzz..." >&4
21143 cat > try.c <<EOCP
21144 #include <sys/types.h>
21145 #include <stdio.h>
21146 int main() {
21147         $uidtype foo = -1;
21148         if (foo < 0)
21149                 printf("-1\n");
21150         else
21151                 printf("1\n");
21152 }
21153 EOCP
21154 set try
21155 if eval $compile; then
21156         yyy=`$run ./try`
21157         case "$yyy" in
21158         '')     uidsign=1
21159                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21160                 ;;
21161         *)      uidsign=$yyy
21162                 case "$uidsign" in
21163                  1) echo "Your $zzz is unsigned." ;;
21164                 -1) echo "Your $zzz is signed."   ;;
21165                 esac
21166                 ;;
21167         esac
21168 else
21169         uidsign=1
21170         echo "(I can't compile the test program--guessing unsigned.)" >&4
21171 fi
21172
21173
21174 : Check format string for UID
21175 echo " "
21176 $echo "Checking the format string to be used for uids..." >&4
21177
21178 case "$uidsign" in
21179 -1)     if $test X"$uidsize" = X"$ivsize"; then
21180                 uidformat="$ivdformat"
21181         else
21182                 if $test X"$uidsize" = X"$longsize"; then
21183                         uidformat='"ld"'
21184                 else
21185                         if $test X"$uidsize" = X"$intsize"; then
21186                                 uidformat='"d"'
21187                         else
21188                                 if $test X"$uidsize" = X"$shortsize"; then
21189                                         uidformat='"hd"'
21190                                 fi
21191                         fi
21192                 fi
21193         fi
21194         ;;
21195 *)      if $test X"$uidsize" = X"$uvsize"; then
21196                 uidformat="$uvuformat"
21197         else
21198                 if $test X"$uidsize" = X"$longsize"; then
21199                         uidformat='"lu"'
21200                 else
21201                         if $test X"$uidsize" = X"$intsize"; then
21202                                 uidformat='"u"'
21203                         else
21204                                 if $test X"$uidsize" = X"$shortsize"; then
21205                                         uidformat='"hu"'
21206                                 fi
21207                         fi
21208                 fi
21209         fi
21210         ;;
21211 esac
21212
21213 : Check if site customization support was requested
21214 case "$usesitecustomize" in
21215     $define|true|[Yy]*)
21216         usesitecustomize="$define"
21217         ;;
21218     *)
21219         usesitecustomize="$undef"
21220         ;;
21221     esac
21222
21223 : see if prototypes support variable argument declarations
21224 echo " "
21225 case "$prototype$i_stdarg" in
21226 $define$define)
21227         echo "It appears we'll be able to prototype varargs functions." >&4
21228         val="$define"
21229         ;;
21230 *)
21231         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21232         val="$undef"
21233         ;;
21234 esac
21235 set vaproto
21236 eval $setvar
21237
21238 : determine compiler compiler
21239 case "$yacc" in
21240 '')
21241         dflt=yacc;;
21242 *)
21243         dflt="$yacc";;
21244 esac
21245 echo " "
21246 comp='yacc'
21247 if $test -f "$byacc$_exe"; then
21248         dflt="$byacc"
21249         comp="byacc or $comp"
21250 fi
21251 if $test -f "$bison$_exe"; then
21252         comp="$comp or bison -y"
21253 fi
21254 rp="Which compiler compiler ($comp) shall I use?"
21255 . ./myread
21256 yacc="$ans"
21257 case "$yacc" in
21258 *bis*)
21259         case "$yacc" in
21260         *-y*) ;;
21261         *)
21262                 yacc="$yacc -y"
21263                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21264                 ;;
21265         esac
21266         ;;
21267 esac
21268
21269 : see if this is a assert.h system
21270 set assert.h i_assert
21271 eval $inhdr
21272
21273 : see if this is a fp.h system
21274 set fp.h i_fp
21275 eval $inhdr
21276
21277 : see if this is a fp_class.h system
21278 set fp_class.h i_fp_class
21279 eval $inhdr
21280
21281 : see if gdbm.h is available
21282 set gdbm.h t_gdbm
21283 eval $inhdr
21284 case "$t_gdbm" in
21285 $define)
21286         : see if gdbm_open exists
21287         set gdbm_open d_gdbm_open
21288         eval $inlibc
21289         case "$d_gdbm_open" in
21290         $undef)
21291                 t_gdbm="$undef"
21292                 echo "We won't be including <gdbm.h>"
21293                 ;;
21294         esac
21295         ;;
21296 esac
21297 val="$t_gdbm"
21298 set i_gdbm
21299 eval $setvar
21300
21301 : see if this is a ieeefp.h system
21302 case "$i_ieeefp" in
21303 '' ) set ieeefp.h i_ieeefp
21304      eval $inhdr
21305      ;;
21306 esac
21307
21308 : see if this is a libutil.h system
21309 set libutil.h i_libutil
21310 eval $inhdr
21311
21312 : see if mach cthreads are available
21313 if test "X$usethreads" = "X$define"; then
21314         set mach/cthreads.h i_machcthr
21315         eval $inhdr
21316 else
21317         i_machcthr="$undef"
21318 fi
21319
21320 : see if this is a mntent.h system
21321 set mntent.h i_mntent
21322 eval $inhdr
21323
21324 : see if net/errno.h is available
21325 val=''
21326 set net/errno.h val
21327 eval $inhdr
21328
21329 : Unfortunately, it causes problems on some systems.  Arrgh.
21330 case "$val" in
21331 $define)
21332         cat > try.c <<'EOM'
21333 #include <stdio.h>
21334 #include <errno.h>
21335 #include <net/errno.h>
21336 int func()
21337 {
21338         return ENOTSOCK;
21339 }
21340 EOM
21341         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21342                 echo "We'll be including <net/errno.h>." >&4
21343         else
21344                 echo "We won't be including <net/errno.h>." >&4
21345                 val="$undef"
21346         fi
21347         $rm_try
21348         ;;
21349 esac
21350 set i_neterrno
21351 eval $setvar
21352
21353 : see if netinet/tcp.h is available
21354 set netinet/tcp.h i_netinettcp
21355 eval $inhdr
21356
21357 : see if this is a poll.h system
21358 set poll.h i_poll
21359 eval $inhdr
21360
21361 : see if this is a prot.h system
21362 set prot.h i_prot
21363 eval $inhdr
21364
21365 : Preprocessor symbols
21366 echo " "
21367 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21368 $cat <<'EOSH' > Cppsym.know
21369 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21370 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21371 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21372 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21373 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21374 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21375 bull c cadmus clipper CMU COFF COMPILER_VERSION
21376 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21377 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21378 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21379 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21380 GLIBC GLIBC_MINOR
21381 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21382 H3050R H3050RX hbullx20 hcx host_mips
21383 hp200 hp300 hp700 HP700 hp800 hp9000
21384 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21385 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21386 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21387 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21388 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21389 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21390 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21391 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21392 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21393 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21394 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21395 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21396 MATH_HAS_NO_SIDE_EFFECTS
21397 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21398 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21399 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21400 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21401 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21402 NetBSD news1500 news1700 news1800 news1900 news3700
21403 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21404 ns32016 ns32332 ns32k nsc32000
21405 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21406 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21407 pc532 pdp11 PGC PIC plexus PORTAR posix
21408 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21409 POSIX_C_SOURCE POSIX_SOURCE POWER
21410 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21411 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21412 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21413 sony sony_news sonyrisc sparc sparclite spectrum
21414 stardent stdc STDC_EXT stratos sun sun3 sun386
21415 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21416 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21417 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21418 sysV68 sysV88 Tek4132 Tek4300 titan
21419 TM3200 TM5400 TM5600
21420 tower tower32 tower32_200 tower32_600 tower32_700
21421 tower32_800 tower32_850 tss
21422 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21423 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21424 unix UNIX95 UNIX99 unixpc unos
21425 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21426 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21427 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21428 USGr4 USGr4_2
21429 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21430 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21431 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21432 z8000
21433 EOSH
21434 # Maybe put other stuff here too.
21435 cat <<EOSH >>Cppsym.know
21436 $osname
21437 EOSH
21438 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21439 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21440 $cat Cppsym.know > Cppsym.c
21441 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21442 $rm -f Cppsym.a Cppsym.b Cppsym.c
21443 cat <<EOSH > Cppsym
21444 $startsh
21445 if $test \$# -gt 0; then
21446     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21447     if $test -s Cppsym.got; then
21448         $rm -f Cppsym.got
21449         exit 0
21450     fi
21451     $rm -f Cppsym.got
21452     exit 1
21453 else
21454     $tr " " "$trnl" | ./Cppsym.try
21455     exit 0
21456 fi
21457 EOSH
21458 chmod +x Cppsym
21459 $eunicefix Cppsym
21460 cat <<EOSH > Cppsym.try
21461 $startsh
21462 cat <<'EOCP' > try.c
21463 #include <stdio.h>
21464 #if cpp_stuff == 1
21465 #define STRINGIFY(a)    "a"
21466 #endif
21467 #if cpp_stuff == 42
21468 #define StGiFy(a)  #a
21469 #define STRINGIFY(a)    StGiFy(a)
21470 #endif
21471 #if $cpp_stuff != 1 && $cpp_stuff != 42
21472 #   include "Bletch: How does this C preprocessor stringify macros?"
21473 #endif
21474 int main() {
21475 EOCP
21476 $awk \\
21477 EOSH
21478 cat <<'EOSH' >> Cppsym.try
21479 'length($1) > 0 {
21480     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21481     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21482     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21483     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21484 }'       >> try.c
21485 echo 'return 0;}' >> try.c
21486 EOSH
21487 cat <<EOSH >> Cppsym.try
21488 ccflags="$ccflags"
21489 case "$osname-$gccversion" in
21490 irix-) ccflags="\$ccflags -woff 1178" ;;
21491 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21492 esac
21493 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21494 EOSH
21495 chmod +x Cppsym.try
21496 $eunicefix Cppsym.try
21497 ./Cppsym < Cppsym.know > Cppsym.true
21498 : Add in any linux cpp "predefined macros":
21499 case "$osname::$gccversion" in
21500   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21501     tHdrH=_tmpHdr
21502     rm -f $tHdrH'.h' $tHdrH
21503     touch $tHdrH'.h'
21504     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21505        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21506        if [ -s $tHdrH'_cppsym.real' ]; then
21507           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21508        fi
21509     fi
21510     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21511   ;;
21512 esac
21513 : now check the C compiler for additional symbols
21514 postprocess_cc_v=''
21515 case "$osname" in
21516 aix) postprocess_cc_v="|$tr , ' '" ;;
21517 esac
21518 $cat >ccsym <<EOS
21519 $startsh
21520 $cat >tmp.c <<EOF
21521 extern int foo;
21522 EOF
21523 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21524 do
21525         case "\$i" in
21526         -D*) echo "\$i" | $sed 's/^-D//';;
21527         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21528         esac
21529 done
21530 $rm_try
21531 EOS
21532 postprocess_cc_v=''
21533 chmod +x ccsym
21534 $eunicefix ccsym
21535 ./ccsym > ccsym1.raw
21536 if $test -s ccsym1.raw; then
21537        $sort ccsym1.raw | $uniq >ccsym.raw
21538 else
21539        mv ccsym1.raw ccsym.raw
21540 fi
21541
21542 $awk '/\=/ { print $0; next }
21543         { print $0"=1" }' ccsym.raw >ccsym.list
21544 $comm -13 Cppsym.true ccsym.list >ccsym.own
21545 $comm -12 Cppsym.true ccsym.list >ccsym.com
21546 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21547 also=''
21548 if $test -z ccsym.raw; then
21549         echo "Your C compiler doesn't seem to define any symbols!" >&4
21550         echo " "
21551         echo "However, your C preprocessor defines the following symbols:"
21552         $cat Cppsym.true
21553         ccsymbols=''
21554         cppsymbols=`$cat Cppsym.true`
21555         cppsymbols=`echo $cppsymbols`
21556         cppccsymbols="$cppsymbols"
21557 else
21558         if $test -s ccsym.com; then
21559                 echo "Your C compiler and pre-processor define these symbols:"
21560                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21561                 also='also '
21562                 symbols='ones'
21563                 cppccsymbols=`$cat ccsym.com`
21564                 cppccsymbols=`echo $cppccsymbols`
21565                 $test "$silent" || sleep 1
21566         fi
21567         if $test -s ccsym.cpp; then
21568                 $test "$also" && echo " "
21569                 echo "Your C pre-processor ${also}defines the following symbols:"
21570                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21571                 also='further '
21572                 cppsymbols=`$cat ccsym.cpp`
21573                 cppsymbols=`echo $cppsymbols`
21574                 $test "$silent" || sleep 1
21575         fi
21576         if $test -s ccsym.own; then
21577                 $test "$also" && echo " "
21578                 echo "Your C compiler ${also}defines the following cpp symbols:"
21579                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21580                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21581                 ccsymbols=`$cat ccsym.own`
21582                 ccsymbols=`echo $ccsymbols`
21583                 $test "$silent" || sleep 1
21584         fi
21585 fi
21586
21587 : see if this is a termio system
21588 val="$undef"
21589 val2="$undef"
21590 val3="$undef"
21591 if $test `./findhdr termios.h`; then
21592         set tcsetattr i_termios
21593         eval $inlibc
21594         val3="$i_termios"
21595 fi
21596 echo " "
21597 case "$val3" in
21598 "$define") echo "You have POSIX termios.h... good!" >&4;;
21599 *) if ./Cppsym pyr; then
21600                 case "`/bin/universe`" in
21601                 ucb) if $test `./findhdr sgtty.h`; then
21602                                 val2="$define"
21603                                 echo "<sgtty.h> found." >&4
21604                         else
21605                                 echo "System is pyramid with BSD universe."
21606                                 ./warn "<sgtty.h> not found--you could have problems."
21607                         fi;;
21608                 *) if $test `./findhdr termio.h`; then
21609                                 val="$define"
21610                                 echo "<termio.h> found." >&4
21611                         else
21612                                 echo "System is pyramid with USG universe."
21613                                 ./warn "<termio.h> not found--you could have problems."
21614                         fi;;
21615                 esac
21616         elif ./usg; then
21617                 if $test `./findhdr termio.h`; then
21618                         echo "<termio.h> found." >&4
21619                         val="$define"
21620                 elif $test `./findhdr sgtty.h`; then
21621                         echo "<sgtty.h> found." >&4
21622                         val2="$define"
21623                 else
21624                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21625                 fi
21626         else
21627                 if $test `./findhdr sgtty.h`; then
21628                         echo "<sgtty.h> found." >&4
21629                         val2="$define"
21630                 elif $test `./findhdr termio.h`; then
21631                         echo "<termio.h> found." >&4
21632                         val="$define"
21633                 else
21634                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21635                 fi
21636         fi;;
21637 esac
21638 set i_termio; eval $setvar
21639 val=$val2; set i_sgtty; eval $setvar
21640 val=$val3; set i_termios; eval $setvar
21641
21642 : see if stddef is available
21643 set stddef.h i_stddef
21644 eval $inhdr
21645
21646 : see if sys/access.h is available
21647 set sys/access.h i_sysaccess
21648 eval $inhdr
21649
21650 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21651 set sys/filio.h i_sysfilio
21652 eval $inhdr
21653 echo " "
21654 if $test `./findhdr sys/ioctl.h`; then
21655         val="$define"
21656         echo '<sys/ioctl.h> found.' >&4
21657 else
21658         val="$undef"
21659         if $test $i_sysfilio = "$define"; then
21660             echo '<sys/ioctl.h> NOT found.' >&4
21661         else
21662                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21663                 $test $i_termio = "$define" && xxx="termio.h"
21664                 $test $i_termios = "$define" && xxx="termios.h"
21665 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21666         fi
21667 fi
21668 set i_sysioctl
21669 eval $setvar
21670
21671 : see if socket ioctl defs are in sys/sockio.h
21672 echo " "
21673 xxx=`./findhdr sys/sockio.h`
21674 if $test "$xxx"; then
21675         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21676                 val="$define"
21677                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21678         else
21679                 val="$undef"
21680                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21681         fi
21682 else
21683         val="$undef"
21684         $cat <<EOM
21685 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21686 EOM
21687 fi
21688 set i_syssockio
21689 eval $setvar
21690
21691 : see if this is a syslog.h system
21692 set syslog.h i_syslog
21693 eval $inhdr
21694
21695 : see if this is a sys/mode.h system
21696 set sys/mode.h i_sysmode
21697 eval $inhdr
21698
21699 : see if there is a sys/poll.h file
21700 set sys/poll.h i_syspoll
21701 eval $inhdr
21702
21703 : see if sys/resource.h has to be included
21704 set sys/resource.h i_sysresrc
21705 eval $inhdr
21706
21707 : see if sys/security.h is available
21708 set sys/security.h i_syssecrt
21709 eval $inhdr
21710
21711 : see if this is a sys/statvfs.h system
21712 set sys/statvfs.h i_sysstatvfs
21713 eval $inhdr
21714
21715 : see if this is a sys/un.h system
21716 set sys/un.h i_sysun
21717 eval $inhdr
21718
21719 : see if this is a sys/utsname.h system
21720 set sys/utsname.h i_sysutsname
21721 eval $inhdr
21722
21723 : see if this is a syswait system
21724 set sys/wait.h i_syswait
21725 eval $inhdr
21726
21727 : see if this is a ustat.h system
21728 set ustat.h i_ustat
21729 eval $inhdr
21730
21731 : see if this is an utime system
21732 set utime.h i_utime
21733 eval $inhdr
21734
21735 : see if this is a vfork system
21736 case "$d_vfork" in
21737 "$define")
21738         set vfork.h i_vfork
21739         eval $inhdr
21740         ;;
21741 *)
21742         i_vfork="$undef"
21743         ;;
21744 esac
21745
21746 : Check extensions
21747 echo " "
21748 echo "Looking for extensions..." >&4
21749 : If we are using the old config.sh, known_extensions may contain
21750 : old or inaccurate or duplicate values.
21751 known_extensions=''
21752 nonxs_extensions=''
21753 : We do not use find because it might not be available.
21754 : We do not just use MANIFEST because the user may have dropped
21755 : some additional extensions into the source tree and expect them
21756 : to be built.
21757
21758 : Function to recursively find available extensions, ignoring DynaLoader
21759 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21760 : In 5.10.1 and later, extensions are stored in directories
21761 : like File-Glob instead of the older File/Glob/.
21762 find_extensions='
21763     for xxx in *; do
21764         case "$xxx" in
21765             DynaLoader|dynaload) ;;
21766             *)
21767             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21768             leaf=`echo $xxx | $sed -e s/.*-//`;
21769             if $test -d File; then
21770                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21771                     known_extensions="$known_extensions $1$this_ext";
21772                 elif $test -f $xxx/Makefile.PL; then
21773                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21774                 else
21775                     if $test -d $xxx -a $# -lt 10; then
21776                         set $1$xxx/ $*;
21777                         cd "$xxx";
21778                         eval $find_extensions;
21779                         cd ..;
21780                         shift;
21781                     fi;
21782                 fi;
21783             else
21784                 $ls -1 $xxx > $$.tmp;
21785                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21786                     known_extensions="$known_extensions $this_ext";
21787                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21788                     known_extensions="$known_extensions $this_ext";
21789                 elif $test -d $xxx; then
21790                     nonxs_extensions="$nonxs_extensions $this_ext";
21791                 fi;
21792                 $rm -f $$.tmp;
21793             fi
21794             ;;
21795         esac;
21796     done'
21797 tdir=`pwd`
21798 cd "$rsrc/cpan"
21799 set X
21800 shift
21801 eval $find_extensions
21802 cd "$rsrc/dist"
21803 set X
21804 shift
21805 eval $find_extensions
21806 cd "$rsrc/ext"
21807 set X
21808 shift
21809 eval $find_extensions
21810 if $test -d File-Glob; then
21811     : All ext/ flattened
21812 else
21813     # Special case:  Add in modules that nest beyond the first level.
21814     # Currently threads/shared and Hash/Util/FieldHash, since they are
21815     # not picked up by the recursive find above (and adding in general
21816     # recursive finding breaks SDBM_File/sdbm).
21817     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21818     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21819 fi
21820 set X $known_extensions
21821 shift
21822 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21823 set X $nonxs_extensions
21824 shift
21825 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21826 cd "$tdir"
21827
21828 : Now see which are supported on this system.
21829 avail_ext=''
21830 for xxx in $known_extensions ; do
21831         case "$xxx" in
21832         DB_File|db_file)
21833                 case "$i_db" in
21834                 $define) avail_ext="$avail_ext $xxx" ;;
21835                 esac
21836                 ;;
21837         GDBM_File|gdbm_fil)
21838                 case "$i_gdbm" in
21839                 $define) avail_ext="$avail_ext $xxx" ;;
21840                 esac
21841                 ;;
21842         I18N/Langinfo|i18n_lan)
21843                 case "$i_langinfo$d_nl_langinfo" in
21844                 $define$define) avail_ext="$avail_ext $xxx" ;;
21845                 esac
21846                 ;;
21847         IPC/SysV|ipc/sysv)
21848                 : XXX Do we need a useipcsysv variable here
21849                 case "${d_msg}${d_sem}${d_shm}" in
21850                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21851                 esac
21852                 ;;
21853         NDBM_File|ndbm_fil)
21854                 case "$d_ndbm" in
21855                 $define)
21856                     case "$osname-$use64bitint" in
21857                     hpux-define)
21858                         case "$libs" in
21859                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21860                         esac
21861                         ;;
21862                     *) avail_ext="$avail_ext $xxx" ;;
21863                     esac
21864                     ;;
21865                 esac
21866                 ;;
21867         ODBM_File|odbm_fil)
21868                 case "${i_dbm}${i_rpcsvcdbm}" in
21869                 *"${define}"*)
21870                     case "$d_cplusplus" in
21871                     define) ;; # delete as a function name will not work
21872                     *)  case "$osname-$use64bitint" in
21873                         hpux-define)
21874                             case "$libs" in
21875                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21876                             esac
21877                             ;;
21878                         *) avail_ext="$avail_ext $xxx" ;;
21879                         esac
21880                         ;;
21881                     esac
21882                     ;;
21883                 esac
21884                 ;;
21885         Opcode|opcode)
21886                 case "$useopcode" in
21887                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21888                 esac
21889                 ;;
21890         POSIX|posix)
21891                 case "$useposix" in
21892                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21893                 esac
21894                 ;;
21895         Socket|socket)
21896                 case "$d_socket" in
21897                 true|$define|y)
21898                     case "$osname" in
21899                     beos) ;; # not unless BONE
21900                     *) avail_ext="$avail_ext $xxx" ;;
21901                     esac
21902                     ;;
21903                 esac
21904                 ;;
21905         Sys/Syslog|sys/syslog)
21906                 : XXX syslog requires socket
21907                 case "$d_socket" in
21908                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21909                 esac
21910                 ;;
21911         Thread|thread)
21912                 case "$usethreads" in
21913                 true|$define|y)
21914                         case "$use5005threads" in
21915                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21916                         esac
21917                 esac
21918                 ;;
21919         threads|threads/shared)
21920                 # threads and threads::shared are special cases.
21921                 # To stop people from asking "Perl 5.8.0 was supposed
21922                 # to have this new fancy threads implementation but my
21923                 # perl doesn't have it" and from people trying to
21924                 # (re)install the threads module using CPAN.pm and
21925                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21926                 # the threads.pm and threads/shared.pm will always be
21927                 # there, croaking informatively ("you need to rebuild
21928                 # all of Perl with threads, sorry") when threads haven't
21929                 # been compiled in.
21930                 # --jhi
21931                 avail_ext="$avail_ext $xxx"
21932                 ;;
21933         VMS*)
21934                 ;;
21935         Win32*)
21936                 case "$osname" in
21937                 cygwin) avail_ext="$avail_ext $xxx" ;;
21938                 esac
21939                 ;;
21940         XS/APItest|xs/apitest)
21941                 # This is just for testing.  Skip it unless we have dynamic loading.
21942
21943                 case "$usedl" in
21944                 $define) avail_ext="$avail_ext $xxx" ;;
21945                 esac
21946                 ;;
21947         XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21948                 # This is just for testing.  Skip it unless we have dynamic loading.
21949
21950                 case "$usedl" in
21951                 $define) avail_ext="$avail_ext $xxx" ;;
21952                 esac
21953                 ;;
21954         XS/Typemap|xs/typemap)
21955                 # This is just for testing.  Skip it unless we have dynamic loading.
21956                 case "$usedl" in
21957                 $define) avail_ext="$avail_ext $xxx" ;;
21958                 esac
21959                 ;;
21960         *)      avail_ext="$avail_ext $xxx"
21961                 ;;
21962         esac
21963 done
21964
21965 set X $avail_ext
21966 shift
21967 avail_ext="$*"
21968
21969 case "$onlyextensions" in
21970 '') ;;
21971 *)  keepextensions=''
21972     echo "You have requested that only certains extensions be included..." >&4
21973     for i in $onlyextensions; do
21974         case " $avail_ext " in
21975         *" $i "*)
21976             echo "Keeping extension $i."
21977             keepextensions="$keepextensions $i"
21978             ;;
21979         *) echo "Ignoring extension $i." ;;
21980         esac
21981     done
21982     avail_ext="$keepextensions"
21983     ;;
21984 esac
21985
21986 case "$noextensions" in
21987 '') ;;
21988 *)  keepextensions=''
21989     echo "You have requested that certain extensions be ignored..." >&4
21990     for i in $avail_ext; do
21991         case " $noextensions " in
21992         *" $i "*) echo "Ignoring extension $i." ;;
21993         *) echo "Keeping extension $i.";
21994            keepextensions="$keepextensions $i"
21995            ;;
21996         esac
21997     done
21998     avail_ext="$keepextensions"
21999     ;;
22000 esac
22001
22002 : Now see which nonxs extensions are supported on this system.
22003 : For now assume all are.
22004 nonxs_ext=''
22005 for xxx in $nonxs_extensions ; do
22006         case "$xxx" in
22007         *)      nonxs_ext="$nonxs_ext $xxx"
22008                 ;;
22009         esac
22010 done
22011
22012 set X $nonxs_ext
22013 shift
22014 nonxs_ext="$*"
22015
22016 case $usedl in
22017 $define)
22018         $cat <<EOM
22019 A number of extensions are supplied with $package.  You may choose to
22020 compile these extensions for dynamic loading (the default), compile
22021 them into the $package executable (static loading), or not include
22022 them at all.  Answer "none" to include no extensions.
22023 Note that DynaLoader is always built and need not be mentioned here.
22024
22025 EOM
22026         case "$dynamic_ext" in
22027         '')
22028                 : Exclude those listed in static_ext
22029                 dflt=''
22030                 for xxx in $avail_ext; do
22031                         case " $static_ext " in
22032                         *" $xxx "*) ;;
22033                         *) dflt="$dflt $xxx" ;;
22034                         esac
22035                 done
22036                 set X $dflt
22037                 shift
22038                 dflt="$*"
22039                 ;;
22040         *)      dflt="$dynamic_ext"
22041                 # Perhaps we are reusing an old out-of-date config.sh.
22042                 case "$hint" in
22043                 previous)
22044                         if test X"$dynamic_ext" != X"$avail_ext"; then
22045                                 $cat <<EOM
22046 NOTICE:  Your previous config.sh list may be incorrect.
22047 The extensions now available to you are
22048         ${avail_ext}
22049 but the default list from your previous config.sh is
22050         ${dynamic_ext}
22051
22052 EOM
22053                         fi
22054                         ;;
22055                 esac
22056                 ;;
22057         esac
22058         case "$dflt" in
22059         '')     dflt=none;;
22060         esac
22061         rp="What extensions do you wish to load dynamically?"
22062         . ./myread
22063         case "$ans" in
22064         none) dynamic_ext=' ' ;;
22065         *) dynamic_ext="$ans" ;;
22066         esac
22067
22068         case "$static_ext" in
22069         '')
22070                 : Exclude those already listed in dynamic linking
22071                 dflt=''
22072                 for xxx in $avail_ext; do
22073                         case " $dynamic_ext " in
22074                         *" $xxx "*) ;;
22075                         *) dflt="$dflt $xxx" ;;
22076                         esac
22077                 done
22078                 set X $dflt
22079                 shift
22080                 dflt="$*"
22081                 ;;
22082         *)  dflt="$static_ext"
22083                 ;;
22084         esac
22085
22086         case "$dflt" in
22087         '')     dflt=none;;
22088         esac
22089         rp="What extensions do you wish to load statically?"
22090         . ./myread
22091         case "$ans" in
22092         none) static_ext=' ' ;;
22093         *) static_ext="$ans" ;;
22094         esac
22095         ;;
22096 *)
22097         $cat <<EOM
22098 A number of extensions are supplied with $package.  Answer "none"
22099 to include no extensions.
22100 Note that DynaLoader is always built and need not be mentioned here.
22101
22102 EOM
22103         case "$static_ext" in
22104         '') dflt="$avail_ext" ;;
22105         *)      dflt="$static_ext"
22106                 # Perhaps we are reusing an old out-of-date config.sh.
22107                 case "$hint" in
22108                 previous)
22109                         if test X"$static_ext" != X"$avail_ext"; then
22110                                 $cat <<EOM
22111 NOTICE:  Your previous config.sh list may be incorrect.
22112 The extensions now available to you are
22113         ${avail_ext}
22114 but the default list from your previous config.sh is
22115         ${static_ext}
22116
22117 EOM
22118                         fi
22119                         ;;
22120                 esac
22121                 ;;
22122         esac
22123         : Exclude those that are not xs extensions
22124         case "$dflt" in
22125         '')     dflt=none;;
22126         esac
22127         rp="What extensions do you wish to include?"
22128         . ./myread
22129         case "$ans" in
22130         none) static_ext=' ' ;;
22131         *) static_ext="$ans" ;;
22132         esac
22133         ;;
22134 esac
22135 #
22136 # Encode is a special case.  If we are building Encode as a static
22137 # extension, we need to explicitly list its subextensions as well.
22138 # For other nested extensions, this is handled automatically by
22139 # the appropriate Makefile.PL.
22140 case " $static_ext " in
22141         *" Encode "*) # Add the subextensions of Encode
22142         cd "$rsrc/ext"
22143         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22144                 static_ext="$static_ext Encode/$xxx"
22145         done
22146         cd "$tdir"
22147         ;;
22148 esac
22149
22150 set X $dynamic_ext $static_ext $nonxs_ext
22151 shift
22152 extensions="$*"
22153
22154 # Sanity check:  We require an extension suitable for use with
22155 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22156 # should show up as failures in the test suite, but it's helpful to
22157 # catch them now.) The 'extensions' list is normally sorted
22158 # alphabetically, so we need to accept either
22159 #    DB_File ... Fcntl ... IO  ....
22160 # or something like
22161 #    Fcntl ... NDBM_File ... IO  ....
22162 case " $extensions"  in
22163 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22164 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22165 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22166 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22167    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22168    ;;
22169 esac
22170
22171 : Remove libraries needed only for extensions
22172 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22173 : The exception is SunOS 4.x, which needs them.
22174 case "${osname}X${osvers}" in
22175 sunos*X4*)
22176     perllibs="$libs"
22177     ;;
22178 *) case "$usedl" in
22179     $define|true|[yY]*)
22180             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22181             shift
22182             perllibs="$*"
22183             ;;
22184     *)  perllibs="$libs"
22185             ;;
22186     esac
22187     ;;
22188 esac
22189
22190 : Remove build directory name from cppstdin so it can be used from
22191 : either the present location or the final installed location.
22192 echo " "
22193 : Get out of the UU directory to get correct path name.
22194 cd ..
22195 case "$cppstdin" in
22196 `pwd`/cppstdin)
22197         echo "Stripping down cppstdin path name"
22198         cppstdin=cppstdin
22199         ;;
22200 esac
22201 cd UU
22202
22203 : end of configuration questions
22204 echo " "
22205 echo "End of configuration questions."
22206 echo " "
22207
22208 : back to where it started
22209 if test -d ../UU; then
22210         cd ..
22211 fi
22212
22213 : configuration may be unconditionally patched via a 'config.arch' file
22214 if $test -f config.arch; then
22215         echo "I see a config.arch file, loading it." >&4
22216         . ./config.arch
22217 fi
22218
22219 : configuration may be patched via a 'config.over' file
22220 if $test -f config.over; then
22221         echo " "
22222         dflt=y
22223         rp='I see a config.over file.  Do you wish to load it?'
22224         . UU/myread
22225         case "$ans" in
22226         n*) echo "OK, I'll ignore it.";;
22227         *)      . ./config.over
22228                 echo "Configuration override changes have been loaded."
22229                 ;;
22230         esac
22231 fi
22232
22233 : in case they want portability, strip down executable paths
22234 case "$d_portable" in
22235 "$define")
22236         echo " "
22237         echo "Stripping down executable paths..." >&4
22238         for file in $loclist $trylist; do
22239                 eval temp=\$$file
22240                 eval $file=`basename $temp`
22241         done
22242         ;;
22243 esac
22244
22245 : create config.sh file
22246 echo " "
22247 echo "Creating config.sh..." >&4
22248 $spitshell <<EOT >config.sh
22249 $startsh
22250 #
22251 # This file was produced by running the Configure script. It holds all the
22252 # definitions figured out by Configure. Should you modify one of these values,
22253 # do not forget to propagate your changes by running "Configure -der". You may
22254 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22255 #
22256
22257 # Package name      : $package
22258 # Source directory  : $src
22259 # Configuration time: $cf_time
22260 # Configured by     : $cf_by
22261 # Target system     : $myuname
22262
22263 EOT
22264 : Add in command line options if available
22265 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22266
22267 $spitshell <<EOT >>config.sh
22268
22269 Author='$Author'
22270 Date='$Date'
22271 Header='$Header'
22272 Id='$Id'
22273 Locker='$Locker'
22274 Log='$Log'
22275 RCSfile='$RCSfile'
22276 Revision='$Revision'
22277 Source='$Source'
22278 State='$State'
22279 _a='$_a'
22280 _exe='$_exe'
22281 _o='$_o'
22282 afs='$afs'
22283 afsroot='$afsroot'
22284 alignbytes='$alignbytes'
22285 ansi2knr='$ansi2knr'
22286 aphostname='$aphostname'
22287 api_revision='$api_revision'
22288 api_subversion='$api_subversion'
22289 api_version='$api_version'
22290 api_versionstring='$api_versionstring'
22291 ar='$ar'
22292 archlib='$archlib'
22293 archlibexp='$archlibexp'
22294 archname64='$archname64'
22295 archname='$archname'
22296 archobjs='$archobjs'
22297 asctime_r_proto='$asctime_r_proto'
22298 awk='$awk'
22299 baserev='$baserev'
22300 bash='$bash'
22301 bin='$bin'
22302 bin_ELF='$bin_ELF'
22303 binexp='$binexp'
22304 bison='$bison'
22305 byacc='$byacc'
22306 byteorder='$byteorder'
22307 c='$c'
22308 castflags='$castflags'
22309 cat='$cat'
22310 cc='$cc'
22311 cccdlflags='$cccdlflags'
22312 ccdlflags='$ccdlflags'
22313 ccflags='$ccflags'
22314 ccflags_uselargefiles='$ccflags_uselargefiles'
22315 ccname='$ccname'
22316 ccsymbols='$ccsymbols'
22317 ccversion='$ccversion'
22318 cf_by='$cf_by'
22319 cf_email='$cf_email'
22320 cf_time='$cf_time'
22321 charbits='$charbits'
22322 charsize='$charsize'
22323 chgrp='$chgrp'
22324 chmod='$chmod'
22325 chown='$chown'
22326 clocktype='$clocktype'
22327 comm='$comm'
22328 compress='$compress'
22329 contains='$contains'
22330 cp='$cp'
22331 cpio='$cpio'
22332 cpp='$cpp'
22333 cpp_stuff='$cpp_stuff'
22334 cppccsymbols='$cppccsymbols'
22335 cppflags='$cppflags'
22336 cpplast='$cpplast'
22337 cppminus='$cppminus'
22338 cpprun='$cpprun'
22339 cppstdin='$cppstdin'
22340 cppsymbols='$cppsymbols'
22341 crypt_r_proto='$crypt_r_proto'
22342 cryptlib='$cryptlib'
22343 csh='$csh'
22344 ctermid_r_proto='$ctermid_r_proto'
22345 ctime_r_proto='$ctime_r_proto'
22346 d_Gconvert='$d_Gconvert'
22347 d_PRIEUldbl='$d_PRIEUldbl'
22348 d_PRIFUldbl='$d_PRIFUldbl'
22349 d_PRIGUldbl='$d_PRIGUldbl'
22350 d_PRIXU64='$d_PRIXU64'
22351 d_PRId64='$d_PRId64'
22352 d_PRIeldbl='$d_PRIeldbl'
22353 d_PRIfldbl='$d_PRIfldbl'
22354 d_PRIgldbl='$d_PRIgldbl'
22355 d_PRIi64='$d_PRIi64'
22356 d_PRIo64='$d_PRIo64'
22357 d_PRIu64='$d_PRIu64'
22358 d_PRIx64='$d_PRIx64'
22359 d_SCNfldbl='$d_SCNfldbl'
22360 d__fwalk='$d__fwalk'
22361 d_access='$d_access'
22362 d_accessx='$d_accessx'
22363 d_aintl='$d_aintl'
22364 d_alarm='$d_alarm'
22365 d_archlib='$d_archlib'
22366 d_asctime64='$d_asctime64'
22367 d_asctime_r='$d_asctime_r'
22368 d_atolf='$d_atolf'
22369 d_atoll='$d_atoll'
22370 d_attribute_deprecated='$d_attribute_deprecated'
22371 d_attribute_format='$d_attribute_format'
22372 d_attribute_malloc='$d_attribute_malloc'
22373 d_attribute_nonnull='$d_attribute_nonnull'
22374 d_attribute_noreturn='$d_attribute_noreturn'
22375 d_attribute_pure='$d_attribute_pure'
22376 d_attribute_unused='$d_attribute_unused'
22377 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22378 d_bcmp='$d_bcmp'
22379 d_bcopy='$d_bcopy'
22380 d_bsd='$d_bsd'
22381 d_bsdgetpgrp='$d_bsdgetpgrp'
22382 d_bsdsetpgrp='$d_bsdsetpgrp'
22383 d_builtin_choose_expr='$d_builtin_choose_expr'
22384 d_builtin_expect='$d_builtin_expect'
22385 d_bzero='$d_bzero'
22386 d_c99_variadic_macros='$d_c99_variadic_macros'
22387 d_casti32='$d_casti32'
22388 d_castneg='$d_castneg'
22389 d_charvspr='$d_charvspr'
22390 d_chown='$d_chown'
22391 d_chroot='$d_chroot'
22392 d_chsize='$d_chsize'
22393 d_class='$d_class'
22394 d_clearenv='$d_clearenv'
22395 d_closedir='$d_closedir'
22396 d_cmsghdr_s='$d_cmsghdr_s'
22397 d_const='$d_const'
22398 d_copysignl='$d_copysignl'
22399 d_cplusplus='$d_cplusplus'
22400 d_crypt='$d_crypt'
22401 d_crypt_r='$d_crypt_r'
22402 d_csh='$d_csh'
22403 d_ctermid='$d_ctermid'
22404 d_ctermid_r='$d_ctermid_r'
22405 d_ctime64='$d_ctime64'
22406 d_ctime_r='$d_ctime_r'
22407 d_cuserid='$d_cuserid'
22408 d_dbl_dig='$d_dbl_dig'
22409 d_dbminitproto='$d_dbminitproto'
22410 d_difftime64='$d_difftime64'
22411 d_difftime='$d_difftime'
22412 d_dir_dd_fd='$d_dir_dd_fd'
22413 d_dirfd='$d_dirfd'
22414 d_dirnamlen='$d_dirnamlen'
22415 d_dlerror='$d_dlerror'
22416 d_dlopen='$d_dlopen'
22417 d_dlsymun='$d_dlsymun'
22418 d_dosuid='$d_dosuid'
22419 d_drand48_r='$d_drand48_r'
22420 d_drand48proto='$d_drand48proto'
22421 d_dup2='$d_dup2'
22422 d_eaccess='$d_eaccess'
22423 d_endgrent='$d_endgrent'
22424 d_endgrent_r='$d_endgrent_r'
22425 d_endhent='$d_endhent'
22426 d_endhostent_r='$d_endhostent_r'
22427 d_endnent='$d_endnent'
22428 d_endnetent_r='$d_endnetent_r'
22429 d_endpent='$d_endpent'
22430 d_endprotoent_r='$d_endprotoent_r'
22431 d_endpwent='$d_endpwent'
22432 d_endpwent_r='$d_endpwent_r'
22433 d_endsent='$d_endsent'
22434 d_endservent_r='$d_endservent_r'
22435 d_eofnblk='$d_eofnblk'
22436 d_eunice='$d_eunice'
22437 d_faststdio='$d_faststdio'
22438 d_fchdir='$d_fchdir'
22439 d_fchmod='$d_fchmod'
22440 d_fchown='$d_fchown'
22441 d_fcntl='$d_fcntl'
22442 d_fcntl_can_lock='$d_fcntl_can_lock'
22443 d_fd_macros='$d_fd_macros'
22444 d_fd_set='$d_fd_set'
22445 d_fds_bits='$d_fds_bits'
22446 d_fgetpos='$d_fgetpos'
22447 d_finite='$d_finite'
22448 d_finitel='$d_finitel'
22449 d_flexfnam='$d_flexfnam'
22450 d_flock='$d_flock'
22451 d_flockproto='$d_flockproto'
22452 d_fork='$d_fork'
22453 d_fp_class='$d_fp_class'
22454 d_fpathconf='$d_fpathconf'
22455 d_fpclass='$d_fpclass'
22456 d_fpclassify='$d_fpclassify'
22457 d_fpclassl='$d_fpclassl'
22458 d_fpos64_t='$d_fpos64_t'
22459 d_frexpl='$d_frexpl'
22460 d_fs_data_s='$d_fs_data_s'
22461 d_fseeko='$d_fseeko'
22462 d_fsetpos='$d_fsetpos'
22463 d_fstatfs='$d_fstatfs'
22464 d_fstatvfs='$d_fstatvfs'
22465 d_fsync='$d_fsync'
22466 d_ftello='$d_ftello'
22467 d_ftime='$d_ftime'
22468 d_futimes='$d_futimes'
22469 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22470 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22471 d_getaddrinfo='$d_getaddrinfo'
22472 d_getcwd='$d_getcwd'
22473 d_getespwnam='$d_getespwnam'
22474 d_getfsstat='$d_getfsstat'
22475 d_getgrent='$d_getgrent'
22476 d_getgrent_r='$d_getgrent_r'
22477 d_getgrgid_r='$d_getgrgid_r'
22478 d_getgrnam_r='$d_getgrnam_r'
22479 d_getgrps='$d_getgrps'
22480 d_gethbyaddr='$d_gethbyaddr'
22481 d_gethbyname='$d_gethbyname'
22482 d_gethent='$d_gethent'
22483 d_gethname='$d_gethname'
22484 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22485 d_gethostbyname_r='$d_gethostbyname_r'
22486 d_gethostent_r='$d_gethostent_r'
22487 d_gethostprotos='$d_gethostprotos'
22488 d_getitimer='$d_getitimer'
22489 d_getlogin='$d_getlogin'
22490 d_getlogin_r='$d_getlogin_r'
22491 d_getmnt='$d_getmnt'
22492 d_getmntent='$d_getmntent'
22493 d_getnameinfo='$d_getnameinfo'
22494 d_getnbyaddr='$d_getnbyaddr'
22495 d_getnbyname='$d_getnbyname'
22496 d_getnent='$d_getnent'
22497 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22498 d_getnetbyname_r='$d_getnetbyname_r'
22499 d_getnetent_r='$d_getnetent_r'
22500 d_getnetprotos='$d_getnetprotos'
22501 d_getpagsz='$d_getpagsz'
22502 d_getpbyname='$d_getpbyname'
22503 d_getpbynumber='$d_getpbynumber'
22504 d_getpent='$d_getpent'
22505 d_getpgid='$d_getpgid'
22506 d_getpgrp2='$d_getpgrp2'
22507 d_getpgrp='$d_getpgrp'
22508 d_getppid='$d_getppid'
22509 d_getprior='$d_getprior'
22510 d_getprotobyname_r='$d_getprotobyname_r'
22511 d_getprotobynumber_r='$d_getprotobynumber_r'
22512 d_getprotoent_r='$d_getprotoent_r'
22513 d_getprotoprotos='$d_getprotoprotos'
22514 d_getprpwnam='$d_getprpwnam'
22515 d_getpwent='$d_getpwent'
22516 d_getpwent_r='$d_getpwent_r'
22517 d_getpwnam_r='$d_getpwnam_r'
22518 d_getpwuid_r='$d_getpwuid_r'
22519 d_getsbyname='$d_getsbyname'
22520 d_getsbyport='$d_getsbyport'
22521 d_getsent='$d_getsent'
22522 d_getservbyname_r='$d_getservbyname_r'
22523 d_getservbyport_r='$d_getservbyport_r'
22524 d_getservent_r='$d_getservent_r'
22525 d_getservprotos='$d_getservprotos'
22526 d_getspnam='$d_getspnam'
22527 d_getspnam_r='$d_getspnam_r'
22528 d_gettimeod='$d_gettimeod'
22529 d_gmtime64='$d_gmtime64'
22530 d_gmtime_r='$d_gmtime_r'
22531 d_gnulibc='$d_gnulibc'
22532 d_grpasswd='$d_grpasswd'
22533 d_hasmntopt='$d_hasmntopt'
22534 d_htonl='$d_htonl'
22535 d_ilogbl='$d_ilogbl'
22536 d_inc_version_list='$d_inc_version_list'
22537 d_index='$d_index'
22538 d_inetaton='$d_inetaton'
22539 d_inetntop='$d_inetntop'
22540 d_inetpton='$d_inetpton'
22541 d_int64_t='$d_int64_t'
22542 d_isascii='$d_isascii'
22543 d_isfinite='$d_isfinite'
22544 d_isinf='$d_isinf'
22545 d_isnan='$d_isnan'
22546 d_isnanl='$d_isnanl'
22547 d_killpg='$d_killpg'
22548 d_lchown='$d_lchown'
22549 d_ldbl_dig='$d_ldbl_dig'
22550 d_libm_lib_version='$d_libm_lib_version'
22551 d_link='$d_link'
22552 d_localtime64='$d_localtime64'
22553 d_localtime_r='$d_localtime_r'
22554 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22555 d_locconv='$d_locconv'
22556 d_lockf='$d_lockf'
22557 d_longdbl='$d_longdbl'
22558 d_longlong='$d_longlong'
22559 d_lseekproto='$d_lseekproto'
22560 d_lstat='$d_lstat'
22561 d_madvise='$d_madvise'
22562 d_malloc_good_size='$d_malloc_good_size'
22563 d_malloc_size='$d_malloc_size'
22564 d_mblen='$d_mblen'
22565 d_mbstowcs='$d_mbstowcs'
22566 d_mbtowc='$d_mbtowc'
22567 d_memchr='$d_memchr'
22568 d_memcmp='$d_memcmp'
22569 d_memcpy='$d_memcpy'
22570 d_memmove='$d_memmove'
22571 d_memset='$d_memset'
22572 d_mkdir='$d_mkdir'
22573 d_mkdtemp='$d_mkdtemp'
22574 d_mkfifo='$d_mkfifo'
22575 d_mkstemp='$d_mkstemp'
22576 d_mkstemps='$d_mkstemps'
22577 d_mktime64='$d_mktime64'
22578 d_mktime='$d_mktime'
22579 d_mmap='$d_mmap'
22580 d_modfl='$d_modfl'
22581 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22582 d_modflproto='$d_modflproto'
22583 d_mprotect='$d_mprotect'
22584 d_msg='$d_msg'
22585 d_msg_ctrunc='$d_msg_ctrunc'
22586 d_msg_dontroute='$d_msg_dontroute'
22587 d_msg_oob='$d_msg_oob'
22588 d_msg_peek='$d_msg_peek'
22589 d_msg_proxy='$d_msg_proxy'
22590 d_msgctl='$d_msgctl'
22591 d_msgget='$d_msgget'
22592 d_msghdr_s='$d_msghdr_s'
22593 d_msgrcv='$d_msgrcv'
22594 d_msgsnd='$d_msgsnd'
22595 d_msync='$d_msync'
22596 d_munmap='$d_munmap'
22597 d_mymalloc='$d_mymalloc'
22598 d_ndbm='$d_ndbm'
22599 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22600 d_nice='$d_nice'
22601 d_nl_langinfo='$d_nl_langinfo'
22602 d_nv_preserves_uv='$d_nv_preserves_uv'
22603 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22604 d_off64_t='$d_off64_t'
22605 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22606 d_oldpthreads='$d_oldpthreads'
22607 d_oldsock='$d_oldsock'
22608 d_open3='$d_open3'
22609 d_pathconf='$d_pathconf'
22610 d_pause='$d_pause'
22611 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22612 d_phostname='$d_phostname'
22613 d_pipe='$d_pipe'
22614 d_poll='$d_poll'
22615 d_portable='$d_portable'
22616 d_printf_format_null='$d_printf_format_null'
22617 d_procselfexe='$d_procselfexe'
22618 d_pseudofork='$d_pseudofork'
22619 d_pthread_atfork='$d_pthread_atfork'
22620 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22621 d_pthread_yield='$d_pthread_yield'
22622 d_pwage='$d_pwage'
22623 d_pwchange='$d_pwchange'
22624 d_pwclass='$d_pwclass'
22625 d_pwcomment='$d_pwcomment'
22626 d_pwexpire='$d_pwexpire'
22627 d_pwgecos='$d_pwgecos'
22628 d_pwpasswd='$d_pwpasswd'
22629 d_pwquota='$d_pwquota'
22630 d_qgcvt='$d_qgcvt'
22631 d_quad='$d_quad'
22632 d_random_r='$d_random_r'
22633 d_readdir64_r='$d_readdir64_r'
22634 d_readdir='$d_readdir'
22635 d_readdir_r='$d_readdir_r'
22636 d_readlink='$d_readlink'
22637 d_readv='$d_readv'
22638 d_recvmsg='$d_recvmsg'
22639 d_rename='$d_rename'
22640 d_rewinddir='$d_rewinddir'
22641 d_rmdir='$d_rmdir'
22642 d_safebcpy='$d_safebcpy'
22643 d_safemcpy='$d_safemcpy'
22644 d_sanemcmp='$d_sanemcmp'
22645 d_sbrkproto='$d_sbrkproto'
22646 d_scalbnl='$d_scalbnl'
22647 d_sched_yield='$d_sched_yield'
22648 d_scm_rights='$d_scm_rights'
22649 d_seekdir='$d_seekdir'
22650 d_select='$d_select'
22651 d_sem='$d_sem'
22652 d_semctl='$d_semctl'
22653 d_semctl_semid_ds='$d_semctl_semid_ds'
22654 d_semctl_semun='$d_semctl_semun'
22655 d_semget='$d_semget'
22656 d_semop='$d_semop'
22657 d_sendmsg='$d_sendmsg'
22658 d_setegid='$d_setegid'
22659 d_seteuid='$d_seteuid'
22660 d_setgrent='$d_setgrent'
22661 d_setgrent_r='$d_setgrent_r'
22662 d_setgrps='$d_setgrps'
22663 d_sethent='$d_sethent'
22664 d_sethostent_r='$d_sethostent_r'
22665 d_setitimer='$d_setitimer'
22666 d_setlinebuf='$d_setlinebuf'
22667 d_setlocale='$d_setlocale'
22668 d_setlocale_r='$d_setlocale_r'
22669 d_setnent='$d_setnent'
22670 d_setnetent_r='$d_setnetent_r'
22671 d_setpent='$d_setpent'
22672 d_setpgid='$d_setpgid'
22673 d_setpgrp2='$d_setpgrp2'
22674 d_setpgrp='$d_setpgrp'
22675 d_setprior='$d_setprior'
22676 d_setproctitle='$d_setproctitle'
22677 d_setprotoent_r='$d_setprotoent_r'
22678 d_setpwent='$d_setpwent'
22679 d_setpwent_r='$d_setpwent_r'
22680 d_setregid='$d_setregid'
22681 d_setresgid='$d_setresgid'
22682 d_setresuid='$d_setresuid'
22683 d_setreuid='$d_setreuid'
22684 d_setrgid='$d_setrgid'
22685 d_setruid='$d_setruid'
22686 d_setsent='$d_setsent'
22687 d_setservent_r='$d_setservent_r'
22688 d_setsid='$d_setsid'
22689 d_setvbuf='$d_setvbuf'
22690 d_sfio='$d_sfio'
22691 d_shm='$d_shm'
22692 d_shmat='$d_shmat'
22693 d_shmatprototype='$d_shmatprototype'
22694 d_shmctl='$d_shmctl'
22695 d_shmdt='$d_shmdt'
22696 d_shmget='$d_shmget'
22697 d_sigaction='$d_sigaction'
22698 d_signbit='$d_signbit'
22699 d_sigprocmask='$d_sigprocmask'
22700 d_sigsetjmp='$d_sigsetjmp'
22701 d_sitearch='$d_sitearch'
22702 d_snprintf='$d_snprintf'
22703 d_sockatmark='$d_sockatmark'
22704 d_sockatmarkproto='$d_sockatmarkproto'
22705 d_socket='$d_socket'
22706 d_socklen_t='$d_socklen_t'
22707 d_sockpair='$d_sockpair'
22708 d_socks5_init='$d_socks5_init'
22709 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22710 d_sqrtl='$d_sqrtl'
22711 d_srand48_r='$d_srand48_r'
22712 d_srandom_r='$d_srandom_r'
22713 d_sresgproto='$d_sresgproto'
22714 d_sresuproto='$d_sresuproto'
22715 d_statblks='$d_statblks'
22716 d_statfs_f_flags='$d_statfs_f_flags'
22717 d_statfs_s='$d_statfs_s'
22718 d_statvfs='$d_statvfs'
22719 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22720 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22721 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22722 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22723 d_stdio_stream_array='$d_stdio_stream_array'
22724 d_stdiobase='$d_stdiobase'
22725 d_stdstdio='$d_stdstdio'
22726 d_strchr='$d_strchr'
22727 d_strcoll='$d_strcoll'
22728 d_strctcpy='$d_strctcpy'
22729 d_strerrm='$d_strerrm'
22730 d_strerror='$d_strerror'
22731 d_strerror_r='$d_strerror_r'
22732 d_strftime='$d_strftime'
22733 d_strlcat='$d_strlcat'
22734 d_strlcpy='$d_strlcpy'
22735 d_strtod='$d_strtod'
22736 d_strtol='$d_strtol'
22737 d_strtold='$d_strtold'
22738 d_strtoll='$d_strtoll'
22739 d_strtoq='$d_strtoq'
22740 d_strtoul='$d_strtoul'
22741 d_strtoull='$d_strtoull'
22742 d_strtouq='$d_strtouq'
22743 d_strxfrm='$d_strxfrm'
22744 d_suidsafe='$d_suidsafe'
22745 d_symlink='$d_symlink'
22746 d_syscall='$d_syscall'
22747 d_syscallproto='$d_syscallproto'
22748 d_sysconf='$d_sysconf'
22749 d_sysernlst='$d_sysernlst'
22750 d_syserrlst='$d_syserrlst'
22751 d_system='$d_system'
22752 d_tcgetpgrp='$d_tcgetpgrp'
22753 d_tcsetpgrp='$d_tcsetpgrp'
22754 d_telldir='$d_telldir'
22755 d_telldirproto='$d_telldirproto'
22756 d_time='$d_time'
22757 d_timegm='$d_timegm'
22758 d_times='$d_times'
22759 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22760 d_tm_tm_zone='$d_tm_tm_zone'
22761 d_tmpnam_r='$d_tmpnam_r'
22762 d_truncate='$d_truncate'
22763 d_ttyname_r='$d_ttyname_r'
22764 d_tzname='$d_tzname'
22765 d_u32align='$d_u32align'
22766 d_ualarm='$d_ualarm'
22767 d_umask='$d_umask'
22768 d_uname='$d_uname'
22769 d_union_semun='$d_union_semun'
22770 d_unordered='$d_unordered'
22771 d_unsetenv='$d_unsetenv'
22772 d_usleep='$d_usleep'
22773 d_usleepproto='$d_usleepproto'
22774 d_ustat='$d_ustat'
22775 d_vendorarch='$d_vendorarch'
22776 d_vendorbin='$d_vendorbin'
22777 d_vendorlib='$d_vendorlib'
22778 d_vendorscript='$d_vendorscript'
22779 d_vfork='$d_vfork'
22780 d_void_closedir='$d_void_closedir'
22781 d_voidsig='$d_voidsig'
22782 d_voidtty='$d_voidtty'
22783 d_volatile='$d_volatile'
22784 d_vprintf='$d_vprintf'
22785 d_vsnprintf='$d_vsnprintf'
22786 d_wait4='$d_wait4'
22787 d_waitpid='$d_waitpid'
22788 d_wcstombs='$d_wcstombs'
22789 d_wctomb='$d_wctomb'
22790 d_writev='$d_writev'
22791 d_xenix='$d_xenix'
22792 date='$date'
22793 db_hashtype='$db_hashtype'
22794 db_prefixtype='$db_prefixtype'
22795 db_version_major='$db_version_major'
22796 db_version_minor='$db_version_minor'
22797 db_version_patch='$db_version_patch'
22798 defvoidused='$defvoidused'
22799 direntrytype='$direntrytype'
22800 dlext='$dlext'
22801 dlsrc='$dlsrc'
22802 doublesize='$doublesize'
22803 drand01='$drand01'
22804 drand48_r_proto='$drand48_r_proto'
22805 dtrace='$dtrace'
22806 dynamic_ext='$dynamic_ext'
22807 eagain='$eagain'
22808 ebcdic='$ebcdic'
22809 echo='$echo'
22810 egrep='$egrep'
22811 emacs='$emacs'
22812 endgrent_r_proto='$endgrent_r_proto'
22813 endhostent_r_proto='$endhostent_r_proto'
22814 endnetent_r_proto='$endnetent_r_proto'
22815 endprotoent_r_proto='$endprotoent_r_proto'
22816 endpwent_r_proto='$endpwent_r_proto'
22817 endservent_r_proto='$endservent_r_proto'
22818 eunicefix='$eunicefix'
22819 exe_ext='$exe_ext'
22820 expr='$expr'
22821 extensions='$extensions'
22822 extern_C='$extern_C'
22823 extras='$extras'
22824 fflushNULL='$fflushNULL'
22825 fflushall='$fflushall'
22826 find='$find'
22827 firstmakefile='$firstmakefile'
22828 flex='$flex'
22829 fpossize='$fpossize'
22830 fpostype='$fpostype'
22831 freetype='$freetype'
22832 from='$from'
22833 full_ar='$full_ar'
22834 full_csh='$full_csh'
22835 full_sed='$full_sed'
22836 gccansipedantic='$gccansipedantic'
22837 gccosandvers='$gccosandvers'
22838 gccversion='$gccversion'
22839 getgrent_r_proto='$getgrent_r_proto'
22840 getgrgid_r_proto='$getgrgid_r_proto'
22841 getgrnam_r_proto='$getgrnam_r_proto'
22842 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22843 gethostbyname_r_proto='$gethostbyname_r_proto'
22844 gethostent_r_proto='$gethostent_r_proto'
22845 getlogin_r_proto='$getlogin_r_proto'
22846 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22847 getnetbyname_r_proto='$getnetbyname_r_proto'
22848 getnetent_r_proto='$getnetent_r_proto'
22849 getprotobyname_r_proto='$getprotobyname_r_proto'
22850 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22851 getprotoent_r_proto='$getprotoent_r_proto'
22852 getpwent_r_proto='$getpwent_r_proto'
22853 getpwnam_r_proto='$getpwnam_r_proto'
22854 getpwuid_r_proto='$getpwuid_r_proto'
22855 getservbyname_r_proto='$getservbyname_r_proto'
22856 getservbyport_r_proto='$getservbyport_r_proto'
22857 getservent_r_proto='$getservent_r_proto'
22858 getspnam_r_proto='$getspnam_r_proto'
22859 gidformat='$gidformat'
22860 gidsign='$gidsign'
22861 gidsize='$gidsize'
22862 gidtype='$gidtype'
22863 glibpth='$glibpth'
22864 gmake='$gmake'
22865 gmtime_r_proto='$gmtime_r_proto'
22866 gnulibc_version='$gnulibc_version'
22867 grep='$grep'
22868 groupcat='$groupcat'
22869 groupstype='$groupstype'
22870 gzip='$gzip'
22871 h_fcntl='$h_fcntl'
22872 h_sysfile='$h_sysfile'
22873 hint='$hint'
22874 hostcat='$hostcat'
22875 html1dir='$html1dir'
22876 html1direxp='$html1direxp'
22877 html3dir='$html3dir'
22878 html3direxp='$html3direxp'
22879 i16size='$i16size'
22880 i16type='$i16type'
22881 i32size='$i32size'
22882 i32type='$i32type'
22883 i64size='$i64size'
22884 i64type='$i64type'
22885 i8size='$i8size'
22886 i8type='$i8type'
22887 i_arpainet='$i_arpainet'
22888 i_assert='$i_assert'
22889 i_bsdioctl='$i_bsdioctl'
22890 i_crypt='$i_crypt'
22891 i_db='$i_db'
22892 i_dbm='$i_dbm'
22893 i_dirent='$i_dirent'
22894 i_dld='$i_dld'
22895 i_dlfcn='$i_dlfcn'
22896 i_fcntl='$i_fcntl'
22897 i_float='$i_float'
22898 i_fp='$i_fp'
22899 i_fp_class='$i_fp_class'
22900 i_gdbm='$i_gdbm'
22901 i_gdbm_ndbm='$i_gdbm_ndbm'
22902 i_gdbmndbm='$i_gdbmndbm'
22903 i_grp='$i_grp'
22904 i_ieeefp='$i_ieeefp'
22905 i_inttypes='$i_inttypes'
22906 i_langinfo='$i_langinfo'
22907 i_libutil='$i_libutil'
22908 i_limits='$i_limits'
22909 i_locale='$i_locale'
22910 i_machcthr='$i_machcthr'
22911 i_malloc='$i_malloc'
22912 i_mallocmalloc='$i_mallocmalloc'
22913 i_math='$i_math'
22914 i_memory='$i_memory'
22915 i_mntent='$i_mntent'
22916 i_ndbm='$i_ndbm'
22917 i_netdb='$i_netdb'
22918 i_neterrno='$i_neterrno'
22919 i_netinettcp='$i_netinettcp'
22920 i_niin='$i_niin'
22921 i_poll='$i_poll'
22922 i_prot='$i_prot'
22923 i_pthread='$i_pthread'
22924 i_pwd='$i_pwd'
22925 i_rpcsvcdbm='$i_rpcsvcdbm'
22926 i_sfio='$i_sfio'
22927 i_sgtty='$i_sgtty'
22928 i_shadow='$i_shadow'
22929 i_socks='$i_socks'
22930 i_stdarg='$i_stdarg'
22931 i_stddef='$i_stddef'
22932 i_stdlib='$i_stdlib'
22933 i_string='$i_string'
22934 i_sunmath='$i_sunmath'
22935 i_sysaccess='$i_sysaccess'
22936 i_sysdir='$i_sysdir'
22937 i_sysfile='$i_sysfile'
22938 i_sysfilio='$i_sysfilio'
22939 i_sysin='$i_sysin'
22940 i_sysioctl='$i_sysioctl'
22941 i_syslog='$i_syslog'
22942 i_sysmman='$i_sysmman'
22943 i_sysmode='$i_sysmode'
22944 i_sysmount='$i_sysmount'
22945 i_sysndir='$i_sysndir'
22946 i_sysparam='$i_sysparam'
22947 i_syspoll='$i_syspoll'
22948 i_sysresrc='$i_sysresrc'
22949 i_syssecrt='$i_syssecrt'
22950 i_sysselct='$i_sysselct'
22951 i_syssockio='$i_syssockio'
22952 i_sysstat='$i_sysstat'
22953 i_sysstatfs='$i_sysstatfs'
22954 i_sysstatvfs='$i_sysstatvfs'
22955 i_systime='$i_systime'
22956 i_systimek='$i_systimek'
22957 i_systimes='$i_systimes'
22958 i_systypes='$i_systypes'
22959 i_sysuio='$i_sysuio'
22960 i_sysun='$i_sysun'
22961 i_sysutsname='$i_sysutsname'
22962 i_sysvfs='$i_sysvfs'
22963 i_syswait='$i_syswait'
22964 i_termio='$i_termio'
22965 i_termios='$i_termios'
22966 i_time='$i_time'
22967 i_unistd='$i_unistd'
22968 i_ustat='$i_ustat'
22969 i_utime='$i_utime'
22970 i_values='$i_values'
22971 i_varargs='$i_varargs'
22972 i_varhdr='$i_varhdr'
22973 i_vfork='$i_vfork'
22974 ignore_versioned_solibs='$ignore_versioned_solibs'
22975 inc_version_list='$inc_version_list'
22976 inc_version_list_init='$inc_version_list_init'
22977 incpath='$incpath'
22978 inews='$inews'
22979 initialinstalllocation='$initialinstalllocation'
22980 installarchlib='$installarchlib'
22981 installbin='$installbin'
22982 installhtml1dir='$installhtml1dir'
22983 installhtml3dir='$installhtml3dir'
22984 installman1dir='$installman1dir'
22985 installman3dir='$installman3dir'
22986 installprefix='$installprefix'
22987 installprefixexp='$installprefixexp'
22988 installprivlib='$installprivlib'
22989 installscript='$installscript'
22990 installsitearch='$installsitearch'
22991 installsitebin='$installsitebin'
22992 installsitehtml1dir='$installsitehtml1dir'
22993 installsitehtml3dir='$installsitehtml3dir'
22994 installsitelib='$installsitelib'
22995 installsiteman1dir='$installsiteman1dir'
22996 installsiteman3dir='$installsiteman3dir'
22997 installsitescript='$installsitescript'
22998 installstyle='$installstyle'
22999 installusrbinperl='$installusrbinperl'
23000 installvendorarch='$installvendorarch'
23001 installvendorbin='$installvendorbin'
23002 installvendorhtml1dir='$installvendorhtml1dir'
23003 installvendorhtml3dir='$installvendorhtml3dir'
23004 installvendorlib='$installvendorlib'
23005 installvendorman1dir='$installvendorman1dir'
23006 installvendorman3dir='$installvendorman3dir'
23007 installvendorscript='$installvendorscript'
23008 intsize='$intsize'
23009 issymlink='$issymlink'
23010 ivdformat='$ivdformat'
23011 ivsize='$ivsize'
23012 ivtype='$ivtype'
23013 known_extensions='$known_extensions'
23014 ksh='$ksh'
23015 ld='$ld'
23016 lddlflags='$lddlflags'
23017 ldflags='$ldflags'
23018 ldflags_uselargefiles='$ldflags_uselargefiles'
23019 ldlibpthname='$ldlibpthname'
23020 less='$less'
23021 lib_ext='$lib_ext'
23022 libc='$libc'
23023 libperl='$libperl'
23024 libpth='$libpth'
23025 libs='$libs'
23026 libsdirs='$libsdirs'
23027 libsfiles='$libsfiles'
23028 libsfound='$libsfound'
23029 libspath='$libspath'
23030 libswanted='$libswanted'
23031 libswanted_uselargefiles='$libswanted_uselargefiles'
23032 line='$line'
23033 lint='$lint'
23034 lkflags='$lkflags'
23035 ln='$ln'
23036 lns='$lns'
23037 localtime_r_proto='$localtime_r_proto'
23038 locincpth='$locincpth'
23039 loclibpth='$loclibpth'
23040 longdblsize='$longdblsize'
23041 longlongsize='$longlongsize'
23042 longsize='$longsize'
23043 lp='$lp'
23044 lpr='$lpr'
23045 ls='$ls'
23046 lseeksize='$lseeksize'
23047 lseektype='$lseektype'
23048 mad='$mad'
23049 madlyh='$madlyh'
23050 madlyobj='$madlyobj'
23051 madlysrc='$madlysrc'
23052 mail='$mail'
23053 mailx='$mailx'
23054 make='$make'
23055 make_set_make='$make_set_make'
23056 mallocobj='$mallocobj'
23057 mallocsrc='$mallocsrc'
23058 malloctype='$malloctype'
23059 man1dir='$man1dir'
23060 man1direxp='$man1direxp'
23061 man1ext='$man1ext'
23062 man3dir='$man3dir'
23063 man3direxp='$man3direxp'
23064 man3ext='$man3ext'
23065 mips_type='$mips_type'
23066 mistrustnm='$mistrustnm'
23067 mkdir='$mkdir'
23068 mmaptype='$mmaptype'
23069 modetype='$modetype'
23070 more='$more'
23071 multiarch='$multiarch'
23072 mv='$mv'
23073 myarchname='$myarchname'
23074 mydomain='$mydomain'
23075 myhostname='$myhostname'
23076 myuname='$myuname'
23077 n='$n'
23078 need_va_copy='$need_va_copy'
23079 netdb_hlen_type='$netdb_hlen_type'
23080 netdb_host_type='$netdb_host_type'
23081 netdb_name_type='$netdb_name_type'
23082 netdb_net_type='$netdb_net_type'
23083 nm='$nm'
23084 nm_opt='$nm_opt'
23085 nm_so_opt='$nm_so_opt'
23086 nonxs_ext='$nonxs_ext'
23087 nroff='$nroff'
23088 nvEUformat='$nvEUformat'
23089 nvFUformat='$nvFUformat'
23090 nvGUformat='$nvGUformat'
23091 nv_overflows_integers_at='$nv_overflows_integers_at'
23092 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23093 nveformat='$nveformat'
23094 nvfformat='$nvfformat'
23095 nvgformat='$nvgformat'
23096 nvsize='$nvsize'
23097 nvtype='$nvtype'
23098 o_nonblock='$o_nonblock'
23099 obj_ext='$obj_ext'
23100 old_pthread_create_joinable='$old_pthread_create_joinable'
23101 optimize='$optimize'
23102 orderlib='$orderlib'
23103 osname='$osname'
23104 osvers='$osvers'
23105 otherlibdirs='$otherlibdirs'
23106 package='$package'
23107 pager='$pager'
23108 passcat='$passcat'
23109 patchlevel='$patchlevel'
23110 path_sep='$path_sep'
23111 perl5='$perl5'
23112 perl='$perl'
23113 perl_patchlevel='$perl_patchlevel'
23114 perladmin='$perladmin'
23115 perllibs='$perllibs'
23116 perlpath='$perlpath'
23117 pg='$pg'
23118 phostname='$phostname'
23119 pidtype='$pidtype'
23120 plibpth='$plibpth'
23121 pmake='$pmake'
23122 pr='$pr'
23123 prefix='$prefix'
23124 prefixexp='$prefixexp'
23125 privlib='$privlib'
23126 privlibexp='$privlibexp'
23127 procselfexe='$procselfexe'
23128 prototype='$prototype'
23129 ptrsize='$ptrsize'
23130 quadkind='$quadkind'
23131 quadtype='$quadtype'
23132 randbits='$randbits'
23133 randfunc='$randfunc'
23134 random_r_proto='$random_r_proto'
23135 randseedtype='$randseedtype'
23136 ranlib='$ranlib'
23137 rd_nodata='$rd_nodata'
23138 readdir64_r_proto='$readdir64_r_proto'
23139 readdir_r_proto='$readdir_r_proto'
23140 revision='$revision'
23141 rm='$rm'
23142 rm_try='$rm_try'
23143 rmail='$rmail'
23144 run='$run'
23145 runnm='$runnm'
23146 sGMTIME_max='$sGMTIME_max'
23147 sGMTIME_min='$sGMTIME_min'
23148 sLOCALTIME_max='$sLOCALTIME_max'
23149 sLOCALTIME_min='$sLOCALTIME_min'
23150 sPRIEUldbl='$sPRIEUldbl'
23151 sPRIFUldbl='$sPRIFUldbl'
23152 sPRIGUldbl='$sPRIGUldbl'
23153 sPRIXU64='$sPRIXU64'
23154 sPRId64='$sPRId64'
23155 sPRIeldbl='$sPRIeldbl'
23156 sPRIfldbl='$sPRIfldbl'
23157 sPRIgldbl='$sPRIgldbl'
23158 sPRIi64='$sPRIi64'
23159 sPRIo64='$sPRIo64'
23160 sPRIu64='$sPRIu64'
23161 sPRIx64='$sPRIx64'
23162 sSCNfldbl='$sSCNfldbl'
23163 sched_yield='$sched_yield'
23164 scriptdir='$scriptdir'
23165 scriptdirexp='$scriptdirexp'
23166 sed='$sed'
23167 seedfunc='$seedfunc'
23168 selectminbits='$selectminbits'
23169 selecttype='$selecttype'
23170 sendmail='$sendmail'
23171 setgrent_r_proto='$setgrent_r_proto'
23172 sethostent_r_proto='$sethostent_r_proto'
23173 setlocale_r_proto='$setlocale_r_proto'
23174 setnetent_r_proto='$setnetent_r_proto'
23175 setprotoent_r_proto='$setprotoent_r_proto'
23176 setpwent_r_proto='$setpwent_r_proto'
23177 setservent_r_proto='$setservent_r_proto'
23178 sh='$sh'
23179 shar='$shar'
23180 sharpbang='$sharpbang'
23181 shmattype='$shmattype'
23182 shortsize='$shortsize'
23183 shrpenv='$shrpenv'
23184 shsharp='$shsharp'
23185 sig_count='$sig_count'
23186 sig_name='$sig_name'
23187 sig_name_init='$sig_name_init'
23188 sig_num='$sig_num'
23189 sig_num_init='$sig_num_init'
23190 sig_size='$sig_size'
23191 signal_t='$signal_t'
23192 sitearch='$sitearch'
23193 sitearchexp='$sitearchexp'
23194 sitebin='$sitebin'
23195 sitebinexp='$sitebinexp'
23196 sitehtml1dir='$sitehtml1dir'
23197 sitehtml1direxp='$sitehtml1direxp'
23198 sitehtml3dir='$sitehtml3dir'
23199 sitehtml3direxp='$sitehtml3direxp'
23200 sitelib='$sitelib'
23201 sitelib_stem='$sitelib_stem'
23202 sitelibexp='$sitelibexp'
23203 siteman1dir='$siteman1dir'
23204 siteman1direxp='$siteman1direxp'
23205 siteman3dir='$siteman3dir'
23206 siteman3direxp='$siteman3direxp'
23207 siteprefix='$siteprefix'
23208 siteprefixexp='$siteprefixexp'
23209 sitescript='$sitescript'
23210 sitescriptexp='$sitescriptexp'
23211 sizesize='$sizesize'
23212 sizetype='$sizetype'
23213 sleep='$sleep'
23214 smail='$smail'
23215 so='$so'
23216 sockethdr='$sockethdr'
23217 socketlib='$socketlib'
23218 socksizetype='$socksizetype'
23219 sort='$sort'
23220 spackage='$spackage'
23221 spitshell='$spitshell'
23222 srand48_r_proto='$srand48_r_proto'
23223 srandom_r_proto='$srandom_r_proto'
23224 src='$src'
23225 ssizetype='$ssizetype'
23226 startperl='$startperl'
23227 startsh='$startsh'
23228 static_ext='$static_ext'
23229 stdchar='$stdchar'
23230 stdio_base='$stdio_base'
23231 stdio_bufsiz='$stdio_bufsiz'
23232 stdio_cnt='$stdio_cnt'
23233 stdio_filbuf='$stdio_filbuf'
23234 stdio_ptr='$stdio_ptr'
23235 stdio_stream_array='$stdio_stream_array'
23236 strerror_r_proto='$strerror_r_proto'
23237 strings='$strings'
23238 submit='$submit'
23239 subversion='$subversion'
23240 sysman='$sysman'
23241 tail='$tail'
23242 tar='$tar'
23243 targetarch='$targetarch'
23244 tbl='$tbl'
23245 tee='$tee'
23246 test='$test'
23247 timeincl='$timeincl'
23248 timetype='$timetype'
23249 tmpnam_r_proto='$tmpnam_r_proto'
23250 to='$to'
23251 touch='$touch'
23252 tr='$tr'
23253 trnl='$trnl'
23254 troff='$troff'
23255 ttyname_r_proto='$ttyname_r_proto'
23256 u16size='$u16size'
23257 u16type='$u16type'
23258 u32size='$u32size'
23259 u32type='$u32type'
23260 u64size='$u64size'
23261 u64type='$u64type'
23262 u8size='$u8size'
23263 u8type='$u8type'
23264 uidformat='$uidformat'
23265 uidsign='$uidsign'
23266 uidsize='$uidsize'
23267 uidtype='$uidtype'
23268 uname='$uname'
23269 uniq='$uniq'
23270 uquadtype='$uquadtype'
23271 use5005threads='$use5005threads'
23272 use64bitall='$use64bitall'
23273 use64bitint='$use64bitint'
23274 usecrosscompile='$usecrosscompile'
23275 usedevel='$usedevel'
23276 usedl='$usedl'
23277 usedtrace='$usedtrace'
23278 usefaststdio='$usefaststdio'
23279 useithreads='$useithreads'
23280 uselargefiles='$uselargefiles'
23281 uselongdouble='$uselongdouble'
23282 usemallocwrap='$usemallocwrap'
23283 usemorebits='$usemorebits'
23284 usemultiplicity='$usemultiplicity'
23285 usemymalloc='$usemymalloc'
23286 usenm='$usenm'
23287 useopcode='$useopcode'
23288 useperlio='$useperlio'
23289 useposix='$useposix'
23290 usereentrant='$usereentrant'
23291 userelocatableinc='$userelocatableinc'
23292 usesfio='$usesfio'
23293 useshrplib='$useshrplib'
23294 usesitecustomize='$usesitecustomize'
23295 usesocks='$usesocks'
23296 usethreads='$usethreads'
23297 usevendorprefix='$usevendorprefix'
23298 usevfork='$usevfork'
23299 usrinc='$usrinc'
23300 uuname='$uuname'
23301 uvXUformat='$uvXUformat'
23302 uvoformat='$uvoformat'
23303 uvsize='$uvsize'
23304 uvtype='$uvtype'
23305 uvuformat='$uvuformat'
23306 uvxformat='$uvxformat'
23307 vaproto='$vaproto'
23308 vendorarch='$vendorarch'
23309 vendorarchexp='$vendorarchexp'
23310 vendorbin='$vendorbin'
23311 vendorbinexp='$vendorbinexp'
23312 vendorhtml1dir='$vendorhtml1dir'
23313 vendorhtml1direxp='$vendorhtml1direxp'
23314 vendorhtml3dir='$vendorhtml3dir'
23315 vendorhtml3direxp='$vendorhtml3direxp'
23316 vendorlib='$vendorlib'
23317 vendorlib_stem='$vendorlib_stem'
23318 vendorlibexp='$vendorlibexp'
23319 vendorman1dir='$vendorman1dir'
23320 vendorman1direxp='$vendorman1direxp'
23321 vendorman3dir='$vendorman3dir'
23322 vendorman3direxp='$vendorman3direxp'
23323 vendorprefix='$vendorprefix'
23324 vendorprefixexp='$vendorprefixexp'
23325 vendorscript='$vendorscript'
23326 vendorscriptexp='$vendorscriptexp'
23327 version='$version'
23328 version_patchlevel_string='$version_patchlevel_string'
23329 versiononly='$versiononly'
23330 vi='$vi'
23331 voidflags='$voidflags'
23332 xlibpth='$xlibpth'
23333 yacc='$yacc'
23334 yaccflags='$yaccflags'
23335 zcat='$zcat'
23336 zip='$zip'
23337 EOT
23338
23339 : add special variables
23340 $test -f $src/patchlevel.h && \
23341 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23342 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23343 echo "PERL_CONFIG_SH=true" >>config.sh
23344
23345 : propagate old symbols
23346 if $test -f UU/config.sh; then
23347         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23348         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23349                 config.sh config.sh UU/oldconfig.sh |\
23350                 $sort | $uniq -u >UU/oldsyms
23351         set X `cat UU/oldsyms`
23352         shift
23353         case $# in
23354         0) ;;
23355         *)
23356                 cat <<EOM
23357 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23358 EOM
23359                 echo ": Variables propagated from previous config.sh file." >>config.sh
23360                 for sym in `cat UU/oldsyms`; do
23361                         echo "    Propagating $hint variable "'$'"$sym..."
23362                         eval 'tmp="$'"${sym}"'"'
23363                         echo "$tmp" | \
23364                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23365                 done
23366                 ;;
23367         esac
23368 fi
23369
23370 : Finish up by extracting the .SH files
23371 case "$alldone" in
23372 exit)
23373         $rm -rf UU
23374         echo "Extraction done."
23375         exit 0
23376         ;;
23377 cont)
23378         ;;
23379 '')
23380         dflt=''
23381         nostick=true
23382         $cat <<EOM
23383
23384 If you'd like to make any changes to the config.sh file before I begin
23385 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23386
23387 EOM
23388         rp="Press return or use a shell escape to edit config.sh:"
23389         . UU/myread
23390         nostick=''
23391         case "$ans" in
23392         '') ;;
23393         *) : in case they cannot read
23394                 sh 1>&4 -c "$ans";;
23395         esac
23396         ;;
23397 esac
23398
23399 : if this fails, just run all the .SH files by hand
23400 . ./config.sh
23401
23402 echo " "
23403 exec 1>&4
23404 pwd=`pwd`
23405 . ./UU/extract
23406 cd "$pwd"
23407
23408 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23409         dflt=y
23410         case "$silent" in
23411         true) ;;
23412         *)
23413                 $cat <<EOM
23414
23415 Now you need to generate make dependencies by running "$make depend".
23416 You might prefer to run it in background: "$make depend > makedepend.out &"
23417 It can take a while, so you might not want to run it right now.
23418
23419 EOM
23420                 ;;
23421         esac
23422         rp="Run $make depend now?"
23423         . UU/myread
23424         case "$ans" in
23425         y*)
23426                 $make depend && echo "Now you must run '$make'."
23427                 ;;
23428         *)
23429                 echo "You must run '$make depend' then '$make'."
23430                 ;;
23431         esac
23432 elif test -f [Mm]akefile; then
23433         echo " "
23434         echo "Now you must run a $make."
23435 else
23436         echo "Configure done."
23437 fi
23438
23439 if $test -f Policy.sh; then
23440     $cat <<EOM
23441
23442 If you compile $package on a different machine or from a different object
23443 directory, copy the Policy.sh file from this object directory to the
23444 new one before you run Configure -- this will help you with most of
23445 the policy defaults.
23446
23447 EOM
23448 fi
23449 if $test -f config.msg; then
23450     echo "Hmm.  I also noted the following information while running:"
23451     echo " "
23452     $cat config.msg >&4
23453     $rm -f config.msg
23454 fi
23455 $rm -f kit*isdone ark*isdone
23456 $rm -rf UU
23457
23458 : End of Configure
23459