This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove obsolete test for the deprecation warning I just removed.
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Sat Feb 10 17:48:04 CET 2007 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 if test ! -c /dev/null ; then
69         cat >&4 <<EOF
70 ***
71 *** I'm sorry, but /dev/null appears to be a file rather than a device.
72 *** Please consult your operating sytem's notes for making a device
73 *** in /dev.
74 *** Cannot continue, aborting.
75 ***
76 EOF
77         exit 1
78 fi
79
80 : compute my invocation name
81 me=$0
82 case "$0" in
83 */*)
84         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85         test "$me" || me=$0
86         ;;
87 esac
88
89 : Proper separator for the PATH environment variable
90 p_=:
91 : On OS/2 this directory should exist if this is not floppy only system :-]
92 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93     if test -n "$OS2_SHELL"; then
94                 p_=\;
95                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97                 is_os2=yes
98         elif test -n "$DJGPP"; then
99                 case "X${MACHTYPE:-nonesuchmach}" in
100                 *cygwin) ;;
101                 *) p_=\; ;;
102                 esac
103         fi
104 fi
105
106 : Proper PATH setting
107 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114 paths="$paths /sbin /usr/sbin /usr/libexec"
115 paths="$paths /system/gnu_library/bin"
116
117 for p in $paths
118 do
119         case "$p_$PATH$p_" in
120         *$p_$p$p_*) ;;
121         *) test -d $p && PATH=$PATH$p_$p ;;
122         esac
123 done
124
125 PATH=.$p_$PATH
126 export PATH
127
128 : shall we be using ksh?
129 inksh=''
130 needksh=''
131 avoidksh=''
132 newsh=/bin/ksh
133 changesh=''
134 if (PATH=.; alias -x) >/dev/null 2>&1; then
135                 inksh=true
136 fi
137 if test -f /hp-ux -a -f /bin/ksh; then
138         needksh='to avoid sh bug in "here document" expansion'
139 fi
140 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141         if test X`/usr/bin/uname -v` = X4; then
142                 avoidksh="to avoid AIX 4's /bin/sh"
143                 newsh=/usr/bin/bsh
144         fi
145 fi
146 if test -f /osf_boot -a -f /usr/sbin/setld; then
147         if test X`/usr/bin/uname -s` = XOSF1; then
148                 avoidksh="to avoid Digital UNIX' ksh"
149                 newsh=/bin/sh
150                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151         fi
152 fi
153 case "$inksh/$needksh" in
154 /[a-z]*)
155                 ENV=''
156                 changesh=true
157                 reason="$needksh"
158         ;;
159 esac
160 case "$inksh/$avoidksh" in
161 true/[a-z]*)
162         changesh=true
163         reason="$avoidksh"
164         ;;
165 esac
166 case "$inksh/$needksh-$avoidksh-" in
167 true/--)
168                 cat <<EOM
169 (I see you are using the Korn shell.  Some ksh's blow up on $me,
170 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171 EOM
172         ;;
173 esac
174 case "$changesh" in
175 true)
176         export newsh
177         echo "(Feeding myself to $newsh $reason.)"
178         case "$0" in
179         Configure|*/Configure) exec $newsh $0 "$@";;
180         *) exec $newsh Configure "$@";;
181         esac
182         ;;
183 esac
184
185 : if needed set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *)              CDPATH='' ;;
192         esac
193         ;;
194 esac
195 : Configure runs within the UU subdirectory
196 test -d UU || mkdir UU
197 cd UU && rm -f ./*
198
199 ccname=''
200 ccversion=''
201 ccsymbols=''
202 cppccsymbols=''
203 cppsymbols=''
204 from=''
205 run=''
206 targetarch=''
207 to=''
208 usecrosscompile=''
209 mistrustnm=''
210 perllibs=''
211 dynamic_ext=''
212 extensions=''
213 known_extensions=''
214 nonxs_ext=''
215 static_ext=''
216 useopcode=''
217 useposix=''
218 extras=''
219 d_bsd=''
220 d_eunice=''
221 d_xenix=''
222 eunicefix=''
223 Mcc=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 afs=''
320 afsroot=''
321 alignbytes=''
322 ansi2knr=''
323 archlib=''
324 archlibexp=''
325 d_archlib=''
326 installarchlib=''
327 archname=''
328 myarchname=''
329 d_atolf=''
330 d_atoll=''
331 baserev=''
332 bin=''
333 binexp=''
334 initialinstalllocation=''
335 installbin=''
336 userelocatableinc=''
337 byteorder=''
338 cc=''
339 ccflags=''
340 cppflags=''
341 ldflags=''
342 lkflags=''
343 locincpth=''
344 optimize=''
345 cf_email=''
346 cf_by=''
347 cf_time=''
348 charsize=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_signbit=''
704 d_sigprocmask=''
705 d_sigsetjmp=''
706 usesitecustomize=''
707 d_snprintf=''
708 d_vsnprintf=''
709 d_sockatmark=''
710 d_sockatmarkproto=''
711 d_msg_ctrunc=''
712 d_msg_dontroute=''
713 d_msg_oob=''
714 d_msg_peek=''
715 d_msg_proxy=''
716 d_oldsock=''
717 d_scm_rights=''
718 d_socket=''
719 d_sockpair=''
720 sockethdr=''
721 socketlib=''
722 d_socklen_t=''
723 d_socks5_init=''
724 d_sprintf_returns_strlen=''
725 d_sqrtl=''
726 d_srand48_r=''
727 srand48_r_proto=''
728 d_srandom_r=''
729 srandom_r_proto=''
730 d_sresgproto=''
731 d_sresuproto=''
732 d_statblks=''
733 d_statfs_f_flags=''
734 d_statfs_s=''
735 d_fstatvfs=''
736 d_statvfs=''
737 d_stdio_cnt_lval=''
738 d_stdio_ptr_lval=''
739 d_stdio_ptr_lval_nochange_cnt=''
740 d_stdio_ptr_lval_sets_cnt=''
741 d_stdiobase=''
742 d_stdstdio=''
743 stdio_base=''
744 stdio_bufsiz=''
745 stdio_cnt=''
746 stdio_filbuf=''
747 stdio_ptr=''
748 d_index=''
749 d_strchr=''
750 d_strcoll=''
751 d_strctcpy=''
752 d_strerrm=''
753 d_strerror=''
754 d_sysernlst=''
755 d_syserrlst=''
756 d_strerror_r=''
757 strerror_r_proto=''
758 d_strftime=''
759 d_strlcat=''
760 d_strlcpy=''
761 d_strtod=''
762 d_strtol=''
763 d_strtold=''
764 d_strtoll=''
765 d_strtoq=''
766 d_strtoul=''
767 d_strtoull=''
768 d_strtouq=''
769 d_strxfrm=''
770 d_symlink=''
771 d_syscall=''
772 d_syscallproto=''
773 d_sysconf=''
774 d_system=''
775 d_tcgetpgrp=''
776 d_tcsetpgrp=''
777 d_telldirproto=''
778 d_time=''
779 timetype=''
780 clocktype=''
781 d_times=''
782 d_tmpnam_r=''
783 tmpnam_r_proto=''
784 d_truncate=''
785 d_ttyname_r=''
786 ttyname_r_proto=''
787 d_tzname=''
788 d_u32align=''
789 d_ualarm=''
790 d_umask=''
791 d_semctl_semid_ds=''
792 d_semctl_semun=''
793 d_union_semun=''
794 d_unordered=''
795 d_unsetenv=''
796 d_usleep=''
797 d_usleepproto=''
798 d_ustat=''
799 d_pseudofork=''
800 d_vfork=''
801 usevfork=''
802 d_voidsig=''
803 signal_t=''
804 d_volatile=''
805 d_charvspr=''
806 d_vprintf=''
807 d_wait4=''
808 d_waitpid=''
809 d_wcstombs=''
810 d_wctomb=''
811 d_writev=''
812 dlext=''
813 cccdlflags=''
814 ccdlflags=''
815 dlsrc=''
816 ld=''
817 lddlflags=''
818 usedl=''
819 doublesize=''
820 ebcdic=''
821 fflushNULL=''
822 fflushall=''
823 fpossize=''
824 fpostype=''
825 gccansipedantic=''
826 gccosandvers=''
827 gccversion=''
828 gidformat=''
829 gidsign=''
830 gidsize=''
831 gidtype=''
832 groupstype=''
833 h_fcntl=''
834 h_sysfile=''
835 html1dir=''
836 html1direxp=''
837 installhtml1dir=''
838 html3dir=''
839 html3direxp=''
840 installhtml3dir=''
841 i_arpainet=''
842 i_crypt=''
843 db_hashtype=''
844 db_prefixtype=''
845 db_version_major=''
846 db_version_minor=''
847 db_version_patch=''
848 i_db=''
849 i_dbm=''
850 i_rpcsvcdbm=''
851 d_dirnamlen=''
852 direntrytype=''
853 i_dirent=''
854 i_dld=''
855 i_dlfcn=''
856 i_fcntl=''
857 i_float=''
858 i_fp=''
859 i_fp_class=''
860 i_gdbm=''
861 d_grpasswd=''
862 i_grp=''
863 i_ieeefp=''
864 i_inttypes=''
865 i_langinfo=''
866 i_libutil=''
867 i_limits=''
868 i_locale=''
869 i_machcthr=''
870 i_malloc=''
871 i_math=''
872 i_memory=''
873 i_mntent=''
874 i_ndbm=''
875 i_netdb=''
876 i_neterrno=''
877 i_netinettcp=''
878 i_niin=''
879 i_sysin=''
880 i_poll=''
881 i_prot=''
882 i_pthread=''
883 d_pwage=''
884 d_pwchange=''
885 d_pwclass=''
886 d_pwcomment=''
887 d_pwexpire=''
888 d_pwgecos=''
889 d_pwpasswd=''
890 d_pwquota=''
891 i_pwd=''
892 i_sfio=''
893 i_shadow=''
894 i_socks=''
895 i_stddef=''
896 i_stdlib=''
897 i_string=''
898 strings=''
899 i_sunmath=''
900 i_sysaccess=''
901 i_sysdir=''
902 i_sysfile=''
903 d_voidtty=''
904 i_bsdioctl=''
905 i_sysfilio=''
906 i_sysioctl=''
907 i_syssockio=''
908 i_syslog=''
909 i_sysmman=''
910 i_sysmode=''
911 i_sysmount=''
912 i_sysndir=''
913 i_sysparam=''
914 i_sysresrc=''
915 i_syssecrt=''
916 i_sysselct=''
917 i_sysstat=''
918 i_sysstatfs=''
919 i_sysstatvfs=''
920 i_systimes=''
921 i_systypes=''
922 i_sysuio=''
923 i_sysun=''
924 i_sysutsname=''
925 i_sysvfs=''
926 i_syswait=''
927 i_sgtty=''
928 i_termio=''
929 i_termios=''
930 d_tm_tm_gmtoff=''
931 d_tm_tm_zone=''
932 i_systime=''
933 i_systimek=''
934 i_time=''
935 timeincl=''
936 i_unistd=''
937 i_ustat=''
938 i_utime=''
939 i_values=''
940 i_stdarg=''
941 i_varargs=''
942 i_varhdr=''
943 i_vfork=''
944 d_inc_version_list=''
945 inc_version_list=''
946 inc_version_list_init=''
947 installprefix=''
948 installprefixexp=''
949 installstyle=''
950 installusrbinperl=''
951 intsize=''
952 longsize=''
953 shortsize=''
954 issymlink=''
955 libc=''
956 ldlibpthname=''
957 libperl=''
958 shrpenv=''
959 useshrplib=''
960 glibpth=''
961 libpth=''
962 loclibpth=''
963 plibpth=''
964 xlibpth=''
965 ignore_versioned_solibs=''
966 libs=''
967 libsdirs=''
968 libsfiles=''
969 libsfound=''
970 libspath=''
971 lns=''
972 d_PRIEUldbl=''
973 d_PRIFUldbl=''
974 d_PRIGUldbl=''
975 d_PRIeldbl=''
976 d_PRIfldbl=''
977 d_PRIgldbl=''
978 d_SCNfldbl=''
979 sPRIEUldbl=''
980 sPRIFUldbl=''
981 sPRIGUldbl=''
982 sPRIeldbl=''
983 sPRIfldbl=''
984 sPRIgldbl=''
985 sSCNfldbl=''
986 lseeksize=''
987 lseektype=''
988 mad=''
989 madlyh=''
990 madlyobj=''
991 madlysrc=''
992 make_set_make=''
993 d_mymalloc=''
994 freetype=''
995 mallocobj=''
996 mallocsrc=''
997 malloctype=''
998 usemallocwrap=''
999 usemymalloc=''
1000 installman1dir=''
1001 man1dir=''
1002 man1direxp=''
1003 man1ext=''
1004 installman3dir=''
1005 man3dir=''
1006 man3direxp=''
1007 man3ext=''
1008 modetype=''
1009 multiarch=''
1010 mydomain=''
1011 myhostname=''
1012 phostname=''
1013 c=''
1014 n=''
1015 d_eofnblk=''
1016 eagain=''
1017 o_nonblock=''
1018 rd_nodata=''
1019 need_va_copy=''
1020 netdb_hlen_type=''
1021 netdb_host_type=''
1022 netdb_name_type=''
1023 netdb_net_type=''
1024 groupcat=''
1025 hostcat=''
1026 passcat=''
1027 orderlib=''
1028 ranlib=''
1029 d_perl_otherlibdirs=''
1030 otherlibdirs=''
1031 package=''
1032 spackage=''
1033 pager=''
1034 api_revision=''
1035 api_subversion=''
1036 api_version=''
1037 api_versionstring=''
1038 patchlevel=''
1039 perl_patchlevel=''
1040 revision=''
1041 subversion=''
1042 version=''
1043 version_patchlevel_string=''
1044 perl5=''
1045 perladmin=''
1046 perlpath=''
1047 d_nv_preserves_uv=''
1048 d_nv_zero_is_allbits_zero=''
1049 i16size=''
1050 i16type=''
1051 i32size=''
1052 i32type=''
1053 i64size=''
1054 i64type=''
1055 i8size=''
1056 i8type=''
1057 ivsize=''
1058 ivtype=''
1059 nv_preserves_uv_bits=''
1060 nvsize=''
1061 nvtype=''
1062 u16size=''
1063 u16type=''
1064 u32size=''
1065 u32type=''
1066 u64size=''
1067 u64type=''
1068 u8size=''
1069 u8type=''
1070 uvsize=''
1071 uvtype=''
1072 ivdformat=''
1073 nvEUformat=''
1074 nvFUformat=''
1075 nvGUformat=''
1076 nveformat=''
1077 nvfformat=''
1078 nvgformat=''
1079 uvXUformat=''
1080 uvoformat=''
1081 uvuformat=''
1082 uvxformat=''
1083 pidtype=''
1084 prefix=''
1085 prefixexp=''
1086 installprivlib=''
1087 privlib=''
1088 privlibexp=''
1089 prototype=''
1090 ptrsize=''
1091 d_PRIXU64=''
1092 d_PRId64=''
1093 d_PRIi64=''
1094 d_PRIo64=''
1095 d_PRIu64=''
1096 d_PRIx64=''
1097 sPRIXU64=''
1098 sPRId64=''
1099 sPRIi64=''
1100 sPRIo64=''
1101 sPRIu64=''
1102 sPRIx64=''
1103 d_quad=''
1104 quadkind=''
1105 quadtype=''
1106 uquadtype=''
1107 drand01=''
1108 randbits=''
1109 randfunc=''
1110 randseedtype=''
1111 seedfunc=''
1112 installscript=''
1113 scriptdir=''
1114 scriptdirexp=''
1115 selectminbits=''
1116 selecttype=''
1117 sh=''
1118 sig_count=''
1119 sig_name=''
1120 sig_name_init=''
1121 sig_num=''
1122 sig_num_init=''
1123 sig_size=''
1124 d_sitearch=''
1125 installsitearch=''
1126 sitearch=''
1127 sitearchexp=''
1128 installsitebin=''
1129 sitebin=''
1130 sitebinexp=''
1131 installsitehtml1dir=''
1132 sitehtml1dir=''
1133 sitehtml1direxp=''
1134 installsitehtml3dir=''
1135 sitehtml3dir=''
1136 sitehtml3direxp=''
1137 installsitelib=''
1138 sitelib=''
1139 sitelib_stem=''
1140 sitelibexp=''
1141 installsiteman1dir=''
1142 siteman1dir=''
1143 siteman1direxp=''
1144 installsiteman3dir=''
1145 siteman3dir=''
1146 siteman3direxp=''
1147 siteprefix=''
1148 siteprefixexp=''
1149 installsitescript=''
1150 sitescript=''
1151 sitescriptexp=''
1152 sizesize=''
1153 sizetype=''
1154 so=''
1155 socksizetype=''
1156 sharpbang=''
1157 shsharp=''
1158 spitshell=''
1159 src=''
1160 ssizetype=''
1161 startperl=''
1162 startsh=''
1163 stdchar=''
1164 d_stdio_stream_array=''
1165 stdio_stream_array=''
1166 sysman=''
1167 trnl=''
1168 uidformat=''
1169 uidsign=''
1170 uidsize=''
1171 uidtype=''
1172 archname64=''
1173 use64bitall=''
1174 use64bitint=''
1175 usefaststdio=''
1176 ccflags_uselargefiles=''
1177 ldflags_uselargefiles=''
1178 libswanted_uselargefiles=''
1179 uselargefiles=''
1180 uselongdouble=''
1181 usemorebits=''
1182 usemultiplicity=''
1183 nm_opt=''
1184 nm_so_opt=''
1185 runnm=''
1186 usenm=''
1187 useperlio=''
1188 usesocks=''
1189 d_oldpthreads=''
1190 use5005threads=''
1191 useithreads=''
1192 usereentrant=''
1193 usethreads=''
1194 incpath=''
1195 mips_type=''
1196 usrinc=''
1197 d_vendorarch=''
1198 installvendorarch=''
1199 vendorarch=''
1200 vendorarchexp=''
1201 d_vendorbin=''
1202 installvendorbin=''
1203 vendorbin=''
1204 vendorbinexp=''
1205 installvendorhtml1dir=''
1206 vendorhtml1dir=''
1207 vendorhtml1direxp=''
1208 installvendorhtml3dir=''
1209 vendorhtml3dir=''
1210 vendorhtml3direxp=''
1211 d_vendorlib=''
1212 installvendorlib=''
1213 vendorlib=''
1214 vendorlib_stem=''
1215 vendorlibexp=''
1216 installvendorman1dir=''
1217 vendorman1dir=''
1218 vendorman1direxp=''
1219 installvendorman3dir=''
1220 vendorman3dir=''
1221 vendorman3direxp=''
1222 usevendorprefix=''
1223 vendorprefix=''
1224 vendorprefixexp=''
1225 d_vendorscript=''
1226 installvendorscript=''
1227 vendorscript=''
1228 vendorscriptexp=''
1229 versiononly=''
1230 defvoidused=''
1231 voidflags=''
1232 yacc=''
1233 yaccflags=''
1234 CONFIG=''
1235
1236 define='define'
1237 undef='undef'
1238 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1239 rmlist=''
1240
1241 : We must find out about Eunice early
1242 eunicefix=':'
1243 if test -f /etc/unixtovms; then
1244         eunicefix=/etc/unixtovms
1245 fi
1246 if test -f /etc/unixtovms.exe; then
1247         eunicefix=/etc/unixtovms.exe
1248 fi
1249
1250 : Set executable suffix now -- needed before hints available
1251 if test -f "/libs/version.library"; then
1252 : Amiga OS
1253     _exe=""
1254 elif test -f "/system/gnu_library/bin/ar.pm"; then
1255 : Stratus VOS
1256     _exe=".pm"
1257 elif test -n "$DJGPP"; then
1258 : DOS DJGPP
1259     _exe=".exe"
1260 elif test -d c:/. -o -n "$is_os2" ; then
1261 : OS/2 or cygwin
1262     _exe=".exe"
1263 fi
1264
1265 i_whoami=''
1266 : Trailing extension.  Override this in a hint file, if needed.
1267 : Extra object files, if any, needed on this platform.
1268 archobjs=''
1269 archname=''
1270 groupstype=''
1271 libnames=''
1272 : change the next line if compiling for Xenix/286 on Xenix/386
1273 xlibpth='/usr/lib/386 /lib/386'
1274 : Possible local library directories to search.
1275 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278 : general looking path for locating libraries
1279 glibpth="/lib /usr/lib $xlibpth"
1280 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1281 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1283 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1284
1285 : Private path used by Configure to find libraries.  Its value
1286 : is prepended to libpth. This variable takes care of special
1287 : machines, like the mips.  Usually, it should be empty.
1288 plibpth=''
1289
1290 : default library list
1291 libswanted=''
1292 : some systems want to use only the non-versioned libso:s
1293 ignore_versioned_solibs=''
1294 siteman1dir=''
1295 siteman3dir=''
1296 sitescript=''
1297 : set usethreads on the Configure command line to enable threads.
1298 usereentrant='undef'
1299 : full support for void wanted by default
1300 defvoidused=15
1301
1302 : Possible local include directories to search.
1303 : Set locincpth to "" in a hint file to defeat local include searches.
1304 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1305 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1306 :
1307 : no include file wanted by default
1308 inclwanted=''
1309
1310 : Enable -DEBUGGING and -DDEBUGGING from the command line
1311 EBUGGING=''
1312 DEBUGGING=old
1313
1314 ccname=''
1315 ccversion=''
1316 perllibs=''
1317 : set useposix=false in your hint file to disable the POSIX extension.
1318 useposix=true
1319 : set useopcode=false in your hint file to disable the Opcode extension.
1320 useopcode=true
1321 archname64=''
1322 ccflags_uselargefiles=''
1323 ldflags_uselargefiles=''
1324 libswanted_uselargefiles=''
1325 : set usemultiplicity on the Configure command line to enable multiplicity.
1326 : set usesocks on the Configure command line to enable socks.
1327 : List of libraries we want.
1328 : If anyone needs extra -lxxx, put those in a hint file.
1329 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1330 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1331 : We probably want to search /usr/shlib before most other libraries.
1332 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1333 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1334 glibpth="/usr/shlib $glibpth"
1335 : Do not use vfork unless overridden by a hint file.
1336 usevfork=false
1337
1338 : Find the basic shell for Bourne shell scripts
1339 case "$sh" in
1340 '')
1341         case "$SYSTYPE" in
1342         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1343         *) xxx='/bin/sh';;
1344         esac
1345         if test -f "$xxx"; then
1346                 sh="$xxx"
1347         else
1348                 : Build up a list and do a single loop so we can 'break' out.
1349                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1350                 for xxx in sh bash ksh pdksh ash; do
1351                         for p in $pth; do
1352                                 try="$try ${p}/${xxx}"
1353                         done
1354                 done
1355                 for xxx in $try; do
1356                         if test -f "$xxx"; then
1357                                 sh="$xxx";
1358                                 break
1359                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1360                                 sh="$xxx";
1361                                 break
1362                         elif test -f "$xxx.exe"; then
1363                                 sh="$xxx";
1364                                 break
1365                         fi
1366                 done
1367         fi
1368         ;;
1369 esac
1370
1371 case "$sh" in
1372 '')     cat >&2 <<EOM
1373 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1374
1375 Usually it's in /bin/sh.  How did you even get this far?
1376 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1377 we'll try to straighten this all out.
1378 EOM
1379         exit 1
1380         ;;
1381 esac
1382
1383 : see if sh knows # comments
1384 if `$sh -c '#' >/dev/null 2>&1`; then
1385         shsharp=true
1386         spitshell=cat
1387         xcat=/bin/cat
1388         test -f $xcat$_exe || xcat=/usr/bin/cat
1389         if test ! -f $xcat$_exe; then
1390                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1391                         if test -f $p/cat$_exe; then
1392                                 xcat=$p/cat
1393                                 break
1394                         fi
1395                 done
1396                 if test ! -f $xcat$_exe; then
1397                         echo "Can't find cat anywhere!"
1398                         exit 1
1399                 fi
1400         fi
1401         echo "#!$xcat" >sharp
1402         $eunicefix sharp
1403         chmod +x sharp
1404         ./sharp > today
1405         if test -s today; then
1406                 sharpbang='#!'
1407         else
1408                 echo "#! $xcat" > sharp
1409                 $eunicefix sharp
1410                 chmod +x sharp
1411                 ./sharp > today
1412                 if test -s today; then
1413                         sharpbang='#! '
1414                 else
1415                         sharpbang=': use '
1416                 fi
1417         fi
1418 else
1419         echo " "
1420         echo "Your $sh doesn't grok # comments--I will strip them later on."
1421         shsharp=false
1422         cd ..
1423         echo "exec grep -v '^[  ]*#'" >spitshell
1424         chmod +x spitshell
1425         $eunicefix spitshell
1426         spitshell=`pwd`/spitshell
1427         cd UU
1428         echo "I presume that if # doesn't work, #! won't work either!"
1429         sharpbang=': use '
1430 fi
1431 rm -f sharp today
1432
1433 : figure out how to guarantee sh startup
1434 case "$startsh" in
1435 '') startsh=${sharpbang}${sh} ;;
1436 *)
1437 esac
1438 cat >sharp <<EOSS
1439 $startsh
1440 set abc
1441 test "$?abc" != 1
1442 EOSS
1443
1444 chmod +x sharp
1445 $eunicefix sharp
1446 if ./sharp; then
1447         : echo "Yup, it does."
1448 else
1449         echo "Hmm... '$startsh' does not guarantee sh startup..."
1450         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1451 fi
1452 rm -f sharp
1453
1454
1455 : Save command line options in file UU/cmdline.opt for later use in
1456 : generating config.sh.
1457 cat > cmdline.opt <<EOSH
1458 # Configure command line arguments.
1459 config_arg0='$0'
1460 config_args='$*'
1461 config_argc=$#
1462 EOSH
1463 argn=1
1464 args_exp=''
1465 args_sep=''
1466 for arg in "$@"; do
1467         cat >>cmdline.opt <<EOSH
1468 config_arg$argn='$arg'
1469 EOSH
1470         # Extreme backslashitis: replace each ' by '"'"'
1471         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1472 $arg
1473 EOC
1474         arg_exp=`cat cmdl.opt`
1475         args_exp="$args_exp$args_sep'$arg_exp'"
1476         argn=`expr $argn + 1`
1477         args_sep=' '
1478 done
1479 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1480 # used by ./hints/os2.sh
1481 rm -f cmdl.opt
1482
1483 : produce awk script to parse command line options
1484 cat >options.awk <<'EOF'
1485 BEGIN {
1486         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1487
1488         len = length(optstr);
1489         for (i = 1; i <= len; i++) {
1490                 c = substr(optstr, i, 1);
1491                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1492                 if (a == ":") {
1493                         arg[c] = 1;
1494                         i++;
1495                 }
1496                 opt[c] = 1;
1497         }
1498 }
1499 {
1500         expect = 0;
1501         str = $0;
1502         if (substr(str, 1, 1) != "-") {
1503                 printf("'%s'\n", str);
1504                 next;
1505         }
1506         len = length($0);
1507         for (i = 2; i <= len; i++) {
1508                 c = substr(str, i, 1);
1509                 if (!opt[c]) {
1510                         printf("-%s\n", substr(str, i));
1511                         next;
1512                 }
1513                 printf("-%s\n", c);
1514                 if (arg[c]) {
1515                         if (i < len)
1516                                 printf("'%s'\n", substr(str, i + 1));
1517                         else
1518                                 expect = 1;
1519                         next;
1520                 }
1521         }
1522 }
1523 END {
1524         if (expect)
1525                 print "?";
1526 }
1527 EOF
1528
1529 : process the command line options
1530 set X `for arg in "$@"; do echo "X$arg"; done |
1531         sed -e s/X// | awk -f options.awk`
1532 eval "set $*"
1533 shift
1534 rm -f options.awk
1535
1536 : set up default values
1537 fastread=''
1538 reuseval=false
1539 config_sh=''
1540 alldone=''
1541 error=''
1542 silent=''
1543 extractsh=''
1544 override=''
1545 knowitall=''
1546 rm -f optdef.sh posthint.sh
1547 cat >optdef.sh <<EOS
1548 $startsh
1549 EOS
1550
1551
1552 : option parsing
1553 while test $# -gt 0; do
1554         case "$1" in
1555         -d) shift; fastread=yes;;
1556         -e) shift; alldone=cont;;
1557         -f)
1558                 shift
1559                 cd ..
1560                 if test -r "$1"; then
1561                         config_sh="$1"
1562                 else
1563                         echo "$me: cannot read config file $1." >&2
1564                         error=true
1565                 fi
1566                 cd UU
1567                 shift;;
1568         -h) shift; error=true;;
1569         -r) shift; reuseval=true;;
1570         -s) shift; silent=true; realsilent=true;;
1571         -E) shift; alldone=exit;;
1572         -K) shift; knowitall=true;;
1573         -O) shift; override=true;;
1574         -S) shift; silent=true; extractsh=true;;
1575         -D)
1576                 shift
1577                 case "$1" in
1578                 *=)
1579                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1580                         echo "$me: ignoring -D $1" >&2
1581                         ;;
1582                 *=*) echo "$1" | \
1583                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1584                 *) echo "$1='define'" >> optdef.sh;;
1585                 esac
1586                 shift
1587                 ;;
1588         -U)
1589                 shift
1590                 case "$1" in
1591                 *=) echo "$1" >> optdef.sh;;
1592                 *=*)
1593                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1594                         echo "$me: ignoring -U $1" >&2
1595                         ;;
1596                 *) echo "$1='undef'" >> optdef.sh;;
1597                 esac
1598                 shift
1599                 ;;
1600         -A)
1601             shift
1602             xxx=''
1603             yyy="$1"
1604             zzz=''
1605             uuu=undef
1606             case "$yyy" in
1607             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1608                  case "$zzz" in
1609                  *:*) zzz='' ;;
1610                  *)   xxx=append
1611                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1612                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1613                  esac
1614                  ;;
1615             esac
1616             case "$xxx" in
1617             '')  case "$yyy" in
1618                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1619                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1620                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1621                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1622                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1623                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1624                  esac
1625                  ;;       
1626             esac
1627             case "$xxx" in
1628             append)
1629                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1630             clear)
1631                 echo "$yyy=''"                  >> posthint.sh ;;
1632             define)
1633                 case "$zzz" in
1634                 '') zzz=define ;;
1635                 esac
1636                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1637             eval)
1638                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1639             prepend)
1640                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1641             undef)
1642                 case "$zzz" in
1643                 '') zzz="$uuu" ;;
1644                 esac
1645                 echo "$yyy=$zzz"                >> posthint.sh ;;
1646             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1647             esac
1648             shift
1649             ;;
1650         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1651             exit 0;;
1652         --) break;;
1653         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1654         *) break;;
1655         esac
1656 done
1657
1658 case "$error" in
1659 true)
1660         cat >&2 <<EOM
1661 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1662                  [-U symbol] [-U symbol=] [-A command:symbol...]
1663   -d : use defaults for all answers.
1664   -e : go on without questioning past the production of config.sh.
1665   -f : specify an alternate default configuration file.
1666   -h : print this help message and exit (with an error status).
1667   -r : reuse C symbols value if possible (skips costly nm extraction).
1668   -s : silent mode, only echoes questions and essential information.
1669   -D : define symbol to have some value:
1670          -D symbol         symbol gets the value 'define'
1671          -D symbol=value   symbol gets the value 'value'
1672   -E : stop at the end of questions, after having produced config.sh.
1673   -K : do not use unless you know what you are doing.
1674   -O : let -D and -U override definitions from loaded configuration file.
1675   -S : perform variable substitutions on all .SH files (can mix with -f)
1676   -U : undefine symbol:
1677          -U symbol    symbol gets the value 'undef'
1678          -U symbol=   symbol gets completely empty
1679   -A : manipulate symbol after the platform specific hints have been applied:
1680          -A symbol=value                append " "value to symbol
1681          -A append:symbol=value         append value to symbol
1682          -A define:symbol=value         define symbol to have value
1683          -A clear:symbol                define symbol to be ''
1684          -A define:symbol               define symbol to be 'define'
1685          -A eval:symbol=value           define symbol to be eval of value
1686          -A prepend:symbol=value        prepend value to symbol
1687          -A undef:symbol                define symbol to be 'undef'
1688          -A undef:symbol=               define symbol to be ''
1689   -V : print version number and exit (with a zero status).
1690 EOM
1691         exit 1
1692         ;;
1693 esac
1694
1695 : Sanity checks
1696 case "$fastread$alldone" in
1697 yescont|yesexit) ;;
1698 *)
1699         case "$extractsh" in
1700         true) ;;
1701         *)
1702                 if test ! -t 0; then
1703                         echo "Say 'sh Configure', not 'sh <Configure'"
1704                         exit 1
1705                 fi
1706                 ;;
1707         esac
1708         ;;
1709 esac
1710
1711 exec 4>&1
1712 case "$silent" in
1713 true) exec 1>/dev/null;;
1714 esac
1715
1716 : run the defines and the undefines, if any, but leave the file out there...
1717 touch optdef.sh
1718 . ./optdef.sh
1719 : create the posthint manipulation script and leave the file out there...
1720 touch posthint.sh
1721
1722 : set package name
1723 package=perl5
1724 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1725 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1726 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1727 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1728 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1729 esac
1730
1731 : Some greps do not return status, grrr.
1732 echo "grimblepritz" >grimble
1733 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1734         contains=contains
1735 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1736         contains=grep
1737 else
1738         contains=contains
1739 fi
1740 rm -f grimble
1741 : the following should work in any shell
1742 case "$contains" in
1743 contains*)
1744         echo " "
1745         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1746         cat >contains <<'EOSS'
1747 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1748 EOSS
1749 chmod +x contains
1750 esac
1751
1752 : Find the path to the source tree
1753 case "$src" in
1754 '') case "$0" in
1755     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1756          case "$src" in
1757          /*)    ;;
1758          .)     ;;
1759          *)     src=`cd ../$src && pwd` ;;
1760          esac
1761          ;;
1762     *)   src='.';;
1763     esac;;
1764 esac
1765 case "$src" in
1766 '')     src=/
1767         rsrc=/
1768         ;;
1769 /*) rsrc="$src";;
1770 *) rsrc="../$src";;
1771 esac
1772 if test -f $rsrc/Configure && \
1773         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1774 then
1775    : found it, so we are ok.
1776 else
1777         rsrc=''
1778         for src in . .. ../.. ../../.. ../../../..; do
1779                 if test -f ../$src/Configure && \
1780                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1781                 then
1782                         rsrc=../$src
1783                         break
1784                 fi
1785         done
1786 fi
1787 case "$rsrc" in
1788 '')
1789         cat <<EOM >&4
1790
1791 Sorry, I can't seem to locate the source dir for $package.  Please start
1792 Configure with an explicit path -- i.e. /some/path/Configure.
1793
1794 EOM
1795         exit 1
1796         ;;
1797 ../.)   rsrc='..';;
1798 *)
1799         echo " "
1800         echo "Sources for $package found in \"$src\"." >&4
1801         ;;
1802 esac
1803
1804 : script used to extract .SH files with variable substitutions
1805 cat >extract <<'EOS'
1806 PERL_CONFIG_SH=true
1807 echo "Doing variable substitutions on .SH files..."
1808 if test -f MANIFEST; then
1809         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1810 else
1811         echo "(Looking for .SH files under the source directory.)"
1812         set x `(cd "$src"; find . -name "*.SH" -print)`
1813 fi
1814 shift
1815 case $# in
1816 0) set x `(cd "$src"; echo *.SH)`; shift;;
1817 esac
1818 if test ! -f "$src/$1"; then
1819         shift
1820 fi
1821 mkdir_p='
1822 name=$1;
1823 create="";
1824 while test $name; do
1825         if test ! -d "$name"; then
1826                 create="$name $create";
1827                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1828                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1829         else
1830                 name="";
1831         fi;
1832 done;
1833 for file in $create; do
1834         mkdir $file;
1835 done
1836 '
1837 for file in $*; do
1838         case "$src" in
1839         ".")
1840                 case "$file" in
1841                 */*)
1842                         dir=`expr X$file : 'X\(.*\)/'`
1843                         file=`expr X$file : 'X.*/\(.*\)'`
1844                         (cd "$dir" && . ./$file)
1845                         ;;
1846                 *)
1847                         . ./$file
1848                         ;;
1849                 esac
1850                 ;;
1851         *)
1852                 case "$file" in
1853                 */*)
1854                         dir=`expr X$file : 'X\(.*\)/'`
1855                         file=`expr X$file : 'X.*/\(.*\)'`
1856                         (set x $dir; shift; eval $mkdir_p)
1857                         sh <"$src/$dir/$file"
1858                         ;;
1859                 *)
1860                         sh <"$src/$file"
1861                         ;;
1862                 esac
1863                 ;;
1864         esac
1865 done
1866 if test -f "$src/config_h.SH"; then
1867         if test ! -f config.h; then
1868         : oops, they left it out of MANIFEST, probably, so do it anyway.
1869         . "$src/config_h.SH"
1870         fi
1871 fi
1872 EOS
1873
1874 : extract files and exit if asked to do so
1875 case "$extractsh" in
1876 true)
1877         case "$realsilent" in
1878         true) ;;
1879         *) exec 1>&4;;
1880         esac
1881         case "$config_sh" in
1882         '') config_sh='config.sh';;
1883         esac
1884         echo " "
1885         echo "Fetching answers from $config_sh..."
1886         cd ..
1887         . $config_sh
1888         test "$override" && . ./optdef.sh
1889         echo " "
1890         . UU/extract
1891         rm -rf UU
1892         echo "Extraction done."
1893         exit 0
1894         ;;
1895 esac
1896
1897 : Eunice requires " " instead of "", can you believe it
1898 echo " "
1899 : Here we go...
1900 echo "Beginning of configuration questions for $package."
1901
1902 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1903
1904 : first determine how to suppress newline on echo command
1905 echo " "
1906 echo "Checking echo to see how to suppress newlines..."
1907 (echo "hi there\c" ; echo " ") >.echotmp
1908 if $contains c .echotmp >/dev/null 2>&1 ; then
1909         echo "...using -n."
1910         n='-n'
1911         c=''
1912 else
1913         cat <<'EOM'
1914 ...using \c
1915 EOM
1916         n=''
1917         c='\c'
1918 fi
1919 echo $n "The star should be here-->$c"
1920 echo '*'
1921 rm -f .echotmp
1922
1923 : Now test for existence of everything in MANIFEST
1924 echo " "
1925 if test -f "$rsrc/MANIFEST"; then
1926         echo "First let's make sure your kit is complete.  Checking..." >&4
1927         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1928         rm -f missing
1929         tmppwd=`pwd`
1930         for filelist in x??; do
1931                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1932         done
1933         if test -s missing; then
1934                 cat missing >&4
1935                 cat >&4 <<'EOM'
1936
1937 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1938
1939 You have the option of continuing the configuration process, despite the
1940 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1941 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1942 and contact the author (perlbug@perl.org).
1943
1944 EOM
1945                 echo $n "Continue? [n] $c" >&4
1946                 read ans
1947                 case "$ans" in
1948                 y*)
1949                         echo "Continuing..." >&4
1950                         rm -f missing
1951                         ;;
1952                 *)
1953                         echo "ABORTING..." >&4
1954                         kill $$
1955                         ;;
1956                 esac
1957         else
1958                 echo "Looks good..."
1959         fi
1960 else
1961         echo "There is no MANIFEST file.  I hope your kit is complete !"
1962 fi
1963 rm -f missing x??
1964
1965 echo " "
1966 : Find the appropriate value for a newline for tr
1967 if test -n "$DJGPP"; then
1968        trnl='\012'
1969 fi
1970 if test X"$trnl" = X; then
1971         case "`echo foo|tr '\n' x 2>/dev/null`" in
1972         foox) trnl='\n' ;;
1973         esac
1974 fi
1975 if test X"$trnl" = X; then
1976         case "`echo foo|tr '\012' x 2>/dev/null`" in
1977         foox) trnl='\012' ;;
1978         esac
1979 fi
1980 if test X"$trnl" = X; then
1981        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1982        fooxy) trnl='\n\r' ;;
1983        esac
1984 fi
1985 if test X"$trnl" = X; then
1986         cat <<EOM >&2
1987
1988 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1989
1990 EOM
1991         exit 1
1992 fi
1993
1994 : compute the number of columns on the terminal for proper question formatting
1995 case "$COLUMNS" in
1996 '') COLUMNS='80';;
1997 esac
1998
1999 : set up the echo used in my read
2000 myecho="case \"\$xxxm\" in
2001 '') echo $n \"\$rp $c\" >&4;;
2002 *) case \"\$rp\" in
2003         '') echo $n \"[\$xxxm] $c\";;
2004         *)
2005                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2006                         echo \"\$rp\" >&4
2007                         echo $n \"[\$xxxm] $c\" >&4
2008                 else
2009                         echo $n \"\$rp [\$xxxm] $c\" >&4
2010                 fi
2011                 ;;
2012         esac;;
2013 esac"
2014
2015 : now set up to do reads with possible shell escape and default assignment
2016 cat <<EOSC >myread
2017 $startsh
2018 xxxm=\$dflt
2019 $myecho
2020 ans='!'
2021 case "\$fastread" in
2022 yes) case "\$dflt" in
2023         '') ;;
2024         *) ans='';
2025                 case "\$silent-\$rp" in
2026                 true-) ;;
2027                 *) echo " " >&4;;
2028                 esac;;
2029         esac;;
2030 *) case "\$silent" in
2031         true) case "\$rp" in
2032                 '') ans='';;
2033                 esac;;
2034         esac;;
2035 esac
2036 while expr "X\$ans" : "X!" >/dev/null; do
2037         read answ
2038         set x \$xxxm
2039         shift
2040         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2041         case  "\$answ" in
2042         "!")
2043                 sh 1>&4
2044                 echo " "
2045                 $myecho
2046                 ;;
2047         !*)
2048                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2049                 shift
2050                 sh 1>&4 -c "\$*"
2051                 echo " "
2052                 $myecho
2053                 ;;
2054         "\$ans")
2055                 case "\$ans" in
2056                 \\&*)
2057                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2058                         shift
2059                         case "\$1" in
2060                         -d)
2061                                 fastread=yes
2062                                 echo "(OK, I'll run with -d after this question.)" >&4
2063                                 ;;
2064                         -*)
2065                                 echo "*** Sorry, \$1 not supported yet." >&4
2066                                 ;;
2067                         esac
2068                         $myecho
2069                         ans=!
2070                         ;;
2071                 esac;;
2072         *)
2073                 case "\$aok" in
2074                 y)
2075                         echo "*** Substitution done -- please confirm."
2076                         xxxm="\$ans"
2077                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2078                         xxxm="\$ans"
2079                         ans=!
2080                         ;;
2081                 *)
2082                         echo "*** Error -- try again."
2083                         ans=!
2084                         ;;
2085                 esac
2086                 $myecho
2087                 ;;
2088         esac
2089         case "\$ans\$xxxm\$nostick" in
2090         '')
2091                 ans=!
2092                 $myecho
2093                 ;;
2094         esac
2095 done
2096 case "\$ans" in
2097 '') ans="\$xxxm";;
2098 esac
2099 EOSC
2100
2101 : create .config dir to save info across Configure sessions
2102 test -d ../.config || mkdir ../.config
2103 cat >../.config/README <<EOF
2104 This directory created by Configure to save information that should
2105 persist across sessions for $package.
2106
2107 You may safely delete it if you wish.
2108 EOF
2109
2110 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2111 case "$usedevel" in
2112 $define|true|[yY]*) ;;
2113 *) case "$xversion" in
2114    *[13579])
2115         cat >&4 <<EOH
2116 *** WHOA THERE!!! ***
2117
2118     This is an UNSTABLE DEVELOPMENT release.
2119     The version of this $package distribution is $xversion, that is, odd,
2120     (as opposed to even) and that signifies a development release.
2121     If you want a maintenance release, you want an even-numbered version.
2122
2123     Do ***NOT*** install this into production use.
2124     Data corruption and crashes are possible.
2125
2126     It is most seriously suggested that you do not continue any further
2127     unless you want to help in developing and debugging Perl.
2128
2129     If you *still* want to build perl, you can answer 'y' now,
2130     or pass -Dusedevel to Configure.
2131
2132 EOH
2133         rp='Do you really want to continue?'
2134         dflt='n'
2135         . ./myread
2136         case "$ans" in
2137         [yY]) echo >&4 "Okay, continuing."
2138               usedevel="$define" ;;
2139         *) echo >&4 "Okay, bye."
2140            exit 1
2141            ;;
2142         esac
2143         ;;
2144     esac
2145     ;;
2146 esac
2147 case "$usedevel" in
2148 $define|true|[yY]*)
2149         case "$versiononly" in
2150         '') versiononly="$define" ;;
2151         esac
2152         case "$installusrbinperl" in
2153         '') installusrbinperl="$undef" ;;
2154         esac
2155         ;;
2156 esac
2157
2158 : general instructions
2159 needman=true
2160 firsttime=true
2161 user=`(logname) 2>/dev/null`
2162 case "$user" in
2163 '') user=`whoami 2>&1`;;
2164 esac
2165 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2166         firsttime=false
2167         echo " "
2168         rp='Would you like to see the instructions?'
2169         dflt=n
2170         . ./myread
2171         case "$ans" in
2172         [yY]*) ;;
2173         *) needman=false;;
2174         esac
2175 fi
2176 if $needman; then
2177         cat <<EOH
2178
2179 This installation shell script will examine your system and ask you questions
2180 to determine how the perl5 package should be installed. If you get
2181 stuck on a question, you may use a ! shell escape to start a subshell or
2182 execute a command.  Many of the questions will have default answers in square
2183 brackets; typing carriage return will give you the default.
2184
2185 On some of the questions which ask for file or directory names you are allowed
2186 to use the ~name construct to specify the login directory belonging to "name",
2187 even if you don't have a shell which knows about that.  Questions where this is
2188 allowed will be marked "(~name ok)".
2189
2190 EOH
2191         rp=''
2192         dflt='Type carriage return to continue'
2193         . ./myread
2194         cat <<'EOH'
2195
2196 The prompter used in this script allows you to use shell variables and
2197 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2198 in the default answer, as if the default line was a set of arguments given to a
2199 script shell.  This means you may also use $* to repeat the whole default line,
2200 so you do not have to re-type everything to add something to the default.
2201
2202 Everytime there is a substitution, you will have to confirm.  If there is an
2203 error (e.g. an unmatched backtick), the default answer will remain unchanged
2204 and you will be prompted again.
2205
2206 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2207 the questions and use the computed defaults (or the previous answers if there
2208 was already a config.sh file). Type 'Configure -h' for a list of options.
2209 You may also start interactively and then answer '& -d' at any prompt to turn
2210 on the non-interactive behaviour for the remainder of the execution.
2211
2212 EOH
2213         . ./myread
2214         cat <<EOH
2215
2216 Much effort has been expended to ensure that this shell script will run on any
2217 Unix system.  If despite that it blows up on yours, your best bet is to edit
2218 Configure and run it again.  If you can't run Configure for some reason,
2219 you'll have to generate a config.sh file by hand.  Whatever problems you
2220 have, let me (perlbug@perl.org) know how I blew it.
2221
2222 This installation script affects things in two ways:
2223
2224 1) it may do direct variable substitutions on some of the files included
2225    in this kit.
2226 2) it builds a config.h file for inclusion in C programs.  You may edit
2227    any of these files as the need arises after running this script.
2228
2229 If you make a mistake on a question, there is no easy way to back up to it
2230 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2231 files.  Configure will offer to let you do this before it runs the SH files.
2232
2233 EOH
2234         dflt='Type carriage return to continue'
2235         . ./myread
2236         case "$firsttime" in
2237         true) echo $user >>../.config/instruct;;
2238         esac
2239 fi
2240
2241 : find out where common programs are
2242 echo " "
2243 echo "Locating common programs..." >&4
2244 cat <<EOSC >loc
2245 $startsh
2246 case \$# in
2247 0) exit 1;;
2248 esac
2249 thing=\$1
2250 shift
2251 dflt=\$1
2252 shift
2253 for dir in \$*; do
2254         case "\$thing" in
2255         .)
2256         if test -d \$dir/\$thing; then
2257                 echo \$dir
2258                 exit 0
2259         fi
2260         ;;
2261         *)
2262         for thisthing in \$dir/\$thing; do
2263                 : just loop through to pick last item
2264         done
2265         if test -f \$thisthing; then
2266                 echo \$thisthing
2267                 exit 0
2268         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2269                 echo \$thisthing
2270                 exit 0
2271         elif test -f \$dir/\$thing.exe; then
2272                 if test -n "$DJGPP"; then
2273                         echo \$dir/\$thing.exe
2274                 elif test "$eunicefix" != ":"; then
2275                         : on Eunice apparently
2276                         echo \$dir/\$thing
2277                         exit 0
2278                 fi
2279                 exit 0
2280         fi
2281         ;;
2282         esac
2283 done
2284 echo \$dflt
2285 exit 1
2286 EOSC
2287 chmod +x loc
2288 $eunicefix loc
2289 loclist="
2290 awk
2291 cat
2292 chmod
2293 comm
2294 cp
2295 echo
2296 expr
2297 grep
2298 ls
2299 mkdir
2300 rm
2301 sed
2302 sort
2303 touch
2304 tr
2305 uniq
2306 "
2307 trylist="
2308 Mcc
2309 ar
2310 bison
2311 byacc
2312 cpp
2313 csh
2314 date
2315 egrep
2316 gmake
2317 gzip
2318 less
2319 ln
2320 make
2321 more
2322 nm
2323 nroff
2324 pg
2325 test
2326 uname
2327 zip
2328 "
2329 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2330 pth="$pth /lib /usr/lib"
2331 for file in $loclist; do
2332         eval xxx=\$$file
2333         case "$xxx" in
2334         /*|?:[\\/]*)
2335                 if test -f "$xxx"; then
2336                         : ok
2337                 else
2338                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2339                         xxx=`./loc $file $file $pth`
2340                 fi
2341                 ;;
2342         '') xxx=`./loc $file $file $pth`;;
2343         *) xxx=`./loc $xxx $xxx $pth`;;
2344         esac
2345         eval $file=$xxx$_exe
2346         eval _$file=$xxx
2347         case "$xxx" in
2348         /*)
2349                 echo $file is in $xxx.
2350                 ;;
2351         ?:[\\/]*)
2352                 echo $file is in $xxx.
2353                 ;;
2354         *)
2355                 echo "I don't know where '$file' is, and my life depends on it." >&4
2356                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2357                 exit 1
2358                 ;;
2359         esac
2360 done
2361 echo " "
2362 echo "Don't worry if any of the following aren't found..."
2363 say=offhand
2364 for file in $trylist; do
2365         eval xxx=\$$file
2366         case "$xxx" in
2367         /*|?:[\\/]*)
2368                 if test -f "$xxx"; then
2369                         : ok
2370                 else
2371                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2372                         xxx=`./loc $file $file $pth`
2373                 fi
2374                 ;;
2375         '') xxx=`./loc $file $file $pth`;;
2376         *) xxx=`./loc $xxx $xxx $pth`;;
2377         esac
2378         eval $file=$xxx$_exe
2379         eval _$file=$xxx
2380         case "$xxx" in
2381         /*)
2382                 echo $file is in $xxx.
2383                 ;;
2384         ?:[\\/]*)
2385                 echo $file is in $xxx.
2386                 ;;
2387         *)
2388                 echo "I don't see $file out there, $say."
2389                 say=either
2390                 ;;
2391         esac
2392 done
2393 case "$egrep" in
2394 egrep)
2395         echo "Substituting grep for egrep."
2396         egrep=$grep
2397         _egrep=$grep
2398         ;;
2399 esac
2400 case "$ln" in
2401 ln)
2402         echo "Substituting cp for ln."
2403         ln=$cp
2404         _ln=$cp
2405         ;;
2406 esac
2407 case "$make" in
2408 make)   
2409         case "$gmake" in
2410         gmake)
2411         echo "I can't find make or gmake, and my life depends on it." >&4
2412         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2413         exit 1
2414         ;;
2415         esac
2416         ;;
2417 esac    
2418 case "$gmake" in
2419 gmake)  ;;
2420 *)      # We can't have osname yet.
2421         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2422                 # Assume that gmake, if found, is definitely GNU make
2423                 # and prefer it over the system make.
2424                 echo "Substituting gmake for make."
2425                 make=$gmake
2426                 _make=$gmake
2427         fi
2428         ;;
2429 esac
2430 case "$test" in
2431 test)
2432         echo "Hopefully test is built into your sh."
2433         ;;
2434 *)
2435         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2436                 echo "Using the test built into your sh."
2437                 test=test
2438                 _test=test
2439         fi
2440         ;;
2441 esac
2442 case "$echo" in
2443 echo)
2444         echo "Hopefully echo is built into your sh."
2445         ;;
2446 '') ;;
2447 *)
2448         echo " "
2449 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2450         $echo $n "hi there$c" >foo1
2451         echo $n "hi there$c" >foo2
2452         if cmp foo1 foo2 >/dev/null 2>&1; then
2453                 echo "They are compatible.  In fact, they may be identical."
2454         else
2455                 case "$n" in
2456                 '-n') n='' c='\c';;
2457                 *) n='-n' c='';;
2458                 esac
2459                 cat <<FOO
2460 They are not compatible!  You are probably running ksh on a non-USG system.
2461 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2462 have echo built in and we may have to run some Bourne shell scripts.  That
2463 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2464
2465 FOO
2466                 $echo $n "The star should be here-->$c"
2467                 $echo "*"
2468         fi
2469         $rm -f foo1 foo2
2470         ;;
2471 esac
2472
2473 cat <<EOS >trygcc
2474 $startsh
2475 EOS
2476 cat <<'EOSC' >>trygcc
2477 case "$cc" in
2478 '') ;;
2479 *)  $rm -f try try.*
2480     $cat >try.c <<EOM
2481 int main(int argc, char *argv[]) {
2482   return 0;
2483 }
2484 EOM
2485     if $cc -o try $ccflags $ldflags try.c; then
2486        :
2487     else
2488         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2489         despair=yes
2490         trygcc=yes
2491         case "$cc" in
2492         *gcc*) trygcc=no ;;
2493         esac
2494         case "`$cc -v -c try.c 2>&1`" in
2495         *gcc*) trygcc=no ;;
2496         esac
2497         if $test X"$trygcc" = Xyes; then
2498             if gcc -o try -c try.c; then
2499                 echo " "
2500                 echo "You seem to have a working gcc, though." >&4
2501                 rp="Would you like to use it?"
2502                 dflt=y
2503                 if $test -f myread; then
2504                     . ./myread
2505                 else
2506                     if $test -f UU/myread; then
2507                         . ./UU/myread
2508                     else
2509                         echo "Cannot find myread, sorry.  Aborting." >&2
2510                         exit 1
2511                     fi
2512                 fi  
2513                 case "$ans" in
2514                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2515                        if $test -f usethreads.cbu; then
2516                            $cat >&4 <<EOM 
2517
2518 *** However, any setting of the C compiler flags (e.g. for thread support)
2519 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2520 *** (together with e.g. -Dusethreads).
2521
2522 EOM
2523                        fi;;
2524                 esac
2525             fi
2526         fi
2527     fi
2528     $rm -f try try.*
2529     ;;
2530 esac
2531 EOSC
2532
2533 cat <<EOS >checkcc
2534 $startsh
2535 EOS
2536 cat <<'EOSC' >>checkcc
2537 case "$cc" in        
2538 '') ;;
2539 *)  $rm -f try try.*              
2540     $cat >try.c <<EOM
2541 int main(int argc, char *argv[]) {
2542   return 0;
2543 }
2544 EOM
2545     if $cc -o try $ccflags $ldflags try.c; then
2546        :
2547     else
2548         if $test X"$despair" = Xyes; then
2549            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2550         fi
2551         $cat >&4 <<EOM         
2552 You need to find a working C compiler.
2553 Either (purchase and) install the C compiler supplied by your OS vendor,
2554 or for a free C compiler try http://gcc.gnu.org/
2555 I cannot continue any further, aborting.
2556 EOM
2557         exit 1
2558     fi
2559     $rm -f try try.*
2560     ;;
2561 esac
2562 EOSC
2563
2564 : determine whether symbolic links are supported
2565 echo " "
2566 $touch blurfl
2567 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2568         echo "Symbolic links are supported." >&4
2569         lns="$ln -s"
2570 else
2571         echo "Symbolic links are NOT supported." >&4
2572         lns="$ln"
2573 fi
2574 $rm -f blurfl sym
2575
2576 : determine whether symbolic links are supported
2577 echo " "
2578 case "$lns" in
2579 *"ln"*" -s")
2580         echo "Checking how to test for symbolic links..." >&4
2581         $lns blurfl sym
2582         if $test "X$issymlink" = X; then
2583                 case "$newsh" in
2584                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2585                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2586                 esac
2587                 if test $? = 0; then
2588                         issymlink="test -h"
2589                 else
2590                         echo "Your builtin 'test -h' may be broken." >&4
2591                         case "$test" in
2592                         /*)     ;;
2593                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2594                                 for p in $pth
2595                                 do
2596                                         if test -f "$p/$test"; then
2597                                                 test="$p/$test"
2598                                                 break
2599                                         fi
2600                                 done
2601                                 ;;
2602                         esac
2603                         case "$test" in
2604                         /*)
2605                                 echo "Trying external '$test -h'." >&4
2606                                 issymlink="$test -h"
2607                                 if $test ! -h sym >/dev/null 2>&1; then
2608                                         echo "External '$test -h' is broken, too." >&4
2609                                         issymlink=''
2610                                 fi
2611                                 ;;
2612                         *)      issymlink='' ;;
2613                         esac
2614                 fi              
2615         fi
2616         if $test "X$issymlink" = X; then
2617                 if $test -L sym 2>/dev/null; then
2618                         issymlink="$test -L"
2619                         echo "The builtin '$test -L' worked." >&4
2620                 fi
2621         fi
2622         if $test "X$issymlink" != X; then
2623                 echo "You can test for symbolic links with '$issymlink'." >&4
2624         else
2625                 echo "I do not know how you can test for symbolic links." >&4
2626         fi
2627         $rm -f blurfl sym
2628         ;;
2629 *)      echo "No symbolic links, so not testing for their testing..." >&4
2630         ;;
2631 esac
2632 echo " "
2633
2634
2635 case "$mksymlinks" in
2636 $define|true|[yY]*)
2637         case "$src" in
2638         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2639                 exit 1
2640                 ;;
2641         *)      case "$lns:$issymlink" in
2642                 *"ln"*" -s:"*"test -"?)
2643                         echo "Creating the symbolic links..." >&4
2644                         echo "(First creating the subdirectories...)" >&4
2645                         cd ..
2646                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2647                                 read directory
2648                                 test -z "$directory" && break
2649                                 mkdir -p $directory
2650                         done
2651                         # Sanity check 1.
2652                         if test ! -d t/base; then
2653                                 echo "Failed to create the subdirectories.  Aborting." >&4
2654                                 exit 1
2655                         fi
2656                         echo "(Then creating the symlinks...)" >&4
2657                         awk '{print $1}' $src/MANIFEST | while true; do
2658                                 read filename
2659                                 test -z "$filename" && break
2660                                 if test -f $filename; then
2661                                         if $issymlink $filename; then
2662                                                 rm -f $filename
2663                                         fi
2664                                 fi
2665                                 if test -f $filename; then
2666                                         echo "$filename already exists, not symlinking."
2667                                 else
2668                                         ln -s $src/$filename $filename
2669                                 fi
2670                         done
2671                         # Sanity check 2.
2672                         if test ! -f t/base/lex.t; then
2673                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2674                                 exit 1
2675                         fi
2676                         cd UU
2677                         ;;
2678                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2679                         ;;
2680                 esac
2681                 ;;
2682         esac
2683         ;;
2684 esac
2685
2686
2687 case "$usecrosscompile" in
2688 $define|true|[yY]*)
2689         $echo "Cross-compiling..."
2690         croak=''
2691         case "$cc" in
2692         *-*-gcc) # A cross-compiling gcc, probably.
2693             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2694             ar=$targetarch-ar
2695             # leave out ld, choosing it is more complex
2696             nm=$targetarch-nm
2697             ranlib=$targetarch-ranlib
2698             $echo 'extern int foo;' > try.c
2699             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2700             shift
2701             if $test $# -gt 0; then
2702                 incpth="$incpth $*"
2703                 incpth="`$echo $incpth|$sed 's/^ //'`"
2704                 echo "Guessing incpth '$incpth'." >&4
2705                 for i in $*; do
2706                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2707                     if $test -d $j; then
2708                         libpth="$libpth $j"
2709                     fi
2710                 done   
2711                 libpth="`$echo $libpth|$sed 's/^ //'`"
2712                 echo "Guessing libpth '$libpth'." >&4
2713             fi
2714             $rm -f try.c
2715             ;;
2716         esac
2717         case "$targetarch" in
2718         '') echo "Targetarch not defined." >&4; croak=y ;;
2719         *)  echo "Using targetarch $targetarch." >&4 ;;
2720         esac
2721         case "$incpth" in
2722         '') echo "Incpth not defined." >&4; croak=y ;;
2723         *)  echo "Using incpth '$incpth'." >&4 ;;
2724         esac
2725         case "$libpth" in
2726         '') echo "Libpth not defined." >&4; croak=y ;;
2727         *)  echo "Using libpth '$libpth'." >&4 ;;
2728         esac
2729         case "$usrinc" in
2730         '') for i in $incpth; do
2731                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2732                     usrinc=$i
2733                     echo "Guessing usrinc $usrinc." >&4
2734                     break
2735                 fi
2736             done
2737             case "$usrinc" in
2738             '') echo "Usrinc not defined." >&4; croak=y ;;
2739             esac
2740             ;;
2741         *)  echo "Using usrinc $usrinc." >&4 ;;
2742         esac
2743         case "$targethost" in
2744         '') echo "Targethost not defined." >&4; croak=y ;;
2745         *)  echo "Using targethost $targethost." >&4
2746         esac
2747         locincpth=' '
2748         loclibpth=' '
2749         case "$croak" in
2750         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2751         esac
2752         case "$src" in
2753         /*) run=$src/Cross/run
2754             targetmkdir=$src/Cross/mkdir
2755             to=$src/Cross/to
2756             from=$src/Cross/from
2757             ;;
2758         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2759             run=$pwd/Cross/run
2760             targetmkdir=$pwd/Cross/mkdir
2761             to=$pwd/Cross/to
2762             from=$pwd/Cross/from
2763             ;;
2764         esac
2765         case "$targetrun" in
2766         '') targetrun=ssh ;;
2767         esac
2768         case "$targetto" in
2769         '') targetto=scp ;;
2770         esac
2771         case "$targetfrom" in
2772         '') targetfrom=scp ;;
2773         esac
2774         run=$run-$targetrun
2775         to=$to-$targetto
2776         from=$from-$targetfrom
2777         case "$targetdir" in
2778         '')  targetdir=/tmp
2779              echo "Guessing targetdir $targetdir." >&4
2780              ;;
2781         esac
2782         case "$targetuser" in
2783         '')  targetuser=root
2784              echo "Guessing targetuser $targetuser." >&4
2785              ;;
2786         esac
2787         case "$targetfrom" in
2788         scp)    q=-q ;;
2789         *)      q='' ;;
2790         esac
2791         case "$targetrun" in
2792         ssh|rsh)
2793             cat >$run <<EOF
2794 #!/bin/sh
2795 case "\$1" in
2796 -cwd)
2797   shift
2798   cwd=\$1
2799   shift
2800   ;;
2801 esac
2802 case "\$cwd" in
2803 '') cwd=$targetdir ;;
2804 esac
2805 exe=\$1
2806 shift
2807 if $test ! -f \$exe.xok; then
2808   $to \$exe
2809   $touch \$exe.xok
2810 fi
2811 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2812 EOF
2813             ;;
2814         *)  echo "Unknown targetrun '$targetrun'" >&4
2815             exit 1
2816             ;;
2817         esac
2818         case "$targetmkdir" in
2819         */Cross/mkdir)
2820             cat >$targetmkdir <<EOF
2821 #!/bin/sh
2822 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2823 EOF
2824             $chmod a+rx $targetmkdir
2825             ;;
2826         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2827             exit 1
2828             ;;
2829         esac
2830         case "$targetto" in
2831         scp|rcp)
2832             cat >$to <<EOF
2833 #!/bin/sh
2834 for f in \$@
2835 do
2836   case "\$f" in
2837   /*)
2838     $targetmkdir \`dirname \$f\`
2839     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2840     ;;
2841   *)
2842     $targetmkdir $targetdir/\`dirname \$f\`
2843     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2844     ;;
2845   esac
2846 done
2847 exit 0
2848 EOF
2849             ;;
2850         cp) cat >$to <<EOF
2851 #!/bin/sh
2852 for f in \$@
2853 do
2854   case "\$f" in
2855   /*)
2856     $mkdir -p $targetdir/\`dirname \$f\`
2857     $cp \$f $targetdir/\$f || exit 1
2858     ;;
2859   *)
2860     $targetmkdir $targetdir/\`dirname \$f\`
2861     $cp \$f $targetdir/\$f || exit 1
2862     ;;
2863   esac
2864 done
2865 exit 0
2866 EOF
2867             ;;
2868         *)  echo "Unknown targetto '$targetto'" >&4
2869             exit 1
2870             ;;
2871         esac
2872         case "$targetfrom" in
2873         scp|rcp)
2874           cat >$from <<EOF
2875 #!/bin/sh
2876 for f in \$@
2877 do
2878   $rm -f \$f
2879   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2880 done
2881 exit 0
2882 EOF
2883             ;;
2884         cp) cat >$from <<EOF
2885 #!/bin/sh
2886 for f in \$@
2887 do
2888   $rm -f \$f
2889   cp $targetdir/\$f . || exit 1
2890 done
2891 exit 0
2892 EOF
2893             ;;
2894         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2895             exit 1
2896             ;;
2897         esac
2898         if $test ! -f $run; then
2899             echo "Target 'run' script '$run' not found." >&4
2900         else
2901             $chmod a+rx $run
2902         fi
2903         if $test ! -f $to; then
2904             echo "Target 'to' script '$to' not found." >&4
2905         else
2906             $chmod a+rx $to
2907         fi
2908         if $test ! -f $from; then
2909             echo "Target 'from' script '$from' not found." >&4
2910         else
2911             $chmod a+rx $from
2912         fi
2913         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2914             exit 1
2915         fi
2916         cat >&4 <<EOF
2917 Using '$run' for remote execution,
2918 and '$from' and '$to'
2919 for remote file transfer.
2920 EOF
2921         ;;
2922 *)      run=''
2923         to=:
2924         from=:
2925         usecrosscompile='undef'
2926         targetarch=''
2927         ;;
2928 esac
2929
2930 : see whether [:lower:] and [:upper:] are supported character classes
2931 echo " "
2932 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2933 ABYZ)
2934         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2935         up='[:upper:]'
2936         low='[:lower:]'
2937         ;;
2938 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2939         # (0xd9 and 0xe2), therefore that is a nice testing point.
2940         if test "X$up" = X -o "X$low" = X; then
2941             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2942             rs) up='[A-Z]'
2943                 low='[a-z]'
2944                 ;;
2945             esac
2946         fi
2947         if test "X$up" = X -o "X$low" = X; then
2948             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2949             rs) up='A-Z'
2950                 low='a-z'
2951                 ;;
2952             esac
2953         fi
2954         if test "X$up" = X -o "X$low" = X; then
2955             case "`echo RS | od -x 2>/dev/null`" in
2956             *D9E2*|*d9e2*)
2957                 echo "Hey, this might be EBCDIC." >&4
2958                 if test "X$up" = X -o "X$low" = X; then
2959                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2960                     rs) up='[A-IJ-RS-Z]'
2961                         low='[a-ij-rs-z]'
2962                         ;;
2963                     esac
2964                 fi
2965                 if test "X$up" = X -o "X$low" = X; then
2966                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2967                     rs) up='A-IJ-RS-Z'
2968                         low='a-ij-rs-z'
2969                         ;;
2970                     esac
2971                 fi
2972                 ;;
2973             esac
2974         fi
2975 esac
2976 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2977 rs)
2978     echo "Using $up and $low to convert case." >&4
2979     ;;
2980 *)
2981     echo "I don't know how to translate letters from upper to lower case." >&4
2982     echo "Your tr is not acting any way I know of." >&4
2983     exit 1
2984     ;;
2985 esac
2986 : set up the translation script tr, must be called with ./tr of course
2987 cat >tr <<EOSC
2988 $startsh
2989 case "\$1\$2" in
2990 '[A-Z][a-z]') exec $tr '$up' '$low';;
2991 '[a-z][A-Z]') exec $tr '$low' '$up';;
2992 esac
2993 exec $tr "\$@"
2994 EOSC
2995 chmod +x tr
2996 $eunicefix tr
2997
2998 : Try to determine whether config.sh was made on this system
2999 case "$config_sh" in
3000 '')
3001 myuname=`$uname -a 2>/dev/null`
3002 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3003 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3004 # because the A-Z/a-z are not consecutive.
3005 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3006         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3007 newmyuname="$myuname"
3008 dflt=n
3009 case "$knowitall" in
3010 '')
3011         if test -f ../config.sh; then
3012                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3013                         eval "`grep myuname= ../config.sh`"
3014                 fi
3015                 if test "X$myuname" = "X$newmyuname"; then
3016                         dflt=y
3017                 fi
3018         fi
3019         ;;
3020 *) dflt=y;;
3021 esac
3022
3023 : Get old answers from old config file if Configure was run on the
3024 : same system, otherwise use the hints.
3025 hint=default
3026 cd ..
3027 if test -f config.sh; then
3028         echo " "
3029         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3030         . UU/myread
3031         case "$ans" in
3032         n*|N*) echo "OK, I'll ignore it."
3033                 mv config.sh config.sh.old
3034                 myuname="$newmyuname"
3035                 ;;
3036         *)  echo "Fetching default answers from your old config.sh file..." >&4
3037                 tmp_n="$n"
3038                 tmp_c="$c"
3039                 tmp_sh="$sh"
3040                 . ./config.sh
3041                 cp config.sh UU
3042                 n="$tmp_n"
3043                 c="$tmp_c"
3044                 : Older versions did not always set $sh.  Catch re-use of such
3045                 : an old config.sh.
3046                 case "$sh" in
3047                 '') sh="$tmp_sh" ;;
3048                 esac
3049                 hint=previous
3050                 ;;
3051         esac
3052 fi
3053 . ./UU/checkcc
3054 if test ! -f config.sh; then
3055         $cat <<EOM
3056
3057 First time through, eh?  I have some defaults handy for some systems
3058 that need some extra help getting the Configure answers right:
3059
3060 EOM
3061         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3062         dflt=''
3063         : Half the following guesses are probably wrong... If you have better
3064         : tests or hints, please send them to perlbug@perl.org
3065         : The metaconfig authors would also appreciate a copy...
3066         $test -f /irix && osname=irix
3067         $test -f /xenix && osname=sco_xenix
3068         $test -f /dynix && osname=dynix
3069         $test -f /dnix && osname=dnix
3070         $test -f /lynx.os && osname=lynxos
3071         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3072         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3073         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3074         $test -f /bin/mips && /bin/mips && osname=mips
3075         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3076                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3077         $test -d /usr/apollo/bin && osname=apollo
3078         $test -f /etc/saf/_sactab && osname=svr4
3079         $test -d /usr/include/minix && osname=minix
3080         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3081         if $test -d /MachTen -o -d /MachTen_Folder; then
3082                 osname=machten
3083                 if $test -x /sbin/version; then
3084                         osvers=`/sbin/version | $awk '{print $2}' |
3085                         $sed -e 's/[A-Za-z]$//'`
3086                 elif $test -x /usr/etc/version; then
3087                         osvers=`/usr/etc/version | $awk '{print $2}' |
3088                         $sed -e 's/[A-Za-z]$//'`
3089                 else
3090                         osvers="$2.$3"
3091                 fi
3092         fi
3093
3094         $test -f /sys/posix.dll &&
3095                 $test -f /usr/bin/what &&
3096                 set X `/usr/bin/what /sys/posix.dll` &&
3097                 $test "$3" = UWIN &&
3098                 osname=uwin &&
3099                 osvers="$5"
3100
3101         if $test -f $uname; then
3102                 set X $myuname
3103                 shift
3104
3105                 case "$5" in
3106                 fps*) osname=fps ;;
3107                 mips*)
3108                         case "$4" in
3109                         umips) osname=umips ;;
3110                         *) osname=mips ;;
3111                         esac;;
3112                 [23]100) osname=mips ;;
3113                 next*) osname=next ;;
3114                 i386*)
3115                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3116                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3117                                 osname='sco'
3118                                 osvers=$tmp
3119                         elif $test -f /etc/kconfig; then
3120                                 osname=isc
3121                                 if test "$lns" = "$ln -s"; then
3122                                         osvers=4
3123                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3124                                         osvers=3
3125                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3126                                         osvers=2
3127                                 fi
3128                         fi
3129                         tmp=''
3130                         ;;
3131                 pc*)
3132                         if test -n "$DJGPP"; then
3133                                 osname=dos
3134                                 osvers=djgpp
3135                         fi
3136                         ;;
3137                 esac
3138
3139                 case "$1" in
3140                 aix) osname=aix
3141                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3142                         case "$tmp" in
3143                         # oslevel can fail with:
3144                         # oslevel: Unable to acquire lock.
3145                         *not\ found) osvers="$4"."$3" ;;
3146                         '<3240'|'<>3240') osvers=3.2.0 ;;
3147                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3148                         '=3250'|'>3250') osvers=3.2.5 ;;
3149                         *) osvers=$tmp;;
3150                         esac
3151                         ;;
3152                 bsd386) osname=bsd386
3153                         osvers=`$uname -r`
3154                         ;;
3155                 cygwin*) osname=cygwin
3156                         osvers="$3"
3157                         ;;
3158                 *dc.osx) osname=dcosx
3159                         osvers="$3"
3160                         ;;
3161                 dnix) osname=dnix
3162                         osvers="$3"
3163                         ;;
3164                 domainos) osname=apollo
3165                         osvers="$3"
3166                         ;;
3167                 dgux)   osname=dgux
3168                         osvers="$3"
3169                         ;;
3170                 dragonfly) osname=dragonfly
3171                         osvers="$3"
3172                         ;;
3173                 dynixptx*) osname=dynixptx
3174                         osvers=`echo "$4"|sed 's/^v//'`
3175                         ;;
3176                 freebsd) osname=freebsd
3177                         osvers="$3" ;;
3178                 genix)  osname=genix ;;
3179                 gnu)    osname=gnu
3180                         osvers="$3" ;;
3181                 hp*)    osname=hpux
3182                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3183                         ;;
3184                 irix*)  osname=irix
3185                         case "$3" in
3186                         4*) osvers=4 ;;
3187                         5*) osvers=5 ;;
3188                         *)      osvers="$3" ;;
3189                         esac
3190                         ;;
3191                 linux)  osname=linux
3192                         case "$3" in
3193                         *)      osvers="$3" ;;
3194                         esac
3195                         ;;
3196                 MiNT)   osname=mint
3197                         ;;
3198                 netbsd*) osname=netbsd
3199                         osvers="$3"
3200                         ;;
3201                 news-os) osvers="$3"
3202                         case "$3" in
3203                         4*) osname=newsos4 ;;
3204                         *) osname=newsos ;;
3205                         esac
3206                         ;;
3207                 next*) osname=next ;;
3208                 nonstop-ux) osname=nonstopux ;;
3209                 openbsd) osname=openbsd
3210                         osvers="$3"
3211                         ;;
3212                 os2)    osname=os2
3213                         osvers="$4"
3214                         ;;
3215                 POSIX-BC | posix-bc ) osname=posix-bc
3216                         osvers="$3"
3217                         ;;
3218                 powerux | power_ux | powermax_os | powermaxos | \
3219                 powerunix | power_unix) osname=powerux
3220                         osvers="$3"
3221                         ;;
3222                 qnx) osname=qnx
3223                         osvers="$4"
3224                         ;;
3225                 solaris) osname=solaris
3226                         case "$3" in
3227                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3228                         *)      osvers="$3" ;;
3229                         esac
3230                         ;;
3231                 sunos) osname=sunos
3232                         case "$3" in
3233                         5*) osname=solaris
3234                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3235                         *)      osvers="$3" ;;
3236                         esac
3237                         ;;
3238                 titanos) osname=titanos
3239                         case "$3" in
3240                         1*) osvers=1 ;;
3241                         2*) osvers=2 ;;
3242                         3*) osvers=3 ;;
3243                         4*) osvers=4 ;;
3244                         *)      osvers="$3" ;;
3245                         esac
3246                         ;;
3247                 ultrix) osname=ultrix
3248                         osvers="$3"
3249                         ;;
3250                 osf1|mls+)      case "$5" in
3251                                 alpha)
3252                                         osname=dec_osf
3253                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3254                                         case "$osvers" in
3255                                         [1-9].[0-9]*) ;;
3256                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3257                                         esac
3258                                         ;;
3259                         hp*)    osname=hp_osf1  ;;
3260                         mips)   osname=mips_osf1 ;;
3261                         esac
3262                         ;;
3263                 # UnixWare 7.1.2 is known as Open UNIX 8
3264                 openunix|unixware) osname=svr5
3265                         osvers="$4"
3266                         ;;
3267                 uts)    osname=uts
3268                         osvers="$3"
3269                         ;;
3270                 vos) osvers="$3"
3271                         ;;
3272                 $2) case "$osname" in
3273                         *isc*) ;;
3274                         *freebsd*) ;;
3275                         svr*)
3276                                 : svr4.x or possibly later
3277                                 case "svr$3" in
3278                                 ${osname}*)
3279                                         osname=svr$3
3280                                         osvers=$4
3281                                         ;;
3282                                 esac
3283                                 case "$osname" in
3284                                 svr4.0)
3285                                         : Check for ESIX
3286                                         if test -f /stand/boot ; then
3287                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3288                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3289                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3290                                                         if test -n "$isesix"; then
3291                                                                 osname=esix4
3292                                                         fi
3293                                                 fi
3294                                         fi
3295                                         ;;
3296                                 esac
3297                                 ;;
3298                         *)      if test -f /etc/systemid; then
3299                                         osname=sco
3300                                         set `echo $3 | $sed 's/\./ /g'` $4
3301                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3302                                                 osvers=$1.$2.$3
3303                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3304                                                 osvers=$1.$2
3305                                         elif $test -f $src/hints/sco_$1.sh; then
3306                                                 osvers=$1
3307                                         fi
3308                                 else
3309                                         case "$osname" in
3310                                         '') : Still unknown.  Probably a generic Sys V.
3311                                                 osname="sysv"
3312                                                 osvers="$3"
3313                                                 ;;
3314                                         esac
3315                                 fi
3316                                 ;;
3317                         esac
3318                         ;;
3319                 *)      case "$osname" in
3320                         '') : Still unknown.  Probably a generic BSD.
3321                                 osname="$1"
3322                                 osvers="$3"
3323                                 ;;
3324                         esac
3325                         ;;
3326                 esac
3327         else
3328                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3329                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3330                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3331                                 osname=news_os
3332                         fi
3333                         $rm -f UU/kernel.what
3334                 elif test -d c:/. -o -n "$is_os2" ; then
3335                         set X $myuname
3336                         osname=os2
3337                         osvers="$5"
3338                 fi
3339         fi
3340
3341         case "$targetarch" in
3342         '') ;;
3343         *)  hostarch=$osname
3344             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3345             osvers=''
3346             ;;
3347         esac
3348
3349         : Now look for a hint file osname_osvers, unless one has been
3350         : specified already.
3351         case "$hintfile" in
3352         ''|' ')
3353                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3354                 : Also try without trailing minor version numbers.
3355                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3356                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3357                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3358                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3359                 case "$file" in
3360                 '') dflt=none ;;
3361                 *)  case "$osvers" in
3362                         '') dflt=$file
3363                                 ;;
3364                         *)  if $test -f $src/hints/$file.sh ; then
3365                                         dflt=$file
3366                                 elif $test -f $src/hints/$xfile.sh ; then
3367                                         dflt=$xfile
3368                                 elif $test -f $src/hints/$xxfile.sh ; then
3369                                         dflt=$xxfile
3370                                 elif $test -f $src/hints/$xxxfile.sh ; then
3371                                         dflt=$xxxfile
3372                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3373                                         dflt=$xxxxfile
3374                                 elif $test -f "$src/hints/${osname}.sh" ; then
3375                                         dflt="${osname}"
3376                                 else
3377                                         dflt=none
3378                                 fi
3379                                 ;;
3380                         esac
3381                         ;;
3382                 esac
3383                 if $test -f Policy.sh ; then
3384                         case "$dflt" in
3385                         *Policy*) ;;
3386                         none) dflt="Policy" ;;
3387                         *) dflt="Policy $dflt" ;;
3388                         esac
3389                 fi
3390                 ;;
3391         *)
3392                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3393                 ;;
3394         esac
3395
3396         if $test -f Policy.sh ; then
3397                 $cat <<EOM
3398
3399 There's also a Policy hint file available, which should make the
3400 site-specific (policy) questions easier to answer.
3401 EOM
3402
3403         fi
3404
3405         $cat <<EOM
3406
3407 You may give one or more space-separated answers, or "none" if appropriate.
3408 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3409 previous run of Configure, you may specify it as well as or instead of
3410 OS-specific hints.  If hints are provided for your OS, you should use them:
3411 although Perl can probably be built without hints on many platforms, using
3412 hints often improve performance and may enable features that Configure can't
3413 set up on its own. If there are no hints that match your OS, specify "none";
3414 DO NOT give a wrong version or a wrong OS.
3415
3416 EOM
3417
3418         rp="Which of these apply, if any?"
3419         . UU/myread
3420         tans=$ans
3421         for file in $tans; do
3422                 if $test X$file = XPolicy -a -f Policy.sh; then
3423                         . Policy.sh
3424                         $cat Policy.sh >> UU/config.sh
3425                 elif $test -f $src/hints/$file.sh; then
3426                         . $src/hints/$file.sh
3427                         $cat $src/hints/$file.sh >> UU/config.sh
3428                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3429                         : nothing
3430                 else
3431                         : Give one chance to correct a possible typo.
3432                         echo "$file.sh does not exist"
3433                         dflt=$file
3434                         rp="hint to use instead?"
3435                         . UU/myread
3436                         for file in $ans; do
3437                                 if $test -f "$src/hints/$file.sh"; then
3438                                         . $src/hints/$file.sh
3439                                         $cat $src/hints/$file.sh >> UU/config.sh
3440                                 elif $test X$ans = X -o X$ans = Xnone ; then
3441                                         : nothing
3442                                 else
3443                                         echo "$file.sh does not exist -- ignored."
3444                                 fi
3445                         done
3446                 fi
3447         done
3448
3449         hint=recommended
3450         : Remember our hint file for later.
3451         if $test -f "$src/hints/$file.sh" ; then
3452                 hintfile="$file"
3453         else
3454                 hintfile=''
3455         fi
3456 fi
3457 cd UU
3458 ;;
3459 *)
3460         echo " "
3461         echo "Fetching default answers from $config_sh..." >&4
3462         tmp_n="$n"
3463         tmp_c="$c"
3464         cd ..
3465         cp $config_sh config.sh 2>/dev/null
3466         chmod +w config.sh
3467         . ./config.sh
3468         cd UU
3469         cp ../config.sh .
3470         n="$tmp_n"
3471         c="$tmp_c"
3472         hint=previous
3473         ;;
3474 esac
3475 test "$override" && . ./optdef.sh
3476
3477 : Restore computed paths
3478 for file in $loclist $trylist; do
3479         eval $file="\$_$file"
3480 done
3481
3482 cat << EOM
3483
3484 Configure uses the operating system name and version to set some defaults.
3485 The default value is probably right if the name rings a bell. Otherwise,
3486 since spelling matters for me, either accept the default or answer "none"
3487 to leave it blank.
3488
3489 EOM
3490 case "$osname" in
3491         ''|' ')
3492                 case "$hintfile" in
3493                 ''|' '|none) dflt=none ;;
3494                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3495                 esac
3496                 ;;
3497         *) dflt="$osname" ;;
3498 esac
3499 rp="Operating system name?"
3500 . ./myread
3501 case "$ans" in
3502 none)  osname='' ;;
3503 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3504 esac
3505 echo " "
3506 case "$osvers" in
3507         ''|' ')
3508                 case "$hintfile" in
3509                 ''|' '|none) dflt=none ;;
3510                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3511                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3512                         case "$dflt" in
3513                         ''|' ') dflt=none ;;
3514                         esac
3515                         ;;
3516                 esac
3517                 ;;
3518         *) dflt="$osvers" ;;
3519 esac
3520 rp="Operating system version?"
3521 . ./myread
3522 case "$ans" in
3523 none)  osvers='' ;;
3524 *) osvers="$ans" ;;
3525 esac
3526
3527
3528 . ./posthint.sh
3529
3530 : who configured the system
3531 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3532 case "$cf_by" in
3533 "")
3534         cf_by=`(logname) 2>/dev/null`
3535         case "$cf_by" in
3536         "")
3537                 cf_by=`(whoami) 2>/dev/null`
3538                 case "$cf_by" in
3539                 "") cf_by=unknown ;;
3540                 esac ;;
3541         esac ;;
3542 esac
3543
3544 : decide how portable to be.  Allow command line overrides.
3545 case "$d_portable" in
3546 "$undef") ;;
3547 *)      d_portable="$define" ;;
3548 esac
3549
3550 : set up shell script to do ~ expansion
3551 cat >filexp <<EOSS
3552 $startsh
3553 : expand filename
3554 case "\$1" in
3555  ~/*|~)
3556         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3557         ;;
3558  ~*)
3559         if $test -f /bin/csh; then
3560                 /bin/csh -f -c "glob \$1"
3561                 failed=\$?
3562                 echo ""
3563                 exit \$failed
3564         else
3565                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3566                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3567                 if $test ! -d "\$dir"; then
3568                         me=\`basename \$0\`
3569                         echo "\$me: can't locate home directory for: \$name" >&2
3570                         exit 1
3571                 fi
3572                 case "\$1" in
3573                 */*)
3574                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3575                         ;;
3576                 *)
3577                         echo \$dir
3578                         ;;
3579                 esac
3580         fi
3581         ;;
3582 *)
3583         echo \$1
3584         ;;
3585 esac
3586 EOSS
3587 chmod +x filexp
3588 $eunicefix filexp
3589
3590 : now set up to get a file name
3591 cat <<EOS >getfile
3592 $startsh
3593 EOS
3594 cat <<'EOSC' >>getfile
3595 tilde=''
3596 fullpath=''
3597 already=''
3598 skip=''
3599 none_ok=''
3600 exp_file=''
3601 nopath_ok=''
3602 orig_rp="$rp"
3603 orig_dflt="$dflt"
3604 case "$gfpth" in
3605 '') gfpth='.' ;;
3606 esac
3607
3608 case "$fn" in
3609 *\(*)
3610         : getfile will accept an answer from the comma-separated list
3611         : enclosed in parentheses even if it does not meet other criteria.
3612         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3613         fn=`echo $fn | sed 's/(.*)//'`
3614         ;;
3615 esac
3616
3617 case "$fn" in
3618 *:*)
3619         loc_file=`expr $fn : '.*:\(.*\)'`
3620         fn=`expr $fn : '\(.*\):.*'`
3621         ;;
3622 esac
3623
3624 case "$fn" in
3625 *~*) tilde=true;;
3626 esac
3627 case "$fn" in
3628 */*) fullpath=true;;
3629 esac
3630 case "$fn" in
3631 *+*) skip=true;;
3632 esac
3633 case "$fn" in
3634 *n*) none_ok=true;;
3635 esac
3636 case "$fn" in
3637 *e*) exp_file=true;;
3638 esac
3639 case "$fn" in
3640 *p*) nopath_ok=true;;
3641 esac
3642
3643 case "$fn" in
3644 *f*) type='File';;
3645 *d*) type='Directory';;
3646 *l*) type='Locate';;
3647 esac
3648
3649 what="$type"
3650 case "$what" in
3651 Locate) what='File';;
3652 esac
3653
3654 case "$exp_file" in
3655 '')
3656         case "$d_portable" in
3657         "$define") ;;
3658         *) exp_file=true;;
3659         esac
3660         ;;
3661 esac
3662
3663 cd ..
3664 while test "$type"; do
3665         redo=''
3666         rp="$orig_rp"
3667         dflt="$orig_dflt"
3668         case "$tilde" in
3669         true) rp="$rp (~name ok)";;
3670         esac
3671         . UU/myread
3672         if test -f UU/getfile.ok && \
3673                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3674         then
3675                 value="$ans"
3676                 ansexp="$ans"
3677                 break
3678         fi
3679         case "$ans" in
3680         none)
3681                 value=''
3682                 ansexp=''
3683                 case "$none_ok" in
3684                 true) type='';;
3685                 esac
3686                 ;;
3687         *)
3688                 case "$tilde" in
3689                 '') value="$ans"
3690                         ansexp="$ans";;
3691                 *)
3692                         value=`UU/filexp $ans`
3693                         case $? in
3694                         0)
3695                                 if test "$ans" != "$value"; then
3696                                         echo "(That expands to $value on this system.)"
3697                                 fi
3698                                 ;;
3699                         *) value="$ans";;
3700                         esac
3701                         ansexp="$value"
3702                         case "$exp_file" in
3703                         '') value="$ans";;
3704                         esac
3705                         ;;
3706                 esac
3707                 case "$fullpath" in
3708                 true)
3709                         case "$ansexp" in
3710                         /*) value="$ansexp" ;;
3711                         [a-zA-Z]:/*) value="$ansexp" ;;
3712                         *)
3713                                 redo=true
3714                                 case "$already" in
3715                                 true)
3716                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3717                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3718                                         ;;
3719                                 *)
3720                                 echo "Please give a full path name, starting with slash." >&4
3721                                         case "$tilde" in
3722                                         true)
3723                                 echo "Note that using ~name is ok provided it expands well." >&4
3724                                                 already=true
3725                                                 ;;
3726                                         esac
3727                                 esac
3728                                 ;;
3729                         esac
3730                         ;;
3731                 esac
3732                 case "$redo" in
3733                 '')
3734                         case "$type" in
3735                         File)
3736                                 for fp in $gfpth; do
3737                                         if test "X$fp" = X.; then
3738                                             pf="$ansexp"
3739                                         else    
3740                                             pf="$fp/$ansexp"
3741                                         fi
3742                                         if test -f "$pf"; then
3743                                                 type=''
3744                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3745                                         then
3746                                                 echo "($value is not a plain file, but that's ok.)"
3747                                                 type=''
3748                                         fi
3749                                         if test X"$type" = X; then
3750                                             value="$pf"
3751                                             break
3752                                         fi
3753                                 done
3754                                 ;;
3755                         Directory)
3756                                 for fp in $gfpth; do
3757                                         if test "X$fp" = X.; then
3758                                             dir="$ans"
3759                                             direxp="$ansexp"
3760                                         else    
3761                                             dir="$fp/$ansexp"
3762                                             direxp="$fp/$ansexp"
3763                                         fi
3764                                         if test -d "$direxp"; then
3765                                                 type=''
3766                                                 value="$dir"
3767                                                 break
3768                                         fi
3769                                 done
3770                                 ;;
3771                         Locate)
3772                                 if test -d "$ansexp"; then
3773                                         echo "(Looking for $loc_file in directory $value.)"
3774                                         value="$value/$loc_file"
3775                                         ansexp="$ansexp/$loc_file"
3776                                 fi
3777                                 if test -f "$ansexp"; then
3778                                         type=''
3779                                 fi
3780                                 case "$nopath_ok" in
3781                                 true)   case "$value" in
3782                                         */*) ;;
3783                                         *)      echo "Assuming $value will be in people's path."
3784                                                 type=''
3785                                                 ;;
3786                                         esac
3787                                         ;;
3788                                 esac
3789                                 ;;
3790                         esac
3791
3792                         case "$skip" in
3793                         true) type='';
3794                         esac
3795
3796                         case "$type" in
3797                         '') ;;
3798                         *)
3799                                 if test "$fastread" = yes; then
3800                                         dflt=y
3801                                 else
3802                                         dflt=n
3803                                 fi
3804                                 rp="$what $value doesn't exist.  Use that name anyway?"
3805                                 . UU/myread
3806                                 dflt=''
3807                                 case "$ans" in
3808                                 y*) type='';;
3809                                 *) echo " ";;
3810                                 esac
3811                                 ;;
3812                         esac
3813                         ;;
3814                 esac
3815                 ;;
3816         esac
3817 done
3818 cd UU
3819 ans="$value"
3820 rp="$orig_rp"
3821 dflt="$orig_dflt"
3822 rm -f getfile.ok
3823 test "X$gfpthkeep" != Xy && gfpth=""
3824 EOSC
3825
3826 : determine root of directory hierarchy where package will be installed.
3827 case "$prefix" in
3828 '')
3829         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3830         ;;
3831 *?/)
3832         dflt=`echo "$prefix" | sed 's/.$//'`
3833         ;;
3834 *)
3835         dflt="$prefix"
3836         ;;
3837 esac
3838 $cat <<EOM
3839
3840 By default, $package will be installed in $dflt/bin, manual pages
3841 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3842 installation directories. Typically this is something like /usr/local.
3843 If you wish to have binaries under /usr/bin but other parts of the
3844 installation under /usr/local, that's ok: you will be prompted
3845 separately for each of the installation directories, the prefix being
3846 only used to set the defaults.
3847
3848 EOM
3849 fn=d~
3850 rp='Installation prefix to use?'
3851 . ./getfile
3852 oldprefix=''
3853 case "$prefix" in
3854 '') ;;
3855 *)
3856         case "$ans" in
3857         "$prefix") ;;
3858         *) oldprefix="$prefix";;
3859         esac
3860         ;;
3861 esac
3862 prefix="$ans"
3863 prefixexp="$ansexp"
3864
3865 case "$afsroot" in
3866 '')     afsroot=/afs ;;
3867 *)      afsroot=$afsroot ;;
3868 esac
3869
3870 : is AFS running?
3871 echo " "
3872 case "$afs" in
3873 $define|true)   afs=true ;;
3874 $undef|false)   afs=false ;;
3875 *)      if test -d $afsroot; then
3876                 afs=true
3877         else
3878                 afs=false
3879         fi
3880         ;;
3881 esac
3882 if $afs; then
3883         echo "AFS may be running... I'll be extra cautious then..." >&4
3884 else
3885         echo "AFS does not seem to be running..." >&4
3886 fi
3887
3888 : determine installation prefix for where package is to be installed.
3889 if $afs; then 
3890 $cat <<EOM
3891
3892 Since you are running AFS, I need to distinguish the directory in which
3893 files will reside from the directory in which they are installed (and from
3894 which they are presumably copied to the former directory by occult means).
3895
3896 EOM
3897         case "$installprefix" in
3898         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3899         *) dflt="$installprefix";;
3900         esac
3901 else
3902 $cat <<EOM
3903
3904 In some special cases, particularly when building $package for distribution,
3905 it is convenient to distinguish the directory in which files should be
3906 installed from the directory ($prefix) in which they will
3907 eventually reside.  For most users, these two directories are the same.
3908
3909 EOM
3910         case "$installprefix" in
3911         '') dflt=$prefix ;;
3912         *) dflt=$installprefix;;
3913         esac
3914 fi
3915 fn=d~
3916 rp='What installation prefix should I use for installing files?'
3917 . ./getfile
3918 installprefix="$ans"
3919 installprefixexp="$ansexp"
3920
3921 : Perform the prefixexp/installprefixexp correction if necessary
3922 cat <<EOS >installprefix
3923 $startsh
3924 EOS
3925 cat <<'EOSC' >>installprefix
3926 : Change installation prefix, if necessary.
3927 if $test X"$prefix" != X"$installprefix"; then
3928     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3929 else
3930     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3931 fi
3932 EOSC
3933 chmod +x installprefix
3934 $eunicefix installprefix
3935
3936 : Set variables such as privlib and privlibexp from the output of ./getfile
3937 : performing the prefixexp/installprefixexp correction if necessary.
3938 cat <<EOS >setprefixvar
3939 $startsh
3940 EOS
3941 cat <<'EOSC' >>setprefixvar
3942 eval "${prefixvar}=\"\$ans\""
3943 eval "${prefixvar}exp=\"\$ansexp\""
3944 . ./installprefix
3945 EOSC
3946 chmod +x setprefixvar
3947 $eunicefix setprefixvar
3948
3949 : set up the script used to warn in case of inconsistency
3950 cat <<EOS >whoa
3951 $startsh
3952 EOS
3953 cat <<'EOSC' >>whoa
3954 dflt=y
3955 case "$hint" in
3956     recommended)
3957         case "$hintfile" in
3958         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3959                 ;;
3960         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3961                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3962                 ;;
3963         esac
3964         ;;
3965     *)  echo " "
3966         echo "*** WHOA THERE!!! ***" >&4
3967         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3968         ;;
3969 esac
3970 rp="    Keep the $hint value?"
3971 . ./myread
3972 case "$ans" in
3973 y) td=$was; tu=$was;;
3974 esac
3975 EOSC
3976
3977 : function used to set $1 to $val
3978 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3979 case "$val$was" in
3980 $define$undef) . ./whoa; eval "$var=\$td";;
3981 $undef$define) . ./whoa; eval "$var=\$tu";;
3982 *) eval "$var=$val";;
3983 esac'
3984
3985 case "$usesocks" in
3986 $define|true|[yY]*)     dflt='y';;
3987 *) dflt='n';;
3988 esac
3989 cat <<EOM
3990
3991 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3992 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3993 to use the PerlIO abstraction layer, this will be implicitly selected.
3994
3995 If this doesn't make any sense to you, just accept the default '$dflt'.
3996 EOM
3997 rp='Build Perl for SOCKS?'
3998 . ./myread
3999 case "$ans" in
4000 y|Y)    val="$define" ;;     
4001 *)      val="$undef" ;;
4002 esac
4003 set usesocks
4004 eval $setvar
4005
4006 case "$usesocks" in
4007 $define|true|[yY]*) useperlio="$define";;
4008 esac
4009
4010 case "$useperlio" in
4011 $define|true|[yY]*|'')  dflt='y';;
4012 *) dflt='n';;
4013 esac
4014 cat <<EOM
4015
4016 Previous version of $package used the standard IO mechanisms as
4017 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4018 alternate IO mechanisms via the PerlIO abstraction layer, but the
4019 stdio mechanism is still available if needed.  The abstraction layer
4020 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4021 Using PerlIO with sfio may cause problems with some extension modules.
4022
4023 If this doesn't make any sense to you, just accept the default '$dflt'.
4024 EOM
4025 rp='Use the PerlIO abstraction layer?'
4026 . ./myread
4027 case "$ans" in
4028 y|Y) 
4029         val="$define"
4030         ;;
4031 *)      
4032         echo "Ok, doing things the stdio way."
4033         val="$undef"
4034         ;;
4035 esac
4036 set useperlio
4037 eval $setvar 
4038
4039 case "$usesocks" in
4040 $define|true|[yY]*)
4041         case "$useperlio" in
4042         $define|true|[yY]*) ;;
4043         *)      cat >&4 <<EOM
4044
4045 You are using the SOCKS proxy protocol library which means that you
4046 should also use the PerlIO layer.  You may be headed for trouble.
4047
4048 EOM
4049                 ;;
4050         esac
4051         ;;
4052 esac
4053
4054         
4055 : get the patchlevel
4056 echo " "
4057 echo "Getting the current patchlevel..." >&4
4058 if $test -r $rsrc/patchlevel.h;then
4059         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4060         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4061         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4062         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4063         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4064         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4065         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4066 else
4067         revision=0
4068         patchlevel=0
4069         subversion=0
4070         api_revision=0
4071         api_version=0
4072         api_subversion=0
4073         perl_patchlevel=0
4074         $echo "(You do not have patchlevel.h.  Eek.)"
4075 fi
4076 if $test -r $rsrc/.patch ; then
4077         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4078                 perl_patchlevel=`cat $rsrc/.patch`
4079         fi
4080 fi
4081 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4082 version_patchlevel_string="version $patchlevel subversion $subversion"
4083 case "$perl_patchlevel" in
4084 0|'') ;;
4085 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4086 esac
4087
4088 $echo "(You have $package $version_patchlevel_string.)"
4089
4090 case "$osname" in
4091 dos|vms)
4092         : XXX Should be a Configure test for double-dots in filenames.
4093         version=`echo $revision $patchlevel $subversion | \
4094                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4095         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4096                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4097         ;;
4098 *)
4099         version=`echo $revision $patchlevel $subversion | \
4100                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4101         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4102                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4103         ;;
4104 esac
4105 : Special case the 5.005_xx maintenance series, which used 5.005
4106 : without any subversion label as a subdirectory in $sitelib
4107 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4108         api_versionstring='5.005'
4109 fi
4110
4111 case "$usethreads" in
4112 $define|true|[yY]*)     dflt='y';;
4113 *)     # Catch case where user specified ithreads or 5005threads but
4114        # forgot -Dusethreads (A.D. 4/2002)
4115        case "$useithreads$use5005threads" in
4116        *$define*)      
4117                 case "$useperlio" in
4118                 "$define")      dflt='y' ;;
4119                 *)              dflt='n' ;;
4120                 esac
4121                 ;;
4122        *)       dflt='n';;
4123        esac
4124        ;;
4125 esac
4126 cat <<EOM
4127
4128 Perl can be built to take advantage of threads on some systems.
4129 To do so, Configure can be run with -Dusethreads.
4130
4131 Note that Perl built with threading support runs slightly slower
4132 and uses more memory than plain Perl. The current implementation
4133 is believed to be stable, but it is fairly new, and so should be
4134 treated with caution.
4135
4136 If this doesn't make any sense to you, just accept the default '$dflt'.
4137 EOM
4138 rp='Build a threading Perl?'
4139 . ./myread
4140 case "$ans" in
4141 y|Y)    val="$define" ;;
4142 *)      val="$undef" ;;
4143 esac
4144 set usethreads
4145 eval $setvar
4146
4147 if $test $patchlevel -lt 9; then
4148     case "$usethreads" in
4149     $define)
4150         $cat <<EOM
4151
4152 Since release 5.6, Perl has had two different threading implementations,
4153 the newer interpreter-based version (ithreads) with one interpreter per
4154 thread, and the older 5.005 version (5005threads).
4155 The 5005threads version is effectively unmaintained and will probably be
4156 removed in Perl 5.10, so there should be no need to build a Perl using it
4157 unless needed for backwards compatibility with some existing 5.005threads
4158 code.
4159
4160 EOM
4161         : Default to ithreads unless overridden on command line or with
4162         : old config.sh
4163         dflt='y'
4164         case "$use5005threads" in
4165                 $define|true|[yY]*) dflt='n';;
4166         esac
4167         case "$useithreads" in
4168                 $undef|false|[nN]*) dflt='n';;
4169         esac
4170         rp='Use the newer interpreter-based ithreads?'
4171         . ./myread
4172         case "$ans" in
4173         y|Y)    val="$define" ;;
4174         *)      val="$undef" ;;
4175         esac
4176         set useithreads
4177         eval $setvar
4178         : Now set use5005threads to the opposite value.
4179         case "$useithreads" in
4180         $define) val="$undef" ;;
4181         *) val="$define" ;;
4182         esac
4183         set use5005threads
4184         eval $setvar
4185         ;;
4186     *)
4187         useithreads="$undef"
4188         use5005threads="$undef"
4189         ;;
4190     esac
4191
4192     case "$useithreads$use5005threads" in
4193     "$define$define")
4194         $cat >&4 <<EOM
4195
4196 You cannot have both the ithreads and the 5.005 threads enabled
4197 at the same time.  Disabling the 5.005 threads since they are
4198 much less stable than the ithreads.
4199
4200 EOM
4201         use5005threads="$undef"
4202         ;;
4203     esac
4204
4205 else
4206 : perl-5.9.x and later
4207
4208     use5005threads="$undef"
4209     case "$usethreads" in
4210     $define)
4211         : Default to ithreads unless overridden on command line or with
4212         : old config.sh
4213         dflt='y'
4214         case "$useithreads" in
4215                 $undef|false|[nN]*) dflt='n';;
4216         esac
4217         rp='Use the newer interpreter-based ithreads?'
4218         . ./myread
4219         case "$ans" in
4220         y|Y)    val="$define" ;;
4221         *)      val="$undef" ;;
4222         esac
4223         set useithreads
4224         eval $setvar
4225         ;;
4226     *)
4227         useithreads="$undef"
4228         ;;
4229     esac
4230
4231 fi
4232
4233 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4234         cat >&4 <<EOF
4235 ***
4236 *** To build with ithreads you must also use the PerlIO layer.
4237 *** Cannot continue, aborting.
4238 ***
4239 EOF
4240         exit 1
4241 fi
4242
4243 case "$d_oldpthreads" in
4244 '')     : Configure tests would be welcome here.  For now, assume undef.
4245         val="$undef" ;;
4246 *)      val="$d_oldpthreads" ;;
4247 esac
4248 set d_oldpthreads
4249 eval $setvar
4250
4251
4252 : Look for a hint-file generated 'call-back-unit'.  If the
4253 : user has specified that a threading perl is to be built,
4254 : we may need to set or change some other defaults.
4255 if $test -f usethreads.cbu; then
4256     echo "Your platform has some specific hints regarding threaded builds, using them..."
4257     . ./usethreads.cbu
4258 else
4259     case "$usethreads" in
4260         "$define"|true|[yY]*)
4261                 $cat <<EOM
4262 (Your platform does not have any specific hints for threaded builds.
4263  Assuming POSIX threads, then.)
4264 EOM
4265         ;;
4266     esac
4267 fi
4268
4269 cat <<EOM
4270
4271 Perl can be built so that multiple Perl interpreters can coexist
4272 within the same Perl executable.
4273 EOM
4274
4275 case "$useithreads" in
4276 $define)
4277         cat <<EOM
4278 This multiple interpreter support is required for interpreter-based threads.
4279 EOM
4280         val="$define"
4281         ;;
4282 *)      case "$usemultiplicity" in
4283         $define|true|[yY]*)     dflt='y';;
4284         *) dflt='n';;
4285         esac
4286         echo " "
4287         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4288         rp='Build Perl for multiplicity?'
4289         . ./myread
4290         case "$ans" in
4291         y|Y)    val="$define" ;;
4292         *)      val="$undef" ;;
4293         esac
4294         ;;
4295 esac
4296 set usemultiplicity
4297 eval $setvar
4298
4299
4300 case "$usemorebits" in
4301 "$define"|true|[yY]*)
4302         use64bitint="$define"
4303         uselongdouble="$define"
4304         usemorebits="$define"
4305         ;;
4306 *)      usemorebits="$undef"
4307         ;;
4308 esac
4309
4310 : make some quick guesses about what we are up against
4311 echo " "
4312 $echo $n "Hmm...  $c"
4313 echo exit 1 >bsd
4314 echo exit 1 >usg
4315 echo exit 1 >v7
4316 echo exit 1 >osf1
4317 echo exit 1 >eunice
4318 echo exit 1 >xenix
4319 echo exit 1 >venix
4320 echo exit 1 >os2
4321 d_bsd="$undef"
4322 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4323 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4324 then
4325         echo "Looks kind of like an OSF/1 system, but we'll see..."
4326         echo exit 0 >osf1
4327 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4328         xxx=`./loc addbib blurfl $pth`
4329         if $test -f $xxx; then
4330         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4331                 echo exit 0 >bsd
4332                 echo exit 0 >usg
4333         else
4334                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4335                         echo "Looks kind of like an extended USG system, but we'll see..."
4336                 else
4337                         echo "Looks kind of like a USG system, but we'll see..."
4338                 fi
4339                 echo exit 0 >usg
4340         fi
4341 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4342         echo "Looks kind of like a BSD system, but we'll see..."
4343         d_bsd="$define"
4344         echo exit 0 >bsd
4345 else
4346         echo "Looks kind of like a Version 7 system, but we'll see..."
4347         echo exit 0 >v7
4348 fi
4349 case "$eunicefix" in
4350 *unixtovms*)
4351         $cat <<'EOI'
4352 There is, however, a strange, musty smell in the air that reminds me of
4353 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4354 EOI
4355         echo exit 0 >eunice
4356         d_eunice="$define"
4357 : it so happens the Eunice I know will not run shell scripts in Unix format
4358         ;;
4359 *)
4360         echo " "
4361         echo "Congratulations.  You aren't running Eunice."
4362         d_eunice="$undef"
4363         ;;
4364 esac
4365 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4366 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4367 : semicolon as a patch separator
4368 case "$p_" in
4369 :) ;;
4370 *)
4371         $cat <<'EOI'
4372 I have the feeling something is not exactly right, however...don't tell me...
4373 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4374 (Or you may be running DOS with DJGPP.)
4375 EOI
4376         echo exit 0 >os2
4377         ;;
4378 esac
4379 if test -f /xenix; then
4380         echo "Actually, this looks more like a XENIX system..."
4381         echo exit 0 >xenix
4382         d_xenix="$define"
4383 else
4384         echo " "
4385         echo "It's not Xenix..."
4386         d_xenix="$undef"
4387 fi
4388 chmod +x xenix
4389 $eunicefix xenix
4390 if test -f /venix; then
4391         echo "Actually, this looks more like a VENIX system..."
4392         echo exit 0 >venix
4393 else
4394         echo " "
4395         if ./xenix; then
4396                 : null
4397         else
4398                 echo "Nor is it Venix..."
4399         fi
4400 fi
4401 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4402 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4403 $rm -f foo
4404
4405 case "$cc" in
4406 '') dflt=cc;;
4407 *) dflt="$cc";;
4408 esac
4409 rp="Use which C compiler?"
4410 . ./myread
4411 cc="$ans"
4412
4413 : See if they have not cc but they do have gcc
4414 . ./trygcc
4415 : Look for a hint-file generated 'call-back-unit'.  Now that the
4416 : user has specified the compiler, we may need to set or change some
4417 : other defaults.
4418 if $test -f cc.cbu; then
4419     . ./cc.cbu
4420 fi
4421 . ./checkcc
4422
4423 echo " "
4424 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4425 $cat >try.c <<EOM
4426 #include <stdio.h>
4427 int main() {
4428 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4429 #ifdef __VERSION__
4430         printf("%s\n", __VERSION__);
4431 #else
4432         printf("%s\n", "1");
4433 #endif
4434 #endif
4435         return(0);
4436 }
4437 EOM
4438 if $cc -o try $ccflags $ldflags try.c; then
4439         gccversion=`$run ./try`
4440         case "$gccversion" in
4441         '') echo "You are not using GNU cc." ;;
4442         *)  echo "You are using GNU cc $gccversion."
4443             ccname=gcc
4444             ;;
4445         esac
4446 else
4447         echo " "
4448         echo "*** WHOA THERE!!! ***" >&4
4449         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4450         case "$knowitall" in
4451         '')
4452         echo "    You'd better start hunting for one and let me know about it." >&4
4453                 exit 1
4454                 ;;
4455         esac
4456 fi
4457 $rm -f try try.*
4458 case "$gccversion" in
4459 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4460 esac
4461 case "$gccversion" in
4462 '') gccosandvers='' ;;
4463 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4464    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4465    gccshortvers=''
4466    case "$gccosandvers" in
4467    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4468    $osname$osvers) ;; # looking good
4469    $osname*) cat <<EOM >&4
4470
4471 *** WHOA THERE!!! ***
4472
4473     Your gcc has not been compiled for the exact release of
4474     your operating system ($gccosandvers versus $osname$osvers).
4475
4476     In general it is a good idea to keep gcc synchronized with
4477     the operating system because otherwise serious problems
4478     may ensue when trying to compile software, like Perl.
4479
4480     I'm trying to be optimistic here, though, and will continue.
4481     If later during the configuration and build icky compilation
4482     problems appear (headerfile conflicts being the most common
4483     manifestation), I suggest reinstalling the gcc to match
4484     your operating system release.
4485
4486 EOM
4487       ;;
4488    *) gccosandvers='' ;; # failed to parse, better be silent
4489    esac
4490    ;;
4491 esac
4492 case "$ccname" in
4493 '') ccname="$cc" ;;
4494 esac
4495
4496 # gcc 3.* complain about adding -Idirectories that they already know about,
4497 # so we will take those off from locincpth.
4498 case "$gccversion" in
4499 3*)
4500     echo "main(){}">try.c
4501     for incdir in $locincpth; do
4502        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4503              grep '^c[cp]p*[01]: warning: changing search order '`
4504        if test "X$warn" != X; then
4505            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4506        fi
4507     done
4508     $rm -f try try.*
4509 esac
4510
4511 : What should the include directory be ?
4512 echo " "
4513 $echo $n "Hmm...  $c"
4514 dflt='/usr/include'
4515 incpath=''
4516 mips_type=''
4517 if $test -f /bin/mips && /bin/mips; then
4518         echo "Looks like a MIPS system..."
4519         $cat >usr.c <<'EOCP'
4520 #ifdef SYSTYPE_BSD43
4521 /bsd43
4522 #endif
4523 EOCP
4524         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4525                 dflt='/bsd43/usr/include'
4526                 incpath='/bsd43'
4527                 mips_type='BSD 4.3'
4528         else
4529                 mips_type='System V'
4530         fi
4531         $rm -f usr.c usr.out
4532         echo "and you're compiling with the $mips_type compiler and libraries."
4533         xxx_prompt=y
4534         echo "exit 0" >mips
4535 else
4536         echo "Doesn't look like a MIPS system."
4537         xxx_prompt=n
4538         echo "exit 1" >mips
4539 fi
4540 chmod +x mips
4541 $eunicefix mips
4542 case "$usrinc" in
4543 '') ;;
4544 *) dflt="$usrinc";;
4545 esac
4546 case "$xxx_prompt" in
4547 y)      fn=d/
4548         echo " "
4549         rp='Where are the include files you want to use?'
4550         . ./getfile
4551         usrinc="$ans"
4552         ;;
4553 *)      usrinc="$dflt"
4554         ;;
4555 esac
4556
4557 : see how we invoke the C preprocessor
4558 echo " "
4559 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4560 cat <<'EOT' >testcpp.c
4561 #define ABC abc
4562 #define XYZ xyz
4563 ABC.XYZ
4564 EOT
4565 cd ..
4566 if test ! -f cppstdin; then
4567         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4568                 # AIX cc -E doesn't show the absolute headerfile
4569                 # locations but we'll cheat by using the -M flag.
4570                 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
4571         else
4572                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4573         fi
4574 else
4575         echo "Keeping your $hint cppstdin wrapper."
4576 fi
4577 chmod 755 cppstdin
4578 wrapper=`pwd`/cppstdin
4579 ok='false'
4580 cd UU
4581
4582 if $test "X$cppstdin" != "X" && \
4583         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4584         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4585 then
4586         echo "You used to use $cppstdin $cppminus so we'll use that again."
4587         case "$cpprun" in
4588         '') echo "But let's see if we can live without a wrapper..." ;;
4589         *)
4590                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4591                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4592                 then
4593                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4594                         ok='true'
4595                 else
4596                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4597                 fi
4598                 ;;
4599         esac
4600 else
4601         case "$cppstdin" in
4602         '') ;;
4603         *)
4604                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4605                 ;;
4606         esac
4607 fi
4608
4609 if $ok; then
4610         : nothing
4611 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4612         $cc -E <testcpp.c >testcpp.out 2>&1; \
4613         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4614         echo "Yup, it does."
4615         x_cpp="$cc -E"
4616         x_minus='';
4617 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4618         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4619         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4620         echo "Yup, it does."
4621         x_cpp="$cc -E"
4622         x_minus='-';
4623 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4624         $cc -P <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yipee, that works!"
4627         x_cpp="$cc -P"
4628         x_minus='';
4629 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4630         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "At long last!"
4633         x_cpp="$cc -P"
4634         x_minus='-';
4635 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4636         $cpp <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "It works!"
4639         x_cpp="$cpp"
4640         x_minus='';
4641 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4642         $cpp - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "Hooray, it works!  I was beginning to wonder."
4645         x_cpp="$cpp"
4646         x_minus='-';
4647 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4648         $wrapper <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         x_cpp="$wrapper"
4651         x_minus=''
4652         echo "Eureka!"
4653 else
4654         dflt=''
4655         rp="No dice.  I can't find a C preprocessor.  Name one:"
4656         . ./myread
4657         x_cpp="$ans"
4658         x_minus=''
4659         $x_cpp <testcpp.c >testcpp.out 2>&1
4660         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4661                 echo "OK, that will do." >&4
4662         else
4663 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4664                 exit 1
4665         fi
4666 fi
4667
4668 case "$ok" in
4669 false)
4670         cppstdin="$x_cpp"
4671         cppminus="$x_minus"
4672         cpprun="$x_cpp"
4673         cpplast="$x_minus"
4674         set X $x_cpp
4675         shift
4676         case "$1" in
4677         "$cpp")
4678                 echo "Perhaps can we force $cc -E using a wrapper..."
4679                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4680                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4681                 then
4682                         echo "Yup, we can."
4683                         cppstdin="$wrapper"
4684                         cppminus='';
4685                 else
4686                         echo "Nope, we'll have to live without it..."
4687                 fi
4688                 ;;
4689         esac
4690         case "$cpprun" in
4691         "$wrapper")
4692                 cpprun=''
4693                 cpplast=''
4694                 ;;
4695         esac
4696         ;;
4697 esac
4698
4699 case "$cppstdin" in
4700 "$wrapper"|'cppstdin') ;;
4701 *) $rm -f $wrapper;;
4702 esac
4703 $rm -f testcpp.c testcpp.out
4704
4705 : Set private lib path
4706 case "$plibpth" in
4707 '') if ./mips; then
4708                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4709         fi;;
4710 esac
4711 case "$libpth" in
4712 ' ') dlist='';;
4713 '') dlist="$loclibpth $plibpth $glibpth";;
4714 *) dlist="$libpth";;
4715 esac
4716
4717 : Now check and see which directories actually exist, avoiding duplicates
4718 libpth=''
4719 for xxx in $dlist
4720 do
4721     if $test -d $xxx; then
4722                 case " $libpth " in
4723                 *" $xxx "*) ;;
4724                 *) libpth="$libpth $xxx";;
4725                 esac
4726     fi
4727 done
4728 $cat <<'EOM'
4729
4730 Some systems have incompatible or broken versions of libraries.  Among
4731 the directories listed in the question below, please remove any you
4732 know not to be holding relevant libraries, and add any that are needed.
4733 Say "none" for none.
4734
4735 EOM
4736 case "$libpth" in
4737 '') dflt='none';;
4738 *)
4739         set X $libpth
4740         shift
4741         dflt=${1+"$@"}
4742         ;;
4743 esac
4744 rp="Directories to use for library searches?"
4745 . ./myread
4746 case "$ans" in
4747 none) libpth=' ';;
4748 *) libpth="$ans";;
4749 esac
4750
4751 : compute shared library extension
4752 case "$so" in
4753 '')
4754         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4755                 dflt='sl'
4756         else
4757                 dflt='so'
4758         fi
4759         ;;
4760 *) dflt="$so";;
4761 esac
4762 $cat <<EOM
4763
4764 On some systems, shared libraries may be available.  Answer 'none' if
4765 you want to suppress searching of shared libraries for the remainder
4766 of this configuration.
4767
4768 EOM
4769 rp='What is the file extension used for shared libraries?'
4770 . ./myread
4771 so="$ans"
4772
4773 : Define several unixisms.
4774 : Hints files or command line option can be used to override them.
4775 : The convoluted testing is in case hints files set either the old
4776 : or the new name.
4777 case "$_exe" in
4778 '')     case "$exe_ext" in
4779         '')     ;;
4780         *)      _exe="$exe_ext" ;;
4781         esac
4782         ;;
4783 esac
4784 case "$_a" in
4785 '')     case "$lib_ext" in
4786     '') _a='.a';;
4787         *)      _a="$lib_ext" ;;
4788         esac
4789         ;;
4790 esac
4791 case "$_o" in
4792 '') case "$obj_ext" in
4793         '')     _o='.o';;
4794         *)      _o="$obj_ext";;
4795         esac
4796         ;;
4797 esac
4798 case "$p_" in
4799 '') case "$path_sep" in
4800         '')     p_=':';;
4801         *)      p_="$path_sep";;
4802         esac
4803         ;;
4804 esac
4805 exe_ext=$_exe
4806 lib_ext=$_a
4807 obj_ext=$_o
4808 path_sep=$p_
4809
4810 : Which makefile gets called first.  This is used by make depend.
4811 case "$firstmakefile" in
4812 '') firstmakefile='makefile';;
4813 esac
4814
4815 case "$ccflags" in
4816 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4817 esac
4818
4819 case "$uselongdouble" in
4820 $define|true|[yY]*)     dflt='y';;
4821 *) dflt='n';;
4822 esac
4823 cat <<EOM
4824
4825 Perl can be built to take advantage of long doubles which
4826 (if available) may give more accuracy and range for floating point numbers.
4827
4828 If this doesn't make any sense to you, just accept the default '$dflt'.
4829 EOM
4830 rp='Try to use long doubles if available?'
4831 . ./myread
4832 case "$ans" in
4833 y|Y)    val="$define"   ;;
4834 *)      val="$undef"    ;;
4835 esac
4836 set uselongdouble
4837 eval $setvar
4838
4839 case "$uselongdouble" in
4840 true|[yY]*) uselongdouble="$define" ;;
4841 esac
4842
4843 : Look for a hint-file generated 'call-back-unit'.  If the
4844 : user has specified that long doubles should be used,
4845 : we may need to set or change some other defaults.
4846 if $test -f uselongdouble.cbu; then
4847     echo "Your platform has some specific hints regarding long doubles, using them..."
4848     . ./uselongdouble.cbu
4849 else
4850     case "$uselongdouble" in
4851         $define)
4852                 $cat <<EOM
4853 (Your platform does not have any specific hints for long doubles.)
4854 EOM
4855         ;;
4856     esac
4857 fi
4858
4859 : Looking for optional libraries
4860 echo " "
4861 echo "Checking for optional libraries..." >&4
4862 case "$libs" in
4863 ' '|'') dflt='';;
4864 *) dflt="$libs";;
4865 esac
4866 case "$libswanted" in
4867 '') libswanted='c_s';;
4868 esac
4869 case "$usesocks" in
4870 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4871 esac
4872 libsfound=''
4873 libsfiles=''
4874 libsdirs=''
4875 libspath=''
4876 for thisdir in $libpth $xlibpth; do
4877   test -d $thisdir && libspath="$libspath $thisdir"
4878 done
4879 for thislib in $libswanted; do
4880         for thisdir in $libspath; do
4881             xxx=''
4882             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4883                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4884                 $test -f "$xxx" && eval $libscheck
4885                 $test -f "$xxx" && libstyle=shared
4886             fi
4887             if test ! -f "$xxx"; then
4888                 xxx=$thisdir/lib$thislib.$so
4889                 $test -f "$xxx" && eval $libscheck
4890                 $test -f "$xxx" && libstyle=shared
4891             fi  
4892             if test ! -f "$xxx"; then
4893                 xxx=$thisdir/lib$thislib$_a
4894                 $test -f "$xxx" && eval $libscheck
4895                 $test -f "$xxx" && libstyle=static
4896             fi
4897             if test ! -f "$xxx"; then
4898                 xxx=$thisdir/$thislib$_a
4899                 $test -f "$xxx" && eval $libscheck
4900                 $test -f "$xxx" && libstyle=static
4901             fi
4902             if test ! -f "$xxx"; then
4903                 xxx=$thisdir/lib${thislib}_s$_a
4904                 $test -f "$xxx" && eval $libscheck
4905                 $test -f "$xxx" && libstyle=static
4906                 $test -f "$xxx" && thislib=${thislib}_s
4907             fi
4908             if test ! -f "$xxx"; then
4909                 xxx=$thisdir/Slib$thislib$_a
4910                 $test -f "$xxx" && eval $libscheck
4911                 $test -f "$xxx" && libstyle=static
4912             fi
4913             if $test -f "$xxx"; then
4914                 case "$libstyle" in
4915                 shared) echo "Found -l$thislib (shared)." ;;
4916                 static) echo "Found -l$thislib." ;;
4917                 *)      echo "Found -l$thislib ($libstyle)." ;;
4918                 esac
4919                 case " $dflt " in
4920                 *"-l$thislib "*);;
4921                 *) dflt="$dflt -l$thislib"
4922                    libsfound="$libsfound $xxx"
4923                    yyy=`basename $xxx`
4924                    libsfiles="$libsfiles $yyy"
4925                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4926                    case " $libsdirs " in
4927                    *" $yyy "*) ;;
4928                    *) libsdirs="$libsdirs $yyy" ;;
4929                    esac
4930                    ;;
4931                 esac
4932                 break
4933             fi  
4934         done
4935         if $test ! -f "$xxx"; then
4936             echo "No -l$thislib."
4937         fi
4938 done
4939 set X $dflt
4940 shift
4941 dflt="$*"
4942 case "$libs" in
4943 '') dflt="$dflt";;
4944 *) dflt="$libs";;
4945 esac
4946 case "$dflt" in
4947 ' '|'') dflt='none';;
4948 esac
4949
4950 $cat <<EOM
4951
4952 In order to compile $package on your machine, a number of libraries
4953 are usually needed.  Include any other special libraries here as well.
4954 Say "none" for none.  The default list is almost always right.
4955 EOM
4956
4957 echo " "
4958 rp="What libraries to use?"
4959 . ./myread
4960 case "$ans" in
4961 none) libs=' ';;
4962 *) libs="$ans";;
4963 esac
4964
4965 : determine optimization, if desired, or use for debug flag also
4966 case "$optimize" in
4967 ' '|$undef) dflt='none';;
4968 '') dflt='-O';;
4969 *) dflt="$optimize";;
4970 esac
4971 $cat <<EOH
4972
4973 By default, $package compiles with the -O flag to use the optimizer.
4974 Alternately, you might want to use the symbolic debugger, which uses
4975 the -g flag (on traditional Unix systems).  Either flag can be
4976 specified here.  To use neither flag, specify the word "none".
4977
4978 EOH
4979 rp="What optimizer/debugger flag should be used?"
4980 . ./myread
4981 optimize="$ans"
4982 case "$optimize" in
4983 'none') optimize=" ";;
4984 esac
4985
4986 : Check what DEBUGGING is required from the command line
4987 : -DEBUGGING      or -DDEBUGGING or
4988 : -DEBUGGING=both                       = -g + -DDEBUGGING
4989 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4990 : -DEBUGGING=none or -UDEBUGGING        =
4991 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4992 case "$EBUGGING" in
4993 '')     ;;
4994 *)      DEBUGGING=$EBUGGING ;;
4995 esac
4996
4997 case "$DEBUGGING" in
4998 -g|both|$define)
4999     case "$optimize" in
5000         *-g*) ;;
5001         *)    optimize="$optimize -g" ;;
5002     esac ;;
5003 none|$undef)
5004     case "$optimize" in
5005         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5006                 shift
5007                 optimize="$*"
5008                 ;;
5009     esac ;;
5010 esac
5011
5012 dflt=''
5013 case "$DEBUGGING" in
5014 both|$define) dflt='-DDEBUGGING'
5015 esac
5016
5017 : We will not override a previous value, but we might want to
5018 : augment a hint file
5019 case "$hint" in
5020 default|recommended)
5021         case "$gccversion" in
5022         1*) dflt="$dflt -fpcc-struct-return" ;;
5023         esac
5024         case "$optimize:$DEBUGGING" in
5025         *-g*:old) dflt="$dflt -DDEBUGGING";;
5026         esac
5027         case "$gccversion" in
5028         2*) if test -d /etc/conf/kconfig.d &&
5029                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5030                 then
5031                         # Interactive Systems (ISC) POSIX mode.
5032                         dflt="$dflt -posix"
5033                 fi
5034                 ;;
5035         esac
5036         case "$gccversion" in
5037         1*) ;;
5038         2.[0-8]*) ;;
5039         ?*)     echo " "
5040                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5041                 echo 'int main(void) { return 0; }' > gcctest.c
5042                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5043                         echo "Yes, it does." 2>&1
5044                         case "$ccflags" in
5045                         *strict-aliasing*)
5046                                 echo "Leaving current flags $ccflags alone." 2>&1
5047                                 ;;
5048                         *) dflt="$dflt -fno-strict-aliasing" ;;
5049                         esac
5050                 else
5051                         echo "Nope, it doesn't, but that's ok." 2>&1
5052                 fi
5053                 ;;
5054         esac
5055         # For gcc, adding -pipe speeds up compilations for some, but apparently
5056         # some assemblers can't read from stdin.  (It also slows down compilations
5057         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5058         case "$gccversion" in
5059         ?*)     echo " "
5060                 echo "Checking if your compiler accepts -pipe" 2>&1
5061                 echo 'int main(void) { return 0; }' > gcctest.c
5062                 if $cc -pipe -o gcctest gcctest.c; then
5063                         echo "Yes, it does." 2>&1
5064                         case "$ccflags" in
5065                         *-pipe*)
5066                                 echo "Leaving current flags $ccflags alone." 2>&1
5067                                 ;;
5068                         *) dflt="$dflt -pipe" ;;
5069                         esac
5070                 else
5071                         echo "Nope, it doesn't, but that's ok." 2>&1
5072                 fi
5073                 ;;
5074         esac
5075         ;;
5076 esac
5077
5078 case "$mips_type" in
5079 *BSD*|'') inclwanted="$locincpth $usrinc";;
5080 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5081 esac
5082 for thisincl in $inclwanted; do
5083         if $test -d $thisincl; then
5084                 if $test x$thisincl != x$usrinc; then
5085                         case "$dflt" in
5086                         *" -I$thisincl "*);;
5087                         *) dflt="$dflt -I$thisincl ";;
5088                         esac
5089                 fi
5090         fi
5091 done
5092
5093 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5094         xxx=true;
5095 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5096         xxx=true;
5097 else
5098         xxx=false;
5099 fi;
5100 if $xxx; then
5101         case "$dflt" in
5102         *$2*);;
5103         *) dflt="$dflt -D$2";;
5104         esac;
5105 fi'
5106
5107 set signal.h LANGUAGE_C; eval $inctest
5108
5109 case "$usesocks" in
5110 $define)
5111         ccflags="$ccflags -DSOCKS"
5112         ;;
5113 esac
5114
5115 case "$hint" in
5116 default|recommended) dflt="$ccflags $dflt" ;;
5117 *) dflt="$ccflags";;
5118 esac
5119
5120 case "$dflt" in
5121 ''|' ') dflt=none;;
5122 esac
5123
5124 $cat <<EOH
5125
5126 Your C compiler may want other flags.  For this question you should include
5127 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5128 but you should NOT include libraries or ld flags like -lwhatever.  If you
5129 want $package to honor its debug switch, you should include -DDEBUGGING here.
5130 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5131
5132 To use no flags, specify the word "none".
5133
5134 EOH
5135 set X $dflt
5136 shift
5137 dflt=${1+"$@"}
5138 rp="Any additional cc flags?"
5139 . ./myread
5140 case "$ans" in
5141 none) ccflags='';;
5142 *) ccflags="$ans";;
5143 esac
5144
5145 : the following weeds options from ccflags that are of no interest to cpp
5146 case "$cppflags" in
5147 '') cppflags="$ccflags" ;;
5148 *)  cppflags="$cppflags $ccflags" ;;
5149 esac
5150 case "$gccversion" in
5151 1*) cppflags="$cppflags -D__GNUC__"
5152 esac
5153 case "$mips_type" in
5154 '');;
5155 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5156 esac
5157 case "$cppflags" in
5158 '');;
5159 *)
5160         echo " "
5161         echo "Let me guess what the preprocessor flags are..." >&4
5162         set X $cppflags
5163         shift
5164         cppflags=''
5165         $cat >cpp.c <<'EOM'
5166 #define BLURFL foo
5167
5168 BLURFL xx LFRULB
5169 EOM
5170         previous=''
5171         for flag in $*
5172         do
5173                 case "$flag" in
5174                 -*) ftry="$flag";;
5175                 *) ftry="$previous $flag";;
5176                 esac
5177                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5178                         >cpp1.out 2>/dev/null && \
5179                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5180                         >cpp2.out 2>/dev/null && \
5181                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5182                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5183                 then
5184                         cppflags="$cppflags $ftry"
5185                         previous=''
5186                 else
5187                         previous="$flag"
5188                 fi
5189         done
5190         set X $cppflags
5191         shift
5192         cppflags=${1+"$@"}
5193         case "$cppflags" in
5194         *-*)  echo "They appear to be: $cppflags";;
5195         esac
5196         $rm -f cpp.c cpp?.out
5197         ;;
5198 esac
5199
5200 : flags used in final linking phase
5201 case "$ldflags" in
5202 '') if ./venix; then
5203                 dflt='-i -z'
5204         else
5205                 dflt=''
5206         fi
5207         case "$ccflags" in
5208         *-posix*) dflt="$dflt -posix" ;;
5209         esac
5210         ;;
5211 *) dflt="$ldflags";;
5212 esac
5213
5214 : Try to guess additional flags to pick up local libraries.
5215 for thislibdir in $libpth; do
5216         case " $loclibpth " in
5217         *" $thislibdir "*)
5218                 case "$dflt " in
5219                 *"-L$thislibdir "*) ;;
5220                 *)  dflt="$dflt -L$thislibdir" ;;
5221                 esac
5222                 ;;
5223         esac
5224 done
5225
5226 case "$dflt" in
5227 '') dflt='none' ;;
5228 esac
5229
5230 $cat <<EOH
5231
5232 Your C linker may need flags.  For this question you should
5233 include -L/whatever and any other flags used by the C linker, but you
5234 should NOT include libraries like -lwhatever.
5235
5236 Make sure you include the appropriate -L/path flags if your C linker
5237 does not normally search all of the directories you specified above,
5238 namely
5239         $libpth
5240 To use no flags, specify the word "none".
5241
5242 EOH
5243
5244 rp="Any additional ld flags (NOT including libraries)?"
5245 . ./myread
5246 case "$ans" in
5247 none) ldflags='';;
5248 *) ldflags="$ans";;
5249 esac
5250 rmlist="$rmlist pdp11"
5251
5252 : coherency check
5253 echo " "
5254 echo "Checking your choice of C compiler and flags for coherency..." >&4
5255 $cat > try.c <<'EOF'
5256 #include <stdio.h>
5257 int main() { printf("Ok\n"); return(0); }
5258 EOF
5259 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5260 shift
5261 $cat >try.msg <<'EOM'
5262 I've tried to compile and run the following simple program:
5263
5264 EOM
5265 $cat try.c >> try.msg
5266
5267 $cat >> try.msg <<EOM
5268
5269 I used the command:
5270
5271         $*
5272         $run ./try
5273
5274 and I got the following output:
5275
5276 EOM
5277 dflt=y
5278 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5279         if $sh -c "$run ./try" >>try.msg 2>&1; then
5280                 xxx=`$run ./try`
5281                 case "$xxx" in
5282                 "Ok") dflt=n ;;
5283                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5284                         case " $libs " in
5285                         *" -lsfio "*)
5286                                 cat >> try.msg <<'EOQS'
5287 If $libs contains -lsfio, and sfio is mis-configured, then it
5288 sometimes (apparently) runs and exits with a 0 status, but with no
5289 output!  It may have to do with sfio's use of _exit vs. exit.
5290
5291 EOQS
5292                                 rp="You have a big problem.  Shall I abort Configure"
5293                                 dflt=y
5294                                 ;;
5295                         esac
5296                         ;;
5297                 esac
5298         else
5299                 echo "The program compiled OK, but exited with status $?." >>try.msg
5300                 rp="You have a problem.  Shall I abort Configure"
5301                 dflt=y
5302         fi
5303 else
5304         echo "I can't compile the test program." >>try.msg
5305         rp="You have a BIG problem.  Shall I abort Configure"
5306         dflt=y
5307 fi
5308 case "$dflt" in
5309 y)
5310         $cat try.msg >&4
5311         case "$knowitall" in
5312         '')
5313                 echo "(The supplied flags or libraries might be incorrect.)"
5314                 ;;
5315         *) dflt=n;;
5316         esac
5317         echo " "
5318         . ./myread
5319         case "$ans" in
5320         n*|N*) ;;
5321         *)      echo "Ok.  Stopping Configure." >&4
5322                 exit 1
5323                 ;;
5324         esac
5325         ;;
5326 n) echo "OK, that should do.";;
5327 esac
5328 $rm -f try try.* core
5329
5330 : define a shorthand compile call
5331 compile='
5332 mc_file=$1;
5333 shift;
5334 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5335 : define a shorthand compile call for compilations that should be ok.
5336 compile_ok='
5337 mc_file=$1;
5338 shift;
5339 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5340
5341 : determine filename position in cpp output
5342 echo " "
5343 echo "Computing filename position in cpp output for #include directives..." >&4
5344 case "$osname" in
5345 vos) testaccess=-e ;;
5346 *)   testaccess=-r ;;
5347 esac
5348 echo '#include <stdio.h>' > foo.c
5349 $cat >fieldn <<EOF
5350 $startsh
5351 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5352 $grep '^[       ]*#.*stdio\.h' | \
5353 while read cline; do
5354         pos=1
5355         set \$cline
5356         while $test \$# -gt 0; do
5357                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5358                         echo "\$pos"
5359                         exit 0
5360                 fi
5361                 shift
5362                 pos=\`expr \$pos + 1\`
5363         done
5364 done
5365 EOF
5366 chmod +x fieldn
5367 fieldn=`./fieldn`
5368 $rm -f foo.c fieldn
5369 case $fieldn in
5370 '') pos='???';;
5371 1) pos=first;;
5372 2) pos=second;;
5373 3) pos=third;;
5374 *) pos="${fieldn}th";;
5375 esac
5376 echo "Your cpp writes the filename in the $pos field of the line."
5377
5378 case "$osname" in
5379 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5380 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5381 *)   cppfilter='' ;;
5382 esac
5383 : locate header file
5384 $cat >findhdr <<EOF
5385 $startsh
5386 wanted=\$1
5387 name=''
5388 for usrincdir in $usrinc
5389 do
5390         if test -f \$usrincdir/\$wanted; then
5391                 echo "\$usrincdir/\$wanted"
5392                 exit 0
5393         fi
5394 done
5395 awkprg='{ print \$$fieldn }'
5396 echo "#include <\$wanted>" > foo\$\$.c
5397 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5398 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5399 while read cline; do
5400         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5401         case "\$name" in
5402         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5403         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5404         *) exit 2;;
5405         esac;
5406 done;
5407 #
5408 # status = 0: grep returned 0 lines, case statement not executed
5409 # status = 1: headerfile found
5410 # status = 2: while loop executed, no headerfile found
5411 #
5412 status=\$?
5413 $rm -f foo\$\$.c;
5414 if test \$status -eq 1; then
5415         exit 0;
5416 fi
5417 exit 1
5418 EOF
5419 chmod +x findhdr
5420
5421 : define an alternate in-header-list? function
5422 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5423 cont=true; xxf="echo \"<\$1> found.\" >&4";
5424 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5425 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5426 esac;
5427 case $# in 4) instead=instead;; *) instead="at last";; esac;
5428 while $test "$cont"; do
5429         xxx=`./findhdr $1`
5430         var=$2; eval "was=\$$2";
5431         if $test "$xxx" && $test -r "$xxx";
5432         then eval $xxf;
5433         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5434                 cont="";
5435         else eval $xxnf;
5436         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5437         set $yyy; shift; shift; yyy=$@;
5438         case $# in 0) cont="";;
5439         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5440                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5441         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5442                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5443         esac;
5444 done;
5445 while $test "$yyy";
5446 do set $yyy; var=$2; eval "was=\$$2";
5447         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5448         set $yyy; shift; shift; yyy=$@;
5449 done'
5450
5451 : see if stdlib is available
5452 set stdlib.h i_stdlib
5453 eval $inhdr
5454
5455 : check for lengths of integral types
5456 echo " "
5457 case "$intsize" in
5458 '')
5459         echo "Checking to see how big your integers are..." >&4
5460         $cat >try.c <<EOCP
5461 #include <stdio.h>
5462 #$i_stdlib I_STDLIB
5463 #ifdef I_STDLIB
5464 #include <stdlib.h>
5465 #endif
5466 int main()
5467 {
5468         printf("intsize=%d;\n", (int)sizeof(int));
5469         printf("longsize=%d;\n", (int)sizeof(long));
5470         printf("shortsize=%d;\n", (int)sizeof(short));
5471         exit(0);
5472 }
5473 EOCP
5474         set try
5475         if eval $compile_ok && $run ./try > /dev/null; then
5476                 eval `$run ./try`
5477                 echo "Your integers are $intsize bytes long."
5478                 echo "Your long integers are $longsize bytes long."
5479                 echo "Your short integers are $shortsize bytes long."
5480         else
5481                 $cat >&4 <<EOM
5482 !
5483 Help! I can't compile and run the intsize test program: please enlighten me!
5484 (This is probably a misconfiguration in your system or libraries, and
5485 you really ought to fix it.  Still, I'll try anyway.)
5486 !
5487 EOM
5488                 dflt=4
5489                 rp="What is the size of an integer (in bytes)?"
5490                 . ./myread
5491                 intsize="$ans"
5492                 dflt=$intsize
5493                 rp="What is the size of a long integer (in bytes)?"
5494                 . ./myread
5495                 longsize="$ans"
5496                 dflt=2
5497                 rp="What is the size of a short integer (in bytes)?"
5498                 . ./myread
5499                 shortsize="$ans"
5500         fi
5501         ;;
5502 esac
5503 $rm -f try try.*
5504
5505 : check for long long
5506 echo " "
5507 echo "Checking to see if you have long long..." >&4
5508 echo 'int main() { long long x = 7; return 0; }' > try.c
5509 set try
5510 if eval $compile; then
5511         val="$define"
5512         echo "You have long long."
5513 else
5514         val="$undef"
5515         echo "You do not have long long."
5516 fi
5517 $rm try.*
5518 set d_longlong
5519 eval $setvar
5520
5521 : check for length of long long
5522 case "${d_longlong}${longlongsize}" in
5523 $define)
5524         echo " "
5525         echo "Checking to see how big your long longs are..." >&4
5526         $cat >try.c <<'EOCP'
5527 #include <stdio.h>
5528 int main()
5529 {
5530     printf("%d\n", (int)sizeof(long long));
5531     return(0);
5532 }
5533 EOCP
5534         set try
5535         if eval $compile_ok; then
5536                 longlongsize=`$run ./try`
5537                 echo "Your long longs are $longlongsize bytes long."
5538         else
5539                 dflt='8'
5540                 echo " "
5541                 echo "(I can't seem to compile the test program.  Guessing...)"
5542                 rp="What is the size of a long long (in bytes)?"
5543                 . ./myread
5544                 longlongsize="$ans"
5545         fi
5546         if $test "X$longsize" = "X$longlongsize"; then
5547                 echo "(That isn't any different from an ordinary long.)"
5548         fi      
5549         ;;
5550 esac
5551 $rm -f try.* try
5552
5553 : see if inttypes.h is available
5554 : we want a real compile instead of Inhdr because some systems
5555 : have an inttypes.h which includes non-existent headers
5556 echo " "
5557 $cat >try.c <<EOCP
5558 #include <inttypes.h>
5559 int main() {
5560         static int32_t foo32 = 0x12345678;
5561 }
5562 EOCP
5563 set try
5564 if eval $compile; then
5565         echo "<inttypes.h> found." >&4
5566         val="$define"
5567 else
5568         echo "<inttypes.h> NOT found." >&4
5569         val="$undef"
5570 fi
5571 $rm -f try.c try
5572 set i_inttypes
5573 eval $setvar
5574
5575 : check for int64_t
5576 echo " "
5577 echo "Checking to see if you have int64_t..." >&4
5578 $cat >try.c <<EOCP
5579 #include <sys/types.h>
5580 #$i_inttypes I_INTTYPES
5581 #ifdef I_INTTYPES
5582 #include <inttypes.h>
5583 #endif
5584 int main() { int64_t x = 7; }
5585 EOCP
5586 set try
5587 if eval $compile; then
5588         val="$define"
5589         echo "You have int64_t."
5590 else
5591         val="$undef"
5592         echo "You do not have int64_t."
5593 fi
5594 $rm -f try try.*
5595 set d_int64_t
5596 eval $setvar
5597
5598
5599 echo " "
5600 echo "Checking which 64-bit integer type we could use..." >&4
5601
5602 case "$intsize" in
5603 8) val=int
5604    set quadtype
5605    eval $setvar
5606    val='"unsigned int"'
5607    set uquadtype
5608    eval $setvar
5609    quadkind=1
5610    ;;
5611 *) case "$longsize" in
5612    8) val=long
5613       set quadtype
5614       eval $setvar
5615       val='"unsigned long"'
5616       set uquadtype
5617       eval $setvar
5618       quadkind=2
5619       ;;
5620    *) case "$d_longlong:$longlongsize" in
5621       define:8)
5622         val='"long long"'
5623         set quadtype
5624         eval $setvar
5625         val='"unsigned long long"'
5626         set uquadtype
5627         eval $setvar
5628         quadkind=3
5629         ;;
5630       *) case "$d_int64_t" in
5631          define)
5632            val=int64_t
5633            set quadtype
5634            eval $setvar
5635            val=uint64_t
5636            set uquadtype
5637            eval $setvar
5638            quadkind=4
5639            ;;
5640          esac
5641          ;;
5642       esac
5643       ;;
5644    esac
5645    ;;
5646 esac
5647
5648 case "$quadtype" in
5649 '')     echo "Alas, no 64-bit integer types in sight." >&4
5650         d_quad="$undef"
5651         ;;
5652 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5653         d_quad="$define"
5654         ;;
5655 esac
5656
5657
5658 case "$uselonglong" in
5659 "$define"|true|[yY]*)
5660         cat <<EOM >&4
5661
5662 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5663 EOM
5664         use64bitint="$define"
5665         ;;
5666 esac                          
5667 case "$use64bits" in
5668 "$define"|true|[yY]*)
5669         cat <<EOM >&4
5670
5671 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5672 EOM
5673         use64bitint="$define"
5674         ;;
5675 esac                          
5676 case "$use64bitints" in
5677 "$define"|true|[yY]*)
5678         cat <<EOM >&4
5679
5680 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5681 EOM
5682         use64bitint="$define"
5683         ;;
5684 esac                          
5685 case "$use64bitsint" in
5686 "$define"|true|[yY]*)
5687         cat <<EOM >&4
5688
5689 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5690 EOM
5691         use64bitint="$define"
5692         ;;
5693 esac                          
5694 case "$uselonglongs" in
5695 "$define"|true|[yY]*)
5696         cat <<EOM >&4
5697
5698 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5699 EOM
5700         use64bitint="$define"
5701         ;;
5702 esac                          
5703 case "$use64bitsall" in
5704 "$define"|true|[yY]*)
5705         cat <<EOM >&4
5706
5707 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5708 EOM
5709         use64bitall="$define"
5710         ;;
5711 esac                          
5712
5713 case "$ccflags" in
5714 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5715 esac
5716 case "$use64bitall" in
5717 "$define"|true|[yY]*) use64bitint="$define" ;;
5718 esac
5719
5720 case "$longsize" in
5721 8) cat <<EOM
5722
5723 You have natively 64-bit long integers.
5724 EOM
5725    val="$define"
5726    ;;
5727 *) case "$use64bitint" in
5728    "$define"|true|[yY]*) dflt='y';;
5729    *) dflt='n';;
5730    esac
5731    case "$d_quad" in
5732    "$define") ;;
5733    *) dflt='n' ;;
5734    esac
5735    cat <<EOM
5736
5737 Perl can be built to take advantage of 64-bit integer types
5738 on some systems.  To do so, Configure can be run with -Duse64bitint.
5739 Choosing this option will most probably introduce binary incompatibilities.
5740
5741 If this doesn't make any sense to you, just accept the default '$dflt'.
5742 (The default has been chosen based on your configuration.)
5743 EOM
5744    rp='Try to use 64-bit integers, if available?'
5745    . ./myread
5746    case "$ans" in
5747    [yY]*) val="$define" ;;
5748    *)     val="$undef"  ;;
5749    esac
5750    ;;
5751 esac
5752 set use64bitint
5753 eval $setvar
5754
5755 case "$use64bitall" in
5756 "$define"|true|[yY]*) dflt='y' ;;
5757 *) case "$longsize" in
5758    8) dflt='y' ;;
5759    *) dflt='n' ;;
5760    esac
5761    ;;
5762 esac    
5763 cat <<EOM
5764
5765 You may also choose to try maximal 64-bitness.  It means using as much
5766 64-bitness as possible on the platform.  This in turn means even more
5767 binary incompatibilities.  On the other hand, your platform may not
5768 have any more 64-bitness available than what you already have chosen.
5769
5770 If this doesn't make any sense to you, just accept the default '$dflt'.
5771 (The default has been chosen based on your configuration.)
5772 EOM
5773 rp='Try to use maximal 64-bit support, if available?'
5774 . ./myread
5775 case "$ans" in
5776 [yY]*) val="$define" ;;
5777 *)     val="$undef"  ;;
5778 esac
5779 set use64bitall
5780 eval $setvar
5781 case "$use64bitall" in
5782 "$define")
5783         case "$use64bitint" in
5784         "$undef")
5785                 cat <<EOM
5786
5787 Since you have chosen a maximally 64-bit build, I'm also turning on
5788 the use of 64-bit integers.
5789 EOM
5790                 use64bitint="$define" ;;
5791         esac
5792         ;;
5793 esac
5794
5795 : Look for a hint-file generated 'call-back-unit'.  If the
5796 : user has specified that a 64-bit perl is to be built,
5797 : we may need to set or change some other defaults.
5798 if $test -f use64bitint.cbu; then
5799         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5800         . ./use64bitint.cbu
5801 fi
5802 case "$use64bitint" in
5803 "$define"|true|[yY]*)
5804         case "$longsize" in
5805         4) case "$archname64" in
5806            '') archname64=64int ;;
5807            esac
5808            ;;
5809         esac
5810         ;;
5811 esac
5812
5813 : Look for a hint-file generated 'call-back-unit'.  If the
5814 : user has specified that a maximally 64-bit perl is to be built,
5815 : we may need to set or change some other defaults.
5816 if $test -f use64bitall.cbu; then
5817         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5818         . ./use64bitall.cbu
5819 fi
5820 case "$use64bitall" in
5821 "$define"|true|[yY]*)
5822         case "$longsize" in
5823         4) case "$archname64" in
5824            ''|64int) archname64=64all ;;
5825            esac
5826            ;;
5827         esac
5828         ;;
5829 esac
5830
5831 case "$d_quad:$use64bitint" in
5832 $undef:$define)
5833         cat >&4 <<EOF
5834
5835 *** You have chosen to use 64-bit integers,
5836 *** but none can be found.
5837 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5838 *** Cannot continue, aborting.
5839
5840 EOF
5841         exit 1
5842         ;;
5843 esac
5844
5845 : check for length of double
5846 echo " "
5847 case "$doublesize" in
5848 '')
5849         echo "Checking to see how big your double precision numbers are..." >&4
5850         $cat >try.c <<EOCP
5851 #include <stdio.h>
5852 #$i_stdlib I_STDLIB
5853 #ifdef I_STDLIB
5854 #include <stdlib.h>
5855 #endif
5856 int main()
5857 {
5858     printf("%d\n", (int)sizeof(double));
5859     exit(0);
5860 }
5861 EOCP
5862         set try
5863         if eval $compile_ok; then
5864                 doublesize=`$run ./try`
5865                 echo "Your double is $doublesize bytes long."
5866         else
5867                 dflt='8'
5868                 echo "(I can't seem to compile the test program.  Guessing...)"
5869                 rp="What is the size of a double precision number (in bytes)?"
5870                 . ./myread
5871                 doublesize="$ans"
5872         fi
5873         ;;
5874 esac
5875 $rm -f try.c try
5876
5877 : check for long doubles
5878 echo " "
5879 echo "Checking to see if you have long double..." >&4
5880 echo 'int main() { long double x = 7.0; }' > try.c
5881 set try
5882 if eval $compile; then
5883         val="$define"
5884         echo "You have long double."
5885 else
5886         val="$undef"
5887         echo "You do not have long double."
5888 fi
5889 $rm try.*
5890 set d_longdbl
5891 eval $setvar
5892
5893 : check for length of long double
5894 case "${d_longdbl}${longdblsize}" in
5895 $define)
5896         echo " "
5897         echo "Checking to see how big your long doubles are..." >&4
5898         $cat >try.c <<'EOCP'
5899 #include <stdio.h>
5900 int main()
5901 {
5902         printf("%d\n", sizeof(long double));
5903 }
5904 EOCP
5905         set try
5906         set try
5907         if eval $compile; then
5908                 longdblsize=`$run ./try`
5909                 echo "Your long doubles are $longdblsize bytes long."
5910         else
5911                 dflt='8'
5912                 echo " "
5913                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5914                 rp="What is the size of a long double (in bytes)?"
5915                 . ./myread
5916                 longdblsize="$ans"
5917         fi
5918         if $test "X$doublesize" = "X$longdblsize"; then
5919                 echo "That isn't any different from an ordinary double."
5920                 echo "I'll keep your setting anyway, but you may see some"
5921                 echo "harmless compilation warnings."
5922         fi      
5923         ;;
5924 esac
5925 $rm -f try.* try
5926
5927 : determine the architecture name
5928 echo " "
5929 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5930         tarch=`arch`"-$osname"
5931 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5932         if uname -m > tmparch 2>&1 ; then
5933                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5934                         -e 's/$/'"-$osname/" tmparch`
5935         else
5936                 tarch="$osname"
5937         fi
5938         $rm -f tmparch
5939 else
5940         tarch="$osname"
5941 fi
5942 case "$myarchname" in
5943 ''|"$tarch") ;;
5944 *)
5945         echo "(Your architecture name used to be $myarchname.)"
5946         archname=''
5947         ;;
5948 esac
5949 case "$targetarch" in
5950 '') ;;
5951 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5952 esac
5953 myarchname="$tarch"
5954 case "$archname" in
5955 '') dflt="$tarch";;
5956 *) dflt="$archname";;
5957 esac
5958 rp='What is your architecture name'
5959 . ./myread
5960 archname="$ans"
5961 case "$usethreads" in
5962 $define)
5963         echo "Threads selected." >&4
5964         case "$archname" in
5965         *-thread*) echo "...and architecture name already has -thread." >&4
5966                 ;;
5967         *)      archname="$archname-thread"
5968                 echo "...setting architecture name to $archname." >&4
5969                 ;;
5970         esac
5971         ;;
5972 esac
5973 case "$usemultiplicity" in
5974 $define)
5975         echo "Multiplicity selected." >&4
5976         case "$archname" in
5977         *-multi*) echo "...and architecture name already has -multi." >&4
5978                 ;;
5979         *)      archname="$archname-multi"
5980                 echo "...setting architecture name to $archname." >&4
5981                 ;;
5982         esac
5983         ;;
5984 esac
5985 case "$use64bitint$use64bitall" in
5986 *"$define"*)
5987         case "$archname64" in
5988         '')
5989                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5990                 ;;
5991         *)
5992                 case "$use64bitint" in
5993                 "$define") echo "64 bit integers selected." >&4 ;;
5994                 esac
5995                 case "$use64bitall" in
5996                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5997                 esac
5998                 case "$archname" in
5999                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6000                         ;;
6001                 *)      archname="$archname-$archname64"
6002                         echo "...setting architecture name to $archname." >&4
6003                         ;;
6004                 esac
6005                 ;;
6006         esac
6007 esac
6008 case "$uselongdouble" in
6009 $define)
6010         echo "Long doubles selected." >&4
6011         case "$longdblsize" in
6012         $doublesize)
6013                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6014                 ;;
6015         *)
6016                 case "$archname" in
6017                 *-ld*) echo "...and architecture name already has -ld." >&4
6018                         ;;
6019                 *)      archname="$archname-ld"
6020                         echo "...setting architecture name to $archname." >&4
6021                         ;;
6022                 esac
6023                 ;;
6024         esac
6025         ;;
6026 esac
6027 case "$useperlio" in
6028 $define)
6029         echo "Perlio selected." >&4
6030         ;;
6031 *)
6032         echo "Perlio not selected, using stdio." >&4
6033         case "$archname" in
6034         *-stdio*) echo "...and architecture name already has -stdio." >&4
6035                 ;;
6036         *)      archname="$archname-stdio"
6037                 echo "...setting architecture name to $archname." >&4
6038                 ;;
6039         esac
6040         ;;
6041 esac
6042 if $test -f archname.cbu; then
6043         echo "Your platform has some specific hints for architecture name, using them..."
6044         . ./archname.cbu
6045 fi
6046
6047 : set the prefixit variable, to compute a suitable default value
6048 prefixit='case "$3" in
6049 ""|none)
6050         case "$oldprefix" in
6051         "") eval "$1=\"\$$2\"";;
6052         *)
6053                 case "$3" in
6054                 "") eval "$1=";;
6055                 none)
6056                         eval "tp=\"\$$2\"";
6057                         case "$tp" in
6058                         ""|" ") eval "$1=\"\$$2\"";;
6059                         *) eval "$1=";;
6060                         esac;;
6061                 esac;;
6062         esac;;
6063 *)
6064         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6065         case "$tp" in
6066         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6067         /*-$oldprefix/*|\~*-$oldprefix/*)
6068                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6069         *) eval "$1=\"\$$2\"";;
6070         esac;;
6071 esac'
6072
6073 : determine installation style
6074 : For now, try to deduce it from prefix unless it is already set.
6075 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6076 case "$installstyle" in
6077 '')     case "$prefix" in
6078                 *perl*) dflt='lib';;
6079                 *) dflt='lib/perl5' ;;
6080         esac
6081         ;;
6082 *)      dflt="$installstyle" ;;
6083 esac
6084 : Probably not worth prompting for this since we prompt for all
6085 : the directories individually, and the prompt would be too long and
6086 : confusing anyway.
6087 installstyle=$dflt
6088
6089 : determine where public executables go
6090 echo " "
6091 set dflt bin bin
6092 eval $prefixit
6093 fn=d~
6094 rp='Pathname where the public executables will reside?'
6095 . ./getfile
6096 if $test "X$ansexp" != "X$binexp"; then
6097         installbin=''
6098 fi
6099 prefixvar=bin
6100 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6101 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6102 :     this via initialinstalllocation
6103 . ./setprefixvar
6104
6105 case "$userelocatableinc" in
6106 $define|true|[yY]*)     dflt='y' ;;
6107 *)                      dflt='n' ;;
6108 esac
6109 cat <<EOM
6110
6111 Would you like to build Perl so that the installation is relocatable, so that
6112 library paths in @INC are determined relative to the path of the perl binary?
6113 This is not advised for system Perl installs, or if you need to run setid
6114 scripts or scripts under taint mode.
6115
6116 If this doesn't make any sense to you, just accept the default '$dflt'.
6117 EOM
6118 rp='Use relocatable @INC?'
6119 . ./myread
6120 case "$ans" in
6121 y|Y)    val="$define" ;;
6122 *)      val="$undef"  ;;
6123 esac
6124 set userelocatableinc
6125 eval $setvar
6126
6127 initialinstalllocation="$binexp"
6128 : Default prefix is now "up one level from where the binaries are"
6129 case "$userelocatableinc" in
6130 $define|true|[yY]*)
6131     bin=".../"
6132     binexp=".../"
6133     prefix=".../.."
6134     prefixexp=".../.."
6135     installprefixexp=".../.."
6136     ;;
6137 esac
6138
6139 : determine where private library files go
6140 : Usual default is /usr/local/lib/perl5/$version.
6141 : Also allow things like /opt/perl/lib/$version, since
6142 : /opt/perl/lib/perl5... would be redundant.
6143 : The default "style" setting is made in installstyle.U
6144 case "$installstyle" in
6145 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6146 *)       set dflt privlib lib/$version ;;
6147 esac
6148 eval $prefixit
6149 $cat <<EOM
6150
6151 There are some auxiliary files for $package that need to be put into a
6152 private library directory that is accessible by everyone.
6153
6154 EOM
6155 fn=$binexp
6156 fn=d~+
6157 rp='Pathname where the private library files will reside?'
6158 . ./getfile
6159 prefixvar=privlib
6160 . ./setprefixvar
6161
6162 : set the prefixup variable, to restore leading tilda escape
6163 prefixup='case "$prefixexp" in
6164 "$prefix") ;;
6165 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6166 esac'
6167
6168 : determine where public architecture dependent libraries go
6169 set archlib archlib
6170 eval $prefixit
6171 : privlib default is /usr/local/lib/$package/$version
6172 : archlib default is /usr/local/lib/$package/$version/$archname
6173 : privlib may have an optional trailing /share.
6174 tdflt=`echo $privlib | $sed 's,/share$,,'`
6175 tdflt=$tdflt/$archname
6176 case "$archlib" in
6177 '')     dflt=$tdflt
6178         ;;
6179 *)      dflt="$archlib"
6180     ;;
6181 esac
6182 $cat <<EOM
6183
6184 $spackage contains architecture-dependent library files.  If you are
6185 sharing libraries in a heterogeneous environment, you might store
6186 these files in a separate location.  Otherwise, you can just include
6187 them with the rest of the public library files.
6188
6189 EOM
6190 fn=$binexp
6191 fn=d+~
6192 rp='Where do you want to put the public architecture-dependent libraries?'
6193 . ./getfile
6194 prefixvar=archlib
6195 . ./setprefixvar
6196 if $test X"$archlib" = X"$privlib"; then
6197         d_archlib="$undef"
6198 else
6199         d_archlib="$define"
6200 fi
6201
6202 : see if setuid scripts can be secure
6203 $cat <<EOM
6204
6205 Some kernels have a bug that prevents setuid #! scripts from being
6206 secure.  Some sites have disabled setuid #! scripts because of this.
6207
6208 First let's decide if your kernel supports secure setuid #! scripts.
6209 (If setuid #! scripts would be secure but have been disabled anyway,
6210 don't say that they are secure if asked.)
6211
6212 EOM
6213
6214 val="$undef"
6215 if $test -d /dev/fd; then
6216         echo "#!$ls" >reflect
6217         chmod +x,u+s reflect
6218         ./reflect >flect 2>&1
6219         if $contains "/dev/fd" flect >/dev/null; then
6220                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6221                 val="$define"
6222         else
6223                 $cat <<EOM
6224 If you are not sure if they are secure, I can check but I'll need a
6225 username and password different from the one you are using right now.
6226 If you don't have such a username or don't want me to test, simply
6227 enter 'none'.
6228
6229 EOM
6230                 rp='Other username to test security of setuid scripts with?'
6231                 dflt='none'
6232                 . ./myread
6233                 case "$ans" in
6234                 n|none)
6235                         case "$d_suidsafe" in
6236                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6237                                 dflt=n;;
6238                         "$undef")
6239                                 echo "Well, the $hint value is *not* secure." >&4
6240                                 dflt=n;;
6241                         *)      echo "Well, the $hint value *is* secure." >&4
6242                                 dflt=y;;
6243                         esac
6244                         ;;
6245                 *)
6246                         $rm -f reflect flect
6247                         echo "#!$ls" >reflect
6248                         chmod +x,u+s reflect
6249                         echo >flect
6250                         chmod a+w flect
6251                         echo '"su" will (probably) prompt you for '"$ans's password."
6252                         su $ans -c './reflect >flect'
6253                         if $contains "/dev/fd" flect >/dev/null; then
6254                                 echo "Okay, it looks like setuid scripts are secure." >&4
6255                                 dflt=y
6256                         else
6257                                 echo "I don't think setuid scripts are secure." >&4
6258                                 dflt=n
6259                         fi
6260                         ;;
6261                 esac
6262                 rp='Does your kernel have *secure* setuid scripts?'
6263                 . ./myread
6264                 case "$ans" in
6265                 [yY]*)  val="$define";;
6266                 *)      val="$undef";;
6267                 esac
6268         fi
6269 else
6270         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6271         echo "(That's for file descriptors, not floppy disks.)"
6272         val="$undef"
6273 fi
6274 set d_suidsafe
6275 eval $setvar
6276
6277 $rm -f reflect flect
6278
6279 : now see if they want to do setuid emulation
6280 echo " "
6281 val="$undef"
6282 case "$d_suidsafe" in
6283 "$define")
6284         val="$undef"
6285         echo "No need to emulate SUID scripts since they are secure here." >&4
6286         ;;
6287 *)
6288         $cat <<EOM
6289 Some systems have disabled setuid scripts, especially systems where
6290 setuid scripts cannot be secure.  On systems where setuid scripts have
6291 been disabled, the setuid/setgid bits on scripts are currently
6292 useless.  It is possible for $package to detect those bits and emulate
6293 setuid/setgid in a secure fashion.  This emulation will only work if
6294 setuid scripts have been disabled in your kernel.
6295
6296 EOM
6297         case "$d_dosuid" in
6298         "$define") dflt=y ;;
6299         *) dflt=n ;;
6300         esac
6301         rp="Do you want to do setuid/setgid emulation?"
6302         . ./myread
6303         case "$ans" in
6304         [yY]*)  val="$define";;
6305         *)      val="$undef";;
6306         esac
6307         ;;
6308 esac
6309 set d_dosuid
6310 eval $setvar
6311
6312 : Find perl5.005 or later.
6313 echo "Looking for a previously installed perl5.005 or later... "
6314 case "$perl5" in
6315 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6316                 : Check if this perl is recent and can load a simple module
6317                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6318                         perl5=$tdir/perl
6319                         break;
6320                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6321                         perl5=$tdir/perl5
6322                         break;
6323                 fi
6324         done
6325         ;;
6326 *)      perl5="$perl5"
6327         ;;
6328 esac
6329 case "$perl5" in
6330 '')     echo "None found.  That's ok.";;
6331 *)      echo "Using $perl5." ;;
6332 esac
6333
6334 $cat <<EOM
6335
6336 After $package is installed, you may wish to install various
6337 add-on modules and utilities.  Typically, these add-ons will
6338 be installed under $prefix with the rest
6339 of this package.  However, you may wish to install such add-ons
6340 elsewhere under a different prefix.
6341
6342 If you do not wish to put everything under a single prefix, that's
6343 ok.  You will be prompted for the individual locations; this siteprefix
6344 is only used to suggest the defaults.
6345
6346 The default should be fine for most people.
6347
6348 EOM
6349 fn=d~+
6350 rp='Installation prefix to use for add-on modules and utilities?'
6351 : XXX Here might be another good place for an installstyle setting.
6352 case "$siteprefix" in
6353 '') dflt=$prefix ;;
6354 *)  dflt=$siteprefix ;;
6355 esac
6356 . ./getfile
6357 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6358 oldsiteprefix=''
6359 case "$siteprefix" in
6360 '') ;;
6361 *)      case "$ans" in
6362         "$prefix") ;;
6363         *) oldsiteprefix="$prefix";;
6364         esac
6365         ;;
6366 esac
6367 siteprefix="$ans"
6368 siteprefixexp="$ansexp"
6369
6370 : determine where site specific libraries go.
6371 : Usual default is /usr/local/lib/perl5/site_perl/$version
6372 : The default "style" setting is made in installstyle.U
6373 : XXX No longer works with Prefixit stuff.
6374 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6375 case "$sitelib" in
6376 '') case "$installstyle" in
6377         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6378         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6379         esac
6380         ;;
6381 *)      dflt="$sitelib"
6382         ;;
6383 esac
6384 $cat <<EOM
6385
6386 The installation process will create a directory for
6387 site-specific extensions and modules.  Most users find it convenient
6388 to place all site-specific files in this directory rather than in the
6389 main distribution directory.
6390
6391 EOM
6392 fn=d~+
6393 rp='Pathname for the site-specific library files?'
6394 . ./getfile
6395 prefixvar=sitelib
6396 . ./setprefixvar
6397 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6398
6399 : Determine list of previous versions to include in @INC
6400 $cat > getverlist <<EOPL
6401 #!$perl5 -w
6402 use File::Basename;
6403 \$api_versionstring = "$api_versionstring";
6404 \$version = "$version";
6405 \$stem = "$sitelib_stem";
6406 \$archname = "$archname";
6407 EOPL
6408         $cat >> getverlist <<'EOPL'
6409 # The list found is store twice for each entry: the original name, and
6410 # the binary broken down version as pack "sss", so sorting is easy and
6411 # unambiguous. This will work for all versions that have a maximum of
6412 # three digit groups, separate by '.'s or '_'s. Names are extended with
6413 # ".0.0" to ensure at least three elements for the pack.
6414 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6415
6416 # Can't have leading @ because metaconfig interprets it as a command!
6417 ;@inc_version_list=();
6418 # XXX Redo to do opendir/readdir?
6419 if (-d $stem) {
6420     chdir($stem);
6421     ;@candidates = map {
6422         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6423 }
6424 else {
6425     ;@candidates = ();
6426 }
6427
6428 ($pversion, $aversion, $vsn5005) = map {
6429     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6430 foreach $d (@candidates) {
6431     if ($d->[1] lt $pversion) {
6432         if ($d->[1] ge $aversion) {
6433             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6434         }
6435         elsif ($d->[1] ge $vsn5005) {
6436             unshift(@inc_version_list, grep { -d } $d->[0]);
6437         }
6438     }
6439     else {
6440         # Skip newer version.  I.e. don't look in
6441         # 5.7.0 if we're installing 5.6.1.
6442     }
6443 }
6444
6445 if (@inc_version_list) {
6446     print join(' ', @inc_version_list);
6447 }
6448 else {
6449     # Blank space to preserve value for next Configure run.
6450     print " ";
6451 }
6452 EOPL
6453 chmod +x getverlist
6454 case "$inc_version_list" in
6455 '')     if test -x "$perl5$exe_ext"; then
6456                 dflt=`$perl5 getverlist`
6457         else
6458                 dflt='none'
6459         fi
6460         ;;
6461 $undef) dflt='none' ;;
6462 *)  eval dflt=\"$inc_version_list\" ;;
6463 esac
6464 case "$dflt" in
6465 ''|' ') dflt=none ;;
6466 esac
6467 case "$dflt" in
6468 5.005) dflt=none ;;
6469 esac
6470 $cat <<EOM
6471
6472 In order to ease the process of upgrading, this version of perl
6473 can be configured to use modules built and installed with earlier
6474 versions of perl that were installed under $prefix.  Specify here
6475 the list of earlier versions that this version of perl should check.
6476 If Configure detected no earlier versions of perl installed under
6477 $prefix, then the list will be empty.  Answer 'none' to tell perl
6478 to not search earlier versions.
6479
6480 The default should almost always be sensible, so if you're not sure,
6481 just accept the default.
6482 EOM
6483
6484 rp='List of earlier versions to include in @INC?'
6485 . ./myread
6486 case "$ans" in
6487 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6488 *) inc_version_list="$ans" ;;
6489 esac
6490 case "$inc_version_list" in
6491 ''|' ')
6492         inc_version_list_init='0'
6493         d_inc_version_list="$undef"
6494         ;;
6495 *)      inc_version_list_init=`echo $inc_version_list |
6496                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6497         d_inc_version_list="$define"
6498         ;;
6499 esac
6500 $rm -f getverlist
6501
6502 : see if this is a malloc.h system
6503 : we want a real compile instead of Inhdr because some systems have a
6504 : malloc.h that just gives a compile error saying to use stdlib.h instead
6505 echo " "
6506 $cat >try.c <<EOCP
6507 #include <stdlib.h>
6508 #include <malloc.h>
6509 int main () { return 0; }
6510 EOCP
6511 set try
6512 if eval $compile; then
6513     echo "<malloc.h> found." >&4
6514     val="$define"
6515 else
6516     echo "<malloc.h> NOT found." >&4
6517     val="$undef"
6518 fi
6519 $rm -f try.c try
6520 set i_malloc
6521 eval $setvar
6522
6523 : check for void type
6524 echo " "
6525 echo "Checking to see how well your C compiler groks the void type..." >&4
6526 case "$voidflags" in
6527 '')
6528         $cat >try.c <<EOCP
6529 #$i_stdlib I_STDLIB
6530 #ifdef I_STDLIB
6531 #include <stdlib.h>
6532 #endif
6533 #if TRY & 1
6534 void sub() {
6535 #else
6536 sub() {
6537 #endif
6538         extern void moo();      /* function returning void */
6539         void (*goo)();          /* ptr to func returning void */
6540 #if TRY & 8
6541         void *hue;              /* generic ptr */
6542 #endif
6543 #if TRY & 2
6544         void (*foo[10])();
6545 #endif
6546
6547 #if TRY & 4
6548         if(goo == moo) {
6549                 exit(0);
6550         }
6551 #endif
6552         exit(0);
6553 }
6554 int main() { sub(); }
6555 EOCP
6556         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6557                 voidflags=$defvoidused
6558         echo "Good.  It appears to support void to the level $package wants.">&4
6559                 if $contains warning .out >/dev/null 2>&1; then
6560                         echo "However, you might get some warnings that look like this:"
6561                         $cat .out
6562                 fi
6563         else
6564 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6565                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6566                         echo "It supports 1..."
6567                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6568                                 echo "It also supports 2..."
6569                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6570                                         voidflags=7
6571                                         echo "And it supports 4 but not 8 definitely."
6572                                 else
6573                                         echo "It doesn't support 4..."
6574                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6575                                                 voidflags=11
6576                                                 echo "But it supports 8."
6577                                         else
6578                                                 voidflags=3
6579                                                 echo "Neither does it support 8."
6580                                         fi
6581                                 fi
6582                         else
6583                                 echo "It does not support 2..."
6584                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6585                                         voidflags=13
6586                                         echo "But it supports 4 and 8."
6587                                 else
6588                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6589                                                 voidflags=5
6590                                                 echo "And it supports 4 but has not heard about 8."
6591                                         else
6592                                                 echo "However it supports 8 but not 4."
6593                                         fi
6594                                 fi
6595                         fi
6596                 else
6597                         echo "There is no support at all for void."
6598                         voidflags=0
6599                 fi
6600         fi
6601 esac
6602 case "$voidflags" in
6603 "$defvoidused") ;;
6604 *)      $cat >&4 <<'EOM'
6605   Support flag bits are:
6606     1: basic void declarations.
6607     2: arrays of pointers to functions returning void.
6608     4: operations between pointers to and addresses of void functions.
6609     8: generic void pointers.
6610 EOM
6611         dflt="$voidflags";
6612         rp="Your void support flags add up to what?"
6613         . ./myread
6614         voidflags="$ans"
6615         ;;
6616 esac
6617 $rm -f try.* .out
6618
6619 : check for length of pointer
6620 echo " "
6621 case "$ptrsize" in
6622 '')
6623         echo "Checking to see how big your pointers are..." >&4
6624         if test "$voidflags" -gt 7; then
6625                 echo '#define VOID_PTR char *' > try.c
6626         else
6627                 echo '#define VOID_PTR void *' > try.c
6628         fi
6629         $cat >>try.c <<EOCP
6630 #include <stdio.h>
6631 #$i_stdlib I_STDLIB
6632 #ifdef I_STDLIB
6633 #include <stdlib.h>
6634 #endif
6635 int main()
6636 {
6637     printf("%d\n", (int)sizeof(VOID_PTR));
6638     exit(0);
6639 }
6640 EOCP
6641         set try
6642         if eval $compile_ok; then
6643                 ptrsize=`$run ./try`
6644                 echo "Your pointers are $ptrsize bytes long."
6645         else
6646                 dflt='4'
6647                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6648                 rp="What is the size of a pointer (in bytes)?"
6649                 . ./myread
6650                 ptrsize="$ans"
6651         fi
6652         ;;
6653 esac
6654 $rm -f try.c try
6655 case "$use64bitall" in
6656 "$define"|true|[yY]*)
6657         case "$ptrsize" in
6658         4)      cat <<EOM >&4
6659
6660 *** You have chosen a maximally 64-bit build,
6661 *** but your pointers are only 4 bytes wide.
6662 *** Please rerun Configure without -Duse64bitall.
6663 EOM
6664                 case "$d_quad" in
6665                 define)
6666                         cat <<EOM >&4
6667 *** Since you have quads, you could possibly try with -Duse64bitint.
6668 EOM
6669                         ;;
6670                 esac
6671                 cat <<EOM >&4
6672 *** Cannot continue, aborting.
6673
6674 EOM
6675
6676                 exit 1
6677                 ;;
6678         esac
6679         ;;
6680 esac
6681
6682
6683 : determine whether to use malloc wrapping
6684 echo " "
6685 case "$usemallocwrap" in
6686 [yY]*|true|$define)     dflt='y' ;;
6687 [nN]*|false|$undef)     dflt='n' ;;
6688 *)      case "$usedevel" in
6689         [yY]*|true|$define)     dflt='y' ;;
6690         *) dflt='n' ;;
6691         esac
6692         ;;
6693 esac
6694 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6695 . ./myread
6696 usemallocwrap="$ans"
6697 case "$ans" in
6698 y*|true)
6699         usemallocwrap="$define" ;;
6700 *)
6701         usemallocwrap="$undef" ;;
6702 esac
6703
6704 : determine which malloc to compile in
6705 echo " "
6706 case "$usemymalloc" in
6707 [yY]*|true|$define)     dflt='y' ;;
6708 [nN]*|false|$undef)     dflt='n' ;;
6709 *)      case "$ptrsize" in
6710         4) dflt='y' ;;
6711         *) dflt='n' ;;
6712         esac
6713         ;;
6714 esac
6715 rp="Do you wish to attempt to use the malloc that comes with $package?"
6716 . ./myread
6717 usemymalloc="$ans"
6718 case "$ans" in
6719 y*|true)
6720         usemymalloc='y'
6721         mallocsrc='malloc.c'
6722         mallocobj="malloc$_o"
6723         d_mymalloc="$define"
6724         case "$libs" in
6725         *-lmalloc*)
6726                 : Remove malloc from list of libraries to use
6727                 echo "Removing unneeded -lmalloc from library list" >&4
6728                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6729                 shift
6730                 libs="$*"
6731                 echo "libs = $libs" >&4
6732                 ;;
6733         esac
6734         ;;
6735 *)
6736         usemymalloc='n'
6737         mallocsrc=''
6738         mallocobj=''
6739         d_mymalloc="$undef"
6740         ;;
6741 esac
6742
6743 : compute the return types of malloc and free
6744 echo " "
6745 $cat >malloc.c <<END
6746 #$i_malloc I_MALLOC
6747 #$i_stdlib I_STDLIB
6748 #include <stdio.h>
6749 #include <sys/types.h>
6750 #ifdef I_MALLOC
6751 #include <malloc.h>
6752 #endif
6753 #ifdef I_STDLIB
6754 #include <stdlib.h>
6755 #endif
6756 #ifdef TRY_MALLOC
6757 void *malloc();
6758 #endif
6759 #ifdef TRY_FREE
6760 void free();
6761 #endif
6762 END
6763 case "$malloctype" in
6764 '')
6765         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6766                 malloctype='void *'
6767         else
6768                 malloctype='char *'
6769         fi
6770         ;;
6771 esac
6772 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6773
6774 case "$freetype" in
6775 '')
6776         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6777                 freetype='void'
6778         else
6779                 freetype='int'
6780         fi
6781         ;;
6782 esac
6783 echo "Your system uses $freetype free(), it would seem." >&4
6784 $rm -f malloc.[co]
6785 : determine where site specific architecture-dependent libraries go.
6786 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6787 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6788 : sitelib may have an optional trailing /share.
6789 case "$sitearch" in
6790 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6791         dflt="$dflt/$archname"
6792         ;;
6793 *)      dflt="$sitearch"
6794         ;;
6795 esac
6796 set sitearch sitearch none
6797 eval $prefixit
6798 $cat <<EOM
6799
6800 The installation process will also create a directory for
6801 architecture-dependent site-specific extensions and modules.
6802
6803 EOM
6804 fn=d~+
6805 rp='Pathname for the site-specific architecture-dependent library files?'
6806 . ./getfile
6807 prefixvar=sitearch
6808 . ./setprefixvar
6809 if $test X"$sitearch" = X"$sitelib"; then
6810         d_sitearch="$undef"
6811 else
6812         d_sitearch="$define"
6813 fi
6814
6815 $cat <<EOM
6816
6817 The installation process will also create a directory for
6818 vendor-supplied add-ons.  Vendors who supply perl with their system
6819 may find it convenient to place all vendor-supplied files in this
6820 directory rather than in the main distribution directory.  This will
6821 ease upgrades between binary-compatible maintenance versions of perl.
6822
6823 Of course you may also use these directories in whatever way you see
6824 fit.  For example, you might use them to access modules shared over a
6825 company-wide network.
6826
6827 The default answer should be fine for most people.
6828 This causes further questions about vendor add-ons to be skipped
6829 and no vendor-specific directories will be configured for perl.
6830
6831 EOM
6832 rp='Do you want to configure vendor-specific add-on directories?'
6833 case "$usevendorprefix" in
6834 define|true|[yY]*) dflt=y ;;
6835 *)      : User may have set vendorprefix directly on Configure command line.
6836         case "$vendorprefix" in
6837         ''|' ') dflt=n ;;
6838         *)      dflt=y ;;
6839         esac
6840         ;;
6841 esac
6842 . ./myread
6843 case "$ans" in
6844 [yY]*)  fn=d~+
6845         rp='Installation prefix to use for vendor-supplied add-ons?'
6846         case "$vendorprefix" in
6847         '') dflt='' ;;
6848         *)  dflt=$vendorprefix ;;
6849         esac
6850         . ./getfile
6851         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6852         oldvendorprefix=''
6853         case "$vendorprefix" in
6854         '') ;;
6855         *)      case "$ans" in
6856                 "$prefix") ;;
6857                 *) oldvendorprefix="$prefix";;
6858                 esac
6859                 ;;
6860         esac
6861         usevendorprefix="$define"
6862         vendorprefix="$ans"
6863         vendorprefixexp="$ansexp"
6864         ;;
6865 *)      usevendorprefix="$undef"
6866         vendorprefix=''
6867         vendorprefixexp=''
6868         ;;
6869 esac
6870
6871 case "$vendorprefix" in
6872 '')     d_vendorlib="$undef"
6873         vendorlib=''
6874         vendorlibexp=''
6875         ;;
6876 *)      d_vendorlib="$define"
6877         : determine where vendor-supplied modules go.
6878         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6879         case "$vendorlib" in
6880         '')
6881                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6882                 case "$installstyle" in
6883                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6884                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6885                 esac
6886                 ;;
6887         *)      dflt="$vendorlib"
6888                 ;;
6889         esac
6890         fn=d~+
6891         rp='Pathname for the vendor-supplied library files?'
6892         . ./getfile
6893         vendorlib="$ans"
6894         vendorlibexp="$ansexp"
6895         ;;
6896 esac
6897 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6898 prefixvar=vendorlib
6899 . ./installprefix
6900
6901 case "$vendorprefix" in
6902 '')     d_vendorarch="$undef"
6903         vendorarch=''
6904         vendorarchexp=''
6905         ;;
6906 *)      d_vendorarch="$define"
6907         : determine where vendor-supplied architecture-dependent libraries go.
6908         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6909         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6910         : vendorlib may have an optional trailing /share.
6911         case "$vendorarch" in
6912         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6913                 dflt="$dflt/$archname"
6914                 ;;
6915         *)      dflt="$vendorarch" ;;
6916         esac
6917         fn=d~+
6918         rp='Pathname for vendor-supplied architecture-dependent files?'
6919         . ./getfile
6920         vendorarch="$ans"
6921         vendorarchexp="$ansexp"
6922         ;;
6923 esac
6924 prefixvar=vendorarch
6925 . ./installprefix
6926
6927 : Final catch-all directories to search
6928 $cat <<EOM
6929
6930 Lastly, you can have perl look in other directories for extensions and
6931 modules in addition to those already specified.
6932 These directories will be searched after 
6933         $sitearch 
6934         $sitelib 
6935 EOM
6936 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6937 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6938 echo ' '
6939 case "$otherlibdirs" in
6940 ''|' ') dflt='none' ;;
6941 *)      dflt="$otherlibdirs" ;;
6942 esac
6943 $cat <<EOM
6944 Enter a colon-separated set of extra paths to include in perl's @INC
6945 search path, or enter 'none' for no extra paths.
6946
6947 EOM
6948
6949 rp='Colon-separated list of additional directories for perl to search?'
6950 . ./myread
6951 case "$ans" in
6952 ' '|''|none)    otherlibdirs=' ' ;;     
6953 *)      otherlibdirs="$ans" ;;
6954 esac
6955 case "$otherlibdirs" in
6956 ' ') val=$undef ;;
6957 *)      val=$define ;;
6958 esac
6959 set d_perl_otherlibdirs
6960 eval $setvar
6961
6962 : Cruising for prototypes
6963 echo " "
6964 echo "Checking out function prototypes..." >&4
6965 $cat >prototype.c <<EOCP
6966 #$i_stdlib I_STDLIB
6967 #ifdef I_STDLIB
6968 #include <stdlib.h>
6969 #endif
6970 int main(int argc, char *argv[]) {
6971         exit(0);}
6972 EOCP
6973 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6974         echo "Your C compiler appears to support function prototypes."
6975         val="$define"
6976 else
6977         echo "Your C compiler doesn't seem to understand function prototypes."
6978         val="$undef"
6979 fi
6980 set prototype
6981 eval $setvar
6982 $rm -f prototype*
6983
6984 case "$prototype" in
6985 "$define") ;;
6986 *)      ansi2knr='ansi2knr'
6987         echo " "
6988         cat <<EOM >&4
6989
6990 $me:  FATAL ERROR:
6991 This version of $package can only be compiled by a compiler that 
6992 understands function prototypes.  Unfortunately, your C compiler 
6993         $cc $ccflags
6994 doesn't seem to understand them.  Sorry about that.
6995
6996 If GNU cc is available for your system, perhaps you could try that instead.  
6997
6998 Eventually, we hope to support building Perl with pre-ANSI compilers.
6999 If you would like to help in that effort, please contact <perlbug@perl.org>.
7000
7001 Aborting Configure now.
7002 EOM
7003         exit 2
7004         ;;
7005 esac
7006
7007 echo " "
7008 case "$extras" in
7009 '') dflt='n';;
7010 *) dflt='y';;
7011 esac
7012 cat <<EOM
7013 Perl can be built with extra modules or bundles of modules which
7014 will be fetched from the CPAN and installed alongside Perl.
7015
7016 Notice that you will need access to the CPAN; either via the Internet,
7017 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7018 be asked later to configure the CPAN.pm module which will in turn do
7019 the installation of the rest of the extra modules or bundles.)
7020
7021 Notice also that if the modules require any external software such as
7022 libraries and headers (the libz library and the zlib.h header for the
7023 Compress::Zlib module, for example) you MUST have any such software
7024 already installed, this configuration process will NOT install such
7025 things for you.
7026
7027 If this doesn't make any sense to you, just accept the default '$dflt'.
7028 EOM
7029 rp='Install any extra modules (y or n)?'
7030 . ./myread
7031 case "$ans" in
7032 y|Y)
7033         cat <<EOM
7034
7035 Please list any extra modules or bundles to be installed from CPAN,
7036 with spaces between the names.  The names can be in any format the
7037 'install' command of CPAN.pm will understand.  (Answer 'none',
7038 without the quotes, to install no extra modules or bundles.)
7039 EOM
7040         rp='Extras?'
7041         dflt="$extras"
7042         . ./myread
7043         extras="$ans"
7044 esac
7045 case "$extras" in
7046 ''|'none')
7047         val=''
7048         $rm -f ../extras.lst
7049         ;;
7050 *)      echo "(Saving the list of extras for later...)"
7051         echo "$extras" > ../extras.lst
7052         val="'$extras'"
7053         ;;
7054 esac
7055 set extras
7056 eval $setvar
7057 echo " "
7058
7059 : determine where html pages for programs go
7060 set html1dir html1dir none
7061 eval $prefixit
7062 $cat <<EOM
7063
7064 If you wish to install html files for programs in $spackage, indicate
7065 the appropriate directory here.  To skip installing html files,
7066 answer "none".
7067 EOM
7068 case "$html1dir" in
7069 ''|none|$undef|' ') dflt=none ;;
7070 *) dflt=$html1dir ;;
7071 esac
7072 fn=dn+~
7073 rp="Directory for the main $spackage html pages?"
7074 . ./getfile
7075 prefixvar=html1dir
7076 . ./setprefixvar
7077 : Use ' ' for none so value is preserved next time through Configure
7078 $test X"$html1dir" = "X" && html1dir=' '
7079
7080 : determine where html pages for libraries and modules go
7081 set html3dir html3dir none
7082 eval $prefixit
7083 $cat <<EOM
7084
7085 If you wish to install html files for modules associated with $spackage,
7086 indicate the appropriate directory here.  To skip installing html files,
7087 answer "none".
7088 EOM
7089 : There is no obvious default.  If they have specified html1dir, then
7090 : try to key off that, possibly changing .../html1 into .../html3.
7091 case "$html3dir" in
7092 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7093 *) dflt=$html3dir ;;
7094 esac
7095 fn=dn+~
7096 rp="Directory for the $spackage module html pages?"
7097 . ./getfile
7098 prefixvar=html3dir
7099 . ./setprefixvar
7100 : Use ' ' for none so value is preserved next time through Configure
7101 $test X"$html3dir" = "X" && html3dir=' '
7102
7103 : determine whether to install perl also as /usr/bin/perl
7104
7105 echo " "
7106 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7107         $cat <<EOM
7108 Many scripts expect perl to be installed as /usr/bin/perl.
7109
7110 If you want to, I can install the perl you are about to compile
7111 as /usr/bin/perl (in addition to $bin/perl).
7112 EOM
7113         if test -f /usr/bin/perl; then
7114             $cat <<EOM
7115
7116 However, please note that because you already have a /usr/bin/perl,
7117 overwriting that with a new Perl would very probably cause problems.
7118 Therefore I'm assuming you don't want to do that (unless you insist).
7119
7120 EOM
7121             case "$installusrbinperl" in
7122             "$define"|[yY]*)    dflt='y';;
7123             *)                  dflt='n';;
7124             esac
7125         else
7126             $cat <<EOM
7127
7128 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7129
7130 EOM
7131             case "$installusrbinperl" in
7132             "$undef"|[nN]*)     dflt='n';;
7133             *)                  dflt='y';;
7134             esac
7135         fi
7136         rp="Do you want to install perl as /usr/bin/perl?"
7137         . ./myread
7138         case "$ans" in
7139         [yY]*)  val="$define";;
7140         *)      val="$undef" ;;
7141         esac
7142 else
7143         val="$undef"
7144 fi
7145 set installusrbinperl
7146 eval $setvar
7147
7148 echo " "
7149 echo "Checking for GNU C Library..." >&4
7150 cat >try.c <<'EOCP'
7151 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7152    alone are insufficient to distinguish different versions, such as
7153    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7154    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7155 */
7156 #include <stdio.h>
7157 int main(void)
7158 {
7159 #ifdef __GLIBC__
7160 #   ifdef __GLIBC_MINOR__
7161 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7162 #           include <gnu/libc-version.h>
7163             printf("%s\n",  gnu_get_libc_version());
7164 #       else
7165             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7166 #       endif
7167 #   else
7168         printf("%d\n",  __GLIBC__);
7169 #   endif
7170     return 0;
7171 #else
7172     return 1;
7173 #endif
7174 }
7175 EOCP
7176 set try
7177 if eval $compile_ok && $run ./try > glibc.ver; then
7178         val="$define"
7179         gnulibc_version=`$cat glibc.ver`
7180         echo "You are using the GNU C Library version $gnulibc_version"
7181 else
7182         val="$undef"
7183         gnulibc_version=''
7184         echo "You are not using the GNU C Library"
7185 fi
7186 $rm -f try try.* glibc.ver
7187 set d_gnulibc
7188 eval $setvar
7189
7190 : see if nm is to be used to determine whether a symbol is defined or not
7191 case "$usenm" in
7192 '')
7193         dflt=''
7194         case "$d_gnulibc" in
7195         "$define")
7196                 echo " "
7197                 echo "nm probably won't work on the GNU C Library." >&4
7198                 dflt=n
7199                 ;;
7200         esac
7201         case "$dflt" in
7202         '') 
7203                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7204                         echo " "
7205                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7206                         echo "'nm' won't be sufficient on this sytem." >&4
7207                         dflt=n
7208                 fi
7209                 ;;
7210         esac
7211         case "$dflt" in
7212         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7213                 if $test $dflt -gt 20; then
7214                         dflt=y
7215                 else
7216                         dflt=n
7217                 fi
7218                 ;;
7219         esac
7220         ;;
7221 *)
7222         case "$usenm" in
7223         true|$define) dflt=y;;
7224         *) dflt=n;;
7225         esac
7226         ;;
7227 esac
7228 $cat <<EOM
7229
7230 I can use $nm to extract the symbols from your C libraries. This
7231 is a time consuming task which may generate huge output on the disk (up
7232 to 3 megabytes) but that should make the symbols extraction faster. The
7233 alternative is to skip the 'nm' extraction part and to compile a small
7234 test program instead to determine whether each symbol is present. If
7235 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7236 this may be the best solution.
7237
7238 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7239
7240 EOM
7241 rp="Shall I use $nm to extract C symbols from the libraries?"
7242 . ./myread
7243 case "$ans" in
7244 [Nn]*) usenm=false;;
7245 *) usenm=true;;
7246 esac
7247
7248 runnm=$usenm
7249 case "$reuseval" in
7250 true) runnm=false;;
7251 esac
7252
7253 : nm options which may be necessary
7254 case "$nm_opt" in
7255 '') if $test -f /mach_boot; then
7256                 nm_opt=''       # Mach
7257         elif $test -d /usr/ccs/lib; then
7258                 nm_opt='-p'     # Solaris (and SunOS?)
7259         elif $test -f /dgux; then
7260                 nm_opt='-p'     # DG-UX
7261         elif $test -f /lib64/rld; then
7262                 nm_opt='-p'     # 64-bit Irix
7263         else
7264                 nm_opt=''
7265         fi;;
7266 esac
7267
7268 : nm options which may be necessary for shared libraries but illegal
7269 : for archive libraries.  Thank you, Linux.
7270 case "$nm_so_opt" in
7271 '')     case "$myuname" in
7272         *linux*|gnu*)
7273                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7274                         nm_so_opt='--dynamic'
7275                 fi
7276                 ;;
7277         esac
7278         ;;
7279 esac
7280
7281 case "$runnm" in
7282 true)
7283 : get list of predefined functions in a handy place
7284 echo " "
7285 case "$libc" in
7286 '') libc=unknown
7287         case "$libs" in
7288         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7289         esac
7290         ;;
7291 esac
7292 case "$libs" in
7293 '') ;;
7294 *)  for thislib in $libs; do
7295         case "$thislib" in
7296         -lc|-lc_s)
7297                 : Handle C library specially below.
7298                 ;;
7299         -l*)
7300                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7301                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7302                         :
7303                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7304                         :
7305                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7306                         :
7307                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7308                         :
7309                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7310                         :
7311                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7312                         :
7313                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7314                         :
7315                 else
7316                         try=''
7317                 fi
7318                 libnames="$libnames $try"
7319                 ;;
7320         *) libnames="$libnames $thislib" ;;
7321         esac
7322         done
7323         ;;
7324 esac
7325 xxx=normal
7326 case "$libc" in
7327 unknown)
7328         set /lib/libc.$so
7329         for xxx in $libpth; do
7330                 $test -r $1 || set $xxx/libc.$so
7331                 : The messy sed command sorts on library version numbers.
7332                 $test -r $1 || \
7333                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7334                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7335                                 h
7336                                 s/[0-9][0-9]*/0000&/g
7337                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7338                                 G
7339                                 s/\n/ /' | \
7340                          $sort | $sed -e 's/^.* //'`
7341                 eval set \$$#
7342         done
7343         $test -r $1 || set /usr/ccs/lib/libc.$so
7344         $test -r $1 || set /lib/libsys_s$_a
7345         ;;
7346 *)
7347         set blurfl
7348         ;;
7349 esac
7350 if $test -r "$1"; then
7351         echo "Your (shared) C library seems to be in $1."
7352         libc="$1"
7353 elif $test -r /lib/libc && $test -r /lib/clib; then
7354         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7355         xxx=apollo
7356         libc='/lib/clib /lib/libc'
7357         if $test -r /lib/syslib; then
7358                 echo "(Your math library is in /lib/syslib.)"
7359                 libc="$libc /lib/syslib"
7360         fi
7361 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7362         echo "Your C library seems to be in $libc, as you said before."
7363 elif $test -r $incpath/usr/lib/libc$_a; then
7364         libc=$incpath/usr/lib/libc$_a;
7365         echo "Your C library seems to be in $libc.  That's fine."
7366 elif $test -r /lib/libc$_a; then
7367         libc=/lib/libc$_a;
7368         echo "Your C library seems to be in $libc.  You're normal."
7369 else
7370         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7371                 :
7372         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7373                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7374         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7375                 :
7376         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7377                 :
7378         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7379                 :
7380         else
7381                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7382         fi
7383         if $test -r "$tans"; then
7384                 echo "Your C library seems to be in $tans, of all places."
7385                 libc=$tans
7386         else
7387                 libc='blurfl'
7388         fi
7389 fi
7390 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7391         dflt="$libc"
7392         cat <<EOM
7393
7394 If the guess above is wrong (which it might be if you're using a strange
7395 compiler, or your machine supports multiple models), you can override it here.
7396
7397 EOM
7398 else
7399         dflt=''
7400         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7401         cat >&4 <<EOM
7402 I can't seem to find your C library.  I've looked in the following places:
7403
7404 EOM
7405         $sed 's/^/      /' libpath
7406         cat <<EOM
7407
7408 None of these seems to contain your C library. I need to get its name...
7409
7410 EOM
7411 fi
7412 fn=f
7413 rp='Where is your C library?'
7414 . ./getfile
7415 libc="$ans"
7416
7417 echo " "
7418 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7419 set X `cat libnames`
7420 shift
7421 xxx=files
7422 case $# in 1) xxx=file; esac
7423 echo "Extracting names from the following $xxx for later perusal:" >&4
7424 echo " "
7425 $sed 's/^/      /' libnames >&4
7426 echo " "
7427 $echo $n "This may take a while...$c" >&4
7428
7429 for file in $*; do
7430         case $file in
7431         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7432         *) $nm $nm_opt $file 2>/dev/null;;
7433         esac
7434 done >libc.tmp
7435
7436 $echo $n ".$c"
7437 $grep fprintf libc.tmp > libc.ptf
7438 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7439 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7440 xxx='[ADTSIW]'
7441 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7442         eval $xscan;\
7443         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7444                 eval $xrun
7445 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7446         eval $xscan;\
7447         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7448                 eval $xrun
7449 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7450         eval $xscan;\
7451         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7452                 eval $xrun
7453 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7454         eval $xscan;\
7455         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7456                 eval $xrun
7457 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7458         eval $xscan;\
7459         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7460                 eval $xrun
7461 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7462         eval $xscan;\
7463         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7464                 eval $xrun
7465 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7466                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7467         eval $xscan;\
7468         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7469                 eval $xrun
7470 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7471         eval $xscan;\
7472         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7473                 eval $xrun
7474 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7475         eval $xscan;\
7476         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7477                 eval $xrun
7478 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7479         eval $xscan;\
7480         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7481                 eval $xrun
7482 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7483         eval $xscan;\
7484         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7485                 eval $xrun
7486 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7487         eval $xscan;\
7488         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7489                 eval $xrun
7490 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7491         eval $xscan;\
7492         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7493                 eval $xrun
7494 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7495         eval $xscan;\
7496         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7497                 eval $xrun
7498 else
7499         $nm -p $* 2>/dev/null >libc.tmp
7500         $grep fprintf libc.tmp > libc.ptf
7501         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7502                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7503         then
7504                 nm_opt='-p'
7505                 eval $xrun
7506         else
7507                 echo " "
7508                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7509                 com=''
7510                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7511                         for thisname in $libnames $libc; do
7512                                 $ar t $thisname >>libc.tmp
7513                         done
7514                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7515                         echo "Ok." >&4
7516                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7517                         # Repeat libc to extract forwarders to DLL entries too
7518                         for thisname in $libnames $libc; do
7519                                 $ar tv $thisname >>libc.tmp
7520                                 # Revision 50 of EMX has bug in $ar.
7521                                 # it will not extract forwarders to DLL entries
7522                                 # Use emximp which will extract exactly them.
7523                                 emximp -o tmp.imp $thisname \
7524                                     2>/dev/null && \
7525                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7526                                     < tmp.imp >>libc.tmp
7527                                 $rm tmp.imp
7528                         done
7529                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7530                         echo "Ok." >&4
7531                 else
7532                         echo "$ar didn't seem to work right." >&4
7533                         echo "Maybe this is a Cray...trying bld instead..." >&4
7534                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7535                         then
7536                                 for thisname in $libnames; do
7537                                         bld t $libnames | \
7538                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7539                                         $ar t $thisname >>libc.tmp
7540                                 done
7541                                 echo "Ok." >&4
7542                         else
7543                                 echo "That didn't work either.  Giving up." >&4
7544                                 exit 1
7545                         fi
7546                 fi
7547         fi
7548 fi
7549 nm_extract="$com"
7550 case "$PASE" in
7551 define)
7552     echo " "
7553     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7554     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7555     ;;
7556 *)  if $test -f /lib/syscalls.exp; then
7557         echo " "
7558         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7559         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7560     fi
7561     ;;
7562 esac
7563 ;;
7564 esac
7565 $rm -f libnames libpath
7566
7567 : see if dld is available
7568 set dld.h i_dld
7569 eval $inhdr
7570
7571 : is a C symbol defined?
7572 csym='tlook=$1;
7573 case "$3" in
7574 -v) tf=libc.tmp; tdc="";;
7575 -a) tf=libc.tmp; tdc="[]";;
7576 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7577 esac;
7578 tx=yes;
7579 case "$reuseval-$4" in
7580 true-) ;;
7581 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7582 esac;
7583 case "$tx" in
7584 yes)
7585         tval=false;
7586         if $test "$runnm" = true; then
7587                 if $contains $tlook $tf >/dev/null 2>&1; then
7588                         tval=true;
7589                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7590                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7591                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7592                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7593                         $rm -f try$_exe try.c core core.* try.core;
7594                 fi;
7595         else
7596                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7597                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7598                 $rm -f try$_exe try.c;
7599         fi;
7600         ;;
7601 *)
7602         case "$tval" in
7603         $define) tval=true;;
7604         *) tval=false;;
7605         esac;
7606         ;;
7607 esac;
7608 eval "$2=$tval"'
7609
7610 : define an is-in-libc? function
7611 inlibc='echo " "; td=$define; tu=$undef;
7612 sym=$1; var=$2; eval "was=\$$2";
7613 tx=yes;
7614 case "$reuseval$was" in
7615 true) ;;
7616 true*) tx=no;;
7617 esac;
7618 case "$tx" in
7619 yes)
7620         set $sym tres -f;
7621         eval $csym;
7622         case "$tres" in
7623         true)
7624                 echo "$sym() found." >&4;
7625                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7626         *)
7627                 echo "$sym() NOT found." >&4;
7628                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7629         esac;;
7630 *)
7631         case "$was" in
7632         $define) echo "$sym() found." >&4;;
7633         *) echo "$sym() NOT found." >&4;;
7634         esac;;
7635 esac'
7636
7637
7638 echo " "
7639 echo "Checking for C++..." >&4
7640 cat >try.c <<'EOCP'
7641 #include <stdio.h>
7642 int main(void)
7643 {
7644 #ifdef __cplusplus
7645     printf("define\n");
7646 #else
7647     printf("undef\n");
7648 #endif
7649     return 0;
7650 }
7651 EOCP
7652 set try
7653 if eval $compile_ok && $run ./try >cplusplus$$; then
7654         val=`$cat cplusplus$$`
7655         echo "You are using a C++ compiler."
7656 else
7657         val="$undef"
7658         echo "You are not using a C++ compiler."
7659 fi
7660 $rm -f try try.* cplusplus$$
7661 set d_cplusplus
7662 eval $setvar
7663
7664 : see if dlopen exists
7665 xxx_runnm="$runnm"
7666 xxx_ccflags="$ccflags"
7667 runnm=false
7668 : with g++ one needs -shared to get is-in-libc to work for dlopen
7669 case "$gccversion" in
7670 '')     ;;
7671 *)      case "$d_cplusplus" in
7672         "$define") ccflags="$ccflags -shared" ;;
7673         esac
7674         ;;
7675 esac
7676 set dlopen d_dlopen
7677 eval $inlibc
7678 runnm="$xxx_runnm"
7679 ccflags="$xxx_ccflags"
7680
7681 : see if this is a unistd.h system
7682 set unistd.h i_unistd
7683 eval $inhdr
7684
7685 : determine which dynamic loading, if any, to compile in
7686 echo " "
7687 dldir="ext/DynaLoader"
7688 case "$usedl" in
7689 $define|y|true)
7690         dflt='y'
7691         usedl="$define"
7692         ;;
7693 $undef|n|false)
7694         dflt='n'
7695         usedl="$undef"
7696         ;;
7697 *) 
7698         dflt='n'
7699         case "$d_dlopen" in
7700             $define) dflt='y' ;;
7701         esac
7702         case "$i_dld" in
7703             $define) dflt='y' ;;
7704         esac
7705         : Does a dl_xxx.xs file exist for this operating system
7706         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7707         ;;
7708 esac
7709 rp="Do you wish to use dynamic loading?"
7710 . ./myread
7711 usedl="$ans"
7712 case "$ans" in
7713 y*) usedl="$define"
7714         case "$dlsrc" in
7715         '')
7716                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7717                         dflt="$dldir/dl_${osname}.xs"
7718                 elif $test "$d_dlopen" = "$define" ; then
7719                         dflt="$dldir/dl_dlopen.xs"
7720                 elif $test "$i_dld" = "$define" ; then
7721                         dflt="$dldir/dl_dld.xs"
7722                 else
7723                         dflt=''
7724                 fi
7725                 ;;
7726         *)      dflt="$dldir/$dlsrc"
7727                 ;;
7728         esac
7729     echo "The following dynamic loading files are available:"
7730         : Can not go over to $dldir because getfile has path hard-coded in.
7731         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7732         rp="Source file to use for dynamic loading"
7733         fn="fne"
7734         gfpth="$src"
7735         . ./getfile
7736         usedl="$define"
7737         : emulate basename
7738         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7739
7740         $cat << EOM
7741
7742 Some systems may require passing special flags to $cc -c to
7743 compile modules that will be used to create a shared library.
7744 To use no flags, say "none".
7745
7746 EOM
7747     case "$cccdlflags" in
7748     '') case "$gccversion" in
7749                 '') case "$osname" in
7750                         hpux)   dflt='+z' ;;
7751                         next)   dflt='none' ;;
7752                         irix*)  dflt='-KPIC' ;;
7753                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7754                         sunos)  dflt='-pic' ;;
7755                         *)      dflt='none' ;;
7756                     esac
7757                         ;;
7758                 *)  case "$osname" in
7759                         darwin) dflt='none' ;;
7760                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7761                         *)      dflt='-fpic' ;;
7762                     esac ;;
7763             esac ;;
7764         ' ') dflt='none' ;;
7765     *)  dflt="$cccdlflags" ;;
7766     esac
7767     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7768     . ./myread
7769     case "$ans" in
7770     none) cccdlflags=' ' ;;
7771     *) cccdlflags="$ans" ;;
7772     esac
7773
7774     cat << EOM
7775
7776 Some systems use ld to create libraries that can be dynamically loaded,
7777 while other systems (such as those using ELF) use $cc.
7778
7779 EOM
7780         case "$ld" in
7781         '')     $cat >try.c <<EOM
7782 /* Test for whether ELF binaries are produced */
7783 #include <fcntl.h>
7784 #$i_stdlib I_STDLIB
7785 #ifdef I_STDLIB
7786 #include <stdlib.h>
7787 #endif
7788 #$i_unistd I_UNISTD
7789 #ifdef I_UNISTD
7790 #include <unistd.h>
7791 #endif
7792 int main() {
7793         char b[4];
7794         int i = open("a.out",O_RDONLY);
7795         if(i == -1) 
7796                 exit(1); /* fail */
7797         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7798                 exit(0); /* succeed (yes, it's ELF) */
7799         else
7800                 exit(1); /* fail */
7801 }
7802 EOM
7803                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7804                         cat <<EOM
7805 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7806 EOM
7807                         dflt="$cc"
7808                 else
7809                         echo "I'll use ld to build dynamic libraries."
7810                         dflt='ld'
7811                 fi
7812                 rm -f try.c a.out
7813                 ;;
7814         *)      dflt="$ld"
7815                 ;;
7816         esac
7817
7818     rp="What command should be used to create dynamic libraries?"
7819     . ./myread
7820         ld="$ans"
7821
7822     cat << EOM
7823
7824 Some systems may require passing special flags to $ld to create a
7825 library that can be dynamically loaded.  If your ld flags include
7826 -L/other/path options to locate libraries outside your loader's normal
7827 search path, you may need to specify those -L options here as well.  To
7828 use no flags, say "none".
7829
7830 EOM
7831     case "$lddlflags" in
7832     '') case "$osname" in
7833                         beos) dflt='-nostart' ;;
7834                         hpux) dflt='-b';
7835                               case "$gccversion" in
7836                               '') dflt="$dflt +vnocompatwarnings" ;;
7837                               esac
7838                               ;;        
7839                         linux|irix*|gnu*)       dflt='-shared' ;;
7840                         next)  dflt='none' ;;
7841                         solaris) dflt='-G' ;;
7842                         sunos) dflt='-assert nodefinitions' ;;
7843                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7844                 *)     dflt='none' ;;
7845                         esac
7846                         ;;
7847     *) dflt="$lddlflags" ;;
7848     esac
7849
7850         : Try to guess additional flags to pick up local libraries.
7851         : Be careful not to append to a plain 'none'
7852         case "$dflt" in
7853         none) dflt='' ;;
7854         esac
7855         for thisflag in $ldflags; do
7856                 case "$thisflag" in
7857                 -L*|-R*|-Wl,-R*)
7858                         case " $dflt " in
7859                         *" $thisflag "*) ;;
7860                         *) dflt="$dflt $thisflag" ;;
7861                         esac
7862                         ;;
7863                 esac
7864         done
7865
7866         case "$dflt" in
7867         ''|' ') dflt='none' ;;
7868         esac
7869
7870     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7871     . ./myread
7872     case "$ans" in
7873     none) lddlflags=' ' ;;
7874     *) lddlflags="$ans" ;;
7875     esac
7876
7877         cat <<EOM
7878
7879 Some systems may require passing special flags to $cc to indicate that
7880 the resulting executable will use dynamic linking.  To use no flags,
7881 say "none".
7882
7883 EOM
7884     case "$ccdlflags" in
7885     '') case "$osname" in
7886             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7887             next|sunos) dflt='none' ;;
7888             *)          dflt='none' ;;
7889             esac ;;
7890     ' ')  dflt='none' ;;
7891     *)  dflt="$ccdlflags" ;;
7892     esac
7893     rp="Any special flags to pass to $cc to use dynamic linking?"
7894     . ./myread
7895     case "$ans" in
7896     none) ccdlflags=' ' ;;
7897     *) ccdlflags="$ans" ;;
7898     esac
7899     ;;
7900 *)  usedl="$undef"
7901         ld='ld'
7902     dlsrc='dl_none.xs'
7903     lddlflags=''
7904     ccdlflags=''
7905     ;;
7906 esac
7907
7908 also=''
7909 case "$usedl" in
7910 $undef)
7911         # No dynamic loading being used, so don't bother even to prompt.
7912         useshrplib='false'
7913         ;;
7914 *)      case "$useshrplib" in
7915         '')     case "$osname" in
7916                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7917                         dflt=y
7918                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7919                         ;;
7920                 next*)
7921                         case "$osvers" in
7922                         4*)     dflt=y
7923                                 also='Building a shared libperl is needed for MAB support.'
7924                                 ;;
7925                         *)      dflt=n
7926                                 ;;
7927                         esac
7928                         ;;
7929                 *)      dflt=n
7930                         ;;
7931                 esac
7932                 ;;
7933         $define|true|[Yy]*)
7934                 dflt=y
7935                 ;;
7936         *)      dflt=n
7937                 ;;
7938         esac
7939         $cat << EOM
7940
7941 The perl executable is normally obtained by linking perlmain.c with
7942 libperl${_a}, any static extensions (usually just DynaLoader), and
7943 any other libraries needed on this system (such as -lm, etc.).  Since
7944 your system supports dynamic loading, it is probably possible to build
7945 a shared libperl.$so.  If you will have more than one executable linked
7946 to libperl.$so, this will significantly reduce the size of each
7947 executable, but it may have a noticeable effect on performance.  The
7948 default is probably sensible for your system.
7949 $also
7950
7951 EOM
7952         rp="Build a shared libperl.$so (y/n)"
7953         . ./myread
7954         case "$ans" in
7955         true|$define|[Yy]*)
7956                 useshrplib='true'  ;;
7957         *)      useshrplib='false' ;;
7958         esac
7959         ;;
7960 esac
7961
7962 case "$useshrplib" in
7963 true)
7964         case "$libperl" in
7965         '')
7966                 # Figure out a good name for libperl.so.  Since it gets stored in
7967                 # a version-specific architecture-dependent library, the version
7968                 # number isn't really that important, except for making cc/ld happy.
7969                 #
7970                 # A name such as libperl.so.3.1
7971                 majmin="libperl.$so.$patchlevel.$subversion"
7972                 # A name such as libperl.so.301
7973                 majonly=`echo $patchlevel $subversion |
7974                         $awk '{printf "%d%02d", $1, $2}'`
7975                 majonly=libperl.$so.$majonly
7976                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7977                 # rely on figuring it out from the naming of libc.
7978                 case "${osname}${osvers}" in
7979                 next4*)
7980                         dflt=libperl.5.$so
7981                         # XXX How handle the --version stuff for MAB?
7982                         ;;
7983                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7984                         dflt=libperl.$so
7985                         ;;
7986                 cygwin*) # ld links against an importlib
7987                         dflt=libperl$lib_ext
7988                         ;;
7989                 *)      # Try to guess based on whether libc has major.minor.
7990                         case "$libc" in
7991                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7992                         *libc.$so.[0-9]*) dflt=$majonly ;;
7993                         *)      dflt=libperl.$so ;;
7994                         esac
7995                         ;;
7996                 esac
7997                 ;;
7998         *)      dflt=$libperl
7999                 ;;
8000         esac
8001         cat << EOM
8002
8003 I need to select a good name for the shared libperl.  If your system uses
8004 library names with major and minor numbers, then you might want something
8005 like $majmin.  Alternatively, if your system uses a single version
8006 number for shared libraries, then you might want to use $majonly.
8007 Or, your system might be quite happy with a simple libperl.$so.
8008
8009 Since the shared libperl will get installed into a version-specific
8010 architecture-dependent directory, the version number of the shared perl
8011 library probably isn't important, so the default should be o.k.
8012
8013 EOM
8014         rp='What name do you want to give to the shared libperl?'
8015         . ./myread
8016         libperl=$ans
8017         echo "Ok, I'll use $libperl"
8018         ;;
8019 *)
8020         libperl="libperl${_a}"
8021         ;;
8022 esac
8023
8024 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8025 case "$shrpdir" in
8026 '') ;;
8027 *)      $cat >&4 <<EOM
8028 WARNING:  Use of the shrpdir variable for the installation location of
8029 the shared $libperl is not supported.  It was never documented and
8030 will not work in this version.  Let me (perlbug@perl.org)
8031 know of any problems this may cause.
8032
8033 EOM
8034         case "$shrpdir" in
8035         "$archlibexp/CORE")
8036                 $cat >&4 <<EOM
8037 But your current setting of $shrpdir is
8038 the default anyway, so it's harmless.
8039 EOM
8040                 ;;
8041         *)
8042                 $cat >&4 <<EOM
8043 Further, your current attempted setting of $shrpdir
8044 conflicts with the value of $archlibexp/CORE
8045 that installperl will use.
8046 EOM
8047                 ;;
8048         esac
8049         ;;
8050 esac
8051
8052 # How will the perl executable find the installed shared $libperl?
8053 # Add $xxx to ccdlflags.
8054 # If we can't figure out a command-line option, use $shrpenv to
8055 # set env LD_RUN_PATH.  The main perl makefile uses this.
8056 shrpdir=$archlibexp/CORE
8057 xxx=''
8058 tmp_shrpenv=''
8059 if "$useshrplib"; then
8060     case "$osname" in 
8061         aix)
8062                 # We'll set it in Makefile.SH...
8063                 ;;
8064         solaris)
8065                 xxx="-R $shrpdir"
8066                 ;;
8067         freebsd|netbsd|openbsd|interix|dragonfly)
8068                 xxx="-Wl,-R$shrpdir"
8069                 ;;
8070         bsdos|linux|irix*|dec_osf|gnu*)
8071                 xxx="-Wl,-rpath,$shrpdir"
8072                 ;;
8073         next)
8074                 # next doesn't like the default...
8075                 ;;
8076         beos)
8077                 # beos doesn't like the default, either.
8078                 ;;
8079         hpux*)
8080                 # hpux doesn't like the default, either.
8081                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8082                 ;;
8083         *)
8084                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8085                 ;;
8086         esac
8087         case "$xxx" in
8088         '') ;;
8089         *)      
8090                 # Only add $xxx if it isn't already in ccdlflags.
8091                 case " $ccdlflags " in
8092                 *" $xxx "*)     ;;
8093                 *)      ccdlflags="$ccdlflags $xxx"
8094                         cat <<EOM >&4
8095
8096 Adding $xxx to the flags
8097 passed to $ld so that the perl executable will find the 
8098 installed shared $libperl.
8099
8100 EOM
8101                         ;;
8102                 esac
8103                 ;;
8104         esac
8105 fi
8106 # Fix ccdlflags in AIX for building external extensions.
8107 # (For building Perl itself bare -bE:perl.exp is needed,
8108 #  Makefile.SH takes care of this.)
8109 case "$osname" in
8110 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8111 esac
8112 # Respect a hint or command-line value.
8113 case "$shrpenv" in
8114 '') shrpenv="$tmp_shrpenv" ;;
8115 esac
8116 case "$ldlibpthname" in
8117 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8118 none)   ldlibpthname='' ;;
8119 esac
8120
8121 : determine where manual pages are on this system
8122 echo " "
8123 case "$sysman" in
8124 '') 
8125         syspath='/usr/share/man/man1 /usr/man/man1'
8126         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8127         syspath="$syspath /usr/man/u_man/man1"
8128         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8129         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8130         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8131         sysman=`./loc . /usr/man/man1 $syspath`
8132         ;;
8133 esac
8134 if $test -d "$sysman"; then
8135         echo "System manual is in $sysman." >&4
8136 else
8137         echo "Could not find manual pages in source form." >&4
8138 fi
8139
8140 : determine where manual pages go
8141 set man1dir man1dir none
8142 eval $prefixit
8143 $cat <<EOM
8144
8145 $spackage has manual pages available in source form.
8146 EOM
8147 case "$nroff" in
8148 nroff)
8149         echo "However, you don't have nroff, so they're probably useless to you."
8150         case "$man1dir" in
8151         '') man1dir="none";;
8152         esac;;
8153 esac
8154 echo "If you don't want the manual sources installed, answer 'none'."
8155 case "$man1dir" in
8156 ' ') dflt=none
8157         ;;
8158 '')
8159         lookpath="$prefixexp/share/man/man1"
8160         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8161         lookpath="$lookpath $prefixexp/man/p_man/man1"
8162         lookpath="$lookpath $prefixexp/man/u_man/man1"
8163         lookpath="$lookpath $prefixexp/man/man.1"
8164         case "$sysman" in
8165         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8166         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8167         esac
8168         set dflt
8169         eval $prefixup
8170         ;;
8171 *)  dflt="$man1dir"
8172         ;;
8173 esac
8174 echo " "
8175 fn=dn+~
8176 rp="Where do the main $spackage manual pages (source) go?"
8177 . ./getfile
8178 if $test "X$man1direxp" != "X$ansexp"; then
8179         installman1dir=''
8180 fi
8181 prefixvar=man1dir
8182 . ./setprefixvar
8183
8184 case "$man1dir" in
8185 '')     man1dir=' '
8186         installman1dir='';;
8187 esac
8188
8189 : What suffix to use on installed man pages
8190
8191 case "$man1dir" in
8192 ' ')
8193         man1ext='0'
8194         ;;
8195 *)
8196         rp="What suffix should be used for the main $spackage man pages?"
8197         case "$man1ext" in
8198         '')     case "$man1dir" in
8199                 *1)  dflt=1 ;;
8200                 *1p) dflt=1p ;;
8201                 *1pm) dflt=1pm ;;
8202                 *l) dflt=l;;
8203                 *n) dflt=n;;
8204                 *o) dflt=o;;
8205                 *p) dflt=p;;
8206                 *C) dflt=C;;
8207                 *L) dflt=L;;
8208                 *L1) dflt=L1;;
8209                 *) dflt=1;;
8210                 esac
8211                 ;;
8212         *)      dflt="$man1ext";;
8213         esac
8214         . ./myread
8215         man1ext="$ans"
8216         ;;
8217 esac
8218
8219 : see if we can have long filenames
8220 echo " "
8221 first=123456789abcdef
8222 $rm -f $first
8223 if (echo hi >$first) 2>/dev/null; then
8224         if $test -f 123456789abcde; then
8225                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8226                 val="$undef"
8227         else
8228                 echo 'You can have filenames longer than 14 characters.'>&4
8229                 val="$define"
8230         fi
8231 else
8232         $cat <<'EOM'
8233 You can't have filenames longer than 14 chars.
8234 You can't even think about them!
8235 EOM
8236         val="$undef"
8237 fi 
8238 set d_flexfnam
8239 eval $setvar
8240 $rm -rf 123456789abcde*
8241
8242 : determine where library module manual pages go
8243 set man3dir man3dir none
8244 eval $prefixit
8245 $cat <<EOM
8246
8247 $spackage has manual pages for many of the library modules.
8248 EOM
8249
8250 case "$nroff" in
8251 nroff)
8252         $cat <<'EOM'
8253 However, you don't have nroff, so they're probably useless to you.
8254 EOM
8255         case "$man3dir" in
8256         '') man3dir="none";;
8257         esac;;
8258 esac
8259
8260 case "$d_flexfnam" in
8261 undef)
8262         $cat <<'EOM'
8263 However, your system can't handle the long file names like File::Basename.3.
8264 EOM
8265         case "$man3dir" in
8266         '') man3dir="none";;
8267         esac;;
8268 esac
8269
8270 echo "If you don't want the manual sources installed, answer 'none'."
8271 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8272 case "$man3dir" in
8273 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8274         if $test -d "$privlib/man/man3"; then
8275                 cat <<EOM >&4
8276
8277 WARNING:  Previous versions of perl installed man3 pages into
8278 $privlib/man/man3.  This version will suggest a
8279 new default of $dflt.
8280 EOM
8281                 tdflt=$dflt
8282                 dflt='n'
8283                 rp='Do you wish to preserve the old behavior?(y/n)'
8284                 . ./myread
8285                 case "$ans" in
8286                 y*) dflt="$privlib/man/man3" ;;
8287                 *)  dflt=$tdflt ;;
8288                 esac
8289     fi
8290         ;;
8291 *)      dflt="$man3dir" ;;
8292 esac
8293 case "$dflt" in
8294 ' ') dflt=none ;;
8295 esac
8296 echo " "
8297 fn=dn+~
8298 rp="Where do the $package library man pages (source) go?"
8299 . ./getfile
8300 prefixvar=man3dir
8301 . ./setprefixvar
8302
8303 case "$man3dir" in
8304 '')     man3dir=' '
8305         installman3dir='';;
8306 esac
8307
8308 : What suffix to use on installed man pages
8309 case "$man3dir" in
8310 ' ')
8311         man3ext='0'
8312         ;;
8313 *)
8314         rp="What suffix should be used for the $package library man pages?"
8315         case "$man3ext" in
8316         '')     case "$man3dir" in
8317                 *3)  dflt=3 ;;
8318                 *3p) dflt=3p ;;
8319                 *3pm) dflt=3pm ;;
8320                 *l) dflt=l;;
8321                 *n) dflt=n;;
8322                 *o) dflt=o;;
8323                 *p) dflt=p;;
8324                 *C) dflt=C;;
8325                 *L) dflt=L;;
8326                 *L3) dflt=L3;;
8327                 *) dflt=3;;
8328                 esac
8329                 ;;
8330         *)      dflt="$man3ext";;
8331         esac
8332         . ./myread
8333         man3ext="$ans"
8334         ;;
8335 esac
8336
8337 : see if we have to deal with yellow pages, now NIS.
8338 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8339         if $test -f /usr/etc/nibindd; then
8340                 echo " "
8341                 echo "I'm fairly confident you're on a NeXT."
8342                 echo " "
8343                 rp='Do you get the hosts file via NetInfo?'
8344                 dflt=y
8345                 case "$hostcat" in
8346                 nidump*) ;;
8347                 '') ;;
8348                 *) dflt=n;;
8349                 esac
8350                 . ./myread
8351                 case "$ans" in
8352                 y*) hostcat='nidump hosts .';;
8353                 *)      case "$hostcat" in
8354                         nidump*) hostcat='';;
8355                         esac
8356                         ;;
8357                 esac
8358         fi
8359         case "$hostcat" in
8360         nidump*) ;;
8361         *)
8362                 case "$hostcat" in
8363                 *ypcat*) dflt=y;;
8364                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8365                                 dflt=y
8366                         else
8367                                 dflt=n
8368                         fi;;
8369                 *) dflt=n;;
8370                 esac
8371                 echo " "
8372                 rp='Are you getting the hosts file via yellow pages?'
8373                 . ./myread
8374                 case "$ans" in
8375                 y*) hostcat='ypcat hosts';;
8376                 *) hostcat='cat /etc/hosts';;
8377                 esac
8378                 ;;
8379         esac
8380 fi
8381 case "$hostcat" in
8382 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8383 esac
8384 case "$groupcat" in
8385 '') test -f /etc/group && groupcat='cat /etc/group';;
8386 esac
8387 case "$passcat" in
8388 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8389 esac
8390
8391 : now get the host name
8392 echo " "
8393 echo "Figuring out host name..." >&4
8394 case "$myhostname" in
8395 '') cont=true
8396         echo 'Maybe "hostname" will work...'
8397         if tans=`sh -c hostname 2>&1` ; then
8398                 myhostname=$tans
8399                 phostname=hostname
8400                 cont=''
8401         fi
8402         ;;
8403 *) cont='';;
8404 esac
8405 if $test "$cont"; then
8406         if ./xenix; then
8407                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8408                 if tans=`cat /etc/systemid 2>&1` ; then
8409                         myhostname=$tans
8410                         phostname='cat /etc/systemid'
8411                         echo "Whadyaknow.  Xenix always was a bit strange..."
8412                         cont=''
8413                 fi
8414         elif $test -r /etc/systemid; then
8415                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8416         fi
8417 fi
8418 if $test "$cont"; then
8419         echo 'No, maybe "uuname -l" will work...'
8420         if tans=`sh -c 'uuname -l' 2>&1` ; then
8421                 myhostname=$tans
8422                 phostname='uuname -l'
8423         else
8424                 echo 'Strange.  Maybe "uname -n" will work...'
8425                 if tans=`sh -c 'uname -n' 2>&1` ; then
8426                         myhostname=$tans
8427                         phostname='uname -n'
8428                 else
8429                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8430                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8431                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8432                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8433                         else
8434                                 case "$myhostname" in
8435                                 '') echo "Does this machine have an identity crisis or something?"
8436                                         phostname='';;
8437                                 *)
8438                                         echo "Well, you said $myhostname before..."
8439                                         phostname='echo $myhostname';;
8440                                 esac
8441                         fi
8442                 fi
8443         fi
8444 fi
8445 case "$myhostname" in
8446 '') myhostname=noname ;;
8447 esac
8448 : you do not want to know about this
8449 set $myhostname
8450 myhostname=$1
8451
8452 : verify guess
8453 if $test "$myhostname" ; then
8454         dflt=y
8455         rp='Your host name appears to be "'$myhostname'".'" Right?"
8456         . ./myread
8457         case "$ans" in
8458         y*) ;;
8459         *) myhostname='';;
8460         esac
8461 fi
8462
8463 : bad guess or no guess
8464 while $test "X$myhostname" = X ; do
8465         dflt=''
8466         rp="Please type the (one word) name of your host:"
8467         . ./myread
8468         myhostname="$ans"
8469 done
8470
8471 : translate upper to lower if necessary
8472 case "$myhostname" in
8473 *[A-Z]*)
8474         echo "(Normalizing case in your host name)"
8475         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8476         ;;
8477 esac
8478
8479 case "$myhostname" in
8480 *.*)
8481         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8482         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8483         echo "(Trimming domain name from host name--host name is now $myhostname)"
8484         ;;
8485 *) case "$mydomain" in
8486         '')
8487                 {
8488                         test "X$hostcat" = "Xypcat hosts" &&
8489                         ypmatch "$myhostname" hosts 2>/dev/null |\
8490                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8491                         $test -s hosts
8492                 } || {
8493                         test "X$hostcat" != "X" &&
8494                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8495                                         /[       ]$myhostname[  . ]/p" > hosts
8496                 }
8497                 tmp_re="[       . ]"
8498                 if $test -f hosts; then
8499                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8500                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8501                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8502                                 hosts | $sort | $uniq | \
8503                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8504                         case `$echo X$dflt` in
8505                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8506                                 dflt=.
8507                                 ;;
8508                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8509                                 ;;
8510                         esac
8511                 else
8512                         echo "(I cannot locate a hosts database anywhere)"
8513                         dflt=.
8514                 fi
8515                 case "$dflt" in
8516                 .)
8517                         tans=`./loc resolv.conf X /etc /usr/etc`
8518                         if $test -f "$tans"; then
8519                                 echo "(Attempting domain name extraction from $tans)"
8520                                 dflt=.`$sed -n -e 's/   / /g' \
8521                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8522                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8523                                 case "$dflt" in
8524                                 .) dflt=.`$sed -n -e 's/        / /g' \
8525                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8526                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8527                                         ;;
8528                                 esac
8529                         fi
8530                         ;;
8531                 esac
8532                 case "$dflt" in
8533                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8534                         dflt=.`sh -c domainname 2>/dev/null`
8535                         case "$dflt" in
8536                         '') dflt='.';;
8537                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8538                         esac
8539                         ;;
8540                 esac
8541                 case "$dflt$osname" in
8542                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8543                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8544                         ;;
8545                 esac
8546                 case "$dflt" in
8547                 .) echo "(Lost all hope -- silly guess then)"
8548                         dflt='.nonet'
8549                         ;;
8550                 esac
8551                 $rm -f hosts
8552                 ;;
8553         *) dflt="$mydomain";;
8554         esac;;
8555 esac
8556 echo " "
8557 rp="What is your domain name?"
8558 . ./myread
8559 tans="$ans"
8560 case "$ans" in
8561 '') ;;
8562 .*) ;;
8563 *) tans=".$tans";;
8564 esac
8565 mydomain="$tans"
8566
8567 : translate upper to lower if necessary
8568 case "$mydomain" in
8569 *[A-Z]*)
8570         echo "(Normalizing case in your domain name)"
8571         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8572         ;;
8573 esac
8574
8575 : a little sanity check here
8576 case "$phostname" in
8577 '') ;;
8578 *)
8579         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8580         $myhostname$mydomain|$myhostname) ;;
8581         *)
8582                 case "$phostname" in
8583                 sed*)
8584                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8585                         ;;
8586                 *)
8587                         echo "(That doesn't agree with your $phostname command, by the way.)"
8588                         ;;
8589                 esac
8590         ;;
8591         esac
8592         ;;
8593 esac
8594
8595 $cat <<EOM
8596
8597 I need to get your e-mail address in Internet format if possible, i.e.
8598 something like user@host.domain. Please answer accurately since I have
8599 no easy means to double check it. The default value provided below
8600 is most probably close to reality but may not be valid from outside
8601 your organization...
8602
8603 EOM
8604 cont=x
8605 while test "$cont"; do
8606         case "$cf_email" in
8607         '') dflt="$cf_by@$myhostname$mydomain";;
8608         *) dflt="$cf_email";;
8609         esac
8610         rp='What is your e-mail address?'
8611         . ./myread
8612         cf_email="$ans"
8613         case "$cf_email" in
8614         *@*.*) cont='' ;;
8615         *)
8616                 rp='Address does not look like an Internet one.  Use it anyway?'
8617                 case "$fastread" in
8618                 yes) dflt=y ;;
8619                 *) dflt=n ;;
8620                 esac
8621                 . ./myread
8622                 case "$ans" in
8623                 y*) cont='' ;;
8624                 *) echo " " ;;
8625                 esac
8626                 ;;
8627         esac
8628 done
8629
8630 $cat <<EOM
8631
8632 If you or somebody else will be maintaining perl at your site, please
8633 fill in the correct e-mail address here so that they may be contacted
8634 if necessary. Currently, the "perlbug" program included with perl
8635 will send mail to this address in addition to perlbug@perl.org. You may
8636 enter "none" for no administrator.
8637
8638 EOM
8639 case "$perladmin" in
8640 '') dflt="$cf_email";;
8641 *) dflt="$perladmin";;
8642 esac
8643 rp='Perl administrator e-mail address'
8644 . ./myread
8645 perladmin="$ans"
8646
8647 : determine whether to only install version-specific parts.
8648 echo " "
8649 $cat <<EOM
8650 Do you want to install only the version-specific parts of the perl
8651 distribution?  Usually you do *not* want to do this.
8652 EOM
8653 case "$versiononly" in
8654 "$define"|[Yy]*|true) dflt='y' ;;
8655 *) dflt='n';
8656 esac
8657 rp="Do you want to install only the version-specific parts of perl?"
8658 . ./myread
8659 case "$ans" in
8660 [yY]*)  val="$define";;
8661 *)      val="$undef" ;;
8662 esac
8663 set versiononly
8664 eval $setvar
8665
8666 case "$versiononly" in
8667 "$define") inc_version_list=''
8668            inc_version_list_init=0
8669            ;;
8670 esac
8671
8672 : figure out how to guarantee perl startup
8673 : XXX Note that this currently takes advantage of the bug that binexp ignores
8674 :     the Configure -Dinstallprefix setting, which in turn means that under
8675 :     relocatable @INC, initialinstalllocation is what binexp started as.
8676 case "$startperl" in
8677 '')
8678         case "$sharpbang" in
8679         *!)
8680                 $cat <<EOH
8681
8682 I can use the #! construct to start perl on your system. This will
8683 make startup of perl scripts faster, but may cause problems if you
8684 want to share those scripts and perl is not in a standard place
8685 ($initialinstalllocation/perl) on all your platforms. The alternative
8686 is to force a shell by starting the script with a single ':' character.
8687
8688 EOH
8689                 case "$versiononly" in
8690                 "$define")      dflt="$initialinstalllocation/perl$version";;
8691                 *)              dflt="$initialinstalllocation/perl";;
8692                 esac
8693                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8694                 . ./myread
8695                 case "$ans" in
8696                 none)   startperl=": # use perl";;
8697                 *)      startperl="#!$ans"
8698                         if $test 30 -lt `echo "$ans" | wc -c`; then
8699                                 $cat >&4 <<EOM
8700
8701 WARNING:  Some systems limit the #! command to 32 characters.
8702 If you experience difficulty running Perl scripts with #!, try
8703 installing Perl in a directory with a shorter pathname.
8704
8705 EOM
8706                         fi ;;
8707                 esac
8708                 ;;
8709         *) startperl=": # use perl"
8710                 ;;
8711         esac
8712         ;;
8713 esac
8714 echo "I'll use $startperl to start perl scripts."
8715
8716 : figure best path for perl in scripts
8717 case "$perlpath" in
8718 '')
8719         case "$versiononly" in
8720         "$define")      perlpath="$initialinstalllocation/perl$version";;
8721         *)              perlpath="$initialinstalllocation/perl";;
8722         esac
8723         case "$startperl" in
8724         *!*) ;;
8725         *)
8726                 $cat <<EOH
8727
8728 I will use the "eval 'exec'" idiom to start Perl on your system.
8729 I can use the full path of your Perl binary for this purpose, but
8730 doing so may cause problems if you want to share those scripts and
8731 Perl is not always in a standard place ($initialinstalllocation/perl).
8732
8733 EOH
8734                 dflt="$initialinstalllocation/perl"
8735                 rp="What path shall I use in \"eval 'exec'\"?"
8736                 . ./myread
8737                 perlpath="$ans"
8738                 ;;
8739         esac
8740         ;;
8741 esac
8742 case "$startperl" in
8743 *!*)    ;;
8744 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8745 esac
8746
8747 : determine where public executable scripts go
8748 set scriptdir scriptdir
8749 eval $prefixit
8750 case "$scriptdir" in
8751 '')
8752         dflt="$bin"
8753         : guess some guesses
8754         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8755         $test -d /usr/share/bin     && dflt=/usr/share/bin
8756         $test -d /usr/local/script  && dflt=/usr/local/script
8757         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8758         $test -d $prefixexp/script  && dflt=$prefixexp/script
8759         set dflt
8760         eval $prefixup
8761         ;;
8762 *)  dflt="$scriptdir"
8763         ;;
8764 esac
8765 $cat <<EOM
8766
8767 Some installations have a separate directory just for executable scripts so
8768 that they can mount it across multiple architectures but keep the scripts in
8769 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8770 Or you might just lump your scripts in with all your other executables.
8771
8772 EOM
8773 fn=d~
8774 rp='Where do you keep publicly executable scripts?'
8775 . ./getfile
8776 if $test "X$ansexp" != "X$scriptdirexp"; then
8777         installscript=''
8778 fi
8779 installscriptdir=''
8780 prefixvar=scriptdir
8781 . ./setprefixvar
8782 : A little fix up for an irregularly named variable.
8783 installscript="$installscriptdir"
8784
8785 : determine where add-on public executables go
8786 case "$sitebin" in
8787 '')     dflt=$siteprefix/bin ;;
8788 *)      dflt=$sitebin ;;
8789 esac
8790 fn=d~
8791 rp='Pathname where the add-on public executables should be installed?'
8792 . ./getfile
8793 prefixvar=sitebin
8794 . ./setprefixvar
8795
8796 : determine where add-on html pages go
8797 : There is no standard location, so try to copy the previously-selected
8798 : directory structure for the core html pages.
8799 case "$sitehtml1dir" in
8800 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8801 *)     dflt=$sitehtml1dir ;;
8802 esac
8803 case "$dflt" in
8804 ''|' ') dflt=none ;;
8805 esac
8806 fn=dn+~
8807 rp='Pathname where the site-specific html pages should be installed?'
8808 . ./getfile
8809 prefixvar=sitehtml1dir
8810 . ./setprefixvar
8811
8812 : determine where add-on library html pages go
8813 : There is no standard location, so try to copy the previously-selected
8814 : directory structure for the core html pages.
8815 case "$sitehtml3dir" in
8816 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8817 *)     dflt=$sitehtml3dir ;;
8818 esac
8819 case "$dflt" in
8820 ''|' ') dflt=none ;;
8821 esac
8822 fn=dn+~
8823 rp='Pathname where the site-specific library html pages should be installed?'
8824 . ./getfile
8825 prefixvar=sitehtml3dir
8826 . ./setprefixvar
8827
8828 : determine where add-on manual pages go
8829 case "$siteman1dir" in
8830 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8831 *)      dflt=$siteman1dir ;;
8832 esac
8833 case "$dflt" in
8834 ''|' ') dflt=none ;;
8835 esac
8836 fn=dn+~
8837 rp='Pathname where the site-specific manual pages should be installed?'
8838 . ./getfile
8839 prefixvar=siteman1dir
8840 . ./setprefixvar
8841
8842 : determine where add-on library man pages go
8843 case "$siteman3dir" in
8844 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8845 *)      dflt=$siteman3dir ;;
8846 esac
8847 case "$dflt" in
8848 ''|' ') dflt=none ;;
8849 esac
8850 fn=dn+~
8851 rp='Pathname where the site-specific library manual pages should be installed?'
8852 . ./getfile
8853 prefixvar=siteman3dir
8854 . ./setprefixvar
8855
8856 : determine where add-on public executable scripts go
8857 case "$sitescript" in
8858 '')     dflt=$siteprefix/script
8859         $test -d $dflt || dflt=$sitebin ;;
8860 *)  dflt="$sitescript" ;;
8861 esac
8862 fn=d~+
8863 rp='Pathname where add-on public executable scripts should be installed?'
8864 . ./getfile
8865 prefixvar=sitescript
8866 . ./setprefixvar
8867
8868 case "$usefaststdio" in
8869 $define|true|[yY]*|'')
8870         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8871         case "$xversion" in
8872         [68])   dflt='y' ;;
8873         *)      dflt='n' ;;
8874         esac
8875         ;;
8876 *) dflt='n';;
8877 esac
8878 cat <<EOM
8879
8880 Perl can be built to use 'fast stdio', which means using the stdio
8881 library but also directly manipulating the stdio buffers to enable
8882 faster I/O.  Using stdio is better for backward compatibility (especially
8883 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8884 interface has been preferred instead of stdio.
8885
8886 If this doesn't make any sense to you, just accept the default '$dflt'.
8887 EOM
8888 rp='Use the "fast stdio" if available?'
8889 . ./myread
8890 case "$ans" in
8891 y|Y)    val="$define" ;;     
8892 *)      val="$undef" ;;
8893 esac
8894 set usefaststdio
8895 eval $setvar
8896
8897
8898 : define an is-a-typedef? function
8899 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8900 case "$inclist" in
8901 "") inclist="sys/types.h";;
8902 esac;
8903 eval "varval=\$$var";
8904 case "$varval" in
8905 "")
8906         $rm -f temp.c;
8907         for inc in $inclist; do
8908                 echo "#include <$inc>" >>temp.c;
8909         done;
8910         echo "#ifdef $type" >> temp.c;
8911         echo "printf(\"We have $type\");" >> temp.c;
8912         echo "#endif" >> temp.c;
8913         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8914         if $contains $type temp.E >/dev/null 2>&1; then
8915                 eval "$var=\$type";
8916         else
8917                 eval "$var=\$def";
8918         fi;
8919         $rm -f temp.?;;
8920 *) eval "$var=\$varval";;
8921 esac'
8922
8923 : define an is-a-typedef? function that prompts if the type is not available.
8924 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8925 case "$inclist" in
8926 "") inclist="sys/types.h";;
8927 esac;
8928 eval "varval=\$$var";
8929 case "$varval" in
8930 "")
8931         $rm -f temp.c;
8932         for inc in $inclist; do
8933                 echo "#include <$inc>" >>temp.c;
8934         done;
8935         echo "#ifdef $type" >> temp.c;
8936         echo "printf(\"We have $type\");" >> temp.c;
8937         echo "#endif" >> temp.c;
8938         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8939         echo " " ;
8940         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8941         if $contains $type temp.E >/dev/null 2>&1; then
8942                 echo "$type found." >&4;
8943                 eval "$var=\$type";
8944         else
8945                 echo "$type NOT found." >&4;
8946                 dflt="$def";
8947                 . ./myread ;
8948                 eval "$var=\$ans";
8949         fi;
8950         $rm -f temp.?;;
8951 *) eval "$var=\$varval";;
8952 esac'
8953
8954 : see what type lseek is declared as in the kernel
8955 rp="What is the type used for lseek's offset on this system?"
8956 set off_t lseektype long stdio.h sys/types.h
8957 eval $typedef_ask
8958
8959 echo " "
8960 echo "Checking to see how big your file offsets are..." >&4
8961 $cat >try.c <<EOCP
8962 #include <sys/types.h>
8963 #include <stdio.h>
8964 int main()
8965 {
8966     printf("%d\n", (int)sizeof($lseektype));
8967     return(0); 
8968 }
8969 EOCP
8970 set try
8971 if eval $compile_ok; then
8972         lseeksize=`$run ./try`
8973         echo "Your file offsets are $lseeksize bytes long."
8974 else
8975         dflt=$longsize
8976         echo " "
8977         echo "(I can't seem to compile the test program.  Guessing...)"
8978         rp="What is the size of your file offsets (in bytes)?"
8979         . ./myread
8980         lseeksize="$ans"
8981 fi
8982 $rm -f try.c try
8983
8984 : see what type file positions are declared as in the library
8985 rp="What is the type for file position used by fsetpos()?"
8986 set fpos_t fpostype long stdio.h sys/types.h
8987 eval $typedef_ask
8988
8989 echo " "
8990 case "$fpostype" in
8991 *_t) zzz="$fpostype"    ;;
8992 *)   zzz="fpos_t"       ;;
8993 esac
8994 echo "Checking the size of $zzz..." >&4 
8995 cat > try.c <<EOCP
8996 #include <sys/types.h>
8997 #include <stdio.h>
8998 #$i_stdlib I_STDLIB
8999 #ifdef I_STDLIB
9000 #include <stdlib.h>
9001 #endif
9002 int main() {
9003     printf("%d\n", (int)sizeof($fpostype));
9004     exit(0);
9005 }
9006 EOCP
9007 set try
9008 if eval $compile_ok; then
9009         yyy=`$run ./try`
9010         case "$yyy" in
9011         '')     fpossize=4
9012                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9013                 ;;
9014         *)      fpossize=$yyy
9015                 echo "Your $zzz is $fpossize bytes long."
9016                 ;;
9017         esac
9018 else
9019         dflt="$longsize"
9020         echo " " >&4
9021         echo "(I can't compile the test program.  Guessing...)" >&4
9022         rp="What is the size of your file positions (in bytes)?"
9023         . ./myread
9024         fpossize="$ans"
9025 fi
9026
9027 # Backward compatibility (uselfs is deprecated).
9028 case "$uselfs" in
9029 "$define"|true|[yY]*)
9030         cat <<EOM >&4
9031
9032 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9033 EOM
9034         uselargefiles="$define"
9035         ;;
9036 esac                          
9037
9038 case "$lseeksize:$fpossize" in
9039 8:8) cat <<EOM
9040
9041 You can have files larger than 2 gigabytes.
9042 EOM
9043    val="$define" ;;
9044 *)    case "$uselargefiles" in
9045    "$undef"|false|[nN]*) dflt='n' ;;
9046    *)   dflt='y' ;;
9047    esac
9048    cat <<EOM
9049
9050 Perl can be built to understand large files (files larger than 2 gigabytes)
9051 on some systems.  To do so, Configure can be run with -Duselargefiles.
9052
9053 If this doesn't make any sense to you, just accept the default '$dflt'.
9054 EOM
9055    rp='Try to understand large files, if available?'
9056    . ./myread
9057    case "$ans" in
9058    y|Y)         val="$define" ;;
9059    *)           val="$undef"  ;;
9060    esac
9061    ;;
9062 esac
9063 set uselargefiles
9064 eval $setvar
9065 : Look for a hint-file generated 'call-back-unit'.  If the
9066 : user has specified that a large files perl is to be built,
9067 : we may need to set or change some other defaults.
9068 if $test -f uselargefiles.cbu; then
9069         echo "Your platform has some specific hints regarding large file builds, using them..."
9070         . ./uselargefiles.cbu
9071 fi
9072 case "$uselargefiles" in
9073 "$define")
9074         if $test -f uselargefiles.cbu; then
9075                 echo " "
9076                 echo "Rechecking to see how big your file offsets are..." >&4
9077                 $cat >try.c <<EOCP
9078 #include <sys/types.h>
9079 #include <stdio.h>
9080 int main()
9081 {
9082     printf("%d\n", (int)sizeof($lseektype));
9083     return(0); 
9084 }
9085 EOCP
9086                 set try
9087                 if eval $compile_ok; then
9088                         lseeksize=`$run ./try`
9089                         $echo "Your file offsets are now $lseeksize bytes long."
9090                 else
9091                         dflt="$lseeksize"
9092                         echo " "
9093                         echo "(I can't seem to compile the test program.  Guessing...)"
9094                         rp="What is the size of your file offsets (in bytes)?"
9095                         . ./myread
9096                         lseeksize="$ans"
9097                 fi
9098                 case "$fpostype" in
9099                 *_t) zzz="$fpostype"    ;;
9100                 *)   zzz="fpos_t"       ;;
9101                 esac
9102                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9103                 $cat > try.c <<EOCP
9104 #include <sys/types.h>
9105 #include <stdio.h>
9106 #$i_stdlib I_STDLIB
9107 #ifdef I_STDLIB
9108 #include <stdlib.h>
9109 #endif
9110 int main() {
9111     printf("%d\n", (int)sizeof($fpostype));
9112     return(0);
9113 }
9114 EOCP
9115                 set try
9116                 if eval $compile_ok; then
9117                         yyy=`$run ./try`
9118                         dflt="$lseeksize"
9119                         case "$yyy" in
9120                         '')     echo " "
9121                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9122                                 ;;
9123                         *)      fpossize=$yyy
9124                                 echo " $fpossize bytes." >&4
9125                                 ;;
9126                         esac
9127                 else
9128                         dflt="$fpossize"
9129                         echo " "
9130                         echo "(I can't compile the test program.  Guessing...)" >&4
9131                         rp="What is the size of your file positions (in bytes)?"
9132                         . ./myread
9133                         fpossize="$ans"
9134                 fi
9135                 $rm -f try.c try
9136         fi
9137         ;;
9138 esac
9139
9140 case "$vendorprefix" in
9141 '')     d_vendorbin="$undef"
9142         vendorbin=''
9143         vendorbinexp=''
9144         ;;
9145 *)      d_vendorbin="$define"
9146         : determine where vendor-supplied executables go.
9147         case "$vendorbin" in
9148         '') dflt=$vendorprefix/bin ;;
9149         *)      dflt="$vendorbin" ;;
9150         esac
9151         fn=d~+
9152         rp='Pathname for the vendor-supplied executables directory?'
9153         . ./getfile
9154         vendorbin="$ans"
9155         vendorbinexp="$ansexp"
9156         ;;
9157 esac
9158 prefixvar=vendorbin
9159 . ./installprefix
9160
9161 case "$vendorprefix" in
9162 '')     vendorhtml1dir=''
9163         vendorhtml1direxp=''
9164         ;;
9165 *)      : determine where vendor-supplied html pages go.
9166         : There is no standard location, so try to copy the previously-selected
9167         : directory structure for the core html pages.
9168         : XXX Better default suggestions would be welcome.
9169         case "$vendorhtml1dir" in
9170         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9171         *)      dflt=$vendorhtml1dir ;;
9172         esac
9173         case "$dflt" in
9174         ''|' ') dflt=none ;;
9175         esac
9176         fn=dn+~
9177         rp='Pathname for the vendor-supplied html pages?'
9178         . ./getfile
9179         vendorhtml1dir="$ans"
9180         vendorhtml1direxp="$ansexp"
9181         ;;
9182 esac
9183 : Use ' ' for none so value is preserved next time through Configure
9184 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9185 prefixvar=vendorhtml1dir
9186 . ./installprefix
9187
9188 case "$vendorprefix" in
9189 '')     vendorhtml3dir=''
9190         vendorhtml3direxp=''
9191         ;;
9192 *)      : determine where vendor-supplied module html pages go.
9193         : There is no standard location, so try to copy the previously-selected
9194         : directory structure for the core html pages.
9195         : XXX Better default suggestions would be welcome.
9196         case "$vendorhtml3dir" in
9197         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9198         *)      dflt=$vendorhtml3dir ;;
9199         esac
9200         case "$dflt" in
9201         ''|' ') dflt=none ;;
9202         esac
9203         fn=dn+~
9204         rp='Pathname for the vendor-supplied html pages?'
9205         . ./getfile
9206         vendorhtml3dir="$ans"
9207         vendorhtml3direxp="$ansexp"
9208         ;;
9209 esac
9210 : Use ' ' for none so value is preserved next time through Configure
9211 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9212 prefixvar=vendorhtml3dir
9213 . ./installprefix
9214
9215 case "$vendorprefix" in
9216 '')     vendorman1dir=''
9217         vendorman1direxp=''
9218         ;;
9219 *)      : determine where vendor-supplied manual pages go.
9220         case "$vendorman1dir" in
9221         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9222         *)      dflt=$vendorman1dir ;;
9223         esac
9224         case "$dflt" in
9225         ''|' ') dflt=none ;;
9226         esac
9227         fn=nd~+
9228         rp='Pathname for the vendor-supplied manual section 1 pages?'
9229         . ./getfile
9230         vendorman1dir="$ans"
9231         vendorman1direxp="$ansexp"
9232         ;;
9233 esac
9234 : Use ' ' for none so value is preserved next time through Configure
9235 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9236 prefixvar=vendorman1dir
9237 . ./installprefix
9238
9239 case "$vendorprefix" in
9240 '')     vendorman3dir=''
9241         vendorman3direxp=''
9242         ;;
9243 *)      : determine where vendor-supplied module manual pages go.
9244         case "$vendorman3dir" in
9245         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9246         *)      dflt=$vendorman3dir ;;
9247         esac
9248         case "$dflt" in
9249         ''|' ') dflt=none ;;
9250         esac
9251         fn=nd~+
9252         rp='Pathname for the vendor-supplied manual section 3 pages?'
9253         . ./getfile
9254         vendorman3dir="$ans"
9255         vendorman3direxp="$ansexp"
9256         ;;
9257 esac
9258 : Use ' ' for none so value is preserved next time through Configure
9259 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9260 prefixvar=vendorman3dir
9261 . ./installprefix
9262
9263 case "$vendorprefix" in
9264 '')     d_vendorscript="$undef"
9265         vendorscript=''
9266         vendorscriptexp=''
9267         ;;
9268 *)      d_vendorscript="$define"
9269         : determine where vendor-supplied scripts go.
9270         case "$vendorscript" in
9271         '')     dflt=$vendorprefix/script
9272                 $test -d $dflt || dflt=$vendorbin ;;
9273         *)  dflt="$vendorscript" ;;
9274         esac
9275         $cat <<EOM
9276
9277 The installation process will create a directory for
9278 vendor-supplied scripts.
9279
9280 EOM
9281         fn=d~+
9282         rp='Pathname for the vendor-supplied scripts directory?'
9283         . ./getfile
9284         vendorscript="$ans"
9285         vendorscriptexp="$ansexp"
9286         ;;
9287 esac
9288 prefixvar=vendorscript
9289 . ./installprefix
9290
9291 : see if qgcvt exists
9292 set qgcvt d_qgcvt
9293 eval $inlibc
9294
9295 echo " "
9296
9297 if $test X"$d_longdbl" = X"$define"; then
9298
9299 echo "Checking how to print long doubles..." >&4
9300
9301 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9302         $cat >try.c <<'EOCP'
9303 #include <sys/types.h>
9304 #include <stdio.h>
9305 int main() {
9306   double d = 123.456;
9307   printf("%.3f\n", d);
9308 }
9309 EOCP
9310         set try
9311         if eval $compile; then
9312                 yyy=`$run ./try`
9313                 case "$yyy" in
9314                 123.456)
9315                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9316                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9317                         echo "We will use %f."
9318                         ;;
9319                 esac
9320         fi
9321 fi
9322
9323 if $test X"$sPRIfldbl" = X; then
9324         $cat >try.c <<'EOCP'
9325 #include <sys/types.h>
9326 #include <stdio.h>
9327 int main() {
9328   long double d = 123.456;
9329   printf("%.3Lf\n", d);
9330 }
9331 EOCP
9332         set try
9333         if eval $compile; then
9334                 yyy=`$run ./try`
9335                 case "$yyy" in
9336                 123.456)
9337                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9338                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9339                         echo "We will use %Lf."
9340                         ;;
9341                 esac
9342         fi
9343 fi
9344
9345 if $test X"$sPRIfldbl" = X; then
9346         $cat >try.c <<'EOCP'
9347 #include <sys/types.h>
9348 #include <stdio.h>
9349 int main() {
9350   long double d = 123.456;
9351   printf("%.3llf\n", d);
9352 }
9353 EOCP
9354         set try
9355         if eval $compile; then
9356                 yyy=`$run ./try`
9357                 case "$yyy" in
9358                 123.456)
9359                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9360                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9361                         echo "We will use %llf."
9362                         ;;
9363                 esac
9364         fi
9365 fi
9366
9367 if $test X"$sPRIfldbl" = X; then
9368         $cat >try.c <<'EOCP'
9369 #include <sys/types.h>
9370 #include <stdio.h>
9371 int main() {
9372   long double d = 123.456;
9373   printf("%.3lf\n", d);
9374 }
9375 EOCP
9376         set try
9377         if eval $compile; then
9378                 yyy=`$run ./try`
9379                 case "$yyy" in
9380                 123.456)
9381                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9382                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9383                         echo "We will use %lf."
9384                         ;;
9385                 esac
9386         fi
9387 fi
9388
9389 if $test X"$sPRIfldbl" = X; then
9390         echo "Cannot figure out how to print long doubles." >&4
9391 else
9392         sSCNfldbl=$sPRIfldbl    # expect consistency
9393 fi
9394
9395 $rm -f try try.*
9396
9397 fi # d_longdbl
9398
9399 case "$sPRIfldbl" in
9400 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9401         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9402         d_SCNfldbl="$undef";
9403         ;;
9404 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9405         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9406         d_SCNfldbl="$define";
9407         ;;
9408 esac
9409
9410 : Check how to convert floats to strings.
9411
9412 if test "X$d_Gconvert" = X; then
9413
9414 echo " "
9415 echo "Checking for an efficient way to convert floats to strings."
9416 echo " " > try.c
9417 case "$uselongdouble" in
9418 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9419 esac
9420 case "$d_longdbl" in
9421 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9422 esac
9423 case "$d_PRIgldbl" in
9424 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9425 esac
9426 $cat >>try.c <<EOP
9427 #ifdef TRY_gconvert
9428 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9429 char *myname = "gconvert";
9430 #endif
9431 #ifdef TRY_gcvt
9432 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9433 char *myname = "gcvt";
9434 #endif
9435 #ifdef TRY_qgcvt
9436 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9437 char *myname = "qgcvt";
9438 #define DOUBLETYPE long double
9439 #endif
9440 #ifdef TRY_sprintf
9441 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9442 #ifdef HAS_PRIgldbl
9443 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9444 #else
9445 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9446 #endif
9447 #else
9448 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9449 #endif
9450 char *myname = "sprintf";
9451 #endif
9452
9453 #ifndef DOUBLETYPE
9454 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9455 #define DOUBLETYPE long double
9456 #else
9457 #define DOUBLETYPE double
9458 #endif
9459 #endif
9460
9461 #include <stdio.h>
9462
9463 #define I_STDLIB $i_stdlib
9464 #ifdef I_STDLIB
9465 #include <stdlib.h>
9466 #endif
9467
9468 int
9469 checkit(expect, got)
9470 char *expect;
9471 char *got;
9472 {
9473     if (strcmp(expect, got)) {
9474                 printf("%s oddity:  Expected %s, got %s\n",
9475                         myname, expect, got);
9476                 exit(1);
9477         }
9478 }
9479
9480 int main()
9481
9482         char buf[64]; 
9483         buf[63] = '\0';
9484
9485         /* This must be 1st test on (which?) platform */
9486         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9487         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9488         checkit("0.1", buf);
9489
9490         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9491         checkit("0.01", buf);
9492
9493         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9494         checkit("0.001", buf);
9495
9496         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9497         checkit("0.0001", buf);
9498
9499         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9500         if (strlen(buf) > 5)
9501             checkit("9e-005", buf); /* for Microsoft ?? */
9502         else
9503             checkit("9e-05", buf);
9504
9505         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9506         checkit("1", buf);
9507
9508         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9509         checkit("1.1", buf);
9510
9511         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9512         checkit("1.01", buf);
9513
9514         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9515         checkit("1.001", buf);
9516
9517         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9518         checkit("1.0001", buf);
9519
9520         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9521         checkit("1.00001", buf);
9522
9523         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9524         checkit("1.000001", buf);
9525
9526         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9527         checkit("0", buf);
9528
9529         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9530         checkit("-1", buf);
9531
9532         /* Some Linux gcvt's give 1.e+5 here. */
9533         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9534         checkit("100000", buf);
9535         
9536         /* Some Linux gcvt's give -1.e+5 here. */
9537         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9538         checkit("-100000", buf);
9539
9540         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9541         checkit("123.456", buf);
9542
9543         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9544         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9545         /* 34 should be enough to scare even long double
9546          * places into using the e notation. */
9547         if (strlen(buf) > 5)
9548             checkit("1e+034", buf); /* for Microsoft */
9549         else
9550             checkit("1e+34", buf);
9551
9552         /* For Perl, if you add additional tests here, also add them to
9553          * t/base/num.t for benefit of platforms not using Configure or
9554          * overriding d_Gconvert */
9555
9556         exit(0);
9557 }
9558 EOP
9559 : first add preferred functions to our list
9560 xxx_list=""
9561 for xxx_convert in $gconvert_preference; do
9562     case $xxx_convert in
9563     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9564     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9565     esac 
9566 done
9567 : then add any others
9568 for xxx_convert in gconvert gcvt sprintf; do
9569     case "$xxx_list" in
9570     *$xxx_convert*) ;;
9571     *) xxx_list="$xxx_list $xxx_convert" ;;
9572     esac 
9573 done
9574
9575 case "$d_longdbl$uselongdouble" in
9576 "$define$define")
9577     : again, add prefered functions to our list first
9578     xxx_ld_list=""
9579     for xxx_convert in $gconvert_ld_preference; do
9580         case $xxx_convert in
9581         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9582         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9583         esac
9584     done
9585     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9586     for xxx_convert in qgcvt sprintf $xxx_list; do
9587         case "$xxx_ld_list" in
9588         $xxx_convert*|*" $xxx_convert"*) ;;
9589         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9590         esac
9591     done
9592     : if sprintf cannot do long doubles, move it to the end
9593     if test "$d_PRIgldbl" != "$define"; then
9594         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9595     fi
9596     : if no qgcvt, remove it
9597     if test "$d_qgcvt" != "$define"; then
9598         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9599     fi
9600     : use the ld_list
9601     xxx_list="$xxx_ld_list"
9602     ;;
9603 esac
9604
9605 for xxx_convert in $xxx_list; do
9606         echo "Trying $xxx_convert..."
9607         $rm -f try try$_o
9608         set try -DTRY_$xxx_convert
9609         if eval $compile; then
9610                 echo "$xxx_convert() found." >&4
9611                 if $run ./try; then
9612                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9613                         break;
9614                 else
9615                         echo "...But $xxx_convert didn't work as I expected."
9616                         xxx_convert=''
9617                 fi
9618         else
9619                 echo "$xxx_convert NOT found." >&4
9620         fi
9621 done
9622
9623 if test X$xxx_convert = X; then
9624     echo "*** WHOA THERE!!! ***" >&4
9625     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9626     xxx_convert=sprintf
9627 fi
9628
9629 case "$xxx_convert" in
9630 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9631 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9632 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9633 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9634    "$define$define$define")
9635       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9636    "$define$define$undef")
9637       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9638    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9639    esac
9640    ;;  
9641 esac
9642
9643 fi
9644
9645 : see if _fwalk exists
9646 set fwalk d__fwalk
9647 eval $inlibc
9648
9649 : Initialize h_fcntl
9650 h_fcntl=false
9651
9652 : Initialize h_sysfile
9653 h_sysfile=false
9654
9655 : access call always available on UNIX
9656 set access d_access
9657 eval $inlibc
9658
9659 : locate the flags for 'access()'
9660 case "$d_access" in
9661 "$define")
9662         echo " "
9663         $cat >access.c <<EOCP
9664 #include <sys/types.h>
9665 #ifdef I_FCNTL
9666 #include <fcntl.h>
9667 #endif
9668 #ifdef I_SYS_FILE
9669 #include <sys/file.h>
9670 #endif
9671 #ifdef I_UNISTD
9672 #include <unistd.h>
9673 #endif
9674 #$i_stdlib I_STDLIB
9675 #ifdef I_STDLIB
9676 #include <stdlib.h>
9677 #endif
9678 int main() {
9679         exit(R_OK);
9680 }
9681 EOCP
9682         : check sys/file.h first, no particular reason here
9683         if $test `./findhdr sys/file.h` && \
9684                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9685                 h_sysfile=true;
9686                 echo "<sys/file.h> defines the *_OK access constants." >&4
9687         elif $test `./findhdr fcntl.h` && \
9688                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9689                 h_fcntl=true;
9690                 echo "<fcntl.h> defines the *_OK access constants." >&4
9691         elif $test `./findhdr unistd.h` && \
9692                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9693                 echo "<unistd.h> defines the *_OK access constants." >&4
9694         else
9695                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9696         fi
9697         ;;
9698 esac
9699 $rm -f access*
9700
9701 : see if accessx exists
9702 set accessx d_accessx
9703 eval $inlibc
9704
9705 : see if aintl exists
9706 set aintl d_aintl
9707 eval $inlibc
9708
9709 : see if alarm exists
9710 set alarm d_alarm
9711 eval $inlibc
9712
9713 : see if POSIX threads are available
9714 set pthread.h i_pthread
9715 eval $inhdr
9716
9717 : define a fucntion to check prototypes
9718 $cat > protochk <<EOSH
9719 $startsh
9720 cc="$cc"
9721 optimize="$optimize"
9722 ccflags="$ccflags"
9723 prototype="$prototype"
9724 define="$define"
9725 rm=$rm
9726 usethreads=$usethreads
9727 i_pthread=$i_pthread
9728 pthread_h_first=$pthread_h_first
9729 EOSH
9730
9731 $cat >> protochk <<'EOSH'
9732
9733 $rm -f try.c
9734 foo="$1"
9735 shift
9736 while test $# -ge 2; do
9737         case "$1" in
9738                 $define) echo "#include <$2>" >> try.c ;;
9739                 literal) echo "$2" >> try.c ;;
9740         esac
9741     # Extra magic for the benefit of systems that need pthread.h
9742     # to be included early to correctly detect threadsafe functions.
9743     # Such functions must guarantee themselves, though, that the usethreads
9744     # and i_pthread have been defined, before calling protochk.
9745     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9746         echo "#include <pthread.h>" >> try.c
9747         pthread_h_done=yes
9748     fi
9749     shift 2
9750 done
9751 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9752 cat >> try.c <<'EOCP'
9753 #ifdef CAN_PROTOTYPE
9754 #define _(args) args
9755 #else
9756 #define _(args) ()
9757 #endif
9758 EOCP
9759 echo "$foo" >> try.c
9760 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9761 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9762 status=$?
9763 $rm -f try.[co]
9764 exit $status
9765 EOSH
9766 chmod +x protochk
9767 $eunicefix protochk
9768
9769 hasproto='varname=$1; func=$2; shift; shift;
9770 while $test $# -ge 2; do
9771         case "$1" in
9772         $define) echo "#include <$2>";;
9773         esac ;
9774     shift 2;
9775 done > try.c;
9776 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9777 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9778         echo "$func() prototype found.";
9779         val="$define";
9780 else
9781         echo "$func() prototype NOT found.";
9782         val="$undef";
9783 fi;
9784 set $varname;
9785 eval $setvar;
9786 $rm -f try.c tryout.c'
9787
9788 : see if sys/types.h has to be included
9789 set sys/types.h i_systypes
9790 eval $inhdr
9791
9792 : see if sys/select.h has to be included
9793 set sys/select.h i_sysselct
9794 eval $inhdr
9795
9796 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9797 while $test $# -ge 2; do
9798         case "$1" in
9799         $define) echo "#include <$2>";;
9800         esac ;
9801     shift 2;
9802 done > try.c;
9803 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9804 set try;
9805 if eval $compile; then
9806         val="$define";
9807 else
9808         val="$undef";
9809 fi;
9810 set $varname;
9811 eval $setvar;
9812 $rm -f try.c try.o'
9813
9814 : see if we should include time.h, sys/time.h, or both
9815 echo " "
9816 if test "X$timeincl" = X; then
9817         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9818         $echo $n "I'm now running the test program...$c"
9819         $cat >try.c <<EOCP
9820 #include <sys/types.h>
9821 #ifdef I_TIME
9822 #include <time.h>
9823 #endif
9824 #ifdef I_SYSTIME
9825 #ifdef SYSTIMEKERNEL
9826 #define KERNEL
9827 #endif
9828 #include <sys/time.h>
9829 #endif
9830 #ifdef I_SYSSELECT
9831 #include <sys/select.h>
9832 #endif
9833 #$i_stdlib I_STDLIB
9834 #ifdef I_STDLIB
9835 #include <stdlib.h>
9836 #endif
9837 int main()
9838 {
9839         struct tm foo;
9840 #ifdef S_TIMEVAL
9841         struct timeval bar;
9842 #endif
9843 #ifdef S_TIMEZONE
9844         struct timezone tzp;
9845 #endif
9846         if (foo.tm_sec == foo.tm_sec)
9847                 exit(0);
9848 #ifdef S_TIMEVAL
9849         if (bar.tv_sec == bar.tv_sec)
9850                 exit(0);
9851 #endif
9852         exit(1);
9853 }
9854 EOCP
9855         flags=''
9856         for s_timezone in '-DS_TIMEZONE' ''; do
9857         sysselect=''
9858         for s_timeval in '-DS_TIMEVAL' ''; do
9859         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9860         for i_time in '' '-DI_TIME'; do
9861         for i_systime in '-DI_SYSTIME' ''; do
9862                 case "$flags" in
9863                 '') $echo $n ".$c"
9864                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9865                         if eval $compile; then
9866                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9867                                 shift
9868                                 flags="$*"
9869                                 echo " "
9870                                 $echo $n "Succeeded with $flags$c"
9871                         fi
9872                         ;;
9873                 esac
9874         done
9875         done
9876         done
9877         done
9878         done
9879         timeincl=''
9880         echo " "
9881         case "$flags" in
9882         *SYSTIMEKERNEL*) i_systimek="$define"
9883                 timeincl=`./findhdr sys/time.h`
9884                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9885         *) i_systimek="$undef";;
9886         esac
9887         case "$flags" in
9888         *I_TIME*) i_time="$define"
9889                 timeincl=`./findhdr time.h`" $timeincl"
9890                 echo "We'll include <time.h>." >&4;;
9891         *) i_time="$undef";;
9892         esac
9893         case "$flags" in
9894         *I_SYSTIME*) i_systime="$define"
9895                 timeincl=`./findhdr sys/time.h`" $timeincl"
9896                 echo "We'll include <sys/time.h>." >&4;;
9897         *) i_systime="$undef";;
9898         esac
9899         $rm -f try.c try
9900 fi
9901 : see if struct tm knows about tm_zone
9902 case "$i_systime$i_time" in
9903 *$define*) 
9904         echo " "
9905         echo "Checking to see if your struct tm has tm_zone field..." >&4
9906         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9907         eval $hasfield
9908         ;;
9909 *)      val="$undef"
9910         set d_tm_tm_zone
9911         eval $setvar
9912         ;;
9913 esac
9914 case "$d_tm_tm_zone" in
9915 "$define")      echo "Yes, it does."   ;;
9916 *)              echo "No, it doesn't." ;;
9917 esac
9918 : see if struct tm knows about tm_gmtoff
9919 case "$i_systime$i_time" in
9920 *$define*) 
9921         echo " "
9922         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9923         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9924         eval $hasfield
9925         ;;
9926 *)      val="$undef"
9927         set d_tm_tm_gmtoff
9928         eval $setvar
9929         ;;
9930 esac
9931 case "$d_tm_tm_gmtoff" in
9932 "$define")      echo "Yes, it does."   ;;
9933 *)              echo "No, it doesn't." ;;
9934 esac
9935
9936 : see if asctime_r exists
9937 set asctime_r d_asctime_r
9938 eval $inlibc
9939 case "$d_asctime_r" in
9940 "$define")
9941         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9942         case "$d_asctime_r_proto:$usethreads" in
9943         ":define")      d_asctime_r_proto=define
9944                 set d_asctime_r_proto asctime_r $hdrs
9945                 eval $hasproto ;;
9946         *)      ;;
9947         esac
9948         case "$d_asctime_r_proto" in
9949         define)
9950         case "$asctime_r_proto" in
9951         ''|0) try='char* asctime_r(const struct tm*, char*);'
9952         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9953         esac
9954         case "$asctime_r_proto" in
9955         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9956         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9957         esac
9958         case "$asctime_r_proto" in
9959         ''|0) try='int asctime_r(const struct tm*, char*);'
9960         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9961         esac
9962         case "$asctime_r_proto" in
9963         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9964         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9965         esac
9966         case "$asctime_r_proto" in
9967         ''|0)   d_asctime_r=undef
9968                 asctime_r_proto=0
9969                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9970         * )     case "$asctime_r_proto" in
9971                 REENTRANT_PROTO*) ;;
9972                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9973                 esac
9974                 echo "Prototype: $try" ;;
9975         esac
9976         ;;
9977         *)      case "$usethreads" in
9978                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9979                 esac
9980                 d_asctime_r=undef
9981                 asctime_r_proto=0
9982                 ;;
9983         esac
9984         ;;
9985 *)      asctime_r_proto=0
9986         ;;
9987 esac
9988
9989 : see if atolf exists
9990 set atolf d_atolf
9991 eval $inlibc
9992
9993 : see if atoll exists
9994 set atoll d_atoll
9995 eval $inlibc
9996
9997 : Look for GCC-style attribute format
9998 case "$d_attribute_format" in
9999 '')
10000 echo " "
10001 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10002 $cat >attrib.c <<'EOCP'
10003 #include <stdio.h>
10004 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10005 EOCP
10006 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10007         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10008                 echo "Your C compiler doesn't support __attribute__((format))."
10009                 val="$undef"
10010         else
10011                 echo "Your C compiler supports __attribute__((format))."
10012                 val="$define"
10013         fi
10014 else
10015         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10016         val="$undef"
10017 fi
10018 ;;
10019 *) val="$d_attribute_format" ;;
10020 esac
10021 set d_attribute_format
10022 eval $setvar
10023 $rm -f attrib*
10024
10025 : Look for GCC-style attribute format with null format allowed
10026 case "$d_printf_format_null" in
10027 '') case "$d_attribute_format" in
10028     $define)
10029         echo " "
10030         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10031 $cat >attrib.c <<EOCP
10032 #include <stdio.h>
10033 #$i_stdlib I_STDLIB
10034 #ifdef I_STDLIB
10035 #include <stdlib.h>
10036 #endif
10037 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10038 int null_printf (char* pat,...) { return (int)pat; }
10039 int main () { exit(null_printf(NULL)); }
10040 EOCP
10041         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10042             : run the executable in case it produces a run-time warning
10043             if $run ./attrib >>attrib.out 2>&1; then
10044                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10045                     echo "Your C compiler doesn't allow __printf__ format to be null."
10046                     val="$undef"
10047                 else
10048                     echo "Your C compiler allows __printf__ format to be null."
10049                     val="$define"
10050                 fi
10051             else
10052             echo "Your C compiler executable failed with __printf__ format null."
10053             val="$undef"
10054         fi
10055     else
10056         echo "Your C compiler fails with __printf__ format null."
10057         val="$undef"
10058     fi
10059     ;;
10060     *)  val="$undef" ;;
10061     esac
10062 ;;
10063 *)  val="$d_printf_format_null" ;;
10064 esac
10065 set d_printf_format_null
10066 eval $setvar
10067 $rm -f attrib*
10068
10069 : Look for GCC-style attribute malloc
10070 case "$d_attribute_malloc" in
10071 '')
10072 echo " "
10073 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10074 $cat >attrib.c <<'EOCP'
10075 #include <stdio.h>
10076 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10077 EOCP
10078 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10079         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10080                 echo "Your C compiler doesn't support __attribute__((malloc))."
10081                 val="$undef"
10082         else
10083                 echo "Your C compiler supports __attribute__((malloc))."
10084                 val="$define"
10085         fi
10086 else
10087         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10088         val="$undef"
10089 fi
10090 ;;
10091 *) val="$d_attribute_malloc" ;;
10092 esac
10093 set d_attribute_malloc
10094 eval $setvar
10095 $rm -f attrib*
10096
10097 : Look for GCC-style attribute nonnull
10098 case "$d_attribute_nonnull" in
10099 '')
10100 echo " "
10101 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10102 $cat >attrib.c <<'EOCP'
10103 #include <stdio.h>
10104 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10105 EOCP
10106 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10107         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10108                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10109                 val="$undef"
10110         else
10111                 echo "Your C compiler supports __attribute__((nonnull))."
10112                 val="$define"
10113         fi
10114 else
10115         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10116         val="$undef"
10117 fi
10118 ;;
10119 *) val="$d_attribute_nonnull" ;;
10120 esac
10121 set d_attribute_nonnull
10122 eval $setvar
10123 $rm -f attrib*
10124
10125 : Look for GCC-style attribute noreturn
10126 case "$d_attribute_noreturn" in
10127 '')
10128 echo " "
10129 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10130 $cat >attrib.c <<'EOCP'
10131 #include <stdio.h>
10132 void fall_over_dead( void ) __attribute__((noreturn));
10133 EOCP
10134 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10135         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10136                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10137                 val="$undef"
10138         else
10139                 echo "Your C compiler supports __attribute__((noreturn))."
10140                 val="$define"
10141         fi
10142 else
10143         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10144         val="$undef"
10145 fi
10146 ;;
10147 *) val="$d_attribute_noreturn" ;;
10148 esac
10149 set d_attribute_noreturn
10150 eval $setvar
10151 $rm -f attrib*
10152
10153 : Look for GCC-style attribute pure
10154 case "$d_attribute_pure" in
10155 '')
10156 echo " "
10157 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10158 $cat >attrib.c <<'EOCP'
10159 #include <stdio.h>
10160 int square( int n ) __attribute__((pure));
10161 EOCP
10162 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10163         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10164                 echo "Your C compiler doesn't support __attribute__((pure))."
10165                 val="$undef"
10166         else
10167                 echo "Your C compiler supports __attribute__((pure))."
10168                 val="$define"
10169         fi
10170 else
10171         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10172         val="$undef"
10173 fi
10174 ;;
10175 *) val="$d_attribute_pure" ;;
10176 esac
10177 set d_attribute_pure
10178 eval $setvar
10179 $rm -f attrib*
10180
10181 : Look for GCC-style attribute unused
10182 case "$d_attribute_unused" in
10183 '')
10184 echo " "
10185 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10186 $cat >attrib.c <<'EOCP'
10187 #include <stdio.h>
10188 int do_something( int dummy __attribute__((unused)), int n );
10189 EOCP
10190 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10191         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10192                 echo "Your C compiler doesn't support __attribute__((unused))."
10193                 val="$undef"
10194         else
10195                 echo "Your C compiler supports __attribute__((unused))."
10196                 val="$define"
10197         fi
10198 else
10199         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10200         val="$undef"
10201 fi
10202 ;;
10203 *) val="$d_attribute_unused" ;;
10204 esac
10205 set d_attribute_unused
10206 eval $setvar
10207 $rm -f attrib*
10208
10209 : Look for GCC-style attribute warn_unused_result
10210 case "$d_attribute_warn_unused_result" in
10211 '')
10212 echo " "
10213 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10214 $cat >attrib.c <<'EOCP'
10215 #include <stdio.h>
10216 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10217 EOCP
10218 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10219         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10220                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10221                 val="$undef"
10222         else
10223                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10224                 val="$define"
10225         fi
10226 else
10227         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10228         val="$undef"
10229 fi
10230 ;;
10231 *) val="$d_attribute_warn_unused_result" ;;
10232 esac
10233 set d_attribute_warn_unused_result
10234 eval $setvar
10235 $rm -f attrib*
10236
10237 : see if bcmp exists
10238 set bcmp d_bcmp
10239 eval $inlibc
10240
10241 : see if bcopy exists
10242 set bcopy d_bcopy
10243 eval $inlibc
10244
10245 : see if getpgrp exists
10246 set getpgrp d_getpgrp
10247 eval $inlibc
10248
10249 case "$d_getpgrp" in
10250 "$define")
10251         echo " "
10252         echo "Checking to see which flavor of getpgrp is in use..."
10253         $cat >try.c <<EOP
10254 #$i_unistd I_UNISTD
10255 #include <sys/types.h>
10256 #ifdef I_UNISTD
10257 #  include <unistd.h>
10258 #endif
10259 #$i_stdlib I_STDLIB
10260 #ifdef I_STDLIB
10261 #include <stdlib.h>
10262 #endif
10263 int main()
10264 {
10265         if (getuid() == 0) {
10266                 printf("(I see you are running Configure as super-user...)\n");
10267                 setuid(1);
10268         }
10269 #ifdef TRY_BSD_PGRP
10270         if (getpgrp(1) == 0)
10271                 exit(0);
10272 #else
10273         if (getpgrp() > 0)
10274                 exit(0);
10275 #endif
10276         exit(1);
10277 }
10278 EOP
10279         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10280                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10281                 val="$define"
10282         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10283                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10284                 val="$undef"
10285         else
10286                 echo "I can't seem to compile and run the test program."
10287                 if ./usg; then
10288                         xxx="a USG one, i.e. you use getpgrp()."
10289                 else
10290                         # SVR4 systems can appear rather BSD-ish.
10291                         case "$i_unistd" in
10292                         $undef)
10293                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10294                                 val="$define"
10295                                 ;;
10296                         $define)
10297                                 xxx="probably a USG one, i.e. you use getpgrp()."
10298                                 val="$undef"
10299                                 ;;
10300                         esac
10301                 fi
10302                 echo "Assuming your getpgrp is $xxx" >&4
10303         fi
10304         ;;
10305 *) val="$undef";;
10306 esac
10307 set d_bsdgetpgrp
10308 eval $setvar
10309 $rm -f try try.*
10310
10311 : see if setpgrp exists
10312 set setpgrp d_setpgrp
10313 eval $inlibc
10314
10315 case "$d_setpgrp" in
10316 "$define")
10317         echo " "
10318         echo "Checking to see which flavor of setpgrp is in use..."
10319         $cat >try.c <<EOP
10320 #$i_unistd I_UNISTD
10321 #include <sys/types.h>
10322 #ifdef I_UNISTD
10323 #  include <unistd.h>
10324 #endif
10325 #$i_stdlib I_STDLIB
10326 #ifdef I_STDLIB
10327 #include <stdlib.h>
10328 #endif
10329 int main()
10330 {
10331         if (getuid() == 0) {
10332                 printf("(I see you are running Configure as super-user...)\n");
10333                 setuid(1);
10334         }
10335 #ifdef TRY_BSD_PGRP
10336         if (-1 == setpgrp(1, 1))
10337                 exit(0);
10338 #else
10339         if (setpgrp() != -1)
10340                 exit(0);
10341 #endif
10342         exit(1);
10343 }
10344 EOP
10345         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10346                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10347                 val="$define"
10348         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10349                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10350                 val="$undef"
10351         else
10352                 echo "(I can't seem to compile and run the test program.)"
10353                 if ./usg; then
10354                         xxx="a USG one, i.e. you use setpgrp()."
10355                 else
10356                         # SVR4 systems can appear rather BSD-ish.
10357                         case "$i_unistd" in
10358                         $undef)
10359                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10360                                 val="$define"
10361                                 ;;
10362                         $define)
10363                                 xxx="probably a USG one, i.e. you use setpgrp()."
10364                                 val="$undef"
10365                                 ;;
10366                         esac
10367                 fi
10368                 echo "Assuming your setpgrp is $xxx" >&4
10369         fi
10370         ;;
10371 *) val="$undef";;
10372 esac
10373 set d_bsdsetpgrp
10374 eval $setvar
10375 $rm -f try try.*
10376 : Look for GCC-style __builtin_choose_expr
10377 case "$d_builtin_choose_expr" in
10378 '')
10379     echo " "
10380     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10381     $cat >try.c <<'EOCP'
10382 #include <assert.h>
10383 #include <stdlib.h>
10384 #include <stdio.h>
10385
10386 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10387
10388 int main(void) {
10389     assert( SYRINX(1) == 2112 );
10390     assert( SYRINX(1) != 5150 );
10391     assert( SYRINX(0) == 5150 );
10392     assert( SYRINX(0) != 2112 );
10393     puts( "All good!" );
10394     exit(0);
10395 }
10396
10397 EOCP
10398     set try
10399     if eval $compile; then
10400         echo "Your C compiler supports __builtin_choose_expr."
10401         val="$define"
10402     else
10403         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10404         val="$undef"
10405     fi
10406 ;;
10407 *) val="$d_builtin_choose_expr" ;;
10408 esac
10409
10410 set d_builtin_choose_expr
10411 eval $setvar
10412 $rm -f try.* try core core.try.*
10413
10414 : Look for GCC-style __builtin_expect
10415 case "$d_builtin_expect" in
10416 '')
10417     echo " "
10418     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10419     $cat >builtin.c <<'EOCP'
10420 int main(void) {
10421     int n = 50;
10422     if ( __builtin_expect(n, 0) ) n = 1;
10423 }
10424 EOCP
10425     set try
10426     if eval $compile; then
10427         echo "Your C compiler supports __builtin_choose_expr."
10428         val="$define"
10429     else
10430         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10431         val="$undef"
10432     fi
10433     ;;
10434 *) val="$d_builtin_expect" ;;
10435 esac
10436
10437 set d_builtin_expect
10438 eval $setvar
10439 $rm -f try.* try core core.try.*
10440
10441 : see if bzero exists
10442 set bzero d_bzero
10443 eval $inlibc
10444
10445 : see if stdarg is available
10446 echo " "
10447 if $test `./findhdr stdarg.h`; then
10448         echo "<stdarg.h> found." >&4
10449         valstd="$define"
10450 else
10451         echo "<stdarg.h> NOT found." >&4
10452         valstd="$undef"
10453 fi
10454
10455 : see if varags is available
10456 echo " "
10457 if $test `./findhdr varargs.h`; then
10458         echo "<varargs.h> found." >&4
10459 else
10460         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10461 fi
10462
10463 : set up the varargs testing programs
10464 $cat > varargs.c <<EOP
10465 #ifdef I_STDARG
10466 #include <stdarg.h>
10467 #endif
10468 #ifdef I_VARARGS
10469 #include <varargs.h>
10470 #endif
10471
10472 #ifdef I_STDARG
10473 int f(char *p, ...)
10474 #else
10475 int f(va_alist)
10476 va_dcl
10477 #endif
10478 {
10479         va_list ap;
10480 #ifndef I_STDARG
10481         char *p;
10482 #endif
10483 #ifdef I_STDARG
10484         va_start(ap,p);
10485 #else
10486         va_start(ap);
10487         p = va_arg(ap, char *);
10488 #endif
10489         va_end(ap);
10490         return 0;
10491 }
10492 EOP
10493 $cat > varargs <<EOP
10494 $startsh
10495 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10496         echo "true"
10497 else
10498         echo "false"
10499 fi
10500 $rm -f varargs$_o
10501 EOP
10502 chmod +x varargs
10503
10504 : now check which varargs header should be included
10505 echo " "
10506 i_varhdr=''
10507 case "$valstd" in
10508 "$define")
10509         if `./varargs I_STDARG`; then
10510                 val='stdarg.h'
10511         elif `./varargs I_VARARGS`; then
10512                 val='varargs.h'
10513         fi
10514         ;;
10515 *)
10516         if `./varargs I_VARARGS`; then
10517                 val='varargs.h'
10518         fi
10519         ;;
10520 esac
10521 case "$val" in
10522 '')
10523 echo "I could not find the definition for va_dcl... You have problems..." >&4
10524         val="$undef"; set i_stdarg; eval $setvar
10525         val="$undef"; set i_varargs; eval $setvar
10526         ;;
10527 *) 
10528         set i_varhdr
10529         eval $setvar
10530         case "$i_varhdr" in
10531         stdarg.h)
10532                 val="$define"; set i_stdarg; eval $setvar
10533                 val="$undef"; set i_varargs; eval $setvar
10534                 ;;
10535         varargs.h)
10536                 val="$undef"; set i_stdarg; eval $setvar
10537                 val="$define"; set i_varargs; eval $setvar
10538                 ;;
10539         esac
10540         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10541 esac
10542 $rm -f varargs*
10543
10544 : see if the Compiler supports C99 variadic macros
10545 case "$i_stdarg$i_stdlib" in
10546     "$define$define")
10547     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10548     $cat >try.c <<EOCP
10549 #include <stdio.h>
10550 #include <stdarg.h>
10551
10552 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10553
10554 int main() {
10555   char buf[20];
10556   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10557   puts(buf);
10558   return 0;
10559 }
10560 EOCP
10561     set try
10562     if eval $compile && $run ./try 2>&1 >/dev/null; then
10563         case "`$run ./try`" in
10564             "123 456 789")
10565             echo "You have C99 variadic macros." >&4
10566             d_c99_variadic_macros="$define"
10567             ;;
10568             *)
10569             echo "You don't have functional C99 variadic macros." >&4
10570             d_c99_variadic_macros="$undef"
10571             ;;
10572         esac
10573     else
10574         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10575         d_c99_variadic_macros="$undef"
10576     fi
10577     $rm -f try.* try core core.try.*
10578     ;;
10579     *)
10580     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10581     d_c99_variadic_macros="$undef"
10582     ;;
10583 esac
10584
10585 : see if signal is declared as pointer to function returning int or void
10586 echo " "
10587 xxx=`./findhdr signal.h`
10588 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10589 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10590         echo "You have int (*signal())() instead of void." >&4
10591         val="$undef"
10592 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10593         echo "You have void (*signal())()." >&4
10594         val="$define"
10595 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10596         echo "You have int (*signal())() instead of void." >&4
10597         val="$undef"
10598 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10599         echo "You have void (*signal())()." >&4
10600         val="$define"
10601 else
10602         case "$d_voidsig" in
10603         '')
10604         echo "I can't determine whether signal handler returns void or int..." >&4
10605                 dflt=void
10606                 rp="What type does your signal handler return?"
10607                 . ./myread
10608                 case "$ans" in
10609                 v*) val="$define";;
10610                 *) val="$undef";;
10611                 esac;;
10612         "$define")
10613                 echo "As you already told me, signal handler returns void." >&4
10614                 val="$define"
10615                 ;;
10616         *)      echo "As you already told me, signal handler returns int." >&4
10617                 val="$undef"
10618                 ;;
10619         esac
10620 fi
10621 set d_voidsig
10622 eval $setvar
10623 case "$d_voidsig" in
10624 "$define") signal_t="void";;
10625 *) signal_t="int";;
10626 esac
10627 $rm -f $$.tmp
10628
10629 : check for ability to cast large floats to 32-bit ints.
10630 echo " "
10631 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10632 if $test "$intsize" -ge 4; then
10633         xxx=int
10634 else
10635         xxx=long
10636 fi
10637 $cat >try.c <<EOCP
10638 #include <stdio.h>
10639 #$i_stdlib I_STDLIB
10640 #ifdef I_STDLIB
10641 #include <stdlib.h>
10642 #endif
10643 #include <sys/types.h>
10644 #include <signal.h>
10645 $signal_t blech(int s) { exit(3); }
10646 int main()
10647 {
10648         $xxx i32;
10649         double f, g;
10650         int result = 0;
10651         char str[16];
10652         signal(SIGFPE, blech);
10653
10654         /* Don't let compiler optimize the test away.  Store the number 
10655            in a writable string for gcc to pass to sscanf under HP/UX.
10656         */
10657         sprintf(str, "2147483647");
10658         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10659         g = 10 * f;
10660         i32  = ($xxx) g;
10661
10662         /* x86 processors will probably give 0x8000 0000, which is a
10663            sign change.  We don't want that.  We want to mimic SPARC
10664            behavior here, which is to preserve the sign and give
10665            back 0x7fff ffff.
10666         */
10667         if (i32 != ($xxx) f)
10668                 result |= 1;
10669         exit(result);
10670 }
10671 EOCP
10672 set try
10673 if eval $compile_ok; then
10674         $run ./try
10675         yyy=$?
10676 else
10677         echo "(I can't seem to compile the test program--assuming it can't)"
10678         yyy=1
10679 fi
10680 case "$yyy" in
10681 0)      val="$define"
10682         echo "Yup, it can."
10683         ;;
10684 *)      val="$undef"
10685         echo "Nope, it can't."
10686         ;;
10687 esac
10688 set d_casti32
10689 eval $setvar
10690 $rm -f try try.*
10691
10692 : check for ability to cast negative floats to unsigned
10693 echo " "
10694 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10695 $cat >try.c <<EOCP
10696 #include <stdio.h>
10697 #$i_stdlib I_STDLIB
10698 #ifdef I_STDLIB
10699 #include <stdlib.h>
10700 #endif
10701 #include <sys/types.h>
10702 #include <signal.h>
10703 $signal_t blech(int s) { exit(7); }
10704 $signal_t blech_in_list(int s) { exit(4); }
10705 unsigned long dummy_long(unsigned long p) { return p; }
10706 unsigned int dummy_int(unsigned int p) { return p; }
10707 unsigned short dummy_short(unsigned short p) { return p; }
10708 int main()
10709 {
10710         double f;
10711         unsigned long along;
10712         unsigned int aint;
10713         unsigned short ashort;
10714         int result = 0;
10715         char str[16];
10716         
10717         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10718            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10719            optimized the whole file away
10720         */
10721         /* Store the number in a writable string for gcc to pass to 
10722            sscanf under HP/UX.
10723         */
10724         sprintf(str, "-123");
10725         sscanf(str, "%lf", &f);  /* f = -123.; */
10726
10727         signal(SIGFPE, blech);
10728         along = (unsigned long)f;
10729         aint = (unsigned int)f;
10730         ashort = (unsigned short)f;
10731         if (along != (unsigned long)-123)
10732                 result |= 1;
10733         if (aint != (unsigned int)-123)
10734                 result |= 1;
10735         if (ashort != (unsigned short)-123)
10736                 result |= 1;
10737         sprintf(str, "1073741824.");
10738         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10739         f = f + f;
10740         along = 0;
10741         along = (unsigned long)f;
10742         if (along != 0x80000000)
10743                 result |= 2;
10744         f -= 1.;
10745         along = 0;
10746         along = (unsigned long)f;
10747         if (along != 0x7fffffff)
10748                 result |= 1;
10749         f += 2.;
10750         along = 0;
10751         along = (unsigned long)f;
10752         if (along != 0x80000001)
10753                 result |= 2;
10754         if (result)
10755                 exit(result);
10756         signal(SIGFPE, blech_in_list);
10757         sprintf(str, "123.");
10758         sscanf(str, "%lf", &f);  /* f = 123.; */
10759         along = dummy_long((unsigned long)f);
10760         aint = dummy_int((unsigned int)f);
10761         ashort = dummy_short((unsigned short)f);
10762         if (along != (unsigned long)123)
10763                 result |= 4;
10764         if (aint != (unsigned int)123)
10765                 result |= 4;
10766         if (ashort != (unsigned short)123)
10767                 result |= 4;
10768         exit(result);
10769
10770 }
10771 EOCP
10772 set try
10773 if eval $compile_ok; then
10774         $run ./try
10775         castflags=$?
10776 else
10777         echo "(I can't seem to compile the test program--assuming it can't)"
10778         castflags=7
10779 fi
10780 case "$castflags" in
10781 0)      val="$define"
10782         echo "Yup, it can."
10783         ;;
10784 *)      val="$undef"
10785         echo "Nope, it can't."
10786         ;;
10787 esac
10788 set d_castneg
10789 eval $setvar
10790 $rm -f try.*
10791
10792 : see if vprintf exists
10793 echo " "
10794 if set vprintf val -f d_vprintf; eval $csym; $val; then
10795         echo 'vprintf() found.' >&4
10796         val="$define"
10797         $cat >try.c <<EOF
10798 #include <varargs.h>
10799 #$i_stdlib I_STDLIB
10800 #ifdef I_STDLIB
10801 #include <stdlib.h>
10802 #endif
10803
10804 int main() { xxx("foo"); }
10805
10806 xxx(va_alist)
10807 va_dcl
10808 {
10809         va_list args;
10810         char buf[10];
10811
10812         va_start(args);
10813         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10814 }
10815 EOF
10816         set try
10817         if eval $compile && $run ./try; then
10818                 echo "Your vsprintf() returns (int)." >&4
10819                 val2="$undef"
10820         else
10821                 echo "Your vsprintf() returns (char*)." >&4
10822                 val2="$define"
10823         fi
10824 else
10825         echo 'vprintf() NOT found.' >&4
10826                 val="$undef"
10827                 val2="$undef"
10828 fi
10829 $rm -f try try.*
10830 set d_vprintf
10831 eval $setvar
10832 val=$val2
10833 set d_charvspr
10834 eval $setvar
10835
10836 : see if chown exists
10837 set chown d_chown
10838 eval $inlibc
10839
10840 : see if chroot exists
10841 set chroot d_chroot
10842 eval $inlibc
10843
10844 : see if chsize exists
10845 set chsize d_chsize
10846 eval $inlibc
10847
10848 : see if class exists
10849 set class d_class
10850 eval $inlibc
10851
10852 : see if clearenv exists
10853 set clearenv d_clearenv
10854 eval $inlibc
10855
10856 hasstruct='varname=$1; struct=$2; shift; shift;
10857 while $test $# -ge 2; do
10858         case "$1" in
10859         $define) echo "#include <$2>";;
10860         esac ;
10861     shift 2;
10862 done > try.c;
10863 echo "int main () { struct $struct foo; }" >> try.c;
10864 set try;
10865 if eval $compile; then
10866         val="$define";
10867 else
10868         val="$undef";
10869 fi;
10870 set $varname;
10871 eval $setvar;
10872 $rm -f try.c try.o'
10873
10874 socketlib=''
10875 sockethdr=''
10876 : see whether socket exists
10877 echo " "
10878 $echo $n "Hmm... $c" >&4
10879 if set socket val -f d_socket; eval $csym; $val; then
10880         echo "Looks like you have Berkeley networking support." >&4
10881         d_socket="$define"
10882         if set setsockopt val -f; eval $csym; $val; then
10883                 d_oldsock="$undef"
10884         else
10885                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10886                 d_oldsock="$define"
10887         fi
10888 else
10889         if $contains socklib libc.list >/dev/null 2>&1; then
10890                 echo "Looks like you have Berkeley networking support." >&4
10891                 d_socket="$define"
10892                 : we will have to assume that it supports the 4.2 BSD interface
10893                 d_oldsock="$undef"
10894         else
10895                 echo "You don't have Berkeley networking in libc$_a..." >&4
10896                 if test "X$d_socket" = "X$define"; then
10897                    echo "...but you seem to believe that you have sockets." >&4
10898                 else
10899                         for net in net socket
10900                         do
10901                                 if test -f /usr/lib/lib$net$_a; then
10902                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10903                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10904                                         if $contains socket libc.list >/dev/null 2>&1; then
10905                                                 d_socket="$define"
10906                                                 socketlib="-l$net"
10907                                                 case "$net" in
10908                                                 net)
10909                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10910                                                         sockethdr="-I/usr/netinclude"
10911                                                         ;;
10912                                                 esac
10913                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10914                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10915                                                         d_oldsock="$undef"
10916                                                 else
10917                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10918                                                         d_oldsock="$define"
10919                                                 fi
10920                                                 break
10921                                         fi
10922                                 fi
10923                         done
10924                         if test "X$d_socket" != "X$define"; then
10925                            echo "or anywhere else I see." >&4
10926                            d_socket="$undef"
10927                            d_oldsock="$undef"
10928                         fi
10929                 fi
10930         fi
10931 fi
10932
10933 : see if socketpair exists
10934 set socketpair d_sockpair
10935 eval $inlibc
10936
10937
10938 echo " "
10939 echo "Checking the availability of certain socket constants..." >&4
10940 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10941         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10942         $cat >try.c <<EOF
10943 #include <sys/types.h>
10944 #include <sys/socket.h>
10945 int main() {
10946     int i = $ENUM;
10947 }
10948 EOF
10949         val="$undef"
10950         set try; if eval $compile; then
10951                 val="$define"
10952         fi
10953         set d_${enum}; eval $setvar
10954         $rm -f try.c try
10955 done
10956
10957 : see if this is a sys/uio.h system
10958 set sys/uio.h i_sysuio
10959 eval $inhdr
10960
10961
10962 echo " "
10963 echo "Checking to see if your system supports struct cmsghdr..." >&4
10964 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10965 eval $hasstruct
10966 case "$d_cmsghdr_s" in
10967 "$define")      echo "Yes, it does."   ;;
10968 *)              echo "No, it doesn't." ;;
10969 esac
10970
10971
10972 : check for const keyword
10973 echo " "
10974 echo 'Checking to see if your C compiler knows about "const"...' >&4
10975 $cat >const.c <<'EOCP'
10976 typedef struct spug { int drokk; } spug;
10977 int main()
10978 {
10979         const char *foo;
10980         const spug y = { 0 };
10981 }
10982 EOCP
10983 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10984         val="$define"
10985         echo "Yup, it does."
10986 else
10987         val="$undef"
10988         echo "Nope, it doesn't."
10989 fi
10990 set d_const
10991 eval $setvar
10992
10993 : see if copysignl exists
10994 set copysignl d_copysignl
10995 eval $inlibc
10996
10997 : see if crypt exists
10998 echo " "
10999 set crypt d_crypt
11000 eval $inlibc
11001 case "$d_crypt" in
11002 $define) cryptlib='' ;;
11003 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11004                 echo 'crypt() found.' >&4
11005                 val="$define"
11006                 cryptlib=''
11007         else
11008                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11009                 if $test -z "$cryptlib"; then
11010                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11011                 else
11012                         cryptlib=-lcrypt
11013                 fi
11014                 if $test -z "$cryptlib"; then
11015                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11016                 else
11017                         cryptlib=-lcrypt
11018                 fi
11019                 if $test -z "$cryptlib"; then
11020                         cryptlib=`./loc libcrypt$_a "" $libpth`
11021                 else
11022                         cryptlib=-lcrypt
11023                 fi
11024                 if $test -z "$cryptlib"; then
11025                         echo 'crypt() NOT found.' >&4
11026                         val="$undef"
11027                 else
11028                         val="$define"
11029                 fi
11030         fi
11031         set d_crypt
11032         eval $setvar
11033         ;;
11034 esac
11035
11036 : see if this is a crypt.h system
11037 set crypt.h i_crypt
11038 eval $inhdr
11039
11040 : see if crypt_r exists
11041 set crypt_r d_crypt_r
11042 eval $inlibc
11043 case "$d_crypt_r" in
11044 "$define")
11045         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11046         case "$d_crypt_r_proto:$usethreads" in
11047         ":define")      d_crypt_r_proto=define
11048                 set d_crypt_r_proto crypt_r $hdrs
11049                 eval $hasproto ;;
11050         *)      ;;
11051         esac
11052         case "$d_crypt_r_proto" in
11053         define)
11054         case "$crypt_r_proto" in
11055         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11056         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11057         esac
11058         case "$crypt_r_proto" in
11059         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11060         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11061         esac
11062         case "$crypt_r_proto" in
11063         ''|0)   d_crypt_r=undef
11064                 crypt_r_proto=0
11065                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11066         * )     case "$crypt_r_proto" in
11067                 REENTRANT_PROTO*) ;;
11068                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11069                 esac
11070                 echo "Prototype: $try" ;;
11071         esac
11072         ;;
11073         *)      case "$usethreads" in
11074                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11075                 esac
11076                 d_crypt_r=undef
11077                 crypt_r_proto=0
11078                 ;;
11079         esac
11080         ;;
11081 *)      crypt_r_proto=0
11082         ;;
11083 esac
11084
11085 : get csh whereabouts
11086 case "$csh" in
11087 'csh') val="$undef" ;;
11088 *) val="$define" ;;
11089 esac
11090 set d_csh
11091 eval $setvar
11092 : Respect a hint or command line value for full_csh.
11093 case "$full_csh" in
11094 '') full_csh=$csh ;;
11095 esac
11096
11097 : see if ctermid exists
11098 set ctermid d_ctermid
11099 eval $inlibc
11100
11101 : see if ctermid_r exists
11102 set ctermid_r d_ctermid_r
11103 eval $inlibc
11104 case "$d_ctermid_r" in
11105 "$define")
11106         hdrs="$i_systypes sys/types.h define stdio.h "
11107         case "$d_ctermid_r_proto:$usethreads" in
11108         ":define")      d_ctermid_r_proto=define
11109                 set d_ctermid_r_proto ctermid_r $hdrs
11110                 eval $hasproto ;;
11111         *)      ;;
11112         esac
11113         case "$d_ctermid_r_proto" in
11114         define)
11115         case "$ctermid_r_proto" in
11116         ''|0) try='char* ctermid_r(char*);'
11117         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11118         esac
11119         case "$ctermid_r_proto" in
11120         ''|0)   d_ctermid_r=undef
11121                 ctermid_r_proto=0
11122                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11123         * )     case "$ctermid_r_proto" in
11124                 REENTRANT_PROTO*) ;;
11125                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11126                 esac
11127                 echo "Prototype: $try" ;;
11128         esac
11129         ;;
11130         *)      case "$usethreads" in
11131                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11132                 esac
11133                 d_ctermid_r=undef
11134                 ctermid_r_proto=0
11135                 ;;
11136         esac
11137         ;;
11138 *)      ctermid_r_proto=0
11139         ;;
11140 esac
11141
11142 : see if ctime_r exists
11143 set ctime_r d_ctime_r
11144 eval $inlibc
11145 case "$d_ctime_r" in
11146 "$define")
11147         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11148         case "$d_ctime_r_proto:$usethreads" in
11149         ":define")      d_ctime_r_proto=define
11150                 set d_ctime_r_proto ctime_r $hdrs
11151                 eval $hasproto ;;
11152         *)      ;;
11153         esac
11154         case "$d_ctime_r_proto" in
11155         define)
11156         case "$ctime_r_proto" in
11157         ''|0) try='char* ctime_r(const time_t*, char*);'
11158         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11159         esac
11160         case "$ctime_r_proto" in
11161         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11162         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11163         esac
11164         case "$ctime_r_proto" in
11165         ''|0) try='int ctime_r(const time_t*, char*);'
11166         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11167         esac
11168         case "$ctime_r_proto" in
11169         ''|0) try='int ctime_r(const time_t*, char*, int);'
11170         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11171         esac
11172         case "$ctime_r_proto" in
11173         ''|0)   d_ctime_r=undef
11174                 ctime_r_proto=0
11175                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11176         * )     case "$ctime_r_proto" in
11177                 REENTRANT_PROTO*) ;;
11178                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11179                 esac
11180                 echo "Prototype: $try" ;;
11181         esac
11182         ;;
11183         *)      case "$usethreads" in
11184                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11185                 esac
11186                 d_ctime_r=undef
11187                 ctime_r_proto=0
11188                 ;;
11189         esac
11190         ;;
11191 *)      ctime_r_proto=0
11192         ;;
11193 esac
11194
11195 : see if cuserid exists
11196 set cuserid d_cuserid
11197 eval $inlibc
11198
11199 : see if this is a limits.h system
11200 set limits.h i_limits
11201 eval $inhdr
11202
11203 : see if this is a float.h system
11204 set float.h i_float
11205 eval $inhdr
11206
11207 : See if number of significant digits in a double precision number is known
11208 echo " "
11209 $cat >dbl_dig.c <<EOM
11210 #$i_limits I_LIMITS
11211 #$i_float I_FLOAT
11212 #ifdef I_LIMITS
11213 #include <limits.h>
11214 #endif
11215 #ifdef I_FLOAT
11216 #include <float.h>
11217 #endif
11218 #ifdef DBL_DIG
11219 printf("Contains DBL_DIG");
11220 #endif
11221 EOM
11222 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11223 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11224         echo "DBL_DIG found." >&4
11225         val="$define"
11226 else
11227         echo "DBL_DIG NOT found." >&4
11228         val="$undef"
11229 fi
11230 $rm -f dbl_dig.?
11231 set d_dbl_dig
11232 eval $setvar
11233
11234 : see if dbm.h is available
11235 : see if dbmclose exists
11236 set dbmclose d_dbmclose
11237 eval $inlibc
11238
11239 case "$d_dbmclose" in
11240 $define)
11241         set dbm.h i_dbm
11242         eval $inhdr
11243         case "$i_dbm" in
11244         $define)
11245                 val="$undef"
11246                 set i_rpcsvcdbm
11247                 eval $setvar
11248                 ;;
11249         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11250                 eval $inhdr
11251                 ;;
11252         esac
11253         ;;
11254 *)      echo "We won't be including <dbm.h>"
11255         val="$undef"
11256         set i_dbm
11257         eval $setvar
11258         val="$undef"
11259         set i_rpcsvcdbm
11260         eval $setvar
11261         ;;
11262 esac
11263
11264 : see if prototype for dbminit is available
11265 echo " "
11266 set d_dbminitproto dbminit $i_dbm dbm.h
11267 eval $hasproto
11268
11269 : see if difftime exists
11270 set difftime d_difftime
11271 eval $inlibc
11272
11273 : see if this is a dirent system
11274 echo " "
11275 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11276         val="$define"
11277         echo "<dirent.h> found." >&4
11278 else
11279         val="$undef"
11280         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11281                 echo "<sys/dir.h> found." >&4
11282                 echo " "
11283         else
11284                 xinc=`./findhdr sys/ndir.h`
11285         fi
11286         echo "<dirent.h> NOT found." >&4
11287 fi
11288 set i_dirent
11289 eval $setvar
11290
11291 : Look for type of directory structure.
11292 echo " "
11293 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11294
11295 case "$direntrytype" in
11296 ''|' ')
11297         case "$i_dirent" in
11298         $define) guess1='struct dirent' ;;
11299         *) guess1='struct direct'  ;;
11300         esac
11301         ;;
11302 *)      guess1="$direntrytype"
11303         ;;
11304 esac
11305
11306 case "$guess1" in
11307 'struct dirent') guess2='struct direct' ;;
11308 *) guess2='struct dirent' ;;
11309 esac
11310                 
11311 if $contains "$guess1" try.c >/dev/null 2>&1; then
11312         direntrytype="$guess1"
11313         echo "Your directory entries are $direntrytype." >&4
11314 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11315         direntrytype="$guess2"
11316         echo "Your directory entries seem to be $direntrytype." >&4
11317 else
11318         echo "I don't recognize your system's directory entries." >&4
11319         rp="What type is used for directory entries on this system?"
11320         dflt="$guess1"
11321         . ./myread
11322         direntrytype="$ans"
11323 fi
11324 $rm -f try.c
11325
11326
11327 : see if the directory entry stores field length
11328 echo " "
11329 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11330 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11331         echo "Good, your directory entry keeps length information in d_namlen." >&4
11332         val="$define"
11333 else
11334         echo "Your directory entry does not know about the d_namlen field." >&4
11335         val="$undef"
11336 fi
11337 set d_dirnamlen
11338 eval $setvar
11339 $rm -f try.c
11340
11341 : Look for DIR.dd_fd
11342 case "$i_dirent" in
11343 "$define")
11344     echo "Checking to see if DIR has a dd_fd member variable" >&4
11345     $cat >try.c <<EOCP
11346 #$i_stdlib I_STDLIB
11347 #ifdef I_STDLIB
11348 #include <stdlib.h>
11349 #endif
11350 #include <dirent.h>
11351
11352 int main() {
11353     DIR dir;
11354     dir.dd_fd = 1;
11355     return 0;
11356 }
11357 EOCP
11358     val=$undef
11359     set try
11360     if eval $compile; then
11361         echo "Yes, it does."
11362         val="$define"
11363     else
11364         echo "No, it does not."
11365         val="$undef"
11366     fi
11367     ;;
11368 *)
11369     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11370     val="$undef"
11371     ;;
11372 esac
11373 set d_dir_dd_fd
11374 eval $setvar
11375 $rm -f try try.*
11376
11377 : see if this is an sysdir system
11378 set sys/dir.h i_sysdir
11379 eval $inhdr
11380
11381 : see if this is an sysndir system
11382 set sys/ndir.h i_sysndir
11383 eval $inhdr
11384
11385 : Look for dirfd
11386 echo " "
11387 $cat >dirfd.c <<EOM
11388 #include <stdio.h>
11389 #$i_stdlib I_STDLIB
11390 #ifdef I_STDLIB
11391 #include <stdlib.h>
11392 #endif
11393 #$i_dirent I_DIRENT             /**/
11394 #$i_sysdir I_SYS_DIR            /**/
11395 #$i_sysndir I_SYS_NDIR          /**/
11396 #$i_systypes I_SYS_TYPES        /**/
11397 #if defined(I_SYS_TYPES)
11398 #include <sys/types.h>
11399 #endif
11400 #if defined(I_DIRENT)
11401 #include <dirent.h>
11402 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11403 #include <sys/dir.h>
11404 #endif
11405 #else
11406 #ifdef I_SYS_NDIR
11407 #include <sys/ndir.h>
11408 #else
11409 #ifdef I_SYS_DIR
11410 #ifdef hp9000s500
11411 #include <ndir.h>       /* may be wrong in the future */
11412 #else
11413 #include <sys/dir.h>
11414 #endif
11415 #endif
11416 #endif
11417 #endif 
11418 int main() {
11419         DIR *dirp = opendir(".");
11420         if (dirfd(dirp) >= 0)
11421                 exit(0);
11422         else
11423                 exit(1);
11424 }
11425 EOM
11426 val=$undef
11427 set dirfd
11428 if eval $compile; then
11429         val="$define"
11430 fi
11431 case "$val" in
11432 $define)        echo "dirfd() found." >&4       ;;
11433 *)              echo "dirfd() NOT found." >&4   ;;
11434 esac
11435 set d_dirfd
11436 eval $setvar
11437 $rm -f dirfd*
11438
11439 : see if dlerror exists
11440 xxx_runnm="$runnm"
11441 runnm=false
11442 set dlerror d_dlerror
11443 eval $inlibc
11444 runnm="$xxx_runnm"
11445
11446 : see if dlfcn is available
11447 set dlfcn.h i_dlfcn
11448 eval $inhdr
11449
11450 case "$usedl" in
11451 $define|y|true)
11452         $cat << EOM
11453
11454 On a few systems, the dynamically loaded modules that perl generates and uses
11455 will need a different extension than shared libs. The default will probably
11456 be appropriate.
11457
11458 EOM
11459         case "$dlext" in
11460         '')     dflt="$so" ;;
11461         *)      dflt="$dlext" ;;
11462         esac
11463         rp='What is the extension of dynamically loaded modules'
11464         . ./myread
11465         dlext="$ans"
11466         ;;
11467 *)
11468         dlext="none"
11469         ;;
11470 esac
11471
11472 : Check if dlsym need a leading underscore
11473 echo " "
11474 val="$undef"
11475
11476 case "$dlsrc" in
11477 dl_dlopen.xs)
11478         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11479         $cat >dyna.c <<'EOM'
11480 fred () { }
11481 EOM
11482
11483 $cat >fred.c<<EOM
11484
11485 #include <stdio.h>
11486 #$i_stdlib I_STDLIB
11487 #ifdef I_STDLIB
11488 #include <stdlib.h>
11489 #endif
11490 #$i_dlfcn I_DLFCN
11491 #ifdef I_DLFCN
11492 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11493 #else
11494 #include <sys/types.h>
11495 #include <nlist.h>
11496 #include <link.h>
11497 #endif
11498
11499 extern int fred() ;
11500
11501 int main()
11502 {
11503     void * handle ;
11504     void * symbol ;
11505 #ifndef RTLD_LAZY
11506     int mode = 1 ;
11507 #else
11508     int mode = RTLD_LAZY ;
11509 #endif
11510     handle = dlopen("./dyna.$dlext", mode) ;
11511     if (handle == NULL) {
11512         printf ("1\n") ;
11513         fflush (stdout) ;
11514         exit(0);
11515     }
11516     symbol = dlsym(handle, "fred") ;
11517     if (symbol == NULL) {
11518         /* try putting a leading underscore */
11519         symbol = dlsym(handle, "_fred") ;
11520         if (symbol == NULL) {
11521             printf ("2\n") ;
11522             fflush (stdout) ;
11523             exit(0);
11524         }
11525         printf ("3\n") ;
11526     }
11527     else
11528         printf ("4\n") ;
11529     fflush (stdout) ;
11530     exit(0);
11531 }
11532 EOM
11533         : Call the object file tmp-dyna.o in case dlext=o.
11534         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11535                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11536                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11537                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11538                 xxx=`$run ./fred`
11539                 case $xxx in
11540                 1)      echo "Test program failed using dlopen." >&4
11541                         echo "Perhaps you should not use dynamic loading." >&4;;
11542                 2)      echo "Test program failed using dlsym." >&4
11543                         echo "Perhaps you should not use dynamic loading." >&4;;
11544                 3)      echo "dlsym needs a leading underscore" >&4
11545                         val="$define" ;;
11546                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11547                 esac
11548         else
11549                 echo "I can't compile and run the test program." >&4
11550                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11551         fi
11552         ;;
11553 esac
11554                 
11555 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11556
11557 set d_dlsymun
11558 eval $setvar
11559
11560 : see if drand48_r exists
11561 set drand48_r d_drand48_r
11562 eval $inlibc
11563 case "$d_drand48_r" in
11564 "$define")
11565         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11566         case "$d_drand48_r_proto:$usethreads" in
11567         ":define")      d_drand48_r_proto=define
11568                 set d_drand48_r_proto drand48_r $hdrs
11569                 eval $hasproto ;;
11570         *)      ;;
11571         esac
11572         case "$d_drand48_r_proto" in
11573         define)
11574         case "$drand48_r_proto" in
11575         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11576         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11577         esac
11578         case "$drand48_r_proto" in
11579         ''|0)   d_drand48_r=undef
11580                 drand48_r_proto=0
11581                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11582         * )     case "$drand48_r_proto" in
11583                 REENTRANT_PROTO*) ;;
11584                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11585                 esac
11586                 echo "Prototype: $try" ;;
11587         esac
11588         ;;
11589         *)      case "$usethreads" in
11590                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11591                 esac
11592                 d_drand48_r=undef
11593                 drand48_r_proto=0
11594                 ;;
11595         esac
11596         ;;
11597 *)      drand48_r_proto=0
11598         ;;
11599 esac
11600
11601 : see if prototype for drand48 is available
11602 echo " "
11603 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11604 eval $hasproto
11605
11606 : see if dup2 exists
11607 set dup2 d_dup2
11608 eval $inlibc
11609
11610 : see if eaccess exists
11611 set eaccess d_eaccess
11612 eval $inlibc
11613
11614 : see if endgrent exists
11615 set endgrent d_endgrent
11616 eval $inlibc
11617
11618 : see if this is an grp system
11619 set grp.h i_grp
11620 eval $inhdr
11621
11622 case "$i_grp" in
11623 $define)
11624         xxx=`./findhdr grp.h`
11625         $cppstdin $cppflags $cppminus < $xxx >$$.h
11626
11627         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11628                 val="$define"
11629         else
11630                 val="$undef"
11631         fi
11632         set d_grpasswd
11633         eval $setvar
11634
11635         $rm -f $$.h
11636         ;;
11637 *)
11638         val="$undef";
11639         set d_grpasswd; eval $setvar
11640         ;;
11641 esac
11642
11643 : see if endgrent_r exists
11644 set endgrent_r d_endgrent_r
11645 eval $inlibc
11646 case "$d_endgrent_r" in
11647 "$define")
11648         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11649         case "$d_endgrent_r_proto:$usethreads" in
11650         ":define")      d_endgrent_r_proto=define
11651                 set d_endgrent_r_proto endgrent_r $hdrs
11652                 eval $hasproto ;;
11653         *)      ;;
11654         esac
11655         case "$d_endgrent_r_proto" in
11656         define)
11657         case "$endgrent_r_proto" in
11658         ''|0) try='int endgrent_r(FILE**);'
11659         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11660         esac
11661         case "$endgrent_r_proto" in
11662         ''|0) try='void endgrent_r(FILE**);'
11663         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11664         esac
11665         case "$endgrent_r_proto" in
11666         ''|0)   d_endgrent_r=undef
11667                 endgrent_r_proto=0
11668                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11669         * )     case "$endgrent_r_proto" in
11670                 REENTRANT_PROTO*) ;;
11671                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11672                 esac
11673                 echo "Prototype: $try" ;;
11674         esac
11675         ;;
11676         *)      case "$usethreads" in
11677                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11678                 esac
11679                 d_endgrent_r=undef
11680                 endgrent_r_proto=0
11681                 ;;
11682         esac
11683         ;;
11684 *)      endgrent_r_proto=0
11685         ;;
11686 esac
11687
11688 : see if endhostent exists
11689 set endhostent d_endhent
11690 eval $inlibc
11691
11692 : see if this is a netdb.h system
11693 set netdb.h i_netdb
11694 eval $inhdr
11695
11696 : see if endhostent_r exists
11697 set endhostent_r d_endhostent_r
11698 eval $inlibc
11699 case "$d_endhostent_r" in
11700 "$define")
11701         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11702         case "$d_endhostent_r_proto:$usethreads" in
11703         ":define")      d_endhostent_r_proto=define
11704                 set d_endhostent_r_proto endhostent_r $hdrs
11705                 eval $hasproto ;;
11706         *)      ;;
11707         esac
11708         case "$d_endhostent_r_proto" in
11709         define)
11710         case "$endhostent_r_proto" in
11711         ''|0) try='int endhostent_r(struct hostent_data*);'
11712         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11713         esac
11714         case "$endhostent_r_proto" in
11715         ''|0) try='void endhostent_r(struct hostent_data*);'
11716         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11717         esac
11718         case "$endhostent_r_proto" in
11719         ''|0)   d_endhostent_r=undef
11720                 endhostent_r_proto=0
11721                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11722         * )     case "$endhostent_r_proto" in
11723                 REENTRANT_PROTO*) ;;
11724                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11725                 esac
11726                 echo "Prototype: $try" ;;
11727         esac
11728         ;;
11729         *)      case "$usethreads" in
11730                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11731                 esac
11732                 d_endhostent_r=undef
11733                 endhostent_r_proto=0
11734                 ;;
11735         esac
11736         ;;
11737 *)      endhostent_r_proto=0
11738         ;;
11739 esac
11740
11741 : see if endnetent exists
11742 set endnetent d_endnent
11743 eval $inlibc
11744
11745 : see if endnetent_r exists
11746 set endnetent_r d_endnetent_r
11747 eval $inlibc
11748 case "$d_endnetent_r" in
11749 "$define")
11750         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11751         case "$d_endnetent_r_proto:$usethreads" in
11752         ":define")      d_endnetent_r_proto=define
11753                 set d_endnetent_r_proto endnetent_r $hdrs
11754                 eval $hasproto ;;
11755         *)      ;;
11756         esac
11757         case "$d_endnetent_r_proto" in
11758         define)
11759         case "$endnetent_r_proto" in
11760         ''|0) try='int endnetent_r(struct netent_data*);'
11761         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11762         esac
11763         case "$endnetent_r_proto" in
11764         ''|0) try='void endnetent_r(struct netent_data*);'
11765         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11766         esac
11767         case "$endnetent_r_proto" in
11768         ''|0)   d_endnetent_r=undef
11769                 endnetent_r_proto=0
11770                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11771         * )     case "$endnetent_r_proto" in
11772                 REENTRANT_PROTO*) ;;
11773                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11774                 esac
11775                 echo "Prototype: $try" ;;
11776         esac
11777         ;;
11778         *)      case "$usethreads" in
11779                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11780                 esac
11781                 d_endnetent_r=undef
11782                 endnetent_r_proto=0
11783                 ;;
11784         esac
11785         ;;
11786 *)      endnetent_r_proto=0
11787         ;;
11788 esac
11789
11790 : see if endprotoent exists
11791 set endprotoent d_endpent
11792 eval $inlibc
11793
11794 : see if endprotoent_r exists
11795 set endprotoent_r d_endprotoent_r
11796 eval $inlibc
11797 case "$d_endprotoent_r" in
11798 "$define")
11799         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11800         case "$d_endprotoent_r_proto:$usethreads" in
11801         ":define")      d_endprotoent_r_proto=define
11802                 set d_endprotoent_r_proto endprotoent_r $hdrs
11803                 eval $hasproto ;;
11804         *)      ;;
11805         esac
11806         case "$d_endprotoent_r_proto" in
11807         define)
11808         case "$endprotoent_r_proto" in
11809         ''|0) try='int endprotoent_r(struct protoent_data*);'
11810         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11811         esac
11812         case "$endprotoent_r_proto" in
11813         ''|0) try='void endprotoent_r(struct protoent_data*);'
11814         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11815         esac
11816         case "$endprotoent_r_proto" in
11817         ''|0)   d_endprotoent_r=undef
11818                 endprotoent_r_proto=0
11819                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11820         * )     case "$endprotoent_r_proto" in
11821                 REENTRANT_PROTO*) ;;
11822                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11823                 esac
11824                 echo "Prototype: $try" ;;
11825         esac
11826         ;;
11827         *)      case "$usethreads" in
11828                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11829                 esac
11830                 d_endprotoent_r=undef
11831                 endprotoent_r_proto=0
11832                 ;;
11833         esac
11834         ;;
11835 *)      endprotoent_r_proto=0
11836         ;;
11837 esac
11838
11839 : see if endpwent exists
11840 set endpwent d_endpwent
11841 eval $inlibc
11842
11843 : see if this is a pwd.h system
11844 set pwd.h i_pwd
11845 eval $inhdr
11846
11847 case "$i_pwd" in
11848 $define)
11849         xxx=`./findhdr pwd.h`
11850         $cppstdin $cppflags $cppminus < $xxx >$$.h
11851
11852         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11853                 val="$define"
11854         else
11855                 val="$undef"
11856         fi
11857         set d_pwquota
11858         eval $setvar
11859
11860         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11861                 val="$define"
11862         else
11863                 val="$undef"
11864         fi
11865         set d_pwage
11866         eval $setvar
11867
11868         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11869                 val="$define"
11870         else
11871                 val="$undef"
11872         fi
11873         set d_pwchange
11874         eval $setvar
11875
11876         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11877                 val="$define"
11878         else
11879                 val="$undef"
11880         fi
11881         set d_pwclass
11882         eval $setvar
11883
11884         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11885                 val="$define"
11886         else
11887                 val="$undef"
11888         fi
11889         set d_pwexpire
11890         eval $setvar
11891
11892         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11893                 val="$define"
11894         else
11895                 val="$undef"
11896         fi
11897         set d_pwcomment
11898         eval $setvar
11899
11900         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11901                 val="$define"
11902         else
11903                 val="$undef"
11904         fi
11905         set d_pwgecos
11906         eval $setvar
11907
11908         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11909                 val="$define"
11910         else
11911                 val="$undef"
11912         fi
11913         set d_pwpasswd
11914         eval $setvar
11915
11916         $rm -f $$.h
11917         ;;
11918 *)
11919         val="$undef"; 
11920         set d_pwquota; eval $setvar
11921         set d_pwage; eval $setvar
11922         set d_pwchange; eval $setvar
11923         set d_pwclass; eval $setvar
11924         set d_pwexpire; eval $setvar
11925         set d_pwcomment; eval $setvar
11926         set d_pwgecos; eval $setvar
11927         set d_pwpasswd; eval $setvar
11928         ;;
11929 esac
11930
11931 : see if endpwent_r exists
11932 set endpwent_r d_endpwent_r
11933 eval $inlibc
11934 case "$d_endpwent_r" in
11935 "$define")
11936         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11937         case "$d_endpwent_r_proto:$usethreads" in
11938         ":define")      d_endpwent_r_proto=define
11939                 set d_endpwent_r_proto endpwent_r $hdrs
11940                 eval $hasproto ;;
11941         *)      ;;
11942         esac
11943         case "$d_endpwent_r_proto" in
11944         define)
11945         case "$endpwent_r_proto" in
11946         ''|0) try='int endpwent_r(FILE**);'
11947         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11948         esac
11949         case "$endpwent_r_proto" in
11950         ''|0) try='void endpwent_r(FILE**);'
11951         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11952         esac
11953         case "$endpwent_r_proto" in
11954         ''|0)   d_endpwent_r=undef
11955                 endpwent_r_proto=0
11956                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11957         * )     case "$endpwent_r_proto" in
11958                 REENTRANT_PROTO*) ;;
11959                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11960                 esac
11961                 echo "Prototype: $try" ;;
11962         esac
11963         ;;
11964         *)      case "$usethreads" in
11965                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11966                 esac
11967                 d_endpwent_r=undef
11968                 endpwent_r_proto=0
11969                 ;;
11970         esac
11971         ;;
11972 *)      endpwent_r_proto=0
11973         ;;
11974 esac
11975
11976 : see if endservent exists
11977 set endservent d_endsent
11978 eval $inlibc
11979
11980 : see if endservent_r exists
11981 set endservent_r d_endservent_r
11982 eval $inlibc
11983 case "$d_endservent_r" in
11984 "$define")
11985         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11986         case "$d_endservent_r_proto:$usethreads" in
11987         ":define")      d_endservent_r_proto=define
11988                 set d_endservent_r_proto endservent_r $hdrs
11989                 eval $hasproto ;;
11990         *)      ;;
11991         esac
11992         case "$d_endservent_r_proto" in
11993         define)
11994         case "$endservent_r_proto" in
11995         ''|0) try='int endservent_r(struct servent_data*);'
11996         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11997         esac
11998         case "$endservent_r_proto" in
11999         ''|0) try='void endservent_r(struct servent_data*);'
12000         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12001         esac
12002         case "$endservent_r_proto" in
12003         ''|0)   d_endservent_r=undef
12004                 endservent_r_proto=0
12005                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12006         * )     case "$endservent_r_proto" in
12007                 REENTRANT_PROTO*) ;;
12008                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12009                 esac
12010                 echo "Prototype: $try" ;;
12011         esac
12012         ;;
12013         *)      case "$usethreads" in
12014                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12015                 esac
12016                 d_endservent_r=undef
12017                 endservent_r_proto=0
12018                 ;;
12019         esac
12020         ;;
12021 *)      endservent_r_proto=0
12022         ;;
12023 esac
12024
12025 : Locate the flags for 'open()'
12026 echo " "
12027 $cat >try.c <<EOCP
12028 #include <sys/types.h>
12029 #ifdef I_FCNTL
12030 #include <fcntl.h>
12031 #endif
12032 #ifdef I_SYS_FILE
12033 #include <sys/file.h>
12034 #endif
12035 #$i_stdlib I_STDLIB
12036 #ifdef I_STDLIB
12037 #include <stdlib.h>
12038 #endif
12039 int main() {
12040         if(O_RDONLY);
12041 #ifdef O_TRUNC
12042         exit(0);
12043 #else
12044         exit(1);
12045 #endif
12046 }
12047 EOCP
12048 : check sys/file.h first to get FREAD on Sun
12049 if $test `./findhdr sys/file.h` && \
12050                 set try -DI_SYS_FILE && eval $compile; then
12051         h_sysfile=true;
12052         echo "<sys/file.h> defines the O_* constants..." >&4
12053         if $run ./try; then
12054                 echo "and you have the 3 argument form of open()." >&4
12055                 val="$define"
12056         else
12057                 echo "but not the 3 argument form of open().  Oh, well." >&4
12058                 val="$undef"
12059         fi
12060 elif $test `./findhdr fcntl.h` && \
12061                 set try -DI_FCNTL && eval $compile; then
12062         h_fcntl=true;
12063         echo "<fcntl.h> defines the O_* constants..." >&4
12064         if $run ./try; then
12065                 echo "and you have the 3 argument form of open()." >&4
12066                 val="$define"
12067         else
12068                 echo "but not the 3 argument form of open().  Oh, well." >&4
12069                 val="$undef"
12070         fi
12071 else
12072         val="$undef"
12073         echo "I can't find the O_* constant definitions!  You got problems." >&4
12074 fi
12075 set d_open3
12076 eval $setvar
12077 $rm -f try try.*
12078
12079 : see which of string.h or strings.h is needed
12080 echo " "
12081 strings=`./findhdr string.h`
12082 if $test "$strings" && $test -r "$strings"; then
12083         echo "Using <string.h> instead of <strings.h>." >&4
12084         val="$define"
12085 else
12086         val="$undef"
12087         strings=`./findhdr strings.h`
12088         if $test "$strings" && $test -r "$strings"; then
12089                 echo "Using <strings.h> instead of <string.h>." >&4
12090         else
12091                 echo "No string header found -- You'll surely have problems." >&4
12092         fi
12093 fi
12094 set i_string
12095 eval $setvar
12096 case "$i_string" in
12097 "$undef") strings=`./findhdr strings.h`;;
12098 *)        strings=`./findhdr string.h`;;
12099 esac
12100
12101 : see if this is a sys/file.h system
12102 val=''
12103 set sys/file.h val
12104 eval $inhdr
12105
12106 : do we need to include sys/file.h ?
12107 case "$val" in
12108 "$define")
12109         echo " "
12110         if $h_sysfile; then
12111                 val="$define"
12112                 echo "We'll be including <sys/file.h>." >&4
12113         else
12114                 val="$undef"
12115                 echo "We won't be including <sys/file.h>." >&4
12116         fi
12117         ;;
12118 *)
12119         h_sysfile=false
12120         ;;
12121 esac
12122 set i_sysfile
12123 eval $setvar
12124
12125 : see if fcntl.h is there
12126 val=''
12127 set fcntl.h val
12128 eval $inhdr
12129
12130 : see if we can include fcntl.h
12131 case "$val" in
12132 "$define")
12133         echo " "
12134         if $h_fcntl; then
12135                 val="$define"
12136                 echo "We'll be including <fcntl.h>." >&4
12137         else
12138                 val="$undef"
12139                 if $h_sysfile; then
12140         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12141                 else
12142                         echo "We won't be including <fcntl.h>." >&4
12143                 fi
12144         fi
12145         ;;
12146 *)
12147         h_fcntl=false
12148         val="$undef"
12149         ;;
12150 esac
12151 set i_fcntl
12152 eval $setvar
12153
12154 : check for non-blocking I/O stuff
12155 case "$h_sysfile" in
12156 true) echo "#include <sys/file.h>" > head.c;;
12157 *)
12158        case "$h_fcntl" in
12159        true) echo "#include <fcntl.h>" > head.c;;
12160        *) echo "#include <sys/fcntl.h>" > head.c;;
12161        esac
12162        ;;
12163 esac
12164 echo " "
12165 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12166 case "$o_nonblock" in
12167 '')
12168         $cat head.c > try.c
12169         $cat >>try.c <<EOCP
12170 #include <stdio.h>
12171 #$i_stdlib I_STDLIB
12172 #ifdef I_STDLIB
12173 #include <stdlib.h>
12174 #endif
12175 #$i_fcntl I_FCNTL
12176 #ifdef I_FCNTL
12177 #include <fcntl.h>
12178 #endif
12179 int main() {
12180 #ifdef O_NONBLOCK
12181         printf("O_NONBLOCK\n");
12182         exit(0);
12183 #endif
12184 #ifdef O_NDELAY
12185         printf("O_NDELAY\n");
12186         exit(0);
12187 #endif
12188 #ifdef FNDELAY
12189         printf("FNDELAY\n");
12190         exit(0);
12191 #endif
12192         exit(0);
12193 }
12194 EOCP
12195         set try
12196         if eval $compile_ok; then
12197                 o_nonblock=`$run ./try`
12198                 case "$o_nonblock" in
12199                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12200                 *) echo "Seems like we can use $o_nonblock.";;
12201                 esac
12202         else
12203                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12204         fi
12205         ;;
12206 *) echo "Using $hint value $o_nonblock.";;
12207 esac
12208 $rm -f try try.* .out core
12209
12210 echo " "
12211 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12212 case "$eagain" in
12213 '')
12214         $cat head.c > try.c
12215         $cat >>try.c <<EOCP
12216 #include <errno.h>
12217 #include <sys/types.h>
12218 #include <signal.h>
12219 #include <stdio.h> 
12220 #$i_stdlib I_STDLIB
12221 #ifdef I_STDLIB
12222 #include <stdlib.h>
12223 #endif
12224 #$i_fcntl I_FCNTL
12225 #ifdef I_FCNTL
12226 #include <fcntl.h>
12227 #endif
12228 #define MY_O_NONBLOCK $o_nonblock
12229 #ifndef errno  /* XXX need better Configure test */
12230 extern int errno;
12231 #endif
12232 #$i_unistd I_UNISTD
12233 #ifdef I_UNISTD
12234 #include <unistd.h>
12235 #endif
12236 #$i_string I_STRING
12237 #ifdef I_STRING
12238 #include <string.h>
12239 #else
12240 #include <strings.h>
12241 #endif
12242 $signal_t blech(int x) { exit(3); }
12243 EOCP
12244         $cat >> try.c <<'EOCP'
12245 int main()
12246 {
12247         int pd[2];
12248         int pu[2];
12249         char buf[1];
12250         char string[100];
12251
12252         pipe(pd);       /* Down: child -> parent */
12253         pipe(pu);       /* Up: parent -> child */
12254         if (0 != fork()) {
12255                 int ret;
12256                 close(pd[1]);   /* Parent reads from pd[0] */
12257                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12258 #ifdef F_SETFL
12259                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12260                         exit(1);
12261 #else
12262                 exit(4);
12263 #endif
12264                 signal(SIGALRM, blech);
12265                 alarm(5);
12266                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12267                         exit(2);
12268                 sprintf(string, "%d\n", ret);
12269                 write(2, string, strlen(string));
12270                 alarm(0);
12271 #ifdef EAGAIN
12272                 if (errno == EAGAIN) {
12273                         printf("EAGAIN\n");
12274                         goto ok;
12275                 }
12276 #endif
12277 #ifdef EWOULDBLOCK
12278                 if (errno == EWOULDBLOCK)
12279                         printf("EWOULDBLOCK\n");
12280 #endif
12281         ok:
12282                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12283                 sleep(2);                               /* Give it time to close our pipe */
12284                 alarm(5);
12285                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12286                 alarm(0);
12287                 sprintf(string, "%d\n", ret);
12288                 write(4, string, strlen(string));
12289                 exit(0);
12290         }
12291
12292         close(pd[0]);                   /* We write to pd[1] */
12293         close(pu[1]);                   /* We read from pu[0] */
12294         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12295         close(pd[1]);                   /* Pipe pd is now fully closed! */
12296         exit(0);                                /* Bye bye, thank you for playing! */
12297 }
12298 EOCP
12299         set try
12300         if eval $compile_ok; then
12301                 echo "$startsh" >mtry
12302                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12303                 chmod +x mtry
12304                 ./mtry >/dev/null 2>&1
12305                 case $? in
12306                 0) eagain=`$cat try.out`;;
12307                 1) echo "Could not perform non-blocking setting!";;
12308                 2) echo "I did a successful read() for something that was not there!";;
12309                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12310                 4) echo "Could not find F_SETFL!";;
12311                 *) echo "Something terribly wrong happened during testing.";;
12312                 esac
12313                 rd_nodata=`$cat try.ret`
12314                 echo "A read() system call with no data present returns $rd_nodata."
12315                 case "$rd_nodata" in
12316                 0|-1) ;;
12317                 *)
12318                         echo "(That's peculiar, fixing that to be -1.)"
12319                         rd_nodata=-1
12320                         ;;
12321                 esac
12322                 case "$eagain" in
12323                 '')
12324                         echo "Forcing errno EAGAIN on read() with no data available."
12325                         eagain=EAGAIN
12326                         ;;
12327                 *)
12328                         echo "Your read() sets errno to $eagain when no data is available."
12329                         ;;
12330                 esac
12331                 status=`$cat try.err`
12332                 case "$status" in
12333                 0) echo "And it correctly returns 0 to signal EOF.";;
12334                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12335                 *) echo "However, your read() returns '$status' on EOF??";;
12336                 esac
12337                 val="$define"
12338                 if test "$status" = "$rd_nodata"; then
12339                         echo "WARNING: you can't distinguish between EOF and no data!"
12340                         val="$undef"
12341                 fi
12342         else
12343                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12344                 eagain=EAGAIN
12345         fi
12346         set d_eofnblk
12347         eval $setvar
12348         ;;
12349 *)
12350         echo "Using $hint value $eagain."
12351         echo "Your read() returns $rd_nodata when no data is present."
12352         case "$d_eofnblk" in
12353         "$define") echo "And you can see EOF because read() returns 0.";;
12354         "$undef") echo "But you can't see EOF status from read() returned value.";;
12355         *)
12356                 echo "(Assuming you can't see EOF status from read anyway.)"
12357                 d_eofnblk=$undef
12358                 ;;
12359         esac
12360         ;;
12361 esac
12362 $rm -f try try.* .out core head.c mtry
12363
12364 : see if _ptr and _cnt from stdio act std
12365 echo " "
12366
12367 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12368         echo "(Looks like you have stdio.h from BSD.)"
12369         case "$stdio_ptr" in
12370         '') stdio_ptr='((fp)->_p)'
12371                 ptr_lval=$define
12372                 ;;
12373         *)      ptr_lval=$d_stdio_ptr_lval;;
12374         esac
12375         case "$stdio_cnt" in
12376         '') stdio_cnt='((fp)->_r)'
12377                 cnt_lval=$define
12378                 ;;
12379         *)      cnt_lval=$d_stdio_cnt_lval;;
12380         esac
12381         case "$stdio_base" in
12382         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12383         esac
12384         case "$stdio_bufsiz" in
12385         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12386         esac
12387 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12388         echo "(Looks like you have stdio.h from Linux.)"
12389         case "$stdio_ptr" in
12390         '') stdio_ptr='((fp)->_IO_read_ptr)'
12391                 ptr_lval=$define
12392                 ;;
12393         *)      ptr_lval=$d_stdio_ptr_lval;;
12394         esac
12395         case "$stdio_cnt" in
12396         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12397                 cnt_lval=$undef
12398                 ;;
12399         *)      cnt_lval=$d_stdio_cnt_lval;;
12400         esac
12401         case "$stdio_base" in
12402         '') stdio_base='((fp)->_IO_read_base)';;
12403         esac
12404         case "$stdio_bufsiz" in
12405         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12406         esac
12407 else
12408         case "$stdio_ptr" in
12409         '') stdio_ptr='((fp)->_ptr)'
12410                 ptr_lval=$define
12411                 ;;
12412         *)      ptr_lval=$d_stdio_ptr_lval;;
12413         esac
12414         case "$stdio_cnt" in
12415         '') stdio_cnt='((fp)->_cnt)'
12416                 cnt_lval=$define
12417                 ;;
12418         *)      cnt_lval=$d_stdio_cnt_lval;;
12419         esac
12420         case "$stdio_base" in
12421         '') stdio_base='((fp)->_base)';;
12422         esac
12423         case "$stdio_bufsiz" in
12424         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12425         esac
12426 fi
12427
12428 : test whether _ptr and _cnt really work
12429 echo "Checking how std your stdio is..." >&4
12430 $cat >try.c <<EOP
12431 #include <stdio.h>
12432 #$i_stdlib I_STDLIB
12433 #ifdef I_STDLIB
12434 #include <stdlib.h>
12435 #endif
12436 #define FILE_ptr(fp)    $stdio_ptr
12437 #define FILE_cnt(fp)    $stdio_cnt
12438 int main() {
12439         FILE *fp = fopen("try.c", "r");
12440         char c = getc(fp);
12441         if (
12442                 18 <= FILE_cnt(fp) &&
12443                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12444         )
12445                 exit(0);
12446         exit(1);
12447 }
12448 EOP
12449 val="$undef"
12450 set try
12451 if eval $compile && $to try.c; then
12452         if $run ./try; then
12453                 echo "Your stdio acts pretty std."
12454                 val="$define"
12455         else
12456                 echo "Your stdio isn't very std."
12457         fi
12458 else
12459         echo "Your stdio doesn't appear very std."
12460 fi
12461 $rm -f try.c try
12462
12463 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12464 # direct buffer manipulation no longer works.  The Configure tests
12465 # should be changed to correctly detect this, but until then,
12466 # the following check should at least let perl compile and run.
12467 # (This quick fix should be updated before 5.8.1.)
12468 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12469 # A. Dougherty, June 3, 2002.
12470 case "$d_gnulibc" in
12471 $define)
12472         case "$gnulibc_version" in
12473         2.[01]*)  ;;
12474         2.2) ;;
12475         2.2.[0-9]) ;;
12476         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12477                 val="$undef"
12478                 ;;
12479         esac
12480         ;;
12481 esac
12482 set d_stdstdio
12483 eval $setvar
12484
12485 : Can _ptr be used as an lvalue?
12486 case "$d_stdstdio$ptr_lval" in
12487 $define$define) val=$define ;;
12488 *) val=$undef ;;
12489 esac
12490 set d_stdio_ptr_lval
12491 eval $setvar
12492
12493 : Can _cnt be used as an lvalue?
12494 case "$d_stdstdio$cnt_lval" in
12495 $define$define) val=$define ;;
12496 *) val=$undef ;;
12497 esac
12498 set d_stdio_cnt_lval
12499 eval $setvar
12500
12501
12502 : test whether setting _ptr sets _cnt as a side effect
12503 d_stdio_ptr_lval_sets_cnt="$undef"
12504 d_stdio_ptr_lval_nochange_cnt="$undef"
12505 case "$d_stdio_ptr_lval$d_stdstdio" in
12506 $define$define)
12507         echo "Checking to see what happens if we set the stdio ptr..." >&4
12508 $cat >try.c <<EOP
12509 #include <stdio.h>
12510 /* Can we scream? */
12511 /* Eat dust sed :-) */
12512 /* In the buffer space, no one can hear you scream. */
12513 #$i_stdlib I_STDLIB
12514 #ifdef I_STDLIB
12515 #include <stdlib.h>
12516 #endif
12517 #define FILE_ptr(fp)    $stdio_ptr
12518 #define FILE_cnt(fp)    $stdio_cnt
12519 #include <sys/types.h>
12520 int main() {
12521         FILE *fp = fopen("try.c", "r");
12522         int c;
12523         char *ptr;
12524         size_t cnt;
12525         if (!fp) {
12526             puts("Fail even to read");
12527             exit(1);
12528         }
12529         c = getc(fp); /* Read away the first # */
12530         if (c == EOF) {
12531             puts("Fail even to read");
12532             exit(1);
12533         }
12534         if (!(
12535                 18 <= FILE_cnt(fp) &&
12536                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12537         )) {
12538                 puts("Fail even to read");
12539                 exit (1);
12540         }
12541         ptr = (char*) FILE_ptr(fp);
12542         cnt = (size_t)FILE_cnt(fp);
12543
12544         FILE_ptr(fp) += 42;
12545
12546         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12547                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12548                 exit (1);
12549         }
12550         if (FILE_cnt(fp) <= 20) {
12551                 printf ("Fail (<20 chars to test)");
12552                 exit (1);
12553         }
12554         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12555                 puts("Fail compare");
12556                 exit (1);
12557         }
12558         if (cnt == FILE_cnt(fp)) {
12559                 puts("Pass_unchanged");
12560                 exit (0);
12561         }       
12562         if (FILE_cnt(fp) == (cnt - 42)) {
12563                 puts("Pass_changed");
12564                 exit (0);
12565         }
12566         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12567         return 1;
12568
12569 }
12570 EOP
12571         set try
12572         if eval $compile && $to try.c; then
12573                 case `$run ./try` in
12574                 Pass_changed)
12575                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12576                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12577                 Pass_unchanged)
12578                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12579                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12580                 Fail*)
12581                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12582                 *)
12583                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12584         esac
12585         else
12586                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12587         fi
12588         $rm -f try.c try
12589         ;;
12590 esac
12591
12592 : see if _base is also standard
12593 val="$undef"
12594 case "$d_stdstdio" in
12595 $define)
12596         $cat >try.c <<EOP
12597 #include <stdio.h>
12598 #$i_stdlib I_STDLIB
12599 #ifdef I_STDLIB
12600 #include <stdlib.h>
12601 #endif
12602 #define FILE_base(fp)   $stdio_base
12603 #define FILE_bufsiz(fp) $stdio_bufsiz
12604 int main() {
12605         FILE *fp = fopen("try.c", "r");
12606         char c = getc(fp);
12607         if (
12608                 19 <= FILE_bufsiz(fp) &&
12609                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12610         )
12611                 exit(0);
12612         exit(1);
12613 }
12614 EOP
12615         set try
12616         if eval $compile && $to try.c; then
12617                 if $run ./try; then
12618                         echo "And its _base field acts std."
12619                         val="$define"
12620                 else
12621                         echo "But its _base field isn't std."
12622                 fi
12623         else
12624                 echo "However, it seems to be lacking the _base field."
12625         fi
12626         $rm -f try.c try
12627         ;;
12628 esac
12629 set d_stdiobase
12630 eval $setvar
12631
12632 : see if fast_stdio exists
12633 val="$undef"
12634 case "$d_stdstdio:$d_stdio_ptr_lval" in
12635 "$define:$define")
12636         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12637         *$define*)
12638                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12639                 val="$define"
12640                 ;;
12641         esac
12642         ;;
12643 esac
12644 set d_faststdio
12645 eval $setvar
12646
12647
12648
12649 : see if fchdir exists
12650 set fchdir d_fchdir
12651 eval $inlibc
12652
12653 : see if fchmod exists
12654 set fchmod d_fchmod
12655 eval $inlibc
12656
12657 : see if fchown exists
12658 set fchown d_fchown
12659 eval $inlibc
12660
12661 : see if this is an fcntl system
12662 set fcntl d_fcntl
12663 eval $inlibc
12664
12665 echo " "
12666 : See if fcntl-based locking works.
12667 $cat >try.c <<EOCP
12668 #$i_stdlib I_STDLIB
12669 #ifdef I_STDLIB
12670 #include <stdlib.h>
12671 #endif
12672 #include <unistd.h>
12673 #include <fcntl.h>
12674 #include <signal.h>
12675 $signal_t blech(int x) { exit(3); }
12676 int main() {
12677 #if defined(F_SETLK) && defined(F_SETLKW)
12678      struct flock flock;
12679      int retval, fd;
12680      fd = open("try.c", O_RDONLY);
12681      flock.l_type = F_RDLCK;
12682      flock.l_whence = SEEK_SET;
12683      flock.l_start = flock.l_len = 0;
12684      signal(SIGALRM, blech);
12685      alarm(10);
12686      retval = fcntl(fd, F_SETLK, &flock);
12687      close(fd);
12688      (retval < 0 ? exit(2) : exit(0));
12689 #else
12690      exit(2);
12691 #endif
12692 }
12693 EOCP
12694 echo "Checking if fcntl-based file locking works... "
12695 case "$d_fcntl" in
12696 "$define")
12697         set try
12698         if eval $compile_ok; then
12699                 if $run ./try; then
12700                         echo "Yes, it seems to work."
12701                         val="$define"
12702                 else
12703                         echo "Nope, it didn't work."
12704                         val="$undef"
12705                         case "$?" in
12706                         3) $cat >&4 <<EOM
12707 ***
12708 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12709 *** This is (almost) impossible.
12710 *** If your NFS lock daemons are not feeling well, something like
12711 *** this may happen, please investigate.  Cannot continue, aborting.
12712 ***
12713 EOM
12714                                 exit 1
12715                                 ;;
12716                         esac
12717                 fi
12718         else
12719                 echo "I'm unable to compile the test program, so I'll assume not."
12720                 val="$undef"
12721         fi
12722         ;;
12723 *) val="$undef";
12724         echo "Nope, since you don't even have fcntl()."
12725         ;;
12726 esac
12727 set d_fcntl_can_lock
12728 eval $setvar
12729 $rm -f try*
12730
12731
12732 : check for fd_set items
12733 $cat <<EOM
12734
12735 Checking to see how well your C compiler handles fd_set and friends ...
12736 EOM
12737 $cat >try.c <<EOCP
12738 #$i_stdlib I_STDLIB
12739 #ifdef I_STDLIB
12740 #include <stdlib.h>
12741 #endif
12742 #$i_systime I_SYS_TIME
12743 #$i_sysselct I_SYS_SELECT
12744 #$d_socket HAS_SOCKET
12745 #include <sys/types.h>
12746 #ifdef HAS_SOCKET
12747 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12748 #endif
12749 #ifdef I_SYS_TIME
12750 #include <sys/time.h>
12751 #endif
12752 #ifdef I_SYS_SELECT
12753 #include <sys/select.h>
12754 #endif
12755 int main() {
12756         fd_set fds;
12757
12758 #ifdef TRYBITS
12759         if(fds.fds_bits);
12760 #endif
12761
12762 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12763         exit(0);
12764 #else
12765         exit(1);
12766 #endif
12767 }
12768 EOCP
12769 set try -DTRYBITS
12770 if eval $compile; then
12771         d_fds_bits="$define"
12772         d_fd_set="$define"
12773         echo "Well, your system knows about the normal fd_set typedef..." >&4
12774         if $run ./try; then
12775                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12776                 d_fd_macros="$define"
12777         else
12778                 $cat >&4 <<'EOM'
12779 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12780 EOM
12781                 d_fd_macros="$undef"
12782         fi
12783 else
12784         $cat <<'EOM'
12785 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12786 EOM
12787         set try
12788         if eval $compile; then
12789                 d_fds_bits="$undef"
12790                 d_fd_set="$define"
12791                 echo "Well, your system has some sort of fd_set available..." >&4
12792                 if $run ./try; then
12793                         echo "and you have the normal fd_set macros." >&4
12794                         d_fd_macros="$define"
12795                 else
12796                         $cat <<'EOM'
12797 but not the normal fd_set macros!  Gross!  More work for me...
12798 EOM
12799                         d_fd_macros="$undef"
12800                 fi
12801         else
12802         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12803                 d_fd_set="$undef"
12804                 d_fds_bits="$undef"
12805                 d_fd_macros="$undef"
12806         fi
12807 fi
12808 $rm -f try try.*
12809
12810 : see if fgetpos exists
12811 set fgetpos d_fgetpos
12812 eval $inlibc
12813
12814 : see if finite exists
12815 set finite d_finite
12816 eval $inlibc
12817
12818 : see if finitel exists
12819 set finitel d_finitel
12820 eval $inlibc
12821
12822 : see if flock exists
12823 set flock d_flock
12824 eval $inlibc
12825
12826 : see if prototype for flock is available
12827 echo " "
12828 set d_flockproto flock $i_sysfile sys/file.h
12829 eval $hasproto
12830
12831 : see if fork exists
12832 set fork d_fork
12833 eval $inlibc
12834
12835 : see if fp_class exists
12836 set fp_class d_fp_class
12837 eval $inlibc
12838
12839 : see if pathconf exists
12840 set pathconf d_pathconf
12841 eval $inlibc
12842
12843 : see if fpathconf exists
12844 set fpathconf d_fpathconf
12845 eval $inlibc
12846
12847 : see if fpclass exists
12848 set fpclass d_fpclass
12849 eval $inlibc
12850
12851 : see if fpclassify exists
12852 set fpclassify d_fpclassify
12853 eval $inlibc
12854
12855 : see if fpclassl exists
12856 set fpclassl d_fpclassl
12857 eval $inlibc
12858
12859
12860 : check for fpos64_t
12861 echo " "
12862 echo "Checking to see if you have fpos64_t..." >&4
12863 $cat >try.c <<EOCP
12864 #include <stdio.h>
12865 int main() { fpos64_t x = 7; }
12866 EOCP
12867 set try
12868 if eval $compile; then
12869         val="$define"
12870         echo "You have fpos64_t."
12871 else
12872         val="$undef"
12873         echo "You do not have fpos64_t."
12874         case "$fpossize" in
12875         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12876         esac
12877 fi
12878 $rm -f try.* try
12879 set d_fpos64_t
12880 eval $setvar
12881
12882 : see if frexpl exists
12883 set frexpl d_frexpl
12884 eval $inlibc
12885
12886 : see if this is a sys/param system
12887 set sys/param.h i_sysparam
12888 eval $inhdr
12889
12890 : see if this is a sys/mount.h system
12891 set sys/mount.h i_sysmount
12892 eval $inhdr
12893
12894
12895 echo " "
12896 echo "Checking to see if your system supports struct fs_data..." >&4
12897 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12898 eval $hasstruct
12899 case "$d_fs_data_s" in
12900 "$define")      echo "Yes, it does."   ;;
12901 *)              echo "No, it doesn't." ;;
12902 esac
12903
12904 : see if fseeko exists
12905 set fseeko d_fseeko
12906 eval $inlibc
12907 case "$longsize" in
12908 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12909 esac
12910
12911 : see if fsetpos exists
12912 set fsetpos d_fsetpos
12913 eval $inlibc
12914
12915
12916 : see if fstatfs exists
12917 set fstatfs d_fstatfs
12918 eval $inlibc
12919
12920
12921 : see if statvfs exists
12922 set statvfs d_statvfs
12923 eval $inlibc
12924
12925 : see if fstatvfs exists
12926 set fstatvfs d_fstatvfs
12927 eval $inlibc
12928
12929
12930 : see if fsync exists
12931 set fsync d_fsync
12932 eval $inlibc
12933
12934 : see if ftello exists
12935 set ftello d_ftello
12936 eval $inlibc
12937 case "$longsize" in
12938 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12939 esac
12940
12941 d_futimes="$undef"
12942 : check for a working futimes
12943 echo " "
12944 echo "Checking for a working futimes()" >&4
12945 $cat >try.c <<EOCP
12946 #include <stdio.h>
12947 #include <sys/time.h>
12948 #include <errno.h>
12949 #include <fcntl.h>
12950
12951 int main ()
12952 {
12953     int fd, rv;
12954     fd = open ("try.c", O_RDWR);
12955     if (-1 == fd) exit (1);
12956     rv = futimes (fd, NULL);
12957     exit (rv == -1 ? errno : 0);
12958 }
12959 EOCP
12960 set try
12961 if eval $compile; then
12962     `$run ./try`
12963     rc=$?
12964     case "$rc" in
12965         0)  echo "Yes, it does" >&4
12966             d_futimes="$define"
12967             ;;
12968         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12969             ;;
12970     esac
12971 else
12972     echo "No, it does not (probably harmless)\n" >&4
12973 fi
12974 $rm -f try.* try core core.try.*
12975
12976 : see if getcwd exists
12977 set getcwd d_getcwd
12978 eval $inlibc
12979
12980 : see if getespwnam exists
12981 set getespwnam d_getespwnam
12982 eval $inlibc
12983
12984
12985 : see if getfsstat exists
12986 set getfsstat d_getfsstat
12987 eval $inlibc
12988
12989 : see if getgrent exists
12990 set getgrent d_getgrent
12991 eval $inlibc
12992
12993 : see if getgrent_r exists
12994 set getgrent_r d_getgrent_r
12995 eval $inlibc
12996 case "$d_getgrent_r" in
12997 "$define")
12998         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12999         case "$d_getgrent_r_proto:$usethreads" in
13000         ":define")      d_getgrent_r_proto=define
13001                 set d_getgrent_r_proto getgrent_r $hdrs
13002                 eval $hasproto ;;
13003         *)      ;;
13004         esac
13005         case "$d_getgrent_r_proto" in
13006         define)
13007         case "$getgrent_r_proto" in
13008         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13009         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13010         esac
13011         case "$getgrent_r_proto" in
13012         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13013         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13014         esac
13015         case "$getgrent_r_proto" in
13016         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13017         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13018         esac
13019         case "$getgrent_r_proto" in
13020         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13021         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13022         esac
13023         case "$getgrent_r_proto" in
13024         ''|0) try='int getgrent_r(struct group*, char*, int);'
13025         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13026         esac
13027         case "$getgrent_r_proto" in
13028         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13029         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13030         esac
13031         case "$getgrent_r_proto" in
13032         ''|0)   d_getgrent_r=undef
13033                 getgrent_r_proto=0
13034                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13035         * )     case "$getgrent_r_proto" in
13036                 REENTRANT_PROTO*) ;;
13037                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13038                 esac
13039                 echo "Prototype: $try" ;;
13040         esac
13041         ;;
13042         *)      case "$usethreads" in
13043                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13044                 esac
13045                 d_getgrent_r=undef
13046                 getgrent_r_proto=0
13047                 ;;
13048         esac
13049         ;;
13050 *)      getgrent_r_proto=0
13051         ;;
13052 esac
13053
13054 : see if getgrgid_r exists
13055 set getgrgid_r d_getgrgid_r
13056 eval $inlibc
13057 case "$d_getgrgid_r" in
13058 "$define")
13059         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13060         case "$d_getgrgid_r_proto:$usethreads" in
13061         ":define")      d_getgrgid_r_proto=define
13062                 set d_getgrgid_r_proto getgrgid_r $hdrs
13063                 eval $hasproto ;;
13064         *)      ;;
13065         esac
13066         case "$d_getgrgid_r_proto" in
13067         define)
13068         case "$getgrgid_r_proto" in
13069         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13070         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13071         esac
13072         case "$getgrgid_r_proto" in
13073         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13074         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13075         esac
13076         case "$getgrgid_r_proto" in
13077         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13078         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13079         esac
13080         case "$getgrgid_r_proto" in
13081         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13082         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13083         esac
13084         case "$getgrgid_r_proto" in
13085         ''|0)   d_getgrgid_r=undef
13086                 getgrgid_r_proto=0
13087                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13088         * )     case "$getgrgid_r_proto" in
13089                 REENTRANT_PROTO*) ;;
13090                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13091                 esac
13092                 echo "Prototype: $try" ;;
13093         esac
13094         ;;
13095         *)      case "$usethreads" in
13096                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13097                 esac
13098                 d_getgrgid_r=undef
13099                 getgrgid_r_proto=0
13100                 ;;
13101         esac
13102         ;;
13103 *)      getgrgid_r_proto=0
13104         ;;
13105 esac
13106
13107 : see if getgrnam_r exists
13108 set getgrnam_r d_getgrnam_r
13109 eval $inlibc
13110 case "$d_getgrnam_r" in
13111 "$define")
13112         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13113         case "$d_getgrnam_r_proto:$usethreads" in
13114         ":define")      d_getgrnam_r_proto=define
13115                 set d_getgrnam_r_proto getgrnam_r $hdrs
13116                 eval $hasproto ;;
13117         *)      ;;
13118         esac
13119         case "$d_getgrnam_r_proto" in
13120         define)
13121         case "$getgrnam_r_proto" in
13122         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13123         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13124         esac
13125         case "$getgrnam_r_proto" in
13126         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13127         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13128         esac
13129         case "$getgrnam_r_proto" in
13130         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13131         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13132         esac
13133         case "$getgrnam_r_proto" in
13134         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13135         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13136         esac
13137         case "$getgrnam_r_proto" in
13138         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13139         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13140         esac
13141         case "$getgrnam_r_proto" in
13142         ''|0)   d_getgrnam_r=undef
13143                 getgrnam_r_proto=0
13144                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13145         * )     case "$getgrnam_r_proto" in
13146                 REENTRANT_PROTO*) ;;
13147                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13148                 esac
13149                 echo "Prototype: $try" ;;
13150         esac
13151         ;;
13152         *)      case "$usethreads" in
13153                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13154                 esac
13155                 d_getgrnam_r=undef
13156                 getgrnam_r_proto=0
13157                 ;;
13158         esac
13159         ;;
13160 *)      getgrnam_r_proto=0
13161         ;;
13162 esac
13163
13164 : see if gethostbyaddr exists
13165 set gethostbyaddr d_gethbyaddr
13166 eval $inlibc
13167
13168 : see if gethostbyname exists
13169 set gethostbyname d_gethbyname
13170 eval $inlibc
13171
13172 : see if gethostent exists
13173 set gethostent d_gethent
13174 eval $inlibc
13175
13176 : see how we will look up host name
13177 echo " "
13178 call=''
13179 if set gethostname val -f d_gethname; eval $csym; $val; then
13180         echo 'gethostname() found.' >&4
13181         d_gethname="$define"
13182         call=gethostname
13183 fi
13184 if set uname val -f d_uname; eval $csym; $val; then
13185         if ./xenix; then
13186                 $cat <<'EOM'
13187 uname() was found, but you're running xenix, and older versions of xenix
13188 have a broken uname(). If you don't really know whether your xenix is old
13189 enough to have a broken system call, use the default answer.
13190
13191 EOM
13192                 dflt=y
13193                 case "$d_uname" in
13194                 "$define") dflt=n;;
13195                 esac
13196                 rp='Is your uname() broken?'
13197                 . ./myread
13198                 case "$ans" in
13199                 n*) d_uname="$define"; call=uname;;
13200                 esac
13201         else
13202                 echo 'uname() found.' >&4
13203                 d_uname="$define"
13204                 case "$call" in
13205                 '') call=uname ;;
13206                 esac
13207         fi
13208 fi
13209 case "$d_gethname" in
13210 '') d_gethname="$undef";;
13211 esac
13212 case "$d_uname" in
13213 '') d_uname="$undef";;
13214 esac
13215 case "$d_uname$d_gethname" in
13216 *define*)
13217         dflt=n
13218         cat <<EOM
13219  
13220 Every now and then someone has a $call() that lies about the hostname
13221 but can't be fixed for political or economic reasons.  If you wish, I can
13222 pretend $call() isn't there and maybe compute hostname at run-time
13223 thanks to the '$phostname' command.
13224
13225 EOM
13226         rp="Shall I ignore $call() from now on?"
13227         . ./myread
13228         case "$ans" in
13229         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13230         esac;;
13231 esac
13232 case "$phostname" in
13233 '') aphostname='';;
13234 *) case "$aphostname" in
13235         /*) ;;
13236         *) set X $phostname
13237                 shift
13238                 file=$1
13239                 shift
13240                 file=`./loc $file $file $pth`
13241                 aphostname=`echo $file $*`
13242                 ;;
13243         esac
13244         ;;
13245 esac
13246 case "$d_uname$d_gethname" in
13247 *define*) ;;
13248 *)
13249         case "$phostname" in
13250         '')
13251                 echo "There will be no way for $package to get your hostname." >&4;;
13252         *)
13253         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13254                 ;;
13255         esac;;
13256 esac
13257 case "$d_phostname" in
13258 '') d_phostname="$undef";;
13259 esac
13260
13261 : see if gethostbyaddr_r exists
13262 set gethostbyaddr_r d_gethostbyaddr_r
13263 eval $inlibc
13264 case "$d_gethostbyaddr_r" in
13265 "$define")
13266         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13267         case "$d_gethostbyaddr_r_proto:$usethreads" in
13268         ":define")      d_gethostbyaddr_r_proto=define
13269                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13270                 eval $hasproto ;;
13271         *)      ;;
13272         esac
13273         case "$d_gethostbyaddr_r_proto" in
13274         define)
13275         case "$gethostbyaddr_r_proto" in
13276         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13277         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13278         esac
13279         case "$gethostbyaddr_r_proto" in
13280         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13281         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13282         esac
13283         case "$gethostbyaddr_r_proto" in
13284         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13285         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13286         esac
13287         case "$gethostbyaddr_r_proto" in
13288         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13289         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13290         esac
13291         case "$gethostbyaddr_r_proto" in
13292         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13293         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13294         esac
13295         case "$gethostbyaddr_r_proto" in
13296         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13297         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13298         esac
13299         case "$gethostbyaddr_r_proto" in
13300         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13301         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13302         esac
13303         case "$gethostbyaddr_r_proto" in
13304         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13305         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13306         esac
13307         case "$gethostbyaddr_r_proto" in
13308         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13309         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13310         esac
13311         case "$gethostbyaddr_r_proto" in
13312         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13313         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13314         esac
13315         case "$gethostbyaddr_r_proto" in
13316         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13317         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13318         esac
13319         case "$gethostbyaddr_r_proto" in
13320         ''|0)   d_gethostbyaddr_r=undef
13321                 gethostbyaddr_r_proto=0
13322                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13323         * )     case "$gethostbyaddr_r_proto" in
13324                 REENTRANT_PROTO*) ;;
13325                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13326                 esac
13327                 echo "Prototype: $try" ;;
13328         esac
13329         ;;
13330         *)      case "$usethreads" in
13331                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13332                 esac
13333                 d_gethostbyaddr_r=undef
13334                 gethostbyaddr_r_proto=0
13335                 ;;
13336         esac
13337         ;;
13338 *)      gethostbyaddr_r_proto=0
13339         ;;
13340 esac
13341
13342 : see if gethostbyname_r exists
13343 set gethostbyname_r d_gethostbyname_r
13344 eval $inlibc
13345 case "$d_gethostbyname_r" in
13346 "$define")
13347         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13348         case "$d_gethostbyname_r_proto:$usethreads" in
13349         ":define")      d_gethostbyname_r_proto=define
13350                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13351                 eval $hasproto ;;
13352         *)      ;;
13353         esac
13354         case "$d_gethostbyname_r_proto" in
13355         define)
13356         case "$gethostbyname_r_proto" in
13357         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13358         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13359         esac
13360         case "$gethostbyname_r_proto" in
13361         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13362         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13363         esac
13364         case "$gethostbyname_r_proto" in
13365         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13366         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13367         esac
13368         case "$gethostbyname_r_proto" in
13369         ''|0)   d_gethostbyname_r=undef
13370                 gethostbyname_r_proto=0
13371                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13372         * )     case "$gethostbyname_r_proto" in
13373                 REENTRANT_PROTO*) ;;
13374                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13375                 esac
13376                 echo "Prototype: $try" ;;
13377         esac
13378         ;;
13379         *)      case "$usethreads" in
13380                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13381                 esac
13382                 d_gethostbyname_r=undef
13383                 gethostbyname_r_proto=0
13384                 ;;
13385         esac
13386         ;;
13387 *)      gethostbyname_r_proto=0
13388         ;;
13389 esac
13390
13391 : see if gethostent_r exists
13392 set gethostent_r d_gethostent_r
13393 eval $inlibc
13394 case "$d_gethostent_r" in
13395 "$define")
13396         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13397         case "$d_gethostent_r_proto:$usethreads" in
13398         ":define")      d_gethostent_r_proto=define
13399                 set d_gethostent_r_proto gethostent_r $hdrs
13400                 eval $hasproto ;;
13401         *)      ;;
13402         esac
13403         case "$d_gethostent_r_proto" in
13404         define)
13405         case "$gethostent_r_proto" in
13406         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13407         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13408         esac
13409         case "$gethostent_r_proto" in
13410         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13411         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13412         esac
13413         case "$gethostent_r_proto" in
13414         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13415         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13416         esac
13417         case "$gethostent_r_proto" in
13418         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13419         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13420         esac
13421         case "$gethostent_r_proto" in
13422         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13423         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13424         esac
13425         case "$gethostent_r_proto" in
13426         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13427         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13428         esac
13429         case "$gethostent_r_proto" in
13430         ''|0)   d_gethostent_r=undef
13431                 gethostent_r_proto=0
13432                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13433         * )     case "$gethostent_r_proto" in
13434                 REENTRANT_PROTO*) ;;
13435                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13436                 esac
13437                 echo "Prototype: $try" ;;
13438         esac
13439         ;;
13440         *)      case "$usethreads" in
13441                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13442                 esac
13443                 d_gethostent_r=undef
13444                 gethostent_r_proto=0
13445                 ;;
13446         esac
13447         ;;
13448 *)      gethostent_r_proto=0
13449         ;;
13450 esac
13451
13452 : see if prototypes for various gethostxxx netdb.h functions are available
13453 echo " "
13454 set d_gethostprotos gethostent $i_netdb netdb.h
13455 eval $hasproto
13456
13457 : see if getitimer exists
13458 set getitimer d_getitimer
13459 eval $inlibc
13460
13461 : see if getlogin exists
13462 set getlogin d_getlogin
13463 eval $inlibc
13464
13465 : see if getlogin_r exists
13466 set getlogin_r d_getlogin_r
13467 eval $inlibc
13468 case "$d_getlogin_r" in
13469 "$define")
13470         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13471         case "$d_getlogin_r_proto:$usethreads" in
13472         ":define")      d_getlogin_r_proto=define
13473                 set d_getlogin_r_proto getlogin_r $hdrs
13474                 eval $hasproto ;;
13475         *)      ;;
13476         esac
13477         case "$d_getlogin_r_proto" in
13478         define)
13479         case "$getlogin_r_proto" in
13480         ''|0) try='int getlogin_r(char*, size_t);'
13481         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13482         esac
13483         case "$getlogin_r_proto" in
13484         ''|0) try='int getlogin_r(char*, int);'
13485         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13486         esac
13487         case "$getlogin_r_proto" in
13488         ''|0) try='char* getlogin_r(char*, size_t);'
13489         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13490         esac
13491         case "$getlogin_r_proto" in
13492         ''|0) try='char* getlogin_r(char*, int);'
13493         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13494         esac
13495         case "$getlogin_r_proto" in
13496         ''|0)   d_getlogin_r=undef
13497                 getlogin_r_proto=0
13498                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13499         * )     case "$getlogin_r_proto" in
13500                 REENTRANT_PROTO*) ;;
13501                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13502                 esac
13503                 echo "Prototype: $try" ;;
13504         esac
13505         ;;
13506         *)      case "$usethreads" in
13507                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13508                 esac
13509                 d_getlogin_r=undef
13510                 getlogin_r_proto=0
13511                 ;;
13512         esac
13513         ;;
13514 *)      getlogin_r_proto=0
13515         ;;
13516 esac
13517
13518 : see if getmnt exists
13519 set getmnt d_getmnt
13520 eval $inlibc
13521
13522 : see if getmntent exists
13523 set getmntent d_getmntent
13524 eval $inlibc
13525
13526 : see if getnetbyaddr exists
13527 set getnetbyaddr d_getnbyaddr
13528 eval $inlibc
13529
13530 : see if getnetbyname exists
13531 set getnetbyname d_getnbyname
13532 eval $inlibc
13533
13534 : see if getnetent exists
13535 set getnetent d_getnent
13536 eval $inlibc
13537
13538 : see if getnetbyaddr_r exists
13539 set getnetbyaddr_r d_getnetbyaddr_r
13540 eval $inlibc
13541 case "$d_getnetbyaddr_r" in
13542 "$define")
13543         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13544         case "$d_getnetbyaddr_r_proto:$usethreads" in
13545         ":define")      d_getnetbyaddr_r_proto=define
13546                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13547                 eval $hasproto ;;
13548         *)      ;;
13549         esac
13550         case "$d_getnetbyaddr_r_proto" in
13551         define)
13552         case "$getnetbyaddr_r_proto" in
13553         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13554         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13555         esac
13556         case "$getnetbyaddr_r_proto" in
13557         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13558         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13559         esac
13560         case "$getnetbyaddr_r_proto" in
13561         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13562         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13563         esac
13564         case "$getnetbyaddr_r_proto" in
13565         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13566         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13567         esac
13568         case "$getnetbyaddr_r_proto" in
13569         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13570         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13571         esac
13572         case "$getnetbyaddr_r_proto" in
13573         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13574         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13575         esac
13576         case "$getnetbyaddr_r_proto" in
13577         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13578         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13579         esac
13580         case "$getnetbyaddr_r_proto" in
13581         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13582         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13583         esac
13584         case "$getnetbyaddr_r_proto" in
13585         ''|0)   d_getnetbyaddr_r=undef
13586                 getnetbyaddr_r_proto=0
13587                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13588         * )     case "$getnetbyaddr_r_proto" in
13589                 REENTRANT_PROTO*) ;;
13590                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13591                 esac
13592                 echo "Prototype: $try" ;;
13593         esac
13594         ;;
13595         *)      case "$usethreads" in
13596                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13597                 esac
13598                 d_getnetbyaddr_r=undef
13599                 getnetbyaddr_r_proto=0
13600                 ;;
13601         esac
13602         ;;
13603 *)      getnetbyaddr_r_proto=0
13604         ;;
13605 esac
13606
13607 : see if getnetbyname_r exists
13608 set getnetbyname_r d_getnetbyname_r
13609 eval $inlibc
13610 case "$d_getnetbyname_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13613         case "$d_getnetbyname_r_proto:$usethreads" in
13614         ":define")      d_getnetbyname_r_proto=define
13615                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_getnetbyname_r_proto" in
13620         define)
13621         case "$getnetbyname_r_proto" in
13622         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13623         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13624         esac
13625         case "$getnetbyname_r_proto" in
13626         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13627         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13628         esac
13629         case "$getnetbyname_r_proto" in
13630         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13631         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13632         esac
13633         case "$getnetbyname_r_proto" in
13634         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13635         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13636         esac
13637         case "$getnetbyname_r_proto" in
13638         ''|0)   d_getnetbyname_r=undef
13639                 getnetbyname_r_proto=0
13640                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13641         * )     case "$getnetbyname_r_proto" in
13642                 REENTRANT_PROTO*) ;;
13643                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13644                 esac
13645                 echo "Prototype: $try" ;;
13646         esac
13647         ;;
13648         *)      case "$usethreads" in
13649                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13650                 esac
13651                 d_getnetbyname_r=undef
13652                 getnetbyname_r_proto=0
13653                 ;;
13654         esac
13655         ;;
13656 *)      getnetbyname_r_proto=0
13657         ;;
13658 esac
13659
13660 : see if getnetent_r exists
13661 set getnetent_r d_getnetent_r
13662 eval $inlibc
13663 case "$d_getnetent_r" in
13664 "$define")
13665         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13666         case "$d_getnetent_r_proto:$usethreads" in
13667         ":define")      d_getnetent_r_proto=define
13668                 set d_getnetent_r_proto getnetent_r $hdrs
13669                 eval $hasproto ;;
13670         *)      ;;
13671         esac
13672         case "$d_getnetent_r_proto" in
13673         define)
13674         case "$getnetent_r_proto" in
13675         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13676         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13677         esac
13678         case "$getnetent_r_proto" in
13679         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13680         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13681         esac
13682         case "$getnetent_r_proto" in
13683         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13684         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13685         esac
13686         case "$getnetent_r_proto" in
13687         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13688         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13689         esac
13690         case "$getnetent_r_proto" in
13691         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13692         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13693         esac
13694         case "$getnetent_r_proto" in
13695         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13696         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13697         esac
13698         case "$getnetent_r_proto" in
13699         ''|0)   d_getnetent_r=undef
13700                 getnetent_r_proto=0
13701                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13702         * )     case "$getnetent_r_proto" in
13703                 REENTRANT_PROTO*) ;;
13704                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13705                 esac
13706                 echo "Prototype: $try" ;;
13707         esac
13708         ;;
13709         *)      case "$usethreads" in
13710                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13711                 esac
13712                 d_getnetent_r=undef
13713                 getnetent_r_proto=0
13714                 ;;
13715         esac
13716         ;;
13717 *)      getnetent_r_proto=0
13718         ;;
13719 esac
13720
13721 : see if prototypes for various getnetxxx netdb.h functions are available
13722 echo " "
13723 set d_getnetprotos getnetent $i_netdb netdb.h
13724 eval $hasproto
13725
13726 : see if getpagesize exists
13727 set getpagesize d_getpagsz
13728 eval $inlibc
13729
13730
13731 : see if getprotobyname exists
13732 set getprotobyname d_getpbyname
13733 eval $inlibc
13734
13735 : see if getprotobynumber exists
13736 set getprotobynumber d_getpbynumber
13737 eval $inlibc
13738
13739 : see if getprotoent exists
13740 set getprotoent d_getpent
13741 eval $inlibc
13742
13743 : see if getpgid exists
13744 set getpgid d_getpgid
13745 eval $inlibc
13746
13747 : see if getpgrp2 exists
13748 set getpgrp2 d_getpgrp2
13749 eval $inlibc
13750
13751 : see if getppid exists
13752 set getppid d_getppid
13753 eval $inlibc
13754
13755 : see if getpriority exists
13756 set getpriority d_getprior
13757 eval $inlibc
13758
13759 : see if getprotobyname_r exists
13760 set getprotobyname_r d_getprotobyname_r
13761 eval $inlibc
13762 case "$d_getprotobyname_r" in
13763 "$define")
13764         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13765         case "$d_getprotobyname_r_proto:$usethreads" in
13766         ":define")      d_getprotobyname_r_proto=define
13767                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13768                 eval $hasproto ;;
13769         *)      ;;
13770         esac
13771         case "$d_getprotobyname_r_proto" in
13772         define)
13773         case "$getprotobyname_r_proto" in
13774         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13775         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13776         esac
13777         case "$getprotobyname_r_proto" in
13778         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13779         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13780         esac
13781         case "$getprotobyname_r_proto" in
13782         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13783         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13784         esac
13785         case "$getprotobyname_r_proto" in
13786         ''|0)   d_getprotobyname_r=undef
13787                 getprotobyname_r_proto=0
13788                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13789         * )     case "$getprotobyname_r_proto" in
13790                 REENTRANT_PROTO*) ;;
13791                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13792                 esac
13793                 echo "Prototype: $try" ;;
13794         esac
13795         ;;
13796         *)      case "$usethreads" in
13797                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13798                 esac
13799                 d_getprotobyname_r=undef
13800                 getprotobyname_r_proto=0
13801                 ;;
13802         esac
13803         ;;
13804 *)      getprotobyname_r_proto=0
13805         ;;
13806 esac
13807
13808 : see if getprotobynumber_r exists
13809 set getprotobynumber_r d_getprotobynumber_r
13810 eval $inlibc
13811 case "$d_getprotobynumber_r" in
13812 "$define")
13813         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13814         case "$d_getprotobynumber_r_proto:$usethreads" in
13815         ":define")      d_getprotobynumber_r_proto=define
13816                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13817                 eval $hasproto ;;
13818         *)      ;;
13819         esac
13820         case "$d_getprotobynumber_r_proto" in
13821         define)
13822         case "$getprotobynumber_r_proto" in
13823         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13824         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13825         esac
13826         case "$getprotobynumber_r_proto" in
13827         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13828         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13829         esac
13830         case "$getprotobynumber_r_proto" in
13831         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13832         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13833         esac
13834         case "$getprotobynumber_r_proto" in
13835         ''|0)   d_getprotobynumber_r=undef
13836                 getprotobynumber_r_proto=0
13837                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13838         * )     case "$getprotobynumber_r_proto" in
13839                 REENTRANT_PROTO*) ;;
13840                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13841                 esac
13842                 echo "Prototype: $try" ;;
13843         esac
13844         ;;
13845         *)      case "$usethreads" in
13846                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13847                 esac
13848                 d_getprotobynumber_r=undef
13849                 getprotobynumber_r_proto=0
13850                 ;;
13851         esac
13852         ;;
13853 *)      getprotobynumber_r_proto=0
13854         ;;
13855 esac
13856
13857 : see if getprotoent_r exists
13858 set getprotoent_r d_getprotoent_r
13859 eval $inlibc
13860 case "$d_getprotoent_r" in
13861 "$define")
13862         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13863         case "$d_getprotoent_r_proto:$usethreads" in
13864         ":define")      d_getprotoent_r_proto=define
13865                 set d_getprotoent_r_proto getprotoent_r $hdrs
13866                 eval $hasproto ;;
13867         *)      ;;
13868         esac
13869         case "$d_getprotoent_r_proto" in
13870         define)
13871         case "$getprotoent_r_proto" in
13872         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13873         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13874         esac
13875         case "$getprotoent_r_proto" in
13876         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13877         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13878         esac
13879         case "$getprotoent_r_proto" in
13880         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13881         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13882         esac
13883         case "$getprotoent_r_proto" in
13884         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13885         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13886         esac
13887         case "$getprotoent_r_proto" in
13888         ''|0)   d_getprotoent_r=undef
13889                 getprotoent_r_proto=0
13890                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13891         * )     case "$getprotoent_r_proto" in
13892                 REENTRANT_PROTO*) ;;
13893                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13894                 esac
13895                 echo "Prototype: $try" ;;
13896         esac
13897         ;;
13898         *)      case "$usethreads" in
13899                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13900                 esac
13901                 d_getprotoent_r=undef
13902                 getprotoent_r_proto=0
13903                 ;;
13904         esac
13905         ;;
13906 *)      getprotoent_r_proto=0
13907         ;;
13908 esac
13909
13910 : see if prototypes for various getprotoxxx netdb.h functions are available
13911 echo " "
13912 set d_getprotoprotos getprotoent $i_netdb netdb.h
13913 eval $hasproto
13914
13915 : see if getprpwnam exists
13916 set getprpwnam d_getprpwnam
13917 eval $inlibc
13918
13919 : see if getpwent exists
13920 set getpwent d_getpwent
13921 eval $inlibc
13922
13923 : see if getpwent_r exists
13924 set getpwent_r d_getpwent_r
13925 eval $inlibc
13926 case "$d_getpwent_r" in
13927 "$define")
13928         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13929         case "$d_getpwent_r_proto:$usethreads" in
13930         ":define")      d_getpwent_r_proto=define
13931                 set d_getpwent_r_proto getpwent_r $hdrs
13932                 eval $hasproto ;;
13933         *)      ;;
13934         esac
13935         case "$d_getpwent_r_proto" in
13936         define)
13937         case "$getpwent_r_proto" in
13938         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13939         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13940         esac
13941         case "$getpwent_r_proto" in
13942         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13943         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13944         esac
13945         case "$getpwent_r_proto" in
13946         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13947         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13948         esac
13949         case "$getpwent_r_proto" in
13950         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13951         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13952         esac
13953         case "$getpwent_r_proto" in
13954         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13955         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13956         esac
13957         case "$getpwent_r_proto" in
13958         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13959         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13960         esac
13961         case "$getpwent_r_proto" in
13962         ''|0)   d_getpwent_r=undef
13963                 getpwent_r_proto=0
13964                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13965         * )     case "$getpwent_r_proto" in
13966                 REENTRANT_PROTO*) ;;
13967                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13968                 esac
13969                 echo "Prototype: $try" ;;
13970         esac
13971         ;;
13972         *)      case "$usethreads" in
13973                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13974                 esac
13975                 d_getpwent_r=undef
13976                 getpwent_r_proto=0
13977                 ;;
13978         esac
13979         ;;
13980 *)      getpwent_r_proto=0
13981         ;;
13982 esac
13983
13984 : see if getpwnam_r exists
13985 set getpwnam_r d_getpwnam_r
13986 eval $inlibc
13987 case "$d_getpwnam_r" in
13988 "$define")
13989         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13990         case "$d_getpwnam_r_proto:$usethreads" in
13991         ":define")      d_getpwnam_r_proto=define
13992                 set d_getpwnam_r_proto getpwnam_r $hdrs
13993                 eval $hasproto ;;
13994         *)      ;;
13995         esac
13996         case "$d_getpwnam_r_proto" in
13997         define)
13998         case "$getpwnam_r_proto" in
13999         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14000         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14001         esac
14002         case "$getpwnam_r_proto" in
14003         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14004         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14005         esac
14006         case "$getpwnam_r_proto" in
14007         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14008         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14009         esac
14010         case "$getpwnam_r_proto" in
14011         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14012         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14013         esac
14014         case "$getpwnam_r_proto" in
14015         ''|0)   d_getpwnam_r=undef
14016                 getpwnam_r_proto=0
14017                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14018         * )     case "$getpwnam_r_proto" in
14019                 REENTRANT_PROTO*) ;;
14020                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14021                 esac
14022                 echo "Prototype: $try" ;;
14023         esac
14024         ;;
14025         *)      case "$usethreads" in
14026                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14027                 esac
14028                 d_getpwnam_r=undef
14029                 getpwnam_r_proto=0
14030                 ;;
14031         esac
14032         ;;
14033 *)      getpwnam_r_proto=0
14034         ;;
14035 esac
14036
14037 : see if getpwuid_r exists
14038 set getpwuid_r d_getpwuid_r
14039 eval $inlibc
14040 case "$d_getpwuid_r" in
14041 "$define")
14042         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14043         case "$d_getpwuid_r_proto:$usethreads" in
14044         ":define")      d_getpwuid_r_proto=define
14045                 set d_getpwuid_r_proto getpwuid_r $hdrs
14046                 eval $hasproto ;;
14047         *)      ;;
14048         esac
14049         case "$d_getpwuid_r_proto" in
14050         define)
14051         case "$getpwuid_r_proto" in
14052         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14053         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14054         esac
14055         case "$getpwuid_r_proto" in
14056         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14057         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14058         esac
14059         case "$getpwuid_r_proto" in
14060         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14061         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14062         esac
14063         case "$getpwuid_r_proto" in
14064         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14065         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14066         esac
14067         case "$getpwuid_r_proto" in
14068         ''|0)   d_getpwuid_r=undef
14069                 getpwuid_r_proto=0
14070                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14071         * )     case "$getpwuid_r_proto" in
14072                 REENTRANT_PROTO*) ;;
14073                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14074                 esac
14075                 echo "Prototype: $try" ;;
14076         esac
14077         ;;
14078         *)      case "$usethreads" in
14079                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14080                 esac
14081                 d_getpwuid_r=undef
14082                 getpwuid_r_proto=0
14083                 ;;
14084         esac
14085         ;;
14086 *)      getpwuid_r_proto=0
14087         ;;
14088 esac
14089
14090
14091 : see if getservbyname exists
14092 set getservbyname d_getsbyname
14093 eval $inlibc
14094
14095 : see if getservbyport exists
14096 set getservbyport d_getsbyport
14097 eval $inlibc
14098
14099 : see if getservent exists
14100 set getservent d_getsent
14101 eval $inlibc
14102
14103 : see if getservbyname_r exists
14104 set getservbyname_r d_getservbyname_r
14105 eval $inlibc
14106 case "$d_getservbyname_r" in
14107 "$define")
14108         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14109         case "$d_getservbyname_r_proto:$usethreads" in
14110         ":define")      d_getservbyname_r_proto=define
14111                 set d_getservbyname_r_proto getservbyname_r $hdrs
14112                 eval $hasproto ;;
14113         *)      ;;
14114         esac
14115         case "$d_getservbyname_r_proto" in
14116         define)
14117         case "$getservbyname_r_proto" in
14118         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14119         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14120         esac
14121         case "$getservbyname_r_proto" in
14122         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14123         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14124         esac
14125         case "$getservbyname_r_proto" in
14126         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14127         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14128         esac
14129         case "$getservbyname_r_proto" in
14130         ''|0)   d_getservbyname_r=undef
14131                 getservbyname_r_proto=0
14132                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14133         * )     case "$getservbyname_r_proto" in
14134                 REENTRANT_PROTO*) ;;
14135                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14136                 esac
14137                 echo "Prototype: $try" ;;
14138         esac
14139         ;;
14140         *)      case "$usethreads" in
14141                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14142                 esac
14143                 d_getservbyname_r=undef
14144                 getservbyname_r_proto=0
14145                 ;;
14146         esac
14147         ;;
14148 *)      getservbyname_r_proto=0
14149         ;;
14150 esac
14151
14152 : see if getservbyport_r exists
14153 set getservbyport_r d_getservbyport_r
14154 eval $inlibc
14155 case "$d_getservbyport_r" in
14156 "$define")
14157         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14158         case "$d_getservbyport_r_proto:$usethreads" in
14159         ":define")      d_getservbyport_r_proto=define
14160                 set d_getservbyport_r_proto getservbyport_r $hdrs
14161                 eval $hasproto ;;
14162         *)      ;;
14163         esac
14164         case "$d_getservbyport_r_proto" in
14165         define)
14166         case "$getservbyport_r_proto" in
14167         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14168         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14169         esac
14170         case "$getservbyport_r_proto" in
14171         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14172         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14173         esac
14174         case "$getservbyport_r_proto" in
14175         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14176         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14177         esac
14178         case "$getservbyport_r_proto" in
14179         ''|0)   d_getservbyport_r=undef
14180                 getservbyport_r_proto=0
14181                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14182         * )     case "$getservbyport_r_proto" in
14183                 REENTRANT_PROTO*) ;;
14184                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14185                 esac
14186                 echo "Prototype: $try" ;;
14187         esac
14188         ;;
14189         *)      case "$usethreads" in
14190                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14191                 esac
14192                 d_getservbyport_r=undef
14193                 getservbyport_r_proto=0
14194                 ;;
14195         esac
14196         ;;
14197 *)      getservbyport_r_proto=0
14198         ;;
14199 esac
14200
14201 : see if getservent_r exists
14202 set getservent_r d_getservent_r
14203 eval $inlibc
14204 case "$d_getservent_r" in
14205 "$define")
14206         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14207         case "$d_getservent_r_proto:$usethreads" in
14208         ":define")      d_getservent_r_proto=define
14209                 set d_getservent_r_proto getservent_r $hdrs
14210                 eval $hasproto ;;
14211         *)      ;;
14212         esac
14213         case "$d_getservent_r_proto" in
14214         define)
14215         case "$getservent_r_proto" in
14216         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14217         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14218         esac
14219         case "$getservent_r_proto" in
14220         ''|0) try='int getservent_r(struct servent*, char*, int);'
14221         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14222         esac
14223         case "$getservent_r_proto" in
14224         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14225         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14226         esac
14227         case "$getservent_r_proto" in
14228         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14229         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14230         esac
14231         case "$getservent_r_proto" in
14232         ''|0)   d_getservent_r=undef
14233                 getservent_r_proto=0
14234                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14235         * )     case "$getservent_r_proto" in
14236                 REENTRANT_PROTO*) ;;
14237                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14238                 esac
14239                 echo "Prototype: $try" ;;
14240         esac
14241         ;;
14242         *)      case "$usethreads" in
14243                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14244                 esac
14245                 d_getservent_r=undef
14246                 getservent_r_proto=0
14247                 ;;
14248         esac
14249         ;;
14250 *)      getservent_r_proto=0
14251         ;;
14252 esac
14253
14254 : see if prototypes for various getservxxx netdb.h functions are available
14255 echo " "
14256 set d_getservprotos getservent $i_netdb netdb.h
14257 eval $hasproto
14258
14259 : see if getspnam exists
14260 set getspnam d_getspnam
14261 eval $inlibc
14262
14263 : see if this is a shadow.h system
14264 set shadow.h i_shadow
14265 eval $inhdr
14266
14267 : see if getspnam_r exists
14268 set getspnam_r d_getspnam_r
14269 eval $inlibc
14270 case "$d_getspnam_r" in
14271 "$define")
14272         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14273         case "$d_getspnam_r_proto:$usethreads" in
14274         ":define")      d_getspnam_r_proto=define
14275                 set d_getspnam_r_proto getspnam_r $hdrs
14276                 eval $hasproto ;;
14277         *)      ;;
14278         esac
14279         case "$d_getspnam_r_proto" in
14280         define)
14281         case "$getspnam_r_proto" in
14282         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14283         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14284         esac
14285         case "$getspnam_r_proto" in
14286         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14287         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14288         esac
14289         case "$getspnam_r_proto" in
14290         ''|0)   d_getspnam_r=undef
14291                 getspnam_r_proto=0
14292                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14293         * )     case "$getspnam_r_proto" in
14294                 REENTRANT_PROTO*) ;;
14295                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14296                 esac
14297                 echo "Prototype: $try" ;;
14298         esac
14299         ;;
14300         *)      case "$usethreads" in
14301                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14302                 esac
14303                 d_getspnam_r=undef
14304                 getspnam_r_proto=0
14305                 ;;
14306         esac
14307         ;;
14308 *)      getspnam_r_proto=0
14309         ;;
14310 esac
14311
14312 : see if gettimeofday or ftime exists
14313 set gettimeofday d_gettimeod
14314 eval $inlibc
14315 case "$d_gettimeod" in
14316 "$undef")
14317         set ftime d_ftime 
14318         eval $inlibc
14319         ;;
14320 *)
14321         val="$undef"; set d_ftime; eval $setvar
14322         ;;
14323 esac
14324 case "$d_gettimeod$d_ftime" in
14325 "$undef$undef")
14326         echo " "
14327         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14328         ;;
14329 esac
14330
14331 : see if gmtime_r exists
14332 set gmtime_r d_gmtime_r
14333 eval $inlibc
14334 case "$d_gmtime_r" in
14335 "$define")
14336         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14337         case "$d_gmtime_r_proto:$usethreads" in
14338         ":define")      d_gmtime_r_proto=define
14339                 set d_gmtime_r_proto gmtime_r $hdrs
14340                 eval $hasproto ;;
14341         *)      ;;
14342         esac
14343         case "$d_gmtime_r_proto" in
14344         define)
14345         case "$gmtime_r_proto" in
14346         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14347         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14348         esac
14349         case "$gmtime_r_proto" in
14350         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14351         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14352         esac
14353         case "$gmtime_r_proto" in
14354         ''|0)   d_gmtime_r=undef
14355                 gmtime_r_proto=0
14356                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14357         * )     case "$gmtime_r_proto" in
14358                 REENTRANT_PROTO*) ;;
14359                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14360                 esac
14361                 echo "Prototype: $try" ;;
14362         esac
14363         ;;
14364         *)      case "$usethreads" in
14365                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14366                 esac
14367                 d_gmtime_r=undef
14368                 gmtime_r_proto=0
14369                 ;;
14370         esac
14371         ;;
14372 *)      gmtime_r_proto=0
14373         ;;
14374 esac
14375
14376 : see if hasmntopt exists
14377 set hasmntopt d_hasmntopt
14378 eval $inlibc
14379
14380 : see if this is a netinet/in.h or sys/in.h system
14381 set netinet/in.h i_niin sys/in.h i_sysin
14382 eval $inhdr
14383
14384 : see if arpa/inet.h has to be included
14385 set arpa/inet.h i_arpainet
14386 eval $inhdr
14387
14388 : see if htonl --and friends-- exists
14389 val=''
14390 set htonl val
14391 eval $inlibc
14392
14393 : Maybe they are macros.
14394 case "$val" in
14395 $undef)
14396         $cat >htonl.c <<EOM
14397 #include <stdio.h>
14398 #include <sys/types.h>
14399 #$i_niin I_NETINET_IN
14400 #$i_sysin I_SYS_IN
14401 #$i_arpainet I_ARPA_INET
14402 #ifdef I_NETINET_IN
14403 #include <netinet/in.h>
14404 #endif
14405 #ifdef I_SYS_IN
14406 #include <sys/in.h>
14407 #endif
14408 #ifdef I_ARPA_INET
14409 #include <arpa/inet.h>
14410 #endif
14411 #ifdef htonl
14412 printf("Defined as a macro.");
14413 #endif
14414 EOM
14415         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14416         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14417                 val="$define"
14418                 echo "But it seems to be defined as a macro." >&4
14419         fi
14420         $rm -f htonl.?
14421         ;;
14422 esac
14423 set d_htonl
14424 eval $setvar
14425
14426 : see if ilogbl exists
14427 set ilogbl d_ilogbl
14428 eval $inlibc
14429
14430 : index or strchr
14431 echo " "
14432 if set index val -f; eval $csym; $val; then
14433         if set strchr val -f d_strchr; eval $csym; $val; then
14434                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14435                         val="$define"
14436                         vali="$undef"
14437                         echo "strchr() found." >&4
14438                 else
14439                         val="$undef"
14440                         vali="$define"
14441                         echo "index() found." >&4
14442                 fi
14443         else
14444                 val="$undef"
14445                 vali="$define"
14446                 echo "index() found." >&4
14447         fi
14448 else
14449         if set strchr val -f d_strchr; eval $csym; $val; then
14450                 val="$define"
14451                 vali="$undef"
14452                 echo "strchr() found." >&4
14453         else
14454                 echo "No index() or strchr() found!" >&4
14455                 val="$undef"
14456                 vali="$undef"
14457         fi
14458 fi
14459 set d_strchr; eval $setvar
14460 val="$vali"
14461 set d_index; eval $setvar
14462
14463 : check whether inet_aton exists
14464 set inet_aton d_inetaton
14465 eval $inlibc
14466
14467 : Look for isascii
14468 echo " "
14469 $cat >isascii.c <<EOCP
14470 #include <stdio.h>
14471 #include <ctype.h>
14472 #$i_stdlib I_STDLIB
14473 #ifdef I_STDLIB
14474 #include <stdlib.h>
14475 #endif
14476 int main() {
14477         int c = 'A';
14478         if (isascii(c))
14479                 exit(0);
14480         else
14481                 exit(1);
14482 }
14483 EOCP
14484 set isascii
14485 if eval $compile; then
14486         echo "isascii() found." >&4
14487         val="$define"
14488 else
14489         echo "isascii() NOT found." >&4
14490         val="$undef"
14491 fi
14492 set d_isascii
14493 eval $setvar
14494 $rm -f isascii*
14495
14496 : see if isfinite exists
14497 set isfinite d_isfinite
14498 eval $inlibc
14499
14500 : see if isinf exists
14501 set isinf d_isinf
14502 eval $inlibc
14503
14504 : see if isnan exists
14505 set isnan d_isnan
14506 eval $inlibc
14507
14508 : see if isnanl exists
14509 set isnanl d_isnanl
14510 eval $inlibc
14511
14512 : see if killpg exists
14513 set killpg d_killpg
14514 eval $inlibc
14515
14516 : see if lchown exists
14517 echo " "
14518 $cat > try.c <<'EOCP'
14519 /* System header to define __stub macros and hopefully few prototypes,
14520     which can conflict with char lchown(); below.  */
14521 #include <assert.h>
14522 /* Override any gcc2 internal prototype to avoid an error.  */
14523 /* We use char because int might match the return type of a gcc2
14524    builtin and then its argument prototype would still apply.  */
14525 char lchown();
14526 int main() {
14527     /*  The GNU C library defines this for functions which it implements
14528         to always fail with ENOSYS.  Some functions are actually named
14529         something starting with __ and the normal name is an alias.  */
14530 #if defined (__stub_lchown) || defined (__stub___lchown)
14531 choke me
14532 #else
14533 lchown();
14534 #endif
14535 ; return 0; }
14536 EOCP
14537 set try
14538 if eval $compile; then
14539     $echo "lchown() found." >&4
14540     val="$define"
14541 else
14542     $echo "lchown() NOT found." >&4
14543     val="$undef"
14544 fi
14545 set d_lchown
14546 eval $setvar
14547
14548 : See if number of significant digits in a double precision number is known
14549 echo " "
14550 $cat >ldbl_dig.c <<EOM
14551 #$i_limits I_LIMITS
14552 #$i_float I_FLOAT
14553 #ifdef I_LIMITS
14554 #include <limits.h>
14555 #endif
14556 #ifdef I_FLOAT
14557 #include <float.h>
14558 #endif
14559 #ifdef LDBL_DIG
14560 printf("Contains LDBL_DIG");
14561 #endif
14562 EOM
14563 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14564 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14565         echo "LDBL_DIG found." >&4
14566         val="$define"
14567 else
14568         echo "LDBL_DIG NOT found." >&4
14569         val="$undef"
14570 fi
14571 $rm -f ldbl_dig.?
14572 set d_ldbl_dig
14573 eval $setvar
14574
14575 : see if this is a math.h system
14576 set math.h i_math
14577 eval $inhdr
14578
14579 d_libm_lib_version="$undef"
14580 case $i_math in
14581     $define)
14582         : check to see if math.h defines _LIB_VERSION
14583         echo " "
14584         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14585         $cat >try.c <<EOCP
14586 #include <unistd.h>
14587 #include <math.h>
14588 int main (int argc, char *argv[])
14589 {
14590     printf ("%d\n", _LIB_VERSION);
14591     return (0);
14592     } /* main */
14593 EOCP
14594         set try
14595         if eval $compile; then
14596             foo=`$run ./try`
14597             echo "Yes, it does ($foo)" >&4
14598             d_libm_lib_version="$define"
14599         else
14600             echo "No, it does not (probably harmless)\n" >&4
14601             fi
14602         $rm -f try.* try core core.try.*
14603         ;;
14604
14605     esac
14606
14607 : see if link exists
14608 set link d_link
14609 eval $inlibc
14610
14611 : see if localtime_r exists
14612 set localtime_r d_localtime_r
14613 eval $inlibc
14614 case "$d_localtime_r" in
14615 "$define")
14616         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14617         case "$d_localtime_r_proto:$usethreads" in
14618         ":define")      d_localtime_r_proto=define
14619                 set d_localtime_r_proto localtime_r $hdrs
14620                 eval $hasproto ;;
14621         *)      ;;
14622         esac
14623         case "$d_localtime_r_proto" in
14624         define)
14625         case "$localtime_r_proto" in
14626         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14627         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14628         esac
14629         case "$localtime_r_proto" in
14630         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14631         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14632         esac
14633         case "$localtime_r_proto" in
14634         ''|0)   d_localtime_r=undef
14635                 localtime_r_proto=0
14636                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14637         * )     case "$localtime_r_proto" in
14638                 REENTRANT_PROTO*) ;;
14639                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14640                 esac
14641                 echo "Prototype: $try" ;;
14642         esac
14643         ;;
14644         *)      case "$usethreads" in
14645                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14646                 esac
14647                 d_localtime_r=undef
14648                 localtime_r_proto=0
14649                 ;;
14650         esac
14651         ;;
14652 *)      localtime_r_proto=0
14653         ;;
14654 esac
14655
14656 : see if localtime_r calls tzset
14657 case "$localtime_r_proto" in
14658 REENTRANT_PROTO*)
14659         $cat >try.c <<EOCP
14660 /*  Does our libc's localtime_r call tzset ?
14661  *  return 0 if so, 1 otherwise.
14662  */
14663 #include <sys/types.h>
14664 #include <unistd.h>
14665 #include <time.h>
14666 #include <string.h>
14667 #include <malloc.h>
14668 int main()
14669 {
14670     time_t t = time(0L);
14671     char w_tz[]="TZ" "=GMT+5",
14672          e_tz[]="TZ" "=GMT-5",
14673         *tz_e = (char*)malloc(16),
14674         *tz_w = (char*)malloc(16);
14675     struct tm tm_e, tm_w;
14676     memset(&tm_e,'\0',sizeof(struct tm));
14677     memset(&tm_w,'\0',sizeof(struct tm));
14678     strcpy(tz_e,e_tz);
14679     strcpy(tz_w,w_tz);
14680
14681     putenv(tz_e);
14682     localtime_r(&t, &tm_e);
14683
14684     putenv(tz_w);
14685     localtime_r(&t, &tm_w);
14686
14687     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14688         return 1;
14689     return 0;
14690 }
14691 EOCP
14692         set try
14693         if eval $compile; then
14694             if ./try; then
14695                 d_localtime_r_needs_tzset=undef;
14696             else
14697                 d_localtime_r_needs_tzset=define;
14698             fi;
14699         else
14700             d_localtime_r_needs_tzset=undef;
14701         fi;
14702      ;;
14703   *)
14704      d_localtime_r_needs_tzset=undef;
14705      ;;
14706 esac
14707 $rm -f try try.* core
14708
14709 : see if localeconv exists
14710 set localeconv d_locconv
14711 eval $inlibc
14712
14713 : see if lockf exists
14714 set lockf d_lockf
14715 eval $inlibc
14716
14717 : see if prototype for lseek is available
14718 echo " "
14719 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14720 eval $hasproto
14721
14722 : see if lstat exists
14723 set lstat d_lstat
14724 eval $inlibc
14725
14726 : see if madvise exists
14727 set madvise d_madvise
14728 eval $inlibc
14729
14730 : see if malloc_size exists
14731 set malloc_size d_malloc_size
14732 eval $inlibc
14733
14734 : see if malloc_size_good exists
14735 set malloc_good_size d_malloc_good_size
14736 eval $inlibc
14737
14738 : see if mblen exists
14739 set mblen d_mblen
14740 eval $inlibc
14741
14742 : see if mbstowcs exists
14743 set mbstowcs d_mbstowcs
14744 eval $inlibc
14745
14746 : see if mbtowc exists
14747 set mbtowc d_mbtowc
14748 eval $inlibc
14749
14750 : see if memchr exists
14751 set memchr d_memchr
14752 eval $inlibc
14753
14754 : see if memcmp exists
14755 set memcmp d_memcmp
14756 eval $inlibc
14757
14758 : see if memcpy exists
14759 set memcpy d_memcpy
14760 eval $inlibc
14761
14762 : see if memmove exists
14763 set memmove d_memmove
14764 eval $inlibc
14765
14766 : see if memset exists
14767 set memset d_memset
14768 eval $inlibc
14769
14770 : see if mkdir exists
14771 set mkdir d_mkdir
14772 eval $inlibc
14773
14774 : see if mkdtemp exists
14775 set mkdtemp d_mkdtemp
14776 eval $inlibc
14777
14778 : see if mkfifo exists
14779 set mkfifo d_mkfifo
14780 eval $inlibc
14781
14782 : see if mkstemp exists
14783 set mkstemp d_mkstemp
14784 eval $inlibc
14785
14786 : see if mkstemps exists
14787 set mkstemps d_mkstemps
14788 eval $inlibc
14789
14790 : see if mktime exists
14791 set mktime d_mktime
14792 eval $inlibc
14793
14794 : see if this is a sys/mman.h system
14795 set sys/mman.h i_sysmman
14796 eval $inhdr
14797
14798 : see if mmap exists
14799 set mmap d_mmap
14800 eval $inlibc
14801 : see what shmat returns
14802 : default to something harmless
14803 mmaptype='void *'
14804 case "$i_sysmman$d_mmap" in
14805 "$define$define")
14806         $cat >mmap.c <<'END'
14807 #include <sys/mman.h>
14808 void *mmap();
14809 END
14810         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14811                 mmaptype='void *'
14812         else
14813                 mmaptype='caddr_t'
14814         fi
14815         echo "and it returns ($mmaptype)." >&4
14816         ;;
14817 esac
14818
14819
14820
14821 : see if sqrtl exists
14822 set sqrtl d_sqrtl
14823 eval $inlibc
14824
14825 : see if scalbnl exists
14826 set scalbnl d_scalbnl
14827 eval $inlibc
14828
14829 : see if modfl exists
14830 set modfl d_modfl
14831 eval $inlibc
14832
14833 : see if prototype for modfl is available
14834 echo " "
14835 set d_modflproto modfl $i_math math.h
14836 eval $hasproto
14837
14838 d_modfl_pow32_bug="$undef"
14839
14840 case "$d_longdbl$d_modfl" in
14841 $define$define)
14842         $cat <<EOM
14843 Checking to see whether your modfl() is okay for large values...
14844 EOM
14845 $cat >try.c <<EOCP
14846 #include <math.h> 
14847 #include <stdio.h>
14848 EOCP
14849 if $test "X$d_modflproto" != "X$define"; then
14850         $cat >>try.c <<EOCP
14851 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14852 long double modfl (long double, long double *);
14853 EOCP
14854 fi
14855 $cat >>try.c <<EOCP
14856 int main() {
14857     long double nv = 4294967303.15;
14858     long double v, w;
14859     v = modfl(nv, &w);         
14860 #ifdef __GLIBC__
14861     printf("glibc");
14862 #endif
14863     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14864     return 0;
14865 }
14866 EOCP
14867         case "$osname:$gccversion" in
14868         aix:)   saveccflags="$ccflags"
14869                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14870         esac
14871         set try
14872         if eval $compile; then
14873                 foo=`$run ./try`
14874                 case "$foo" in
14875                 *" 4294967303.150000 1.150000 4294967302.000000")
14876                         echo >&4 "Your modfl() is broken for large values."
14877                         d_modfl_pow32_bug="$define"
14878                         case "$foo" in
14879                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14880                         ;;
14881                         esac
14882                         ;;
14883                 *" 4294967303.150000 0.150000 4294967303.000000")
14884                         echo >&4 "Your modfl() seems okay for large values."
14885                         ;;
14886                 *)      echo >&4 "I don't understand your modfl() at all."
14887                         d_modfl="$undef"
14888                         ;;
14889                 esac
14890                 $rm -f try.* try core core.try.*
14891         else
14892                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14893                 d_modfl="$undef"
14894         fi
14895         case "$osname:$gccversion" in
14896         aix:)   ccflags="$saveccflags" ;; # restore
14897         esac
14898         ;;
14899 esac
14900
14901 if $test "$uselongdouble" = "$define"; then
14902     message=""
14903     if $test "$d_sqrtl" != "$define"; then
14904         message="$message sqrtl"
14905     fi
14906     if $test "$d_modfl" != "$define"; then
14907         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14908             echo "You have both aintl and copysignl, so I can emulate modfl."
14909         else
14910             message="$message modfl"
14911         fi
14912     fi
14913     if $test "$d_frexpl" != "$define"; then
14914         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14915             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14916         else
14917             message="$message frexpl"
14918         fi
14919     fi
14920
14921     if $test "$message" != ""; then
14922         $cat <<EOM >&4
14923
14924 *** You requested the use of long doubles but you do not seem to have
14925 *** the following mathematical functions needed for long double support:
14926 ***    $message
14927 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14928 *** Cannot continue, aborting.
14929
14930 EOM
14931
14932         exit 1
14933     fi
14934 fi
14935
14936 : see if mprotect exists
14937 set mprotect d_mprotect
14938 eval $inlibc
14939
14940 : see if msgctl exists
14941 set msgctl d_msgctl
14942 eval $inlibc
14943
14944 : see if msgget exists
14945 set msgget d_msgget
14946 eval $inlibc
14947
14948 : see if msgsnd exists
14949 set msgsnd d_msgsnd
14950 eval $inlibc
14951
14952 : see if msgrcv exists
14953 set msgrcv d_msgrcv
14954 eval $inlibc
14955
14956 : see how much of the 'msg*(2)' library is present.
14957 h_msg=true
14958 echo " "
14959 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14960 *"$undef"*) h_msg=false;;
14961 esac
14962 case "$osname" in
14963 freebsd)
14964     case "`ipcs 2>&1`" in
14965     "SVID messages"*"not configured"*)
14966         echo "Your $osname does not have the msg*(2) configured." >&4
14967         h_msg=false
14968         val="$undef"
14969         set msgctl d_msgctl
14970         eval $setvar
14971         set msgget d_msgget
14972         eval $setvar
14973         set msgsnd d_msgsnd
14974         eval $setvar
14975         set msgrcv d_msgrcv
14976         eval $setvar
14977         ;;
14978     esac
14979     ;;
14980 esac
14981 : we could also check for sys/ipc.h ...
14982 if $h_msg && $test `./findhdr sys/msg.h`; then
14983         echo "You have the full msg*(2) library." >&4
14984         val="$define"
14985 else
14986         echo "You don't have the full msg*(2) library." >&4
14987         val="$undef"
14988 fi
14989 set d_msg
14990 eval $setvar
14991
14992
14993 echo " "
14994 echo "Checking to see if your system supports struct msghdr..." >&4
14995 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14996 eval $hasstruct
14997 case "$d_msghdr_s" in
14998 "$define")      echo "Yes, it does."   ;;
14999 *)              echo "No, it doesn't." ;;
15000 esac
15001
15002
15003 : see if msync exists
15004 set msync d_msync
15005 eval $inlibc
15006
15007 : see if munmap exists
15008 set munmap d_munmap
15009 eval $inlibc
15010
15011 : see if nice exists
15012 set nice d_nice
15013 eval $inlibc
15014
15015 : see if this is a langinfo.h system
15016 set langinfo.h i_langinfo
15017 eval $inhdr
15018
15019 : see if nl_langinfo exists
15020 set nl_langinfo d_nl_langinfo
15021 eval $inlibc
15022
15023 : check for length of character
15024 echo " "
15025 case "$charsize" in
15026 '')
15027         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15028         $cat >try.c <<EOCP
15029 #include <stdio.h>
15030 #$i_stdlib I_STDLIB
15031 #ifdef I_STDLIB
15032 #include <stdlib.h>
15033 #endif
15034 int main()
15035 {
15036     printf("%d\n", (int)sizeof(char));
15037     exit(0);
15038 }
15039 EOCP
15040         set try
15041         if eval $compile_ok; then
15042                 dflt=`$run ./try`
15043         else
15044                 dflt='1'
15045                 echo "(I can't seem to compile the test program.  Guessing...)"
15046         fi
15047         ;;
15048 *)
15049         dflt="$charsize"
15050         ;;
15051 esac
15052 rp="What is the size of a character (in bytes)?"
15053 . ./myread
15054 charsize="$ans"
15055 $rm -f try.c try
15056
15057 : check for volatile keyword
15058 echo " "
15059 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15060 $cat >try.c <<'EOCP'
15061 int main()
15062 {
15063         typedef struct _goo_struct goo_struct;
15064         goo_struct * volatile goo = ((goo_struct *)0);
15065         struct _goo_struct {
15066                 long long_int;
15067                 int reg_int;
15068                 char char_var;
15069         };
15070         typedef unsigned short foo_t;
15071         char *volatile foo;
15072         volatile int bar;
15073         volatile foo_t blech;
15074         foo = foo;
15075 }
15076 EOCP
15077 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15078         val="$define"
15079         echo "Yup, it does."
15080 else
15081         val="$undef"
15082         echo "Nope, it doesn't."
15083 fi
15084 set d_volatile
15085 eval $setvar
15086 $rm -f try.*
15087
15088
15089 echo " "
15090 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15091
15092 case "$use64bitint:$d_quad:$quadtype" in
15093 define:define:?*)
15094         ivtype="$quadtype"
15095         uvtype="$uquadtype"
15096         ivsize=8
15097         uvsize=8
15098         ;;
15099 *)      ivtype="long"
15100         uvtype="unsigned long"
15101         ivsize=$longsize
15102         uvsize=$longsize
15103         ;;
15104 esac
15105
15106 case "$uselongdouble:$d_longdbl" in
15107 define:define)
15108         nvtype="long double"
15109         nvsize=$longdblsize
15110         ;;
15111 *)      nvtype=double
15112         nvsize=$doublesize
15113         ;;
15114 esac
15115
15116 $echo "(IV will be "$ivtype", $ivsize bytes)"
15117 $echo "(UV will be "$uvtype", $uvsize bytes)"
15118 $echo "(NV will be "$nvtype", $nvsize bytes)"
15119
15120 $cat >try.c <<EOCP
15121 #$i_inttypes I_INTTYPES
15122 #ifdef I_INTTYPES
15123 #include <inttypes.h>
15124 #endif
15125 #include <stdio.h>
15126 int main() {
15127 #ifdef INT8
15128    int8_t i =  INT8_MAX;
15129   uint8_t u = UINT8_MAX;
15130   printf("int8_t\n");
15131 #endif
15132 #ifdef INT16
15133    int16_t i =  INT16_MAX;
15134   uint16_t i = UINT16_MAX;
15135   printf("int16_t\n");
15136 #endif
15137 #ifdef INT32
15138    int32_t i =  INT32_MAX;
15139   uint32_t u = UINT32_MAX;
15140   printf("int32_t\n");
15141 #endif
15142 }
15143 EOCP
15144
15145 case "$i8type" in
15146 '')     case "$charsize" in
15147         1)      i8type=char
15148                 u8type="unsigned char"
15149                 i8size=$charsize
15150                 u8size=$charsize
15151                 ;;
15152         esac
15153         ;;
15154 esac
15155 case "$i8type" in
15156 '')     set try -DINT8
15157         if eval $compile; then
15158                 case "`$run ./try`" in
15159                 int8_t) i8type=int8_t
15160                         u8type=uint8_t
15161                         i8size=1
15162                         u8size=1
15163                         ;;
15164                 esac
15165         fi
15166         ;;
15167 esac
15168 case "$i8type" in
15169 '')     if $test $charsize -ge 1; then
15170                 i8type=char
15171                 u8type="unsigned char"
15172                 i8size=$charsize
15173                 u8size=$charsize
15174         fi
15175         ;;
15176 esac
15177
15178 case "$i16type" in
15179 '')     case "$shortsize" in
15180         2)      i16type=short
15181                 u16type="unsigned short"
15182                 i16size=$shortsize
15183                 u16size=$shortsize
15184                 ;;
15185         esac
15186         ;;
15187 esac
15188 case "$i16type" in
15189 '')     set try -DINT16
15190         if eval $compile; then
15191                 case "`$run ./try`" in
15192                 int16_t)
15193                         i16type=int16_t
15194                         u16type=uint16_t
15195                         i16size=2
15196                         u16size=2
15197                         ;;
15198                 esac
15199         fi
15200         ;;
15201 esac
15202 case "$i16type" in
15203 '')     if $test $shortsize -ge 2; then
15204                 i16type=short
15205                 u16type="unsigned short"
15206                 i16size=$shortsize
15207                 u16size=$shortsize
15208         fi
15209         ;;
15210 esac
15211
15212 case "$i32type" in
15213 '')     case "$longsize" in
15214         4)      i32type=long
15215                 u32type="unsigned long"
15216                 i32size=$longsize
15217                 u32size=$longsize
15218                 ;;
15219         *)      case "$intsize" in
15220                 4)      i32type=int
15221                         u32type="unsigned int"
15222                         i32size=$intsize
15223                         u32size=$intsize
15224                         ;;
15225                 esac
15226                 ;;
15227         esac
15228         ;;
15229 esac
15230 case "$i32type" in
15231 '')     set try -DINT32
15232         if eval $compile; then
15233                 case "`$run ./try`" in
15234                 int32_t)
15235                         i32type=int32_t
15236                         u32type=uint32_t
15237                         i32size=4
15238                         u32size=4
15239                         ;;
15240                 esac
15241         fi
15242         ;;
15243 esac
15244 case "$i32type" in
15245 '')     if $test $intsize -ge 4; then
15246                 i32type=int
15247                 u32type="unsigned int"
15248                 i32size=$intsize
15249                 u32size=$intsize
15250         fi
15251         ;;
15252 esac
15253
15254 case "$i64type" in
15255 '')     case "$d_quad:$quadtype" in
15256         define:?*)
15257                 i64type="$quadtype"
15258                 u64type="$uquadtype"
15259                 i64size=8
15260                 u64size=8
15261                 ;;
15262         esac
15263         ;;
15264 esac
15265
15266 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15267 : volatile so that the compiler has to store it out to memory.
15268 if test X"$d_volatile" = X"$define"; then
15269         volatile=volatile
15270 fi
15271 $cat <<EOP >try.c
15272 #include <stdio.h>
15273 #$i_stdlib I_STDLIB
15274 #ifdef I_STDLIB
15275 #include <stdlib.h>
15276 #endif
15277 #include <sys/types.h>
15278 #include <signal.h>
15279 #ifdef SIGFPE
15280 $volatile int bletched = 0;
15281 $signal_t blech(int s) { bletched = 1; }
15282 #endif
15283 int main() {
15284     $uvtype u = 0;
15285     $nvtype d;
15286     int     n = 8 * $uvsize;
15287     int     i;
15288 #ifdef SIGFPE
15289     signal(SIGFPE, blech);
15290 #endif
15291
15292     for (i = 0; i < n; i++) {
15293       u = u << 1 | ($uvtype)1;
15294       d = ($nvtype)u;
15295       if (($uvtype)d != u)
15296         break;
15297       if (d <= 0)
15298         break;
15299       d = ($nvtype)(u - 1);
15300       if (($uvtype)d != (u - 1))
15301         break;
15302 #ifdef SIGFPE
15303       if (bletched)
15304         break;
15305 #endif
15306     }
15307     printf("%d\n", ((i == n) ? -n : i));
15308     exit(0);
15309 }
15310 EOP
15311 set try
15312
15313 d_nv_preserves_uv="$undef"
15314 if eval $compile; then
15315         nv_preserves_uv_bits="`$run ./try`"
15316 fi
15317 case "$nv_preserves_uv_bits" in
15318 \-[1-9]*)       
15319         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15320         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15321         d_nv_preserves_uv="$define"
15322         ;;
15323 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15324         d_nv_preserves_uv="$undef" ;;
15325 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15326         nv_preserves_uv_bits="0" ;;
15327 esac
15328
15329 $rm -f try.* try
15330
15331 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15332 : volatile so that the compiler has to store it out to memory.
15333 if test X"$d_volatile" = X"$define"; then
15334         volatile=volatile
15335 fi
15336 $cat <<EOP >try.c
15337 #include <stdio.h>
15338 #$i_stdlib I_STDLIB
15339 #ifdef I_STDLIB
15340 #include <stdlib.h>
15341 #endif
15342 #$i_string I_STRING
15343 #ifdef I_STRING
15344 #  include <string.h>
15345 #else
15346 #  include <strings.h>
15347 #endif
15348 #include <sys/types.h>
15349 #include <signal.h>
15350 #ifdef SIGFPE
15351 $volatile int bletched = 0;
15352 $signal_t blech(int s) { bletched = 1; }
15353 #endif
15354
15355 int checkit($nvtype d, char *where) {
15356     unsigned char *p = (char *)&d;
15357     unsigned char *end = p + sizeof(d);
15358     int fail = 0;
15359
15360     while (p < end)
15361         fail += *p++;
15362
15363     if (!fail)
15364         return 0;
15365
15366     p = (char *)&d;
15367     printf("No - %s: 0x", where);
15368     while (p < end)
15369         printf ("%02X", *p++);
15370     printf("\n");
15371     return 1;
15372 }
15373
15374 int main(int argc, char **argv) {
15375     $nvtype d = 0.0;
15376     int fail = 0;
15377     fail += checkit(d, "0.0");
15378
15379     /* The compiler shouldn't be assuming that bletched is 0  */
15380     d = bletched;
15381
15382     fail += checkit(d, "bleched");
15383
15384 #ifdef SIGFPE
15385     signal(SIGFPE, blech);
15386 #endif
15387
15388     /* Paranoia - the compiler should have no way of knowing that ANSI says
15389        that argv[argc] will always be NULL.  Actually, if it did assume this it
15390        would be buggy, as this is C and main() can be called from elsewhere in
15391        the program.  */
15392     d = argv[argc] ? 1 : 0;
15393
15394     if (d) {
15395         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15396     }
15397
15398     fail += checkit(d, "ternary");
15399
15400     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15401
15402     if (d != 0.0) {
15403         printf("No - memset doesn't give 0.0\n");
15404         /* This might just blow up:  */
15405         printf("(gives %g)\n", d);
15406         return 1;
15407     }
15408     
15409 #ifdef SIGFPE
15410     if (bletched) {
15411         printf("No - something bleched\n");
15412         return 1;
15413     }
15414 #endif
15415     if (fail) {
15416       printf("No - %d fail(s)\n", fail);
15417       return 1;
15418     }
15419     printf("Yes\n");
15420     return 0;
15421 }
15422 EOP
15423 set try
15424
15425 d_nv_zero_is_allbits_zero="$undef"
15426 if eval $compile; then
15427     xxx="`$run ./try`"
15428     case "$?" in
15429         0)
15430             case "$xxx" in
15431                 Yes)  cat >&4 <<EOM
15432 0.0 is represented as all bits zero in memory
15433 EOM
15434                     d_nv_zero_is_allbits_zero="$define"
15435                     ;;
15436                 *)  cat >&4 <<EOM
15437 0.0 is not represented as all bits zero in memory
15438 EOM
15439                     d_nv_zero_is_allbits_zero="$undef"
15440                     ;;
15441             esac
15442             ;;
15443         *)  cat >&4 <<EOM
15444 0.0 is not represented as all bits zero in memory
15445 EOM
15446             d_nv_zero_is_allbits_zero="$undef"
15447             ;;
15448     esac
15449 fi
15450
15451 $rm -f try.* try
15452
15453
15454 : check for off64_t
15455 echo " "
15456 echo "Checking to see if you have off64_t..." >&4
15457 $cat >try.c <<EOCP
15458 #include <sys/types.h>
15459 #include <unistd.h>
15460 int main() { off64_t x = 7; }
15461 EOCP
15462 set try
15463 if eval $compile; then
15464         val="$define"
15465         echo "You have off64_t."
15466 else
15467         val="$undef"
15468         echo "You do not have off64_t."
15469         case "$lseeksize" in
15470         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15471         esac
15472 fi
15473 $rm -f try.* try
15474 set d_off64_t
15475 eval $setvar
15476
15477 : how to create joinable pthreads
15478 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15479         echo " "
15480         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15481         $cat >try.c <<'EOCP'
15482 #include <pthread.h>
15483 int main() {
15484     int detachstate = JOINABLE;
15485 }
15486 EOCP
15487         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15488         if eval $compile; then
15489                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15490                 val="$undef" # Yes, undef.
15491                 set d_old_pthread_create_joinable
15492                 eval $setvar
15493                 val=""
15494                 set old_pthread_create_joinable
15495                 eval $setvar
15496         else
15497                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15498                 if eval $compile; then
15499                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15500                         val="$define"
15501                         set d_old_pthread_create_joinable
15502                         eval $setvar
15503                         val=PTHREAD_CREATE_UNDETACHED
15504                         set old_pthread_create_joinable
15505                         eval $setvar
15506                 else            
15507                         set try -DJOINABLE=__UNDETACHED
15508                         if eval $compile; then
15509                                 echo "You seem to use __UNDETACHED." >&4
15510                                 val="$define"
15511                                 set d_old_pthread_create_joinable
15512                                 eval $setvar
15513                                 val=__UNDETACHED
15514                                 set old_pthread_create_joinable
15515                                 eval $setvar
15516                         else
15517                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15518                                 val="$define"
15519                                 set d_old_pthread_create_joinable
15520                                 eval $setvar
15521                                 val=0
15522                                 set old_pthread_create_joinable
15523                                 eval $setvar
15524                         fi
15525                 fi
15526         fi
15527         $rm -f try try.*
15528 else
15529     d_old_pthread_create_joinable="$undef"
15530     old_pthread_create_joinable=""
15531 fi
15532
15533 : see if pause exists
15534 set pause d_pause
15535 eval $inlibc
15536
15537 : see if pipe exists
15538 set pipe d_pipe
15539 eval $inlibc
15540
15541 : see if poll exists
15542 set poll d_poll
15543 eval $inlibc
15544
15545 : see if readlink exists
15546 set readlink d_readlink
15547 eval $inlibc
15548
15549 echo " "
15550 procselfexe=''
15551 val="$undef"
15552 case "$d_readlink" in
15553 "$define")
15554         if $issymlink /proc/self/exe ; then
15555                 $ls -l /proc/self/exe > reflect
15556                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15557                         echo "You have Linux-like /proc/self/exe."
15558                         procselfexe='"/proc/self/exe"'
15559                         val="$define"
15560                 fi
15561         fi
15562         if $issymlink /proc/curproc/file ; then
15563                 $ls -l /proc/curproc/file > reflect
15564                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15565                         echo "You have BSD-like /proc/curproc/file."
15566                         procselfexe='"/proc/curproc/file"'
15567                         val="$define"
15568                 fi
15569         fi
15570         ;;
15571 esac
15572 $rm -f reflect
15573 set d_procselfexe
15574 eval $setvar
15575
15576 : backward compatibility for d_hvfork
15577 if test X$d_hvfork != X; then
15578         d_vfork="$d_hvfork"
15579         d_hvfork=''
15580 fi
15581 : see if there is a vfork
15582 val=''
15583 set vfork val
15584 eval $inlibc
15585
15586 d_pseudofork=$undef
15587
15588 : Ok, but do we want to use it. vfork is reportedly unreliable in
15589 : perl on Solaris 2.x, and probably elsewhere.
15590 case "$val" in
15591 $define)
15592         echo " "
15593         case "$usevfork" in
15594         false) dflt='n';;
15595         *) dflt='y';;
15596         esac
15597         cat <<'EOM'
15598
15599 Perl can only use a vfork() that doesn't suffer from strict
15600 restrictions on calling functions or modifying global data in
15601 the child.  For example, glibc-2.1 contains such a vfork()
15602 that is unsuitable.  If your system provides a proper fork()
15603 call, chances are that you do NOT want perl to use vfork().
15604
15605 EOM
15606         rp="Do you still want to use vfork()?"
15607         . ./myread
15608         case "$ans" in
15609         y|Y) ;;
15610         *)
15611                 echo "Ok, we won't use vfork()."
15612                 val="$undef"
15613                 ;;
15614         esac
15615         ;;
15616 esac
15617 set d_vfork
15618 eval $setvar
15619 case "$d_vfork" in
15620 $define) usevfork='true';;
15621 *) usevfork='false';;
15622 esac
15623
15624 : see whether the pthread_atfork exists
15625 $cat >try.c <<EOP
15626 #include <pthread.h>
15627 #include <stdio.h>
15628 int main() {
15629 #ifdef  PTHREAD_ATFORK
15630         pthread_atfork(NULL,NULL,NULL);
15631 #endif
15632 }
15633 EOP
15634
15635 : see if pthread_atfork exists
15636 set try -DPTHREAD_ATFORK
15637 if eval $compile; then
15638     val="$define"
15639 else
15640     val="$undef"
15641 fi
15642 case "$usethreads" in
15643 $define)
15644         case "$val" in
15645         $define) echo 'pthread_atfork found.' >&4        ;;
15646         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15647         esac
15648 esac
15649 set d_pthread_atfork
15650 eval $setvar
15651
15652 : see if pthread_attr_setscope exists
15653 set pthread_attr_setscope d_pthread_attr_setscope
15654 eval $inlibc
15655
15656
15657 : see whether the various POSIXish _yields exist
15658 $cat >try.c <<EOP
15659 #include <pthread.h>
15660 #include <stdio.h>
15661 int main() {
15662 #ifdef SCHED_YIELD
15663         sched_yield();
15664 #else
15665 #ifdef PTHREAD_YIELD
15666         pthread_yield();
15667 #else
15668 #ifdef PTHREAD_YIELD_NULL
15669         pthread_yield(NULL);
15670 #endif
15671 #endif
15672 #endif
15673 }
15674 EOP
15675 : see if sched_yield exists
15676 set try -DSCHED_YIELD
15677 if eval $compile; then
15678     val="$define"
15679     sched_yield='sched_yield()'
15680 else
15681     val="$undef"
15682 fi
15683 case "$usethreads" in
15684 $define)
15685         case "$val" in
15686         $define) echo 'sched_yield() found.' >&4        ;;
15687         *)       echo 'sched_yield() NOT found.' >&4    ;;
15688         esac
15689 esac
15690 set d_sched_yield
15691 eval $setvar
15692
15693 : see if pthread_yield exists
15694 set try -DPTHREAD_YIELD
15695 if eval $compile; then
15696     val="$define"
15697     case "$sched_yield" in
15698     '') sched_yield='pthread_yield()' ;;
15699     esac
15700 else
15701     set try -DPTHREAD_YIELD_NULL
15702     if eval $compile; then
15703         val="$define"
15704         case "$sched_yield" in
15705         '') sched_yield='pthread_yield(NULL)' ;;
15706         esac
15707     else
15708         val="$undef"
15709     fi
15710 fi
15711 case "$usethreads" in
15712 $define)
15713         case "$val" in
15714         $define) echo 'pthread_yield() found.' >&4      ;;
15715         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15716         esac
15717         ;;
15718 esac
15719 set d_pthread_yield
15720 eval $setvar
15721
15722 case "$sched_yield" in
15723 '') sched_yield=undef ;;
15724 esac
15725
15726 $rm -f try try.*
15727
15728 : see if random_r exists
15729 set random_r d_random_r
15730 eval $inlibc
15731 case "$d_random_r" in
15732 "$define")
15733         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15734         case "$d_random_r_proto:$usethreads" in
15735         ":define")      d_random_r_proto=define
15736                 set d_random_r_proto random_r $hdrs
15737                 eval $hasproto ;;
15738         *)      ;;
15739         esac
15740         case "$d_random_r_proto" in
15741         define)
15742         case "$random_r_proto" in
15743         ''|0) try='int random_r(int*, struct random_data*);'
15744         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15745         esac
15746         case "$random_r_proto" in
15747         ''|0) try='int random_r(long*, struct random_data*);'
15748         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15749         esac
15750         case "$random_r_proto" in
15751         ''|0) try='int random_r(struct random_data*, int32_t*);'
15752         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15753         esac
15754         case "$random_r_proto" in
15755         ''|0)   d_random_r=undef
15756                 random_r_proto=0
15757                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15758         * )     case "$random_r_proto" in
15759                 REENTRANT_PROTO*) ;;
15760                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15761                 esac
15762                 echo "Prototype: $try" ;;
15763         esac
15764         ;;
15765         *)      case "$usethreads" in
15766                 define) echo "random_r has no prototype, not using it." >&4 ;;
15767                 esac
15768                 d_random_r=undef
15769                 random_r_proto=0
15770                 ;;
15771         esac
15772         ;;
15773 *)      random_r_proto=0
15774         ;;
15775 esac
15776
15777 : see if readdir and friends exist
15778 set readdir d_readdir
15779 eval $inlibc
15780 set seekdir d_seekdir
15781 eval $inlibc
15782 set telldir d_telldir
15783 eval $inlibc
15784 set rewinddir d_rewinddir
15785 eval $inlibc
15786
15787 : see if readdir64_r exists
15788 set readdir64_r d_readdir64_r
15789 eval $inlibc
15790 case "$d_readdir64_r" in
15791 "$define")
15792         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15793         case "$d_readdir64_r_proto:$usethreads" in
15794         ":define")      d_readdir64_r_proto=define
15795                 set d_readdir64_r_proto readdir64_r $hdrs
15796                 eval $hasproto ;;
15797         *)      ;;
15798         esac
15799         case "$d_readdir64_r_proto" in
15800         define)
15801         case "$readdir64_r_proto" in
15802         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15803         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15804         esac
15805         case "$readdir64_r_proto" in
15806         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15807         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15808         esac
15809         case "$readdir64_r_proto" in
15810         ''|0)   d_readdir64_r=undef
15811                 readdir64_r_proto=0
15812                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15813         * )     case "$readdir64_r_proto" in
15814                 REENTRANT_PROTO*) ;;
15815                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15816                 esac
15817                 echo "Prototype: $try" ;;
15818         esac
15819         ;;
15820         *)      case "$usethreads" in
15821                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15822                 esac
15823                 d_readdir64_r=undef
15824                 readdir64_r_proto=0
15825                 ;;
15826         esac
15827         ;;
15828 *)      readdir64_r_proto=0
15829         ;;
15830 esac
15831
15832 : see if readdir_r exists
15833 set readdir_r d_readdir_r
15834 eval $inlibc
15835 case "$d_readdir_r" in
15836 "$define")
15837         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15838         case "$d_readdir_r_proto:$usethreads" in
15839         ":define")      d_readdir_r_proto=define
15840                 set d_readdir_r_proto readdir_r $hdrs
15841                 eval $hasproto ;;
15842         *)      ;;
15843         esac
15844         case "$d_readdir_r_proto" in
15845         define)
15846         case "$readdir_r_proto" in
15847         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15848         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15849         esac
15850         case "$readdir_r_proto" in
15851         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15852         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15853         esac
15854         case "$readdir_r_proto" in
15855         ''|0)   d_readdir_r=undef
15856                 readdir_r_proto=0
15857                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15858         * )     case "$readdir_r_proto" in
15859                 REENTRANT_PROTO*) ;;
15860                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15861                 esac
15862                 echo "Prototype: $try" ;;
15863         esac
15864         ;;
15865         *)      case "$usethreads" in
15866                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15867                 esac
15868                 d_readdir_r=undef
15869                 readdir_r_proto=0
15870                 ;;
15871         esac
15872         ;;
15873 *)      readdir_r_proto=0
15874         ;;
15875 esac
15876
15877 : see if readv exists
15878 set readv d_readv
15879 eval $inlibc
15880
15881 : see if recvmsg exists
15882 set recvmsg d_recvmsg
15883 eval $inlibc
15884
15885 : see if rename exists
15886 set rename d_rename
15887 eval $inlibc
15888
15889 : see if rmdir exists
15890 set rmdir d_rmdir
15891 eval $inlibc
15892
15893 : see if memory.h is available.
15894 val=''
15895 set memory.h val
15896 eval $inhdr
15897
15898 : See if it conflicts with string.h
15899 case "$val" in
15900 $define)
15901         case "$strings" in
15902         '') ;;
15903         *)
15904                 $cppstdin $cppflags $cppminus < $strings > mem.h
15905                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15906                         echo " "
15907                         echo "We won't be including <memory.h>."
15908                         val="$undef"
15909                 fi
15910                 $rm -f mem.h
15911                 ;;
15912         esac
15913 esac
15914 set i_memory
15915 eval $setvar
15916
15917 : can bcopy handle overlapping blocks?
15918 echo " "
15919 val="$undef"
15920 case "$d_memmove" in
15921 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15922 *)      case "$d_bcopy" in
15923         "$define")
15924                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15925                 $cat >try.c <<EOCP
15926 #$i_memory I_MEMORY
15927 #$i_stdlib I_STDLIB
15928 #$i_string I_STRING
15929 #$i_unistd I_UNISTD
15930 EOCP
15931         $cat >>try.c <<'EOCP'
15932 #include <stdio.h>
15933 #ifdef I_MEMORY
15934 #  include <memory.h>
15935 #endif
15936 #ifdef I_STDLIB
15937 #  include <stdlib.h>
15938 #endif
15939 #ifdef I_STRING
15940 #  include <string.h>
15941 #else
15942 #  include <strings.h>
15943 #endif
15944 #ifdef I_UNISTD
15945 #  include <unistd.h>  /* Needed for NetBSD */
15946 #endif
15947 int main()
15948 {
15949 char buf[128], abc[128];
15950 char *b;
15951 int len;
15952 int off;
15953 int align;
15954
15955 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15956    try to store the string in read-only memory. */
15957 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15958
15959 for (align = 7; align >= 0; align--) {
15960         for (len = 36; len; len--) {
15961                 b = buf+align;
15962                 bcopy(abc, b, len);
15963                 for (off = 1; off <= len; off++) {
15964                         bcopy(b, b+off, len);
15965                         bcopy(b+off, b, len);
15966                         if (bcmp(b, abc, len))
15967                                 exit(1);
15968                 }
15969         }
15970 }
15971 exit(0);
15972 }
15973 EOCP
15974                 set try
15975                 if eval $compile_ok; then
15976                         if ./try 2>/dev/null; then
15977                                 echo "Yes, it can."
15978                                 val="$define"
15979                         else
15980                                 echo "It can't, sorry."
15981                         fi
15982                 else
15983                         echo "(I can't compile the test program, so we'll assume not...)"
15984                 fi
15985                 ;;
15986         esac
15987         $rm -f try.* try core
15988         ;;
15989 esac
15990 set d_safebcpy
15991 eval $setvar
15992
15993 : can memcpy handle overlapping blocks?
15994 echo " "
15995 val="$undef"
15996 case "$d_memmove" in
15997 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15998 *)      case "$d_memcpy" in
15999         "$define")
16000                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16001                 $cat >try.c <<EOCP
16002 #$i_memory I_MEMORY
16003 #$i_stdlib I_STDLIB
16004 #$i_string I_STRING
16005 #$i_unistd I_UNISTD
16006 EOCP
16007         $cat >>try.c <<'EOCP'
16008 #include <stdio.h>
16009 #ifdef I_MEMORY
16010 #  include <memory.h>
16011 #endif
16012 #ifdef I_STDLIB
16013 #  include <stdlib.h>
16014 #endif
16015 #ifdef I_STRING
16016 #  include <string.h>
16017 #else
16018 #  include <strings.h>
16019 #endif
16020 #ifdef I_UNISTD
16021 #  include <unistd.h>  /* Needed for NetBSD */
16022 #endif
16023 int main()
16024 {
16025 char buf[128], abc[128];
16026 char *b;
16027 int len;
16028 int off;
16029 int align;
16030
16031 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16032    try to store the string in read-only memory. */
16033 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16034
16035 for (align = 7; align >= 0; align--) {
16036         for (len = 36; len; len--) {
16037                 b = buf+align;
16038                 memcpy(b, abc, len);
16039                 for (off = 1; off <= len; off++) {
16040                         memcpy(b+off, b, len);
16041                         memcpy(b, b+off, len);
16042                         if (memcmp(b, abc, len))
16043                                 exit(1);
16044                 }
16045         }
16046 }
16047 exit(0);
16048 }
16049 EOCP
16050                 set try
16051                 if eval $compile_ok; then
16052                         if ./try 2>/dev/null; then
16053                                 echo "Yes, it can."
16054                                 val="$define"
16055                         else
16056                                 echo "It can't, sorry."
16057                         fi
16058                 else
16059                         echo "(I can't compile the test program, so we'll assume not...)"
16060                 fi
16061                 ;;
16062         esac
16063         $rm -f try.* try core
16064         ;;
16065 esac
16066 set d_safemcpy
16067 eval $setvar
16068
16069 : can memcmp be trusted to compare relative magnitude?
16070 val="$undef"
16071 case "$d_memcmp" in
16072 "$define")
16073         echo " "
16074         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16075         $cat >try.c <<EOCP
16076 #$i_memory I_MEMORY
16077 #$i_stdlib I_STDLIB
16078 #$i_string I_STRING
16079 #$i_unistd I_UNISTD
16080 EOCP
16081         $cat >>try.c <<'EOCP'
16082 #include <stdio.h>
16083 #ifdef I_MEMORY
16084 #  include <memory.h>
16085 #endif
16086 #ifdef I_STDLIB
16087 #  include <stdlib.h>
16088 #endif
16089 #ifdef I_STRING
16090 #  include <string.h>
16091 #else
16092 #  include <strings.h>
16093 #endif
16094 #ifdef I_UNISTD
16095 #  include <unistd.h>  /* Needed for NetBSD */
16096 #endif
16097 int main()
16098 {
16099 char a = -1;
16100 char b = 0;
16101 if ((a < b) && memcmp(&a, &b, 1) < 0)
16102         exit(1);
16103 exit(0);
16104 }
16105 EOCP
16106         set try
16107         if eval $compile_ok; then
16108                 if $run ./try 2>/dev/null; then
16109                         echo "Yes, it can."
16110                         val="$define"
16111                 else
16112                         echo "No, it can't (it uses signed chars)."
16113                 fi
16114         else
16115                 echo "(I can't compile the test program, so we'll assume not...)"
16116         fi
16117         ;;
16118 esac
16119 $rm -f try.* try core
16120 set d_sanemcmp
16121 eval $setvar
16122
16123 : see if prototype for sbrk is available
16124 echo " "
16125 set d_sbrkproto sbrk $i_unistd unistd.h
16126 eval $hasproto
16127
16128 : see if select exists
16129 set select d_select
16130 eval $inlibc
16131
16132 : see if semctl exists
16133 set semctl d_semctl
16134 eval $inlibc
16135
16136 : see if semget exists
16137 set semget d_semget
16138 eval $inlibc
16139
16140 : see if semop exists
16141 set semop d_semop
16142 eval $inlibc
16143
16144 : see how much of the 'sem*(2)' library is present.
16145 h_sem=true
16146 echo " "
16147 case "$d_semctl$d_semget$d_semop" in
16148 *"$undef"*) h_sem=false;;
16149 esac
16150 case "$osname" in
16151 freebsd)
16152     case "`ipcs 2>&1`" in
16153     "SVID messages"*"not configured"*)
16154         echo "Your $osname does not have the sem*(2) configured." >&4
16155         h_sem=false
16156         val="$undef"
16157         set semctl d_semctl
16158         eval $setvar
16159         set semget d_semget
16160         eval $setvar
16161         set semop d_semop
16162         eval $setvar
16163         ;;
16164     esac
16165     ;;
16166 esac
16167 : we could also check for sys/ipc.h ...
16168 if $h_sem && $test `./findhdr sys/sem.h`; then
16169         echo "You have the full sem*(2) library." >&4
16170         val="$define"
16171 else
16172         echo "You don't have the full sem*(2) library." >&4
16173         val="$undef"
16174 fi
16175 set d_sem
16176 eval $setvar
16177
16178 : see whether sys/sem.h defines union semun
16179 echo " "
16180 $cat > try.c <<'END'
16181 #include <sys/types.h>
16182 #include <sys/ipc.h>
16183 #include <sys/sem.h>
16184 int main () { union semun semun; semun.buf = 0; }
16185 END
16186 set try
16187 if eval $compile; then
16188     echo "You have union semun in <sys/sem.h>." >&4
16189     val="$define"
16190 else
16191     echo "You do not have union semun in <sys/sem.h>." >&4
16192     val="$undef"
16193 fi
16194 $rm -f try try.c
16195 set d_union_semun
16196 eval $setvar
16197
16198 : see how to do semctl IPC_STAT
16199 case "$d_sem" in
16200 $define)
16201     echo " "
16202     $cat > try.h <<END
16203 #ifndef S_IRUSR
16204 #   ifdef S_IREAD
16205 #       define S_IRUSR S_IREAD
16206 #       define S_IWUSR S_IWRITE
16207 #       define S_IXUSR S_IEXEC
16208 #   else
16209 #       define S_IRUSR 0400
16210 #       define S_IWUSR 0200
16211 #       define S_IXUSR 0100
16212 #   endif
16213 #   define S_IRGRP (S_IRUSR>>3)
16214 #   define S_IWGRP (S_IWUSR>>3)
16215 #   define S_IXGRP (S_IXUSR>>3)
16216 #   define S_IROTH (S_IRUSR>>6)
16217 #   define S_IWOTH (S_IWUSR>>6)
16218 #   define S_IXOTH (S_IXUSR>>6)
16219 #endif
16220 #ifndef S_IRWXU
16221 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16222 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16223 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16224 #endif
16225 END
16226     : see whether semctl IPC_STAT can use union semun
16227     case "$d_semctl_semun" in
16228     '')
16229       val="$undef"
16230       $cat > try.c <<END
16231 #include <sys/types.h>
16232 #include <sys/ipc.h>
16233 #include <sys/sem.h>
16234 #include <sys/stat.h>
16235 #include <stdio.h>
16236 #include <errno.h>
16237 #include "try.h"
16238 #ifndef errno
16239 extern int errno;
16240 #endif
16241 #$d_union_semun HAS_UNION_SEMUN
16242 int main() {
16243     union semun
16244 #ifndef HAS_UNION_SEMUN
16245     {
16246         int val;
16247         struct semid_ds *buf;
16248         unsigned short *array;
16249     }
16250 #endif
16251     arg;
16252     int sem, st;
16253
16254 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16255     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16256     if (sem > -1) {
16257         struct semid_ds argbuf;
16258         arg.buf = &argbuf;
16259 #       ifdef IPC_STAT
16260         st = semctl(sem, 0, IPC_STAT, arg);
16261         if (st == 0)
16262             printf("semun\n");
16263         else
16264 #       endif /* IPC_STAT */
16265             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16266 #       ifdef IPC_RMID
16267         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16268 #       endif /* IPC_RMID */
16269             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16270     } else
16271 #endif /* IPC_PRIVATE && ... */
16272         printf("semget failed: errno = %d\n", errno);
16273   return 0;
16274 }
16275 END
16276       set try
16277       if eval $compile; then
16278           xxx=`$run ./try`
16279           case "$xxx" in
16280           semun) val="$define" ;;
16281           esac
16282       fi
16283       $rm -f try try.c
16284       set d_semctl_semun
16285       eval $setvar
16286       ;;
16287     esac
16288     case "$d_semctl_semun" in
16289     $define)
16290         echo "You can use union semun for semctl IPC_STAT." >&4
16291         also='also'
16292         ;;
16293     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16294         also=''
16295         ;;
16296     esac
16297
16298     : see whether semctl IPC_STAT can use struct semid_ds pointer
16299     case "$d_semctl_semid_ds" in
16300     '')
16301       val="$undef"
16302       $cat > try.c <<'END'
16303 #include <sys/types.h>
16304 #include <sys/ipc.h>
16305 #include <sys/sem.h>
16306 #include <sys/stat.h>
16307 #include "try.h"
16308 #include <stdio.h>
16309 #include <errno.h>
16310 #ifndef errno
16311 extern int errno;
16312 #endif
16313 int main() {
16314     struct semid_ds arg;
16315     int sem, st;
16316
16317 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16318     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16319     if (sem > -1) {
16320 #       ifdef IPC_STAT
16321         st = semctl(sem, 0, IPC_STAT, &arg);
16322         if (st == 0)
16323             printf("semid_ds\n");
16324         else
16325 #       endif /* IPC_STAT */
16326             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16327 #       ifdef IPC_RMID
16328         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16329 #       endif /* IPC_RMID */
16330             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16331     } else
16332 #endif /* IPC_PRIVATE && ... */
16333         printf("semget failed: errno = %d\n", errno);
16334
16335     return 0;
16336 }
16337 END
16338       set try
16339       if eval $compile; then
16340           xxx=`$run ./try`
16341           case "$xxx" in
16342           semid_ds) val="$define" ;;
16343           esac
16344       fi
16345       $rm -f try try.c
16346       set d_semctl_semid_ds
16347       eval $setvar
16348       ;;
16349     esac
16350     case "$d_semctl_semid_ds" in
16351     $define)
16352         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16353         ;;
16354     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16355         ;;
16356     esac
16357     $rm -f try.h
16358     ;;
16359 *)  val="$undef"
16360
16361     # We do not have the full sem*(2) library, so assume we can not
16362     # use either.
16363
16364     set d_semctl_semun
16365     eval $setvar
16366
16367     set d_semctl_semid_ds
16368     eval $setvar
16369     ;;
16370 esac
16371
16372 : see if sendmsg exists
16373 set sendmsg d_sendmsg
16374 eval $inlibc
16375
16376 : see if setegid exists
16377 set setegid d_setegid
16378 eval $inlibc
16379
16380 : see if seteuid exists
16381 set seteuid d_seteuid
16382 eval $inlibc
16383
16384 : see if setgrent exists
16385 set setgrent d_setgrent
16386 eval $inlibc
16387
16388 : see if setgrent_r exists
16389 set setgrent_r d_setgrent_r
16390 eval $inlibc
16391 case "$d_setgrent_r" in
16392 "$define")
16393         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16394         case "$d_setgrent_r_proto:$usethreads" in
16395         ":define")      d_setgrent_r_proto=define
16396                 set d_setgrent_r_proto setgrent_r $hdrs
16397                 eval $hasproto ;;
16398         *)      ;;
16399         esac
16400         case "$d_setgrent_r_proto" in
16401         define)
16402         case "$setgrent_r_proto" in
16403         ''|0) try='int setgrent_r(FILE**);'
16404         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16405         esac
16406         case "$setgrent_r_proto" in
16407         ''|0) try='void setgrent_r(FILE**);'
16408         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16409         esac
16410         case "$setgrent_r_proto" in
16411         ''|0)   d_setgrent_r=undef
16412                 setgrent_r_proto=0
16413                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16414         * )     case "$setgrent_r_proto" in
16415                 REENTRANT_PROTO*) ;;
16416                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16417                 esac
16418                 echo "Prototype: $try" ;;
16419         esac
16420         ;;
16421         *)      case "$usethreads" in
16422                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16423                 esac
16424                 d_setgrent_r=undef
16425                 setgrent_r_proto=0
16426                 ;;
16427         esac
16428         ;;
16429 *)      setgrent_r_proto=0
16430         ;;
16431 esac
16432
16433 : see if sethostent exists
16434 set sethostent d_sethent
16435 eval $inlibc
16436
16437 : see if sethostent_r exists
16438 set sethostent_r d_sethostent_r
16439 eval $inlibc
16440 case "$d_sethostent_r" in
16441 "$define")
16442         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16443         case "$d_sethostent_r_proto:$usethreads" in
16444         ":define")      d_sethostent_r_proto=define
16445                 set d_sethostent_r_proto sethostent_r $hdrs
16446                 eval $hasproto ;;
16447         *)      ;;
16448         esac
16449         case "$d_sethostent_r_proto" in
16450         define)
16451         case "$sethostent_r_proto" in
16452         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16453         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16454         esac
16455         case "$sethostent_r_proto" in
16456         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16457         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16458         esac
16459         case "$sethostent_r_proto" in
16460         ''|0)   d_sethostent_r=undef
16461                 sethostent_r_proto=0
16462                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16463         * )     case "$sethostent_r_proto" in
16464                 REENTRANT_PROTO*) ;;
16465                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16466                 esac
16467                 echo "Prototype: $try" ;;
16468         esac
16469         ;;
16470         *)      case "$usethreads" in
16471                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16472                 esac
16473                 d_sethostent_r=undef
16474                 sethostent_r_proto=0
16475                 ;;
16476         esac
16477         ;;
16478 *)      sethostent_r_proto=0
16479         ;;
16480 esac
16481
16482 : see if setitimer exists
16483 set setitimer d_setitimer
16484 eval $inlibc
16485
16486 : see if setlinebuf exists
16487 set setlinebuf d_setlinebuf
16488 eval $inlibc
16489
16490 : see if setlocale exists
16491 set setlocale d_setlocale
16492 eval $inlibc
16493
16494 : see if locale.h is available
16495 set locale.h i_locale
16496 eval $inhdr
16497
16498 : see if setlocale_r exists
16499 set setlocale_r d_setlocale_r
16500 eval $inlibc
16501 case "$d_setlocale_r" in
16502 "$define")
16503         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16504         case "$d_setlocale_r_proto:$usethreads" in
16505         ":define")      d_setlocale_r_proto=define
16506                 set d_setlocale_r_proto setlocale_r $hdrs
16507                 eval $hasproto ;;
16508         *)      ;;
16509         esac
16510         case "$d_setlocale_r_proto" in
16511         define)
16512         case "$setlocale_r_proto" in
16513         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16514         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16515         esac
16516         case "$setlocale_r_proto" in
16517         ''|0)   d_setlocale_r=undef
16518                 setlocale_r_proto=0
16519                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16520         * )     case "$setlocale_r_proto" in
16521                 REENTRANT_PROTO*) ;;
16522                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16523                 esac
16524                 echo "Prototype: $try" ;;
16525         esac
16526         ;;
16527         *)      case "$usethreads" in
16528                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16529                 esac
16530                 d_setlocale_r=undef
16531                 setlocale_r_proto=0
16532                 ;;
16533         esac
16534         ;;
16535 *)      setlocale_r_proto=0
16536         ;;
16537 esac
16538
16539 : see if setnetent exists
16540 set setnetent d_setnent
16541 eval $inlibc
16542
16543 : see if setnetent_r exists
16544 set setnetent_r d_setnetent_r
16545 eval $inlibc
16546 case "$d_setnetent_r" in
16547 "$define")
16548         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16549         case "$d_setnetent_r_proto:$usethreads" in
16550         ":define")      d_setnetent_r_proto=define
16551                 set d_setnetent_r_proto setnetent_r $hdrs
16552                 eval $hasproto ;;
16553         *)      ;;
16554         esac
16555         case "$d_setnetent_r_proto" in
16556         define)
16557         case "$setnetent_r_proto" in
16558         ''|0) try='int setnetent_r(int, struct netent_data*);'
16559         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16560         esac
16561         case "$setnetent_r_proto" in
16562         ''|0) try='void setnetent_r(int, struct netent_data*);'
16563         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16564         esac
16565         case "$setnetent_r_proto" in
16566         ''|0)   d_setnetent_r=undef
16567                 setnetent_r_proto=0
16568                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16569         * )     case "$setnetent_r_proto" in
16570                 REENTRANT_PROTO*) ;;
16571                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16572                 esac
16573                 echo "Prototype: $try" ;;
16574         esac
16575         ;;
16576         *)      case "$usethreads" in
16577                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16578                 esac
16579                 d_setnetent_r=undef
16580                 setnetent_r_proto=0
16581                 ;;
16582         esac
16583         ;;
16584 *)      setnetent_r_proto=0
16585         ;;
16586 esac
16587
16588 : see if setprotoent exists
16589 set setprotoent d_setpent
16590 eval $inlibc
16591
16592 : see if setpgid exists
16593 set setpgid d_setpgid
16594 eval $inlibc
16595
16596 : see if setpgrp2 exists
16597 set setpgrp2 d_setpgrp2
16598 eval $inlibc
16599
16600 : see if setpriority exists
16601 set setpriority d_setprior
16602 eval $inlibc
16603
16604 : see if setproctitle exists
16605 set setproctitle d_setproctitle
16606 eval $inlibc
16607
16608 : see if setprotoent_r exists
16609 set setprotoent_r d_setprotoent_r
16610 eval $inlibc
16611 case "$d_setprotoent_r" in
16612 "$define")
16613         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16614         case "$d_setprotoent_r_proto:$usethreads" in
16615         ":define")      d_setprotoent_r_proto=define
16616                 set d_setprotoent_r_proto setprotoent_r $hdrs
16617                 eval $hasproto ;;
16618         *)      ;;
16619         esac
16620         case "$d_setprotoent_r_proto" in
16621         define)
16622         case "$setprotoent_r_proto" in
16623         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16624         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16625         esac
16626         case "$setprotoent_r_proto" in
16627         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16628         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16629         esac
16630         case "$setprotoent_r_proto" in
16631         ''|0)   d_setprotoent_r=undef
16632                 setprotoent_r_proto=0
16633                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16634         * )     case "$setprotoent_r_proto" in
16635                 REENTRANT_PROTO*) ;;
16636                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16637                 esac
16638                 echo "Prototype: $try" ;;
16639         esac
16640         ;;
16641         *)      case "$usethreads" in
16642                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16643                 esac
16644                 d_setprotoent_r=undef
16645                 setprotoent_r_proto=0
16646                 ;;
16647         esac
16648         ;;
16649 *)      setprotoent_r_proto=0
16650         ;;
16651 esac
16652
16653 : see if setpwent exists
16654 set setpwent d_setpwent
16655 eval $inlibc
16656
16657 : see if setpwent_r exists
16658 set setpwent_r d_setpwent_r
16659 eval $inlibc
16660 case "$d_setpwent_r" in
16661 "$define")
16662         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16663         case "$d_setpwent_r_proto:$usethreads" in
16664         ":define")      d_setpwent_r_proto=define
16665                 set d_setpwent_r_proto setpwent_r $hdrs
16666                 eval $hasproto ;;
16667         *)      ;;
16668         esac
16669         case "$d_setpwent_r_proto" in
16670         define)
16671         case "$setpwent_r_proto" in
16672         ''|0) try='int setpwent_r(FILE**);'
16673         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16674         esac
16675         case "$setpwent_r_proto" in
16676         ''|0) try='void setpwent_r(FILE**);'
16677         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16678         esac
16679         case "$setpwent_r_proto" in
16680         ''|0)   d_setpwent_r=undef
16681                 setpwent_r_proto=0
16682                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16683         * )     case "$setpwent_r_proto" in
16684                 REENTRANT_PROTO*) ;;
16685                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16686                 esac
16687                 echo "Prototype: $try" ;;
16688         esac
16689         ;;
16690         *)      case "$usethreads" in
16691                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16692                 esac
16693                 d_setpwent_r=undef
16694                 setpwent_r_proto=0
16695                 ;;
16696         esac
16697         ;;
16698 *)      setpwent_r_proto=0
16699         ;;
16700 esac
16701
16702 : see if setregid exists
16703 set setregid d_setregid
16704 eval $inlibc
16705 set setresgid d_setresgid
16706 eval $inlibc
16707
16708 : see if setreuid exists
16709 set setreuid d_setreuid
16710 eval $inlibc
16711 set setresuid d_setresuid
16712 eval $inlibc
16713
16714 : see if setrgid exists
16715 set setrgid d_setrgid
16716 eval $inlibc
16717
16718 : see if setruid exists
16719 set setruid d_setruid
16720 eval $inlibc
16721
16722 : see if setservent exists
16723 set setservent d_setsent
16724 eval $inlibc
16725
16726 : see if setservent_r exists
16727 set setservent_r d_setservent_r
16728 eval $inlibc
16729 case "$d_setservent_r" in
16730 "$define")
16731         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16732         case "$d_setservent_r_proto:$usethreads" in
16733         ":define")      d_setservent_r_proto=define
16734                 set d_setservent_r_proto setservent_r $hdrs
16735                 eval $hasproto ;;
16736         *)      ;;
16737         esac
16738         case "$d_setservent_r_proto" in
16739         define)
16740         case "$setservent_r_proto" in
16741         ''|0) try='int setservent_r(int, struct servent_data*);'
16742         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16743         esac
16744         case "$setservent_r_proto" in
16745         ''|0) try='void setservent_r(int, struct servent_data*);'
16746         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16747         esac
16748         case "$setservent_r_proto" in
16749         ''|0)   d_setservent_r=undef
16750                 setservent_r_proto=0
16751                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16752         * )     case "$setservent_r_proto" in
16753                 REENTRANT_PROTO*) ;;
16754                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16755                 esac
16756                 echo "Prototype: $try" ;;
16757         esac
16758         ;;
16759         *)      case "$usethreads" in
16760                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16761                 esac
16762                 d_setservent_r=undef
16763                 setservent_r_proto=0
16764                 ;;
16765         esac
16766         ;;
16767 *)      setservent_r_proto=0
16768         ;;
16769 esac
16770
16771 : see if setsid exists
16772 set setsid d_setsid
16773 eval $inlibc
16774
16775 : see if setvbuf exists
16776 set setvbuf d_setvbuf
16777 eval $inlibc
16778
16779 : see if sfio.h is available
16780 set sfio.h i_sfio
16781 eval $inhdr
16782
16783
16784 : see if sfio library is available
16785 case "$i_sfio" in
16786 $define)
16787         val=''
16788         set sfreserve val
16789         eval $inlibc
16790         ;;
16791 *)
16792         val="$undef"
16793         ;;
16794 esac
16795 : Ok, but do we want to use it.
16796 case "$val" in
16797 $define)
16798         case "$usesfio" in
16799         true|$define|[yY]*) dflt='y';;
16800         *) dflt='n';;
16801         esac
16802         echo "$package can use the sfio library, but it is experimental."
16803         case "$useperlio" in
16804         "$undef")
16805             echo "For sfio also the PerlIO abstraction layer is needed."
16806             echo "Earlier you said you wouldn't want that."
16807             ;;
16808         esac
16809         rp="You seem to have sfio available, do you want to try using it?"
16810         . ./myread
16811         case "$ans" in
16812         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16813                 useperlio="$define"
16814                 val="$define"
16815                 ;;
16816         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16817                 val="$undef"
16818                 ;;
16819         esac
16820         ;;
16821 *)      case "$usesfio" in
16822         true|$define|[yY]*)
16823                 echo "Sorry, cannot find sfio on this machine." >&4
16824                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16825                 val="$undef"
16826                 ;;
16827         esac
16828         ;;
16829 esac
16830 set d_sfio
16831 eval $setvar
16832 case "$d_sfio" in
16833 $define) usesfio='true';;
16834 *) usesfio='false';;
16835 esac
16836 case "$d_sfio" in
16837 $define) ;;
16838 *)      : Remove sfio from list of libraries to use
16839         case "$libs" in
16840         *-lsfio*)
16841                 echo "Removing unneeded -lsfio from library list" >&4
16842                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16843                 shift
16844                 libs="$*"
16845                 echo "libs = $libs" >&4
16846                 ;;
16847         esac
16848 ;;
16849 esac
16850
16851
16852 : see if shmctl exists
16853 set shmctl d_shmctl
16854 eval $inlibc
16855
16856 : see if shmget exists
16857 set shmget d_shmget
16858 eval $inlibc
16859
16860 : see if shmat exists
16861 set shmat d_shmat
16862 eval $inlibc
16863 : see what shmat returns
16864 case "$d_shmat" in
16865 "$define")
16866         $cat >shmat.c <<'END'
16867 #include <sys/shm.h>
16868 void *shmat();
16869 END
16870         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16871                 shmattype='void *'
16872         else
16873                 shmattype='char *'
16874         fi
16875         echo "and it returns ($shmattype)." >&4
16876         : see if a prototype for shmat is available
16877         xxx=`./findhdr sys/shm.h`
16878         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16879         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16880                 val="$define"
16881         else
16882                 val="$undef"
16883         fi
16884         $rm -f shmat.[co]
16885         ;;
16886 *)
16887         val="$undef"
16888         ;;
16889 esac
16890 set d_shmatprototype
16891 eval $setvar
16892
16893 : see if shmdt exists
16894 set shmdt d_shmdt
16895 eval $inlibc
16896
16897 : see how much of the 'shm*(2)' library is present.
16898 h_shm=true
16899 echo " "
16900 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16901 *"$undef"*) h_shm=false;;
16902 esac
16903 case "$osname" in
16904 freebsd)
16905     case "`ipcs 2>&1`" in
16906     "SVID shared memory"*"not configured"*)
16907         echo "Your $osname does not have the shm*(2) configured." >&4
16908         h_shm=false
16909         val="$undef"
16910         set shmctl d_shmctl
16911         evat $setvar
16912         set shmget d_shmget
16913         evat $setvar
16914         set shmat d_shmat
16915         evat $setvar
16916         set shmdt d_shmdt
16917         evat $setvar
16918         ;;
16919     esac
16920     ;;
16921 esac
16922 : we could also check for sys/ipc.h ...
16923 if $h_shm && $test `./findhdr sys/shm.h`; then
16924         echo "You have the full shm*(2) library." >&4
16925         val="$define"
16926 else
16927         echo "You don't have the full shm*(2) library." >&4
16928         val="$undef"
16929 fi
16930 set d_shm
16931 eval $setvar
16932
16933 echo " "
16934 : see if we have sigaction
16935 if set sigaction val -f d_sigaction; eval $csym; $val; then
16936         echo 'sigaction() found.' >&4
16937         $cat > try.c <<EOP
16938 #include <stdio.h>
16939 #include <sys/types.h>
16940 #include <signal.h>
16941 #$i_stdlib I_STDLIB
16942 #ifdef I_STDLIB
16943 #include <stdlib.h>
16944 #endif
16945 int main()
16946 {
16947     struct sigaction act, oact;
16948     act.sa_flags = 0;
16949     oact.sa_handler = 0;
16950     /* so that act and oact are used */
16951     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16952 }
16953 EOP
16954         set try
16955         if eval $compile_ok; then
16956                 val="$define"
16957         else
16958                 echo "But you don't seem to have a useable struct sigaction." >&4
16959                 val="$undef"
16960         fi
16961 else
16962         echo 'sigaction NOT found.' >&4
16963         val="$undef"
16964 fi
16965 set d_sigaction; eval $setvar
16966 $rm -f try try$_o try.c
16967
16968 : see if this is a sunmath.h system
16969 set sunmath.h i_sunmath
16970 eval $inhdr
16971
16972 : see if signbit exists
16973 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16974 $cat >try.c <<EOCP
16975 #$i_math I_MATH
16976 #$i_sunmath I_SUNMATH
16977 #ifdef I_MATH
16978 #  include <math.h>
16979 #endif
16980 #ifdef I_SUNMATH  /* Solaris special math library */
16981 #  include <sunmath.h>
16982 #endif
16983 #define NV $nvtype
16984 int main(int argc, char **argv)
16985 {
16986     NV x = 0.0;
16987     NV y = -0.0;
16988     if ((signbit(x) == 0) && (signbit(y) != 0))
16989         return 0;
16990     else
16991         return 1;
16992 }
16993 EOCP
16994 val="$undef"
16995 set try
16996 if eval $compile; then
16997     if $run ./try; then
16998         $echo "Yes." >&4
16999         val="$define"
17000     else
17001         $echo "Signbit seems to be available, but doesn't work as I expected."
17002         $echo "I won't use it." >&4
17003         val="$undef"
17004     fi
17005 else
17006     $echo "Nope." >&4
17007     dflt="$undef"
17008 fi
17009 set d_signbit
17010 eval $setvar
17011 $rm -f try.* try
17012
17013 : see if sigprocmask exists
17014 set sigprocmask d_sigprocmask
17015 eval $inlibc
17016
17017 : see if sigsetjmp exists
17018 echo " "
17019 case "$d_sigsetjmp" in
17020 '')
17021         $cat >try.c <<EOP
17022 #include <setjmp.h>
17023 #$i_stdlib I_STDLIB
17024 #ifdef I_STDLIB
17025 #include <stdlib.h>
17026 #endif
17027 sigjmp_buf env;
17028 int set = 1;
17029 int main()
17030 {
17031         if (sigsetjmp(env,1))
17032                 exit(set);
17033         set = 0;
17034         siglongjmp(env, 1);
17035         exit(1);
17036 }
17037 EOP
17038         set try
17039         if eval $compile; then
17040                 if $run ./try >/dev/null 2>&1; then
17041                         echo "POSIX sigsetjmp found." >&4
17042                         val="$define"
17043                 else
17044                         $cat >&4 <<EOM
17045 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17046 I'll ignore them.
17047 EOM
17048                         val="$undef"
17049                 fi
17050         else
17051                 echo "sigsetjmp not found." >&4
17052                 val="$undef"
17053         fi
17054         ;;
17055 *) val="$d_sigsetjmp"
17056         case "$d_sigsetjmp" in
17057         $define) echo "POSIX sigsetjmp found." >&4;;
17058         $undef) echo "sigsetjmp not found." >&4;;
17059         esac
17060         ;;
17061 esac
17062 set d_sigsetjmp
17063 eval $setvar
17064 $rm -f try.c try
17065
17066 : see if snprintf exists
17067 set snprintf d_snprintf
17068 eval $inlibc
17069
17070 : see if vsnprintf exists
17071 set vsnprintf d_vsnprintf
17072 eval $inlibc
17073
17074 case "$d_snprintf-$d_vsnprintf" in
17075 "$define-$define")
17076     $cat <<EOM
17077 Checking whether your snprintf() and vsnprintf() work okay...
17078 EOM
17079     $cat >try.c <<'EOCP'
17080 /* v?snprintf testing logic courtesy of Russ Allbery.
17081  * According to C99:
17082  * - if the buffer is too short it still must be \0-terminated
17083  * - if the buffer is too short the potentially required length
17084  *   must be returned and not -1
17085  * - if the buffer is NULL the potentially required length
17086  *   must be returned and not -1 or core dump
17087  */
17088 #include <stdio.h>
17089 #include <stdarg.h>
17090
17091 char buf[2];
17092
17093 int test (char *format, ...)
17094 {
17095     va_list args;
17096     int count;
17097
17098     va_start (args, format);
17099     count = vsnprintf (buf, sizeof buf, format, args);
17100     va_end (args);
17101     return count;
17102 }
17103
17104 int main ()
17105 {
17106     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17107              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17108 }
17109 EOCP
17110     set try
17111     if eval $compile; then
17112         `$run ./try`
17113         case "$?" in
17114         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17115         *) cat <<EOM >&4
17116 Your snprintf() and snprintf() don't seem to be working okay.
17117 EOM
17118            d_snprintf="$undef"
17119            d_vsnprintf="$undef"
17120            ;;
17121         esac
17122     else
17123         echo "(I can't seem to compile the test program--assuming they don't)"
17124         d_snprintf="$undef"
17125         d_vsnprintf="$undef"
17126     fi
17127     $rm -f try.* try core core.try.*
17128     ;;
17129 esac
17130
17131 : see if sockatmark exists
17132 set sockatmark d_sockatmark
17133 eval $inlibc
17134
17135 : see if prototype for sockatmark is available
17136 echo " "
17137 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17138 eval $hasproto
17139
17140 : see if socks5_init exists
17141 set socks5_init d_socks5_init
17142 eval $inlibc
17143
17144 : see if sprintf returns the length of the string in the buffer as per ANSI
17145 $echo "Checking whether sprintf returns the length of the string..." >&4
17146 $cat <<EOP >try.c
17147 #include <stdio.h>
17148 #$i_stdlib I_STDLIB
17149 #ifdef I_STDLIB
17150 #include <stdlib.h>
17151 #endif
17152 #$i_string I_STRING
17153 #ifdef I_STRING
17154 #  include <string.h>
17155 #else
17156 #  include <strings.h>
17157 #endif
17158 #$i_math I_MATH
17159 #ifdef I_MATH
17160 #include <math.h>
17161 #endif
17162
17163 char buffer[256];
17164
17165 int check (size_t expect, int test) {
17166   size_t got = strlen(buffer);
17167   if (expect == got)
17168     return 0;
17169
17170   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17171        test, buffer);
17172   exit (test);
17173 }
17174
17175 int main(int argc, char **argv) {
17176   int test = 0;
17177
17178   check(sprintf(buffer, ""), ++test);
17179   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17180   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17181
17182   return 0;
17183 }
17184 EOP
17185 set try
17186
17187 d_sprintf_returns_strlen="$undef"
17188 if eval $compile; then
17189     xxx="`$run ./try`"
17190     case "$?" in
17191         0) cat >&4 <<EOM
17192 sprintf returns the length of the string (as ANSI says it should)
17193 EOM
17194         d_sprintf_returns_strlen="$define"
17195         ;;
17196         *) cat >&4 <<EOM
17197 sprintf does not return the length of the string (how old is this system?)
17198 EOM
17199         d_sprintf_returns_strlen="$undef"
17200         ;;
17201     esac
17202 fi
17203
17204 $rm -f try.* try
17205
17206 : see if srand48_r exists
17207 set srand48_r d_srand48_r
17208 eval $inlibc
17209 case "$d_srand48_r" in
17210 "$define")
17211         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17212         case "$d_srand48_r_proto:$usethreads" in
17213         ":define")      d_srand48_r_proto=define
17214                 set d_srand48_r_proto srand48_r $hdrs
17215                 eval $hasproto ;;
17216         *)      ;;
17217         esac
17218         case "$d_srand48_r_proto" in
17219         define)
17220         case "$srand48_r_proto" in
17221         ''|0) try='int srand48_r(long, struct drand48_data*);'
17222         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17223         esac
17224         case "$srand48_r_proto" in
17225         ''|0)   d_srand48_r=undef
17226                 srand48_r_proto=0
17227                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17228         * )     case "$srand48_r_proto" in
17229                 REENTRANT_PROTO*) ;;
17230                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17231                 esac
17232                 echo "Prototype: $try" ;;
17233         esac
17234         ;;
17235         *)      case "$usethreads" in
17236                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17237                 esac
17238                 d_srand48_r=undef
17239                 srand48_r_proto=0
17240                 ;;
17241         esac
17242         ;;
17243 *)      srand48_r_proto=0
17244         ;;
17245 esac
17246
17247 : see if srandom_r exists
17248 set srandom_r d_srandom_r
17249 eval $inlibc
17250 case "$d_srandom_r" in
17251 "$define")
17252         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17253         case "$d_srandom_r_proto:$usethreads" in
17254         ":define")      d_srandom_r_proto=define
17255                 set d_srandom_r_proto srandom_r $hdrs
17256                 eval $hasproto ;;
17257         *)      ;;
17258         esac
17259         case "$d_srandom_r_proto" in
17260         define)
17261         case "$srandom_r_proto" in
17262         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17263         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17264         esac
17265         case "$srandom_r_proto" in
17266         ''|0)   d_srandom_r=undef
17267                 srandom_r_proto=0
17268                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17269         * )     case "$srandom_r_proto" in
17270                 REENTRANT_PROTO*) ;;
17271                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17272                 esac
17273                 echo "Prototype: $try" ;;
17274         esac
17275         ;;
17276         *)      case "$usethreads" in
17277                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17278                 esac
17279                 d_srandom_r=undef
17280                 srandom_r_proto=0
17281                 ;;
17282         esac
17283         ;;
17284 *)      srandom_r_proto=0
17285         ;;
17286 esac
17287
17288 : see if prototype for setresgid is available
17289 echo " "
17290 set d_sresgproto setresgid $i_unistd unistd.h
17291 eval $hasproto
17292
17293 : see if prototype for setresuid is available
17294 echo " "
17295 set d_sresuproto setresuid $i_unistd unistd.h
17296 eval $hasproto
17297
17298 : see if sys/stat.h is available
17299 set sys/stat.h i_sysstat
17300 eval $inhdr
17301
17302
17303 : see if stat knows about block sizes
17304 echo " "
17305 echo "Checking to see if your struct stat has st_blocks field..." >&4
17306 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17307 eval $hasfield
17308
17309
17310 : see if this is a sys/vfs.h system
17311 set sys/vfs.h i_sysvfs
17312 eval $inhdr
17313
17314
17315 : see if this is a sys/statfs.h system
17316 set sys/statfs.h i_sysstatfs
17317 eval $inhdr
17318
17319
17320 echo " "
17321 echo "Checking to see if your system supports struct statfs..." >&4
17322 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
17323 eval $hasstruct
17324 case "$d_statfs_s" in
17325 "$define")      echo "Yes, it does."   ;;
17326 *)              echo "No, it doesn't." ;;
17327 esac
17328
17329
17330
17331 : see if struct statfs knows about f_flags
17332 case "$d_statfs_s" in
17333 define) 
17334         echo " "
17335         echo "Checking to see if your struct statfs has f_flags field..." >&4
17336         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
17337         eval $hasfield
17338         ;;
17339 *)      val="$undef"
17340         set d_statfs_f_flags
17341         eval $setvar
17342         ;;
17343 esac
17344 case "$d_statfs_f_flags" in
17345 "$define")      echo "Yes, it does."   ;;
17346 *)              echo "No, it doesn't." ;;
17347 esac
17348
17349 $cat >&4 <<EOM
17350 Checking how to access stdio streams by file descriptor number...
17351 EOM
17352 case "$stdio_stream_array" in
17353 '')     $cat >try.c <<EOCP
17354 #include <stdio.h>
17355 int main() {
17356   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17357     printf("yes\n");
17358 }
17359 EOCP
17360         for s in _iob __iob __sF
17361         do
17362                 set try -DSTDIO_STREAM_ARRAY=$s
17363                 if eval $compile; then
17364                         case "`$run ./try`" in
17365                         yes)    stdio_stream_array=$s; break ;;
17366                         esac
17367                 fi
17368         done
17369         $rm -f try.* try$exe_ext
17370 esac
17371 case "$stdio_stream_array" in
17372 '')     $cat >&4 <<EOM
17373 I can't figure out how to access stdio streams by file descriptor number.
17374 EOM
17375         d_stdio_stream_array="$undef"
17376         ;;
17377 *)      $cat >&4 <<EOM
17378 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17379 EOM
17380         d_stdio_stream_array="$define"
17381         ;;
17382 esac
17383
17384 : see if strcoll exists
17385 set strcoll d_strcoll
17386 eval $inlibc
17387
17388 : check for structure copying
17389 echo " "
17390 echo "Checking to see if your C compiler can copy structs..." >&4
17391 $cat >try.c <<'EOCP'
17392 int main()
17393 {
17394         struct blurfl {
17395                 int dyick;
17396         } foo, bar;
17397
17398         foo = bar;
17399 }
17400 EOCP
17401 if $cc -c try.c >/dev/null 2>&1 ; then
17402         val="$define"
17403         echo "Yup, it can."
17404 else
17405         val="$undef"
17406         echo "Nope, it can't."
17407 fi
17408 set d_strctcpy
17409 eval $setvar
17410 $rm -f try.*
17411
17412 : see if strerror and/or sys_errlist[] exist
17413 echo " "
17414 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17415     if set strerror val -f d_strerror; eval $csym; $val; then
17416                 echo 'strerror() found.' >&4
17417                 d_strerror="$define"
17418                 d_strerrm='strerror(e)'
17419                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17420                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17421                         d_syserrlst="$define"
17422                 else
17423                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17424                         d_syserrlst="$undef"
17425                 fi
17426     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17427                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17428                 echo 'strerror() found in string header.' >&4
17429                 d_strerror="$define"
17430                 d_strerrm='strerror(e)'
17431                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17432                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17433                                 d_syserrlst="$define"
17434                 else
17435                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17436                         d_syserrlst="$undef"
17437                 fi
17438     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17439                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17440                 d_strerror="$undef"
17441                 d_syserrlst="$define"
17442                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17443     else
17444                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17445                 d_strerror="$undef"
17446                 d_syserrlst="$undef"
17447                 d_strerrm='"unknown"'
17448     fi
17449 fi
17450
17451 : see if strerror_r exists
17452 set strerror_r d_strerror_r
17453 eval $inlibc
17454 case "$d_strerror_r" in
17455 "$define")
17456         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17457         case "$d_strerror_r_proto:$usethreads" in
17458         ":define")      d_strerror_r_proto=define
17459                 set d_strerror_r_proto strerror_r $hdrs
17460                 eval $hasproto ;;
17461         *)      ;;
17462         esac
17463         case "$d_strerror_r_proto" in
17464         define)
17465         case "$strerror_r_proto" in
17466         ''|0) try='int strerror_r(int, char*, size_t);'
17467         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17468         esac
17469         case "$strerror_r_proto" in
17470         ''|0) try='int strerror_r(int, char*, int);'
17471         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17472         esac
17473         case "$strerror_r_proto" in
17474         ''|0) try='char* strerror_r(int, char*, size_t);'
17475         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17476         esac
17477         case "$strerror_r_proto" in
17478         ''|0)   d_strerror_r=undef
17479                 strerror_r_proto=0
17480                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17481         * )     case "$strerror_r_proto" in
17482                 REENTRANT_PROTO*) ;;
17483                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17484                 esac
17485                 echo "Prototype: $try" ;;
17486         esac
17487         ;;
17488         *)      case "$usethreads" in
17489                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17490                 esac
17491                 d_strerror_r=undef
17492                 strerror_r_proto=0
17493                 ;;
17494         esac
17495         ;;
17496 *)      strerror_r_proto=0
17497         ;;
17498 esac
17499
17500 : see if strftime exists
17501 set strftime d_strftime
17502 eval $inlibc
17503
17504 : see if strlcat exists
17505 set strlcat d_strlcat
17506 eval $inlibc
17507
17508 : see if strlcpy exists
17509 set strlcpy d_strlcpy
17510 eval $inlibc
17511
17512 : see if strtod exists
17513 set strtod d_strtod
17514 eval $inlibc
17515
17516 : see if strtol exists
17517 set strtol d_strtol
17518 eval $inlibc
17519
17520 : see if strtold exists
17521 set strtold d_strtold
17522 eval $inlibc
17523
17524 : see if strtoll exists
17525 set strtoll d_strtoll
17526 eval $inlibc
17527
17528 case "$d_longlong-$d_strtoll" in
17529 "$define-$define")
17530         $cat <<EOM
17531 Checking whether your strtoll() works okay...
17532 EOM
17533         $cat >try.c <<'EOCP'
17534 #include <errno.h>
17535 #ifdef __hpux
17536 #define strtoll __strtoll
17537 #endif
17538 #ifdef __EMX__
17539 #define strtoll _strtoll
17540 #endif
17541 #include <stdio.h>
17542 extern long long int strtoll(char *s, char **, int); 
17543 static int bad = 0;
17544 int check(char *s, long long ell, int een) {
17545         long long gll;
17546         errno = 0;
17547         gll = strtoll(s, 0, 10);
17548         if (!((gll == ell) && (errno == een)))
17549                 bad++;
17550 }
17551 int main() {
17552         check(" 1",                                      1LL, 0);
17553         check(" 0",                                      0LL, 0);
17554         check("-1",                                     -1LL, 0);
17555         check("-9223372036854775808", -9223372036854775808LL, 0);
17556         check("-9223372036854775808", -9223372036854775808LL, 0);
17557         check(" 9223372036854775807",  9223372036854775807LL, 0);
17558         check("-9223372036854775808", -9223372036854775808LL, 0);
17559         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17560         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17561         if (!bad)
17562                 printf("ok\n");
17563 }
17564 EOCP
17565         set try
17566         if eval $compile; then
17567                 yyy=`$run ./try`
17568                 case "$yyy" in
17569                 ok) echo "Your strtoll() seems to be working okay." ;;
17570                 *) cat <<EOM >&4
17571 Your strtoll() doesn't seem to be working okay.
17572 EOM
17573                    d_strtoll="$undef"
17574                    ;;
17575                 esac
17576         else
17577                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17578                 d_strtoll="$undef"
17579         fi
17580         ;;
17581 esac
17582
17583 : see if strtoq exists
17584 set strtoq d_strtoq
17585 eval $inlibc
17586
17587 : see if strtoul exists
17588 set strtoul d_strtoul
17589 eval $inlibc
17590
17591 case "$d_strtoul" in
17592 "$define")
17593         $cat <<EOM
17594 Checking whether your strtoul() works okay...
17595 EOM
17596         $cat >try.c <<'EOCP'
17597 #include <errno.h>
17598 #include <stdio.h>
17599 extern unsigned long int strtoul(char *s, char **, int); 
17600 static int bad = 0;
17601 void check(char *s, unsigned long eul, int een) {
17602         unsigned long gul;
17603         errno = 0;
17604         gul = strtoul(s, 0, 10);
17605         if (!((gul == eul) && (errno == een)))
17606                 bad++;
17607 }
17608 int main() {
17609         check(" 1", 1L, 0);
17610         check(" 0", 0L, 0);
17611 EOCP
17612         case "$longsize" in
17613         8)
17614             $cat >>try.c <<'EOCP'
17615         check("18446744073709551615", 18446744073709551615UL, 0);
17616         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17617 #if 0 /* strtoul() for /^-/ strings is undefined. */
17618         check("-1", 18446744073709551615UL, 0);
17619         check("-18446744073709551614", 2, 0);
17620         check("-18446744073709551615", 1, 0);
17621         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17622         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17623 #endif
17624 EOCP
17625                 ;;
17626         4)
17627                     $cat >>try.c <<'EOCP'
17628         check("4294967295", 4294967295UL, 0);
17629         check("4294967296", 4294967295UL, ERANGE);
17630 #if 0 /* strtoul() for /^-/ strings is undefined. */
17631         check("-1", 4294967295UL, 0);
17632         check("-4294967294", 2, 0);
17633         check("-4294967295", 1, 0);
17634         check("-4294967296", 4294967295UL, ERANGE);
17635         check("-4294967297", 4294967295UL, ERANGE);
17636 #endif
17637 EOCP
17638                 ;;
17639         *)
17640 : Should we write these tests to be more portable by sprintf-ing
17641 : ~0 and then manipulating that char string as input for strtol?
17642                 ;;
17643         esac
17644         $cat >>try.c <<'EOCP'
17645         if (!bad)
17646                 printf("ok\n");
17647         return 0;
17648 }
17649 EOCP
17650         set try
17651         if eval $compile; then
17652                 case "`$run ./try`" in
17653                 ok) echo "Your strtoul() seems to be working okay." ;;
17654                 *) cat <<EOM >&4
17655 Your strtoul() doesn't seem to be working okay.
17656 EOM
17657                    d_strtoul="$undef"
17658                    ;;
17659                 esac
17660         fi
17661         ;;
17662 esac
17663
17664 : see if strtoull exists
17665 set strtoull d_strtoull
17666 eval $inlibc
17667
17668 case "$d_longlong-$d_strtoull" in
17669 "$define-$define")
17670         $cat <<EOM
17671 Checking whether your strtoull() works okay...
17672 EOM
17673         $cat >try.c <<'EOCP'
17674 #include <errno.h>
17675 #ifdef __hpux
17676 #define strtoull __strtoull
17677 #endif
17678 #include <stdio.h>
17679 extern unsigned long long int strtoull(char *s, char **, int); 
17680 static int bad = 0;
17681 int check(char *s, long long eull, int een) {
17682         long long gull;
17683         errno = 0;
17684         gull = strtoull(s, 0, 10);
17685         if (!((gull == eull) && (errno == een)))
17686                 bad++;
17687 }
17688 int main() {
17689         check(" 1",                                        1LL, 0);
17690         check(" 0",                                        0LL, 0);
17691         check("18446744073709551615",  18446744073709551615ULL, 0);
17692         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17693 #if 0 /* strtoull() for /^-/ strings is undefined. */
17694         check("-1",                    18446744073709551615ULL, 0);
17695         check("-18446744073709551614",                     2LL, 0);
17696         check("-18446744073709551615",                     1LL, 0);
17697         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17698         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17699 #endif
17700         if (!bad)
17701                 printf("ok\n");
17702 }
17703 EOCP
17704         set try
17705         if eval $compile; then
17706                 case "`$run ./try`" in
17707                 ok) echo "Your strtoull() seems to be working okay." ;;
17708                 *) cat <<EOM >&4
17709 Your strtoull() doesn't seem to be working okay.
17710 EOM
17711                    d_strtoull="$undef"
17712                    ;;
17713                 esac
17714         fi
17715         ;;
17716 esac
17717
17718 : see if strtouq exists
17719 set strtouq d_strtouq
17720 eval $inlibc
17721
17722 case "$d_strtouq" in
17723 "$define")
17724         $cat <<EOM
17725 Checking whether your strtouq() works okay...
17726 EOM
17727         $cat >try.c <<'EOCP'
17728 #include <errno.h>
17729 #include <stdio.h>
17730 extern unsigned long long int strtouq(char *s, char **, int); 
17731 static int bad = 0;
17732 void check(char *s, unsigned long long eull, int een) {
17733         unsigned long long gull;
17734         errno = 0;
17735         gull = strtouq(s, 0, 10);
17736         if (!((gull == eull) && (errno == een)))
17737                 bad++;
17738 }
17739 int main() {
17740         check(" 1",                                        1LL, 0);
17741         check(" 0",                                        0LL, 0);
17742         check("18446744073709551615",  18446744073709551615ULL, 0);
17743         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17744 #if 0 /* strtouq() for /^-/ strings is undefined. */
17745         check("-1",                    18446744073709551615ULL, 0);
17746         check("-18446744073709551614",                     2LL, 0);
17747         check("-18446744073709551615",                     1LL, 0);
17748         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17749         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17750 #endif
17751         if (!bad)
17752                 printf("ok\n");
17753         return 0;
17754 }
17755 EOCP
17756         set try
17757         if eval $compile; then
17758                 case "`$run ./try`" in
17759                 ok) echo "Your strtouq() seems to be working okay." ;;
17760                 *) cat <<EOM >&4
17761 Your strtouq() doesn't seem to be working okay.
17762 EOM
17763                    d_strtouq="$undef"
17764                    ;;
17765                 esac
17766         fi
17767         ;;
17768 esac
17769
17770 : see if strxfrm exists
17771 set strxfrm d_strxfrm
17772 eval $inlibc
17773
17774 : see if symlink exists
17775 set symlink d_symlink
17776 eval $inlibc
17777
17778 : see if syscall exists
17779 set syscall d_syscall
17780 eval $inlibc
17781
17782 : see if prototype for syscall is available
17783 echo " "
17784 set d_syscallproto syscall $i_unistd unistd.h
17785 eval $hasproto
17786
17787 : see if sysconf exists
17788 set sysconf d_sysconf
17789 eval $inlibc
17790
17791 : see if system exists
17792 set system d_system
17793 eval $inlibc
17794
17795 : see if tcgetpgrp exists
17796 set tcgetpgrp d_tcgetpgrp
17797 eval $inlibc
17798
17799 : see if tcsetpgrp exists
17800 set tcsetpgrp d_tcsetpgrp
17801 eval $inlibc
17802
17803 : see if prototype for telldir is available
17804 echo " "
17805 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17806 eval $hasproto
17807
17808 : see if time exists
17809 echo " "
17810 if test "X$d_time" = X -o X"$timetype" = X; then
17811     if set time val -f d_time; eval $csym; $val; then
17812                 echo 'time() found.' >&4
17813                 val="$define"
17814                 rp="What is the type returned by time() on this system?"
17815                 set time_t timetype long stdio.h sys/types.h
17816                 eval $typedef_ask
17817     else
17818                 echo 'time() not found, hope that will do.' >&4
17819                 val="$undef"
17820                 timetype='int';
17821     fi
17822     set d_time
17823     eval $setvar
17824 fi
17825
17826 : see if this is a sys/times.h system
17827 set sys/times.h i_systimes
17828 eval $inhdr
17829
17830 : see if times exists
17831 echo " "
17832 if set times val -f d_times; eval $csym; $val; then
17833         echo 'times() found.' >&4
17834         d_times="$define"
17835         inc=''
17836         case "$i_systimes" in
17837         "$define") inc='sys/times.h';;
17838         esac
17839         rp="What is the type returned by times() on this system?"
17840         set clock_t clocktype long stdio.h sys/types.h $inc
17841         eval $typedef_ask
17842 else
17843         echo 'times() NOT found, hope that will do.' >&4
17844         d_times="$undef"
17845         clocktype='int'
17846 fi
17847
17848 : see if tmpnam_r exists
17849 set tmpnam_r d_tmpnam_r
17850 eval $inlibc
17851 case "$d_tmpnam_r" in
17852 "$define")
17853         hdrs="$i_systypes sys/types.h define stdio.h "
17854         case "$d_tmpnam_r_proto:$usethreads" in
17855         ":define")      d_tmpnam_r_proto=define
17856                 set d_tmpnam_r_proto tmpnam_r $hdrs
17857                 eval $hasproto ;;
17858         *)      ;;
17859         esac
17860         case "$d_tmpnam_r_proto" in
17861         define)
17862         case "$tmpnam_r_proto" in
17863         ''|0) try='char* tmpnam_r(char*);'
17864         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17865         esac
17866         case "$tmpnam_r_proto" in
17867         ''|0)   d_tmpnam_r=undef
17868                 tmpnam_r_proto=0
17869                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17870         * )     case "$tmpnam_r_proto" in
17871                 REENTRANT_PROTO*) ;;
17872                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17873                 esac
17874                 echo "Prototype: $try" ;;
17875         esac
17876         ;;
17877         *)      case "$usethreads" in
17878                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17879                 esac
17880                 d_tmpnam_r=undef
17881                 tmpnam_r_proto=0
17882                 ;;
17883         esac
17884         ;;
17885 *)      tmpnam_r_proto=0
17886         ;;
17887 esac
17888
17889 : see if truncate exists
17890 set truncate d_truncate
17891 eval $inlibc
17892
17893 : see if ttyname_r exists
17894 set ttyname_r d_ttyname_r
17895 eval $inlibc
17896 case "$d_ttyname_r" in
17897 "$define")
17898         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17899         case "$d_ttyname_r_proto:$usethreads" in
17900         ":define")      d_ttyname_r_proto=define
17901                 set d_ttyname_r_proto ttyname_r $hdrs
17902                 eval $hasproto ;;
17903         *)      ;;
17904         esac
17905         case "$d_ttyname_r_proto" in
17906         define)
17907         case "$ttyname_r_proto" in
17908         ''|0) try='int ttyname_r(int, char*, size_t);'
17909         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17910         esac
17911         case "$ttyname_r_proto" in
17912         ''|0) try='int ttyname_r(int, char*, int);'
17913         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17914         esac
17915         case "$ttyname_r_proto" in
17916         ''|0) try='char* ttyname_r(int, char*, int);'
17917         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17918         esac
17919         case "$ttyname_r_proto" in
17920         ''|0)   d_ttyname_r=undef
17921                 ttyname_r_proto=0
17922                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17923         * )     case "$ttyname_r_proto" in
17924                 REENTRANT_PROTO*) ;;
17925                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17926                 esac
17927                 echo "Prototype: $try" ;;
17928         esac
17929         ;;
17930         *)      case "$usethreads" in
17931                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17932                 esac
17933                 d_ttyname_r=undef
17934                 ttyname_r_proto=0
17935                 ;;
17936         esac
17937         ;;
17938 *)      ttyname_r_proto=0
17939         ;;
17940 esac
17941
17942 : see if tzname[] exists
17943 echo " "
17944 if set tzname val -a d_tzname; eval $csym; $val; then
17945         val="$define"
17946         echo 'tzname[] found.' >&4
17947 else
17948         val="$undef"
17949         echo 'tzname[] NOT found.' >&4
17950 fi
17951 set d_tzname
17952 eval $setvar
17953
17954 case "$osname" in
17955 next|rhapsody|darwin) multiarch="$define" ;;
17956 esac
17957 case "$multiarch" in
17958 ''|[nN]*) multiarch="$undef" ;;
17959 esac
17960
17961 : check for ordering of bytes in a UV
17962 echo " "
17963 case "$usecrosscompile$multiarch" in
17964 *$define*)
17965         $cat <<EOM
17966 You seem to be either cross-compiling or doing a multiarchitecture build,
17967 skipping the byteorder check.
17968
17969 EOM
17970         byteorder='ffff'
17971         ;;
17972 *)
17973         case "$byteorder" in
17974         '')
17975                 $cat <<'EOM'
17976 In the following, larger digits indicate more significance.  A big-endian
17977 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17978 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17979 machines may have weird orders like 3412.  A Cray will report 87654321,
17980 an Alpha will report 12345678. If the test program works the default is
17981 probably right.
17982 I'm now running the test program...
17983 EOM
17984                 $cat >try.c <<EOCP
17985 #include <stdio.h>
17986 #$i_stdlib I_STDLIB
17987 #ifdef I_STDLIB
17988 #include <stdlib.h>
17989 #endif
17990 #include <sys/types.h>
17991 typedef $uvtype UV;
17992 int main()
17993 {
17994         int i;
17995         union {
17996                 UV l;
17997                 char c[$uvsize];
17998         } u;
17999
18000         if ($uvsize > 4)
18001                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18002         else
18003                 u.l = (UV)0x04030201;
18004         for (i = 0; i < $uvsize; i++)
18005                 printf("%c", u.c[i]+'0');
18006         printf("\n");
18007         exit(0);
18008 }
18009 EOCP
18010                 xxx_prompt=y
18011                 set try
18012                 if eval $compile && ./try > /dev/null; then
18013                         dflt=`$run ./try`
18014                         case "$dflt" in
18015                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18016                                 echo "(The test program ran ok.)"
18017                                 echo "byteorder=$dflt"
18018                                 xxx_prompt=n
18019                         ;;
18020                         ????|????????) echo "(The test program ran ok.)" ;;
18021                         *) echo "(The test program didn't run right for some reason.)" ;;
18022                         esac
18023                 else
18024                         dflt='4321'
18025                         cat <<'EOM'
18026 (I can't seem to compile the test program.  Guessing big-endian...)
18027 EOM
18028                 fi
18029                 case "$xxx_prompt" in
18030                 y)
18031                         rp="What is the order of bytes in $uvtype?"
18032                         . ./myread
18033                         byteorder="$ans"
18034                         ;;
18035                 *)      byteorder=$dflt
18036                         ;;
18037                 esac
18038                 ;;
18039         esac
18040         $rm -f try.c try
18041         ;;
18042 esac
18043
18044
18045 $cat <<EOM
18046
18047 Checking to see whether you can access character data unalignedly...
18048 EOM
18049 case "$d_u32align" in
18050 '')   $cat >try.c <<EOCP
18051 #include <stdio.h>
18052 #$i_stdlib I_STDLIB
18053 #ifdef I_STDLIB
18054 #include <stdlib.h>
18055 #endif
18056 #define U32 $u32type
18057 #define BYTEORDER 0x$byteorder
18058 #define U8 $u8type
18059 #include <signal.h>
18060 #ifdef SIGBUS
18061 $signal_t bletch(int s) { exit(4); }
18062 #endif
18063 int main() {
18064 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18065     U8 buf[8];
18066     U32 *up;
18067     int i;
18068
18069     if (sizeof(U32) != 4) {
18070         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18071         exit(1);
18072     }
18073
18074     fflush(stdout);
18075
18076 #ifdef SIGBUS
18077     signal(SIGBUS, bletch);
18078 #endif
18079
18080     buf[0] = 0;
18081     buf[1] = 0;
18082     buf[2] = 0;
18083     buf[3] = 1;
18084     buf[4] = 0;
18085     buf[5] = 0;
18086     buf[6] = 0;
18087     buf[7] = 1;
18088
18089     for (i = 0; i < 4; i++) {
18090         up = (U32*)(buf + i);
18091         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18092                (*up == 1 << (8*(3-i)))  /* little-endian */
18093               )
18094            )
18095         {
18096             printf("read failed (%x)\n", *up);
18097             exit(2);
18098         }
18099     }
18100
18101     /* write test */
18102     for (i = 0; i < 4; i++) {
18103         up = (U32*)(buf + i);
18104         *up = 0xBeef;
18105         if (*up != 0xBeef) {
18106             printf("write failed (%x)\n", *up);
18107             exit(3);
18108         }
18109     }
18110
18111     exit(0);
18112 #else
18113     printf("1\n");
18114     exit(1);
18115 #endif
18116     return 0;
18117 }
18118 EOCP
18119 set try
18120 if eval $compile_ok; then
18121         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18122         $run ./try 2>&1 >/dev/null
18123         case "$?" in
18124         0)      cat >&4 <<EOM
18125 You can access character data pretty unalignedly.
18126 EOM
18127                 d_u32align="$undef"
18128                 ;;
18129         *)      cat >&4 <<EOM
18130 It seems that you must access character data in an aligned manner.
18131 EOM
18132                 d_u32align="$define"
18133                 ;;
18134         esac
18135 else
18136         rp='Can you access character data at unaligned addresses?'
18137         dflt='n'
18138         . ./myread
18139         case "$ans" in
18140         [yY]*)  d_u32align="$undef"  ;;
18141         *)      d_u32align="$define" ;;
18142         esac
18143 fi
18144 $rm -f core core.try.* try.core
18145 ;;
18146 esac
18147
18148 : see if ualarm exists
18149 set ualarm d_ualarm
18150 eval $inlibc
18151
18152 : see if umask exists
18153 set umask d_umask
18154 eval $inlibc
18155
18156 : see if unordered exists
18157 set unordered d_unordered
18158 eval $inlibc
18159
18160 : see if unsetenv exists
18161 set unsetenv d_unsetenv
18162 eval $inlibc
18163
18164 : see if usleep exists
18165 set usleep d_usleep
18166 eval $inlibc
18167
18168 : see if prototype for usleep is available
18169 echo " "
18170 set d_usleepproto usleep $i_unistd unistd.h
18171 eval $hasproto
18172
18173 : see if ustat exists
18174 set ustat d_ustat
18175 eval $inlibc
18176
18177 : see if closedir exists
18178 set closedir d_closedir
18179 eval $inlibc
18180
18181 case "$d_closedir" in
18182 "$define")
18183         echo " "
18184         echo "Checking whether closedir() returns a status..." >&4
18185         cat > try.c <<EOM
18186 #$i_dirent I_DIRENT             /**/
18187 #$i_sysdir I_SYS_DIR            /**/
18188 #$i_sysndir I_SYS_NDIR          /**/
18189 #$i_systypes I_SYS_TYPES        /**/
18190
18191 #if defined(I_SYS_TYPES)
18192 #include <sys/types.h>
18193 #endif
18194 #if defined(I_DIRENT)
18195 #include <dirent.h>
18196 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18197 #include <sys/dir.h>
18198 #endif
18199 #else
18200 #ifdef I_SYS_NDIR
18201 #include <sys/ndir.h>
18202 #else
18203 #ifdef I_SYS_DIR
18204 #ifdef hp9000s500
18205 #include <ndir.h>       /* may be wrong in the future */
18206 #else
18207 #include <sys/dir.h>
18208 #endif
18209 #endif
18210 #endif
18211 #endif 
18212 int main() { return closedir(opendir(".")); }
18213 EOM
18214         set try
18215         if eval $compile_ok; then
18216                 if $run ./try > /dev/null 2>&1 ; then
18217                         echo "Yes, it does."
18218                         val="$undef"
18219                 else
18220                         echo "No, it doesn't."
18221                         val="$define"
18222                 fi
18223         else
18224                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18225                 val="$define"
18226         fi
18227         ;;
18228 *)
18229         val="$undef";
18230         ;;
18231 esac
18232 set d_void_closedir
18233 eval $setvar
18234 $rm -f try try.*
18235 : see if there is a wait4
18236 set wait4 d_wait4
18237 eval $inlibc
18238
18239 : see if waitpid exists
18240 set waitpid d_waitpid
18241 eval $inlibc
18242
18243 : see if wcstombs exists
18244 set wcstombs d_wcstombs
18245 eval $inlibc
18246
18247 : see if wctomb exists
18248 set wctomb d_wctomb
18249 eval $inlibc
18250
18251 : see if writev exists
18252 set writev d_writev
18253 eval $inlibc
18254
18255 : preserve RCS keywords in files with variable substitution, grrr
18256 Date='$Date'
18257 Id='$Id'
18258 Log='$Log'
18259 RCSfile='$RCSfile'
18260 Revision='$Revision'
18261
18262 : check for alignment requirements
18263 echo " "
18264 case "$usecrosscompile$multiarch" in
18265 *$define*)
18266         $cat <<EOM
18267 You seem to be either cross-compiling or doing a multiarchitecture build,
18268 skipping the memory alignment check.
18269
18270 EOM
18271         case "$alignbytes" in
18272         '') alignbytes=8 ;;
18273         esac
18274         ;;
18275 *)
18276         case "$alignbytes" in
18277         '') echo "Checking alignment constraints..." >&4
18278                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18279                         $cat >try.c <<'EOCP'
18280 typedef long double NV;
18281 EOCP
18282                 else
18283                         $cat >try.c <<'EOCP'
18284 typedef double NV;
18285 EOCP
18286                 fi
18287                 $cat >>try.c <<'EOCP'
18288 #include <stdio.h>
18289 struct foobar {
18290         char foo;
18291         NV bar;
18292 } try_algn;
18293 int main()
18294 {
18295     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18296     return(0);
18297 }
18298 EOCP
18299                 set try
18300                 if eval $compile_ok; then
18301                         dflt=`$run ./try`
18302                 else
18303                         dflt='8'
18304                         echo "(I can't seem to compile the test program...)"
18305                 fi
18306                 ;;
18307         *) dflt="$alignbytes"
18308                 ;;
18309         esac
18310         rp="Doubles must be aligned on a how-many-byte boundary?"
18311         . ./myread
18312         alignbytes="$ans"
18313         $rm -f try.c try
18314         ;;
18315 esac
18316
18317
18318 : set the base revision
18319 baserev=5.0
18320
18321 : how do we concatenate cpp tokens here?
18322 echo " "
18323 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18324 $cat >cpp_stuff.c <<'EOCP'
18325 #define RCAT(a,b)a/**/b
18326 #define ACAT(a,b)a ## b
18327 RCAT(Rei,ser)
18328 ACAT(Cir,cus)
18329 EOCP
18330 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18331 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18332         echo "Oh!  Smells like ANSI's been here." >&4
18333         echo "We can catify or stringify, separately or together!"
18334         cpp_stuff=42
18335 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18336         echo "Ah, yes!  The good old days!" >&4
18337         echo "However, in the good old days we don't know how to stringify and"
18338         echo "catify at the same time."
18339         cpp_stuff=1
18340 else
18341         $cat >&4 <<EOM
18342 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18343 You're going to have to edit the values of CAT[2-5] in config.h...
18344 EOM
18345         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18346 fi
18347 $rm -f cpp_stuff.*
18348
18349 : see if this is a db.h system
18350 set db.h i_db
18351 eval $inhdr
18352
18353 case "$i_db" in
18354 $define)
18355         : Check db version.
18356         echo " "
18357         echo "Checking Berkeley DB version ..." >&4
18358         $cat >try.c <<EOCP
18359 #$d_const HASCONST
18360 #ifndef HASCONST
18361 #define const
18362 #endif
18363 #include <sys/types.h>
18364 #include <stdio.h>
18365 #$i_stdlib I_STDLIB
18366 #ifdef I_STDLIB
18367 #include <stdlib.h>
18368 #endif
18369 #include <db.h>
18370 int main(int argc, char *argv[])
18371 {
18372 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18373     int Major, Minor, Patch ;
18374     unsigned long Version ;
18375     (void)db_version(&Major, &Minor, &Patch) ;
18376     if (argc == 2) {
18377         printf("%d %d %d %d %d %d\n",
18378                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18379                Major, Minor, Patch);
18380         exit(0);
18381     }
18382     printf("You have Berkeley DB Version 2 or greater.\n");
18383
18384     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18385                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18386     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18387                 Major, Minor, Patch) ;
18388
18389     /* check that db.h & libdb are compatible */
18390     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18391         printf("db.h and libdb are incompatible.\n") ;
18392         exit(3);        
18393     }
18394
18395     printf("db.h and libdb are compatible.\n") ;
18396
18397     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18398                 + DB_VERSION_PATCH ;
18399
18400     /* needs to be >= 2.3.4 */
18401     if (Version < 2003004) {
18402     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18403         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18404         exit(2);        
18405     }
18406
18407     exit(0);
18408 #else
18409 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18410     if (argc == 2) {
18411         printf("1 0 0\n");
18412         exit(0);
18413     }
18414     printf("You have Berkeley DB Version 1.\n");
18415     exit(0);    /* DB version < 2: the coast is clear. */
18416 #else
18417     exit(1);    /* <db.h> not Berkeley DB? */
18418 #endif
18419 #endif
18420 }
18421 EOCP
18422         set try
18423         if eval $compile_ok && $run ./try; then
18424                 echo 'Looks OK.' >&4
18425                 set `$run ./try 1`
18426                 db_version_major=$1
18427                 db_version_minor=$2
18428                 db_version_patch=$3
18429         else
18430                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18431                 i_db=$undef
18432                 case " $libs " in
18433                 *"-ldb "*)
18434                         : Remove db from list of libraries to use
18435                         echo "Removing unusable -ldb from library list" >&4
18436                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18437                         shift
18438                         libs="$*"
18439                         echo "libs = $libs" >&4
18440                         ;;
18441                 esac
18442         fi
18443         $rm -f try.*
18444         ;;
18445 esac
18446
18447 case "$i_db" in
18448 define)
18449         : Check the return type needed for hash 
18450         echo " "
18451         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18452         $cat >try.c <<EOCP
18453 #$d_const HASCONST
18454 #ifndef HASCONST
18455 #define const
18456 #endif
18457 #include <sys/types.h>
18458 #include <db.h>
18459
18460 #ifndef DB_VERSION_MAJOR
18461 u_int32_t hash_cb (ptr, size)
18462 const void *ptr;
18463 size_t size;
18464 {
18465 }
18466 HASHINFO info;
18467 int main()
18468 {
18469         info.hash = hash_cb;
18470 }
18471 #endif
18472 EOCP
18473         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18474                 if $contains warning try.out >>/dev/null 2>&1 ; then
18475                         db_hashtype='int'
18476                 else
18477                         db_hashtype='u_int32_t'
18478                 fi
18479         else
18480                 : XXX Maybe we should just give up here.
18481                 db_hashtype=u_int32_t
18482                 $cat try.out >&4
18483                 echo "Help:  I can't seem to compile the db test program." >&4
18484                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18485         fi
18486         $rm -f try.*
18487         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18488         ;;
18489 *)      db_hashtype=u_int32_t
18490         ;;
18491 esac
18492 case "$i_db" in
18493 define)
18494         : Check the return type needed for prefix 
18495         echo " "
18496         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18497         cat >try.c <<EOCP
18498 #$d_const HASCONST
18499 #ifndef HASCONST
18500 #define const
18501 #endif
18502 #include <sys/types.h>
18503 #include <db.h>
18504
18505 #ifndef DB_VERSION_MAJOR
18506 size_t prefix_cb (key1, key2)
18507 const DBT *key1;
18508 const DBT *key2;
18509 {
18510 }
18511 BTREEINFO info;
18512 int main()
18513 {
18514         info.prefix = prefix_cb;
18515 }
18516 #endif
18517 EOCP
18518         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18519                 if $contains warning try.out >>/dev/null 2>&1 ; then
18520                         db_prefixtype='int'
18521                 else
18522                         db_prefixtype='size_t'
18523                 fi
18524         else
18525                 db_prefixtype='size_t'
18526                 : XXX Maybe we should just give up here.
18527                 $cat try.out >&4
18528                 echo "Help:  I can't seem to compile the db test program." >&4
18529                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18530         fi
18531         $rm -f try.*
18532         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18533         ;;
18534 *)      db_prefixtype='size_t'
18535         ;;
18536 esac
18537
18538
18539 : How can we generate normalized random numbers ?
18540 echo " "
18541 echo "Looking for a random number function..." >&4
18542 case "$randfunc" in
18543 '')
18544         if set drand48 val -f; eval $csym; $val; then
18545                 dflt="drand48"
18546                 echo "Good, found drand48()." >&4
18547         elif set random val -f; eval $csym; $val; then
18548                 dflt="random"
18549                 echo "OK, found random()." >&4
18550         else
18551                 dflt="rand"
18552                 echo "Yick, looks like I have to use rand()." >&4
18553         fi
18554         echo " "
18555         ;;
18556 *)
18557         dflt="$randfunc"
18558         ;;
18559 esac
18560 cont=true
18561
18562 case "$ccflags" in
18563 *-Dmy_rand=*|*-Dmy_srand=*)
18564         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18565         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18566         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18567         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18568         ;;
18569 esac
18570
18571 while $test "$cont"; do
18572         rp="Use which function to generate random numbers?"
18573         . ./myread
18574         if $test "$ans" = "$dflt"; then
18575                 : null
18576         else
18577                 randbits=''
18578         fi
18579         randfunc="$ans"
18580         if set $ans val -f; eval $csym; $val; then
18581                 cont=''
18582         else
18583                 dflt=y
18584                 rp="I cannot find function $ans. Use that name anyway?"
18585                 . ./myread
18586                 dflt=rand
18587                 case "$ans" in
18588                         [yY]*) cont='';;
18589                 esac
18590         fi
18591         case "$cont" in
18592         '')
18593                 case "$randfunc" in
18594                 drand48)
18595                         drand01="drand48()"
18596                         seedfunc="srand48"
18597                         randbits=48
18598                         randseedtype=long
18599                         ;;
18600                 rand|random)
18601                         case "$randbits" in
18602                         '')
18603 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18604                                 $cat >try.c <<EOCP
18605 #$i_unistd I_UNISTD
18606 #$i_stdlib I_STDLIB
18607 #include <stdio.h>
18608 #ifdef I_UNISTD
18609 #  include <unistd.h>
18610 #endif
18611 #ifdef I_STDLIB
18612 #  include <stdlib.h>
18613 #endif
18614 int main()
18615 {
18616         register int i;
18617         register unsigned long tmp;
18618         register unsigned long max = 0L;
18619
18620         for (i = 1000; i; i--) {
18621                 tmp = (unsigned long) $randfunc();
18622                 if (tmp > max) max = tmp;
18623         }
18624         for (i = 0; max; i++)
18625                 max /= 2;
18626         printf("%d\n",i);
18627 }
18628 EOCP
18629                                 set try
18630                                 if eval $compile_ok; then
18631                                         dflt=`try`
18632                                 else
18633                                         dflt='?'
18634                                         echo "(I can't seem to compile the test program...)"
18635                                 fi
18636                                 ;;
18637                         *)
18638                                 dflt="$randbits"
18639                                 ;;
18640                         esac
18641                         rp="How many bits does your $randfunc() function produce?"
18642                         . ./myread
18643                         randbits="$ans"
18644                         $rm -f try.c try
18645                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18646                         seedfunc="s$randfunc"
18647                         randseedtype=unsigned
18648                         ;;
18649                 *)
18650                         dflt="31"
18651                         rp="How many bits does your $randfunc() function produce?"
18652                         . ./myread
18653                         randbits="$ans"
18654                         seedfunc="s$randfunc"
18655                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18656                         if set $seedfunc val -f; eval $csym; $val; then
18657                                 echo "(Using $seedfunc() to seed random generator)"
18658                         else
18659                                 echo "(Warning: no $seedfunc() to seed random generator)"
18660                                 seedfunc=rand
18661                         fi
18662                         randseedtype=unsigned
18663                         ;;
18664                 esac
18665                 ;;
18666         esac
18667 done
18668
18669 echo " "
18670 echo "Determining whether or not we are on an EBCDIC system..." >&4
18671 $cat >try.c <<'EOM'
18672 int main()
18673 {
18674   if ('M'==0xd4) return 0;
18675   return 1;
18676 }
18677 EOM
18678
18679 val=$undef
18680 set try
18681 if eval $compile_ok; then
18682         if $run ./try; then
18683                 echo "You seem to speak EBCDIC." >&4
18684                 val="$define"
18685         else
18686                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18687         fi
18688 else
18689         echo "I'm unable to compile the test program." >&4
18690         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18691 fi
18692 $rm -f try try.*
18693 set ebcdic
18694 eval $setvar
18695
18696 echo " "
18697 $cat >&4 <<EOM
18698 Checking how to flush all pending stdio output...
18699 EOM
18700 # I only know how to find the first 32 possibly open files on SunOS.
18701 # See also hints/sunos_4_1.sh and util.c  --AD
18702 case "$osname" in
18703 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18704 esac
18705 $cat >>try.c <<EOCP
18706 #include <stdio.h>
18707 #$i_stdlib I_STDLIB
18708 #ifdef I_STDLIB
18709 #include <stdlib.h>
18710 #endif
18711 #$i_unistd I_UNISTD
18712 #ifdef I_UNISTD
18713 # include <unistd.h>
18714 #endif
18715 #$d_sysconf HAS_SYSCONF
18716 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18717 #ifdef HAS_STDIO_STREAM_ARRAY
18718 # define STDIO_STREAM_ARRAY $stdio_stream_array
18719 #endif
18720 int main() {
18721   FILE* p;
18722   unlink("try.out");
18723   p = fopen("try.out", "w");
18724 #ifdef TRY_FPUTC
18725   fputc('x', p);
18726 #else
18727 # ifdef TRY_FPRINTF
18728   fprintf(p, "x");
18729 # endif
18730 #endif
18731 #ifdef TRY_FFLUSH_NULL
18732   fflush(NULL);
18733 #endif
18734 #ifdef TRY_FFLUSH_ALL
18735   {
18736     long open_max = -1;
18737 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18738     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18739 # else
18740 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18741     open_max = sysconf(_SC_OPEN_MAX);
18742 #  else
18743 #   ifdef FOPEN_MAX
18744     open_max = FOPEN_MAX;
18745 #   else
18746 #    ifdef OPEN_MAX
18747     open_max = OPEN_MAX;
18748 #    else
18749 #     ifdef _NFILE
18750     open_max = _NFILE;
18751 #     endif
18752 #    endif
18753 #   endif
18754 #  endif
18755 # endif 
18756 # ifdef HAS_STDIO_STREAM_ARRAY
18757     if (open_max > 0) {
18758       long i;
18759       for (i = 0; i < open_max; i++)
18760             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18761                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18762                 STDIO_STREAM_ARRAY[i]._flag)
18763                 fflush(&STDIO_STREAM_ARRAY[i]);
18764     }   
18765   }
18766 # endif
18767 #endif
18768   _exit(42);
18769 }
18770 EOCP
18771 : first we have to find out how _not_ to flush
18772 $to try.c
18773 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18774     output=''
18775     set try -DTRY_FPUTC
18776     if eval $compile; then
18777             $run ./try 2>/dev/null
18778             code="$?"
18779             $from try.out
18780             if $test ! -s try.out -a "X$code" = X42; then
18781                 output=-DTRY_FPUTC
18782             fi
18783     fi
18784     case "$output" in
18785     '')
18786             set try -DTRY_FPRINTF
18787             if eval $compile; then
18788                     $run ./try 2>/dev/null
18789                     code="$?"
18790                     $from try.out
18791                     if $test ! -s try.out -a "X$code" = X42; then
18792                         output=-DTRY_FPRINTF
18793                     fi
18794             fi
18795         ;;
18796     esac
18797 fi
18798 : check for fflush NULL behaviour
18799 case "$fflushNULL" in
18800 '')     set try -DTRY_FFLUSH_NULL $output
18801         if eval $compile; then
18802                 $run ./try 2>/dev/null
18803                 code="$?"
18804                 $from try.out
18805                 if $test -s try.out -a "X$code" = X42; then
18806                         fflushNULL="`$cat try.out`"
18807                 else
18808                         if $test "X$code" != X42; then
18809                                 $cat >&4 <<EOM
18810 (If this test failed, don't worry, we'll try another method shortly.)
18811 EOM
18812                         fi
18813                 fi
18814         fi
18815         $rm -f core try.core core.try.*
18816         case "$fflushNULL" in
18817         x)      $cat >&4 <<EOM
18818 Your fflush(NULL) works okay for output streams.
18819 Let's see if it clobbers input pipes...
18820 EOM
18821 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18822 # bug that improperly flushes the input end of pipes.  So we avoid the
18823 # autoflush on fork/system/exec support for now. :-(
18824 $cat >tryp.c <<EOCP
18825 #include <stdio.h>
18826 int
18827 main(int argc, char **argv)
18828 {
18829     char buf[1024];
18830     int i;
18831     char *bp = buf;
18832     while (1) {
18833         while ((i = getc(stdin)) != -1
18834                && (*bp++ = i) != '\n'
18835                && bp < &buf[1024])
18836         /* DO NOTHING */ ;
18837         *bp = '\0';
18838         fprintf(stdout, "%s", buf);
18839         fflush(NULL);
18840         if (i == -1)
18841             return 0;
18842         bp = buf;
18843     }
18844 }
18845 EOCP
18846                 fflushNULL="$define"
18847                 set tryp
18848                 if eval $compile; then
18849                     $rm -f tryp.out
18850                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18851                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18852                        $cat >&4 <<EOM
18853 fflush(NULL) seems to behave okay with input streams.
18854 EOM
18855                         fflushNULL="$define"
18856                     else
18857                         $cat >&4 <<EOM
18858 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18859 EOM
18860                         fflushNULL="$undef"
18861                     fi
18862                 fi
18863                 $rm -f core tryp.c tryp.core core.tryp.*
18864                 ;;
18865         '')     $cat >&4 <<EOM
18866 Your fflush(NULL) isn't working (contrary to ANSI C).
18867 EOM
18868                 fflushNULL="$undef"
18869                 ;;
18870         *)      $cat >&4 <<EOM
18871 Cannot figure out whether your fflush(NULL) works or not.
18872 I'm assuming it doesn't (contrary to ANSI C).
18873 EOM
18874                 fflushNULL="$undef"
18875                 ;;
18876         esac
18877         ;;
18878 $define|true|[yY]*)
18879         fflushNULL="$define"
18880         ;;
18881 *)
18882         fflushNULL="$undef"
18883         ;;
18884 esac
18885 : check explicit looping only if NULL did not work, and if the pipe
18886 : bug does not show up on an explicit flush too
18887 case "$fflushNULL" in
18888 "$undef")
18889         $cat >tryp.c <<EOCP
18890 #include <stdio.h>
18891 int
18892 main(int argc, char **argv)
18893 {
18894     char buf[1024];
18895     int i;
18896     char *bp = buf;
18897     while (1) {
18898         while ((i = getc(stdin)) != -1
18899                && (*bp++ = i) != '\n'
18900                && bp < &buf[1024])
18901         /* DO NOTHING */ ;
18902         *bp = '\0';
18903         fprintf(stdout, "%s", buf);
18904         fflush(stdin);
18905         if (i == -1)
18906             return 0;
18907         bp = buf;
18908     }
18909 }
18910 EOCP
18911         set tryp
18912         if eval $compile; then
18913             $rm -f tryp.out
18914             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18915             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18916                $cat >&4 <<EOM
18917 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18918 EOM
18919                 : now check for fflushall behaviour
18920                 case "$fflushall" in
18921                 '')     set try -DTRY_FFLUSH_ALL $output
18922                         if eval $compile; then
18923                                 $cat >&4 <<EOM
18924 (Now testing the other method--but note that this also may fail.)
18925 EOM
18926                                 $run ./try 2>/dev/null
18927                                 code=$?
18928                                 $from try.out
18929                                 if $test -s try.out -a "X$code" = X42; then
18930                                         fflushall="`$cat try.out`"
18931                                 fi
18932                         fi
18933                         $rm -f core try.core core.try.*
18934                         case "$fflushall" in
18935                         x)      $cat >&4 <<EOM
18936 Whew. Flushing explicitly all the stdio streams works.
18937 EOM
18938                                 fflushall="$define"
18939                                 ;;
18940                         '')     $cat >&4 <<EOM
18941 Sigh. Flushing explicitly all the stdio streams doesn't work.
18942 EOM
18943                                 fflushall="$undef"
18944                                 ;;
18945                         *)      $cat >&4 <<EOM
18946 Cannot figure out whether flushing stdio streams explicitly works or not.
18947 I'm assuming it doesn't.
18948 EOM
18949                                 fflushall="$undef"
18950                                 ;;
18951                         esac
18952                         ;;
18953                 "$define"|true|[yY]*)
18954                         fflushall="$define"
18955                         ;;
18956                 *)
18957                         fflushall="$undef"
18958                         ;;
18959                 esac
18960             else
18961                 $cat >&4 <<EOM
18962 All is futile.  Even fflush(stdin) clobbers input pipes!
18963 EOM
18964                 fflushall="$undef"
18965             fi
18966         else
18967             fflushall="$undef"
18968         fi
18969         $rm -f core tryp.c tryp.core core.tryp.*
18970         ;;
18971 *)      fflushall="$undef"
18972         ;;
18973 esac
18974
18975 case "$fflushNULL$fflushall" in
18976 undefundef)
18977         $cat <<EOM
18978 OK, I give up.  I cannot figure out how to flush pending stdio output.
18979 We won't be flushing handles at all before fork/exec/popen.
18980 EOM
18981         ;;
18982 esac
18983 $rm -f try.* try$exe_ext
18984
18985 : Store the full pathname to the ar program for use in the C program
18986 : Respect a hint or command line value for full_ar.
18987 case "$full_ar" in
18988 '') full_ar=$ar ;;
18989 esac
18990
18991 : Store the full pathname to the sed program for use in the C program
18992 full_sed=$sed
18993
18994 : see what type gids are declared as in the kernel
18995 echo " "
18996 echo "Looking for the type for group ids returned by getgid()."
18997 set gid_t gidtype xxx stdio.h sys/types.h
18998 eval $typedef
18999 case "$gidtype" in
19000 xxx)
19001         xxx=`./findhdr sys/user.h`
19002         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19003         case $1 in
19004         unsigned) dflt="$1 $2" ;;
19005         *) dflt="$1" ;;
19006         esac
19007         ;;
19008 *) dflt="$gidtype";;
19009 esac
19010 case "$gidtype" in
19011 gid_t) echo "gid_t found." ;;
19012 *)      rp="What is the type for group ids returned by getgid()?"
19013         . ./myread
19014         gidtype="$ans"
19015         ;;
19016 esac
19017
19018 echo " "
19019 case "$gidtype" in
19020 *_t) zzz="$gidtype"     ;;
19021 *)   zzz="gid"          ;;
19022 esac
19023 echo "Checking the size of $zzz..." >&4 
19024 cat > try.c <<EOCP
19025 #include <sys/types.h>
19026 #include <stdio.h>
19027 #$i_stdlib I_STDLIB
19028 #ifdef I_STDLIB
19029 #include <stdlib.h>
19030 #endif
19031 int main() {
19032     printf("%d\n", (int)sizeof($gidtype));
19033     exit(0);
19034 }
19035 EOCP
19036 set try
19037 if eval $compile_ok; then
19038         yyy=`$run ./try`
19039         case "$yyy" in
19040         '')     gidsize=4
19041                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19042                 ;;
19043         *)      gidsize=$yyy
19044                 echo "Your $zzz is $gidsize bytes long."
19045                 ;;
19046         esac
19047 else
19048         gidsize=4
19049         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19050 fi
19051
19052
19053 echo " "
19054 case "$gidtype" in
19055 *_t) zzz="$gidtype"     ;;
19056 *)   zzz="gid"          ;;
19057 esac
19058 echo "Checking the sign of $zzz..." >&4 
19059 cat > try.c <<EOCP
19060 #include <sys/types.h>
19061 #include <stdio.h>
19062 int main() {
19063         $gidtype foo = -1;
19064         if (foo < 0)
19065                 printf("-1\n");
19066         else
19067                 printf("1\n");
19068 }
19069 EOCP
19070 set try
19071 if eval $compile; then
19072         yyy=`$run ./try`
19073         case "$yyy" in
19074         '')     gidsign=1
19075                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19076                 ;;
19077         *)      gidsign=$yyy
19078                 case "$gidsign" in
19079                  1) echo "Your $zzz is unsigned." ;;
19080                 -1) echo "Your $zzz is signed."   ;;
19081                 esac
19082                 ;;
19083         esac
19084 else
19085         gidsign=1
19086         echo "(I can't compile the test program--guessing unsigned.)" >&4
19087 fi
19088
19089
19090 echo " "
19091
19092 if $test X"$quadtype" != X; then
19093
19094 echo "Checking how to print 64-bit integers..." >&4
19095
19096 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19097         $cat >try.c <<'EOCP'
19098 #include <sys/types.h>
19099 #include <stdio.h>
19100 int main() {
19101   int q = 12345678901;
19102   printf("%ld\n", q);
19103 }
19104 EOCP
19105         set try
19106         if eval $compile; then
19107                 yyy=`$run ./try`
19108                 case "$yyy" in
19109                 12345678901)
19110                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19111                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19112                         echo "We will use %d."
19113                         ;;
19114                 esac
19115         fi
19116 fi
19117
19118 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19119         $cat >try.c <<'EOCP'
19120 #include <sys/types.h>
19121 #include <stdio.h>
19122 int main() {
19123   long q = 12345678901;
19124   printf("%ld\n", q);
19125 }
19126 EOCP
19127         set try
19128         if eval $compile; then
19129                 yyy=`$run ./try`
19130                 case "$yyy" in
19131                 12345678901)
19132                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19133                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19134                         echo "We will use %ld."
19135                         ;;
19136                 esac
19137         fi
19138 fi
19139
19140 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19141         $cat >try.c <<'EOCP'
19142 #include <sys/types.h>
19143 #include <inttypes.h>
19144 #include <stdio.h>
19145 int main() {
19146   int64_t q = 12345678901;
19147   printf("%" PRId64 "\n", q);
19148 }
19149 EOCP
19150         set try
19151         if eval $compile; then
19152                 yyy=`$run ./try`
19153                 case "$yyy" in
19154                 12345678901)
19155                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19156                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19157                         echo "We will use the C9X style."
19158                         ;;
19159                 esac
19160         fi
19161 fi
19162
19163 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19164         $cat >try.c <<EOCP
19165 #include <sys/types.h>
19166 #include <stdio.h>
19167 int main() {
19168   $quadtype q = 12345678901;
19169   printf("%Ld\n", q);
19170 }
19171 EOCP
19172         set try
19173         if eval $compile; then
19174                 yyy=`$run ./try`
19175                 case "$yyy" in
19176                 12345678901)
19177                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19178                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19179                         echo "We will use %Ld."
19180                         ;;
19181                 esac
19182         fi
19183 fi
19184
19185 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19186         $cat >try.c <<'EOCP'
19187 #include <sys/types.h>
19188 #include <stdio.h>
19189 int main() {
19190   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19191   printf("%lld\n", q);
19192 }
19193 EOCP
19194         set try
19195         if eval $compile; then
19196                 yyy=`$run ./try`
19197                 case "$yyy" in
19198                 12345678901)
19199                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19200                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19201                         echo "We will use the %lld style."
19202                         ;;
19203                 esac
19204         fi
19205 fi
19206
19207 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19208         $cat >try.c <<EOCP
19209 #include <sys/types.h>
19210 #include <stdio.h>
19211 int main() {
19212   $quadtype q = 12345678901;
19213   printf("%qd\n", q);
19214 }
19215 EOCP
19216         set try
19217         if eval $compile; then
19218                 yyy=`$run ./try`
19219                 case "$yyy" in
19220                 12345678901)
19221                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19222                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19223                         echo "We will use %qd."
19224                         ;;
19225                 esac
19226         fi
19227 fi
19228
19229 if $test X"$sPRId64" = X; then
19230         echo "Cannot figure out how to print 64-bit integers." >&4
19231 fi
19232
19233 $rm -f try try.*
19234
19235 fi
19236
19237 case "$sPRId64" in
19238 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19239         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19240         ;;
19241 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19242         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19243         ;;
19244 esac
19245
19246
19247 echo " "
19248 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19249
19250 if $test X"$ivsize" = X8; then
19251         ivdformat="$sPRId64"
19252         uvuformat="$sPRIu64"
19253         uvoformat="$sPRIo64"
19254         uvxformat="$sPRIx64"
19255         uvXUformat="$sPRIXU64"
19256 else
19257         if $test X"$ivsize" = X"$longsize"; then
19258                 ivdformat='"ld"'
19259                 uvuformat='"lu"'
19260                 uvoformat='"lo"'
19261                 uvxformat='"lx"'
19262                 uvXUformat='"lX"'
19263         else
19264                 if $test X"$ivsize" = X"$intsize"; then
19265                         ivdformat='"d"'
19266                         uvuformat='"u"'
19267                         uvoformat='"o"'
19268                         uvxformat='"x"'
19269                         uvXUformat='"X"'
19270                 else
19271                         : far out
19272                         if $test X"$ivsize" = X"$shortsize"; then
19273                                 ivdformat='"hd"'
19274                                 uvuformat='"hu"'
19275                                 uvoformat='"ho"'
19276                                 uvxformat='"hx"'
19277                                 uvXUformat='"hX"'
19278                         fi
19279                 fi
19280         fi
19281 fi
19282
19283 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19284         nveformat="$sPRIeldbl"
19285         nvfformat="$sPRIfldbl"
19286         nvgformat="$sPRIgldbl"
19287         nvEUformat="$sPRIEUldbl"
19288         nvFUformat="$sPRIFUldbl"
19289         nvGUformat="$sPRIGUldbl"
19290 else
19291         nveformat='"e"'
19292         nvfformat='"f"'
19293         nvgformat='"g"'
19294         nvEUformat='"E"'
19295         nvFUformat='"F"'
19296         nvGUformat='"G"'
19297 fi
19298
19299 case "$ivdformat" in
19300 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19301     exit 1
19302     ;;
19303 esac
19304
19305
19306 echo " "
19307 $echo "Checking the format string to be used for gids..." >&4
19308
19309 case "$gidsign" in
19310 -1)     if $test X"$gidsize" = X"$ivsize"; then
19311                 gidformat="$ivdformat"
19312         else
19313                 if $test X"$gidsize" = X"$longsize"; then
19314                         gidformat='"ld"'
19315                 else
19316                         if $test X"$gidsize" = X"$intsize"; then
19317                                 gidformat='"d"'
19318                         else
19319                                 if $test X"$gidsize" = X"$shortsize"; then
19320                                         gidformat='"hd"'
19321                                 fi
19322                         fi
19323                 fi
19324         fi
19325         ;;
19326 *)      if $test X"$gidsize" = X"$uvsize"; then
19327                 gidformat="$uvuformat"
19328         else
19329                 if $test X"$gidsize" = X"$longsize"; then
19330                         gidformat='"lu"'
19331                 else
19332                         if $test X"$gidsize" = X"$intsize"; then
19333                                 gidformat='"u"'
19334                         else
19335                                 if $test X"$gidsize" = X"$shortsize"; then
19336                                         gidformat='"hu"'
19337                                 fi
19338                         fi
19339                 fi
19340         fi
19341         ;;
19342 esac
19343
19344 : see if getgroups exists
19345 set getgroups d_getgrps
19346 eval $inlibc
19347
19348 : see if setgroups exists
19349 set setgroups d_setgrps
19350 eval $inlibc
19351
19352
19353 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19354 echo " "
19355 case "$d_getgrps$d_setgrps" in
19356 *define*)
19357         case "$groupstype" in
19358         '') dflt="$gidtype" ;;
19359         *)  dflt="$groupstype" ;;
19360         esac
19361         $cat <<EOM
19362 What type of pointer is the second argument to getgroups() and setgroups()?
19363 Usually this is the same as group ids, $gidtype, but not always.
19364
19365 EOM
19366         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19367         . ./myread
19368         groupstype="$ans"
19369         ;;
19370 *)  groupstype="$gidtype";;
19371 esac
19372
19373
19374 if $test $patchlevel -lt 9; then
19375 : MAD is not available in 5.8.x or earlier.
19376     ans=n;
19377 else
19378     case "$mad" in
19379     $define|true|[yY]*) dflt='y' ;;
19380     *)                  dflt='n' ;;
19381     esac
19382     cat <<EOM
19383
19384 Would you like to build with Misc Attribute Decoration? This is development
19385 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19386 overhead on the interpreter.
19387
19388 If this doesn't make any sense to you, just accept the default '$dflt'.
19389 EOM
19390     rp='Build Perl with MAD?'
19391     . ./myread
19392 fi
19393 case "$ans" in
19394 y|Y)    val="$define"
19395         madlyh='madly.h madly.act madly.tab'
19396         madlysrc='madly.c'
19397         madlyobj="madly$_o" ;;
19398 *)      val="$undef"
19399         madlyh=''
19400         madlysrc=''
19401         madlyobj='' ;;
19402 esac
19403 set mad
19404 eval $setvar
19405
19406 echo " "
19407 echo "Checking if your $make program sets \$(MAKE)..." >&4
19408 case "$make_set_make" in
19409 '')
19410         $sed 's/^X //' > testmake.mak << 'EOF'
19411 Xall:
19412 X       @echo 'maketemp="$(MAKE)"'
19413 EOF
19414         case "`$make -f testmake.mak 2>/dev/null`" in
19415         *maketemp=*) make_set_make='#' ;;
19416         *)      make_set_make="MAKE=$make" ;;
19417         esac
19418         $rm -f testmake.mak
19419         ;;
19420 esac
19421 case "$make_set_make" in
19422 '#') echo "Yup, it does.";;
19423 *) echo "Nope, it doesn't.";;
19424 esac
19425
19426 : see what type is used for mode_t
19427 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19428 set mode_t modetype int stdio.h sys/types.h
19429 eval $typedef_ask
19430
19431 : see if we need va_copy
19432 echo " "
19433 case "$i_stdarg" in
19434 "$define")
19435         $cat >try.c <<EOCP
19436 #include <stdarg.h>
19437 #include <stdio.h>
19438 #$i_stdlib I_STDLIB
19439 #ifdef I_STDLIB
19440 #include <stdlib.h>
19441 #endif
19442 #include <signal.h>
19443
19444 int
19445 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19446 {
19447   return vfprintf(f, fmt, *valp);
19448 }
19449  
19450 int    
19451 myvfprintf(FILE *f, const  char *fmt, va_list val)
19452 {
19453   return ivfprintf(f, fmt, &val);
19454 }
19455       
19456 int
19457 myprintf(char *fmt, ...) 
19458 {
19459   va_list val;
19460   va_start(val, fmt);
19461   return myvfprintf(stdout, fmt, val); 
19462 }         
19463
19464 int
19465 main(int ac, char **av)
19466 {
19467   signal(SIGSEGV, exit);
19468
19469   myprintf("%s%cs all right, then\n", "that", '\'');                            
19470   exit(0);      
19471 }
19472 EOCP
19473         set try
19474         if eval $compile && $run ./try 2>&1 >/dev/null; then
19475                 case "`$run ./try`" in
19476                 "that's all right, then")
19477                         okay=yes
19478                         ;;
19479                 esac
19480         fi
19481         case "$okay" in
19482         yes)    echo "It seems that you don't need va_copy()." >&4
19483                 need_va_copy="$undef"
19484                 ;;
19485         *)      echo "It seems that va_copy() or similar will be needed." >&4
19486                 need_va_copy="$define"
19487                 ;;
19488         esac
19489         $rm -f try.* core core.* *.core *.core.*
19490         ;;
19491 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19492         ;;
19493 esac
19494
19495 : see what type is used for size_t
19496 rp="What is the type used for the length parameter for string functions?"
19497 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19498 eval $typedef_ask
19499
19500 : check for type of arguments to gethostbyaddr. 
19501 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19502         case "$d_gethbyaddr" in
19503         $define)
19504                 $cat <<EOM
19505
19506 Checking to see what type of arguments are accepted by gethostbyaddr().
19507 EOM
19508                 hdrs="$define sys/types.h
19509                         $d_socket sys/socket.h 
19510                         $i_niin netinet/in.h 
19511                         $i_netdb netdb.h
19512                         $i_unistd unistd.h"
19513                 : The first arg can 'char *' or 'void *'
19514                 : The second arg is some of integral type
19515                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19516                         for yyy in size_t long int; do
19517                                 case "$netdb_host_type" in
19518                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19519                                         if ./protochk "$try" $hdrs; then
19520                                                 echo "Your system accepts $xxx for the first arg."
19521                                                 echo "...and $yyy for the second arg."
19522                                                 netdb_host_type="$xxx"
19523                                                 netdb_hlen_type="$yyy"
19524                                         fi
19525                                         ;;
19526                                 esac
19527                         done
19528                 done
19529                 : In case none of those worked, prompt the user.
19530                 case "$netdb_host_type" in
19531                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19532                         dflt='char *'
19533                         . ./myread
19534                         netdb_host_type=$ans
19535                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19536                         dflt="$sizetype"
19537                         . ./myread
19538                         netdb_hlen_type=$ans
19539                         ;;
19540                 esac
19541                 ;;
19542         *)      : no gethostbyaddr, so pick harmless defaults
19543                 netdb_host_type='char *'
19544                 netdb_hlen_type="$sizetype"
19545                 ;;
19546         esac
19547         # Remove the "const" if needed. -- but then we'll have a 
19548         # prototype clash!
19549         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19550 fi
19551
19552 : check for type of argument to gethostbyname. 
19553 if test "X$netdb_name_type" = X ; then
19554         case "$d_gethbyname" in
19555         $define)
19556                 $cat <<EOM
19557
19558 Checking to see what type of argument is accepted by gethostbyname().
19559 EOM
19560                 hdrs="$define sys/types.h
19561                         $d_socket sys/socket.h 
19562                         $i_niin netinet/in.h 
19563                         $i_netdb netdb.h
19564                         $i_unistd unistd.h"
19565                 for xxx in "const char *" "char *"; do
19566                         case "$netdb_name_type" in
19567                         '')     try="extern struct hostent *gethostbyname($xxx);"
19568                                 if ./protochk "$try" $hdrs; then
19569                                         echo "Your system accepts $xxx."
19570                                         netdb_name_type="$xxx"
19571                                 fi
19572                                 ;;
19573                         esac
19574                 done
19575                 : In case none of those worked, prompt the user.
19576                 case "$netdb_name_type" in
19577                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19578                         dflt='char *'
19579                         . ./myread
19580                         netdb_name_type=$ans
19581                         ;;
19582                 esac
19583                 ;;
19584         *)      : no gethostbyname, so pick harmless default
19585                 netdb_name_type='char *'
19586                 ;;
19587         esac
19588 fi
19589
19590 : check for type of 1st argument to getnetbyaddr. 
19591 if test "X$netdb_net_type" = X ; then
19592         case "$d_getnbyaddr" in
19593         $define)
19594                 $cat <<EOM
19595
19596 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19597 EOM
19598                 hdrs="$define sys/types.h
19599                         $d_socket sys/socket.h 
19600                         $i_niin netinet/in.h 
19601                         $i_netdb netdb.h
19602                         $i_unistd unistd.h"
19603                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19604                         case "$netdb_net_type" in
19605                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19606                                 if ./protochk "$try" $hdrs; then
19607                                         echo "Your system accepts $xxx."
19608                                         netdb_net_type="$xxx"
19609                                 fi
19610                                 ;;
19611                         esac
19612                 done
19613                 : In case none of those worked, prompt the user.
19614                 case "$netdb_net_type" in
19615                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19616                         dflt='long'
19617                         . ./myread
19618                         netdb_net_type=$ans
19619                         ;;
19620                 esac
19621                 ;;
19622         *)      : no getnetbyaddr, so pick harmless default
19623                 netdb_net_type='long'
19624                 ;;
19625         esac
19626 fi
19627 : locate the preferred pager for this system
19628 fn=f/
19629 case "$pager" in
19630 '')
19631         dflt=''
19632         case "$pg" in
19633         /*) dflt=$pg;;
19634         [a-zA-Z]:/*) dflt=$pg;;
19635         esac
19636         case "$more" in
19637         /*) dflt=$more;;
19638         [a-zA-Z]:/*) dflt=$more;;
19639         esac
19640         case "$less" in
19641         /*) dflt=$less;;
19642         [a-zA-Z]:/*) dflt=$less;;
19643         esac
19644         case "$dflt" in
19645         '') dflt=/usr/ucb/more;;
19646         esac
19647         ;;
19648 *)      dflt="$pager"
19649         : Instruct ./getfile to trust the hinted or previous pager value,
19650         : even if it does not begin with a slash.  For example, on os2,
19651         : pager might be cmd /c more.  See comments in UU/getfile.
19652         fn="f/($pager)"
19653         ;;
19654 esac
19655 echo " "
19656 rp='What pager is used on your system?'
19657 . ./getfile
19658 pager="$ans"
19659
19660 : see what type pids are declared as in the kernel
19661 rp="What is the type of process ids on this system?"
19662 set pid_t pidtype int stdio.h sys/types.h
19663 eval $typedef_ask
19664
19665 : see if ar generates random libraries by itself
19666 echo " "
19667 echo "Checking how to generate random libraries on your machine..." >&4
19668 echo 'int bar1() { return bar2(); }' > bar1.c
19669 echo 'int bar2() { return 2; }' > bar2.c
19670 $cat > foo.c <<EOP
19671 #$i_stdlib I_STDLIB
19672 #ifdef I_STDLIB
19673 #include <stdlib.h>
19674 #endif
19675 int main() { printf("%d\n", bar1()); exit(0); }
19676 EOP
19677 $cc $ccflags -c bar1.c >/dev/null 2>&1
19678 $cc $ccflags -c bar2.c >/dev/null 2>&1
19679 $cc $ccflags -c foo.c >/dev/null 2>&1
19680 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19681 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19682         $run ./foobar >/dev/null 2>&1; then
19683         echo "$ar appears to generate random libraries itself."
19684         orderlib=false
19685         if [ "X$ranlib" = "X" ]; then
19686             ranlib=":"
19687         fi
19688 elif $ar s bar$_a >/dev/null 2>&1 &&
19689         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19690         $run ./foobar >/dev/null 2>&1; then
19691                 echo "a table of contents needs to be added with '$ar s'."
19692                 orderlib=false
19693                 ranlib="$ar s"
19694 elif $ar ts bar$_a >/dev/null 2>&1 &&
19695         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19696         $run ./foobar >/dev/null 2>&1; then
19697                 echo "a table of contents needs to be added with '$ar ts'."
19698                 orderlib=false
19699                 ranlib="$ar ts"
19700 else
19701         case "$ranlib" in
19702         :) ranlib='';;
19703         '')
19704                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19705                 $test -f $ranlib || ranlib=''
19706                 ;;
19707         esac
19708         if $test -n "$ranlib"; then
19709                 echo "your system has '$ranlib'; we'll use that."
19710                 orderlib=false
19711         else
19712                 echo "your system doesn't seem to support random libraries"
19713                 echo "so we'll use lorder and tsort to order the libraries."
19714                 orderlib=true
19715                 ranlib=":"
19716         fi
19717 fi
19718 $rm -f foo* bar*
19719
19720 : check for type of arguments to select. 
19721 case "$selecttype" in
19722 '') case "$d_select" in
19723         $define)
19724                 echo " "
19725                 $cat <<EOM
19726 Checking to see what type of arguments are accepted by select().
19727 EOM
19728                 hdrs="$define sys/types.h
19729                         $i_systime sys/time.h 
19730                         $i_sysselct sys/select.h
19731                         $d_socket sys/socket.h"
19732                 : The first arg can be int, unsigned, or size_t
19733                 : The last arg may or may not be 'const'
19734                 val=''
19735                 : void pointer has been seen but using that
19736                 : breaks the selectminbits test
19737                 for xxx in 'fd_set *' 'int *'; do
19738                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19739                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19740                                         case "$val" in
19741                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19742                                                 if ./protochk "$try" $hdrs; then
19743                                                         echo "Your system accepts $xxx."
19744                                                         val="$xxx"
19745                                                 fi
19746                                                 ;;
19747                                         esac
19748                                 done
19749                         done
19750                 done
19751                 case "$val" in
19752                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19753                         case "$d_fd_set" in
19754                                 $define) dflt="fd_set *" ;;
19755                                 *)              dflt="int *" ;;
19756                         esac
19757                         . ./myread
19758                         val=$ans
19759                         ;;
19760                 esac
19761                 selecttype="$val"
19762                 ;;
19763         *)      : no select, so pick a harmless default
19764                 selecttype='int *'
19765                 ;;
19766         esac
19767         ;;
19768 esac
19769
19770 : check for the select 'width'
19771 case "$selectminbits" in
19772 '') safebits=`expr $ptrsize \* 8`
19773     case "$d_select" in
19774         $define)
19775                 $cat <<EOM
19776
19777 Checking to see on how many bits at a time your select() operates...
19778 EOM
19779                 $cat >try.c <<EOCP
19780 #include <sys/types.h>
19781 #$i_time I_TIME
19782 #$i_systime I_SYS_TIME
19783 #$i_systimek I_SYS_TIME_KERNEL
19784 #ifdef I_TIME
19785 #   include <time.h>
19786 #endif
19787 #ifdef I_SYS_TIME
19788 #   ifdef I_SYS_TIME_KERNEL
19789 #       define KERNEL
19790 #   endif
19791 #   include <sys/time.h>
19792 #   ifdef I_SYS_TIME_KERNEL
19793 #       undef KERNEL
19794 #   endif
19795 #endif
19796 #$i_sysselct I_SYS_SELECT
19797 #ifdef I_SYS_SELECT
19798 #include <sys/select.h>
19799 #endif
19800 #$d_socket HAS_SOCKET
19801 #ifdef HAS_SOCKET
19802 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19803 #endif
19804 #include <stdio.h>
19805 #$i_stdlib I_STDLIB
19806 #ifdef I_STDLIB
19807 #include <stdlib.h>
19808 #endif
19809 $selecttype b;
19810 #define S sizeof(*(b))
19811 #define MINBITS 64
19812 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19813 #define NBITS  (NBYTES * 8)
19814 int main() {
19815     char *s = (char *)malloc(NBYTES);
19816     struct timeval t;
19817     int i;
19818     FILE* fp;
19819     int fd;
19820
19821     if (!s)
19822         exit(1);
19823     fclose(stdin);
19824     fp = fopen("try.c", "r");
19825     if (fp == 0)
19826       exit(2);
19827     fd = fileno(fp);
19828     if (fd < 0)
19829       exit(3);
19830     b = ($selecttype)s;
19831     for (i = 0; i < NBITS; i++)
19832         FD_SET(i, b);
19833     t.tv_sec  = 0;
19834     t.tv_usec = 0;
19835     select(fd + 1, b, 0, 0, &t);
19836     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19837     free(s);
19838     printf("%d\n", i + 1);
19839     return 0;
19840 }
19841 EOCP
19842                 set try
19843                 if eval $compile_ok; then
19844                         selectminbits=`$run ./try`
19845                         case "$selectminbits" in
19846                         '')     cat >&4 <<EOM
19847 Cannot figure out on how many bits at a time your select() operates.
19848 I'll play safe and guess it is $safebits bits.
19849 EOM
19850                                 selectminbits=$safebits
19851                                 bits="$safebits bits"
19852                                 ;;
19853                         1)      bits="1 bit" ;;
19854                         *)      bits="$selectminbits bits" ;;
19855                         esac
19856                         echo "Your select() operates on $bits at a time." >&4
19857                 else
19858                         rp='What is the minimum number of bits your select() operates on?'
19859                         case "$byteorder" in
19860                         12345678)       dflt=64 ;;
19861                         1234)           dflt=32 ;;
19862                         *)              dflt=1  ;;
19863                         esac
19864                         . ./myread
19865                         val=$ans
19866                         selectminbits="$val"
19867                 fi
19868                 $rm -f try.* try
19869                 ;;
19870         *)      : no select, so pick a harmless default
19871                 selectminbits=$safebits
19872                 ;;
19873         esac
19874         ;;
19875 esac
19876
19877 : Trace out the files included by signal.h, then look for SIGxxx names.
19878 : Remove SIGARRAYSIZE used by HPUX.
19879 : Remove SIGSTKSIZE used by Linux.
19880 : Remove SIGSTKSZ used by Posix.
19881 : Remove SIGTYP void lines used by OS2.
19882 : Some cpps, like os390, dont give the file name anywhere
19883 if [ "X$fieldn" = X ]; then
19884         : Just make some guesses.  We check them later.
19885         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19886 else
19887         xxx=`echo '#include <signal.h>' |
19888         $cppstdin $cppminus $cppflags 2>/dev/null |
19889         $grep '^[       ]*#.*include' | 
19890         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19891 fi
19892 : Check this list of files to be sure we have parsed the cpp output ok.
19893 : This will also avoid potentially non-existent files, such 
19894 : as ../foo/bar.h
19895 xxxfiles=''
19896 for xx in $xxx /dev/null ; do
19897         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19898 done
19899 : If we have found no files, at least try signal.h
19900 case "$xxxfiles" in
19901 '')     xxxfiles=`./findhdr signal.h` ;;
19902 esac
19903 xxx=`awk '
19904 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19905         print substr($2, 4, 20)
19906 }
19907 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19908         print substr($3, 4, 20)
19909 }' $xxxfiles`
19910 : Append some common names just in case the awk scan failed.
19911 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19912 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19913 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19914 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19915 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19916
19917 : generate a few handy files for later
19918 $cat > signal.c <<EOCP
19919 #include <sys/types.h>
19920 #include <signal.h>
19921 #$i_stdlib I_STDLIB
19922 #ifdef I_STDLIB
19923 #include <stdlib.h>
19924 #endif
19925 #include <stdio.h>
19926 int main() {
19927
19928 /* Strange style to avoid deeply-nested #if/#else/#endif */
19929 #ifndef NSIG
19930 #  ifdef _NSIG
19931 #    define NSIG (_NSIG)
19932 #  endif
19933 #endif
19934
19935 #ifndef NSIG
19936 #  ifdef SIGMAX
19937 #    define NSIG (SIGMAX+1)
19938 #  endif
19939 #endif
19940
19941 #ifndef NSIG
19942 #  ifdef SIG_MAX
19943 #    define NSIG (SIG_MAX+1)
19944 #  endif
19945 #endif
19946
19947 #ifndef NSIG
19948 #  ifdef _SIG_MAX
19949 #    define NSIG (_SIG_MAX+1)
19950 #  endif
19951 #endif
19952
19953 #ifndef NSIG
19954 #  ifdef MAXSIG
19955 #    define NSIG (MAXSIG+1)
19956 #  endif
19957 #endif
19958
19959 #ifndef NSIG
19960 #  ifdef MAX_SIG
19961 #    define NSIG (MAX_SIG+1)
19962 #  endif
19963 #endif
19964
19965 #ifndef NSIG
19966 #  ifdef SIGARRAYSIZE
19967 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19968 #  endif
19969 #endif
19970
19971 #ifndef NSIG
19972 #  ifdef _sys_nsig
19973 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19974 #  endif
19975 #endif
19976
19977 /* Default to some arbitrary number that's big enough to get most
19978    of the common signals.
19979 */
19980 #ifndef NSIG
19981 #    define NSIG 50
19982 #endif
19983
19984 printf("NSIG %d\n", NSIG);
19985
19986 #ifndef JUST_NSIG
19987
19988 EOCP
19989
19990 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19991 {
19992         printf "#ifdef SIG"; printf $1; printf "\n"
19993         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19994         printf $1; printf ");\n"
19995         printf "#endif\n"
19996 }
19997 END {
19998         printf "#endif /* JUST_NSIG */\n";
19999         printf "exit(0);\n}\n";
20000 }
20001 ' >>signal.c
20002 $cat >signal.awk <<'EOP'
20003 BEGIN { ndups = 0 }
20004 $1 ~ /^NSIG$/ { nsig = $2 }
20005 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20006     if ($2 > maxsig) { maxsig = $2 }
20007     if (sig_name[$2]) {
20008         dup_name[ndups] = $1
20009         dup_num[ndups] = $2
20010         ndups++ 
20011     }
20012     else {
20013         sig_name[$2] = $1
20014         sig_num[$2] = $2
20015     }
20016 }
20017 END { 
20018     if (nsig == 0) {
20019         nsig = maxsig + 1
20020     }
20021     printf("NSIG %d\n", nsig);
20022     for (n = 1; n < nsig; n++) {
20023         if (sig_name[n]) {
20024             printf("%s %d\n", sig_name[n], sig_num[n])
20025         }
20026         else {
20027             printf("NUM%d %d\n", n, n) 
20028         }
20029     }
20030     for (n = 0; n < ndups; n++) {
20031         printf("%s %d\n", dup_name[n], dup_num[n])
20032     }
20033 }
20034 EOP
20035 $cat >signal_cmd <<EOS
20036 $startsh
20037 if $test -s signal.lst; then
20038     echo "Using your existing signal.lst file"
20039         exit 0
20040 fi
20041 xxx="$xxx"
20042 EOS
20043 $cat >>signal_cmd <<'EOS'
20044
20045 set signal
20046 if eval $compile_ok; then
20047         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20048 else
20049         echo "(I can't seem be able to compile the whole test program)" >&4
20050         echo "(I'll try it in little pieces.)" >&4
20051         set signal -DJUST_NSIG
20052         if eval $compile_ok; then
20053                 $run ./signal$_exe > signal.nsg
20054                 $cat signal.nsg
20055         else
20056                 echo "I can't seem to figure out how many signals you have." >&4
20057                 echo "Guessing 50." >&4
20058                 echo 'NSIG 50' > signal.nsg
20059         fi
20060         : Now look at all the signal names, one at a time.
20061         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20062                 $cat > signal.c <<EOCP
20063 #include <sys/types.h>
20064 #include <signal.h>
20065 #include <stdio.h>
20066 int main() {
20067 printf("$xx %d\n", SIG${xx});
20068 return 0;
20069 }
20070 EOCP
20071                 set signal
20072                 if eval $compile; then
20073                         echo "SIG${xx} found."
20074                         $run ./signal$_exe  >> signal.ls1
20075                 else
20076                         echo "SIG${xx} NOT found."
20077                 fi
20078         done
20079         if $test -s signal.ls1; then
20080                 $cat signal.nsg signal.ls1 |
20081                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20082         fi
20083
20084 fi
20085 if $test -s signal.lst; then
20086         :
20087 else
20088         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20089         echo 'kill -l' >signal
20090         set X `csh -f <signal`
20091         $rm -f signal
20092         shift
20093         case $# in
20094         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20095         esac
20096         echo $@ | $tr ' ' $trnl | \
20097             $awk '{ printf "%s %d\n", $1, ++s; }
20098                   END { printf "NSIG %d\n", ++s }' >signal.lst
20099 fi
20100 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20101 EOS
20102 chmod a+x signal_cmd
20103 $eunicefix signal_cmd
20104
20105 : generate list of signal names
20106 echo " "
20107 case "$sig_name_init" in
20108 '') doinit=yes ;;
20109 *)  case "$sig_num_init" in
20110     ''|*,*) doinit=yes ;;
20111     esac ;;
20112 esac
20113 case "$doinit" in
20114 yes)
20115         echo "Generating a list of signal names and numbers..." >&4
20116         . ./signal_cmd
20117         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20118         sig_name=`$awk 'BEGIN { printf "ZERO " }
20119                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20120         sig_num=`$awk  'BEGIN { printf "0 " }
20121                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20122         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20123                              !/^NSIG/   { printf "\"%s\", ", $1 }
20124                              END        { printf "0\n" }' signal.lst`
20125         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20126                              !/^NSIG/   { printf "%d, ", $2}
20127                              END        { printf "0\n"}' signal.lst`
20128         ;;
20129 esac
20130 echo "The following $sig_count signals are available:"
20131 echo " "
20132 echo $sig_name | $awk \
20133 'BEGIN { linelen = 0 }
20134 {
20135         for (i = 1; i <= NF; i++) {
20136                 name = "SIG" $i " "
20137                 linelen = linelen + length(name)
20138                 if (linelen > 70) {
20139                         printf "\n"
20140                         linelen = length(name)
20141                 }
20142                 printf "%s", name
20143         }
20144         printf "\n"
20145 }'
20146 sig_size=`echo $sig_name | awk '{print NF}'`
20147 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20148
20149 echo " "
20150 case "$sizetype" in
20151 *_t) zzz="$sizetype"    ;;
20152 *)   zzz="filesize"     ;;
20153 esac
20154 echo "Checking the size of $zzz..." >&4 
20155 cat > try.c <<EOCP
20156 #include <sys/types.h>
20157 #include <stdio.h>
20158 #$i_stdlib I_STDLIB
20159 #ifdef I_STDLIB
20160 #include <stdlib.h>
20161 #endif
20162 int main() {
20163     printf("%d\n", (int)sizeof($sizetype));
20164     exit(0);
20165 }
20166 EOCP
20167 set try
20168 if eval $compile_ok; then
20169         yyy=`$run ./try`
20170         case "$yyy" in
20171         '')     sizesize=4
20172                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20173                 ;;
20174         *)      sizesize=$yyy
20175                 echo "Your $zzz size is $sizesize bytes."
20176                 ;;
20177         esac
20178 else
20179         sizesize=4
20180         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20181 fi
20182
20183
20184 : check for socklen_t
20185 echo " "
20186 echo "Checking to see if you have socklen_t..." >&4
20187 $cat >try.c <<EOCP
20188 #include <sys/types.h>
20189 #$d_socket HAS_SOCKET
20190 #ifdef HAS_SOCKET
20191 #include <sys/socket.h>
20192 #endif
20193 int main() { socklen_t x = 16; }
20194 EOCP
20195 set try
20196 if eval $compile; then
20197         val="$define"
20198         echo "You have socklen_t."
20199 else
20200         val="$undef"
20201         echo "You do not have socklen_t."
20202         case "$sizetype" in
20203         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20204         esac
20205 fi
20206 $rm -f try try.*
20207 set d_socklen_t
20208 eval $setvar
20209
20210 : see if this is a socks.h system
20211 set socks.h i_socks
20212 eval $inhdr
20213
20214 : check for type of the size argument to socket calls
20215 case "$d_socket" in
20216 "$define")
20217         $cat <<EOM
20218
20219 Checking to see what type is the last argument of accept().
20220 EOM
20221         yyy=''
20222         case "$d_socklen_t" in
20223         "$define") yyy="$yyy socklen_t"
20224         esac
20225         yyy="$yyy $sizetype int long unsigned"
20226         for xxx in $yyy; do
20227                 case "$socksizetype" in
20228                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20229                         case "$usesocks" in
20230                         "$define")
20231                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20232                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20233                                         socksizetype="$xxx"
20234                                 fi
20235                                 ;;
20236                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20237                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20238                                         socksizetype="$xxx"
20239                                 fi
20240                                 ;;
20241                         esac
20242                         ;;
20243                 esac
20244         done
20245 : In case none of those worked, prompt the user.
20246         case "$socksizetype" in
20247         '')     rp='What is the type for socket address structure sizes?'
20248                 dflt='int'
20249                 . ./myread
20250                 socksizetype=$ans
20251                 ;;
20252         esac
20253         ;;
20254 *)      : no sockets, so pick relatively harmless default
20255         socksizetype='int'
20256         ;;
20257 esac
20258
20259 : see what type is used for signed size_t
20260 set ssize_t ssizetype int stdio.h sys/types.h
20261 eval $typedef
20262 dflt="$ssizetype"
20263 $cat > try.c <<EOM
20264 #include <stdio.h>
20265 #$i_stdlib I_STDLIB
20266 #ifdef I_STDLIB
20267 #include <stdlib.h>
20268 #endif
20269 #include <sys/types.h>
20270 #define Size_t $sizetype
20271 #define SSize_t $dflt
20272 int main()
20273 {
20274         if (sizeof(Size_t) == sizeof(SSize_t))
20275                 printf("$dflt\n");
20276         else if (sizeof(Size_t) == sizeof(int))
20277                 printf("int\n");
20278         else 
20279                 printf("long\n");
20280         exit(0);
20281 }
20282 EOM
20283 echo " "
20284 set try
20285 if eval $compile_ok && $run ./try > /dev/null; then
20286         ssizetype=`$run ./try`
20287         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20288 else
20289         $cat >&4 <<EOM
20290 Help! I can't compile and run the ssize_t test program: please enlighten me!
20291 (This is probably a misconfiguration in your system or libraries, and
20292 you really ought to fix it.  Still, I'll try anyway.)
20293
20294 I need a type that is the same size as $sizetype, but is guaranteed to
20295 be signed.  Common values are ssize_t, int and long.
20296
20297 EOM
20298         rp="What signed type is the same size as $sizetype?"
20299         . ./myread
20300         ssizetype="$ans"
20301 fi
20302 $rm -f try try.*
20303
20304 : see what type of char stdio uses.
20305 echo " "
20306 echo '#include <stdio.h>' > stdio.c
20307 $cppstdin $cppminus < stdio.c > stdioh
20308 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20309         echo "Your stdio uses unsigned chars." >&4
20310         stdchar="unsigned char"
20311 else
20312         echo "Your stdio uses signed chars." >&4
20313         stdchar="char"
20314 fi
20315 $rm -f stdio.* stdioh
20316
20317 : see what type uids are declared as in the kernel
20318 echo " "
20319 echo "Looking for the type for user ids returned by getuid()."
20320 set uid_t uidtype xxx stdio.h sys/types.h
20321 eval $typedef
20322 case "$uidtype" in
20323 xxx)
20324         xxx=`./findhdr sys/user.h`
20325         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20326         case $1 in
20327         unsigned) dflt="$1 $2" ;;
20328         *) dflt="$1" ;;
20329         esac
20330         ;;
20331 *) dflt="$uidtype";;
20332 esac
20333 case "$uidtype" in
20334 uid_t)  echo "uid_t found." ;;
20335 *)      rp="What is the type for user ids returned by getuid()?"
20336         . ./myread
20337         uidtype="$ans"
20338         ;;
20339 esac
20340
20341 echo " "
20342 case "$uidtype" in
20343 *_t) zzz="$uidtype"     ;;
20344 *)   zzz="uid"          ;;
20345 esac
20346 echo "Checking the size of $zzz..." >&4 
20347 cat > try.c <<EOCP
20348 #include <sys/types.h>
20349 #include <stdio.h>
20350 #$i_stdlib I_STDLIB
20351 #ifdef I_STDLIB
20352 #include <stdlib.h>
20353 #endif
20354 int main() {
20355     printf("%d\n", (int)sizeof($uidtype));
20356     exit(0);
20357 }
20358 EOCP
20359 set try
20360 if eval $compile_ok; then
20361         yyy=`$run ./try`
20362         case "$yyy" in
20363         '')     uidsize=4
20364                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20365                 ;;
20366         *)      uidsize=$yyy
20367                 echo "Your $zzz is $uidsize bytes long."
20368                 ;;
20369         esac
20370 else
20371         uidsize=4
20372         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20373 fi
20374
20375 echo " "
20376 case "$uidtype" in
20377 *_t) zzz="$uidtype"     ;;
20378 *)   zzz="uid"          ;;
20379 esac
20380 echo "Checking the sign of $zzz..." >&4
20381 cat > try.c <<EOCP
20382 #include <sys/types.h>
20383 #include <stdio.h>
20384 int main() {
20385         $uidtype foo = -1;
20386         if (foo < 0)
20387                 printf("-1\n");
20388         else
20389                 printf("1\n");
20390 }
20391 EOCP
20392 set try
20393 if eval $compile; then
20394         yyy=`$run ./try`
20395         case "$yyy" in
20396         '')     uidsign=1
20397                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20398                 ;;
20399         *)      uidsign=$yyy
20400                 case "$uidsign" in
20401                  1) echo "Your $zzz is unsigned." ;;
20402                 -1) echo "Your $zzz is signed."   ;;
20403                 esac
20404                 ;;
20405         esac
20406 else
20407         uidsign=1
20408         echo "(I can't compile the test program--guessing unsigned.)" >&4
20409 fi
20410
20411
20412
20413 echo " "
20414 $echo "Checking the format string to be used for uids..." >&4
20415
20416 case "$uidsign" in
20417 -1)     if $test X"$uidsize" = X"$ivsize"; then
20418                 uidformat="$ivdformat"
20419         else
20420                 if $test X"$uidsize" = X"$longsize"; then
20421                         uidformat='"ld"'
20422                 else
20423                         if $test X"$uidsize" = X"$intsize"; then
20424                                 uidformat='"d"'
20425                         else
20426                                 if $test X"$uidsize" = X"$shortsize"; then
20427                                         uidformat='"hd"'
20428                                 fi
20429                         fi
20430                 fi
20431         fi
20432         ;;
20433 *)      if $test X"$uidsize" = X"$uvsize"; then
20434                 uidformat="$uvuformat"
20435         else
20436                 if $test X"$uidsize" = X"$longsize"; then
20437                         uidformat='"lu"'
20438                 else
20439                         if $test X"$uidsize" = X"$intsize"; then
20440                                 uidformat='"u"'
20441                         else
20442                                 if $test X"$uidsize" = X"$shortsize"; then
20443                                         uidformat='"hu"'
20444                                 fi
20445                         fi
20446                 fi
20447         fi
20448         ;;
20449 esac
20450
20451
20452 case "$usesitecustomize" in
20453     $define|true|[Yy]*)
20454         usesitecustomize="$define"
20455         ;;
20456     *)
20457         usesitecustomize="$undef"
20458         ;;
20459     esac
20460
20461 : determine compiler compiler
20462 case "$yacc" in
20463 '')
20464         dflt=yacc;;
20465 *)
20466         dflt="$yacc";;
20467 esac
20468 echo " "
20469 comp='yacc'
20470 if $test -f "$byacc$_exe"; then
20471         dflt="$byacc"
20472         comp="byacc or $comp"
20473 fi
20474 if $test -f "$bison$_exe"; then
20475         comp="$comp or bison -y"
20476 fi
20477 rp="Which compiler compiler ($comp) shall I use?"
20478 . ./myread
20479 yacc="$ans"
20480 case "$yacc" in
20481 *bis*)
20482         case "$yacc" in
20483         *-y*) ;;
20484         *)
20485                 yacc="$yacc -y"
20486                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20487                 ;;
20488         esac
20489         ;;
20490 esac
20491
20492 : see if this is a fp.h system
20493 set fp.h i_fp
20494 eval $inhdr
20495
20496 : see if this is a fp_class.h system
20497 set fp_class.h i_fp_class
20498 eval $inhdr
20499
20500 : see if gdbm.h is available
20501 set gdbm.h t_gdbm
20502 eval $inhdr
20503 case "$t_gdbm" in
20504 $define)
20505         : see if gdbm_open exists
20506         set gdbm_open d_gdbm_open
20507         eval $inlibc
20508         case "$d_gdbm_open" in
20509         $undef)
20510                 t_gdbm="$undef"
20511                 echo "We won't be including <gdbm.h>"
20512                 ;;
20513         esac
20514         ;;
20515 esac
20516 val="$t_gdbm"
20517 set i_gdbm
20518 eval $setvar
20519
20520 : see if this is a ieeefp.h system
20521 case "$i_ieeefp" in
20522 '' ) set ieeefp.h i_ieeefp
20523      eval $inhdr
20524      ;;
20525 esac
20526
20527 : see if this is a libutil.h system
20528 set libutil.h i_libutil
20529 eval $inhdr
20530
20531 : see if mach cthreads are available
20532 if test "X$usethreads" = "X$define"; then
20533         set mach/cthreads.h i_machcthr
20534         eval $inhdr
20535 else
20536         i_machcthr="$undef"
20537 fi
20538
20539
20540
20541 : see if this is a mntent.h system
20542 set mntent.h i_mntent
20543 eval $inhdr
20544
20545 : see if ndbm.h is available
20546 set ndbm.h t_ndbm
20547 eval $inhdr
20548
20549 case "$t_ndbm" in
20550 $undef)
20551     # Some Linux distributions such as RedHat 7.1 put the
20552     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20553     if $test -f /usr/include/gdbm/ndbm.h; then
20554         echo '<gdbm/ndbm.h> found.'
20555         ccflags="$ccflags -I/usr/include/gdbm"
20556         cppflags="$cppflags -I/usr/include/gdbm"
20557         t_ndbm=$define
20558     fi
20559     ;;
20560 esac
20561
20562 case "$t_ndbm" in
20563 $define)
20564         : see if dbm_open exists
20565         set dbm_open d_dbm_open
20566         eval $inlibc
20567         case "$d_dbm_open" in
20568         $undef)
20569                 t_ndbm="$undef"
20570                 echo "We won't be including <ndbm.h>"
20571                 ;;
20572         esac
20573         ;;
20574 esac
20575 val="$t_ndbm"
20576 set i_ndbm
20577 eval $setvar
20578
20579 : see if net/errno.h is available
20580 val=''
20581 set net/errno.h val
20582 eval $inhdr
20583
20584 : Unfortunately, it causes problems on some systems.  Arrgh.
20585 case "$val" in
20586 $define)
20587         cat > try.c <<'EOM'
20588 #include <stdio.h>
20589 #include <errno.h>
20590 #include <net/errno.h>
20591 int func()
20592 {
20593         return ENOTSOCK;
20594 }
20595 EOM
20596         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20597                 echo "We'll be including <net/errno.h>." >&4
20598         else
20599                 echo "We won't be including <net/errno.h>." >&4
20600                 val="$undef"
20601         fi
20602         $rm -f try.* try
20603         ;;
20604 esac
20605 set i_neterrno
20606 eval $setvar
20607
20608 : see if netinet/tcp.h is available
20609 set netinet/tcp.h i_netinettcp
20610 eval $inhdr
20611
20612 : see if this is a poll.h system
20613 set poll.h i_poll
20614 eval $inhdr
20615
20616 : see if this is a prot.h system
20617 set prot.h i_prot
20618 eval $inhdr
20619
20620 echo " "
20621 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20622 $cat <<'EOSH' > Cppsym.know
20623 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20624 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20625 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20626 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20627 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20628 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20629 bull c cadmus clipper CMU COFF COMPILER_VERSION
20630 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20631 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20632 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20633 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20634 GLIBC GLIBC_MINOR
20635 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20636 H3050R H3050RX hbullx20 hcx host_mips
20637 hp200 hp300 hp700 HP700 hp800 hp9000
20638 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20639 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20640 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20641 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20642 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20643 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20644 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20645 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20646 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20647 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20648 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20649 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20650 MATH_HAS_NO_SIDE_EFFECTS
20651 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20652 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20653 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20654 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20655 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20656 NetBSD news1500 news1700 news1800 news1900 news3700
20657 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20658 ns32016 ns32332 ns32k nsc32000
20659 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20660 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20661 pc532 pdp11 PGC PIC plexus PORTAR posix
20662 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20663 POSIX_C_SOURCE POSIX_SOURCE POWER
20664 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20665 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20666 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20667 sony sony_news sonyrisc sparc sparclite spectrum
20668 stardent stdc STDC_EXT stratos sun sun3 sun386
20669 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20670 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20671 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20672 sysV68 sysV88 Tek4132 Tek4300 titan
20673 TM3200 TM5400 TM5600
20674 tower tower32 tower32_200 tower32_600 tower32_700
20675 tower32_800 tower32_850 tss
20676 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20677 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20678 unix UNIX95 UNIX99 unixpc unos
20679 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20680 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20681 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20682 USGr4 USGr4_2
20683 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20684 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20685 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20686 z8000
20687 EOSH
20688 # Maybe put other stuff here too.
20689 cat <<EOSH >>Cppsym.know
20690 $osname
20691 EOSH
20692 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20693 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20694 $cat Cppsym.know > Cppsym.c
20695 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20696 $rm -f Cppsym.a Cppsym.b Cppsym.c
20697 cat <<EOSH > Cppsym
20698 $startsh
20699 if $test \$# -gt 0; then
20700     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20701     if $test -s Cppsym.got; then
20702         $rm -f Cppsym.got
20703         exit 0
20704     fi
20705     $rm -f Cppsym.got
20706     exit 1
20707 else
20708     $tr " " "$trnl" | ./Cppsym.try
20709     exit 0
20710 fi
20711 EOSH
20712 chmod +x Cppsym
20713 $eunicefix Cppsym
20714 cat <<EOSH > Cppsym.try
20715 $startsh
20716 cat <<'EOCP' > try.c
20717 #include <stdio.h>
20718 #if cpp_stuff == 1
20719 #define STRINGIFY(a)    "a"
20720 #endif
20721 #if cpp_stuff == 42
20722 #define StGiFy(a)  #a
20723 #define STRINGIFY(a)    StGiFy(a)
20724 #endif
20725 #if $cpp_stuff != 1 && $cpp_stuff != 42
20726 #   include "Bletch: How does this C preprocessor stringify macros?"
20727 #endif
20728 int main() {
20729 EOCP
20730 $awk \\
20731 EOSH
20732 cat <<'EOSH' >> Cppsym.try
20733 'length($1) > 0 {
20734     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20735     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20736     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20737     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20738 }'       >> try.c
20739 echo 'return 0;}' >> try.c
20740 EOSH
20741 cat <<EOSH >> Cppsym.try
20742 ccflags="$ccflags"
20743 case "$osname-$gccversion" in
20744 irix-) ccflags="\$ccflags -woff 1178" ;;
20745 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20746 esac
20747 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20748 EOSH
20749 chmod +x Cppsym.try
20750 $eunicefix Cppsym.try
20751 ./Cppsym < Cppsym.know > Cppsym.true
20752 : Add in any linux cpp "predefined macros":
20753 case "$osname::$gccversion" in
20754   *linux*::*.*)
20755     tHdrH=_tmpHdr
20756     rm -f $tHdrH'.h' $tHdrH
20757     touch $tHdrH'.h'
20758     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20759        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20760        if [ -s $tHdrH'_cppsym.real' ]; then
20761           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20762        fi
20763     fi
20764     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20765   ;;
20766 esac
20767 : now check the C compiler for additional symbols
20768 postprocess_cc_v=''
20769 case "$osname" in
20770 aix) postprocess_cc_v="|$tr , ' '" ;;
20771 esac
20772 $cat >ccsym <<EOS
20773 $startsh
20774 $cat >tmp.c <<EOF
20775 extern int foo;
20776 EOF
20777 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20778 do
20779         case "\$i" in
20780         -D*) echo "\$i" | $sed 's/^-D//';;
20781         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20782         esac
20783 done
20784 $rm -f try.c
20785 EOS
20786 postprocess_cc_v=''
20787 chmod +x ccsym
20788 $eunicefix ccsym
20789 ./ccsym > ccsym1.raw
20790 if $test -s ccsym1.raw; then
20791        $sort ccsym1.raw | $uniq >ccsym.raw
20792 else
20793        mv ccsym1.raw ccsym.raw
20794 fi
20795
20796 $awk '/\=/ { print $0; next }
20797         { print $0"=1" }' ccsym.raw >ccsym.list
20798 $comm -13 Cppsym.true ccsym.list >ccsym.own
20799 $comm -12 Cppsym.true ccsym.list >ccsym.com
20800 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20801 also=''
20802 if $test -z ccsym.raw; then
20803         echo "Your C compiler doesn't seem to define any symbols!" >&4
20804         echo " "
20805         echo "However, your C preprocessor defines the following symbols:"
20806         $cat Cppsym.true
20807         ccsymbols=''
20808         cppsymbols=`$cat Cppsym.true`
20809         cppsymbols=`echo $cppsymbols`
20810         cppccsymbols="$cppsymbols"
20811 else
20812         if $test -s ccsym.com; then
20813                 echo "Your C compiler and pre-processor define these symbols:"
20814                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20815                 also='also '
20816                 symbols='ones'
20817                 cppccsymbols=`$cat ccsym.com`
20818                 cppccsymbols=`echo $cppccsymbols`
20819                 $test "$silent" || sleep 1
20820         fi
20821         if $test -s ccsym.cpp; then
20822                 $test "$also" && echo " "
20823                 echo "Your C pre-processor ${also}defines the following symbols:"
20824                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20825                 also='further '
20826                 cppsymbols=`$cat ccsym.cpp`
20827                 cppsymbols=`echo $cppsymbols`
20828                 $test "$silent" || sleep 1
20829         fi
20830         if $test -s ccsym.own; then
20831                 $test "$also" && echo " "
20832                 echo "Your C compiler ${also}defines the following cpp symbols:"
20833                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20834                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20835                 ccsymbols=`$cat ccsym.own`
20836                 ccsymbols=`echo $ccsymbols`
20837                 $test "$silent" || sleep 1
20838         fi
20839 fi
20840
20841 : see if this is a termio system
20842 val="$undef"
20843 val2="$undef"
20844 val3="$undef"
20845 if $test `./findhdr termios.h`; then
20846         set tcsetattr i_termios
20847         eval $inlibc
20848         val3="$i_termios"
20849 fi
20850 echo " "
20851 case "$val3" in
20852 "$define") echo "You have POSIX termios.h... good!" >&4;;
20853 *) if ./Cppsym pyr; then
20854                 case "`/bin/universe`" in
20855                 ucb) if $test `./findhdr sgtty.h`; then
20856                                 val2="$define"
20857                                 echo "<sgtty.h> found." >&4
20858                         else
20859                                 echo "System is pyramid with BSD universe."
20860                                 echo "<sgtty.h> not found--you could have problems." >&4
20861                         fi;;
20862                 *) if $test `./findhdr termio.h`; then
20863                                 val="$define"
20864                                 echo "<termio.h> found." >&4
20865                         else
20866                                 echo "System is pyramid with USG universe."
20867                                 echo "<termio.h> not found--you could have problems." >&4
20868                         fi;;
20869                 esac
20870         elif ./usg; then
20871                 if $test `./findhdr termio.h`; then
20872                         echo "<termio.h> found." >&4
20873                         val="$define"
20874                 elif $test `./findhdr sgtty.h`; then
20875                         echo "<sgtty.h> found." >&4
20876                         val2="$define"
20877                 else
20878 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20879                 fi
20880         else
20881                 if $test `./findhdr sgtty.h`; then
20882                         echo "<sgtty.h> found." >&4
20883                         val2="$define"
20884                 elif $test `./findhdr termio.h`; then
20885                         echo "<termio.h> found." >&4
20886                         val="$define"
20887                 else
20888 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20889                 fi
20890         fi;;
20891 esac
20892 set i_termio; eval $setvar
20893 val=$val2; set i_sgtty; eval $setvar
20894 val=$val3; set i_termios; eval $setvar
20895
20896 : see if stddef is available
20897 set stddef.h i_stddef
20898 eval $inhdr
20899
20900 : see if sys/access.h is available
20901 set sys/access.h i_sysaccess
20902 eval $inhdr
20903
20904 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20905 set sys/filio.h i_sysfilio
20906 eval $inhdr
20907 echo " "
20908 if $test `./findhdr sys/ioctl.h`; then
20909         val="$define"
20910         echo '<sys/ioctl.h> found.' >&4
20911 else
20912         val="$undef"
20913         if $test $i_sysfilio = "$define"; then
20914             echo '<sys/ioctl.h> NOT found.' >&4
20915         else
20916                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20917                 $test $i_termio = "$define" && xxx="termio.h"
20918                 $test $i_termios = "$define" && xxx="termios.h"
20919 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20920         fi
20921 fi
20922 set i_sysioctl
20923 eval $setvar
20924
20925 : see if socket ioctl defs are in sys/sockio.h
20926 echo " "
20927 xxx=`./findhdr sys/sockio.h`
20928 if $test "$xxx"; then
20929         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20930                 val="$define"
20931                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20932         else
20933                 val="$undef"
20934                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20935         fi
20936 else
20937         val="$undef"
20938         $cat <<EOM
20939 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20940 EOM
20941 fi
20942 set i_syssockio
20943 eval $setvar
20944
20945
20946 : see if this is a syslog.h system
20947 set syslog.h i_syslog
20948 eval $inhdr
20949
20950
20951 : see if this is a sys/mode.h system
20952 set sys/mode.h i_sysmode
20953 eval $inhdr
20954
20955 : see if sys/resource.h has to be included
20956 set sys/resource.h i_sysresrc
20957 eval $inhdr
20958
20959 : see if sys/security.h is available
20960 set sys/security.h i_syssecrt
20961 eval $inhdr
20962
20963 : see if this is a sys/statvfs.h system
20964 set sys/statvfs.h i_sysstatvfs
20965 eval $inhdr
20966
20967 : see if this is a sys/un.h system
20968 set sys/un.h i_sysun
20969 eval $inhdr
20970
20971
20972 : see if this is a sys/utsname.h system
20973 set sys/utsname.h i_sysutsname
20974 eval $inhdr
20975
20976 : see if this is a syswait system
20977 set sys/wait.h i_syswait
20978 eval $inhdr
20979
20980 : see if this is a ustat.h system
20981 set ustat.h i_ustat
20982 eval $inhdr
20983
20984 : see if this is an utime system
20985 set utime.h i_utime
20986 eval $inhdr
20987
20988 : see if this is a values.h system
20989 set values.h i_values
20990 eval $inhdr
20991
20992 : see if this is a vfork system
20993 case "$d_vfork" in
20994 "$define")
20995         set vfork.h i_vfork
20996         eval $inhdr
20997         ;;
20998 *)
20999         i_vfork="$undef"
21000         ;;
21001 esac
21002
21003 echo " "
21004 echo "Looking for extensions..." >&4
21005 : If we are using the old config.sh, known_extensions may contain
21006 : old or inaccurate or duplicate values.
21007 known_extensions=''
21008 nonxs_extensions=''
21009 : We do not use find because it might not be available.
21010 : We do not just use MANIFEST because the user may have dropped
21011 : some additional extensions into the source tree and expect them
21012 : to be built.
21013
21014 : Function to recursively find available extensions, ignoring DynaLoader
21015 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21016 find_extensions='
21017     for xxx in *; do
21018         case "$xxx" in
21019             DynaLoader|dynaload) ;;
21020             *)
21021             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21022                 known_extensions="$known_extensions $1$xxx";
21023             elif $test -f $xxx/Makefile.PL; then
21024                 nonxs_extensions="$nonxs_extensions $1$xxx";
21025             else
21026                 if $test -d $xxx -a $# -lt 10; then
21027                     set $1$xxx/ $*;
21028                     cd "$xxx";
21029                     eval $find_extensions;
21030                     cd ..;
21031                     shift;
21032                 fi;
21033             fi
21034             ;;
21035         esac;
21036     done'
21037 tdir=`pwd`
21038 cd "$rsrc/ext"
21039 set X
21040 shift
21041 eval $find_extensions
21042 # Special case:  Add in threads/shared since it is not picked up by the
21043 # recursive find above (and adding in general recursive finding breaks
21044 # SDBM_File/sdbm).  A.D.  10/25/2001.
21045 known_extensions="$known_extensions threads/shared"
21046 set X $known_extensions
21047 shift
21048 known_extensions="$*"
21049 #  Ditto for IO/Compress/Base and IO/Compress/Zlib
21050 nonxs_extensions="$nonxs_extensions IO/Compress/Base IO/Compress/Zlib"
21051 set X $nonxs_extensions
21052 shift
21053 nonxs_extensions="$*"
21054 cd "$tdir"
21055
21056 : Now see which are supported on this system.
21057 avail_ext=''
21058 for xxx in $known_extensions ; do
21059         case "$xxx" in
21060         DB_File|db_file)
21061                 case "$i_db" in
21062                 $define) avail_ext="$avail_ext $xxx" ;;
21063                 esac
21064                 ;;
21065         GDBM_File|gdbm_fil)
21066                 case "$i_gdbm" in
21067                 $define) avail_ext="$avail_ext $xxx" ;;
21068                 esac
21069                 ;;
21070         I18N/Langinfo|i18n_lan)
21071                 case "$i_langinfo$d_nl_langinfo" in
21072                 $define$define) avail_ext="$avail_ext $xxx" ;;
21073                 esac
21074                 ;;
21075         NDBM_File|ndbm_fil)
21076                 case "$i_ndbm" in
21077                 $define)
21078                     case "$osname-$use64bitint" in
21079                     hpux-define)
21080                         case "$libs" in
21081                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21082                         esac
21083                         ;;
21084                     *) avail_ext="$avail_ext $xxx" ;;
21085                     esac
21086                     ;;
21087                 esac
21088                 ;;
21089         ODBM_File|odbm_fil)
21090                 case "${i_dbm}${i_rpcsvcdbm}" in
21091                 *"${define}"*)
21092                     case "$osname-$use64bitint" in
21093                     hpux-define)
21094                         case "$libs" in
21095                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21096                         esac
21097                         ;;
21098                     *) avail_ext="$avail_ext $xxx" ;;
21099                     esac
21100                     ;;
21101                 esac
21102                 ;;
21103         POSIX|posix)
21104                 case "$useposix" in
21105                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21106                 esac
21107                 ;;
21108         Opcode|opcode)
21109                 case "$useopcode" in
21110                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21111                 esac
21112                 ;;
21113         Socket|socket)
21114                 case "$d_socket" in
21115                 true|$define|y)
21116                     case "$osname" in
21117                     beos) ;; # not unless BONE
21118                     *) avail_ext="$avail_ext $xxx" ;;
21119                     esac
21120                     ;;
21121                 esac
21122                 ;;
21123         Sys/Syslog|sys/syslog)
21124                 : XXX syslog requires socket
21125                 case "$d_socket" in
21126                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21127                 esac
21128                 ;;
21129         Thread|thread)
21130                 case "$usethreads" in
21131                 true|$define|y)
21132                         case "$useithreads" in
21133                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21134                         esac
21135                 esac
21136                 ;;
21137         Win32*)
21138                 case "$osname" in
21139                 cygwin) avail_ext="$avail_ext $xxx" ;;
21140                 esac
21141                 ;;
21142         XS/APItest|xs/apitest)
21143                 # This is just for testing.  Skip it unless we have dynamic loading.
21144
21145                 case "$usedl" in
21146                 $define) avail_ext="$avail_ext $xxx" ;;
21147                 esac
21148                 ;;
21149         XS/Typemap|xs/typemap)
21150                 # This is just for testing.  Skip it unless we have dynamic loading.
21151                 case "$usedl" in
21152                 $define) avail_ext="$avail_ext $xxx" ;;
21153                 esac
21154                 ;;
21155         threads|threads/shared)
21156                 # threads and threads::shared are special cases.
21157                 # To stop people from asking "Perl 5.8.0 was supposed
21158                 # to have this new fancy threads implementation but my
21159                 # perl doesn't have it" and from people trying to
21160                 # (re)install the threads module using CPAN.pm and
21161                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21162                 # the threads.pm and threads/shared.pm will always be
21163                 # there, croaking informatively ("you need to rebuild
21164                 # all of Perl with threads, sorry") when threads haven't
21165                 # been compiled in.
21166                 # --jhi
21167                 avail_ext="$avail_ext $xxx"
21168                 ;;
21169         IPC/SysV|ipc/sysv)
21170                 : XXX Do we need a useipcsysv variable here
21171                 case "${d_msg}${d_sem}${d_shm}" in
21172                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21173                 esac
21174                 ;;
21175         *)      avail_ext="$avail_ext $xxx"
21176                 ;;
21177         esac
21178 done
21179
21180 set X $avail_ext
21181 shift
21182 avail_ext="$*"
21183
21184 case "$onlyextensions" in
21185 '') ;;
21186 *)  keepextensions=''
21187     echo "You have requested that only certains extensions be included..." >&4
21188     for i in $onlyextensions; do
21189         case " $avail_ext " in
21190         *" $i "*)
21191             echo "Keeping extension $i."
21192             keepextensions="$keepextensions $i"
21193             ;;
21194         *) echo "Ignoring extension $i." ;;
21195         esac
21196     done
21197     avail_ext="$keepextensions"
21198     ;;
21199 esac
21200
21201 case "$noextensions" in
21202 '') ;;
21203 *)  keepextensions=''
21204     echo "You have requested that certain extensions be ignored..." >&4
21205     for i in $avail_ext; do
21206         case " $noextensions " in
21207         *" $i "*) echo "Ignoring extension $i." ;;
21208         *) echo "Keeping extension $i.";
21209            keepextensions="$keepextensions $i"
21210            ;;
21211         esac
21212     done
21213     avail_ext="$keepextensions"
21214     ;;
21215 esac
21216
21217 : Now see which nonxs extensions are supported on this system.
21218 : For now assume all are.
21219 nonxs_ext=''
21220 for xxx in $nonxs_extensions ; do
21221         case "$xxx" in
21222         *)      nonxs_ext="$nonxs_ext $xxx"
21223                 ;;
21224         esac
21225 done
21226
21227 set X $nonxs_ext
21228 shift
21229 nonxs_ext="$*"
21230
21231 case $usedl in
21232 $define)
21233         $cat <<EOM
21234 A number of extensions are supplied with $package.  You may choose to
21235 compile these extensions for dynamic loading (the default), compile
21236 them into the $package executable (static loading), or not include
21237 them at all.  Answer "none" to include no extensions.
21238 Note that DynaLoader is always built and need not be mentioned here.
21239
21240 EOM
21241         case "$dynamic_ext" in
21242         '')
21243                 : Exclude those listed in static_ext
21244                 dflt=''
21245                 for xxx in $avail_ext; do
21246                         case " $static_ext " in
21247                         *" $xxx "*) ;;
21248                         *) dflt="$dflt $xxx" ;;
21249                         esac
21250                 done
21251                 set X $dflt
21252                 shift
21253                 dflt="$*"
21254                 ;;
21255         *)      dflt="$dynamic_ext"
21256                 # Perhaps we are reusing an old out-of-date config.sh.
21257                 case "$hint" in
21258                 previous)
21259                         if test X"$dynamic_ext" != X"$avail_ext"; then
21260                                 $cat <<EOM
21261 NOTICE:  Your previous config.sh list may be incorrect.
21262 The extensions now available to you are
21263         ${avail_ext}
21264 but the default list from your previous config.sh is
21265         ${dynamic_ext}
21266
21267 EOM
21268                         fi
21269                         ;;
21270                 esac
21271                 ;;
21272         esac
21273         case "$dflt" in
21274         '')     dflt=none;;
21275         esac
21276         rp="What extensions do you wish to load dynamically?"
21277         . ./myread
21278         case "$ans" in
21279         none) dynamic_ext=' ' ;;
21280         *) dynamic_ext="$ans" ;;
21281         esac
21282
21283         case "$static_ext" in
21284         '')
21285                 : Exclude those already listed in dynamic linking
21286                 dflt=''
21287                 for xxx in $avail_ext; do
21288                         case " $dynamic_ext " in
21289                         *" $xxx "*) ;;
21290                         *) dflt="$dflt $xxx" ;;
21291                         esac
21292                 done
21293                 set X $dflt
21294                 shift
21295                 dflt="$*"
21296                 ;;
21297         *)  dflt="$static_ext"
21298                 ;;
21299         esac
21300
21301         case "$dflt" in
21302         '')     dflt=none;;
21303         esac
21304         rp="What extensions do you wish to load statically?"
21305         . ./myread
21306         case "$ans" in
21307         none) static_ext=' ' ;;
21308         *) static_ext="$ans" ;;
21309         esac
21310         ;;
21311 *)
21312         $cat <<EOM
21313 A number of extensions are supplied with $package.  Answer "none"
21314 to include no extensions.
21315 Note that DynaLoader is always built and need not be mentioned here.
21316
21317 EOM
21318         case "$static_ext" in
21319         '') dflt="$avail_ext" ;;
21320         *)      dflt="$static_ext"
21321                 # Perhaps we are reusing an old out-of-date config.sh.
21322                 case "$hint" in
21323                 previous)
21324                         if test X"$static_ext" != X"$avail_ext"; then
21325                                 $cat <<EOM
21326 NOTICE:  Your previous config.sh list may be incorrect.
21327 The extensions now available to you are
21328         ${avail_ext}
21329 but the default list from your previous config.sh is
21330         ${static_ext}
21331
21332 EOM
21333                         fi
21334                         ;;
21335                 esac
21336                 ;;
21337         esac
21338         : Exclude those that are not xs extensions
21339         case "$dflt" in
21340         '')     dflt=none;;
21341         esac
21342         rp="What extensions do you wish to include?"
21343         . ./myread
21344         case "$ans" in
21345         none) static_ext=' ' ;;
21346         *) static_ext="$ans" ;;
21347         esac
21348         ;;
21349 esac
21350 #
21351 # Encode is a special case.  If we are building Encode as a static
21352 # extension, we need to explicitly list its subextensions as well.
21353 # For other nested extensions, this is handled automatically by
21354 # the appropriate Makefile.PL.
21355 case " $static_ext " in
21356         *" Encode "*) # Add the subextensions of Encode
21357         cd "$rsrc/ext"
21358         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21359                 static_ext="$static_ext Encode/$xxx"
21360         done
21361         cd "$tdir"
21362         ;;
21363 esac
21364
21365 set X $dynamic_ext $static_ext $nonxs_ext
21366 shift
21367 extensions="$*"
21368
21369 # Sanity check:  We require an extension suitable for use with
21370 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21371 # should show up as failures in the test suite, but it's helpful to
21372 # catch them now.) The 'extensions' list is normally sorted
21373 # alphabetically, so we need to accept either
21374 #    DB_File ... Fcntl ... IO  ....
21375 # or something like
21376 #    Fcntl ... NDBM_File ... IO  ....
21377 case " $extensions"  in
21378 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21379 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21380 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21381 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21382    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21383    ;;
21384 esac
21385
21386 : Remove libraries needed only for extensions
21387 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21388 : The exception is SunOS 4.x, which needs them.
21389 case "${osname}X${osvers}" in
21390 sunos*X4*)
21391     perllibs="$libs"
21392     ;;
21393 *) case "$usedl" in
21394     $define|true|[yY]*)
21395             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21396             shift
21397             perllibs="$*"
21398             ;;
21399     *)  perllibs="$libs"
21400             ;;
21401     esac
21402     ;;
21403 esac
21404
21405 : Remove build directory name from cppstdin so it can be used from
21406 : either the present location or the final installed location.
21407 echo " "
21408 : Get out of the UU directory to get correct path name.
21409 cd ..
21410 case "$cppstdin" in
21411 `pwd`/cppstdin)
21412         echo "Stripping down cppstdin path name"
21413         cppstdin=cppstdin
21414         ;;
21415 esac
21416 cd UU
21417
21418 : end of configuration questions
21419 echo " "
21420 echo "End of configuration questions."
21421 echo " "
21422
21423 : back to where it started
21424 if test -d ../UU; then
21425         cd ..
21426 fi
21427
21428 : configuration may be patched via a 'config.arch' file
21429 if $test -f config.arch; then
21430         echo "I see a config.arch file, loading it."
21431         . ./config.arch
21432 fi
21433
21434 : configuration may be patched via a 'config.over' file
21435 if $test -f config.over; then
21436         echo " "
21437         dflt=y
21438         rp='I see a config.over file.  Do you wish to load it?'
21439         . UU/myread
21440         case "$ans" in
21441         n*) echo "OK, I'll ignore it.";;
21442         *)      . ./config.over
21443                 echo "Configuration override changes have been loaded."
21444                 ;;
21445         esac
21446 fi
21447
21448 : in case they want portability, strip down executable paths
21449 case "$d_portable" in
21450 "$define")
21451         echo " "
21452         echo "Stripping down executable paths..." >&4
21453         for file in $loclist $trylist; do
21454                 eval temp=\$$file
21455                 eval $file=`basename $temp`
21456         done
21457         ;;
21458 esac
21459
21460 : create config.sh file
21461 echo " "
21462 echo "Creating config.sh..." >&4
21463 $spitshell <<EOT >config.sh
21464 $startsh
21465 #
21466 # This file was produced by running the Configure script. It holds all the
21467 # definitions figured out by Configure. Should you modify one of these values,
21468 # do not forget to propagate your changes by running "Configure -der". You may
21469 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21470 #
21471
21472 # Package name      : $package
21473 # Source directory  : $src
21474 # Configuration time: $cf_time
21475 # Configured by     : $cf_by
21476 # Target system     : $myuname
21477
21478 Author='$Author'
21479 Date='$Date'
21480 Header='$Header'
21481 Id='$Id'
21482 Locker='$Locker'
21483 Log='$Log'
21484 Mcc='$Mcc'
21485 RCSfile='$RCSfile'
21486 Revision='$Revision'
21487 Source='$Source'
21488 State='$State'
21489 _a='$_a'
21490 _exe='$_exe'
21491 _o='$_o'
21492 afs='$afs'
21493 afsroot='$afsroot'
21494 alignbytes='$alignbytes'
21495 ansi2knr='$ansi2knr'
21496 aphostname='$aphostname'
21497 api_revision='$api_revision'
21498 api_subversion='$api_subversion'
21499 api_version='$api_version'
21500 api_versionstring='$api_versionstring'
21501 ar='$ar'
21502 archlib='$archlib'
21503 archlibexp='$archlibexp'
21504 archname64='$archname64'
21505 archname='$archname'
21506 archobjs='$archobjs'
21507 asctime_r_proto='$asctime_r_proto'
21508 awk='$awk'
21509 baserev='$baserev'
21510 bash='$bash'
21511 bin='$bin'
21512 binexp='$binexp'
21513 bison='$bison'
21514 byacc='$byacc'
21515 byteorder='$byteorder'
21516 c='$c'
21517 castflags='$castflags'
21518 cat='$cat'
21519 cc='$cc'
21520 cccdlflags='$cccdlflags'
21521 ccdlflags='$ccdlflags'
21522 ccflags='$ccflags'
21523 ccflags_uselargefiles='$ccflags_uselargefiles'
21524 ccname='$ccname'
21525 ccsymbols='$ccsymbols'
21526 ccversion='$ccversion'
21527 cf_by='$cf_by'
21528 cf_email='$cf_email'
21529 cf_time='$cf_time'
21530 charsize='$charsize'
21531 chgrp='$chgrp'
21532 chmod='$chmod'
21533 chown='$chown'
21534 clocktype='$clocktype'
21535 comm='$comm'
21536 compress='$compress'
21537 contains='$contains'
21538 cp='$cp'
21539 cpio='$cpio'
21540 cpp='$cpp'
21541 cpp_stuff='$cpp_stuff'
21542 cppccsymbols='$cppccsymbols'
21543 cppflags='$cppflags'
21544 cpplast='$cpplast'
21545 cppminus='$cppminus'
21546 cpprun='$cpprun'
21547 cppstdin='$cppstdin'
21548 cppsymbols='$cppsymbols'
21549 crypt_r_proto='$crypt_r_proto'
21550 cryptlib='$cryptlib'
21551 csh='$csh'
21552 ctermid_r_proto='$ctermid_r_proto'
21553 ctime_r_proto='$ctime_r_proto'
21554 d_Gconvert='$d_Gconvert'
21555 d_PRIEUldbl='$d_PRIEUldbl'
21556 d_PRIFUldbl='$d_PRIFUldbl'
21557 d_PRIGUldbl='$d_PRIGUldbl'
21558 d_PRIXU64='$d_PRIXU64'
21559 d_PRId64='$d_PRId64'
21560 d_PRIeldbl='$d_PRIeldbl'
21561 d_PRIfldbl='$d_PRIfldbl'
21562 d_PRIgldbl='$d_PRIgldbl'
21563 d_PRIi64='$d_PRIi64'
21564 d_PRIo64='$d_PRIo64'
21565 d_PRIu64='$d_PRIu64'
21566 d_PRIx64='$d_PRIx64'
21567 d_SCNfldbl='$d_SCNfldbl'
21568 d__fwalk='$d__fwalk'
21569 d_access='$d_access'
21570 d_accessx='$d_accessx'
21571 d_aintl='$d_aintl'
21572 d_alarm='$d_alarm'
21573 d_archlib='$d_archlib'
21574 d_asctime_r='$d_asctime_r'
21575 d_atolf='$d_atolf'
21576 d_atoll='$d_atoll'
21577 d_attribute_format='$d_attribute_format'
21578 d_attribute_malloc='$d_attribute_malloc'
21579 d_attribute_nonnull='$d_attribute_nonnull'
21580 d_attribute_noreturn='$d_attribute_noreturn'
21581 d_attribute_pure='$d_attribute_pure'
21582 d_attribute_unused='$d_attribute_unused'
21583 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21584 d_bcmp='$d_bcmp'
21585 d_bcopy='$d_bcopy'
21586 d_bsd='$d_bsd'
21587 d_bsdgetpgrp='$d_bsdgetpgrp'
21588 d_bsdsetpgrp='$d_bsdsetpgrp'
21589 d_builtin_choose_expr='$d_builtin_choose_expr'
21590 d_builtin_expect='$d_builtin_expect'
21591 d_bzero='$d_bzero'
21592 d_c99_variadic_macros='$d_c99_variadic_macros'
21593 d_casti32='$d_casti32'
21594 d_castneg='$d_castneg'
21595 d_charvspr='$d_charvspr'
21596 d_chown='$d_chown'
21597 d_chroot='$d_chroot'
21598 d_chsize='$d_chsize'
21599 d_class='$d_class'
21600 d_clearenv='$d_clearenv'
21601 d_closedir='$d_closedir'
21602 d_cmsghdr_s='$d_cmsghdr_s'
21603 d_const='$d_const'
21604 d_copysignl='$d_copysignl'
21605 d_cplusplus='$d_cplusplus'
21606 d_crypt='$d_crypt'
21607 d_crypt_r='$d_crypt_r'
21608 d_csh='$d_csh'
21609 d_ctermid='$d_ctermid'
21610 d_ctermid_r='$d_ctermid_r'
21611 d_ctime_r='$d_ctime_r'
21612 d_cuserid='$d_cuserid'
21613 d_dbl_dig='$d_dbl_dig'
21614 d_dbminitproto='$d_dbminitproto'
21615 d_difftime='$d_difftime'
21616 d_dir_dd_fd='$d_dir_dd_fd'
21617 d_dirfd='$d_dirfd'
21618 d_dirnamlen='$d_dirnamlen'
21619 d_dlerror='$d_dlerror'
21620 d_dlopen='$d_dlopen'
21621 d_dlsymun='$d_dlsymun'
21622 d_dosuid='$d_dosuid'
21623 d_drand48_r='$d_drand48_r'
21624 d_drand48proto='$d_drand48proto'
21625 d_dup2='$d_dup2'
21626 d_eaccess='$d_eaccess'
21627 d_endgrent='$d_endgrent'
21628 d_endgrent_r='$d_endgrent_r'
21629 d_endhent='$d_endhent'
21630 d_endhostent_r='$d_endhostent_r'
21631 d_endnent='$d_endnent'
21632 d_endnetent_r='$d_endnetent_r'
21633 d_endpent='$d_endpent'
21634 d_endprotoent_r='$d_endprotoent_r'
21635 d_endpwent='$d_endpwent'
21636 d_endpwent_r='$d_endpwent_r'
21637 d_endsent='$d_endsent'
21638 d_endservent_r='$d_endservent_r'
21639 d_eofnblk='$d_eofnblk'
21640 d_eunice='$d_eunice'
21641 d_faststdio='$d_faststdio'
21642 d_fchdir='$d_fchdir'
21643 d_fchmod='$d_fchmod'
21644 d_fchown='$d_fchown'
21645 d_fcntl='$d_fcntl'
21646 d_fcntl_can_lock='$d_fcntl_can_lock'
21647 d_fd_macros='$d_fd_macros'
21648 d_fd_set='$d_fd_set'
21649 d_fds_bits='$d_fds_bits'
21650 d_fgetpos='$d_fgetpos'
21651 d_finite='$d_finite'
21652 d_finitel='$d_finitel'
21653 d_flexfnam='$d_flexfnam'
21654 d_flock='$d_flock'
21655 d_flockproto='$d_flockproto'
21656 d_fork='$d_fork'
21657 d_fp_class='$d_fp_class'
21658 d_fpathconf='$d_fpathconf'
21659 d_fpclass='$d_fpclass'
21660 d_fpclassify='$d_fpclassify'
21661 d_fpclassl='$d_fpclassl'
21662 d_fpos64_t='$d_fpos64_t'
21663 d_frexpl='$d_frexpl'
21664 d_fs_data_s='$d_fs_data_s'
21665 d_fseeko='$d_fseeko'
21666 d_fsetpos='$d_fsetpos'
21667 d_fstatfs='$d_fstatfs'
21668 d_fstatvfs='$d_fstatvfs'
21669 d_fsync='$d_fsync'
21670 d_ftello='$d_ftello'
21671 d_ftime='$d_ftime'
21672 d_futimes='$d_futimes'
21673 d_getcwd='$d_getcwd'
21674 d_getespwnam='$d_getespwnam'
21675 d_getfsstat='$d_getfsstat'
21676 d_getgrent='$d_getgrent'
21677 d_getgrent_r='$d_getgrent_r'
21678 d_getgrgid_r='$d_getgrgid_r'
21679 d_getgrnam_r='$d_getgrnam_r'
21680 d_getgrps='$d_getgrps'
21681 d_gethbyaddr='$d_gethbyaddr'
21682 d_gethbyname='$d_gethbyname'
21683 d_gethent='$d_gethent'
21684 d_gethname='$d_gethname'
21685 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21686 d_gethostbyname_r='$d_gethostbyname_r'
21687 d_gethostent_r='$d_gethostent_r'
21688 d_gethostprotos='$d_gethostprotos'
21689 d_getitimer='$d_getitimer'
21690 d_getlogin='$d_getlogin'
21691 d_getlogin_r='$d_getlogin_r'
21692 d_getmnt='$d_getmnt'
21693 d_getmntent='$d_getmntent'
21694 d_getnbyaddr='$d_getnbyaddr'
21695 d_getnbyname='$d_getnbyname'
21696 d_getnent='$d_getnent'
21697 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21698 d_getnetbyname_r='$d_getnetbyname_r'
21699 d_getnetent_r='$d_getnetent_r'
21700 d_getnetprotos='$d_getnetprotos'
21701 d_getpagsz='$d_getpagsz'
21702 d_getpbyname='$d_getpbyname'
21703 d_getpbynumber='$d_getpbynumber'
21704 d_getpent='$d_getpent'
21705 d_getpgid='$d_getpgid'
21706 d_getpgrp2='$d_getpgrp2'
21707 d_getpgrp='$d_getpgrp'
21708 d_getppid='$d_getppid'
21709 d_getprior='$d_getprior'
21710 d_getprotobyname_r='$d_getprotobyname_r'
21711 d_getprotobynumber_r='$d_getprotobynumber_r'
21712 d_getprotoent_r='$d_getprotoent_r'
21713 d_getprotoprotos='$d_getprotoprotos'
21714 d_getprpwnam='$d_getprpwnam'
21715 d_getpwent='$d_getpwent'
21716 d_getpwent_r='$d_getpwent_r'
21717 d_getpwnam_r='$d_getpwnam_r'
21718 d_getpwuid_r='$d_getpwuid_r'
21719 d_getsbyname='$d_getsbyname'
21720 d_getsbyport='$d_getsbyport'
21721 d_getsent='$d_getsent'
21722 d_getservbyname_r='$d_getservbyname_r'
21723 d_getservbyport_r='$d_getservbyport_r'
21724 d_getservent_r='$d_getservent_r'
21725 d_getservprotos='$d_getservprotos'
21726 d_getspnam='$d_getspnam'
21727 d_getspnam_r='$d_getspnam_r'
21728 d_gettimeod='$d_gettimeod'
21729 d_gmtime_r='$d_gmtime_r'
21730 d_gnulibc='$d_gnulibc'
21731 d_grpasswd='$d_grpasswd'
21732 d_hasmntopt='$d_hasmntopt'
21733 d_htonl='$d_htonl'
21734 d_ilogbl='$d_ilogbl'
21735 d_inc_version_list='$d_inc_version_list'
21736 d_index='$d_index'
21737 d_inetaton='$d_inetaton'
21738 d_int64_t='$d_int64_t'
21739 d_isascii='$d_isascii'
21740 d_isfinite='$d_isfinite'
21741 d_isinf='$d_isinf'
21742 d_isnan='$d_isnan'
21743 d_isnanl='$d_isnanl'
21744 d_killpg='$d_killpg'
21745 d_lchown='$d_lchown'
21746 d_ldbl_dig='$d_ldbl_dig'
21747 d_libm_lib_version='$d_libm_lib_version'
21748 d_link='$d_link'
21749 d_localtime_r='$d_localtime_r'
21750 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21751 d_locconv='$d_locconv'
21752 d_lockf='$d_lockf'
21753 d_longdbl='$d_longdbl'
21754 d_longlong='$d_longlong'
21755 d_lseekproto='$d_lseekproto'
21756 d_lstat='$d_lstat'
21757 d_madvise='$d_madvise'
21758 d_malloc_good_size='$d_malloc_good_size'
21759 d_malloc_size='$d_malloc_size'
21760 d_mblen='$d_mblen'
21761 d_mbstowcs='$d_mbstowcs'
21762 d_mbtowc='$d_mbtowc'
21763 d_memchr='$d_memchr'
21764 d_memcmp='$d_memcmp'
21765 d_memcpy='$d_memcpy'
21766 d_memmove='$d_memmove'
21767 d_memset='$d_memset'
21768 d_mkdir='$d_mkdir'
21769 d_mkdtemp='$d_mkdtemp'
21770 d_mkfifo='$d_mkfifo'
21771 d_mkstemp='$d_mkstemp'
21772 d_mkstemps='$d_mkstemps'
21773 d_mktime='$d_mktime'
21774 d_mmap='$d_mmap'
21775 d_modfl='$d_modfl'
21776 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21777 d_modflproto='$d_modflproto'
21778 d_mprotect='$d_mprotect'
21779 d_msg='$d_msg'
21780 d_msg_ctrunc='$d_msg_ctrunc'
21781 d_msg_dontroute='$d_msg_dontroute'
21782 d_msg_oob='$d_msg_oob'
21783 d_msg_peek='$d_msg_peek'
21784 d_msg_proxy='$d_msg_proxy'
21785 d_msgctl='$d_msgctl'
21786 d_msgget='$d_msgget'
21787 d_msghdr_s='$d_msghdr_s'
21788 d_msgrcv='$d_msgrcv'
21789 d_msgsnd='$d_msgsnd'
21790 d_msync='$d_msync'
21791 d_munmap='$d_munmap'
21792 d_mymalloc='$d_mymalloc'
21793 d_nice='$d_nice'
21794 d_nl_langinfo='$d_nl_langinfo'
21795 d_nv_preserves_uv='$d_nv_preserves_uv'
21796 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21797 d_off64_t='$d_off64_t'
21798 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21799 d_oldpthreads='$d_oldpthreads'
21800 d_oldsock='$d_oldsock'
21801 d_open3='$d_open3'
21802 d_pathconf='$d_pathconf'
21803 d_pause='$d_pause'
21804 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21805 d_phostname='$d_phostname'
21806 d_pipe='$d_pipe'
21807 d_poll='$d_poll'
21808 d_portable='$d_portable'
21809 d_printf_format_null='$d_printf_format_null'
21810 d_procselfexe='$d_procselfexe'
21811 d_pseudofork='$d_pseudofork'
21812 d_pthread_atfork='$d_pthread_atfork'
21813 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21814 d_pthread_yield='$d_pthread_yield'
21815 d_pwage='$d_pwage'
21816 d_pwchange='$d_pwchange'
21817 d_pwclass='$d_pwclass'
21818 d_pwcomment='$d_pwcomment'
21819 d_pwexpire='$d_pwexpire'
21820 d_pwgecos='$d_pwgecos'
21821 d_pwpasswd='$d_pwpasswd'
21822 d_pwquota='$d_pwquota'
21823 d_qgcvt='$d_qgcvt'
21824 d_quad='$d_quad'
21825 d_random_r='$d_random_r'
21826 d_readdir64_r='$d_readdir64_r'
21827 d_readdir='$d_readdir'
21828 d_readdir_r='$d_readdir_r'
21829 d_readlink='$d_readlink'
21830 d_readv='$d_readv'
21831 d_recvmsg='$d_recvmsg'
21832 d_rename='$d_rename'
21833 d_rewinddir='$d_rewinddir'
21834 d_rmdir='$d_rmdir'
21835 d_safebcpy='$d_safebcpy'
21836 d_safemcpy='$d_safemcpy'
21837 d_sanemcmp='$d_sanemcmp'
21838 d_sbrkproto='$d_sbrkproto'
21839 d_scalbnl='$d_scalbnl'
21840 d_sched_yield='$d_sched_yield'
21841 d_scm_rights='$d_scm_rights'
21842 d_seekdir='$d_seekdir'
21843 d_select='$d_select'
21844 d_sem='$d_sem'
21845 d_semctl='$d_semctl'
21846 d_semctl_semid_ds='$d_semctl_semid_ds'
21847 d_semctl_semun='$d_semctl_semun'
21848 d_semget='$d_semget'
21849 d_semop='$d_semop'
21850 d_sendmsg='$d_sendmsg'
21851 d_setegid='$d_setegid'
21852 d_seteuid='$d_seteuid'
21853 d_setgrent='$d_setgrent'
21854 d_setgrent_r='$d_setgrent_r'
21855 d_setgrps='$d_setgrps'
21856 d_sethent='$d_sethent'
21857 d_sethostent_r='$d_sethostent_r'
21858 d_setitimer='$d_setitimer'
21859 d_setlinebuf='$d_setlinebuf'
21860 d_setlocale='$d_setlocale'
21861 d_setlocale_r='$d_setlocale_r'
21862 d_setnent='$d_setnent'
21863 d_setnetent_r='$d_setnetent_r'
21864 d_setpent='$d_setpent'
21865 d_setpgid='$d_setpgid'
21866 d_setpgrp2='$d_setpgrp2'
21867 d_setpgrp='$d_setpgrp'
21868 d_setprior='$d_setprior'
21869 d_setproctitle='$d_setproctitle'
21870 d_setprotoent_r='$d_setprotoent_r'
21871 d_setpwent='$d_setpwent'
21872 d_setpwent_r='$d_setpwent_r'
21873 d_setregid='$d_setregid'
21874 d_setresgid='$d_setresgid'
21875 d_setresuid='$d_setresuid'
21876 d_setreuid='$d_setreuid'
21877 d_setrgid='$d_setrgid'
21878 d_setruid='$d_setruid'
21879 d_setsent='$d_setsent'
21880 d_setservent_r='$d_setservent_r'
21881 d_setsid='$d_setsid'
21882 d_setvbuf='$d_setvbuf'
21883 d_sfio='$d_sfio'
21884 d_shm='$d_shm'
21885 d_shmat='$d_shmat'
21886 d_shmatprototype='$d_shmatprototype'
21887 d_shmctl='$d_shmctl'
21888 d_shmdt='$d_shmdt'
21889 d_shmget='$d_shmget'
21890 d_sigaction='$d_sigaction'
21891 d_signbit='$d_signbit'
21892 d_sigprocmask='$d_sigprocmask'
21893 d_sigsetjmp='$d_sigsetjmp'
21894 d_sitearch='$d_sitearch'
21895 d_snprintf='$d_snprintf'
21896 d_sockatmark='$d_sockatmark'
21897 d_sockatmarkproto='$d_sockatmarkproto'
21898 d_socket='$d_socket'
21899 d_socklen_t='$d_socklen_t'
21900 d_sockpair='$d_sockpair'
21901 d_socks5_init='$d_socks5_init'
21902 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21903 d_sqrtl='$d_sqrtl'
21904 d_srand48_r='$d_srand48_r'
21905 d_srandom_r='$d_srandom_r'
21906 d_sresgproto='$d_sresgproto'
21907 d_sresuproto='$d_sresuproto'
21908 d_statblks='$d_statblks'
21909 d_statfs_f_flags='$d_statfs_f_flags'
21910 d_statfs_s='$d_statfs_s'
21911 d_statvfs='$d_statvfs'
21912 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21913 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21914 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21915 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21916 d_stdio_stream_array='$d_stdio_stream_array'
21917 d_stdiobase='$d_stdiobase'
21918 d_stdstdio='$d_stdstdio'
21919 d_strchr='$d_strchr'
21920 d_strcoll='$d_strcoll'
21921 d_strctcpy='$d_strctcpy'
21922 d_strerrm='$d_strerrm'
21923 d_strerror='$d_strerror'
21924 d_strerror_r='$d_strerror_r'
21925 d_strftime='$d_strftime'
21926 d_strlcat='$d_strlcat'
21927 d_strlcpy='$d_strlcpy'
21928 d_strtod='$d_strtod'
21929 d_strtol='$d_strtol'
21930 d_strtold='$d_strtold'
21931 d_strtoll='$d_strtoll'
21932 d_strtoq='$d_strtoq'
21933 d_strtoul='$d_strtoul'
21934 d_strtoull='$d_strtoull'
21935 d_strtouq='$d_strtouq'
21936 d_strxfrm='$d_strxfrm'
21937 d_suidsafe='$d_suidsafe'
21938 d_symlink='$d_symlink'
21939 d_syscall='$d_syscall'
21940 d_syscallproto='$d_syscallproto'
21941 d_sysconf='$d_sysconf'
21942 d_sysernlst='$d_sysernlst'
21943 d_syserrlst='$d_syserrlst'
21944 d_system='$d_system'
21945 d_tcgetpgrp='$d_tcgetpgrp'
21946 d_tcsetpgrp='$d_tcsetpgrp'
21947 d_telldir='$d_telldir'
21948 d_telldirproto='$d_telldirproto'
21949 d_time='$d_time'
21950 d_times='$d_times'
21951 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21952 d_tm_tm_zone='$d_tm_tm_zone'
21953 d_tmpnam_r='$d_tmpnam_r'
21954 d_truncate='$d_truncate'
21955 d_ttyname_r='$d_ttyname_r'
21956 d_tzname='$d_tzname'
21957 d_u32align='$d_u32align'
21958 d_ualarm='$d_ualarm'
21959 d_umask='$d_umask'
21960 d_uname='$d_uname'
21961 d_union_semun='$d_union_semun'
21962 d_unordered='$d_unordered'
21963 d_unsetenv='$d_unsetenv'
21964 d_usleep='$d_usleep'
21965 d_usleepproto='$d_usleepproto'
21966 d_ustat='$d_ustat'
21967 d_vendorarch='$d_vendorarch'
21968 d_vendorbin='$d_vendorbin'
21969 d_vendorlib='$d_vendorlib'
21970 d_vendorscript='$d_vendorscript'
21971 d_vfork='$d_vfork'
21972 d_void_closedir='$d_void_closedir'
21973 d_voidsig='$d_voidsig'
21974 d_voidtty='$d_voidtty'
21975 d_volatile='$d_volatile'
21976 d_vprintf='$d_vprintf'
21977 d_vsnprintf='$d_vsnprintf'
21978 d_wait4='$d_wait4'
21979 d_waitpid='$d_waitpid'
21980 d_wcstombs='$d_wcstombs'
21981 d_wctomb='$d_wctomb'
21982 d_writev='$d_writev'
21983 d_xenix='$d_xenix'
21984 date='$date'
21985 db_hashtype='$db_hashtype'
21986 db_prefixtype='$db_prefixtype'
21987 db_version_major='$db_version_major'
21988 db_version_minor='$db_version_minor'
21989 db_version_patch='$db_version_patch'
21990 defvoidused='$defvoidused'
21991 direntrytype='$direntrytype'
21992 dlext='$dlext'
21993 dlsrc='$dlsrc'
21994 doublesize='$doublesize'
21995 drand01='$drand01'
21996 drand48_r_proto='$drand48_r_proto'
21997 dynamic_ext='$dynamic_ext'
21998 eagain='$eagain'
21999 ebcdic='$ebcdic'
22000 echo='$echo'
22001 egrep='$egrep'
22002 emacs='$emacs'
22003 endgrent_r_proto='$endgrent_r_proto'
22004 endhostent_r_proto='$endhostent_r_proto'
22005 endnetent_r_proto='$endnetent_r_proto'
22006 endprotoent_r_proto='$endprotoent_r_proto'
22007 endpwent_r_proto='$endpwent_r_proto'
22008 endservent_r_proto='$endservent_r_proto'
22009 eunicefix='$eunicefix'
22010 exe_ext='$exe_ext'
22011 expr='$expr'
22012 extensions='$extensions'
22013 extras='$extras'
22014 fflushNULL='$fflushNULL'
22015 fflushall='$fflushall'
22016 find='$find'
22017 firstmakefile='$firstmakefile'
22018 flex='$flex'
22019 fpossize='$fpossize'
22020 fpostype='$fpostype'
22021 freetype='$freetype'
22022 from='$from'
22023 full_ar='$full_ar'
22024 full_csh='$full_csh'
22025 full_sed='$full_sed'
22026 gccansipedantic='$gccansipedantic'
22027 gccosandvers='$gccosandvers'
22028 gccversion='$gccversion'
22029 getgrent_r_proto='$getgrent_r_proto'
22030 getgrgid_r_proto='$getgrgid_r_proto'
22031 getgrnam_r_proto='$getgrnam_r_proto'
22032 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22033 gethostbyname_r_proto='$gethostbyname_r_proto'
22034 gethostent_r_proto='$gethostent_r_proto'
22035 getlogin_r_proto='$getlogin_r_proto'
22036 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22037 getnetbyname_r_proto='$getnetbyname_r_proto'
22038 getnetent_r_proto='$getnetent_r_proto'
22039 getprotobyname_r_proto='$getprotobyname_r_proto'
22040 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22041 getprotoent_r_proto='$getprotoent_r_proto'
22042 getpwent_r_proto='$getpwent_r_proto'
22043 getpwnam_r_proto='$getpwnam_r_proto'
22044 getpwuid_r_proto='$getpwuid_r_proto'
22045 getservbyname_r_proto='$getservbyname_r_proto'
22046 getservbyport_r_proto='$getservbyport_r_proto'
22047 getservent_r_proto='$getservent_r_proto'
22048 getspnam_r_proto='$getspnam_r_proto'
22049 gidformat='$gidformat'
22050 gidsign='$gidsign'
22051 gidsize='$gidsize'
22052 gidtype='$gidtype'
22053 glibpth='$glibpth'
22054 gmake='$gmake'
22055 gmtime_r_proto='$gmtime_r_proto'
22056 gnulibc_version='$gnulibc_version'
22057 grep='$grep'
22058 groupcat='$groupcat'
22059 groupstype='$groupstype'
22060 gzip='$gzip'
22061 h_fcntl='$h_fcntl'
22062 h_sysfile='$h_sysfile'
22063 hint='$hint'
22064 hostcat='$hostcat'
22065 html1dir='$html1dir'
22066 html1direxp='$html1direxp'
22067 html3dir='$html3dir'
22068 html3direxp='$html3direxp'
22069 i16size='$i16size'
22070 i16type='$i16type'
22071 i32size='$i32size'
22072 i32type='$i32type'
22073 i64size='$i64size'
22074 i64type='$i64type'
22075 i8size='$i8size'
22076 i8type='$i8type'
22077 i_arpainet='$i_arpainet'
22078 i_bsdioctl='$i_bsdioctl'
22079 i_crypt='$i_crypt'
22080 i_db='$i_db'
22081 i_dbm='$i_dbm'
22082 i_dirent='$i_dirent'
22083 i_dld='$i_dld'
22084 i_dlfcn='$i_dlfcn'
22085 i_fcntl='$i_fcntl'
22086 i_float='$i_float'
22087 i_fp='$i_fp'
22088 i_fp_class='$i_fp_class'
22089 i_gdbm='$i_gdbm'
22090 i_grp='$i_grp'
22091 i_ieeefp='$i_ieeefp'
22092 i_inttypes='$i_inttypes'
22093 i_langinfo='$i_langinfo'
22094 i_libutil='$i_libutil'
22095 i_limits='$i_limits'
22096 i_locale='$i_locale'
22097 i_machcthr='$i_machcthr'
22098 i_malloc='$i_malloc'
22099 i_math='$i_math'
22100 i_memory='$i_memory'
22101 i_mntent='$i_mntent'
22102 i_ndbm='$i_ndbm'
22103 i_netdb='$i_netdb'
22104 i_neterrno='$i_neterrno'
22105 i_netinettcp='$i_netinettcp'
22106 i_niin='$i_niin'
22107 i_poll='$i_poll'
22108 i_prot='$i_prot'
22109 i_pthread='$i_pthread'
22110 i_pwd='$i_pwd'
22111 i_rpcsvcdbm='$i_rpcsvcdbm'
22112 i_sfio='$i_sfio'
22113 i_sgtty='$i_sgtty'
22114 i_shadow='$i_shadow'
22115 i_socks='$i_socks'
22116 i_stdarg='$i_stdarg'
22117 i_stddef='$i_stddef'
22118 i_stdlib='$i_stdlib'
22119 i_string='$i_string'
22120 i_sunmath='$i_sunmath'
22121 i_sysaccess='$i_sysaccess'
22122 i_sysdir='$i_sysdir'
22123 i_sysfile='$i_sysfile'
22124 i_sysfilio='$i_sysfilio'
22125 i_sysin='$i_sysin'
22126 i_sysioctl='$i_sysioctl'
22127 i_syslog='$i_syslog'
22128 i_sysmman='$i_sysmman'
22129 i_sysmode='$i_sysmode'
22130 i_sysmount='$i_sysmount'
22131 i_sysndir='$i_sysndir'
22132 i_sysparam='$i_sysparam'
22133 i_sysresrc='$i_sysresrc'
22134 i_syssecrt='$i_syssecrt'
22135 i_sysselct='$i_sysselct'
22136 i_syssockio='$i_syssockio'
22137 i_sysstat='$i_sysstat'
22138 i_sysstatfs='$i_sysstatfs'
22139 i_sysstatvfs='$i_sysstatvfs'
22140 i_systime='$i_systime'
22141 i_systimek='$i_systimek'
22142 i_systimes='$i_systimes'
22143 i_systypes='$i_systypes'
22144 i_sysuio='$i_sysuio'
22145 i_sysun='$i_sysun'
22146 i_sysutsname='$i_sysutsname'
22147 i_sysvfs='$i_sysvfs'
22148 i_syswait='$i_syswait'
22149 i_termio='$i_termio'
22150 i_termios='$i_termios'
22151 i_time='$i_time'
22152 i_unistd='$i_unistd'
22153 i_ustat='$i_ustat'
22154 i_utime='$i_utime'
22155 i_values='$i_values'
22156 i_varargs='$i_varargs'
22157 i_varhdr='$i_varhdr'
22158 i_vfork='$i_vfork'
22159 ignore_versioned_solibs='$ignore_versioned_solibs'
22160 inc_version_list='$inc_version_list'
22161 inc_version_list_init='$inc_version_list_init'
22162 incpath='$incpath'
22163 inews='$inews'
22164 initialinstalllocation='$initialinstalllocation'
22165 installarchlib='$installarchlib'
22166 installbin='$installbin'
22167 installhtml1dir='$installhtml1dir'
22168 installhtml3dir='$installhtml3dir'
22169 installman1dir='$installman1dir'
22170 installman3dir='$installman3dir'
22171 installprefix='$installprefix'
22172 installprefixexp='$installprefixexp'
22173 installprivlib='$installprivlib'
22174 installscript='$installscript'
22175 installsitearch='$installsitearch'
22176 installsitebin='$installsitebin'
22177 installsitehtml1dir='$installsitehtml1dir'
22178 installsitehtml3dir='$installsitehtml3dir'
22179 installsitelib='$installsitelib'
22180 installsiteman1dir='$installsiteman1dir'
22181 installsiteman3dir='$installsiteman3dir'
22182 installsitescript='$installsitescript'
22183 installstyle='$installstyle'
22184 installusrbinperl='$installusrbinperl'
22185 installvendorarch='$installvendorarch'
22186 installvendorbin='$installvendorbin'
22187 installvendorhtml1dir='$installvendorhtml1dir'
22188 installvendorhtml3dir='$installvendorhtml3dir'
22189 installvendorlib='$installvendorlib'
22190 installvendorman1dir='$installvendorman1dir'
22191 installvendorman3dir='$installvendorman3dir'
22192 installvendorscript='$installvendorscript'
22193 intsize='$intsize'
22194 issymlink='$issymlink'
22195 ivdformat='$ivdformat'
22196 ivsize='$ivsize'
22197 ivtype='$ivtype'
22198 known_extensions='$known_extensions'
22199 ksh='$ksh'
22200 ld='$ld'
22201 lddlflags='$lddlflags'
22202 ldflags='$ldflags'
22203 ldflags_uselargefiles='$ldflags_uselargefiles'
22204 ldlibpthname='$ldlibpthname'
22205 less='$less'
22206 lib_ext='$lib_ext'
22207 libc='$libc'
22208 libperl='$libperl'
22209 libpth='$libpth'
22210 libs='$libs'
22211 libsdirs='$libsdirs'
22212 libsfiles='$libsfiles'
22213 libsfound='$libsfound'
22214 libspath='$libspath'
22215 libswanted='$libswanted'
22216 libswanted_uselargefiles='$libswanted_uselargefiles'
22217 line='$line'
22218 lint='$lint'
22219 lkflags='$lkflags'
22220 ln='$ln'
22221 lns='$lns'
22222 localtime_r_proto='$localtime_r_proto'
22223 locincpth='$locincpth'
22224 loclibpth='$loclibpth'
22225 longdblsize='$longdblsize'
22226 longlongsize='$longlongsize'
22227 longsize='$longsize'
22228 lp='$lp'
22229 lpr='$lpr'
22230 ls='$ls'
22231 lseeksize='$lseeksize'
22232 lseektype='$lseektype'
22233 mad='$mad'
22234 madlyh='$madlyh'
22235 madlyobj='$madlyobj'
22236 madlysrc='$madlysrc'
22237 mail='$mail'
22238 mailx='$mailx'
22239 make='$make'
22240 make_set_make='$make_set_make'
22241 mallocobj='$mallocobj'
22242 mallocsrc='$mallocsrc'
22243 malloctype='$malloctype'
22244 man1dir='$man1dir'
22245 man1direxp='$man1direxp'
22246 man1ext='$man1ext'
22247 man3dir='$man3dir'
22248 man3direxp='$man3direxp'
22249 man3ext='$man3ext'
22250 mips_type='$mips_type'
22251 mistrustnm='$mistrustnm'
22252 mkdir='$mkdir'
22253 mmaptype='$mmaptype'
22254 modetype='$modetype'
22255 more='$more'
22256 multiarch='$multiarch'
22257 mv='$mv'
22258 myarchname='$myarchname'
22259 mydomain='$mydomain'
22260 myhostname='$myhostname'
22261 myuname='$myuname'
22262 n='$n'
22263 need_va_copy='$need_va_copy'
22264 netdb_hlen_type='$netdb_hlen_type'
22265 netdb_host_type='$netdb_host_type'
22266 netdb_name_type='$netdb_name_type'
22267 netdb_net_type='$netdb_net_type'
22268 nm='$nm'
22269 nm_opt='$nm_opt'
22270 nm_so_opt='$nm_so_opt'
22271 nonxs_ext='$nonxs_ext'
22272 nroff='$nroff'
22273 nvEUformat='$nvEUformat'
22274 nvFUformat='$nvFUformat'
22275 nvGUformat='$nvGUformat'
22276 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22277 nveformat='$nveformat'
22278 nvfformat='$nvfformat'
22279 nvgformat='$nvgformat'
22280 nvsize='$nvsize'
22281 nvtype='$nvtype'
22282 o_nonblock='$o_nonblock'
22283 obj_ext='$obj_ext'
22284 old_pthread_create_joinable='$old_pthread_create_joinable'
22285 optimize='$optimize'
22286 orderlib='$orderlib'
22287 osname='$osname'
22288 osvers='$osvers'
22289 otherlibdirs='$otherlibdirs'
22290 package='$package'
22291 pager='$pager'
22292 passcat='$passcat'
22293 patchlevel='$patchlevel'
22294 path_sep='$path_sep'
22295 perl5='$perl5'
22296 perl='$perl'
22297 perl_patchlevel='$perl_patchlevel'
22298 perladmin='$perladmin'
22299 perllibs='$perllibs'
22300 perlpath='$perlpath'
22301 pg='$pg'
22302 phostname='$phostname'
22303 pidtype='$pidtype'
22304 plibpth='$plibpth'
22305 pmake='$pmake'
22306 pr='$pr'
22307 prefix='$prefix'
22308 prefixexp='$prefixexp'
22309 privlib='$privlib'
22310 privlibexp='$privlibexp'
22311 procselfexe='$procselfexe'
22312 prototype='$prototype'
22313 ptrsize='$ptrsize'
22314 quadkind='$quadkind'
22315 quadtype='$quadtype'
22316 randbits='$randbits'
22317 randfunc='$randfunc'
22318 random_r_proto='$random_r_proto'
22319 randseedtype='$randseedtype'
22320 ranlib='$ranlib'
22321 rd_nodata='$rd_nodata'
22322 readdir64_r_proto='$readdir64_r_proto'
22323 readdir_r_proto='$readdir_r_proto'
22324 revision='$revision'
22325 rm='$rm'
22326 rmail='$rmail'
22327 run='$run'
22328 runnm='$runnm'
22329 sPRIEUldbl='$sPRIEUldbl'
22330 sPRIFUldbl='$sPRIFUldbl'
22331 sPRIGUldbl='$sPRIGUldbl'
22332 sPRIXU64='$sPRIXU64'
22333 sPRId64='$sPRId64'
22334 sPRIeldbl='$sPRIeldbl'
22335 sPRIfldbl='$sPRIfldbl'
22336 sPRIgldbl='$sPRIgldbl'
22337 sPRIi64='$sPRIi64'
22338 sPRIo64='$sPRIo64'
22339 sPRIu64='$sPRIu64'
22340 sPRIx64='$sPRIx64'
22341 sSCNfldbl='$sSCNfldbl'
22342 sched_yield='$sched_yield'
22343 scriptdir='$scriptdir'
22344 scriptdirexp='$scriptdirexp'
22345 sed='$sed'
22346 seedfunc='$seedfunc'
22347 selectminbits='$selectminbits'
22348 selecttype='$selecttype'
22349 sendmail='$sendmail'
22350 setgrent_r_proto='$setgrent_r_proto'
22351 sethostent_r_proto='$sethostent_r_proto'
22352 setlocale_r_proto='$setlocale_r_proto'
22353 setnetent_r_proto='$setnetent_r_proto'
22354 setprotoent_r_proto='$setprotoent_r_proto'
22355 setpwent_r_proto='$setpwent_r_proto'
22356 setservent_r_proto='$setservent_r_proto'
22357 sh='$sh'
22358 shar='$shar'
22359 sharpbang='$sharpbang'
22360 shmattype='$shmattype'
22361 shortsize='$shortsize'
22362 shrpenv='$shrpenv'
22363 shsharp='$shsharp'
22364 sig_count='$sig_count'
22365 sig_name='$sig_name'
22366 sig_name_init='$sig_name_init'
22367 sig_num='$sig_num'
22368 sig_num_init='$sig_num_init'
22369 sig_size='$sig_size'
22370 signal_t='$signal_t'
22371 sitearch='$sitearch'
22372 sitearchexp='$sitearchexp'
22373 sitebin='$sitebin'
22374 sitebinexp='$sitebinexp'
22375 sitehtml1dir='$sitehtml1dir'
22376 sitehtml1direxp='$sitehtml1direxp'
22377 sitehtml3dir='$sitehtml3dir'
22378 sitehtml3direxp='$sitehtml3direxp'
22379 sitelib='$sitelib'
22380 sitelib_stem='$sitelib_stem'
22381 sitelibexp='$sitelibexp'
22382 siteman1dir='$siteman1dir'
22383 siteman1direxp='$siteman1direxp'
22384 siteman3dir='$siteman3dir'
22385 siteman3direxp='$siteman3direxp'
22386 siteprefix='$siteprefix'
22387 siteprefixexp='$siteprefixexp'
22388 sitescript='$sitescript'
22389 sitescriptexp='$sitescriptexp'
22390 sizesize='$sizesize'
22391 sizetype='$sizetype'
22392 sleep='$sleep'
22393 smail='$smail'
22394 so='$so'
22395 sockethdr='$sockethdr'
22396 socketlib='$socketlib'
22397 socksizetype='$socksizetype'
22398 sort='$sort'
22399 spackage='$spackage'
22400 spitshell='$spitshell'
22401 srand48_r_proto='$srand48_r_proto'
22402 srandom_r_proto='$srandom_r_proto'
22403 src='$src'
22404 ssizetype='$ssizetype'
22405 startperl='$startperl'
22406 startsh='$startsh'
22407 static_ext='$static_ext'
22408 stdchar='$stdchar'
22409 stdio_base='$stdio_base'
22410 stdio_bufsiz='$stdio_bufsiz'
22411 stdio_cnt='$stdio_cnt'
22412 stdio_filbuf='$stdio_filbuf'
22413 stdio_ptr='$stdio_ptr'
22414 stdio_stream_array='$stdio_stream_array'
22415 strerror_r_proto='$strerror_r_proto'
22416 strings='$strings'
22417 submit='$submit'
22418 subversion='$subversion'
22419 sysman='$sysman'
22420 tail='$tail'
22421 tar='$tar'
22422 targetarch='$targetarch'
22423 tbl='$tbl'
22424 tee='$tee'
22425 test='$test'
22426 timeincl='$timeincl'
22427 timetype='$timetype'
22428 tmpnam_r_proto='$tmpnam_r_proto'
22429 to='$to'
22430 touch='$touch'
22431 tr='$tr'
22432 trnl='$trnl'
22433 troff='$troff'
22434 ttyname_r_proto='$ttyname_r_proto'
22435 u16size='$u16size'
22436 u16type='$u16type'
22437 u32size='$u32size'
22438 u32type='$u32type'
22439 u64size='$u64size'
22440 u64type='$u64type'
22441 u8size='$u8size'
22442 u8type='$u8type'
22443 uidformat='$uidformat'
22444 uidsign='$uidsign'
22445 uidsize='$uidsize'
22446 uidtype='$uidtype'
22447 uname='$uname'
22448 uniq='$uniq'
22449 uquadtype='$uquadtype'
22450 use5005threads='$use5005threads'
22451 use64bitall='$use64bitall'
22452 use64bitint='$use64bitint'
22453 usecrosscompile='$usecrosscompile'
22454 usedl='$usedl'
22455 usefaststdio='$usefaststdio'
22456 useithreads='$useithreads'
22457 uselargefiles='$uselargefiles'
22458 uselongdouble='$uselongdouble'
22459 usemallocwrap='$usemallocwrap'
22460 usemorebits='$usemorebits'
22461 usemultiplicity='$usemultiplicity'
22462 usemymalloc='$usemymalloc'
22463 usenm='$usenm'
22464 useopcode='$useopcode'
22465 useperlio='$useperlio'
22466 useposix='$useposix'
22467 usereentrant='$usereentrant'
22468 userelocatableinc='$userelocatableinc'
22469 usesfio='$usesfio'
22470 useshrplib='$useshrplib'
22471 usesitecustomize='$usesitecustomize'
22472 usesocks='$usesocks'
22473 usethreads='$usethreads'
22474 usevendorprefix='$usevendorprefix'
22475 usevfork='$usevfork'
22476 usrinc='$usrinc'
22477 uuname='$uuname'
22478 uvXUformat='$uvXUformat'
22479 uvoformat='$uvoformat'
22480 uvsize='$uvsize'
22481 uvtype='$uvtype'
22482 uvuformat='$uvuformat'
22483 uvxformat='$uvxformat'
22484 vendorarch='$vendorarch'
22485 vendorarchexp='$vendorarchexp'
22486 vendorbin='$vendorbin'
22487 vendorbinexp='$vendorbinexp'
22488 vendorhtml1dir='$vendorhtml1dir'
22489 vendorhtml1direxp='$vendorhtml1direxp'
22490 vendorhtml3dir='$vendorhtml3dir'
22491 vendorhtml3direxp='$vendorhtml3direxp'
22492 vendorlib='$vendorlib'
22493 vendorlib_stem='$vendorlib_stem'
22494 vendorlibexp='$vendorlibexp'
22495 vendorman1dir='$vendorman1dir'
22496 vendorman1direxp='$vendorman1direxp'
22497 vendorman3dir='$vendorman3dir'
22498 vendorman3direxp='$vendorman3direxp'
22499 vendorprefix='$vendorprefix'
22500 vendorprefixexp='$vendorprefixexp'
22501 vendorscript='$vendorscript'
22502 vendorscriptexp='$vendorscriptexp'
22503 version='$version'
22504 version_patchlevel_string='$version_patchlevel_string'
22505 versiononly='$versiononly'
22506 vi='$vi'
22507 voidflags='$voidflags'
22508 xlibpth='$xlibpth'
22509 yacc='$yacc'
22510 yaccflags='$yaccflags'
22511 zcat='$zcat'
22512 zip='$zip'
22513 EOT
22514
22515 : Add in command line options if available
22516 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22517
22518 : add special variables
22519 $test -f $src/patchlevel.h && \
22520 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22521 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22522 echo "PERL_CONFIG_SH=true" >>config.sh
22523
22524 : propagate old symbols
22525 if $test -f UU/config.sh; then
22526         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22527         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22528         $sort | $uniq -u >UU/oldsyms
22529         set X `cat UU/oldsyms`
22530         shift
22531         case $# in
22532         0) ;;
22533         *)
22534                 cat <<EOM
22535 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22536 EOM
22537                 echo "# Variables propagated from previous config.sh file." >>config.sh
22538                 for sym in `cat UU/oldsyms`; do
22539                         echo "    Propagating $hint variable "'$'"$sym..."
22540                         eval 'tmp="$'"${sym}"'"'
22541                         echo "$tmp" | \
22542                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22543                 done
22544                 ;;
22545         esac
22546 fi
22547
22548 : Finish up by extracting the .SH files
22549 case "$alldone" in
22550 exit)
22551         $rm -rf UU
22552         echo "Extraction done."
22553         exit 0
22554         ;;
22555 cont)
22556         ;;
22557 '')
22558         dflt=''
22559         nostick=true
22560         $cat <<EOM
22561
22562 If you'd like to make any changes to the config.sh file before I begin
22563 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22564
22565 EOM
22566         rp="Press return or use a shell escape to edit config.sh:"
22567         . UU/myread
22568         nostick=''
22569         case "$ans" in
22570         '') ;;
22571         *) : in case they cannot read
22572                 sh 1>&4 -c "$ans";;
22573         esac
22574         ;;
22575 esac
22576
22577 : if this fails, just run all the .SH files by hand
22578 . ./config.sh
22579
22580 echo " "
22581 exec 1>&4
22582 pwd=`pwd`
22583 . ./UU/extract
22584 cd "$pwd"
22585
22586 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22587         dflt=y
22588         case "$silent" in
22589         true) ;;
22590         *)
22591                 $cat <<EOM
22592
22593 Now you need to generate make dependencies by running "$make depend".
22594 You might prefer to run it in background: "$make depend > makedepend.out &"
22595 It can take a while, so you might not want to run it right now.
22596
22597 EOM
22598                 ;;
22599         esac
22600         rp="Run $make depend now?"
22601         . UU/myread
22602         case "$ans" in
22603         y*)
22604                 $make depend && echo "Now you must run '$make'."
22605                 ;;
22606         *)
22607                 echo "You must run '$make depend' then '$make'."
22608                 ;;
22609         esac
22610 elif test -f [Mm]akefile; then
22611         echo " "
22612         echo "Now you must run a $make."
22613 else
22614         echo "Configure done."
22615 fi
22616
22617 if $test -f Policy.sh; then
22618     $cat <<EOM
22619
22620 If you compile $package on a different machine or from a different object
22621 directory, copy the Policy.sh file from this object directory to the
22622 new one before you run Configure -- this will help you with most of
22623 the policy defaults.
22624
22625 EOM
22626 fi
22627 if $test -f config.msg; then
22628     echo "Hmm.  I also noted the following information while running:"
22629     echo " "
22630     $cat config.msg >&4
22631     $rm -f config.msg
22632 fi
22633 $rm -f kit*isdone ark*isdone
22634 $rm -rf UU
22635
22636 : End of Configure
22637